Bug 1505786 - Implement overflow-wrap: anywhere. draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 08 Nov 2018 16:01:01 +0100
changeset 1752899 8e58cf7c883e37f6ea1471d7b575aeac4f866992
parent 1752898 524d5a70b8b2dd20f5665fa469106d1fc5e7ecc7
child 1752900 0827f3497273a4a4fd47a8e5cf7ce720acc7dc6b
push id313583
push useremilio@crisal.io
push dateThu, 08 Nov 2018 18:59:31 +0000
treeherdertry@97719084f51d [default view] [failures only]
bugs1505786
milestone65.0a1
Bug 1505786 - Implement overflow-wrap: anywhere. Summary: Per https://github.com/w3c/csswg-drafts/issues/2682 Reviewers: xidorn, jfkthame Tags: #secure-revision Bug #: 1505786 Differential Revision: https://phabricator.services.mozilla.com/D11328
layout/generic/nsTextFrame.cpp
layout/style/ServoBindings.toml
layout/style/ServoCSSPropList.mako.py
layout/style/nsStyleConsts.h
layout/style/nsStyleStruct.cpp
layout/style/nsStyleStruct.h
modules/libpref/init/StaticPrefList.h
servo/components/style/cbindgen.toml
servo/components/style/properties/data.py
servo/components/style/properties/gecko.mako.rs
servo/components/style/properties/longhands/inherited_text.mako.rs
servo/components/style/values/computed/mod.rs
servo/components/style/values/computed/text.rs
servo/components/style/values/specified/mod.rs
servo/components/style/values/specified/text.rs
testing/web-platform/meta/css/css-text/overflow-wrap/overflow-wrap-min-content-size-001.html.ini
testing/web-platform/meta/css/css-text/overflow-wrap/overflow-wrap-min-content-size-002.html.ini
testing/web-platform/meta/css/css-text/overflow-wrap/overflow-wrap-min-content-size-003.html.ini
testing/web-platform/tests/css/css-text/overflow-wrap/overflow-wrap-min-content-size-001.html
testing/web-platform/tests/css/css-text/overflow-wrap/overflow-wrap-min-content-size-002.html
testing/web-platform/tests/css/css-text/overflow-wrap/overflow-wrap-min-content-size-003.html
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -8602,18 +8602,17 @@ nsTextFrame::AddInlineMinISizeForFlow(gf
     if (start < flowEndInTextRun && textRun->CanBreakLineBefore(start)) {
       aData->OptionallyBreak();
     }
     aData->mCurrentLine += provider.GetFontMetrics()->EmHeight();
     aData->mTrailingWhitespace = 0;
     return;
   }
 
