Title: [203150] trunk/Source/WebCore
Revision
203150
Author
[email protected]
Date
2016-07-12 21:47:00 -0700 (Tue, 12 Jul 2016)

Log Message

Move parsing of mpadded attributes to a MathMLPaddedElement class
https://bugs.webkit.org/show_bug.cgi?id=159620

Patch by Frederic Wang <[email protected]> on 2016-07-12
Reviewed by Brent Fulgham.

No new tests, behavior is unchanged.

* CMakeLists.txt: Add MathMLPaddedElement files.
* WebCore.xcodeproj/project.pbxproj: Ditto.
* mathml/MathMLAllInOne.cpp: Ditto.
* mathml/MathMLInlineContainerElement.cpp: Remove handling of mpadded.
* mathml/MathMLPaddedElement.cpp: Added.
(WebCore::MathMLPaddedElement::MathMLPaddedElement):
(WebCore::MathMLPaddedElement::create):
(WebCore::MathMLPaddedElement::width): Expose width attribute as a MathMLLength until mpadded
pseudo-units are supported.
(WebCore::MathMLPaddedElement::height): Ditto.
(WebCore::MathMLPaddedElement::depth): Ditto
(WebCore::MathMLPaddedElement::lspace): Ditto.
(WebCore::MathMLPaddedElement::voffset): Ditto.
(WebCore::MathMLPaddedElement::parseAttribute): Make length attribute dirty.
(WebCore::MathMLPaddedElement::createElementRenderer): Moved code from MathMLInlineContainerElement.
* mathml/MathMLPaddedElement.h: Added.
* mathml/mathtags.in: Map mapdded to MathMLPaddedElement.
* rendering/mathml/RenderMathMLPadded.cpp:
(WebCore::RenderMathMLPadded::resolveWidth): Helper function to resolve width.
(WebCore::RenderMathMLPadded::resolveAttributes): Helper function to resolve all attributes.
(WebCore::RenderMathMLPadded::computePreferredLogicalWidths): Use resolveWidth.
(WebCore::RenderMathMLPadded::layoutBlock): Use resolveAttributes.
* rendering/mathml/RenderMathMLPadded.h: Add new helper functions to access attributes from
the MathMLPaddedElement class.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (203149 => 203150)


--- trunk/Source/WebCore/CMakeLists.txt	2016-07-13 04:05:06 UTC (rev 203149)
+++ trunk/Source/WebCore/CMakeLists.txt	2016-07-13 04:47:00 UTC (rev 203150)
@@ -1987,6 +1987,7 @@
     mathml/MathMLMathElement.cpp
     mathml/MathMLMencloseElement.cpp
     mathml/MathMLOperatorDictionary.cpp
+    mathml/MathMLPaddedElement.cpp
     mathml/MathMLSelectElement.cpp
     mathml/MathMLSpaceElement.cpp
     mathml/MathMLTextElement.cpp

Modified: trunk/Source/WebCore/ChangeLog (203149 => 203150)


