<!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>[204021] 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/204021">204021</a></dd>
<dt>Author</dt> <dd>fred.wang@free.fr</dd>
<dt>Date</dt> <dd>2016-08-02 02:43:01 -0700 (Tue, 02 Aug 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Use Optional members to store parsed MathML attributes.
https://bugs.webkit.org/show_bug.cgi?id=160400

Patch by Frederic Wang &lt;fwang.igalia.com&gt; on 2016-08-02
Reviewed by Darin Adler.

Parsed MathML attributes are stored on the element classes using the memoize pattern to
minimize the number of parsing updates. Currently, a dirty flag for each member
indicate when it must be parsed again. We change this to wrap these members into an
Optional&lt;T&gt; container instead, where a null value indicates that the member is dirty.

No new tests, behavior is unchanged.

* mathml/MathMLElement.cpp:
(WebCore::MathMLElement::cachedMathMLLength):
(WebCore::MathMLElement::cachedBooleanAttribute):
(WebCore::MathMLElement::parseMathVariantAttribute):
(WebCore::MathMLElement::specifiedDisplayStyle):
(WebCore::MathMLElement::specifiedMathVariant):
* mathml/MathMLElement.h:
* mathml/MathMLFractionElement.cpp:
(WebCore::MathMLFractionElement::lineThickness):
(WebCore::MathMLFractionElement::cachedFractionAlignment):
(WebCore::MathMLFractionElement::parseAttribute):
* mathml/MathMLFractionElement.h:
* mathml/MathMLInlineContainerElement.cpp:
(WebCore::MathMLInlineContainerElement::parseAttribute):
* mathml/MathMLMathElement.cpp:
(WebCore::MathMLMathElement::specifiedDisplayStyle):
(WebCore::MathMLMathElement::parseAttribute):
* mathml/MathMLOperatorElement.cpp:
(WebCore::MathMLOperatorElement::operatorText):
* mathml/MathMLPaddedElement.cpp:
(WebCore::MathMLPaddedElement::parseAttribute):
* mathml/MathMLPaddedElement.h:
* mathml/MathMLScriptsElement.cpp:
(WebCore::MathMLScriptsElement::parseAttribute):
* mathml/MathMLScriptsElement.h:
* mathml/MathMLSpaceElement.cpp:
(WebCore::MathMLSpaceElement::parseAttribute):
* mathml/MathMLSpaceElement.h:
* mathml/MathMLTextElement.cpp:
(WebCore::MathMLTextElement::parseAttribute):
* mathml/MathMLUnderOverElement.cpp:
(WebCore::MathMLUnderOverElement::parseAttribute):
* mathml/MathMLUnderOverElement.h:
* rendering/mathml/MathMLStyle.cpp:
(WebCore::MathMLStyle::resolveMathMLStyle):
* rendering/mathml/MathMLStyle.h:
* rendering/mathml/RenderMathMLToken.cpp:
(WebCore::mathVariant):
(WebCore::RenderMathMLToken::updateMathVariantGlyph):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoremathmlMathMLElementcpp">trunk/Source/WebCore/mathml/MathMLElement.cpp</a></li>
<li><a href="#trunkSourceWebCoremathmlMathMLElementh">trunk/Source/WebCore/mathml/MathMLElement.h</a></li>
<li><a href="#trunkSourceWebCoremathmlMathMLFractionElementcpp">trunk/Source/WebCore/mathml/MathMLFractionElement.cpp</a></li>
<li><a href="#trunkSourceWebCoremathmlMathMLFractionElementh">trunk/Source/WebCore/mathml/MathMLFractionElement.h</a></li>
<li><a href="#trunkSourceWebCoremathmlMathMLInlineContainerElementcpp">trunk/Source/WebCore/mathml/MathMLInlineContainerElement.cpp</a></li>
<li><a href="#trunkSourceWebCoremathmlMathMLMathElementcpp">trunk/Source/WebCore/mathml/MathMLMathElement.cpp</a></li>
<li><a href="#trunkSourceWebCoremathmlMathMLOperatorElementcpp">trunk/Source/WebCore/mathml/MathMLOperatorElement.cpp</a></li>
<li><a href="#trunkSourceWebCoremathmlMathMLPaddedElementcpp">trunk/Source/WebCore/mathml/MathMLPaddedElement.cpp</a></li>
<li><a href="#trunkSourceWebCoremathmlMathMLPaddedElementh">trunk/Source/WebCore/mathml/MathMLPaddedElement.h</a></li>
<li><a href="#trunkSourceWebCoremathmlMathMLScriptsElementcpp">trunk/Source/WebCore/mathml/MathMLScriptsElement.cpp</a></li>
<li><a href="#trunkSourceWebCoremathmlMathMLScriptsElementh">trunk/Source/WebCore/mathml/MathMLScriptsElement.h</a></li>
<li><a href="#trunkSourceWebCoremathmlMathMLSpaceElementcpp">trunk/Source/WebCore/mathml/MathMLSpaceElement.cpp</a></li>
<li><a href="#trunkSourceWebCoremathmlMathMLSpaceElementh">trunk/Source/WebCore/mathml/MathMLSpaceElement.h</a></li>
<li><a href="#trunkSourceWebCoremathmlMathMLTextElementcpp">trunk/Source/WebCore/mathml/MathMLTextElement.cpp</a></li>
<li><a href="#trunkSourceWebCoremathmlMathMLUnderOverElementcpp">trunk/Source/WebCore/mathml/MathMLUnderOverElement.cpp</a></li>
<li><a href="#trunkSourceWebCoremathmlMathMLUnderOverElementh">trunk/Source/WebCore/mathml/MathMLUnderOverElement.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (204020 => 204021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-08-02 08:07:28 UTC (rev 204020)
+++ trunk/Source/WebCore/ChangeLog        2016-08-02 09:43:01 UTC (rev 204021)
</span><span class="lines">@@ -1,3 +1,57 @@
</span><ins>+2016-08-02  Frederic Wang  &lt;fwang.igalia.com&gt;
+
+        Use Optional members to store parsed MathML attributes.
+        https://bugs.webkit.org/show_bug.cgi?id=160400
+
+        Reviewed by Darin Adler.
+
+        Parsed MathML attributes are stored on the element classes using the memoize pattern to
+        minimize the number of parsing updates. Currently, a dirty flag for each member
+        indicate when it must be parsed again. We change this to wrap these members into an
+        Optional&lt;T&gt; container instead, where a null value indicates that the member is dirty.
+
+        No new tests, behavior is unchanged.
+
+        * mathml/MathMLElement.cpp:
+        (WebCore::MathMLElement::cachedMathMLLength):
+        (WebCore::MathMLElement::cachedBooleanAttribute):
+        (WebCore::MathMLElement::parseMathVariantAttribute):
+        (WebCore::MathMLElement::specifiedDisplayStyle):
+        (WebCore::MathMLElement::specifiedMathVariant):
+        * mathml/MathMLElement.h:
+        * mathml/MathMLFractionElement.cpp:
+        (WebCore::MathMLFractionElement::lineThickness):
+        (WebCore::MathMLFractionElement::cachedFractionAlignment):
+        (WebCore::MathMLFractionElement::parseAttribute):
+        * mathml/MathMLFractionElement.h:
+        * mathml/MathMLInlineContainerElement.cpp:
+        (WebCore::MathMLInlineContainerElement::parseAttribute):
+        * mathml/MathMLMathElement.cpp:
+        (WebCore::MathMLMathElement::specifiedDisplayStyle):
+        (WebCore::MathMLMathElement::parseAttribute):
+        * mathml/MathMLOperatorElement.cpp:
+        (WebCore::MathMLOperatorElement::operatorText):
+        * mathml/MathMLPaddedElement.cpp:
+        (WebCore::MathMLPaddedElement::parseAttribute):
+        * mathml/MathMLPaddedElement.h:
+        * mathml/MathMLScriptsElement.cpp:
+        (WebCore::MathMLScriptsElement::parseAttribute):
+        * mathml/MathMLScriptsElement.h:
+        * mathml/MathMLSpaceElement.cpp:
+        (WebCore::MathMLSpaceElement::parseAttribute):
+        * mathml/MathMLSpaceElement.h:
+        * mathml/MathMLTextElement.cpp:
+        (WebCore::MathMLTextElement::parseAttribute):
+        * mathml/MathMLUnderOverElement.cpp:
+        (WebCore::MathMLUnderOverElement::parseAttribute):
+        * mathml/MathMLUnderOverElement.h:
+        * rendering/mathml/MathMLStyle.cpp:
+        (WebCore::MathMLStyle::resolveMathMLStyle):
+        * rendering/mathml/MathMLStyle.h:
+        * rendering/mathml/RenderMathMLToken.cpp:
+        (WebCore::mathVariant):
+        (WebCore::RenderMathMLToken::updateMathVariantGlyph):
+
</ins><span class="cx"> 2016-08-02  Youenn Fablet  &lt;youenn@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Fetch API] Fetch promises should not reject or resolve when ActiveDOMObjects are being stopped
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/MathMLElement.cpp (204020 => 204021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLElement.cpp        2016-08-02 08:07:28 UTC (rev 204020)
+++ trunk/Source/WebCore/mathml/MathMLElement.cpp        2016-08-02 09:43:01 UTC (rev 204021)
</span><span class="lines">@@ -517,31 +517,29 @@
</span><span class="cx">     return parseNamedSpace(stringView);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-const MathMLElement::Length&amp; MathMLElement::cachedMathMLLength(const QualifiedName&amp; name, Length&amp; length)
</del><ins>+const MathMLElement::Length&amp; MathMLElement::cachedMathMLLength(const QualifiedName&amp; name, Optional&lt;Length&gt;&amp; length)
</ins><span class="cx"> {
</span><del>-    if (length.dirty) {
-        length = parseMathMLLength(attributeWithoutSynchronization(name));
-        length.dirty = false;
-    }
-    return length;
</del><ins>+    if (length)
+        return length.value();
+    length = parseMathMLLength(attributeWithoutSynchronization(name));
+    return length.value();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-const MathMLElement::BooleanValue&amp; MathMLElement::cachedBooleanAttribute(const QualifiedName&amp; name, BooleanAttribute&amp; attribute)
</del><ins>+const MathMLElement::BooleanValue&amp; MathMLElement::cachedBooleanAttribute(const QualifiedName&amp; name, Optional&lt;BooleanValue&gt;&amp; attribute)
</ins><span class="cx"> {
</span><del>-    if (!attribute.dirty)
-        return attribute.value;
</del><ins>+    if (attribute)
+        return attribute.value();
</ins><span class="cx"> 
</span><span class="cx">     // In MathML, attribute values are case-sensitive.
</span><span class="cx">     const AtomicString&amp; value = attributeWithoutSynchronization(name);
</span><span class="cx">     if (value == &quot;true&quot;)
</span><del>-        attribute.value = BooleanValue::True;
</del><ins>+        attribute = BooleanValue::True;
</ins><span class="cx">     else if (value == &quot;false&quot;)
</span><del>-        attribute.value = BooleanValue::False;
</del><ins>+        attribute = BooleanValue::False;
</ins><span class="cx">     else
</span><del>-        attribute.value = BooleanValue::Default;
-    attribute.dirty = false;
</del><ins>+        attribute = BooleanValue::Default;
</ins><span class="cx"> 
</span><del>-    return attribute.value;
</del><ins>+    return attribute.value();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> MathMLElement::MathVariant MathMLElement::parseMathVariantAttribute(const AtomicString&amp; attributeValue)
</span><span class="lines">@@ -589,20 +587,18 @@
</span><span class="cx"> Optional&lt;bool&gt; MathMLElement::specifiedDisplayStyle()
</span><span class="cx"> {
</span><span class="cx">     if (!acceptsDisplayStyleAttribute())
</span><del>-        return Optional&lt;bool&gt;();
</del><ins>+        return Nullopt;
</ins><span class="cx">     const MathMLElement::BooleanValue&amp; specifiedDisplayStyle = cachedBooleanAttribute(displaystyleAttr, m_displayStyle);
</span><del>-    return specifiedDisplayStyle == BooleanValue::Default ? Optional&lt;bool&gt;() : Optional&lt;bool&gt;(specifiedDisplayStyle == BooleanValue::True);
</del><ins>+    return toOptionalBool(specifiedDisplayStyle);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Optional&lt;MathMLElement::MathVariant&gt; MathMLElement::specifiedMathVariant()
</span><span class="cx"> {
</span><span class="cx">     if (!acceptsMathVariantAttribute())
</span><del>-        return Optional&lt;MathVariant&gt;();
-    if (m_mathVariant.dirty) {
-        m_mathVariant.value = parseMathVariantAttribute(attributeWithoutSynchronization(mathvariantAttr));
-        m_mathVariant.dirty = false;
-    }
-    return m_mathVariant.value == MathVariant::None ? Optional&lt;MathVariant&gt;() : Optional&lt;MathVariant&gt;(m_mathVariant.value);
</del><ins>+        return Nullopt;
+    if (!m_mathVariant)
+        m_mathVariant = parseMathVariantAttribute(attributeWithoutSynchronization(mathvariantAttr));
+    return m_mathVariant.value() == MathVariant::None ? Nullopt : m_mathVariant;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/MathMLElement.h (204020 => 204021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLElement.h        2016-08-02 08:07:28 UTC (rev 204020)
+++ trunk/Source/WebCore/mathml/MathMLElement.h        2016-08-02 09:43:01 UTC (rev 204021)
</span><span class="lines">@@ -63,15 +63,10 @@
</span><span class="cx">     struct Length {
</span><span class="cx">         LengthType type { LengthType::ParsingFailed };
</span><span class="cx">         float value { 0 };
</span><del>-        bool dirty { true };
</del><span class="cx">     };
</span><span class="cx">     static Length parseMathMLLength(const String&amp;);
</span><span class="cx"> 
</span><span class="cx">     enum class BooleanValue { True, False, Default };
</span><del>-    struct BooleanAttribute {
-        BooleanValue value { BooleanValue::Default };
-        bool dirty { true };
-    };
</del><span class="cx"> 
</span><span class="cx">     // These are the mathvariant values from the MathML recommendation.
</span><span class="cx">     // The special value none means that no explicit mathvariant value has been specified.
</span><span class="lines">@@ -97,13 +92,9 @@
</span><span class="cx">         Looped = 17,
</span><span class="cx">         Stretched = 18
</span><span class="cx">     };
</span><del>-    struct MathVariantAttribute {
-        MathVariant value { MathVariant::None };
-        bool dirty { true };
-    };
</del><span class="cx"> 
</span><span class="cx">     virtual Optional&lt;bool&gt; specifiedDisplayStyle();
</span><del>-    Optional&lt;MathMLElement::MathVariant&gt; specifiedMathVariant();
</del><ins>+    Optional&lt;MathVariant&gt; specifiedMathVariant();
</ins><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="cx">     MathMLElement(const QualifiedName&amp; tagName, Document&amp;);
</span><span class="lines">@@ -121,14 +112,15 @@
</span><span class="cx">     bool willRespondToMouseClickEvents() override;
</span><span class="cx">     void defaultEventHandler(Event*) override;
</span><span class="cx"> 
</span><del>-    const Length&amp; cachedMathMLLength(const QualifiedName&amp;, Length&amp;);
-    const BooleanValue&amp; cachedBooleanAttribute(const QualifiedName&amp;, BooleanAttribute&amp;);
</del><ins>+    const Length&amp; cachedMathMLLength(const QualifiedName&amp;, Optional&lt;Length&gt;&amp;);
+    const BooleanValue&amp; cachedBooleanAttribute(const QualifiedName&amp;, Optional&lt;BooleanValue&gt;&amp;);
</ins><span class="cx"> 
</span><span class="cx">     virtual bool acceptsDisplayStyleAttribute() { return false; }
</span><span class="cx">     virtual bool acceptsMathVariantAttribute() { return false; }
</span><span class="cx"> 
</span><del>-    BooleanAttribute m_displayStyle;
-    MathVariantAttribute m_mathVariant;
</del><ins>+    static Optional&lt;bool&gt; toOptionalBool(const BooleanValue&amp; value) { return value == BooleanValue::Default ? Nullopt : Optional&lt;bool&gt;(value == BooleanValue::True); }
+    Optional&lt;BooleanValue&gt; m_displayStyle;
+    Optional&lt;MathVariant&gt; m_mathVariant;
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     virtual void updateSelectedChild() { }
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLFractionElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/MathMLFractionElement.cpp (204020 => 204021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLFractionElement.cpp        2016-08-02 08:07:28 UTC (rev 204020)
+++ trunk/Source/WebCore/mathml/MathMLFractionElement.cpp        2016-08-02 09:43:01 UTC (rev 204021)
</span><span class="lines">@@ -47,42 +47,41 @@
</span><span class="cx"> 
</span><span class="cx"> const MathMLElement::Length&amp; MathMLFractionElement::lineThickness()
</span><span class="cx"> {
</span><del>-    if (!m_lineThickness.dirty)
-        return m_lineThickness;
</del><ins>+    if (m_lineThickness)
+        return m_lineThickness.value();
</ins><span class="cx"> 
</span><span class="cx">     // The MathML3 recommendation states that &quot;medium&quot; is the default thickness.
</span><span class="cx">     // However, it only states that &quot;thin&quot; and &quot;thick&quot; are respectively thiner and thicker.
</span><span class="cx">     // The MathML in HTML5 implementation note suggests 50% and 200% and these values are also used in Gecko.
</span><del>-    String thickness = attributeWithoutSynchronization(linethicknessAttr);
</del><ins>+    auto&amp; thickness = attributeWithoutSynchronization(linethicknessAttr);
+    m_lineThickness = Length();
</ins><span class="cx">     if (equalLettersIgnoringASCIICase(thickness, &quot;thin&quot;)) {
</span><del>-        m_lineThickness.type = LengthType::UnitLess;
-        m_lineThickness.value = .5;
</del><ins>+        m_lineThickness.value().type = LengthType::UnitLess;
+        m_lineThickness.value().value = .5;
</ins><span class="cx">     } else if (equalLettersIgnoringASCIICase(thickness, &quot;medium&quot;)) {
</span><del>-        m_lineThickness.type = LengthType::UnitLess;
-        m_lineThickness.value = 1;
</del><ins>+        m_lineThickness.value().type = LengthType::UnitLess;
+        m_lineThickness.value().value = 1;
</ins><span class="cx">     } else if (equalLettersIgnoringASCIICase(thickness, &quot;thick&quot;)) {
</span><del>-        m_lineThickness.type = LengthType::UnitLess;
-        m_lineThickness.value = 2;
</del><ins>+        m_lineThickness.value().type = LengthType::UnitLess;
+        m_lineThickness.value().value = 2;
</ins><span class="cx">     } else
</span><span class="cx">         m_lineThickness = parseMathMLLength(thickness);
</span><del>-    m_lineThickness.dirty = false;
-    return m_lineThickness;
</del><ins>+    return m_lineThickness.value();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-MathMLFractionElement::FractionAlignment MathMLFractionElement::cachedFractionAlignment(const QualifiedName&amp; name, FractionAlignmentAttribute&amp; alignment)
</del><ins>+MathMLFractionElement::FractionAlignment MathMLFractionElement::cachedFractionAlignment(const QualifiedName&amp; name, Optional&lt;FractionAlignment&gt;&amp; alignment)
</ins><span class="cx"> {
</span><del>-    if (!alignment.dirty)
-        return alignment.value;
</del><ins>+    if (alignment)
+        return alignment.value();
</ins><span class="cx"> 
</span><del>-    String value = attributeWithoutSynchronization(name);
</del><ins>+    auto&amp; value = attributeWithoutSynchronization(name);
</ins><span class="cx">     if (equalLettersIgnoringASCIICase(value, &quot;left&quot;))
</span><del>-        alignment.value = FractionAlignmentLeft;
</del><ins>+        alignment = FractionAlignmentLeft;
</ins><span class="cx">     else if (equalLettersIgnoringASCIICase(value, &quot;right&quot;))
</span><del>-        alignment.value = FractionAlignmentRight;
</del><ins>+        alignment = FractionAlignmentRight;
</ins><span class="cx">     else
</span><del>-        alignment.value = FractionAlignmentCenter;
-    alignment.dirty = false;
-    return alignment.value;
</del><ins>+        alignment = FractionAlignmentCenter;
+    return alignment.value();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> MathMLFractionElement::FractionAlignment MathMLFractionElement::numeratorAlignment()
</span><span class="lines">@@ -98,11 +97,11 @@
</span><span class="cx"> void MathMLFractionElement::parseAttribute(const QualifiedName&amp; name, const AtomicString&amp; value)
</span><span class="cx"> {
</span><span class="cx">     if (name == linethicknessAttr)
</span><del>-        m_lineThickness.dirty = true;
</del><ins>+        m_lineThickness = Nullopt;
</ins><span class="cx">     else if (name == numalignAttr)
</span><del>-        m_numeratorAlignment.dirty = true;
</del><ins>+        m_numeratorAlignment = Nullopt;
</ins><span class="cx">     else if (name == denomalignAttr)
</span><del>-        m_denominatorAlignment.dirty = true;
</del><ins>+        m_denominatorAlignment = Nullopt;
</ins><span class="cx"> 
</span><span class="cx">     MathMLElement::parseAttribute(name, value);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLFractionElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/MathMLFractionElement.h (204020 => 204021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLFractionElement.h        2016-08-02 08:07:28 UTC (rev 204020)
+++ trunk/Source/WebCore/mathml/MathMLFractionElement.h        2016-08-02 09:43:01 UTC (rev 204021)
</span><span class="lines">@@ -47,15 +47,11 @@
</span><span class="cx">     RenderPtr&lt;RenderElement&gt; createElementRenderer(RenderStyle&amp;&amp;, const RenderTreePosition&amp;) final;
</span><span class="cx">     void parseAttribute(const QualifiedName&amp;, const AtomicString&amp;) final;
</span><span class="cx"> 
</span><del>-    struct FractionAlignmentAttribute {
-        FractionAlignment value { FractionAlignmentCenter };
-        bool dirty { true };
-    };
-    FractionAlignment cachedFractionAlignment(const QualifiedName&amp;, FractionAlignmentAttribute&amp;);
</del><ins>+    FractionAlignment cachedFractionAlignment(const QualifiedName&amp;, Optional&lt;FractionAlignment&gt;&amp;);
</ins><span class="cx"> 
</span><del>-    Length m_lineThickness;
-    FractionAlignmentAttribute m_numeratorAlignment;
-    FractionAlignmentAttribute m_denominatorAlignment;
</del><ins>+    Optional&lt;Length&gt; m_lineThickness;
+    Optional&lt;FractionAlignment&gt; m_numeratorAlignment;
+    Optional&lt;FractionAlignment&gt; m_denominatorAlignment;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLInlineContainerElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/MathMLInlineContainerElement.cpp (204020 => 204021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLInlineContainerElement.cpp        2016-08-02 08:07:28 UTC (rev 204020)
+++ trunk/Source/WebCore/mathml/MathMLInlineContainerElement.cpp        2016-08-02 09:43:01 UTC (rev 204021)
</span><span class="lines">@@ -90,9 +90,9 @@
</span><span class="cx">     bool displayStyleAttribute = name == displaystyleAttr &amp;&amp; acceptsDisplayStyleAttribute();
</span><span class="cx">     bool mathVariantAttribute = name == mathvariantAttr &amp;&amp; acceptsMathVariantAttribute();
</span><span class="cx">     if (displayStyleAttribute)
</span><del>-        m_displayStyle.dirty = true;
</del><ins>+        m_displayStyle = Nullopt;
</ins><span class="cx">     if (mathVariantAttribute)
</span><del>-        m_mathVariant.dirty = true;
</del><ins>+        m_mathVariant = Nullopt;
</ins><span class="cx">     if ((displayStyleAttribute || mathVariantAttribute) &amp;&amp; renderer())
</span><span class="cx">         MathMLStyle::resolveMathMLStyleTree(renderer());
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLMathElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/MathMLMathElement.cpp (204020 => 204021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLMathElement.cpp        2016-08-02 08:07:28 UTC (rev 204020)
+++ trunk/Source/WebCore/mathml/MathMLMathElement.cpp        2016-08-02 09:43:01 UTC (rev 204021)
</span><span class="lines">@@ -58,13 +58,13 @@
</span><span class="cx"> {
</span><span class="cx">     if (cachedBooleanAttribute(displaystyleAttr, m_displayStyle) == BooleanValue::Default) {
</span><span class="cx">         // The default displaystyle value of the &lt;math&gt; depends on the display attribute, so we parse it here.
</span><del>-        const AtomicString&amp; value = attributeWithoutSynchronization(displayAttr);
</del><ins>+        auto&amp; value = attributeWithoutSynchronization(displayAttr);
</ins><span class="cx">         if (value == &quot;block&quot;)
</span><del>-            m_displayStyle.value = BooleanValue::True;
</del><ins>+            m_displayStyle = BooleanValue::True;
</ins><span class="cx">         else if (value == &quot;inline&quot;)
</span><del>-            m_displayStyle.value = BooleanValue::False;
</del><ins>+            m_displayStyle = BooleanValue::False;
</ins><span class="cx">     }
</span><del>-    return m_displayStyle.value == BooleanValue::Default ? Optional&lt;bool&gt;() : Optional&lt;bool&gt;(m_displayStyle.value == BooleanValue::True);
</del><ins>+    return toOptionalBool(m_displayStyle.value());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void MathMLMathElement::parseAttribute(const QualifiedName&amp; name, const AtomicString&amp; value)
</span><span class="lines">@@ -72,9 +72,9 @@
</span><span class="cx">     bool displayStyleAttribute = (name == displaystyleAttr || name == displayAttr);
</span><span class="cx">     bool mathVariantAttribute = name == mathvariantAttr;
</span><span class="cx">     if (displayStyleAttribute)
</span><del>-        m_displayStyle.dirty = true;
</del><ins>+        m_displayStyle = Nullopt;
</ins><span class="cx">     if (mathVariantAttribute)
</span><del>-        m_mathVariant.dirty = true;
</del><ins>+        m_mathVariant = Nullopt;
</ins><span class="cx">     if ((displayStyleAttribute || mathVariantAttribute) &amp;&amp; renderer())
</span><span class="cx">         MathMLStyle::resolveMathMLStyleTree(renderer());
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLOperatorElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/MathMLOperatorElement.cpp (204020 => 204021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLOperatorElement.cpp        2016-08-02 08:07:28 UTC (rev 204020)
+++ trunk/Source/WebCore/mathml/MathMLOperatorElement.cpp        2016-08-02 09:43:01 UTC (rev 204021)
</span><span class="lines">@@ -63,13 +63,13 @@
</span><span class="cx">     if (m_operatorText)
</span><span class="cx">         return m_operatorText.value();
</span><span class="cx"> 
</span><del>-    m_operatorText = Optional&lt;UChar&gt;(parseOperatorText(textContent()));
</del><ins>+    m_operatorText = parseOperatorText(textContent());
</ins><span class="cx">     return m_operatorText.value();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void MathMLOperatorElement::childrenChanged(const ChildChange&amp; change)
</span><span class="cx"> {
</span><del>-    m_operatorText = Optional&lt;UChar&gt;();
</del><ins>+    m_operatorText = Nullopt;
</ins><span class="cx">     MathMLTextElement::childrenChanged(change);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLPaddedElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/MathMLPaddedElement.cpp (204020 => 204021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLPaddedElement.cpp        2016-08-02 08:07:28 UTC (rev 204020)
+++ trunk/Source/WebCore/mathml/MathMLPaddedElement.cpp        2016-08-02 09:43:01 UTC (rev 204021)
</span><span class="lines">@@ -73,15 +73,15 @@
</span><span class="cx"> void MathMLPaddedElement::parseAttribute(const QualifiedName&amp; name, const AtomicString&amp; value)
</span><span class="cx"> {
</span><span class="cx">     if (name == widthAttr)
</span><del>-        m_width.dirty = true;
</del><ins>+        m_width = Nullopt;
</ins><span class="cx">     else if (name == heightAttr)
</span><del>-        m_height.dirty = true;
</del><ins>+        m_height = Nullopt;
</ins><span class="cx">     else if (name == depthAttr)
</span><del>-        m_depth.dirty = true;
</del><ins>+        m_depth = Nullopt;
</ins><span class="cx">     else if (name == lspaceAttr)
</span><del>-        m_lspace.dirty = true;
</del><ins>+        m_lspace = Nullopt;
</ins><span class="cx">     else if (name == voffsetAttr)
</span><del>-        m_voffset.dirty = true;
</del><ins>+        m_voffset = Nullopt;
</ins><span class="cx"> 
</span><span class="cx">     MathMLElement::parseAttribute(name, value);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLPaddedElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/MathMLPaddedElement.h (204020 => 204021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLPaddedElement.h        2016-08-02 08:07:28 UTC (rev 204020)
+++ trunk/Source/WebCore/mathml/MathMLPaddedElement.h        2016-08-02 09:43:01 UTC (rev 204021)
</span><span class="lines">@@ -44,11 +44,11 @@
</span><span class="cx">     RenderPtr&lt;RenderElement&gt; createElementRenderer(RenderStyle&amp;&amp;, const RenderTreePosition&amp;) final;
</span><span class="cx">     void parseAttribute(const QualifiedName&amp;, const AtomicString&amp;) final;
</span><span class="cx"> 
</span><del>-    Length m_width;
-    Length m_height;
-    Length m_depth;
-    Length m_lspace;
-    Length m_voffset;
</del><ins>+    Optional&lt;Length&gt; m_width;
+    Optional&lt;Length&gt; m_height;
+    Optional&lt;Length&gt; m_depth;
+    Optional&lt;Length&gt; m_lspace;
+    Optional&lt;Length&gt; m_voffset;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLScriptsElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/MathMLScriptsElement.cpp (204020 => 204021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLScriptsElement.cpp        2016-08-02 08:07:28 UTC (rev 204020)
+++ trunk/Source/WebCore/mathml/MathMLScriptsElement.cpp        2016-08-02 09:43:01 UTC (rev 204021)
</span><span class="lines">@@ -58,9 +58,9 @@
</span><span class="cx"> void MathMLScriptsElement::parseAttribute(const QualifiedName&amp; name, const AtomicString&amp; value)
</span><span class="cx"> {
</span><span class="cx">     if (name == subscriptshiftAttr)
</span><del>-        m_subscriptShift.dirty = true;
</del><ins>+        m_subscriptShift = Nullopt;
</ins><span class="cx">     else if (name == superscriptshiftAttr)
</span><del>-        m_superscriptShift.dirty = true;
</del><ins>+        m_superscriptShift = Nullopt;
</ins><span class="cx"> 
</span><span class="cx">     MathMLElement::parseAttribute(name, value);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLScriptsElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/MathMLScriptsElement.h (204020 => 204021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLScriptsElement.h        2016-08-02 08:07:28 UTC (rev 204020)
+++ trunk/Source/WebCore/mathml/MathMLScriptsElement.h        2016-08-02 09:43:01 UTC (rev 204021)
</span><span class="lines">@@ -43,8 +43,8 @@
</span><span class="cx">     RenderPtr&lt;RenderElement&gt; createElementRenderer(RenderStyle&amp;&amp;, const RenderTreePosition&amp;) override;
</span><span class="cx">     void parseAttribute(const QualifiedName&amp;, const AtomicString&amp;) override;
</span><span class="cx"> 
</span><del>-    Length m_subscriptShift;
-    Length m_superscriptShift;
</del><ins>+    Optional&lt;Length&gt; m_subscriptShift;
+    Optional&lt;Length&gt; m_superscriptShift;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLSpaceElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/MathMLSpaceElement.cpp (204020 => 204021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLSpaceElement.cpp        2016-08-02 08:07:28 UTC (rev 204020)
+++ trunk/Source/WebCore/mathml/MathMLSpaceElement.cpp        2016-08-02 09:43:01 UTC (rev 204021)
</span><span class="lines">@@ -63,11 +63,11 @@
</span><span class="cx"> void MathMLSpaceElement::parseAttribute(const QualifiedName&amp; name, const AtomicString&amp; value)
</span><span class="cx"> {
</span><span class="cx">     if (name == widthAttr)
</span><del>-        m_width.dirty = true;
</del><ins>+        m_width = Nullopt;
</ins><span class="cx">     else if (name == heightAttr)
</span><del>-        m_height.dirty = true;
</del><ins>+        m_height = Nullopt;
</ins><span class="cx">     else if (name == depthAttr)
</span><del>-        m_depth.dirty = true;
</del><ins>+        m_depth = Nullopt;
</ins><span class="cx"> 
</span><span class="cx">     MathMLElement::parseAttribute(name, value);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLSpaceElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/MathMLSpaceElement.h (204020 => 204021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLSpaceElement.h        2016-08-02 08:07:28 UTC (rev 204020)
+++ trunk/Source/WebCore/mathml/MathMLSpaceElement.h        2016-08-02 09:43:01 UTC (rev 204021)
</span><span class="lines">@@ -42,9 +42,9 @@
</span><span class="cx">     RenderPtr&lt;RenderElement&gt; createElementRenderer(RenderStyle&amp;&amp;, const RenderTreePosition&amp;) final;
</span><span class="cx">     void parseAttribute(const QualifiedName&amp;, const AtomicString&amp;) final;
</span><span class="cx"> 
</span><del>-    Length m_width;
-    Length m_height;
-    Length m_depth;
</del><ins>+    Optional&lt;Length&gt; m_width;
+    Optional&lt;Length&gt; m_height;
+    Optional&lt;Length&gt; m_depth;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLTextElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/MathMLTextElement.cpp (204020 => 204021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLTextElement.cpp        2016-08-02 08:07:28 UTC (rev 204020)
+++ trunk/Source/WebCore/mathml/MathMLTextElement.cpp        2016-08-02 09:43:01 UTC (rev 204021)
</span><span class="lines">@@ -65,7 +65,7 @@
</span><span class="cx"> void MathMLTextElement::parseAttribute(const QualifiedName&amp; name, const AtomicString&amp; value)
</span><span class="cx"> {
</span><span class="cx">     if (name == mathvariantAttr) {
</span><del>-        m_mathVariant.dirty = true;
</del><ins>+        m_mathVariant = Nullopt;
</ins><span class="cx">         if (renderer())
</span><span class="cx">             MathMLStyle::resolveMathMLStyleTree(renderer());
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLUnderOverElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/MathMLUnderOverElement.cpp (204020 => 204021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLUnderOverElement.cpp        2016-08-02 08:07:28 UTC (rev 204020)
+++ trunk/Source/WebCore/mathml/MathMLUnderOverElement.cpp        2016-08-02 09:43:01 UTC (rev 204021)
</span><span class="lines">@@ -58,9 +58,9 @@
</span><span class="cx"> void MathMLUnderOverElement::parseAttribute(const QualifiedName&amp; name, const AtomicString&amp; value)
</span><span class="cx"> {
</span><span class="cx">     if (name == accentAttr)
</span><del>-        m_accent.dirty = true;
</del><ins>+        m_accent = Nullopt;
</ins><span class="cx">     else if (name == accentunderAttr)
</span><del>-        m_accentUnder.dirty = true;
</del><ins>+        m_accentUnder = Nullopt;
</ins><span class="cx"> 
</span><span class="cx">     MathMLElement::parseAttribute(name, value);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLUnderOverElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/MathMLUnderOverElement.h (204020 => 204021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLUnderOverElement.h        2016-08-02 08:07:28 UTC (rev 204020)
+++ trunk/Source/WebCore/mathml/MathMLUnderOverElement.h        2016-08-02 09:43:01 UTC (rev 204021)
</span><span class="lines">@@ -41,8 +41,8 @@
</span><span class="cx">     RenderPtr&lt;RenderElement&gt; createElementRenderer(RenderStyle&amp;&amp;, const RenderTreePosition&amp;) final;
</span><span class="cx">     void parseAttribute(const QualifiedName&amp;, const AtomicString&amp;) final;
</span><span class="cx"> 
</span><del>-    BooleanAttribute m_accent;
-    BooleanAttribute m_accentUnder;
</del><ins>+    Optional&lt;BooleanValue&gt; m_accent;
+    Optional&lt;BooleanValue&gt; m_accentUnder;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>