Changeset 203679 in webkit
- Timestamp:
- Jul 25, 2016 12:18:47 AM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r203678 r203679 1 2016-07-24 Frederic Wang <fwang@igalia.com> 2 3 Move parsing of display, displaystyle and mathvariant attributes into MathML element classes 4 https://bugs.webkit.org/show_bug.cgi?id=159623 5 6 Reviewed by Brent Fulgham. 7 8 No new tests, already covered by existing tests. 9 10 * mathml/MathMLElement.cpp: 11 (WebCore::MathMLElement::parseMathVariantAttribute): Move helper function to parse the 12 mathvariant attribute. 13 (WebCore::MathMLElement::getSpecifiedDisplayStyle): Helper function to set the displaystyle 14 value from the attribute specified on the MathML element. 15 (WebCore::MathMLElement::getSpecifiedMathVariant): Helper function to set the mathvariant 16 value from the attribute specified on the MathML element. 17 * mathml/MathMLElement.h: Move the enum for mathvariant values and declare new members. 18 (WebCore::MathMLElement::acceptsDisplayStyleAttribute): Indicate whether the element accepts 19 displaystyle attribute (false for most of them). 20 (WebCore::MathMLElement::acceptsMathVariantAttribute): Indicate whether the element accepts 21 mathvariant attribute (false for most of them). 22 * mathml/MathMLInlineContainerElement.cpp: 23 (WebCore::MathMLInlineContainerElement::acceptsDisplayStyleAttribute): Add mstyle and mtable 24 to the list of elements accepting the displaystyle attribute. 25 (WebCore::MathMLInlineContainerElement::acceptsMathVariantAttribute): Add mstyle to the list 26 of elements accepting the mathvariant attribute. 27 (WebCore::MathMLInlineContainerElement::parseAttribute): Mark displaystyle and mathvariant 28 dirty if necessary. Also use the new accepts*Attribute function. 29 * mathml/MathMLInlineContainerElement.h: Declare overridden accepts*Attribute members. 30 * mathml/MathMLMathElement.cpp: 31 (WebCore::MathMLMathElement::getSpecifiedDisplayStyle): Override acceptsDisplayStyleAttribute 32 so that the display attribute is also used to set the default value if the displaystyle 33 attribute is absent. 34 (WebCore::MathMLMathElement::parseAttribute): Mark displaystyle and mathvariant dirty if 35 necessary. We directly MathMLElement::parseAttribute to avoid duplicate work. 36 * mathml/MathMLMathElement.h: Add the math tag to the list of elements accepting the 37 displaystyle and mathvariant attributes. Declare overridden getSpecifiedDisplayStyle. 38 * mathml/MathMLTextElement.cpp: 39 (WebCore::MathMLTextElement::parseAttribute): Mark mathvariant as dirty. 40 * mathml/MathMLTextElement.h: Add token elements to the list of elements accepting the 41 mathvariant attribute. 42 * rendering/mathml/MathMLStyle.cpp: 43 (WebCore::MathMLStyle::updateStyleIfNeeded): Use the new MathMLElement::MathVariant enum. 44 (WebCore::MathMLStyle::resolveMathMLStyle): We no longer parse the display value to 45 initialize the default value on the math tag, because this is handled in 46 getSpecifiedDisplayStyle. In general, we also just call getSpecifiedDisplayStyle and 47 getSpecifiedMathVariant on the MathML elements instead of parsing the displaystyle and 48 mathvariant attributes here. 49 (WebCore::MathMLStyle::parseMathVariant): Deleted. This is moved into MathMLElement. 50 * rendering/mathml/MathMLStyle.h: Use the new MathMLElement::MathVariant enum. 51 * rendering/mathml/RenderMathMLToken.cpp: Ditto. 52 (WebCore::mathVariant): Ditto. 53 (WebCore::RenderMathMLToken::updateMathVariantGlyph): Ditto. 54 1 55 2016-07-25 Carlos Garcia Campos <cgarcia@igalia.com> 2 56 -
trunk/Source/WebCore/mathml/MathMLElement.cpp
r203667 r203679 3 3 * Copyright (C) 2010 Apple Inc. All rights reserved. 4 4 * Copyright (C) 2010 François Sausset (sausset@gmail.com). All rights reserved. 5 * Copyright (C) 2016 Igalia S.L. 5 6 * 6 7 * Redistribution and use in source and binary forms, with or without … … 544 545 } 545 546 547 MathMLElement::MathVariant MathMLElement::parseMathVariantAttribute(const AtomicString& attributeValue) 548 { 549 // The mathvariant attribute values is case-sensitive. 550 if (attributeValue == "normal") 551 return MathVariant::Normal; 552 if (attributeValue == "bold") 553 return MathVariant::Bold; 554 if (attributeValue == "italic") 555 return MathVariant::Italic; 556 if (attributeValue == "bold-italic") 557 return MathVariant::BoldItalic; 558 if (attributeValue == "double-struck") 559 return MathVariant::DoubleStruck; 560 if (attributeValue == "bold-fraktur") 561 return MathVariant::BoldFraktur; 562 if (attributeValue == "script") 563 return MathVariant::Script; 564 if (attributeValue == "bold-script") 565 return MathVariant::BoldScript; 566 if (attributeValue == "fraktur") 567 return MathVariant::Fraktur; 568 if (attributeValue == "sans-serif") 569 return MathVariant::SansSerif; 570 if (attributeValue == "bold-sans-serif") 571 return MathVariant::BoldSansSerif; 572 if (attributeValue == "sans-serif-italic") 573 return MathVariant::SansSerifItalic; 574 if (attributeValue == "sans-serif-bold-italic") 575 return MathVariant::SansSerifBoldItalic; 576 if (attributeValue == "monospace") 577 return MathVariant::Monospace; 578 if (attributeValue == "initial") 579 return MathVariant::Initial; 580 if (attributeValue == "tailed") 581 return MathVariant::Tailed; 582 if (attributeValue == "looped") 583 return MathVariant::Looped; 584 if (attributeValue == "stretched") 585 return MathVariant::Stretched; 586 return MathVariant::None; 587 } 588 589 Optional<bool> MathMLElement::specifiedDisplayStyle() 590 { 591 if (!acceptsDisplayStyleAttribute()) 592 return Optional<bool>(); 593 const MathMLElement::BooleanValue& specifiedDisplayStyle = cachedBooleanAttribute(displaystyleAttr, m_displayStyle); 594 return specifiedDisplayStyle == BooleanValue::Default ? Optional<bool>() : Optional<bool>(specifiedDisplayStyle == BooleanValue::True); 595 } 596 597 Optional<MathMLElement::MathVariant> MathMLElement::specifiedMathVariant() 598 { 599 if (!acceptsMathVariantAttribute()) 600 return Optional<MathVariant>(); 601 if (m_mathVariant.dirty) { 602 m_mathVariant.value = parseMathVariantAttribute(attributeWithoutSynchronization(mathvariantAttr)); 603 m_mathVariant.dirty = false; 604 } 605 return m_mathVariant.value == MathVariant::None ? Optional<MathVariant>() : Optional<MathVariant>(m_mathVariant.value); 606 } 607 546 608 } 547 609 -
trunk/Source/WebCore/mathml/MathMLElement.h
r203553 r203679 3 3 * Copyright (C) 2010 Apple Inc. All rights reserved. 4 4 * Copyright (C) 2010 François Sausset (sausset@gmail.com). All rights reserved. 5 * Copyright (C) 2016 Igalia S.L. 5 6 * 6 7 * Redistribution and use in source and binary forms, with or without … … 73 74 }; 74 75 76 // These are the mathvariant values from the MathML recommendation. 77 // The special value none means that no explicit mathvariant value has been specified. 78 // Note that the numeral values are important for the computation performed in the mathVariant function of RenderMathMLToken, do not change them! 79 enum class MathVariant { 80 None = 0, 81 Normal = 1, 82 Bold = 2, 83 Italic = 3, 84 BoldItalic = 4, 85 Script = 5, 86 BoldScript = 6, 87 Fraktur = 7, 88 DoubleStruck = 8, 89 BoldFraktur = 9, 90 SansSerif = 10, 91 BoldSansSerif = 11, 92 SansSerifItalic = 12, 93 SansSerifBoldItalic = 13, 94 Monospace = 14, 95 Initial = 15, 96 Tailed = 16, 97 Looped = 17, 98 Stretched = 18 99 }; 100 struct MathVariantAttribute { 101 MathVariant value { MathVariant::None }; 102 bool dirty { true }; 103 }; 104 105 virtual Optional<bool> specifiedDisplayStyle(); 106 Optional<MathMLElement::MathVariant> specifiedMathVariant(); 107 75 108 protected: 76 109 MathMLElement(const QualifiedName& tagName, Document&); … … 92 125 const BooleanValue& cachedBooleanAttribute(const QualifiedName&, BooleanAttribute&); 93 126 127 virtual bool acceptsDisplayStyleAttribute() { return false; } 128 virtual bool acceptsMathVariantAttribute() { return false; } 129 130 BooleanAttribute m_displayStyle; 131 MathVariantAttribute m_mathVariant; 132 94 133 private: 95 134 virtual void updateSelectedChild() { } 96 135 static Length parseNumberAndUnit(const StringView&); 97 136 static Length parseNamedSpace(const StringView&); 137 static MathVariant parseMathVariantAttribute(const AtomicString& attributeValue); 98 138 99 139 bool canStartSelection() const final; -
trunk/Source/WebCore/mathml/MathMLInlineContainerElement.cpp
r203553 r203679 2 2 * Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved. 3 3 * Copyright (C) 2010 Apple Inc. All rights reserved. 4 * Copyright (C) 2016 Igalia S.L. 4 5 * 5 6 * Redistribution and use in source and binary forms, with or without … … 75 76 } 76 77 78 bool MathMLInlineContainerElement::acceptsDisplayStyleAttribute() 79 { 80 return hasTagName(mstyleTag) || hasTagName(mtableTag); 81 } 82 83 bool MathMLInlineContainerElement::acceptsMathVariantAttribute() 84 { 85 return hasTagName(mstyleTag); 86 } 87 77 88 void MathMLInlineContainerElement::parseAttribute(const QualifiedName& name, const AtomicString& value) 78 89 { 79 bool displayStyleAttribute = (name == displaystyleAttr && (hasTagName(mstyleTag) || hasTagName(mtableTag))); 80 bool mathVariantAttribute = (name == mathvariantAttr && (hasTagName(mathTag) || hasTagName(mstyleTag))); 90 bool displayStyleAttribute = name == displaystyleAttr && acceptsDisplayStyleAttribute(); 91 bool mathVariantAttribute = name == mathvariantAttr && acceptsMathVariantAttribute(); 92 if (displayStyleAttribute) 93 m_displayStyle.dirty = true; 94 if (mathVariantAttribute) 95 m_mathVariant.dirty = true; 81 96 if ((displayStyleAttribute || mathVariantAttribute) && renderer()) 82 97 MathMLStyle::resolveMathMLStyleTree(renderer()); -
trunk/Source/WebCore/mathml/MathMLInlineContainerElement.h
r203228 r203679 2 2 * Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved. 3 3 * Copyright (C) 2010 Apple Inc. All rights reserved. 4 * Copyright (C) 2016 Igalia S.L. 4 5 * 5 6 * Redistribution and use in source and binary forms, with or without … … 41 42 void parseAttribute(const QualifiedName&, const AtomicString&) override; 42 43 44 bool acceptsDisplayStyleAttribute() override; 45 bool acceptsMathVariantAttribute() override; 46 43 47 private: 44 48 RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override; -
trunk/Source/WebCore/mathml/MathMLMathElement.cpp
r203072 r203679 2 2 * Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved. 3 3 * Copyright (C) 2010 Apple Inc. All rights reserved. 4 * Copyright (C) 2016 Igalia S.L. 4 5 * 5 6 * Redistribution and use in source and binary forms, with or without … … 54 55 } 55 56 57 Optional<bool> MathMLMathElement::specifiedDisplayStyle() 58 { 59 if (cachedBooleanAttribute(displaystyleAttr, m_displayStyle) == BooleanValue::Default) { 60 // The default displaystyle value of the <math> depends on the display attribute, so we parse it here. 61 const AtomicString& value = attributeWithoutSynchronization(displayAttr); 62 if (value == "block") 63 m_displayStyle.value = BooleanValue::True; 64 else if (value == "inline") 65 m_displayStyle.value = BooleanValue::False; 66 } 67 return m_displayStyle.value == BooleanValue::Default ? Optional<bool>() : Optional<bool>(m_displayStyle.value == BooleanValue::True); 68 } 69 56 70 void MathMLMathElement::parseAttribute(const QualifiedName& name, const AtomicString& value) 57 71 { 58 if ((name == displaystyleAttr || name == displayAttr || name == mathvariantAttr) && renderer()) 72 bool displayStyleAttribute = (name == displaystyleAttr || name == displayAttr); 73 bool mathVariantAttribute = name == mathvariantAttr; 74 if (displayStyleAttribute) 75 m_displayStyle.dirty = true; 76 if (mathVariantAttribute) 77 m_mathVariant.dirty = true; 78 if ((displayStyleAttribute || mathVariantAttribute) && renderer()) 59 79 MathMLStyle::resolveMathMLStyleTree(renderer()); 60 80 61 MathML InlineContainerElement::parseAttribute(name, value);81 MathMLElement::parseAttribute(name, value); 62 82 } 63 83 -
trunk/Source/WebCore/mathml/MathMLMathElement.h
r203228 r203679 2 2 * Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved. 3 3 * Copyright (C) 2010 Apple Inc. All rights reserved. 4 * Copyright (C) 2016 Igalia S.L. 4 5 * 5 6 * Redistribution and use in source and binary forms, with or without … … 41 42 void didAttachRenderers() final; 42 43 44 bool acceptsDisplayStyleAttribute() final { return true; } 45 bool acceptsMathVariantAttribute() final { return true; } 46 Optional<bool> specifiedDisplayStyle() final; 47 43 48 RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; 44 49 }; -
trunk/Source/WebCore/mathml/MathMLTextElement.cpp
r203108 r203679 72 72 } 73 73 74 if (name == mathvariantAttr && renderer()) 75 MathMLStyle::resolveMathMLStyleTree(renderer()); 74 if (name == mathvariantAttr) { 75 m_mathVariant.dirty = true; 76 if (renderer()) 77 MathMLStyle::resolveMathMLStyleTree(renderer()); 78 } 76 79 77 80 MathMLElement::parseAttribute(name, value); -
trunk/Source/WebCore/mathml/MathMLTextElement.h
r203228 r203679 2 2 * Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved. 3 3 * Copyright (C) 2010 Apple Inc. All rights reserved. 4 * Copyright (C) 2016 Igalia S.L. 4 5 * 5 6 * Redistribution and use in source and binary forms, with or without … … 35 36 public: 36 37 static Ref<MathMLTextElement> create(const QualifiedName& tagName, Document&); 38 bool acceptsMathVariantAttribute() final { return true; } 37 39 38 40 private: -
trunk/Source/WebCore/rendering/mathml/MathMLStyle.cpp
r203324 r203679 82 82 } 83 83 84 void MathMLStyle::updateStyleIfNeeded(RenderObject* renderer, bool oldDisplayStyle, Math Variant oldMathVariant)84 void MathMLStyle::updateStyleIfNeeded(RenderObject* renderer, bool oldDisplayStyle, MathMLElement::MathVariant oldMathVariant) 85 85 { 86 86 if (oldDisplayStyle != m_displayStyle) { … … 99 99 } 100 100 101 MathMLStyle::MathVariant MathMLStyle::parseMathVariant(const AtomicString& attributeValue)102 {103 if (attributeValue == "normal")104 return Normal;105 if (attributeValue == "bold")106 return Bold;107 if (attributeValue == "italic")108 return Italic;109 if (attributeValue == "bold-italic")110 return BoldItalic;111 if (attributeValue == "double-struck")112 return DoubleStruck;113 if (attributeValue == "bold-fraktur")114 return BoldFraktur;115 if (attributeValue == "script")116 return Script;117 if (attributeValue == "bold-script")118 return BoldScript;119 if (attributeValue == "fraktur")120 return Fraktur;121 if (attributeValue == "sans-serif")122 return SansSerif;123 if (attributeValue == "bold-sans-serif")124 return BoldSansSerif;125 if (attributeValue == "sans-serif-italic")126 return SansSerifItalic;127 if (attributeValue == "sans-serif-bold-italic")128 return SansSerifBoldItalic;129 if (attributeValue == "monospace")130 return Monospace;131 if (attributeValue == "initial")132 return Initial;133 if (attributeValue == "tailed")134 return Tailed;135 if (attributeValue == "looped")136 return Looped;137 if (attributeValue == "stretched")138 return Stretched;139 return None;140 }141 142 101 void MathMLStyle::resolveMathMLStyle(RenderObject* renderer) 143 102 { … … 145 104 146 105 bool oldDisplayStyle = m_displayStyle; 147 Math Variant oldMathVariant = m_mathVariant;106 MathMLElement::MathVariant oldMathVariant = m_mathVariant; 148 107 auto* parentRenderer = getMathMLParentNode(renderer); 149 108 const MathMLStyle* parentStyle = getMathMLStyle(parentRenderer); … … 151 110 // By default, we just inherit the style from our parent. 152 111 m_displayStyle = false; 153 m_mathVariant = None;112 m_mathVariant = MathMLElement::MathVariant::None; 154 113 if (parentStyle) { 155 114 setDisplayStyle(parentStyle->displayStyle()); … … 163 122 } 164 123 165 if (is<RenderMathMLMath>(renderer)) 166 m_displayStyle = downcast<RenderElement>(renderer)->element()->attributeWithoutSynchronization(displayAttr) == "block"; // The default displaystyle of the <math> element depends on its display attribute. 167 else if (is<RenderMathMLTable>(renderer)) 168 m_displayStyle = false; // The default displaystyle of <mtable> is false. 124 if (is<RenderMathMLMath>(renderer) || is<RenderMathMLTable>(renderer)) 125 m_displayStyle = false; // The default displaystyle of <math> and <mtable> is false. 169 126 else if (parentRenderer) { 170 127 if (is<RenderMathMLFraction>(parentRenderer)) … … 178 135 } 179 136 180 // The displaystyle attribute on the <math>, <mtable> or <mstyle> elements override the default behavior. 181 const auto* element = downcast<RenderElement>(renderer)->element(); 182 const QualifiedName& tagName = element->tagQName(); 183 if (tagName == mathTag || tagName == mtableTag || tagName == mstyleTag) { 184 // We only modify the value of displaystyle if there is an explicit and valid attribute. 185 const AtomicString& attributeValue = element->attributeWithoutSynchronization(displaystyleAttr); 186 if (attributeValue == "true") 187 m_displayStyle = true; 188 else if (attributeValue == "false") 189 m_displayStyle = false; 137 // The displaystyle and mathvariant attributes override the default behavior. 138 auto* element = downcast<RenderElement>(renderer)->element(); 139 if (is<MathMLElement>(element)) { 140 Optional<bool> displayStyle = downcast<MathMLElement>(element)->specifiedDisplayStyle(); 141 if (displayStyle) 142 m_displayStyle = displayStyle.value(); 143 Optional<MathMLElement::MathVariant> mathVariant = downcast<MathMLElement>(element)->specifiedMathVariant(); 144 if (mathVariant) 145 m_mathVariant = mathVariant.value(); 190 146 } 191 192 // The mathvariant attribute on the <math>, <mstyle> or token elements overrides the default behavior.193 if (is<RenderMathMLMath>(renderer) || is<RenderMathMLToken>(renderer) || tagName == mstyleTag) {194 MathVariant mathvariant = parseMathVariant(element->attributeWithoutSynchronization(mathvariantAttr));195 if (mathvariant != None)196 m_mathVariant = mathvariant;197 }198 199 147 updateStyleIfNeeded(renderer, oldDisplayStyle, oldMathVariant); 200 148 } -
trunk/Source/WebCore/rendering/mathml/MathMLStyle.h
r203228 r203679 29 29 30 30 #include "Element.h" 31 #include "MathMLElement.h" 31 32 #include <wtf/RefCounted.h> 32 33 … … 41 42 void setDisplayStyle(bool displayStyle) { m_displayStyle = displayStyle; } 42 43 43 // These are the mathvariant values from the MathML recommendation. 44 // The special value none means that no explicit mathvariant value has been specified. 45 // Note that the numeral values are important for the computation performed in the mathVariant function of RenderMathMLToken, do not change them! 46 enum MathVariant { 47 None = 0, 48 Normal = 1, 49 Bold = 2, 50 Italic = 3, 51 BoldItalic = 4, 52 Script = 5, 53 BoldScript = 6, 54 Fraktur = 7, 55 DoubleStruck = 8, 56 BoldFraktur = 9, 57 SansSerif = 10, 58 BoldSansSerif = 11, 59 SansSerifItalic = 12, 60 SansSerifBoldItalic = 13, 61 Monospace = 14, 62 Initial = 15, 63 Tailed = 16, 64 Looped = 17, 65 Stretched = 18 66 }; 67 MathVariant mathVariant() const { return m_mathVariant; } 68 void setMathVariant(MathVariant mathvariant) { m_mathVariant = mathvariant; } 44 MathMLElement::MathVariant mathVariant() const { return m_mathVariant; } 45 void setMathVariant(MathMLElement::MathVariant mathvariant) { m_mathVariant = mathvariant; } 69 46 70 47 void resolveMathMLStyle(RenderObject*); … … 75 52 const MathMLStyle* getMathMLStyle(RenderObject* renderer); 76 53 RenderObject* getMathMLParentNode(RenderObject*); 77 void updateStyleIfNeeded(RenderObject*, bool, MathVariant); 78 MathVariant parseMathVariant(const AtomicString& attributeValue); 54 void updateStyleIfNeeded(RenderObject*, bool, MathMLElement::MathVariant); 79 55 80 56 bool m_displayStyle { false }; 81 Math Variant m_mathVariant {None };57 MathMLElement::MathVariant m_mathVariant { MathMLElement::MathVariant::None }; 82 58 }; 83 59 -
trunk/Source/WebCore/rendering/mathml/RenderMathMLToken.cpp
r203280 r203679 30 30 #if ENABLE(MATHML) 31 31 32 #include "MathMLElement.h" 32 33 #include "MathMLNames.h" 33 34 #include "PaintInfo.h" … … 282 283 // unaltered. 283 284 // Characters already in the mathematical blocks (or are one of the exceptions) are never transformed. 284 // Acceptable values for mathvariant are specified in MathML Style.h285 // Acceptable values for mathvariant are specified in MathMLElement.h 285 286 // The transformable characters can be found at: 286 287 // http://lists.w3.org/Archives/Public/www-math/2013Sep/0012.html and 287 288 // https://en.wikipedia.org/wiki/Mathematical_Alphanumeric_Symbols 288 static UChar32 mathVariant(UChar32 codePoint, MathML Style::MathVariant mathvariant)289 { 290 ASSERT(mathvariant >= MathML Style::Normal && mathvariant <= MathMLStyle::Stretched);291 292 if (mathvariant == MathML Style::Normal)289 static UChar32 mathVariant(UChar32 codePoint, MathMLElement::MathVariant mathvariant) 290 { 291 ASSERT(mathvariant >= MathMLElement::MathVariant::Normal && mathvariant <= MathMLElement::MathVariant::Stretched); 292 293 if (mathvariant == MathMLElement::MathVariant::Normal) 293 294 return codePoint; // Nothing to do here. 294 295 … … 297 298 return codePoint; // Nothing at this code point is transformed 298 299 if (codePoint == greekLetterDigamma) { 299 if (mathvariant == MathML Style::Bold)300 if (mathvariant == MathMLElement::MathVariant::Bold) 300 301 return mathBoldCapitalDigamma; 301 302 return codePoint; 302 303 } 303 304 if (codePoint == greekSmallLetterDigamma) { 304 if (mathvariant == MathML Style::Bold)305 if (mathvariant == MathMLElement::MathVariant::Bold) 305 306 return mathBoldSmallDigamma; 306 307 return codePoint; 307 308 } 308 309 if (codePoint == latinSmallLetterDotlessI) { 309 if (mathvariant == MathML Style::Italic)310 if (mathvariant == MathMLElement::MathVariant::Italic) 310 311 return mathItalicSmallDotlessI; 311 312 return codePoint; 312 313 } 313 314 if (codePoint == latinSmallLetterDotlessJ) { 314 if (mathvariant == MathML Style::Italic)315 if (mathvariant == MathMLElement::MathVariant::Italic) 315 316 return mathItalicSmallDotlessJ; 316 317 return codePoint; … … 390 391 // multiplier represents the order of the sequences relative to the first one. 391 392 switch (mathvariant) { 392 case MathML Style::Bold:393 case MathMLElement::MathVariant::Bold: 393 394 multiplier = 0; 394 395 break; 395 case MathML Style::DoubleStruck:396 case MathMLElement::MathVariant::DoubleStruck: 396 397 multiplier = 1; 397 398 break; 398 case MathML Style::SansSerif:399 case MathMLElement::MathVariant::SansSerif: 399 400 multiplier = 2; 400 401 break; 401 case MathML Style::BoldSansSerif:402 case MathMLElement::MathVariant::BoldSansSerif: 402 403 multiplier = 3; 403 404 break; 404 case MathML Style::Monospace:405 case MathMLElement::MathVariant::Monospace: 405 406 multiplier = 4; 406 407 break; … … 417 418 if (varType == Greekish) { 418 419 switch (mathvariant) { 419 case MathML Style::Bold:420 case MathMLElement::MathVariant::Bold: 420 421 multiplier = 0; 421 422 break; 422 case MathML Style::Italic:423 case MathMLElement::MathVariant::Italic: 423 424 multiplier = 1; 424 425 break; 425 case MathML Style::BoldItalic:426 case MathMLElement::MathVariant::BoldItalic: 426 427 multiplier = 2; 427 428 break; 428 case MathML Style::BoldSansSerif:429 case MathMLElement::MathVariant::BoldSansSerif: 429 430 multiplier = 3; 430 431 break; 431 case MathML Style::SansSerifBoldItalic:432 case MathMLElement::MathVariant::SansSerifBoldItalic: 432 433 multiplier = 4; 433 434 break; … … 447 448 size_t tableLength; 448 449 switch (mathvariant) { 449 case MathML Style::Initial:450 case MathMLElement::MathVariant::Initial: 450 451 mapTable = arabicInitialMapTable; 451 452 tableLength = WTF_ARRAY_LENGTH(arabicInitialMapTable); 452 453 break; 453 case MathML Style::Tailed:454 case MathMLElement::MathVariant::Tailed: 454 455 mapTable = arabicTailedMapTable; 455 456 tableLength = WTF_ARRAY_LENGTH(arabicTailedMapTable); 456 457 break; 457 case MathML Style::Stretched:458 case MathMLElement::MathVariant::Stretched: 458 459 mapTable = arabicStretchedMapTable; 459 460 tableLength = WTF_ARRAY_LENGTH(arabicStretchedMapTable); 460 461 break; 461 case MathML Style::Looped:462 case MathMLElement::MathVariant::Looped: 462 463 mapTable = arabicLoopedMapTable; 463 464 tableLength = WTF_ARRAY_LENGTH(arabicLoopedMapTable); 464 465 break; 465 case MathML Style::DoubleStruck:466 case MathMLElement::MathVariant::DoubleStruck: 466 467 mapTable = arabicDoubleMapTable; 467 468 tableLength = WTF_ARRAY_LENGTH(arabicDoubleMapTable); … … 473 474 } else { 474 475 // Must be Latin 475 if (mathvariant > MathML Style::Monospace)476 if (mathvariant > MathMLElement::MathVariant::Monospace) 476 477 return codePoint; // Latin doesn't support the Arabic mathvariants 477 multiplier = mathvariant- 2;478 multiplier = static_cast<int>(mathvariant) - 2; 478 479 // This is possible because the values for NS_MATHML_MATHVARIANT_* are chosen to coincide with the order in which the encoded mathvariant characters are located within their unicode block (less an offset to avoid None and Normal variants) 479 480 // See the Number case for an explanation of the following calculation … … 524 525 if (textContent.length() == 1) { 525 526 UChar32 codePoint = textContent[0]; 526 MathML Style::MathVariant mathvariant = mathMLStyle()->mathVariant();527 if (mathvariant == MathML Style::None)528 mathvariant = tokenElement.hasTagName(MathMLNames::miTag) ? MathML Style::Italic : MathMLStyle::Normal;527 MathMLElement::MathVariant mathvariant = mathMLStyle()->mathVariant(); 528 if (mathvariant == MathMLElement::MathVariant::None) 529 mathvariant = tokenElement.hasTagName(MathMLNames::miTag) ? MathMLElement::MathVariant::Italic : MathMLElement::MathVariant::Normal; 529 530 UChar32 transformedCodePoint = mathVariant(codePoint, mathvariant); 530 531 if (transformedCodePoint != codePoint)
Note: See TracChangeset
for help on using the changeset viewer.