--- trunk/Source/WebCore/ChangeLog	2016-07-13 04:05:06 UTC (rev 203149)
+++ trunk/Source/WebCore/ChangeLog	2016-07-13 04:47:00 UTC (rev 203150)
@@ -1,3 +1,37 @@
+2016-07-12  Frederic Wang  <[email protected]>
+
+        Move parsing of mpadded attributes to a MathMLPaddedElement class
+        https://bugs.webkit.org/show_bug.cgi?id=159620
+
+        Reviewed by Brent Fulgham.
+
+        No new tests, behavior is unchanged.
+
+        * CMakeLists.txt: Add MathMLPaddedElement files.
+        * WebCore.xcodeproj/project.pbxproj: Ditto.
+        * mathml/MathMLAllInOne.cpp: Ditto.
+        * mathml/MathMLInlineContainerElement.cpp: Remove handling of mpadded.
+        * mathml/MathMLPaddedElement.cpp: Added.
+        (WebCore::MathMLPaddedElement::MathMLPaddedElement):
+        (WebCore::MathMLPaddedElement::create):
+        (WebCore::MathMLPaddedElement::width): Expose width attribute as a MathMLLength until mpadded
+        pseudo-units are supported.
+        (WebCore::MathMLPaddedElement::height): Ditto.
+        (WebCore::MathMLPaddedElement::depth): Ditto
+        (WebCore::MathMLPaddedElement::lspace): Ditto.
+        (WebCore::MathMLPaddedElement::voffset): Ditto.
+        (WebCore::MathMLPaddedElement::parseAttribute): Make length attribute dirty.
+        (WebCore::MathMLPaddedElement::createElementRenderer): Moved code from MathMLInlineContainerElement.
+        * mathml/MathMLPaddedElement.h: Added.
+        * mathml/mathtags.in: Map mapdded to MathMLPaddedElement.
+        * rendering/mathml/RenderMathMLPadded.cpp:
+        (WebCore::RenderMathMLPadded::resolveWidth): Helper function to resolve width.
+        (WebCore::RenderMathMLPadded::resolveAttributes): Helper function to resolve all attributes.
+        (WebCore::RenderMathMLPadded::computePreferredLogicalWidths): Use resolveWidth.
+        (WebCore::RenderMathMLPadded::layoutBlock): Use resolveAttributes.
+        * rendering/mathml/RenderMathMLPadded.h: Add new helper functions to access attributes from
+        the MathMLPaddedElement class.
+
 2016-07-12  Andreas Kling  <[email protected]>
 
         [Cocoa] Simulated memory warning doesn't trigger libcache purge.

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (203149 => 203150)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-07-13 04:05:06 UTC (rev 203149)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-07-13 04:47:00 UTC (rev 203150)
@@ -7208,6 +7208,7 @@
 		FED13D3D0CEA936A00D89466 /* FrameIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = FED13D3B0CEA936A00D89466 /* FrameIOS.mm */; };
 		FED13D400CEA939400D89466 /* IconIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = FED13D3F0CEA939400D89466 /* IconIOS.mm */; };
 		FED13D520CEA949700D89466 /* RenderThemeIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = FED13D500CEA949700D89466 /* RenderThemeIOS.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		B59CA390CED66C3255F72C59 /* MathMLPaddedElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B59CA59AF170D8FAA5B8CABE /* MathMLPaddedElement.cpp */; };
 		FED48390CED66C3255F72C59 /* MathMLSelectElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F75A059AF170D8FAA5B8CABE /* MathMLSelectElement.cpp */; };
 		FEE1811316C319E800084849 /* SQLTransactionBackend.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEE1811116C319E800084849 /* SQLTransactionBackend.cpp */; };
 		FEE1811416C319E800084849 /* SQLTransactionBackend.h in Headers */ = {isa = PBXBuildFile; fileRef = FEE1811216C319E800084849 /* SQLTransactionBackend.h */; };
@@ -10025,6 +10026,7 @@
 		59309A1211F4AE6A00250603 /* DeviceOrientationClientMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceOrientationClientMock.h; sourceTree = "<group>"; };
 		5958F1CB1343917C0080B31F /* XMLViewer.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = XMLViewer.css; sourceTree = "<group>"; };
 		5958F1CC1343917C0080B31F /* XMLViewer.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = XMLViewer.js; sourceTree = "<group>"; };
+		B59CA849D41E6F65D81198BC /* MathMLPaddedElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathMLPaddedElement.h; sourceTree = "<group>"; };
 		59780849D41E6F65D81198BC /* MathMLSelectElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathMLSelectElement.h; sourceTree = "<group>"; };
 		598365DC1355F53C001B185D /* JSPositionCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPositionCallback.h; sourceTree = "<group>"; };
 		598365DE1355F562001B185D /* JSPositionErrorCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPositionErrorCallback.h; sourceTree = "<group>"; };
@@ -15046,6 +15048,7 @@
 		F5C041E20FFCA96D00839D4A /* JSHTMLDataListElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLDataListElement.h; sourceTree = "<group>"; };
 		F5E0C6591643C42C00D6CB69 /* BaseChooserOnlyDateAndTimeInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BaseChooserOnlyDateAndTimeInputType.cpp; sourceTree = "<group>"; };
 		F5E0C65A1643C42C00D6CB69 /* BaseChooserOnlyDateAndTimeInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseChooserOnlyDateAndTimeInputType.h; sourceTree = "<group>"; };
+		B59CA59AF170D8FAA5B8CABE /* MathMLPaddedElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLPaddedElement.cpp; sourceTree = "<group>"; };
 		F75A059AF170D8FAA5B8CABE /* MathMLSelectElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLSelectElement.cpp; sourceTree = "<group>"; };
 		F8216299029F4FB501000131 /* _javascript_Core.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = _javascript_Core.framework; sourceTree = BUILT_PRODUCTS_DIR; };
 		F916C48B0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSXMLHttpRequestProgressEvent.cpp; sourceTree = "<group>"; };
@@ -24863,6 +24866,8 @@
 				CE6D89294C7AACE0AD89B3DD /* MathMLMencloseElement.h */,
 				D4F72C653A64807A83E76FB8 /* MathMLOperatorDictionary.cpp */,
 				DF7E9A294C7AACE0AD89B3DD /* MathMLOperatorDictionary.h */,
