<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[203150] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/203150">203150</a></dd>
<dt>Author</dt> <dd>fred.wang@free.fr</dd>
<dt>Date</dt> <dd>2016-07-12 21:47:00 -0700 (Tue, 12 Jul 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Move parsing of mpadded attributes to a MathMLPaddedElement class
https://bugs.webkit.org/show_bug.cgi?id=159620
Patch by Frederic Wang <fwang@igalia.com> 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.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCoremathmlMathMLAllInOnecpp">trunk/Source/WebCore/mathml/MathMLAllInOne.cpp</a></li>
<li><a href="#trunkSourceWebCoremathmlMathMLInlineContainerElementcpp">trunk/Source/WebCore/mathml/MathMLInlineContainerElement.cpp</a></li>
<li><a href="#trunkSourceWebCoremathmlmathtagsin">trunk/Source/WebCore/mathml/mathtags.in</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLPaddedcpp">trunk/Source/WebCore/rendering/mathml/RenderMathMLPadded.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLPaddedh">trunk/Source/WebCore/rendering/mathml/RenderMathMLPadded.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoremathmlMathMLPaddedElementcpp">trunk/Source/WebCore/mathml/MathMLPaddedElement.cpp</a></li>
<li><a href="#trunkSourceWebCoremathmlMathMLPaddedElementh">trunk/Source/WebCore/mathml/MathMLPaddedElement.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (203149 => 203150)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1987,6 +1987,7 @@
</span><span class="cx"> mathml/MathMLMathElement.cpp
</span><span class="cx"> mathml/MathMLMencloseElement.cpp
</span><span class="cx"> mathml/MathMLOperatorDictionary.cpp
</span><ins>+ mathml/MathMLPaddedElement.cpp
</ins><span class="cx"> mathml/MathMLSelectElement.cpp
</span><span class="cx"> mathml/MathMLSpaceElement.cpp
</span><span class="cx"> mathml/MathMLTextElement.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (203149 => 203150)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,37 @@
</span><ins>+2016-07-12 Frederic Wang <fwang@igalia.com>
+
+ 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.
+
</ins><span class="cx"> 2016-07-12 Andreas Kling <akling@apple.com>
</span><span class="cx">
</span><span class="cx"> [Cocoa] Simulated memory warning doesn't trigger libcache purge.
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (203149 => 203150)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -7208,6 +7208,7 @@
</span><span class="cx">                 FED13D3D0CEA936A00D89466 /* FrameIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = FED13D3B0CEA936A00D89466 /* FrameIOS.mm */; };
</span><span class="cx">                 FED13D400CEA939400D89466 /* IconIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = FED13D3F0CEA939400D89466 /* IconIOS.mm */; };
</span><span class="cx">                 FED13D520CEA949700D89466 /* RenderThemeIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = FED13D500CEA949700D89466 /* RenderThemeIOS.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                B59CA390CED66C3255F72C59 /* MathMLPaddedElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B59CA59AF170D8FAA5B8CABE /* MathMLPaddedElement.cpp */; };
</ins><span class="cx">                 FED48390CED66C3255F72C59 /* MathMLSelectElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F75A059AF170D8FAA5B8CABE /* MathMLSelectElement.cpp */; };
</span><span class="cx">                 FEE1811316C319E800084849 /* SQLTransactionBackend.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEE1811116C319E800084849 /* SQLTransactionBackend.cpp */; };
</span><span class="cx">                 FEE1811416C319E800084849 /* SQLTransactionBackend.h in Headers */ = {isa = PBXBuildFile; fileRef = FEE1811216C319E800084849 /* SQLTransactionBackend.h */; };
</span><span class="lines">@@ -10025,6 +10026,7 @@
</span><span class="cx">                 59309A1211F4AE6A00250603 /* DeviceOrientationClientMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceOrientationClientMock.h; sourceTree = "<group>"; };
</span><span class="cx">                 5958F1CB1343917C0080B31F /* XMLViewer.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = XMLViewer.css; sourceTree = "<group>"; };
</span><span class="cx">                 5958F1CC1343917C0080B31F /* XMLViewer.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = XMLViewer.js; sourceTree = "<group>"; };
</span><ins>+                B59CA849D41E6F65D81198BC /* MathMLPaddedElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathMLPaddedElement.h; sourceTree = "<group>"; };
</ins><span class="cx">                 59780849D41E6F65D81198BC /* MathMLSelectElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathMLSelectElement.h; sourceTree = "<group>"; };
</span><span class="cx">                 598365DC1355F53C001B185D /* JSPositionCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPositionCallback.h; sourceTree = "<group>"; };
</span><span class="cx">                 598365DE1355F562001B185D /* JSPositionErrorCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPositionErrorCallback.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -15046,6 +15048,7 @@
</span><span class="cx">                 F5C041E20FFCA96D00839D4A /* JSHTMLDataListElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLDataListElement.h; sourceTree = "<group>"; };
</span><span class="cx">                 F5E0C6591643C42C00D6CB69 /* BaseChooserOnlyDateAndTimeInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BaseChooserOnlyDateAndTimeInputType.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 F5E0C65A1643C42C00D6CB69 /* BaseChooserOnlyDateAndTimeInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseChooserOnlyDateAndTimeInputType.h; sourceTree = "<group>"; };
</span><ins>+                B59CA59AF170D8FAA5B8CABE /* MathMLPaddedElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLPaddedElement.cpp; sourceTree = "<group>"; };
</ins><span class="cx">                 F75A059AF170D8FAA5B8CABE /* MathMLSelectElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLSelectElement.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 F8216299029F4FB501000131 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = JavaScriptCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
</span><span class="cx">                 F916C48B0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSXMLHttpRequestProgressEvent.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -24863,6 +24866,8 @@
</span><span class="cx">                                 CE6D89294C7AACE0AD89B3DD /* MathMLMencloseElement.h */,
</span><span class="cx">                                 D4F72C653A64807A83E76FB8 /* MathMLOperatorDictionary.cpp */,
</span><span class="cx">                                 DF7E9A294C7AACE0AD89B3DD /* MathMLOperatorDictionary.h */,
</span><ins>+                                B59CA59AF170D8FAA5B8CABE /* MathMLPaddedElement.cpp */,
+                                B59CA849D41E6F65D81198BC /* MathMLPaddedElement.h */,
</ins><span class="cx">                                 F75A059AF170D8FAA5B8CABE /* MathMLSelectElement.cpp */,
</span><span class="cx">                                 59780849D41E6F65D81198BC /* MathMLSelectElement.h */,
</span><span class="cx">                                 4FA65A691108ABED002615E0 /* MathMLSpaceElement.cpp */,
</span><span class="lines">@@ -31225,6 +31230,7 @@
</span><span class="cx">                                 16EA24CEEAB2A60534218ACF /* MathMLOperatorDictionary.cpp in Sources */,
</span><span class="cx">                                 FABE72FE1059C21100D999DD /* MathMLNames.cpp in Sources */,
</span><span class="cx">                                 439176DF12DA25E17BAF80A2 /* MathMLStyle.cpp in Sources */,
</span><ins>+                                B59CA390CED66C3255F72C59 /* MathMLPaddedElement.cpp in Sources */,
</ins><span class="cx">                                 FED48390CED66C3255F72C59 /* MathMLSelectElement.cpp in Sources */,
</span><span class="cx">                                 4FA65A6B1108ABED002615E0 /* MathMLSpaceElement.cpp in Sources */,
</span><span class="cx">                                 FA654A6B1108ABED002615E0 /* MathMLTextElement.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLAllInOnecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/MathMLAllInOne.cpp (203149 => 203150)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #include "MathMLMathElement.cpp"
</span><span class="cx"> #include "MathMLMencloseElement.cpp"
</span><span class="cx"> #include "MathMLOperatorDictionary.cpp"
</span><ins>+#include "MathMLPaddedElement.cpp"
</ins><span class="cx"> #include "MathMLSelectElement.cpp"
</span><span class="cx"> #include "MathMLTextElement.cpp"
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLInlineContainerElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/MathMLInlineContainerElement.cpp (203149 => 203150)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -35,7 +35,6 @@
</span><span class="cx"> #include "RenderMathMLFenced.h"
</span><span class="cx"> #include "RenderMathMLFraction.h"
</span><span class="cx"> #include "RenderMathMLMenclose.h"
</span><del>-#include "RenderMathMLPadded.h"
</del><span class="cx"> #include "RenderMathMLRoot.h"
</span><span class="cx"> #include "RenderMathMLRow.h"
</span><span class="cx"> #include "RenderMathMLScripts.h"
</span><span class="lines">@@ -80,8 +79,6 @@
</span><span class="cx"> return createRenderer<RenderMathMLFenced>(*this, WTFMove(style));
</span><span class="cx"> if (hasTagName(mtableTag))
</span><span class="cx"> return createRenderer<RenderMathMLTable>(*this, WTFMove(style));
</span><del>- if (hasTagName(mpaddedTag))
- return createRenderer<RenderMathMLPadded>(*this, WTFMove(style));
</del><span class="cx">
</span><span class="cx"> return createRenderer<RenderMathMLBlock>(*this, WTFMove(style));
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLPaddedElementcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/mathml/MathMLPaddedElement.cpp (0 => 203150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLPaddedElement.cpp         (rev 0)
+++ trunk/Source/WebCore/mathml/MathMLPaddedElement.cpp        2016-07-13 04:47:00 UTC (rev 203150)
</span><span class="lines">@@ -0,0 +1,97 @@
</span><ins>+/*
+ * 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)
</ins><span class="cx">Property changes on: trunk/Source/WebCore/mathml/MathMLPaddedElement.cpp
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<ins>+LF
</ins><span class="cx">\ No newline at end of property
</span><a id="trunkSourceWebCoremathmlMathMLPaddedElementhfromrev203149trunkSourceWebCorerenderingmathmlRenderMathMLPaddedh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/mathml/MathMLPaddedElement.h (from rev 203149, trunk/Source/WebCore/rendering/mathml/RenderMathMLPadded.h) (0 => 203150)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLPaddedElement.h         (rev 0)
+++ trunk/Source/WebCore/mathml/MathMLPaddedElement.h        2016-07-13 04:47:00 UTC (rev 203150)
</span><span class="lines">@@ -0,0 +1,58 @@
</span><ins>+/*
+ * 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
</ins></span></pre></div>
<a id="trunkSourceWebCoremathmlmathtagsin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/mathtags.in (203149 => 203150)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -11,7 +11,7 @@
</span><span class="cx"> mfenced interfaceName=MathMLInlineContainerElement
</span><span class="cx"> msubsup interfaceName=MathMLInlineContainerElement
</span><span class="cx"> merror interfaceName=MathMLInlineContainerElement
</span><del>-mpadded interfaceName=MathMLInlineContainerElement
</del><ins>+mpadded interfaceName=MathMLPaddedElement
</ins><span class="cx"> mphantom interfaceName=MathMLInlineContainerElement
</span><span class="cx"> mrow interfaceName=MathMLInlineContainerElement
</span><span class="cx"> mstyle interfaceName=MathMLInlineContainerElement
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLPaddedcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLPadded.cpp (203149 => 203150)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -40,6 +40,31 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+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;
+}
+
</ins><span class="cx"> void RenderMathMLPadded::computePreferredLogicalWidths()
</span><span class="cx"> {
</span><span class="cx"> ASSERT(preferredLogicalWidthsDirty());
</span><span class="lines">@@ -50,8 +75,7 @@
</span><span class="cx"> // Only the width attribute should modify the width.
</span><span class="cx"> // We parse it using the preferred width of the content as its default value.
</span><span class="cx"> LayoutUnit width = m_maxPreferredLogicalWidth;
</span><del>- parseMathMLLength(element()->fastGetAttribute(MathMLNames::widthAttr), width, &style(), false);
-
</del><ins>+ resolveWidth(width);
</ins><span class="cx"> m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = width;
</span><span class="cx">
</span><span class="cx"> setPreferredLogicalWidthsDirty(false);
</span><span class="lines">@@ -72,26 +96,12 @@
</span><span class="cx"> contentWidth = logicalWidth();
</span><span class="cx">
</span><span class="cx"> // We parse the mpadded attributes using the content metrics as the default value.
</span><del>- // FIXME: We should also accept pseudo-units and (some) negative values.
- // See https://bugs.webkit.org/show_bug.cgi?id=85730
</del><span class="cx"> LayoutUnit width = contentWidth;
</span><span class="cx"> LayoutUnit ascent = contentAscent;
</span><span class="cx"> LayoutUnit descent = contentDescent;
</span><span class="cx"> LayoutUnit lspace = 0;
</span><span class="cx"> LayoutUnit voffset = 0;
</span><del>- 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;
</del><ins>+ resolveAttributes(width, ascent, descent, lspace, voffset);
</ins><span class="cx">
</span><span class="cx"> // Align children on the new baseline and shift them by (lspace, -voffset)
</span><span class="cx"> LayoutPoint contentLocation(lspace, ascent - contentAscent - voffset);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLPaddedh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLPadded.h (203149 => 203150)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(MATHML)
</span><span class="cx">
</span><ins>+#include "MathMLPaddedElement.h"
</ins><span class="cx"> #include "RenderMathMLRow.h"
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -48,6 +49,10 @@
</span><span class="cx"> void updateFromElement() final;
</span><span class="cx"> void styleDidChange(StyleDifference, const RenderStyle* oldStyle) final;
</span><span class="cx">
</span><ins>+ MathMLPaddedElement& element() const { return static_cast<MathMLPaddedElement&>(nodeForNonAnonymous()); }
+ void resolveWidth(LayoutUnit& width);
+ void resolveAttributes(LayoutUnit& width, LayoutUnit& height, LayoutUnit& depth, LayoutUnit& lspace, LayoutUnit& voffset);
+
</ins><span class="cx"> LayoutUnit m_ascent;
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>