[css-text] New value 'break-spaces' for the white-space property
Finally the CSS WG decided [1] to move back the 'break-spaces' value to
the 'white-space' property. This makes the parsing logic easier than
the previous approach of using the 'overflow-wrap' property.
This new value prevents the white-space sequence to collapse and gives
breaking opportunities after every preserved white-space.
https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces
Additionally, unlike 'pre-wrap', non-collapsible spaces or tabs at the
end of a line cannot be hung or visually collapsed, since we want them
to be preserved and broken.
[1] https://github.com/w3c/csswg-drafts/pull/2841
Bug: 767634
Change-Id: I55e888d4472de11c64c4b14e2710c6e3d1832e67
Reviewed-on: https://chromium-review.googlesource.com/c/1136543
Reviewed-by: Koji Ishii <kojii@chromium.org>
Commit-Queue: Javier Fernandez <jfernandez@igalia.com>
Cr-Commit-Position: refs/heads/master@{#623324}
diff --git a/third_party/blink/renderer/build/scripts/core/style/templates/computed_style_base_constants.h.tmpl b/third_party/blink/renderer/build/scripts/core/style/templates/computed_style_base_constants.h.tmpl
index aee3668a..9ca650e2 100644
--- a/third_party/blink/renderer/build/scripts/core/style/templates/computed_style_base_constants.h.tmpl
+++ b/third_party/blink/renderer/build/scripts/core/style/templates/computed_style_base_constants.h.tmpl
@@ -14,7 +14,7 @@
{% for enum in enums %}
enum class {{enum.type_name}} : unsigned {
{% for value in enum.values %}
- {{value}}{{print_if(enum.is_set, " = " ~ (0 if loop.first else 2**loop.index0))}},
+ {{value}}{{print_if(enum.is_set, " = " ~ (0 if loop.first else 2**(loop.index0 - 1)))}},
{% endfor %}
};
diff --git a/third_party/blink/renderer/core/css/css_properties.json5 b/third_party/blink/renderer/core/css/css_properties.json5
index 8bab7d7d..316e06a 100644
--- a/third_party/blink/renderer/core/css/css_properties.json5
+++ b/third_party/blink/renderer/core/css/css_properties.json5
@@ -3961,9 +3961,9 @@
property_methods: ["CSSValueFromComputedStyleInternal"],
independent: true,
inherited: true,
- field_template: "keyword",
+ field_template: "multi_keyword", // We use a bitflag field due peformance issues
keywords: [
- "normal", "pre", "pre-wrap", "pre-line", "nowrap", "-webkit-nowrap"
+ "none", "normal", "pre", "pre-wrap", "pre-line", "nowrap", "-webkit-nowrap", "break-spaces"
],
typedom_types: ["Keyword"],
default_value: "normal",
diff --git a/third_party/blink/renderer/core/css/css_value_keywords.json5 b/third_party/blink/renderer/core/css/css_value_keywords.json5
index c2dc5e6..bfa19f63 100644
--- a/third_party/blink/renderer/core/css/css_value_keywords.json5
+++ b/third_party/blink/renderer/core/css/css_value_keywords.json5
@@ -455,6 +455,7 @@
"bidi-override",
"blink",
"both",
+ "break-spaces",
"close-quote",
"embed",
"fixed",
diff --git a/third_party/blink/renderer/core/css/parser/css_parser_fast_paths.cc b/third_party/blink/renderer/core/css/parser/css_parser_fast_paths.cc
index 07d25b3..45e7ba7 100644
--- a/third_party/blink/renderer/core/css/parser/css_parser_fast_paths.cc
+++ b/third_party/blink/renderer/core/css/parser/css_parser_fast_paths.cc
@@ -877,7 +877,9 @@
case CSSPropertyWhiteSpace:
return value_id == CSSValueNormal || value_id == CSSValuePre ||
value_id == CSSValuePreWrap || value_id == CSSValuePreLine ||
- value_id == CSSValueNowrap;
+ value_id == CSSValueNowrap ||
+ (RuntimeEnabledFeatures::CSS3TextBreakSpacesEnabled() &&
+ value_id == CSSValueBreakSpaces);
case CSSPropertyWordBreak:
return value_id == CSSValueNormal || value_id == CSSValueBreakAll ||
value_id == CSSValueKeepAll || value_id == CSSValueBreakWord;
diff --git a/third_party/blink/renderer/core/layout/line/breaking_context_inline_headers.h b/third_party/blink/renderer/core/layout/line/breaking_context_inline_headers.h
index bc06df1..e0a65b1a 100644
--- a/third_party/blink/renderer/core/layout/line/breaking_context_inline_headers.h
+++ b/third_party/blink/renderer/core/layout/line/breaking_context_inline_headers.h
@@ -125,6 +125,7 @@
const Font&,
bool apply_word_spacing,
float word_spacing);
+ void TrailingSpacesHang(bool can_break_mid_word);
bool TrailingSpaceExceedsAvailableWidth(bool can_break_mid_word,
const LineLayoutText&,
WordMeasurement&,
@@ -205,6 +206,7 @@
bool at_start_;
bool ignoring_spaces_;
bool current_character_is_space_;
+ bool previous_character_is_space_;
bool single_leading_space_;
unsigned current_start_offset_; // initial offset for the current text
bool applied_start_width_;
@@ -1044,7 +1046,7 @@
layout_text_info_.line_break_iterator_.SecondToLastCharacter();
for (; current_.Offset() < layout_text.TextLength();
current_.FastIncrementInTextNode()) {
- bool previous_character_is_space = current_character_is_space_;
+ previous_character_is_space_ = current_character_is_space_;
UChar c = current_.Current();
SetCurrentCharacterIsSpace(c);
@@ -1106,7 +1108,7 @@
}
PrepareForNextCharacter(layout_text, prohibit_break_inside,
- previous_character_is_space);
+ previous_character_is_space_);
at_start_ = false;
NextCharacter(c, last_character, second_to_last_character);
continue;
@@ -1146,7 +1148,7 @@
// We keep track of the total width contributed by trailing space as we
// often want to exclude it when determining
// if a run fits on a line.
- if (collapse_white_space_ && previous_character_is_space &&
+ if (collapse_white_space_ && previous_character_is_space_ &&
current_character_is_space_ && last_width_measurement)
width_.SetTrailingWhitespaceWidth(last_width_measurement);
@@ -1210,7 +1212,7 @@
if (CanBreakAtWhitespace(
break_words, word_measurement, stopped_ignoring_spaces, char_width,
hyphenated, disable_soft_hyphen, hyphen_width, between_words,
- mid_word_break, can_break_mid_word, previous_character_is_space,
+ mid_word_break, can_break_mid_word, previous_character_is_space_,
last_width_measurement, layout_text, font, apply_word_spacing,
word_spacing))
return false;
@@ -1250,7 +1252,7 @@
// go ahead and break up this run and enter a mode where we start collapsing
// spaces.
if (!ignoring_spaces_ && current_style_->CollapseWhiteSpace()) {
- if (current_character_is_space_ && previous_character_is_space) {
+ if (current_character_is_space_ && previous_character_is_space_) {
ignoring_spaces_ = true;
// We just entered a mode where we are ignoring spaces. Create a
@@ -1263,7 +1265,7 @@
}
PrepareForNextCharacter(layout_text, prohibit_break_inside,
- previous_character_is_space);
+ previous_character_is_space_);
at_start_ = false;
is_line_empty = line_info_.IsEmpty();
NextCharacter(c, last_character, second_to_last_character);
@@ -1417,6 +1419,22 @@
return word_measurement;
}
+inline void BreakingContext::TrailingSpacesHang(bool can_break_mid_word) {
+ DCHECK(curr_ws_ == EWhiteSpace::kBreakSpaces);
+ // Avoid breaking before the first white-space after a word if there is a
+ // breaking opportunity before.
+ if (single_leading_space_ && !previous_character_is_space_)
+ return;
+
+ line_break_.MoveTo(current_.GetLineLayoutItem(), current_.Offset(),
+ current_.NextBreakablePosition());
+
+ // Avoid breaking before the first white-space after a word, unless
+ // overflow-wrap or word-break allow to.
+ if (!previous_character_is_space_ && !can_break_mid_word)
+ line_break_.Increment();
+}
+
inline bool BreakingContext::TrailingSpaceExceedsAvailableWidth(
bool can_break_mid_word,
const LineLayoutText& layout_text,
@@ -1439,8 +1457,13 @@
// then move the line break to the space and skip all
// additional whitespace.
if (!width_.FitsOnLine(char_width)) {
+ if (curr_ws_ == EWhiteSpace::kBreakSpaces) {
+ TrailingSpacesHang(can_break_mid_word);
+ return true;
+ }
line_break_.MoveTo(current_.GetLineLayoutItem(), current_.Offset(),
current_.NextBreakablePosition());
+
SkipTrailingWhitespace(line_break_, line_info_);
return true;
}
diff --git a/third_party/blink/renderer/core/style/computed_style.cc b/third_party/blink/renderer/core/style/computed_style.cc
index 5af5ed71..e8f274d5 100644
--- a/third_party/blink/renderer/core/style/computed_style.cc
+++ b/third_party/blink/renderer/core/style/computed_style.cc
@@ -85,6 +85,7 @@
// Since different compilers/architectures pack ComputedStyle differently,
// re-create the same structure for an accurate size comparison.
struct SameSizeAsComputedStyle : public RefCounted<SameSizeAsComputedStyle> {
+ unsigned extra_;
struct ComputedStyleBase {
void* data_refs[7];
unsigned bitfields_[4];
diff --git a/third_party/blink/renderer/core/style/computed_style.h b/third_party/blink/renderer/core/style/computed_style.h
index 0e7918f4..6948bb1 100644
--- a/third_party/blink/renderer/core/style/computed_style.h
+++ b/third_party/blink/renderer/core/style/computed_style.h
@@ -2129,9 +2129,13 @@
}
// Whitespace utility functions.
+ static bool Is(EWhiteSpace a, EWhiteSpace b) {
+ return static_cast<unsigned>(a) & static_cast<unsigned>(b);
+ }
+ static bool IsNot(EWhiteSpace a, EWhiteSpace b) { return !Is(a, b); }
static bool AutoWrap(EWhiteSpace ws) {
// Nowrap and pre don't automatically wrap.
- return ws != EWhiteSpace::kNowrap && ws != EWhiteSpace::kPre;
+ return IsNot(ws, EWhiteSpace::kNowrap | EWhiteSpace::kPre);
}
bool AutoWrap() const { return AutoWrap(WhiteSpace()); }
@@ -2149,7 +2153,8 @@
static bool CollapseWhiteSpace(EWhiteSpace ws) {
// Pre and prewrap do not collapse whitespace.
- return ws != EWhiteSpace::kPre && ws != EWhiteSpace::kPreWrap;
+ return IsNot(ws, EWhiteSpace::kPre | EWhiteSpace::kPreWrap |
+ EWhiteSpace::kBreakSpaces);
}
bool CollapseWhiteSpace() const { return CollapseWhiteSpace(WhiteSpace()); }
@@ -2165,15 +2170,15 @@
return false;
}
bool BreakOnlyAfterWhiteSpace() const {
- return WhiteSpace() == EWhiteSpace::kPreWrap ||
+ return Is(WhiteSpace(),
+ EWhiteSpace::kPreWrap | EWhiteSpace::kBreakSpaces) ||
GetLineBreak() == LineBreak::kAfterWhiteSpace;
}
bool BreakWords() const {
return (WordBreak() == EWordBreak::kBreakWord ||
OverflowWrap() == EOverflowWrap::kBreakWord) &&
- WhiteSpace() != EWhiteSpace::kPre &&
- WhiteSpace() != EWhiteSpace::kNowrap;
+ IsNot(WhiteSpace(), EWhiteSpace::kPre | EWhiteSpace::kNowrap);
}
// Text direction utility functions.
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5
index 1d43fad..df5af48 100644
--- a/third_party/blink/renderer/platform/runtime_enabled_features.json5
+++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
@@ -244,6 +244,10 @@
status: "experimental",
},
{
+ name: "CSS3TextBreakSpaces",
+ status: "experimental",
+ },
+ {
name: "CSSAdditiveAnimations",
depends_on: ["StackedCSSPropertyAnimations"],
status: "experimental",
diff --git a/third_party/blink/web_tests/FlagExpectations/enable-blink-features=LayoutNG b/third_party/blink/web_tests/FlagExpectations/enable-blink-features=LayoutNG
index 7dfbfe7c..5664e5e6 100644
--- a/third_party/blink/web_tests/FlagExpectations/enable-blink-features=LayoutNG
+++ b/third_party/blink/web_tests/FlagExpectations/enable-blink-features=LayoutNG
@@ -62,6 +62,29 @@
crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/sizing/vert-block-size-small-or-larger-than-container-with-min-or-max-content-2a.html [ Pass ]
crbug.com/613663 external/wpt/quirks/table-cell-width-calculation.html [ Failure ]
+# The new 'break-spaces' value is not implemented yet in LayoutNG
+crbug.com/922437 external/wpt/css/css-text/white-space/break-spaces-001.html [ Skip ]
+crbug.com/922437 external/wpt/css/css-text/white-space/break-spaces-002.html [ Skip ]
+crbug.com/922437 external/wpt/css/css-text/white-space/break-spaces-003.html [ Skip ]
+crbug.com/922437 external/wpt/css/css-text/white-space/break-spaces-004.html [ Skip ]
+crbug.com/922437 external/wpt/css/css-text/white-space/break-spaces-005.html [ Skip ]
+crbug.com/922437 external/wpt/css/css-text/white-space/break-spaces-006.html [ Skip ]
+crbug.com/922437 external/wpt/css/css-text/white-space/break-spaces-007.html [ Skip ]
+crbug.com/922437 external/wpt/css/css-text/white-space/break-spaces-008.html [ Skip ]
+crbug.com/922437 external/wpt/css/css-text/white-space/textarea-break-spaces-001.html [ Skip ]
+crbug.com/922437 external/wpt/css/css-text/white-space/textarea-break-spaces-002.html [ Skip ]
+crbug.com/922437 external/wpt/css/css-text/white-space/tab-stop-threshold-005.html [ Skip ]
+crbug.com/922437 external/wpt/css/css-text/white-space/tab-stop-threshold-006.html [ Skip ]
+crbug.com/922437 external/wpt/css/css-text/white-space/white-space-intrinsic-size-001.html [ Skip ]
+crbug.com/922437 external/wpt/css/css-text/white-space/white-space-intrinsic-size-002.html [ Skip ]
+crbug.com/922437 external/wpt/css/css-text/word-break/word-break-break-all-012.html [ Skip ]
+crbug.com/922437 external/wpt/css/css-text/word-break/word-break-break-all-013.html [ Skip ]
+crbug.com/922437 external/wpt/css/css-text/overflow-wrap/overflow-wrap-anywhere-002.html [ Skip ]
+crbug.com/922437 external/wpt/css/css-text/overflow-wrap/overflow-wrap-anywhere-003.html [ Skip ]
+crbug.com/922437 external/wpt/css/css-text/overflow-wrap/overflow-wrap-break-word-002.html [ Skip ]
+crbug.com/922437 external/wpt/css/css-text/overflow-wrap/overflow-wrap-break-word-003.html [ Skip ]
+crbug.com/922437 external/wpt/css/css-text/overflow-wrap/overflow-wrap-break-word-006.html [ Skip ]
+
# New failures are appended below by the script.
crbug.com/591099 css3/filters/backdrop-filter-rendering.html [ Pass ]
crbug.com/591099 css3/filters/composited-layer-child-bounds-after-composited-to-sw-shadow-change.html [ Failure ]
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations
index 50ac1b0b..b8ca8aa 100644
--- a/third_party/blink/web_tests/TestExpectations
+++ b/third_party/blink/web_tests/TestExpectations
@@ -2203,7 +2203,6 @@
crbug.com/626703 external/wpt/css/css-text/word-break/word-break-break-all-004.html [ Failure ]
crbug.com/626703 external/wpt/css/css-text/word-break/word-break-break-all-006.html [ Failure ]
crbug.com/626703 external/wpt/css/css-text/word-break/word-break-break-all-008.html [ Failure ]
-crbug.com/626703 external/wpt/css/css-text/word-break/word-break-keep-all-003.html [ Failure ]
crbug.com/626703 [ Linux ] external/wpt/css/css-text/word-break/word-break-normal-bo-000.html [ Failure ]
crbug.com/626703 [ Win ] external/wpt/css/css-text/word-break/word-break-normal-km-000.html [ Failure ]
crbug.com/626703 external/wpt/css/css-text/word-break/word-break-normal-my-000.html [ Failure ]
@@ -3104,7 +3103,6 @@
crbug.com/626703 external/wpt/css/css-text/text-transform/text-transform-shaping-002.html [ Failure ]
crbug.com/626703 external/wpt/css/css-text/white-space/pre-wrap-012.html [ Failure ]
crbug.com/626703 external/wpt/css/CSS2/text/white-space-pre-element-001.xht [ Failure ]
-crbug.com/626703 external/wpt/css/css-text/overflow-wrap/overflow-wrap-anywhere-002.html [ Failure ]
crbug.com/626703 external/wpt/css/CSS2/text/white-space-003.xht [ Failure ]
crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/sizing/hori-block-size-small-or-larger-than-container-with-min-or-max-content-2b.html [ Failure ]
crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/sizing/block-size-with-min-or-max-content-1a.html [ Failure ]
@@ -3115,7 +3113,6 @@
crbug.com/626703 external/wpt/css/css-text/white-space/pre-wrap-013.html [ Failure ]
crbug.com/626703 external/wpt/css/CSS2/text/white-space-processing-040.xht [ Failure ]
crbug.com/626703 external/wpt/css/css-text/text-transform/text-transform-shaping-003.html [ Failure ]
-crbug.com/626703 external/wpt/css/css-text/white-space/tab-stop-threshold-006.html [ Failure ]
crbug.com/626703 external/wpt/css/css-text/white-space/white-space-intrinsic-size-003.html [ Failure ]
crbug.com/626703 external/wpt/css/css-text/overflow-wrap/overflow-wrap-anywhere-001.html [ Failure ]
crbug.com/626703 external/wpt/css/css-text/overflow-wrap/overflow-wrap-anywhere-003.html [ Failure ]
@@ -3132,9 +3129,7 @@
crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/sizing/block-size-with-min-or-max-content-1b.html [ Failure ]
crbug.com/626703 external/wpt/css/css-text/text-transform/text-transform-shaping-001.html [ Failure ]
crbug.com/626703 external/wpt/css/css-text/boundary-shaping/boundary-shaping-001.html [ Failure ]
-crbug.com/626703 external/wpt/css/css-text/white-space/white-space-intrinsic-size-002.html [ Failure ]
crbug.com/626703 external/wpt/css/css-text/text-indent/text-indent-percentage-004.html [ Failure ]
-crbug.com/626703 external/wpt/css/css-text/white-space/tab-stop-threshold-005.html [ Failure ]
crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/sizing/vert-block-size-small-or-larger-than-container-with-min-or-max-content-1.html [ Failure ]
crbug.com/626703 external/wpt/css/css-text/boundary-shaping/boundary-shaping-004.html [ Failure ]
crbug.com/626703 external/wpt/css/css-sizing/range-percent-intrinsic-size-2.html [ Failure ]
@@ -3544,7 +3539,6 @@
crbug.com/626703 external/wpt/content-security-policy/securitypolicyviolation/inside-dedicated-worker.html [ Timeout ]
crbug.com/626703 external/wpt/css/css-text/overflow-wrap/overflow-wrap-min-content-size-002.html [ Failure ]
crbug.com/626703 external/wpt/content-security-policy/securitypolicyviolation/targeting.html [ Timeout ]
-crbug.com/626703 external/wpt/css/css-text/white-space/textarea-break-spaces-001.html [ Failure ]
crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-003.html [ Failure ]
crbug.com/863355 [ Mac ] external/wpt/svg/shapes/reftests/pathlength-002.svg [ Failure ]
crbug.com/366559 external/wpt/svg/shapes/reftests/pathlength-003.svg [ Failure ]
@@ -3552,7 +3546,6 @@
crbug.com/366559 external/wpt/svg/text/reftests/textpath-shape-001.svg [ Failure ]
crbug.com/626703 external/wpt/svg/rendering/order/z-index.svg [ Failure ]
crbug.com/626703 external/wpt/web-animations/timing-model/timelines/update-and-send-events.html [ Timeout ]
-crbug.com/626703 external/wpt/css/css-text/white-space/break-spaces-001.html [ Failure ]
crbug.com/626703 [ Mac10.12 ] external/wpt/compat/webkit-text-fill-color-property-002.html [ Failure ]
crbug.com/626703 [ Mac10.13 ] external/wpt/compat/webkit-text-fill-color-property-002.html [ Failure ]
crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-column-row-gap-001.html [ Failure ]
@@ -3685,8 +3678,6 @@
crbug.com/626703 [ Win10 ] external/wpt/fetch/api/redirect/redirect-count.any.html [ Timeout ]
crbug.com/626703 external/wpt/css/cssom-view/scroll-behavior-smooth.html [ Timeout ]
-crbug.com/626703 external/wpt/css/css-text/overflow-wrap/overflow-wrap-break-word-003.html [ Failure ]
-crbug.com/626703 external/wpt/css/css-text/overflow-wrap/overflow-wrap-break-word-002.html [ Failure ]
crbug.com/626703 external/wpt/websockets/Create-Secure-extensions-empty.any.html [ Timeout ]
crbug.com/626703 external/wpt/websockets/Create-Secure-extensions-empty.any.worker.html [ Timeout ]
crbug.com/626703 external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/string-compilation-integrity-classic.sub.html [ Skip ]
diff --git a/third_party/blink/web_tests/W3CImportExpectations b/third_party/blink/web_tests/W3CImportExpectations
index a113029d..96288da 100644
--- a/third_party/blink/web_tests/W3CImportExpectations
+++ b/third_party/blink/web_tests/W3CImportExpectations
@@ -191,10 +191,6 @@
external/wpt/css/css-text/text-transform/text-transform-fullwidth-002.xht [ Skip ]
external/wpt/css/css-text/text-transform/text-transform-fullwidth-004.xht [ Skip ]
external/wpt/css/css-text/text-transform/text-transform-fullwidth-005.xht [ Skip ]
-external/wpt/css/css-text/white-space/pre-wrap-008.html [ Skip ]
-external/wpt/css/css-text/white-space/pre-wrap-010.html [ Skip ]
-external/wpt/css/css-text/white-space/textarea-pre-wrap-010.html [ Skip ]
-external/wpt/css/css-text/white-space/textarea-pre-wrap-008.html [ Skip ]
external/wpt/css/css-text/white-space/white-space-collapsing-discard-001.xht [ Skip ]
external/wpt/css/css-text/white-space/white-space-collapsing-preserve-breaks-001.xht [ Skip ]
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/overflow-wrap/overflow-wrap-break-word-002.html b/third_party/blink/web_tests/external/wpt/css/css-text/overflow-wrap/overflow-wrap-break-word-002.html
index 660b7f1..6f90f0c 100644
--- a/third_party/blink/web_tests/external/wpt/css/css-text/overflow-wrap/overflow-wrap-break-word-002.html
+++ b/third_party/blink/web_tests/external/wpt/css/css-text/overflow-wrap/overflow-wrap-break-word-002.html
@@ -22,7 +22,7 @@
</style>
<p>This test passes if there is nothing below this sentence.
-<div> FAIL <div>
+<div> FAIL </div>
<!--
white-space:break-spaces should cause the spaces at the end of the line to be preserved.
Since there is an allowed break point between the first space and the F,
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/overflow-wrap/overflow-wrap-break-word-003.html b/third_party/blink/web_tests/external/wpt/css/css-text/overflow-wrap/overflow-wrap-break-word-003.html
index 6203b55..05e570b 100644
--- a/third_party/blink/web_tests/external/wpt/css/css-text/overflow-wrap/overflow-wrap-break-word-003.html
+++ b/third_party/blink/web_tests/external/wpt/css/css-text/overflow-wrap/overflow-wrap-break-word-003.html
@@ -22,4 +22,4 @@
</style>
<p>This test passes if the word FAIL does not appear below.
-<div>PASS FAIL<div>
+<div>PASS FAIL</div>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/overflow-wrap/overflow-wrap-break-word-004.html b/third_party/blink/web_tests/external/wpt/css/css-text/overflow-wrap/overflow-wrap-break-word-004.html
index b277319..5f36410f 100644
--- a/third_party/blink/web_tests/external/wpt/css/css-text/overflow-wrap/overflow-wrap-break-word-004.html
+++ b/third_party/blink/web_tests/external/wpt/css/css-text/overflow-wrap/overflow-wrap-break-word-004.html
@@ -3,6 +3,7 @@
<title>CSS Text Test: overflow-wrap: break-word</title>
<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-break-word">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
<meta name="flags" content="ahem">
<link rel="match" href="reference/overflow-wrap-break-word-001-ref.html">
<meta name="assert" content="A Single leading white-space constitutes a soft breaking opportunity, honoring the 'white-space: pre-wrap' property, that must prevent the word to be broken.">
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/overflow-wrap/overflow-wrap-break-word-006.html b/third_party/blink/web_tests/external/wpt/css/css-text/overflow-wrap/overflow-wrap-break-word-006.html
new file mode 100644
index 0000000..6dc1b4df
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/css/css-text/overflow-wrap/overflow-wrap-break-word-006.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: overflow-wrap: break-word</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-overflow-wrap-break-word">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<meta name="flags" content="ahem">
+<link rel="match" href="reference/overflow-wrap-break-word-001-ref.html">
+<meta name="assert" content="A Single leading white-space constitutes a soft breaking opportunity, honoring the 'white-space: break-spaces' property, that must prevent the word to be broken.">
+<style>
+div {
+ position: relative;
+ font-size: 20px;
+ font-family: Ahem;
+}
+.red {
+ position: absolute;
+ background: green;
+ color: red;
+ width: 100px;
+ height: 100px;
+ z-index: -1;
+}
+.test {
+ color: green;
+ line-height: 1em;
+ width: 5ch;
+ white-space: break-spaces;
+ overflow-wrap: break-word;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="red"><br>XXXXX</div>
+ <div class="test"> XXXXX </div>
+</body>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/white-space/break-spaces-004.html b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/break-spaces-004.html
new file mode 100644
index 0000000..e2c043e
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/break-spaces-004.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: break-spaces</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property" href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-word">
+<meta name="flags" content="ahem">
+<link rel="match" href="reference/pre-wrap-001-ref.html">
+<meta name="assert" content="The word is not broken if there are previous breaking opportunities, honoring the 'white-space: break-spaces' value.">
+<style>
+div {
+ position: relative;
+ font: 20px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 2ch;
+
+ white-space: break-spaces;
+ word-break: break-word;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail"><span>XX</span><br>XX</div>
+ <div class="test"> XX</div>
+</body>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/white-space/break-spaces-005.html b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/break-spaces-005.html
new file mode 100644
index 0000000..d0dafd3
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/break-spaces-005.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="If 'white-space' is set to 'break-spaces', collapsing preserved white-spaces' advance width is not allowed, so that they can be wrapped honoring the 'white-space' propery.">
+<style>
+div {
+ position: relative;
+ font: 10px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 100px;
+
+ white-space: break-spaces;
+}
+
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">XXXX<span>XXXXXX</span><br><span>XXXXXXXXXX</span><br><span>XXXXXXXXXX</span><br><span>XXXXXXXXXX</span><br><span>XXXXXXXXXX</span><br><span>XXXXXXXXXX</span><br><span>XXXXXXXXXX</span><br><span>XXXXXXXXXX</span><br><span>XXXXXXXXXX</span><br><span>XX</span>XXXX<span>XXXX</span></div>
+ <div class="test">XXXX XXXX</div>
+</body>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/white-space/break-spaces-006.html b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/break-spaces-006.html
new file mode 100644
index 0000000..5f9d605
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/break-spaces-006.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property" href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="White spaces are preserved, honoring the 'white-space: break-spaces', but the words are broken, honring the 'word-beak: break-all' even though there are previous breaking opportunities in the white-spaces.">
+<style>
+div {
+ position: relative;
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ word-break: break-all;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail"><span>X</span>XXX<br>X<span>X</span>XX<br>X<span>XXX</span><br><span>XXXX</span></div>
+ <div class="test"> XXXX XXX</div>
+</body>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/white-space/break-spaces-007.html b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/break-spaces-007.html
new file mode 100644
index 0000000..7721361
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/break-spaces-007.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property" href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="A single leading white-space should be used, honoring white-space: break-spaces, to avoid overflow; however, a single preserved white-space at the end of the line cannot be wrapped, hence it hangs when breaking after it to move the rest of the text to the next line.">
+<style>
+div {
+ position: relative;
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail"><span>XXXX</span><br>XXXX<br>XXX<span>X</span><br><span>XXXX</span></div>
+ <div class="test"> XXXX XXX</div>
+</body>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/white-space/break-spaces-008.html b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/break-spaces-008.html
new file mode 100644
index 0000000..d183cac
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/break-spaces-008.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space - break-spaces</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://www.w3.org/TR/css-text-3/#white-space-property">
+<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property" href="https://drafts.csswg.org/css-text-3/#word-break-property">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all">
+<link rel="match" href="reference/white-space-break-spaces-005-ref.html">
+<meta name="flags" content="ahem">
+<meta name="assert" content="White spaces are preserved, honoring the 'white-space: break-spaces', which may lead to overfow. However, we can break before the first white-space after the word honoring the 'break-all' value.">
+<style>
+div {
+ position: relative;
+ font: 25px/1 Ahem;
+}
+.fail {
+ position: absolute;
+ color: red;
+ z-index: -1;
+}
+span { color: green; }
+.test {
+ color: green;
+ width: 4ch;
+
+ white-space: break-spaces;
+ word-break: break-all;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="fail">XXXX<br><span>X</span>XX<span>X</span><br><span>XXXX</span><br><span>XXXX</span></div>
+ <div class="test">XXXX XX</div>
+</body>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/white-space/pre-wrap-016.html b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/pre-wrap-016.html
new file mode 100644
index 0000000..5f66a7b
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/pre-wrap-016.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: white-space: pre-wrap</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-word">
+<meta name="flags" content="ahem">
+<link rel="match" href="reference/pre-wrap-001-ref.html">
+<meta name="assert" content="The word is not broken if there are previous breaking opportunities, honoring the white-space: pre-wrap value.">
+<style>
+div {
+ position: relative;
+ font-size: 20px;
+ font-family: Ahem;
+}
+.red {
+ position: absolute;
+ white-space: pre;
+ background: green;
+ color: red;
+ width: 40px;
+ height: 40px;
+ z-index: -1;
+}
+.test {
+ color: green;
+ line-height: 1em;
+ width: 2ch;
+
+ white-space: pre-wrap;
+ word-break: break-word;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="red"><br>XX</div>
+ <div class="test"> XX</div>
+</body>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/white-space/reference/white-space-break-spaces-005-ref.html b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/reference/white-space-break-spaces-005-ref.html
new file mode 100644
index 0000000..3247ae5a
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/reference/white-space-break-spaces-005-ref.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Reference File</title>
+<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
+<style>
+div {
+ position: relative;
+ width: 100px;
+ height: 100px;
+ background: green;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div></div>
+</body>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/word-break/word-break-break-all-010.html b/third_party/blink/web_tests/external/wpt/css/css-text/word-break/word-break-break-all-010.html
index 7d3bc05..be46d29 100644
--- a/third_party/blink/web_tests/external/wpt/css/css-text/word-break/word-break-break-all-010.html
+++ b/third_party/blink/web_tests/external/wpt/css/css-text/word-break/word-break-break-all-010.html
@@ -1,8 +1,9 @@
<!DOCTYPE html>
<meta charset="utf-8">
-<title>CSS Text Test: overflow-wrap: break-word</title>
+<title>CSS Text Test: word-break: break-all</title>
<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
<meta name="flags" content="ahem">
<link rel="match" href="reference/word-break-break-all-010-ref.html">
<meta name="assert" content="The word is broken even if pre-wrap provides a former breaking opportunity in leading white-space.">
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/word-break/word-break-break-all-011.html b/third_party/blink/web_tests/external/wpt/css/css-text/word-break/word-break-break-all-011.html
index 531c68d8..fade439 100644
--- a/third_party/blink/web_tests/external/wpt/css/css-text/word-break/word-break-break-all-011.html
+++ b/third_party/blink/web_tests/external/wpt/css/css-text/word-break/word-break-break-all-011.html
@@ -1,8 +1,9 @@
<!DOCTYPE html>
<meta charset="utf-8">
-<title>CSS Text Test: overflow-wrap: break-word</title>
+<title>CSS Text Test: word-break: break-all</title>
<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap">
<meta name="flags" content="ahem">
<link rel="match" href="reference/word-break-break-all-010-ref.html">
<meta name="assert" content="A single leading white-space should account as soft breaking opportunity, honoring the 'white-space: pre-wrap', on top to the ones provided by 'word-break: break-all'.">
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/word-break/word-break-break-all-012.html b/third_party/blink/web_tests/external/wpt/css/css-text/word-break/word-break-break-all-012.html
new file mode 100644
index 0000000..cd3d4405
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/css/css-text/word-break/word-break-break-all-012.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: overflow-wrap: break-word</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<meta name="flags" content="ahem">
+<link rel="match" href="reference/word-break-break-all-010-ref.html">
+<meta name="assert" content="The word is broken even if white-space: break-spaces provides a former breaking opportunity in leading white-space.">
+<style>
+div {
+ position: relative;
+ font-size: 20px;
+ font-family: Ahem;
+}
+.red {
+ position: absolute;
+ white-space: pre;
+ background: green;
+ color: red;
+ width: 100px;
+ height: 100px;
+ z-index: -1;
+}
+.test {
+ color: green;
+ line-height: 1em;
+ width: 5ch;
+
+ white-space: break-spaces;
+ word-break: break-all;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="red"> XXXX<br>X</div>
+ <div class="test"> XXXXX</div>
+</body>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/word-break/word-break-break-all-013.html b/third_party/blink/web_tests/external/wpt/css/css-text/word-break/word-break-break-all-013.html
new file mode 100644
index 0000000..85dce08b
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/css/css-text/word-break/word-break-break-all-013.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Text Test: word-break: break-all</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all">
+<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces">
+<meta name="flags" content="ahem">
+<link rel="match" href="reference/word-break-break-all-010-ref.html">
+<meta name="assert" content="A single leading white-space should account as soft breaking opportunity, honoring the 'white-space: break-spaces', on top to the ones provided by 'word-break: break-all'.">
+<style>
+div {
+ position: relative;
+ font-size: 20px;
+ font-family: Ahem;
+}
+.red {
+ position: absolute;
+ background: green;
+ color: red;
+ width: 100px;
+ height: 100px;
+ z-index: -1;
+}
+.test {
+ color: green;
+ background: green;
+ line-height: 1em;
+ width: 1ch;
+ white-space: break-spaces;
+ word-break: break-all;
+}
+</style>
+<body>
+ <p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
+ <div class="red">X<br>X<br>X</div>
+ <div class="test"> XX</div>
+</body>