+				B59CA59AF170D8FAA5B8CABE /* MathMLPaddedElement.cpp */,
+				B59CA849D41E6F65D81198BC /* MathMLPaddedElement.h */,
 				F75A059AF170D8FAA5B8CABE /* MathMLSelectElement.cpp */,
 				59780849D41E6F65D81198BC /* MathMLSelectElement.h */,
 				4FA65A691108ABED002615E0 /* MathMLSpaceElement.cpp */,
@@ -31225,6 +31230,7 @@
 				16EA24CEEAB2A60534218ACF /* MathMLOperatorDictionary.cpp in Sources */,
 				FABE72FE1059C21100D999DD /* MathMLNames.cpp in Sources */,
 				439176DF12DA25E17BAF80A2 /* MathMLStyle.cpp in Sources */,
+				B59CA390CED66C3255F72C59 /* MathMLPaddedElement.cpp in Sources */,
 				FED48390CED66C3255F72C59 /* MathMLSelectElement.cpp in Sources */,
 				4FA65A6B1108ABED002615E0 /* MathMLSpaceElement.cpp in Sources */,
 				FA654A6B1108ABED002615E0 /* MathMLTextElement.cpp in Sources */,

Modified: trunk/Source/WebCore/mathml/MathMLAllInOne.cpp (203149 => 203150)


--- trunk/Source/WebCore/mathml/MathMLAllInOne.cpp	2016-07-13 04:05:06 UTC (rev 203149)
+++ trunk/Source/WebCore/mathml/MathMLAllInOne.cpp	2016-07-13 04:47:00 UTC (rev 203150)
@@ -30,6 +30,7 @@
 #include "MathMLMathElement.cpp"
 #include "MathMLMencloseElement.cpp"
 #include "MathMLOperatorDictionary.cpp"
+#include "MathMLPaddedElement.cpp"
 #include "MathMLSelectElement.cpp"
 #include "MathMLTextElement.cpp"
 

Modified: trunk/Source/WebCore/mathml/MathMLInlineContainerElement.cpp (203149 => 203150)


--- trunk/Source/WebCore/mathml/MathMLInlineContainerElement.cpp	2016-07-13 04:05:06 UTC (rev 203149)
+++ trunk/Source/WebCore/mathml/MathMLInlineContainerElement.cpp	2016-07-13 04:47:00 UTC (rev 203150)
@@ -35,7 +35,6 @@
 #include "RenderMathMLFenced.h"
 #include "RenderMathMLFraction.h"
 #include "RenderMathMLMenclose.h"
-#include "RenderMathMLPadded.h"
 #include "RenderMathMLRoot.h"
 #include "RenderMathMLRow.h"
 #include "RenderMathMLScripts.h"
@@ -80,8 +79,6 @@
         return createRenderer<RenderMathMLFenced>(*this, WTFMove(style));
     if (hasTagName(mtableTag))
         return createRenderer<RenderMathMLTable>(*this, WTFMove(style));
-    if (hasTagName(mpaddedTag))
-        return createRenderer<RenderMathMLPadded>(*this, WTFMove(style));
 
     return createRenderer<RenderMathMLBlock>(*this, WTFMove(style));
 }

Added: trunk/Source/WebCore/mathml/MathMLPaddedElement.cpp (0 => 203150)


