summaryrefslogtreecommitdiff
path: root/layout/style
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2022-06-10 07:35:22 +0000
committerMoonchild <moonchild@palemoon.org>2022-06-10 07:35:22 +0000
commit9ad788853f6f2be403ec54d1c56e8bd608014f02 (patch)
tree60432437fd2c907483ede17e1f566b45792189a6 /layout/style
parentd8070a8e0d7f6df5ac864e4052bc293f5442b967 (diff)
downloaduxp-9ad788853f6f2be403ec54d1c56e8bd608014f02.tar.gz
Issue #1914 - Implement white-space: break-spaces
This also simplifies GetCSSWhitespaceToCompressionMode (FFS with the function names, Mozilla!) to be less fragile.
Diffstat (limited to 'layout/style')
-rw-r--r--layout/style/nsCSSKeywordList.h1
-rw-r--r--layout/style/nsCSSProps.cpp1
-rw-r--r--layout/style/nsStyleConsts.h13
-rw-r--r--layout/style/nsStyleStruct.h7
-rw-r--r--layout/style/test/property_database.js2
5 files changed, 16 insertions, 8 deletions
diff --git a/layout/style/nsCSSKeywordList.h b/layout/style/nsCSSKeywordList.h
index 7e661bc483..d6486b18cf 100644
--- a/layout/style/nsCSSKeywordList.h
+++ b/layout/style/nsCSSKeywordList.h
@@ -171,6 +171,7 @@ CSS_KEY(both, both)
CSS_KEY(bottom, bottom)
CSS_KEY(bottom-outside, bottom_outside)
CSS_KEY(break-all, break_all)
+CSS_KEY(break-spaces, break_spaces)
CSS_KEY(break-word, break_word)
CSS_KEY(brightness, brightness)
CSS_KEY(browser, browser)
diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp
index 4aff3dc5bf..f084e45992 100644
--- a/layout/style/nsCSSProps.cpp
+++ b/layout/style/nsCSSProps.cpp
@@ -2251,6 +2251,7 @@ const KTableEntry nsCSSProps::kWhitespaceKTable[] = {
{ eCSSKeyword_pre_wrap, NS_STYLE_WHITESPACE_PRE_WRAP },
{ eCSSKeyword_pre_line, NS_STYLE_WHITESPACE_PRE_LINE },
{ eCSSKeyword__moz_pre_space, NS_STYLE_WHITESPACE_PRE_SPACE },
+ { eCSSKeyword_break_spaces, NS_STYLE_WHITESPACE_BREAK_SPACES },
{ eCSSKeyword_UNKNOWN, -1 }
};
diff --git a/layout/style/nsStyleConsts.h b/layout/style/nsStyleConsts.h
index 4d2043cc47..9cb3c9edea 100644
--- a/layout/style/nsStyleConsts.h
+++ b/layout/style/nsStyleConsts.h
@@ -993,12 +993,13 @@ enum class StyleDisplay : uint8_t {
#define NS_STYLE_TABSIZE_INITIAL 8
// See nsStyleText
-#define NS_STYLE_WHITESPACE_NORMAL 0
-#define NS_STYLE_WHITESPACE_PRE 1
-#define NS_STYLE_WHITESPACE_NOWRAP 2
-#define NS_STYLE_WHITESPACE_PRE_WRAP 3
-#define NS_STYLE_WHITESPACE_PRE_LINE 4
-#define NS_STYLE_WHITESPACE_PRE_SPACE 5
+#define NS_STYLE_WHITESPACE_NORMAL 0
+#define NS_STYLE_WHITESPACE_PRE 1
+#define NS_STYLE_WHITESPACE_NOWRAP 2
+#define NS_STYLE_WHITESPACE_PRE_WRAP 3
+#define NS_STYLE_WHITESPACE_PRE_LINE 4
+#define NS_STYLE_WHITESPACE_PRE_SPACE 5
+#define NS_STYLE_WHITESPACE_BREAK_SPACES 6
// See nsStyleText
#define NS_STYLE_WORDBREAK_NORMAL 0
diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h
index a01685cc44..da9643594e 100644
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -2105,30 +2105,35 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleText
bool WhiteSpaceIsSignificant() const {
return mWhiteSpace == NS_STYLE_WHITESPACE_PRE ||
mWhiteSpace == NS_STYLE_WHITESPACE_PRE_WRAP ||
+ mWhiteSpace == NS_STYLE_WHITESPACE_BREAK_SPACES ||
mWhiteSpace == NS_STYLE_WHITESPACE_PRE_SPACE;
}
bool NewlineIsSignificantStyle() const {
return mWhiteSpace == NS_STYLE_WHITESPACE_PRE ||
mWhiteSpace == NS_STYLE_WHITESPACE_PRE_WRAP ||
+ mWhiteSpace == NS_STYLE_WHITESPACE_BREAK_SPACES ||
mWhiteSpace == NS_STYLE_WHITESPACE_PRE_LINE;
}
bool WhiteSpaceOrNewlineIsSignificant() const {
return mWhiteSpace == NS_STYLE_WHITESPACE_PRE ||
mWhiteSpace == NS_STYLE_WHITESPACE_PRE_WRAP ||
+ mWhiteSpace == NS_STYLE_WHITESPACE_BREAK_SPACES ||
mWhiteSpace == NS_STYLE_WHITESPACE_PRE_LINE ||
mWhiteSpace == NS_STYLE_WHITESPACE_PRE_SPACE;
}
bool TabIsSignificant() const {
return mWhiteSpace == NS_STYLE_WHITESPACE_PRE ||
- mWhiteSpace == NS_STYLE_WHITESPACE_PRE_WRAP;
+ mWhiteSpace == NS_STYLE_WHITESPACE_PRE_WRAP ||
+ mWhiteSpace == NS_STYLE_WHITESPACE_BREAK_SPACES;
}
bool WhiteSpaceCanWrapStyle() const {
return mWhiteSpace == NS_STYLE_WHITESPACE_NORMAL ||
mWhiteSpace == NS_STYLE_WHITESPACE_PRE_WRAP ||
+ mWhiteSpace == NS_STYLE_WHITESPACE_BREAK_SPACES ||
mWhiteSpace == NS_STYLE_WHITESPACE_PRE_LINE;
}
diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js
index 5c6e2f6d86..0abe930832 100644
--- a/layout/style/test/property_database.js
+++ b/layout/style/test/property_database.js
@@ -4052,7 +4052,7 @@ var gCSSProperties = {
inherited: true,
type: CSS_TYPE_LONGHAND,
initial_values: [ "normal" ],
- other_values: [ "pre", "nowrap", "pre-wrap", "pre-line", "-moz-pre-space" ],
+ other_values: [ "pre", "nowrap", "pre-wrap", "pre-line", "-moz-pre-space", "break-spaces" ],
invalid_values: []
},
"width": {