Changeset 203150 in webkit
- Timestamp:
- Jul 12, 2016 9:47:00 PM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 1 added
- 8 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/CMakeLists.txt
r203116 r203150 1988 1988 mathml/MathMLMencloseElement.cpp 1989 1989 mathml/MathMLOperatorDictionary.cpp 1990 mathml/MathMLPaddedElement.cpp 1990 1991 mathml/MathMLSelectElement.cpp 1991 1992 mathml/MathMLSpaceElement.cpp -
trunk/Source/WebCore/ChangeLog
r203149 r203150 1 2016-07-12 Frederic Wang <fwang@igalia.com> 2 3 Move parsing of mpadded attributes to a MathMLPaddedElement class 4 https://bugs.webkit.org/show_bug.cgi?id=159620 5 6 Reviewed by Brent Fulgham. 7 8 No new tests, behavior is unchanged. 9 10 * CMakeLists.txt: Add MathMLPaddedElement files. 11 * WebCore.xcodeproj/project.pbxproj: Ditto. 12 * mathml/MathMLAllInOne.cpp: Ditto. 13 * mathml/MathMLInlineContainerElement.cpp: Remove handling of mpadded. 14 * mathml/MathMLPaddedElement.cpp: Added. 15 (WebCore::MathMLPaddedElement::MathMLPaddedElement): 16 (WebCore::MathMLPaddedElement::create): 17 (WebCore::MathMLPaddedElement::width): Expose width attribute as a MathMLLength until mpadded 18 pseudo-units are supported. 19 (WebCore::MathMLPaddedElement::height): Ditto. 20 (WebCore::MathMLPaddedElement::depth): Ditto 21 (WebCore::MathMLPaddedElement::lspace): Ditto. 22 (WebCore::MathMLPaddedElement::voffset): Ditto. 23 (WebCore::MathMLPaddedElement::parseAttribute): Make length attribute dirty. 24 (WebCore::MathMLPaddedElement::createElementRenderer): Moved code from MathMLInlineContainerElement. 25 * mathml/MathMLPaddedElement.h: Added. 26 * mathml/mathtags.in: Map mapdded to MathMLPaddedElement. 27 * rendering/mathml/RenderMathMLPadded.cpp: 28 (WebCore::RenderMathMLPadded::resolveWidth): Helper function to resolve width. 29 (WebCore::RenderMathMLPadded::resolveAttributes): Helper function to resolve all attributes. 30 (WebCore::RenderMathMLPadded::computePreferredLogicalWidths): Use resolveWidth. 31 (WebCore::RenderMathMLPadded::layoutBlock): Use resolveAttributes. 32 * rendering/mathml/RenderMathMLPadded.h: Add new helper functions to access attributes from 33 the MathMLPaddedElement class. 34 1 35 2016-07-12 Andreas Kling <akling@apple.com> 2 36 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r203116 r203150 7209 7209 FED13D400CEA939400D89466 /* IconIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = FED13D3F0CEA939400D89466 /* IconIOS.mm */; }; 7210 7210 FED13D520CEA949700D89466 /* RenderThemeIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = FED13D500CEA949700D89466 /* RenderThemeIOS.h */; settings = {ATTRIBUTES = (Private, ); }; }; 7211 B59CA390CED66C3255F72C59 /* MathMLPaddedElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B59CA59AF170D8FAA5B8CABE /* MathMLPaddedElement.cpp */; }; 7211 7212 FED48390CED66C3255F72C59 /* MathMLSelectElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F75A059AF170D8FAA5B8CABE /* MathMLSelectElement.cpp */; }; 7212 7213 FEE1811316C319E800084849 /* SQLTransactionBackend.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEE1811116C319E800084849 /* SQLTransactionBackend.cpp */; }; … … 10026 10027 5958F1CB1343917C0080B31F /* XMLViewer.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = XMLViewer.css; sourceTree = "<group>"; }; 10027 10028 5958F1CC1343917C0080B31F /* XMLViewer.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = XMLViewer.js; sourceTree = "<group>"; }; 10029 B59CA849D41E6F65D81198BC /* MathMLPaddedElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathMLPaddedElement.h; sourceTree = "<group>"; }; 10028 10030 59780849D41E6F65D81198BC /* MathMLSelectElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathMLSelectElement.h; sourceTree = "<group>"; }; 10029 10031 598365DC1355F53C001B185D /* JSPositionCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPositionCallback.h; sourceTree = "<group>"; }; … … 15047 15049 F5E0C6591643C42C00D6CB69 /* BaseChooserOnlyDateAndTimeInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BaseChooserOnlyDateAndTimeInputType.cpp; sourceTree = "<group>"; }; 15048 15050 F5E0C65A1643C42C00D6CB69 /* BaseChooserOnlyDateAndTimeInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseChooserOnlyDateAndTimeInputType.h; sourceTree = "<group>"; }; 15051 B59CA59AF170D8FAA5B8CABE /* MathMLPaddedElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLPaddedElement.cpp; sourceTree = "<group>"; }; 15049 15052 F75A059AF170D8FAA5B8CABE /* MathMLSelectElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLSelectElement.cpp; sourceTree = "<group>"; }; 15050 15053 F8216299029F4FB501000131 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = JavaScriptCore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; … … 24864 24867 D4F72C653A64807A83E76FB8 /* MathMLOperatorDictionary.cpp */, 24865 24868 DF7E9A294C7AACE0AD89B3DD /* MathMLOperatorDictionary.h */, 24869 B59CA59AF170D8FAA5B8CABE /* MathMLPaddedElement.cpp */, 24870 B59CA849D41E6F65D81198BC /* MathMLPaddedElement.h */, 24866 24871 F75A059AF170D8FAA5B8CABE /* MathMLSelectElement.cpp */, 24867 24872 59780849D41E6F65D81198BC /* MathMLSelectElement.h */, … … 31226 31231 FABE72FE1059C21100D999DD /* MathMLNames.cpp in Sources */, 31227 31232 439176DF12DA25E17BAF80A2 /* MathMLStyle.cpp in Sources */, 31233 B59CA390CED66C3255F72C59 /* MathMLPaddedElement.cpp in Sources */, 31228 31234 FED48390CED66C3255F72C59 /* MathMLSelectElement.cpp in Sources */, 31229 31235 4FA65A6B1108ABED002615E0 /* MathMLSpaceElement.cpp in Sources */, -
trunk/Source/WebCore/mathml/MathMLAllInOne.cpp
r203116 r203150 31 31 #include "MathMLMencloseElement.cpp" 32 32 #include "MathMLOperatorDictionary.cpp" 33 #include "MathMLPaddedElement.cpp" 33 34 #include "MathMLSelectElement.cpp" 34 35 #include "MathMLTextElement.cpp" -
trunk/Source/WebCore/mathml/MathMLInlineContainerElement.cpp
r203072 r203150 36 36 #include "RenderMathMLFraction.h" 37 37 #include "RenderMathMLMenclose.h" 38 #include "RenderMathMLPadded.h"39 38 #include "RenderMathMLRoot.h" 40 39 #include "RenderMathMLRow.h" … … 81 80 if (hasTagName(mtableTag)) 82 81 return createRenderer<RenderMathMLTable>(*this, WTFMove(style)); 83 if (hasTagName(mpaddedTag))84 return createRenderer<RenderMathMLPadded>(*this, WTFMove(style));85 82 86 83 return createRenderer<RenderMathMLBlock>(*this, WTFMove(style)); -
trunk/Source/WebCore/mathml/MathMLPaddedElement.h
r203149 r203150 24 24 */ 25 25 26 #ifndef RenderMathMLPadded_h 27 #define RenderMathMLPadded_h 28 #pragma once 26 #ifndef MathMLPaddedElement_h 27 #define MathMLPaddedElement_h 29 28 30 29 #if ENABLE(MATHML) 31 32 #include "RenderMathMLRow.h" 30 #include "MathMLInlineContainerElement.h" 33 31 34 32 namespace WebCore { 35 33 36 class RenderMathMLPadded final : public RenderMathMLRow{34 class MathMLPaddedElement final : public MathMLInlineContainerElement { 37 35 public: 38 RenderMathMLPadded(Element&, RenderStyle&&); 36 static Ref<MathMLPaddedElement> create(const QualifiedName& tagName, Document&); 37 // FIXME: Pseudo-units are not supported yet (https://bugs.webkit.org/show_bug.cgi?id=85730). 38 const Length& width(); 39 const Length& height(); 40 const Length& depth(); 41 const Length& lspace(); 42 const Length& voffset(); 43 private: 44 MathMLPaddedElement(const QualifiedName& tagName, Document&); 45 RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; 46 void parseAttribute(const QualifiedName&, const AtomicString&) final; 39 47 40 private: 41 const char* renderName() const final { return "RenderMathMLPadded"; } 42 bool isRenderMathMLPadded() const final { return true; } 43 44 void computePreferredLogicalWidths() final; 45 void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) final; 46 Optional<int> firstLineBaseline() const final; 47 48 void updateFromElement() final; 49 void styleDidChange(StyleDifference, const RenderStyle* oldStyle) final; 50 51 LayoutUnit m_ascent; 48 Length m_width; 49 Length m_height; 50 Length m_depth; 51 Length m_lspace; 52 Length m_voffset; 52 53 }; 53 54 54 } // namespace WebCore 55 56 SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderMathMLPadded, isRenderMathMLPadded()) 55 } 57 56 58 57 #endif // ENABLE(MATHML) 59 #endif // RenderMathMLPadded_h58 #endif // MathMLPaddedElement_h -
trunk/Source/WebCore/mathml/mathtags.in
r203108 r203150 12 12 msubsup interfaceName=MathMLInlineContainerElement 13 13 merror interfaceName=MathMLInlineContainerElement 14 mpadded interfaceName=MathML InlineContainerElement14 mpadded interfaceName=MathMLPaddedElement 15 15 mphantom interfaceName=MathMLInlineContainerElement 16 16 mrow interfaceName=MathMLInlineContainerElement -
trunk/Source/WebCore/rendering/mathml/RenderMathMLPadded.cpp
r202962 r203150 41 41 } 42 42 43 void RenderMathMLPadded::resolveWidth(LayoutUnit& width) 44 { 45 auto& paddedElement = element(); 46 width = toUserUnits(paddedElement.width(), style(), width); 47 if (width < 0) 48 width = 0; 49 } 50 51 void RenderMathMLPadded::resolveAttributes(LayoutUnit& width, LayoutUnit& height, LayoutUnit& depth, LayoutUnit& lspace, LayoutUnit& voffset) 52 { 53 resolveWidth(width); 54 auto& paddedElement = element(); 55 height = toUserUnits(paddedElement.height(), style(), height); 56 depth = toUserUnits(paddedElement.depth(), style(), depth); 57 lspace = toUserUnits(paddedElement.lspace(), style(), lspace); 58 voffset = toUserUnits(paddedElement.voffset(), style(), voffset); 59 if (height < 0) 60 height = 0; 61 if (depth < 0) 62 depth = 0; 63 // FIXME: Negative lspace values are not supported yet (https://bugs.webkit.org/show_bug.cgi?id=85730). 64 if (lspace < 0) 65 lspace = 0; 66 } 67 43 68 void RenderMathMLPadded::computePreferredLogicalWidths() 44 69 { … … 51 76 // We parse it using the preferred width of the content as its default value. 52 77 LayoutUnit width = m_maxPreferredLogicalWidth; 53 parseMathMLLength(element()->fastGetAttribute(MathMLNames::widthAttr), width, &style(), false); 54 78 resolveWidth(width); 55 79 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = width; 56 80 … … 73 97 74 98 // We parse the mpadded attributes using the content metrics as the default value. 75 // FIXME: We should also accept pseudo-units and (some) negative values.76 // See https://bugs.webkit.org/show_bug.cgi?id=8573077 99 LayoutUnit width = contentWidth; 78 100 LayoutUnit ascent = contentAscent; … … 80 102 LayoutUnit lspace = 0; 81 103 LayoutUnit voffset = 0; 82 parseMathMLLength(element()->fastGetAttribute(MathMLNames::widthAttr), width, &style()); 83 parseMathMLLength(element()->fastGetAttribute(MathMLNames::heightAttr), ascent, &style()); 84 parseMathMLLength(element()->fastGetAttribute(MathMLNames::depthAttr), descent, &style()); 85 parseMathMLLength(element()->fastGetAttribute(MathMLNames::lspaceAttr), lspace, &style()); 86 parseMathMLLength(element()->fastGetAttribute(MathMLNames::voffsetAttr), voffset, &style()); 87 if (width < 0) 88 width = 0; 89 if (ascent < 0) 90 ascent = 0; 91 if (descent < 0) 92 descent = 0; 93 if (lspace < 0) 94 lspace = 0; 104 resolveAttributes(width, ascent, descent, lspace, voffset); 95 105 96 106 // Align children on the new baseline and shift them by (lspace, -voffset) -
trunk/Source/WebCore/rendering/mathml/RenderMathMLPadded.h
r202962 r203150 30 30 #if ENABLE(MATHML) 31 31 32 #include "MathMLPaddedElement.h" 32 33 #include "RenderMathMLRow.h" 33 34 … … 49 50 void styleDidChange(StyleDifference, const RenderStyle* oldStyle) final; 50 51 52 MathMLPaddedElement& element() const { return static_cast<MathMLPaddedElement&>(nodeForNonAnonymous()); } 53 void resolveWidth(LayoutUnit& width); 54 void resolveAttributes(LayoutUnit& width, LayoutUnit& height, LayoutUnit& depth, LayoutUnit& lspace, LayoutUnit& voffset); 55 51 56 LayoutUnit m_ascent; 52 57 };
Note: See TracChangeset
for help on using the changeset viewer.