--- trunk/Source/WebCore/mathml/MathMLPaddedElement.cpp	                        (rev 0)
+++ trunk/Source/WebCore/mathml/MathMLPaddedElement.cpp	2016-07-13 04:47:00 UTC (rev 203150)
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2016 Igalia S.L. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include "config.h"
+
+#if ENABLE(MATHML)
+#include "MathMLPaddedElement.h"
+
+#include "RenderMathMLPadded.h"
+
+namespace WebCore {
+
+using namespace MathMLNames;
+
+inline MathMLPaddedElement::MathMLPaddedElement(const QualifiedName& tagName, Document& document)
+    : MathMLInlineContainerElement(tagName, document)
+{
+}
+
+Ref<MathMLPaddedElement> MathMLPaddedElement::create(const QualifiedName& tagName, Document& document)
+{
+    return adoptRef(*new MathMLPaddedElement(tagName, document));
+}
+
+const MathMLElement::Length& MathMLPaddedElement::width()
+{
+    return cachedMathMLLength(MathMLNames::widthAttr, m_width);
+}
+
+const MathMLElement::Length& MathMLPaddedElement::height()
+{
+    return cachedMathMLLength(MathMLNames::heightAttr, m_height);
+}
+
+const MathMLElement::Length& MathMLPaddedElement::depth()
+{
+    return cachedMathMLLength(MathMLNames::depthAttr, m_depth);
+}
+
+const MathMLElement::Length& MathMLPaddedElement::lspace()
+{
+    return cachedMathMLLength(MathMLNames::lspaceAttr, m_lspace);
+}
+
+const MathMLElement::Length& MathMLPaddedElement::voffset()
+{
+    return cachedMathMLLength(MathMLNames::voffsetAttr, m_voffset);
+}
+
+void MathMLPaddedElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
+{
+    if (name == widthAttr)
+        m_width.dirty = true;
+    else if (name == heightAttr)
+        m_height.dirty = true;
+    else if (name == depthAttr)
+        m_depth.dirty = true;
+    else if (name == lspaceAttr)
+        m_lspace.dirty = true;
+    else if (name == voffsetAttr)
+        m_voffset.dirty = true;
+
+    MathMLElement::parseAttribute(name, value);
+}
+
+RenderPtr<RenderElement> MathMLPaddedElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&)
+{
+    ASSERT(hasTagName(MathMLNames::mpaddedTag));
+    return createRenderer<RenderMathMLPadded>(*this, WTFMove(style));
+}
+
+}
+
+#endif // ENABLE(MATHML)
Property changes on: trunk/Source/WebCore/mathml/MathMLPaddedElement.cpp
___________________________________________________________________

Added: svn:eol-style

+LF \ No newline at end of property

Copied: trunk/Source/WebCore/mathml/MathMLPaddedElement.h (from rev 203149, trunk/Source/WebCore/rendering/mathml/RenderMathMLPadded.h) (0 => 203150)


--- trunk/Source/WebCore/mathml/MathMLPaddedElement.h	                        (rev 0)
+++ trunk/Source/WebCore/mathml/MathMLPaddedElement.h	2016-07-13 04:47:00 UTC (rev 203150)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2016 Igalia S.L. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MathMLPaddedElement_h
+#define MathMLPaddedElement_h
+
+#if ENABLE(MATHML)
+#include "MathMLInlineContainerElement.h"
+
+namespace WebCore {
+
+class MathMLPaddedElement final : public MathMLInlineContainerElement {
+public:
+    static Ref<MathMLPaddedElement> create(const QualifiedName& tagName, Document&);
+    // FIXME: Pseudo-units are not supported yet (https://bugs.webkit.org/show_bug.cgi?id=85730).
+    const Length& width();
+    const Length& height();
+    const Length& depth();
+    const Length& lspace();
+    const Length& voffset();
+private:
+    MathMLPaddedElement(const QualifiedName& tagName, Document&);
+    RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final;
+    void parseAttribute(const QualifiedName&, const AtomicString&) final;
+
+    Length m_width;
+    Length m_height;
+    Length m_depth;
+    Length m_lspace;
+    Length m_voffset;
+};
+
+}
+
+#endif // ENABLE(MATHML)
+#endif // MathMLPaddedElement_h

Modified: trunk/Source/WebCore/mathml/mathtags.in (203149 => 203150)


--- trunk/Source/WebCore/mathml/mathtags.in	2016-07-13 04:05:06 UTC (rev 203149)
+++ trunk/Source/WebCore/mathml/mathtags.in	2016-07-13 04:47:00 UTC (rev 203150)
@@ -11,7 +11,7 @@
 mfenced interfaceName=MathMLInlineContainerElement
 msubsup interfaceName=MathMLInlineContainerElement
 merror interfaceName=MathMLInlineContainerElement
