diff --git a/third_party/blink/public/mojom/use_counter/css_property_id.mojom b/third_party/blink/public/mojom/use_counter/css_property_id.mojom index 3f32fdf1023336..e6ded3c0e794fc 100644 --- a/third_party/blink/public/mojom/use_counter/css_property_id.mojom +++ b/third_party/blink/public/mojom/use_counter/css_property_id.mojom @@ -702,7 +702,7 @@ enum CSSSampleId { kMathStyle = 656, kAspectRatio = 657, kAppearance = 658, - kMathSuperscriptShiftStyle = 659, + // kMathSuperscriptShiftStyle = 659, kRubyPosition = 660, kTextUnderlineOffset = 661, kContentVisibility = 662, @@ -719,6 +719,7 @@ enum CSSSampleId { kDescentOverride = 673, kAdvanceOverride = 674, kLineGapOverride = 675, + kMathShift = 676, // 1. Add new features above this line (don't change the assigned numbers of // the existing items). // 2. Run the src/tools/metrics/histograms/update_use_counter_css.py script diff --git a/third_party/blink/renderer/core/css/css_computed_style_declaration.cc b/third_party/blink/renderer/core/css/css_computed_style_declaration.cc index 39bb0ef661bc1f..55fccdb9ed8a08 100644 --- a/third_party/blink/renderer/core/css/css_computed_style_declaration.cc +++ b/third_party/blink/renderer/core/css/css_computed_style_declaration.cc @@ -138,8 +138,8 @@ const CSSPropertyID kComputedPropertyArray[] = { CSSPropertyID::kMarginLeft, CSSPropertyID::kMarginRight, CSSPropertyID::kMarginTop, CSSPropertyID::kMarkerEnd, CSSPropertyID::kMarkerMid, CSSPropertyID::kMarkerStart, - CSSPropertyID::kMaskType, CSSPropertyID::kMathStyle, - CSSPropertyID::kMathSuperscriptShiftStyle, CSSPropertyID::kMaxBlockSize, + CSSPropertyID::kMaskType, CSSPropertyID::kMathShift, + CSSPropertyID::kMathStyle, CSSPropertyID::kMaxBlockSize, CSSPropertyID::kMaxHeight, CSSPropertyID::kMaxInlineSize, CSSPropertyID::kMaxWidth, CSSPropertyID::kMinBlockSize, CSSPropertyID::kMinHeight, CSSPropertyID::kMinInlineSize, diff --git a/third_party/blink/renderer/core/css/css_properties.json5 b/third_party/blink/renderer/core/css/css_properties.json5 index e0a5d63476d66b..5c075acdb98e2d 100644 --- a/third_party/blink/renderer/core/css/css_properties.json5 +++ b/third_party/blink/renderer/core/css/css_properties.json5 @@ -2516,26 +2516,26 @@ keywords: ["luminance", "alpha"], typedom_types: ["Keyword"] }, - // TODO(rbuis): should be moved to high priority later. { - name: "math-style", + name: "math-shift", property_methods: ["CSSValueFromComputedStyleInternal"], field_template: "keyword", inherited: true, keywords: ["normal", "compact"], typedom_types: ["Keyword"], default_value: "normal", - runtime_flag: "CSSMathStyle" + runtime_flag: "CSSMathShift" }, + // TODO(rbuis): should be moved to high priority later. { - name: "math-superscript-shift-style", + name: "math-style", property_methods: ["CSSValueFromComputedStyleInternal"], field_template: "keyword", inherited: true, - keywords: ["inline", "display"], + keywords: ["normal", "compact"], typedom_types: ["Keyword"], - default_value: "display", - runtime_flag: "CSSMathSuperscriptShiftStyle" + default_value: "normal", + runtime_flag: "CSSMathStyle" }, { name: "max-height", 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 be09de50945462..5bb23e6203f29e 100644 --- a/third_party/blink/renderer/core/css/css_value_keywords.json5 +++ b/third_party/blink/renderer/core/css/css_value_keywords.json5 @@ -640,15 +640,13 @@ "wavy", "-webkit-nowrap", - // - // math-style - // + // math-shift // normal "compact", - // math-shift - // inline - "display", + // math-style + // normal + // compact // CSS3 Values // box-align diff --git a/third_party/blink/renderer/core/css/mathml.css b/third_party/blink/renderer/core/css/mathml.css index b4314bfc70a745..0b2c214b77ec41 100644 --- a/third_party/blink/renderer/core/css/mathml.css +++ b/third_party/blink/renderer/core/css/mathml.css @@ -35,7 +35,7 @@ /* By default, we only display the MathML formulas without any formatting other than the one specified by the display attribute. */ math { display: inline-math; - math-superscript-shift-style: display; + math-shift: normal; math-style: compact; } @@ -83,16 +83,16 @@ mfrac > * { } mfrac > :nth-child(2) { - math-superscript-shift-style: inline; + math-shift: compact; } -/* Other rules for scriptlevel, displaystyle and math-superscript-shift-style */ +/* Other rules for scriptlevel, displaystyle and math-shift */ mroot > :not(:first-child) { font-size: scriptlevel(add(2)); math-style: compact; } mroot, msqrt { - math-superscript-shift-style: inline; + math-shift: compact; } msub > :not(:first-child), msup > :not(:first-child), @@ -116,6 +116,6 @@ munder > :nth-child(2), munderover > :nth-child(2), mover[accent="true" i] > :first-child, munderover[accent="true" i] > :first-child { - math-superscript-shift-style: inline; + math-shift: compact; } 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 9359240c23c093..12777c137aa66a 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 @@ -668,14 +668,14 @@ bool CSSParserFastPaths::IsValidKeywordPropertyAndValue( case CSSPropertyID::kMaskType: return value_id == CSSValueID::kLuminance || value_id == CSSValueID::kAlpha; + case CSSPropertyID::kMathShift: + DCHECK(RuntimeEnabledFeatures::CSSMathShiftEnabled()); + return value_id == CSSValueID::kNormal || + value_id == CSSValueID::kCompact; case CSSPropertyID::kMathStyle: DCHECK(RuntimeEnabledFeatures::CSSMathStyleEnabled()); return value_id == CSSValueID::kNormal || value_id == CSSValueID::kCompact; - case CSSPropertyID::kMathSuperscriptShiftStyle: - DCHECK(RuntimeEnabledFeatures::CSSMathSuperscriptShiftStyleEnabled()); - return value_id == CSSValueID::kInline || - value_id == CSSValueID::kDisplay; case CSSPropertyID::kObjectFit: return value_id == CSSValueID::kFill || value_id == CSSValueID::kContain || @@ -1045,8 +1045,8 @@ bool CSSParserFastPaths::IsKeywordPropertyID(CSSPropertyID property_id) { case CSSPropertyID::kListStylePosition: case CSSPropertyID::kListStyleType: case CSSPropertyID::kMaskType: + case CSSPropertyID::kMathShift: case CSSPropertyID::kMathStyle: - case CSSPropertyID::kMathSuperscriptShiftStyle: case CSSPropertyID::kObjectFit: case CSSPropertyID::kOutlineStyle: case CSSPropertyID::kOverflowAnchor: 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 d01781947ef1bc..15539b61782a8e 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 @@ -4083,20 +4083,20 @@ const CSSValue* MaskType::CSSValueFromComputedStyleInternal( return CSSIdentifierValue::Create(svg_style.MaskType()); } -const CSSValue* MathStyle::CSSValueFromComputedStyleInternal( +const CSSValue* MathShift::CSSValueFromComputedStyleInternal( const ComputedStyle& style, const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { - return CSSIdentifierValue::Create(style.MathStyle()); + return CSSIdentifierValue::Create(style.MathShift()); } -const CSSValue* MathSuperscriptShiftStyle::CSSValueFromComputedStyleInternal( +const CSSValue* MathStyle::CSSValueFromComputedStyleInternal( const ComputedStyle& style, const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const { - return CSSIdentifierValue::Create(style.MathSuperscriptShiftStyle()); + return CSSIdentifierValue::Create(style.MathStyle()); } const CSSValue* MaxBlockSize::ParseSingleValue( diff --git a/third_party/blink/renderer/core/layout/ng/mathml/ng_math_scripts_layout_algorithm.cc b/third_party/blink/renderer/core/layout/ng/mathml/ng_math_scripts_layout_algorithm.cc index 48c808d6ca1a41..e8c5922e0e4233 100644 --- a/third_party/blink/renderer/core/layout/ng/mathml/ng_math_scripts_layout_algorithm.cc +++ b/third_party/blink/renderer/core/layout/ng/mathml/ng_math_scripts_layout_algorithm.cc @@ -197,8 +197,7 @@ NGMathScriptsLayoutAlgorithm::GetVerticalMetrics( if (type == MathScriptType::kSuper || type == MathScriptType::kSubSup || type == MathScriptType::kMultiscripts || type == MathScriptType::kOver || type == MathScriptType::kMultiscripts) { - if (Style().MathSuperscriptShiftStyle() == - EMathSuperscriptShiftStyle::kInline) + if (Style().MathShift() == EMathShift::kCompact) shift_up = parameters.superscript_shift_up_cramped; metrics.sup_shift = std::max(shift_up, base_metrics.ascent - diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 index aca704e003b368..cb1c127241adf7 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5 @@ -514,12 +514,12 @@ name: "CSSMatchedPropertiesCacheDependencies", }, { - name: "CSSMathStyle", + name: "CSSMathShift", status: "experimental", implied_by: ["MathMLCore"], }, { - name: "CSSMathSuperscriptShiftStyle", + name: "CSSMathStyle", status: "experimental", implied_by: ["MathMLCore"], }, diff --git a/third_party/blink/web_tests/external/wpt/mathml/presentation-markup/scripts/cramped-001.html b/third_party/blink/web_tests/external/wpt/mathml/presentation-markup/scripts/cramped-001.html index 029d0f6e9ace58..06a0d5fa5ca31d 100644 --- a/third_party/blink/web_tests/external/wpt/mathml/presentation-markup/scripts/cramped-001.html +++ b/third_party/blink/web_tests/external/wpt/mathml/presentation-markup/scripts/cramped-001.html @@ -8,7 +8,7 @@ - + @@ -138,6 +138,14 @@ assert_cramped("mmultiscripts-005", false, "post-superscript"); }, "mmultiscripts"); + test(function() { + assert_true(MathMLFeatureDetection.has_mspace()); + assert_cramped("css-001", false); + assert_cramped("css-002", true); + assert_cramped("css-003", true); + assert_cramped("css-004", false); + }, "element with specified CSS math-style"); + done(); } @@ -588,5 +596,31 @@
++ + + + +