-  // If overflow-wrap is break-word, we can wrap everywhere.
-  if (StaticPrefs::layout_css_overflow_break_intrinsic_size() &&
+  if (textStyle->mOverflowWrap == mozilla::StyleOverflowWrap::Anywhere &&
       textStyle->WordCanWrap(this)) {
     aData->OptionallyBreak();
     aData->mCurrentLine +=
       textRun->GetMinAdvanceWidth(Range(start, flowEndInTextRun));
     aData->mTrailingWhitespace = 0;
     aData->mAtStartOfLine = false;
     aData->OptionallyBreak();
     return;
--- a/layout/style/ServoBindings.toml
+++ b/layout/style/ServoBindings.toml
@@ -390,16 +390,17 @@ cbindgen-types = [
     { gecko = "StyleDisplay", servo = "values::specified::Display" },
     { gecko = "StyleDisplayMode", servo = "gecko::media_features::DisplayMode" },
     { gecko = "StyleFillRule", servo = "values::generics::basic_shape::FillRule" },
     { gecko = "StyleFontDisplay", servo = "font_face::FontDisplay" },
     { gecko = "StyleFontFaceSourceListComponent", servo = "font_face::FontFaceSourceListComponent" },
     { gecko = "StyleFontLanguageOverride", servo = "values::computed::font::FontLanguageOverride" },
     { gecko = "StylePathCommand", servo = "values::specified::svg_path::PathCommand" },
     { gecko = "StyleUnicodeRange", servo = "cssparser::UnicodeRange" },
+    { gecko = "StyleOverflowWrap", servo = "values::computed::OverflowWrap" },
 ]
 
 mapped-generic-types = [
     { generic = true, gecko = "mozilla::RustCell", servo = "::std::cell::Cell" },
     { generic = false, gecko = "ServoNodeData", servo = "AtomicRefCell<ElementData>" },
     { generic = false, gecko = "mozilla::ServoWritingMode", servo = "::logical_geometry::WritingMode" },
     { generic = false, gecko = "mozilla::ServoCustomPropertiesMap", servo = "Option<::servo_arc::Arc<::custom_properties::CustomPropertiesMap>>" },
     { generic = false, gecko = "mozilla::ServoRuleNode", servo = "Option<::rule_tree::StrongRuleNode>" },
--- a/layout/style/ServoCSSPropList.mako.py
+++ b/layout/style/ServoCSSPropList.mako.py
@@ -97,16 +97,17 @@ SERIALIZED_PREDEFINED_TYPES = [
     "ImageLayer",
     "Length",
     "LengthOrPercentage",
     "NonNegativeLength",
     "NonNegativeLengthOrPercentage",
     "ListStyleType",
     "OffsetPath",
     "Opacity",
+    "OverflowWrap",
     "Quotes",
     "Resize",
     "Scale",
     "TextAlign",
     "TimingFunction",
     "TransformStyle",
     "background::BackgroundSize",
     "basic_shape::ClippingShape",
--- a/layout/style/nsStyleConsts.h
+++ b/layout/style/nsStyleConsts.h
@@ -783,20 +783,16 @@ enum class StyleWhiteSpace : uint8_t {
   PreSpace,
 };
 
 // See nsStyleText
 #define NS_STYLE_WORDBREAK_NORMAL               0
 #define NS_STYLE_WORDBREAK_BREAK_ALL            1
 #define NS_STYLE_WORDBREAK_KEEP_ALL             2
 
-// See nsStyleText
-#define NS_STYLE_OVERFLOWWRAP_NORMAL            0
-#define NS_STYLE_OVERFLOWWRAP_BREAK_WORD        1
-
 // ruby-align, see nsStyleText
 #define NS_STYLE_RUBY_ALIGN_START               0
 #define NS_STYLE_RUBY_ALIGN_CENTER              1
 #define NS_STYLE_RUBY_ALIGN_SPACE_BETWEEN       2
 #define NS_STYLE_RUBY_ALIGN_SPACE_AROUND        3
 
 // ruby-position, see nsStyleText
 #define NS_STYLE_RUBY_POSITION_OVER             0
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -4244,17 +4244,17 @@ AreShadowArraysEqual(nsCSSShadowArray* l
 
 nsStyleText::nsStyleText(const nsPresContext* aContext)
   : mTextAlign(NS_STYLE_TEXT_ALIGN_START)
   , mTextAlignLast(NS_STYLE_TEXT_ALIGN_AUTO)
   , mTextJustify(StyleTextJustify::Auto)
   , mTextTransform(NS_STYLE_TEXT_TRANSFORM_NONE)
   , mWhiteSpace(StyleWhiteSpace::Normal)
   , mWordBreak(NS_STYLE_WORDBREAK_NORMAL)
-  , mOverflowWrap(NS_STYLE_OVERFLOWWRAP_NORMAL)
+  , mOverflowWrap(StyleOverflowWrap::Normal)
   , mHyphens(StyleHyphens::Manual)
   , mRubyAlign(NS_STYLE_RUBY_ALIGN_SPACE_AROUND)
   , mRubyPosition(NS_STYLE_RUBY_POSITION_OVER)
   , mTextSizeAdjust(NS_STYLE_TEXT_SIZE_ADJUST_AUTO)
   , mTextCombineUpright(NS_STYLE_TEXT_COMBINE_UPRIGHT_NONE)
   , mControlCharacterVisibility(nsLayoutUtils::ControlCharVisibilityDefault())
   , mTextEmphasisStyle(NS_STYLE_TEXT_EMPHASIS_STYLE_NONE)
   , mTextRendering(NS_STYLE_TEXT_RENDERING_AUTO)
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -1573,17 +1573,17 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   nsChangeHint CalcDifference(const nsStyleText& aNewData) const;
 
   uint8_t mTextAlign;                   // NS_STYLE_TEXT_ALIGN_*
   uint8_t mTextAlignLast;               // NS_STYLE_TEXT_ALIGN_*
   mozilla::StyleTextJustify mTextJustify;
   uint8_t mTextTransform;               // NS_STYLE_TEXT_TRANSFORM_*
   mozilla::StyleWhiteSpace mWhiteSpace;
   uint8_t mWordBreak;                   // NS_STYLE_WORDBREAK_*
-  uint8_t mOverflowWrap;                // NS_STYLE_OVERFLOWWRAP_*
+  mozilla::StyleOverflowWrap mOverflowWrap;
   mozilla::StyleHyphens mHyphens;
   uint8_t mRubyAlign;                   // NS_STYLE_RUBY_ALIGN_*
   uint8_t mRubyPosition;                // NS_STYLE_RUBY_POSITION_*
   uint8_t mTextSizeAdjust;              // NS_STYLE_TEXT_SIZE_ADJUST_*
   uint8_t mTextCombineUpright;          // NS_STYLE_TEXT_COMBINE_UPRIGHT_*
   uint8_t mControlCharacterVisibility;  // NS_STYLE_CONTROL_CHARACTER_VISIBILITY_*
   uint8_t mTextEmphasisPosition;        // NS_STYLE_TEXT_EMPHASIS_POSITION_*
   uint8_t mTextEmphasisStyle;           // NS_STYLE_TEXT_EMPHASIS_STYLE_*
@@ -1629,18 +1629,21 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
 
   bool WhiteSpaceCanWrapStyle() const {
     return mWhiteSpace == mozilla::StyleWhiteSpace::Normal ||
            mWhiteSpace == mozilla::StyleWhiteSpace::PreWrap ||
            mWhiteSpace == mozilla::StyleWhiteSpace::PreLine;
   }
 
   bool WordCanWrapStyle() const {
-    return WhiteSpaceCanWrapStyle() &&
-           mOverflowWrap == NS_STYLE_OVERFLOWWRAP_BREAK_WORD;
+    if (!WhiteSpaceCanWrapStyle()) {
+      return false;
+    }
+    return mOverflowWrap == mozilla::StyleOverflowWrap::BreakWord ||
+           mOverflowWrap == mozilla::StyleOverflowWrap::Anywhere;
   }
 
   bool HasTextEmphasis() const {
     return !mTextEmphasisStyleString.IsEmpty();
   }
 
   bool HasWebkitTextStroke() const {
     return mWebkitTextStrokeWidth > 0;
--- a/modules/libpref/init/StaticPrefList.h
+++ b/modules/libpref/init/StaticPrefList.h
@@ -799,23 +799,16 @@ VARCACHE_PREF(
 
 // Is overflow: -moz-scrollbars-* value enabled?
 VARCACHE_PREF(
   "layout.css.overflow.moz-scrollbars.enabled",
    layout_css_overflow_moz_scrollbars_enabled,
   bool, false
 )
 
-// Does overflow-break: break-word affect intrinsic size?
-VARCACHE_PREF(
-  "layout.css.overflow-break.intrinsic-size",
-   layout_css_overflow_break_intrinsic_size,
-  bool, false
-)
-
 // Does arbitrary ::-webkit-* pseudo-element parsed?
 VARCACHE_PREF(
   "layout.css.unknown-webkit-pseudo-element",
    layout_css_unknown_webkit_pseudo_element,
   bool, true
 )
 
 // Is path() supported in clip-path?
--- a/servo/components/style/cbindgen.toml
+++ b/servo/components/style/cbindgen.toml
@@ -44,13 +44,14 @@ include = [
   "ComputedFontWeightRange",
   "ComputedTimingFunction",
   "Display",
   "DisplayMode",
   "FillRule",
   "FontDisplay",
   "FontFaceSourceListComponent",
   "FontLanguageOverride",
+  "OverflowWrap",
   "TimingFunction",
   "PathCommand",
   "UnicodeRange",
 ]
 item_types = ["enums", "structs", "typedefs"]
--- a/servo/components/style/properties/data.py
+++ b/servo/components/style/properties/data.py
@@ -319,16 +319,17 @@ class Longhand(object):
                 "MozForceBrokenImageIcon",
                 "MozScriptLevel",
                 "MozScriptMinSize",
                 "MozScriptSizeMultiplier",
                 "NonNegativeNumber",
                 "Opacity",
                 "OutlineStyle",
                 "OverflowClipBox",
+                "OverflowWrap",
                 "OverscrollBehavior",
                 "Percentage",
                 "Resize",
                 "SVGOpacity",
                 "SVGPaintOrder",
                 "ScrollSnapType",
                 "TextAlign",
                 "TextDecorationLine",
--- a/servo/components/style/properties/gecko.mako.rs
+++ b/servo/components/style/properties/gecko.mako.rs
@@ -1414,16 +1414,17 @@ impl Clone for ${style_struct.gecko_stru
         "MaxLength": impl_style_coord,
         "MozLength": impl_style_coord,
         "MozScriptMinSize": impl_absolute_length,
         "MozScriptSizeMultiplier": impl_simple,
         "NonNegativeLengthOrPercentage": impl_style_coord,
         "NonNegativeNumber": impl_simple,
         "Number": impl_simple,
         "Opacity": impl_simple,
+        "OverflowWrap": impl_simple,
         "Perspective": impl_style_coord,
         "Position": impl_position,
         "RGBAColor": impl_rgba_color,
         "SVGLength": impl_svg_length,
         "SVGOpacity": impl_svg_opacity,
         "SVGPaint": impl_svg_paint,
         "SVGWidth": impl_svg_length,
         "Transform": impl_transform,
--- a/servo/components/style/properties/longhands/inherited_text.mako.rs
+++ b/servo/components/style/properties/longhands/inherited_text.mako.rs
@@ -56,25 +56,26 @@
     "LengthOrPercentage",
     "computed::LengthOrPercentage::Length(computed::Length::new(0.))",
     animation_value_type="ComputedValue",
     spec="https://drafts.csswg.org/css-text/#propdef-text-indent",
     allow_quirks=True,
     servo_restyle_damage = "reflow",
 )}
 
-// Also known as "word-wrap" (which is more popular because of IE), but this is the preferred
-// name per CSS-TEXT 6.2.
-${helpers.single_keyword(
+// Also known as "word-wrap" (which is more popular because of IE), but this is
+// the preferred name per CSS-TEXT 6.2.
+${helpers.predefined_type(
     "overflow-wrap",
-    "normal break-word",
-    gecko_constant_prefix="NS_STYLE_OVERFLOWWRAP",
+    "OverflowWrap",
+    "computed::OverflowWrap::Normal",
     animation_value_type="discrete",
     spec="https://drafts.csswg.org/css-text/#propdef-overflow-wrap",
     alias="word-wrap",
+    needs_context=False,
     servo_restyle_damage="rebuild_and_reflow",
 )}
 
 // TODO(pcwalton): Support `word-break: keep-all` once we have better CJK support.
 ${helpers.single_keyword(
     "word-break",
     "normal break-all keep-all",
     gecko_constant_prefix="NS_STYLE_WORDBREAK",
--- a/servo/components/style/values/computed/mod.rs
+++ b/servo/components/style/values/computed/mod.rs
@@ -73,17 +73,17 @@ pub use self::position::{GridAutoFlow, G
 pub use self::rect::LengthOrNumberRect;
 pub use self::resolution::Resolution;
 pub use self::svg::MozContextProperties;
 pub use self::svg::{SVGLength, SVGOpacity, SVGPaint, SVGPaintKind};
 pub use self::svg::{SVGPaintOrder, SVGStrokeDashArray, SVGWidth};
 pub use self::table::XSpan;
 pub use self::text::{InitialLetter, LetterSpacing, LineHeight, MozTabSize};
 pub use self::text::{TextAlign, TextEmphasisPosition, TextEmphasisStyle};
-pub use self::text::{TextOverflow, WordSpacing};
+pub use self::text::{TextOverflow, WordSpacing, OverflowWrap};
 pub use self::time::Time;
 pub use self::transform::{Rotate, Scale, Transform, TransformOperation};
 pub use self::transform::{TransformOrigin, TransformStyle, Translate};
 #[cfg(feature = "gecko")]
 pub use self::ui::CursorImage;
 pub use self::ui::{ColorOrAuto, Cursor, MozForceBrokenImageIcon};
 pub use super::specified::{BorderStyle, TextDecorationLine};
 pub use super::{Auto, Either, None_};
--- a/servo/components/style/values/computed/text.rs
+++ b/servo/components/style/values/computed/text.rs
@@ -14,16 +14,17 @@ use values::generics::text::InitialLette
 use values::generics::text::LineHeight as GenericLineHeight;
 use values::generics::text::MozTabSize as GenericMozTabSize;
 use values::generics::text::Spacing;
 use values::specified::text::{TextEmphasisFillMode, TextEmphasisShapeKeyword, TextOverflowSide};
 use values::{CSSFloat, CSSInteger};
 
 pub use values::specified::TextAlignKeyword as TextAlign;
 pub use values::specified::TextEmphasisPosition;
+pub use values::specified::OverflowWrap;
 
 /// A computed value for the `initial-letter` property.
 pub type InitialLetter = GenericInitialLetter<CSSFloat, CSSInteger>;
 
 /// A computed value for the `letter-spacing` property.
 pub type LetterSpacing = Spacing<Length>;
 
 /// A computed value for the `word-spacing` property.
--- a/servo/components/style/values/specified/mod.rs
+++ b/servo/components/style/values/specified/mod.rs
@@ -71,17 +71,17 @@ pub use self::rect::LengthOrNumberRect;
 pub use self::resolution::Resolution;
 pub use self::svg::MozContextProperties;
 pub use self::svg::{SVGLength, SVGOpacity, SVGPaint, SVGPaintKind};
 pub use self::svg::{SVGPaintOrder, SVGStrokeDashArray, SVGWidth};
 pub use self::svg_path::SVGPathData;
 pub use self::table::XSpan;
 pub use self::text::{InitialLetter, LetterSpacing, LineHeight, MozTabSize, TextAlign};
 pub use self::text::{TextAlignKeyword, TextDecorationLine, TextOverflow, WordSpacing};
-pub use self::text::{TextEmphasisPosition, TextEmphasisStyle};
+pub use self::text::{TextEmphasisPosition, TextEmphasisStyle, OverflowWrap};
 pub use self::time::Time;
 pub use self::transform::{Rotate, Scale, Transform};
 pub use self::transform::{TransformOrigin, TransformStyle, Translate};
 #[cfg(feature = "gecko")]
 pub use self::ui::CursorImage;
 pub use self::ui::{ColorOrAuto, Cursor, MozForceBrokenImageIcon};
 pub use super::generics::grid::GridTemplateComponent as GenericGridTemplateComponent;
 
--- a/servo/components/style/values/specified/text.rs
+++ b/servo/components/style/values/specified/text.rs
@@ -654,16 +654,18 @@ impl TextEmphasisShapeKeyword {
 
 impl ToComputedValue for TextEmphasisStyle {
     type ComputedValue = ComputedTextEmphasisStyle;
 
     #[inline]
     fn to_computed_value(&self, context: &Context) -> Self::ComputedValue {
         match *self {
             TextEmphasisStyle::Keyword(ref keyword) => {
+                // FIXME(emilio): This should set the rule_cache_conditions
+                // properly.
                 let default_shape = if context.style().get_inherited_box().clone_writing_mode() ==
                     SpecifiedWritingMode::HorizontalTb
                 {
                     TextEmphasisShapeKeyword::Circle
                 } else {
                     TextEmphasisShapeKeyword::Sesame
                 };
                 ComputedTextEmphasisStyle::Keyword(ComputedTextEmphasisKeywordValue {
@@ -675,16 +677,17 @@ impl ToComputedValue for TextEmphasisSty
             TextEmphasisStyle::String(ref s) => {
                 // Passing `true` to iterate over extended grapheme clusters, following
                 // recommendation at http://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries
                 let string = s.graphemes(true).next().unwrap_or("").to_string();
                 ComputedTextEmphasisStyle::String(string)
             },
         }
     }
+
     #[inline]
     fn from_computed_value(computed: &Self::ComputedValue) -> Self {
         match *computed {
             ComputedTextEmphasisStyle::Keyword(ref keyword) => TextEmphasisStyle::Keyword(
                 TextEmphasisKeywordValue::FillAndShape(keyword.fill, keyword.shape),
             ),
             ComputedTextEmphasisStyle::None => TextEmphasisStyle::None,
             ComputedTextEmphasisStyle::String(ref string) => {
@@ -872,8 +875,29 @@ impl Parse for MozTabSize {
             // as the number `0` and not the length `0px`.
             return Ok(GenericMozTabSize::Number(number));
         }
         Ok(GenericMozTabSize::Length(NonNegativeLength::parse(
             context, input,
         )?))
     }
 }
+
+/// Values for the `overflow-wrap` property.
+#[repr(u8)]
+#[derive(
+    Clone,
+    Copy,
+    Debug,
+    Eq,
+    MallocSizeOf,
+    Parse,
+    PartialEq,
+    SpecifiedValueInfo,
+    ToComputedValue,
+    ToCss,
+)]
+#[allow(missing_docs)]
+pub enum OverflowWrap {
+    Normal,
+    BreakWord,
+    Anywhere,
+}
deleted file mode 100644
--- a/testing/web-platform/meta/css/css-text/overflow-wrap/overflow-wrap-min-content-size-001.html.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[overflow-wrap-min-content-size-001.html]
-  prefs: [layout.css.overflow-break.intrinsic-size:true]
deleted file mode 100644
--- a/testing/web-platform/meta/css/css-text/overflow-wrap/overflow-wrap-min-content-size-002.html.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[overflow-wrap-min-content-size-002.html]
-  prefs: [layout.css.overflow-break.intrinsic-size:true]
deleted file mode 100644
--- a/testing/web-platform/meta/css/css-text/overflow-wrap/overflow-wrap-min-content-size-003.html.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[overflow-wrap-min-content-size-003.html]
-  prefs: [layout.css.overflow-break.intrinsic-size:true]
--- a/testing/web-platform/tests/css/css-text/overflow-wrap/overflow-wrap-min-content-size-001.html
+++ b/testing/web-platform/tests/css/css-text/overflow-wrap/overflow-wrap-min-content-size-001.html
@@ -1,19 +1,19 @@
 <!DOCTYPE html>
 <meta charset="utf-8">
-<title>CSS Text Test: overflow-wrap: break-word and intrinsic sizing</title>
+<title>CSS Text Test: overflow-wrap: anywhere and intrinsic sizing</title>
 <link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
 <link rel="help" href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
 <meta name="flags" content="">
 <link rel="match" href="reference/overflow-wrap-min-content-size-001-ref.html">
-<meta name="assert" content="Soft wrap opportunities introduced by overflow-wrap:break-word **are** considered when calculating min-content intrinsic sizes.">
+<meta name="assert" content="Soft wrap opportunities introduced by overflow-wrap:anywhere **are** considered when calculating min-content intrinsic sizes.">
 <style>
 table {
-  overflow-wrap: break-word;
+  overflow-wrap: anywhere;
   max-width: 0;
   border: 0;
   border-collapse: collapse;
 }
 td {
   padding: 0;
   background: green;
   color: transparent;
--- a/testing/web-platform/tests/css/css-text/overflow-wrap/overflow-wrap-min-content-size-002.html
+++ b/testing/web-platform/tests/css/css-text/overflow-wrap/overflow-wrap-min-content-size-002.html
@@ -1,21 +1,21 @@
 <!DOCTYPE html>
 <meta charset="utf-8">
-<title>CSS Text Test: overflow-wrap: break-word and intrinsic sizing</title>
+<title>CSS Text Test: overflow-wrap: anywhere and intrinsic sizing</title>
 <link rel="author" title="Xidorn Quan" href="https://www.upsuper.org/">
 <link rel="author" title="Mozilla" href="https://www.mozilla.org/">
 <link rel="help" href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
 <meta name="flags" content="">
 <link rel="match" href="reference/overflow-wrap-min-content-size-002-ref.html">
-<meta name="assert" content="overflow-wrap:break-word doesn't break grapheme cluster and min-content intrinsic size should take that into account.">
+<meta name="assert" content="overflow-wrap:anywhere doesn't break grapheme cluster and min-content intrinsic size should take that into account.">
 <style>
 #wrapper {
   width: 0px;
-  overflow-wrap: break-word;
+  overflow-wrap: anywhere;
 }
 #test {
   float: left;
   border: 2px solid blue;
 }
 </style>
 
 <p>Test passes if the glyphs are completely inside the blue box.
--- a/testing/web-platform/tests/css/css-text/overflow-wrap/overflow-wrap-min-content-size-003.html
+++ b/testing/web-platform/tests/css/css-text/overflow-wrap/overflow-wrap-min-content-size-003.html
@@ -1,22 +1,22 @@
 <!DOCTYPE html>
 <meta charset="utf-8">
-<title>CSS Text Test: overflow-wrap: break-word and intrinsic sizing</title>
+<title>CSS Text Test: overflow-wrap: anywhere and intrinsic sizing</title>
 <link rel="author" title="Xidorn Quan" href="https://www.upsuper.org/">
 <link rel="author" title="Mozilla" href="https://www.mozilla.org/">
 <link rel="help" href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
 <meta name="flags" content="ahem">
 <link rel="match" href="reference/overflow-wrap-min-content-size-003-ref.html">
-<meta name="assert" content="overflow-wrap:break-word breaks at edge of inline elements.">
+<meta name="assert" content="overflow-wrap:anywhere breaks at edge of inline elements.">
 <style>
 #wrapper {
   width: 0px;
   font: 16px / 1 Ahem;
-  overflow-wrap: break-word;
+  overflow-wrap: anywhere;
   color: green;
 }
 #test {
   float: left;
 }
 #reference {
   position: absolute;
   width: 16px;