-mpadded interfaceName=MathMLInlineContainerElement
+mpadded interfaceName=MathMLPaddedElement
 mphantom interfaceName=MathMLInlineContainerElement
 mrow interfaceName=MathMLInlineContainerElement
 mstyle interfaceName=MathMLInlineContainerElement

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLPadded.cpp (203149 => 203150)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLPadded.cpp	2016-07-13 04:05:06 UTC (rev 203149)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLPadded.cpp	2016-07-13 04:47:00 UTC (rev 203150)
@@ -40,6 +40,31 @@
 {
 }
 
+void RenderMathMLPadded::resolveWidth(LayoutUnit& width)
+{
+    auto& paddedElement = element();
+    width = toUserUnits(paddedElement.width(), style(), width);
+    if (width < 0)
+        width = 0;
+}
+
+void RenderMathMLPadded::resolveAttributes(LayoutUnit& width, LayoutUnit& height, LayoutUnit& depth, LayoutUnit& lspace, LayoutUnit& voffset)
+{
+    resolveWidth(width);
+    auto& paddedElement = element();
+    height = toUserUnits(paddedElement.height(), style(), height);
+    depth = toUserUnits(paddedElement.depth(), style(), depth);
+    lspace = toUserUnits(paddedElement.lspace(), style(), lspace);
+    voffset = toUserUnits(paddedElement.voffset(), style(), voffset);
+    if (height < 0)
+        height = 0;
+    if (depth < 0)
+        depth = 0;
+    // FIXME: Negative lspace values are not supported yet (https://bugs.webkit.org/show_bug.cgi?id=85730).
+    if (lspace < 0)
+        lspace = 0;
+}
+
 void RenderMathMLPadded::computePreferredLogicalWidths()
 {
     ASSERT(preferredLogicalWidthsDirty());
@@ -50,8 +75,7 @@
     // Only the width attribute should modify the width.
     // We parse it using the preferred width of the content as its default value.
     LayoutUnit width = m_maxPreferredLogicalWidth;
-    parseMathMLLength(element()->fastGetAttribute(MathMLNames::widthAttr), width, &style(), false);
-
+    resolveWidth(width);
     m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = width;
 
     setPreferredLogicalWidthsDirty(false);
@@ -72,26 +96,12 @@
     contentWidth = logicalWidth();
 
     // We parse the mpadded attributes using the content metrics as the default value.
-    // FIXME: We should also accept pseudo-units and (some) negative values.
-    // See https://bugs.webkit.org/show_bug.cgi?id=85730
     LayoutUnit width = contentWidth;
     LayoutUnit ascent = contentAscent;
     LayoutUnit descent = contentDescent;
     LayoutUnit lspace = 0;
     LayoutUnit voffset = 0;
-    parseMathMLLength(element()->fastGetAttribute(MathMLNames::widthAttr), width, &style());
-    parseMathMLLength(element()->fastGetAttribute(MathMLNames::heightAttr), ascent, &style());
-    parseMathMLLength(element()->fastGetAttribute(MathMLNames::depthAttr), descent, &style());
-    parseMathMLLength(element()->fastGetAttribute(MathMLNames::lspaceAttr), lspace, &style());
-    parseMathMLLength(element()->fastGetAttribute(MathMLNames::voffsetAttr), voffset, &style());
-    if (width < 0)
-        width = 0;
-    if (ascent < 0)
-        ascent = 0;
-    if (descent < 0)
-        descent = 0;
-    if (lspace < 0)
-        lspace = 0;
+    resolveAttributes(width, ascent, descent, lspace, voffset);
 
     // Align children on the new baseline and shift them by (lspace, -voffset)
     LayoutPoint contentLocation(lspace, ascent - contentAscent - voffset);

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLPadded.h (203149 => 203150)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLPadded.h	2016-07-13 04:05:06 UTC (rev 203149)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLPadded.h	2016-07-13 04:47:00 UTC (rev 203150)
@@ -29,6 +29,7 @@
 
 #if ENABLE(MATHML)
 
+#include "MathMLPaddedElement.h"
 #include "RenderMathMLRow.h"
 
 namespace WebCore {
@@ -48,6 +49,10 @@
     void updateFromElement() final;
     void styleDidChange(StyleDifference, const RenderStyle* oldStyle) final;
 
+    MathMLPaddedElement& element() const { return static_cast<MathMLPaddedElement&>(nodeForNonAnonymous()); }
+    void resolveWidth(LayoutUnit& width);
+    void resolveAttributes(LayoutUnit& width, LayoutUnit& height, LayoutUnit& depth, LayoutUnit& lspace, LayoutUnit& voffset);
+
     LayoutUnit m_ascent;
 };
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to