From a1263ce7e33dd0679539ff25237763a603493cb1 Mon Sep 17 00:00:00 2001 From: Koji Ishii Date: Thu, 10 Aug 2023 16:45:27 +0000 Subject: [PATCH] [balance-text] Remove `CSSWhiteSpaceShorthand` runtime flag Shipped in M114. crrev.com/c/4751002 removed the related flag `CSSTextWrap`, but this flag is a bit more complicated, by using the `alternative_of` keyword, and also impacts editing and presentation attributes. Bug: 1251079, 1417543 Change-Id: I59460711d56d1e32185294794c10f18378884ba7 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4751154 Reviewed-by: Anders Hartvoll Ruud Commit-Queue: Koji Ishii Cr-Commit-Position: refs/heads/main@{#1182125} --- .../core/animation/css/css_animations.cc | 8 ----- .../renderer/core/css/css_properties.json5 | 24 --------------- .../core/css/css_property_equality.cc | 4 +-- .../core/css/css_property_value_set.cc | 9 ++---- .../renderer/core/css/css_value_id_mappings.h | 13 -------- .../core/css/parser/css_parser_fast_paths.cc | 13 -------- .../properties/longhands/longhands_custom.cc | 8 ----- .../shorthands/shorthands_custom.cc | 6 ++-- .../core/css/resolver/style_cascade.cc | 15 ---------- .../core/css/style_property_serializer.cc | 6 ++-- .../blink/renderer/core/dom/element.cc | 3 +- .../renderer/core/editing/editing_style.cc | 21 +++++-------- .../core/html/forms/html_text_area_element.cc | 30 +++++++------------ .../renderer/core/html/html_pre_element.cc | 13 +++----- .../core/html/html_table_cell_element.cc | 15 ++++------ .../core/html/track/vtt/vtt_cue_box.cc | 12 +++----- .../core/svg/svg_text_content_element.cc | 30 +++++++------------ .../platform/runtime_enabled_features.json5 | 7 ----- 18 files changed, 49 insertions(+), 188 deletions(-) diff --git a/third_party/blink/renderer/core/animation/css/css_animations.cc b/third_party/blink/renderer/core/animation/css/css_animations.cc index 88e6c306b9e49..17cd4c22b8da5 100644 --- a/third_party/blink/renderer/core/animation/css/css_animations.cc +++ b/third_party/blink/renderer/core/animation/css/css_animations.cc @@ -2222,14 +2222,6 @@ void CSSAnimations::CalculateTransitionUpdateForPropertyHandle( return; } - if (RuntimeEnabledFeatures::CSSWhiteSpaceShorthandEnabled() && - property.GetCSSProperty().PropertyID() == CSSPropertyID::kWhiteSpace) { - // When CSSWhiteSpaceShorthand is enabled white-space is a shorthand, so we - // shouldn't transition it. Otherwise, we will hit the DCHECK in - // WhiteSpace::CSSValueFromComputedStyleInternal. - return; - } - const RunningTransition* interrupted_transition = nullptr; if (state.active_transitions) { TransitionMap::const_iterator active_transition_iter = diff --git a/third_party/blink/renderer/core/css/css_properties.json5 b/third_party/blink/renderer/core/css/css_properties.json5 index 3aa6af8123ca6..4dc13b72241f9 100644 --- a/third_party/blink/renderer/core/css/css_properties.json5 +++ b/third_party/blink/renderer/core/css/css_properties.json5 @@ -6098,33 +6098,10 @@ }, { name: "white-space", - property_methods: ["CSSValueFromComputedStyleInternal"], - independent: false, // Actually true, but setting it to false saves a precious bit in ComputedStyleBase. - inherited: true, - // This property is "keyword" but use "primitive" to use `EWhiteSpace` defined manually. - field_template: "primitive", - // The values are stored in `white-space-collapse` and `text-wrap` by - // `computed_style_custom_functions` even when `CSSWhiteSpaceShorthand` - // is off, but give 1 bit to it because `field_size` can't be zero. - field_size: 1, - include_paths: ["third_party/blink/renderer/core/css/white_space.h"], - keywords: [ - "normal", "pre", "pre-wrap", "pre-line", "nowrap", "break-spaces" - ], - computed_style_custom_functions: ["getter", "setter", "resetter"], - typedom_types: ["Keyword"], - default_value: "EWhiteSpace::kNormal", - valid_for_cue: true, - valid_for_marker: true, - }, - { - name: "-alternative-white-space", - alternative_of: "white-space", longhands: [ "white-space-collapse", "text-wrap" ], property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"], - runtime_flag: "CSSWhiteSpaceShorthand", }, { name: "white-space-collapse", @@ -6139,7 +6116,6 @@ typedom_types: ["Keyword"], valid_for_cue: true, valid_for_marker: true, - runtime_flag: "CSSWhiteSpaceShorthand", }, { name: "text-wrap", diff --git a/third_party/blink/renderer/core/css/css_property_equality.cc b/third_party/blink/renderer/core/css/css_property_equality.cc index f5e9a165bf417..fec9d76487fec 100644 --- a/third_party/blink/renderer/core/css/css_property_equality.cc +++ b/third_party/blink/renderer/core/css/css_property_equality.cc @@ -838,8 +838,6 @@ bool CSSPropertyEquality::PropertiesEqual(const PropertyHandle& property, return a.GetTransformOrigin().Y() == b.GetTransformOrigin().Y(); case CSSPropertyID::kWebkitTransformOriginZ: return a.GetTransformOrigin().Z() == b.GetTransformOrigin().Z(); - case CSSPropertyID::kWhiteSpace: - return a.WhiteSpace() == b.WhiteSpace(); case CSSPropertyID::kWhiteSpaceCollapse: return a.GetWhiteSpaceCollapse() == b.GetWhiteSpaceCollapse(); case CSSPropertyID::kWidows: @@ -1217,7 +1215,7 @@ bool CSSPropertyEquality::PropertiesEqual(const PropertyHandle& property, case CSSPropertyID::kWebkitMaskPosition: case CSSPropertyID::kWebkitMaskRepeat: case CSSPropertyID::kWebkitTextStroke: - case CSSPropertyID::kAlternativeWhiteSpace: + case CSSPropertyID::kWhiteSpace: NOTREACHED() << property.GetCSSPropertyName().ToAtomicString().Ascii(); return true; diff --git a/third_party/blink/renderer/core/css/css_property_value_set.cc b/third_party/blink/renderer/core/css/css_property_value_set.cc index 89114d513fa46..69962300273fa 100644 --- a/third_party/blink/renderer/core/css/css_property_value_set.cc +++ b/third_party/blink/renderer/core/css/css_property_value_set.cc @@ -448,8 +448,7 @@ void MutableCSSPropertyValueSet::SetProperty(CSSPropertyID property_id, const CSSValue& value, bool important) { DCHECK_NE(property_id, CSSPropertyID::kVariable); - DCHECK(!RuntimeEnabledFeatures::CSSWhiteSpaceShorthandEnabled() || - property_id != CSSPropertyID::kWhiteSpace); + DCHECK_NE(property_id, CSSPropertyID::kWhiteSpace); StylePropertyShorthand shorthand = shorthandForProperty(property_id); if (!shorthand.length()) { SetLonghandProperty( @@ -460,7 +459,7 @@ void MutableCSSPropertyValueSet::SetProperty(CSSPropertyID property_id, RemovePropertiesInSet(shorthand.properties(), shorthand.length()); // The simple shorthand expansion below doesn't work for `white-space`. - DCHECK_NE(property_id, CSSPropertyID::kAlternativeWhiteSpace); + DCHECK_NE(property_id, CSSPropertyID::kWhiteSpace); for (unsigned i = 0; i < shorthand.length(); ++i) { CSSPropertyName longhand_name(shorthand.properties()[i]->PropertyID()); property_vector_.push_back( @@ -498,8 +497,6 @@ MutableCSSPropertyValueSet::SetLonghandProperty(CSSPropertyValue property) { const CSSPropertyID id = property.Id(); DCHECK_EQ(shorthandForProperty(id).length(), 0u) << CSSProperty::Get(id).GetPropertyNameString() << " is a shorthand"; - DCHECK(!RuntimeEnabledFeatures::CSSWhiteSpaceShorthandEnabled() || - id != CSSPropertyID::kWhiteSpace); CSSPropertyValue* to_replace; if (id == CSSPropertyID::kVariable) { to_replace = const_cast( @@ -525,8 +522,6 @@ void MutableCSSPropertyValueSet::SetLonghandProperty(CSSPropertyID property_id, DCHECK_EQ(shorthandForProperty(property_id).length(), 0u) << CSSProperty::Get(property_id).GetPropertyNameString() << " is a shorthand"; - DCHECK(!RuntimeEnabledFeatures::CSSWhiteSpaceShorthandEnabled() || - property_id != CSSPropertyID::kWhiteSpace); CSSPropertyValue* to_replace = FindInsertionPointForID(property_id); if (to_replace) { *to_replace = CSSPropertyValue(CSSPropertyName(property_id), value); diff --git a/third_party/blink/renderer/core/css/css_value_id_mappings.h b/third_party/blink/renderer/core/css/css_value_id_mappings.h index 96a5291d6585d..fccab3543f3c6 100644 --- a/third_party/blink/renderer/core/css/css_value_id_mappings.h +++ b/third_party/blink/renderer/core/css/css_value_id_mappings.h @@ -403,13 +403,6 @@ inline CSSValueID PlatformEnumToCSSValueID(EWhiteSpace v) { case EWhiteSpace::kBreakSpaces: return CSSValueID::kBreakSpaces; } - if (ToTextWrap(v) == TextWrap::kBalance && - !RuntimeEnabledFeatures::CSSWhiteSpaceShorthandEnabled()) { - // If `text-wrap: balance` but the shorthandifying `white-space` is off, - // pretend as if `text-wrap: wrap`. - return PlatformEnumToCSSValueID( - ToWhiteSpace(ToWhiteSpaceCollapse(v), TextWrap::kWrap)); - } NOTREACHED(); return CSSValueID::kNone; } @@ -453,7 +446,6 @@ inline TextWrap CssValueIDToPlatformEnum(CSSValueID v) { case CSSValueID::kWrap: return TextWrap::kWrap; case CSSValueID::kNowrap: - DCHECK(RuntimeEnabledFeatures::CSSWhiteSpaceShorthandEnabled()); return TextWrap::kNoWrap; case CSSValueID::kBalance: return TextWrap::kBalance; @@ -472,11 +464,6 @@ inline CSSValueID PlatformEnumToCSSValueID(TextWrap v) { case TextWrap::kWrap: return CSSValueID::kWrap; case TextWrap::kNoWrap: - if (!RuntimeEnabledFeatures::CSSWhiteSpaceShorthandEnabled()) { - // Note this is not right, but a compromise until `white-space` becomes - // a shorthand. Simulate the behavior when it's off. - return CSSValueID::kWrap; - } return CSSValueID::kNowrap; case TextWrap::kBalance: return CSSValueID::kBalance; 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 27147367090a4..962b10e62092a 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 @@ -1532,10 +1532,6 @@ bool CSSParserFastPaths::IsValidKeywordPropertyAndValue( return value_id == CSSValueID::kDisc || value_id == CSSValueID::kCircle || value_id == CSSValueID::kSquare || value_id == CSSValueID::kNone; case CSSPropertyID::kTextWrap: - if (!RuntimeEnabledFeatures::CSSWhiteSpaceShorthandEnabled()) { - return value_id == CSSValueID::kWrap || - value_id == CSSValueID::kBalance; - } if (!RuntimeEnabledFeatures::CSSTextWrapPrettyEnabled()) { return value_id == CSSValueID::kWrap || value_id == CSSValueID::kNowrap || @@ -1582,15 +1578,7 @@ bool CSSParserFastPaths::IsValidKeywordPropertyAndValue( value_id == CSSValueID::kLrTb || value_id == CSSValueID::kRlTb || value_id == CSSValueID::kTbRl || value_id == CSSValueID::kLr || value_id == CSSValueID::kRl || value_id == CSSValueID::kTb; - case CSSPropertyID::kWhiteSpace: - DCHECK(!RuntimeEnabledFeatures::CSSWhiteSpaceShorthandEnabled()); - return value_id == CSSValueID::kNormal || value_id == CSSValueID::kPre || - value_id == CSSValueID::kPreWrap || - value_id == CSSValueID::kPreLine || - value_id == CSSValueID::kNowrap || - value_id == CSSValueID::kBreakSpaces; case CSSPropertyID::kWhiteSpaceCollapse: - DCHECK(RuntimeEnabledFeatures::CSSWhiteSpaceShorthandEnabled()); return value_id == CSSValueID::kCollapse || value_id == CSSValueID::kPreserve || value_id == CSSValueID::kPreserveBreaks || @@ -1745,7 +1733,6 @@ CSSBitset CSSParserFastPaths::handled_by_keyword_fast_paths_properties_{{ CSSPropertyID::kWebkitUserModify, CSSPropertyID::kUserSelect, CSSPropertyID::kWebkitWritingMode, - CSSPropertyID::kWhiteSpace, // TODO(crbug.com/1417543): Remove when done. CSSPropertyID::kWhiteSpaceCollapse, CSSPropertyID::kWordBreak, CSSPropertyID::kWritingMode, diff --git a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc index 2efdf48182676..ed1b741496746 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc @@ -10130,14 +10130,6 @@ const CSSValue* WebkitWritingMode::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(style.GetWritingMode()); } -const CSSValue* WhiteSpace::CSSValueFromComputedStyleInternal( - const ComputedStyle& style, - const LayoutObject*, - bool allow_visited_style) const { - DCHECK(!RuntimeEnabledFeatures::CSSWhiteSpaceShorthandEnabled()); - return CSSIdentifierValue::Create(style.WhiteSpace()); -} - // Longhands for `white-space`: `white-space-collapse` and `text-wrap`. const CSSValue* WhiteSpaceCollapse::CSSValueFromComputedStyleInternal( const ComputedStyle& style, diff --git a/third_party/blink/renderer/core/css/properties/shorthands/shorthands_custom.cc b/third_party/blink/renderer/core/css/properties/shorthands/shorthands_custom.cc index c9e7f94f11649..7faf498940c81 100644 --- a/third_party/blink/renderer/core/css/properties/shorthands/shorthands_custom.cc +++ b/third_party/blink/renderer/core/css/properties/shorthands/shorthands_custom.cc @@ -3862,7 +3862,7 @@ const CSSValue* Toggle::CSSValueFromComputedStyleInternal( return toggle_root; } -bool AlternativeWhiteSpace::ParseShorthand( +bool WhiteSpace::ParseShorthand( bool important, CSSParserTokenRange& range, const CSSParserContext& context, @@ -3901,10 +3901,10 @@ bool AlternativeWhiteSpace::ParseShorthand( // Consume multi-value syntax if the first identifier is not pre-defined. return css_parsing_utils::ConsumeShorthandGreedilyViaLonghands( - alternativeWhiteSpaceShorthand(), important, context, range, properties); + whiteSpaceShorthand(), important, context, range, properties); } -const CSSValue* AlternativeWhiteSpace::CSSValueFromComputedStyleInternal( +const CSSValue* WhiteSpace::CSSValueFromComputedStyleInternal( const ComputedStyle& style, const LayoutObject* layout_object, bool allow_visited_style) const { diff --git a/third_party/blink/renderer/core/css/resolver/style_cascade.cc b/third_party/blink/renderer/core/css/resolver/style_cascade.cc index c170de4cd6f11..a1539491eccd2 100644 --- a/third_party/blink/renderer/core/css/resolver/style_cascade.cc +++ b/third_party/blink/renderer/core/css/resolver/style_cascade.cc @@ -539,21 +539,6 @@ void StyleCascade::ApplyWideOverlapping(CascadeResolver& resolver) { maybe_skip(GetCSSPropertyBaselineSource(), *priority); } } - - if (!RuntimeEnabledFeatures::CSSWhiteSpaceShorthandEnabled()) { - // TODO(crbug.com/1417543): `white-space` will become a shorthand in the - // future - in order to mitigate the forward compat risk, skip the - // `text-wrap` longhand. - const CSSProperty& white_space = GetCSSPropertyWhiteSpace(); - DCHECK(white_space.IsLonghand()); - if (!resolver.filter_.Rejects(white_space)) { - if (const CascadePriority* priority = - map_.Find(white_space.GetCSSPropertyName())) { - LookupAndApply(white_space, resolver); - maybe_skip(GetCSSPropertyTextWrap(), *priority); - } - } - } } // Go through all properties that were found during the analyze phase diff --git a/third_party/blink/renderer/core/css/style_property_serializer.cc b/third_party/blink/renderer/core/css/style_property_serializer.cc index f98196745cddd..d3c907c4b0e60 100644 --- a/third_party/blink/renderer/core/css/style_property_serializer.cc +++ b/third_party/blink/renderer/core/css/style_property_serializer.cc @@ -400,7 +400,7 @@ static bool AllowInitialInShorthand(CSSPropertyID property_id) { case CSSPropertyID::kTextEmphasis: case CSSPropertyID::kWebkitMask: case CSSPropertyID::kWebkitTextStroke: - case CSSPropertyID::kAlternativeWhiteSpace: + case CSSPropertyID::kWhiteSpace: return true; default: return false; @@ -682,7 +682,7 @@ String StylePropertySerializer::SerializeShorthand( } case CSSPropertyID::kViewTimeline: return ViewTimelineValue(); - case CSSPropertyID::kAlternativeWhiteSpace: + case CSSPropertyID::kWhiteSpace: return WhiteSpaceValue(); case CSSPropertyID::kGridColumnGap: case CSSPropertyID::kGridGap: @@ -2285,8 +2285,6 @@ bool StylePropertySerializer::IsValidToggleShorthand( } String StylePropertySerializer::WhiteSpaceValue() const { - DCHECK(RuntimeEnabledFeatures::CSSWhiteSpaceShorthandEnabled()); - const CSSValue* collapse_value = property_set_.GetPropertyCSSValue(GetCSSPropertyWhiteSpaceCollapse()); const CSSValue* wrap_value = diff --git a/third_party/blink/renderer/core/dom/element.cc b/third_party/blink/renderer/core/dom/element.cc index 934603c13f87b..1f226241e8fb6 100644 --- a/third_party/blink/renderer/core/dom/element.cc +++ b/third_party/blink/renderer/core/dom/element.cc @@ -8002,8 +8002,7 @@ void Element::AddPropertyToPresentationAttributeStyle( CSSPropertyID property_id, CSSValueID identifier) { DCHECK(IsStyledElement()); - DCHECK(!RuntimeEnabledFeatures::CSSWhiteSpaceShorthandEnabled() || - property_id != CSSPropertyID::kWhiteSpace); + DCHECK_NE(property_id, CSSPropertyID::kWhiteSpace); style->SetLonghandProperty(property_id, *CSSIdentifierValue::Create(identifier)); } diff --git a/third_party/blink/renderer/core/editing/editing_style.cc b/third_party/blink/renderer/core/editing/editing_style.cc index 324c3ad367ba7..e13ab9202a6f9 100644 --- a/third_party/blink/renderer/core/editing/editing_style.cc +++ b/third_party/blink/renderer/core/editing/editing_style.cc @@ -100,7 +100,10 @@ static const CSSPropertyID kStaticEditingProperties[] = { CSSPropertyID::kWebkitTextFillColor, CSSPropertyID::kWebkitTextStrokeColor, CSSPropertyID::kWebkitTextStrokeWidth, - CSSPropertyID::kCaretColor}; + CSSPropertyID::kCaretColor, + CSSPropertyID::kTextWrap, + CSSPropertyID::kWhiteSpaceCollapse, +}; enum EditingPropertiesType { kOnlyInheritableEditingProperties, @@ -115,14 +118,6 @@ static const Vector& AllEditingProperties( CSSProperty::FilterWebExposedCSSPropertiesIntoVector( execution_context, kStaticEditingProperties, std::size(kStaticEditingProperties), properties); - // TODO(crbug.com/1417543): Move to `kStaticEditingProperties` when removing - // the runtime switch. - if (RuntimeEnabledFeatures::CSSWhiteSpaceShorthandEnabled()) { - properties.push_back(&GetCSSPropertyWhiteSpaceCollapse()); - properties.push_back(&GetCSSPropertyTextWrap()); - } else { - properties.push_back(&GetCSSPropertyWhiteSpace()); - } } return properties; } @@ -1054,12 +1049,10 @@ bool EditingStyle::ConflictsWithInlineStyleOfElement( // e-mail, etc., `white-space` is more interoperable when // `white-space-collapse` is not broadly supported. See crbug.com/1417543 // and `editing/pasteboard/pasting-tabs.html`. - DCHECK_NE(property_id, CSSPropertyID::kAlternativeWhiteSpace); + DCHECK_NE(property_id, CSSPropertyID::kWhiteSpace); const bool is_whitespace_property = - RuntimeEnabledFeatures::CSSWhiteSpaceShorthandEnabled() - ? property_id == CSSPropertyID::kWhiteSpaceCollapse || - property_id == CSSPropertyID::kTextWrap - : property_id == CSSPropertyID::kWhiteSpace; + property_id == CSSPropertyID::kWhiteSpaceCollapse || + property_id == CSSPropertyID::kTextWrap; if (is_whitespace_property && IsTabHTMLSpanElement(element)) { continue; } diff --git a/third_party/blink/renderer/core/html/forms/html_text_area_element.cc b/third_party/blink/renderer/core/html/forms/html_text_area_element.cc index 924b5962f39ed..7f346f40b00da 100644 --- a/third_party/blink/renderer/core/html/forms/html_text_area_element.cc +++ b/third_party/blink/renderer/core/html/forms/html_text_area_element.cc @@ -187,29 +187,19 @@ void HTMLTextAreaElement::CollectStyleForPresentationAttribute( MutableCSSPropertyValueSet* style) { if (name == html_names::kWrapAttr) { if (ShouldWrapText()) { - if (!RuntimeEnabledFeatures::CSSWhiteSpaceShorthandEnabled()) { - AddPropertyToPresentationAttributeStyle( - style, CSSPropertyID::kWhiteSpace, CSSValueID::kPreWrap); - } else { - // Longhands of `white-space: pre-wrap`. - AddPropertyToPresentationAttributeStyle( - style, CSSPropertyID::kWhiteSpaceCollapse, CSSValueID::kPreserve); - AddPropertyToPresentationAttributeStyle(style, CSSPropertyID::kTextWrap, - CSSValueID::kWrap); - } + // Longhands of `white-space: pre-wrap`. + AddPropertyToPresentationAttributeStyle( + style, CSSPropertyID::kWhiteSpaceCollapse, CSSValueID::kPreserve); + AddPropertyToPresentationAttributeStyle(style, CSSPropertyID::kTextWrap, + CSSValueID::kWrap); AddPropertyToPresentationAttributeStyle( style, CSSPropertyID::kOverflowWrap, CSSValueID::kBreakWord); } else { - if (!RuntimeEnabledFeatures::CSSWhiteSpaceShorthandEnabled()) { - AddPropertyToPresentationAttributeStyle( - style, CSSPropertyID::kWhiteSpace, CSSValueID::kPre); - } else { - // Longhands of `white-space: pre`. - AddPropertyToPresentationAttributeStyle( - style, CSSPropertyID::kWhiteSpaceCollapse, CSSValueID::kPreserve); - AddPropertyToPresentationAttributeStyle(style, CSSPropertyID::kTextWrap, - CSSValueID::kNowrap); - } + // Longhands of `white-space: pre`. + AddPropertyToPresentationAttributeStyle( + style, CSSPropertyID::kWhiteSpaceCollapse, CSSValueID::kPreserve); + AddPropertyToPresentationAttributeStyle(style, CSSPropertyID::kTextWrap, + CSSValueID::kNowrap); AddPropertyToPresentationAttributeStyle( style, CSSPropertyID::kOverflowWrap, CSSValueID::kNormal); } diff --git a/third_party/blink/renderer/core/html/html_pre_element.cc b/third_party/blink/renderer/core/html/html_pre_element.cc index 176211abf4e06..8700181753cf1 100644 --- a/third_party/blink/renderer/core/html/html_pre_element.cc +++ b/third_party/blink/renderer/core/html/html_pre_element.cc @@ -44,15 +44,10 @@ void HTMLPreElement::CollectStyleForPresentationAttribute( const AtomicString& value, MutableCSSPropertyValueSet* style) { if (name == html_names::kWrapAttr) { - if (!RuntimeEnabledFeatures::CSSWhiteSpaceShorthandEnabled()) { - style->SetLonghandProperty(CSSPropertyID::kWhiteSpace, - CSSValueID::kPreWrap); - } else { - // Longhands of `white-space: pre-wrap`. - style->SetLonghandProperty(CSSPropertyID::kWhiteSpaceCollapse, - CSSValueID::kPreserve); - style->SetLonghandProperty(CSSPropertyID::kTextWrap, CSSValueID::kWrap); - } + // Longhands of `white-space: pre-wrap`. + style->SetLonghandProperty(CSSPropertyID::kWhiteSpaceCollapse, + CSSValueID::kPreserve); + style->SetLonghandProperty(CSSPropertyID::kTextWrap, CSSValueID::kWrap); } else { HTMLElement::CollectStyleForPresentationAttribute(name, value, style); } diff --git a/third_party/blink/renderer/core/html/html_table_cell_element.cc b/third_party/blink/renderer/core/html/html_table_cell_element.cc index 4140f2b9e6d48..c1e216835f38a 100644 --- a/third_party/blink/renderer/core/html/html_table_cell_element.cc +++ b/third_party/blink/renderer/core/html/html_table_cell_element.cc @@ -89,16 +89,11 @@ void HTMLTableCellElement::CollectStyleForPresentationAttribute( const AtomicString& value, MutableCSSPropertyValueSet* style) { if (name == html_names::kNowrapAttr) { - if (!RuntimeEnabledFeatures::CSSWhiteSpaceShorthandEnabled()) { - AddPropertyToPresentationAttributeStyle(style, CSSPropertyID::kWhiteSpace, - CSSValueID::kNowrap); - } else { - // Longhands of `white-space: nowrap`. - AddPropertyToPresentationAttributeStyle( - style, CSSPropertyID::kWhiteSpaceCollapse, CSSValueID::kCollapse); - AddPropertyToPresentationAttributeStyle(style, CSSPropertyID::kTextWrap, - CSSValueID::kNowrap); - } + // Longhands of `white-space: nowrap`. + AddPropertyToPresentationAttributeStyle( + style, CSSPropertyID::kWhiteSpaceCollapse, CSSValueID::kCollapse); + AddPropertyToPresentationAttributeStyle(style, CSSPropertyID::kTextWrap, + CSSValueID::kNowrap); } else if (name == html_names::kWidthAttr) { if (!value.empty()) { AddHTMLLengthToStyle(style, CSSPropertyID::kWidth, value, diff --git a/third_party/blink/renderer/core/html/track/vtt/vtt_cue_box.cc b/third_party/blink/renderer/core/html/track/vtt/vtt_cue_box.cc index ccb32da5a1c41..be8571413a782 100644 --- a/third_party/blink/renderer/core/html/track/vtt/vtt_cue_box.cc +++ b/third_party/blink/renderer/core/html/track/vtt/vtt_cue_box.cc @@ -134,14 +134,10 @@ void VTTCueBox::ApplyCSSProperties( SetInlineStyleProperty(CSSPropertyID::kTransform, String::Format("translate(-%.2f%%, -%.2f%%)", position.x(), position.y())); - if (!RuntimeEnabledFeatures::CSSWhiteSpaceShorthandEnabled()) { - SetInlineStyleProperty(CSSPropertyID::kWhiteSpace, CSSValueID::kPre); - } else { - // Longhands of `white-space: pre`. - SetInlineStyleProperty(CSSPropertyID::kWhiteSpaceCollapse, - CSSValueID::kPreserve); - SetInlineStyleProperty(CSSPropertyID::kTextWrap, CSSValueID::kNowrap); - } + // Longhands of `white-space: pre`. + SetInlineStyleProperty(CSSPropertyID::kWhiteSpaceCollapse, + CSSValueID::kPreserve); + SetInlineStyleProperty(CSSPropertyID::kTextWrap, CSSValueID::kNowrap); } // The snap-to-lines position is propagated to VttCueLayoutAlgorithm. diff --git a/third_party/blink/renderer/core/svg/svg_text_content_element.cc b/third_party/blink/renderer/core/svg/svg_text_content_element.cc index 53372068c95e6..a5f1389e233ae 100644 --- a/third_party/blink/renderer/core/svg/svg_text_content_element.cc +++ b/third_party/blink/renderer/core/svg/svg_text_content_element.cc @@ -277,29 +277,19 @@ void SVGTextContentElement::CollectStyleForPresentationAttribute( if (value == preserve_string) { UseCounter::Count(GetDocument(), WebFeature::kWhiteSpacePreFromXMLSpace); - if (!RuntimeEnabledFeatures::CSSWhiteSpaceShorthandEnabled()) { - AddPropertyToPresentationAttributeStyle( - style, CSSPropertyID::kWhiteSpace, CSSValueID::kPre); - } else { - // Longhands of `white-space: pre`. - AddPropertyToPresentationAttributeStyle( - style, CSSPropertyID::kWhiteSpaceCollapse, CSSValueID::kPreserve); - AddPropertyToPresentationAttributeStyle(style, CSSPropertyID::kTextWrap, - CSSValueID::kNowrap); - } + // Longhands of `white-space: pre`. + AddPropertyToPresentationAttributeStyle( + style, CSSPropertyID::kWhiteSpaceCollapse, CSSValueID::kPreserve); + AddPropertyToPresentationAttributeStyle(style, CSSPropertyID::kTextWrap, + CSSValueID::kNowrap); } else { UseCounter::Count(GetDocument(), WebFeature::kWhiteSpaceNowrapFromXMLSpace); - if (!RuntimeEnabledFeatures::CSSWhiteSpaceShorthandEnabled()) { - AddPropertyToPresentationAttributeStyle( - style, CSSPropertyID::kWhiteSpace, CSSValueID::kNowrap); - } else { - // Longhands of `white-space: nowrap`. - AddPropertyToPresentationAttributeStyle( - style, CSSPropertyID::kWhiteSpaceCollapse, CSSValueID::kCollapse); - AddPropertyToPresentationAttributeStyle(style, CSSPropertyID::kTextWrap, - CSSValueID::kNowrap); - } + // Longhands of `white-space: nowrap`. + AddPropertyToPresentationAttributeStyle( + style, CSSPropertyID::kWhiteSpaceCollapse, CSSValueID::kCollapse); + AddPropertyToPresentationAttributeStyle(style, CSSPropertyID::kTextWrap, + CSSValueID::kNowrap); } } else { SVGGraphicsElement::CollectStyleForPresentationAttribute(name, value, diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 index c6bff8aca96d7..ad561a1ade770 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5 @@ -1115,13 +1115,11 @@ { name: "CSSTextWrapBalanceByScore", status: "stable", - depends_on: ["CSSWhiteSpaceShorthand"], }, // `text-wrap: pretty`. crbug.com/1432798 { name: "CSSTextWrapPretty", status: "stable", - depends_on: ["CSSWhiteSpaceShorthand"], }, // Support for CSS Toggles, https://tabatkins.github.io/css-toggle/ { @@ -1204,11 +1202,6 @@ status: "stable", base_feature: "none", }, - // `white-space` as a shorthand. crbug.com/1417543 - { - name: "CSSWhiteSpaceShorthand", - status: "stable", - }, { // https://html.spec.whatwg.org/#dom-customelementregistry-getname name: "CustomElementsGetName",