Changeset 259785 in webkit
- Timestamp:
- Apr 9, 2020, 12:57:16 AM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
-
ChangeLog (modified) (1 diff)
-
mathml/MathMLElement.h (modified) (1 diff)
-
mathml/MathMLOperatorElement.cpp (modified) (1 diff)
-
rendering/mathml/RenderMathMLBlock.cpp (modified) (1 diff)
-
rendering/mathml/RenderMathMLOperator.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r259773 r259785 1 2020-04-09 Delan Azabani <dazabani@igalia.com> 2 3 Remove unnecessary explicit parsing for mo@maxsize value "infinity" 4 https://bugs.webkit.org/show_bug.cgi?id=202720 5 6 Reviewed by Frédéric Wang. 7 8 In MathML 2, the default mo@maxsize was infinity [1], unless some other 9 default was given by mstyle@maxsize [2]. The sole purpose of "infinity" 10 was to give authors a way to set mo@maxsize to infinity when some other 11 mstyle@maxsize was set. 12 13 MathML Core removes mstyle@maxsize [3][4], such that "infinity" has the 14 same semantics as any other missing or invalid mo@maxsize, so the spec 15 has been simplified to make infinity an anonymous value [5][6]. 16 17 No functional change, because WebKit has never supported mstyle@maxsize 18 anyway. To verify that there's no functional change: 19 20 1. Search for references to LengthType::Infinity, and observe that the 21 mo@maxsize parser in MathMLOperatorElement::maxSize is the only 22 place where a Length of ::type infinity is created 23 2. Search for references to that method, and observe that the only 24 caller (RenderMathMLOperator::maxSize) passes intMaxForLayoutUnit 25 (infinity) to toUserUnits as the referenceValue 26 3. Go to the definition of toUserUnits, and observe that the refer- 27 enceValue is used as the ParsingFailed default 28 4. Step 1 shows that no other attributes would be affected by removing 29 LengthType::Infinity, and steps 2 and 3 show that mo@maxsize treats 30 invalid values as infinity, therefore it's safe to remove both the 31 "infinity" parsing code and the underlying LengthType variant 32 33 [1] https://www.w3.org/TR/MathML2/chapter3.html#id.3.2.5.2 34 [2] https://www.w3.org/TR/MathML2/chapter3.html#presm.mstyle 35 [3] https://mathml-refresh.github.io/mathml-core/#style-change-mstyle 36 [4] https://github.com/mathml-refresh/mathml/issues/1 37 [5] https://mathml-refresh.github.io/mathml-core/#dictionary-based-attributes 38 [6] https://github.com/mathml-refresh/mathml/issues/107 39 40 No new tests, because no functional change. 41 42 * mathml/MathMLElement.h: Remove LengthType::Infinity. 43 * mathml/MathMLOperatorElement.cpp: 44 (WebCore::MathMLOperatorElement::maxSize): Remove explicit branch on "infinity". Replace what remains with an equivalent cachedMathMLLength call. 45 * rendering/mathml/RenderMathMLBlock.cpp: 46 (WebCore::toUserUnits): Remove explicit branch on LengthType::Infinity. 47 * rendering/mathml/RenderMathMLOperator.cpp: 48 (WebCore::RenderMathMLOperator::maxSize): Update comment to refer to the default value in the same way as the spec. 49 1 50 2020-04-08 Chris Dumez <cdumez@apple.com> 2 51 -
trunk/Source/WebCore/mathml/MathMLElement.h
r248931 r259785 53 53 // TeX's Math Unit is used internally for named spaces (1 mu = 1/18 em). 54 54 // Unitless values are interpreted as a multiple of a reference value. 55 enum class LengthType { Cm, Em, Ex, In, MathUnit, Mm, ParsingFailed, Pc, Percentage, Pt, Px, UnitLess , Infinity};55 enum class LengthType { Cm, Em, Ex, In, MathUnit, Mm, ParsingFailed, Pc, Percentage, Pt, Px, UnitLess }; 56 56 struct Length { 57 57 LengthType type { LengthType::ParsingFailed }; -
trunk/Source/WebCore/mathml/MathMLOperatorElement.cpp
r246490 r259785 199 199 const MathMLElement::Length& MathMLOperatorElement::maxSize() 200 200 { 201 if (m_maxSize) 202 return m_maxSize.value(); 203 204 const AtomString& value = attributeWithoutSynchronization(MathMLNames::maxsizeAttr); 205 if (value == "infinity") { 206 Length maxsize; 207 maxsize.type = LengthType::Infinity; 208 m_maxSize = maxsize; 209 } else 210 m_maxSize = parseMathMLLength(value); 211 212 return m_maxSize.value(); 201 return cachedMathMLLength(MathMLNames::maxsizeAttr, m_maxSize); 213 202 } 214 203 -
trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp
r245543 r259785 171 171 case MathMLElement::LengthType::ParsingFailed: 172 172 return referenceValue; 173 case MathMLElement::LengthType::Infinity:174 return intMaxForLayoutUnit;175 173 default: 176 174 ASSERT_NOT_REACHED(); -
trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp
r245543 r259785 108 108 LayoutUnit RenderMathMLOperator::maxSize() const 109 109 { 110 LayoutUnit maxSize = intMaxForLayoutUnit; // Default maxsize is "infinity".110 LayoutUnit maxSize = intMaxForLayoutUnit; // Default maxsize is ∞. 111 111 maxSize = toUserUnits(element().maxSize(), style(), maxSize); 112 112 return std::max<LayoutUnit>(0, maxSize);
Note:
See TracChangeset
for help on using the changeset viewer.