<!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>[204692] 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/204692">204692</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-08-21 05:18:43 -0700 (Sun, 21 Aug 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Introduce a MathMLAnnotationElement class for the annotation/annotation-xml elements
https://bugs.webkit.org/show_bug.cgi?id=160540

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

The &lt;annotation&gt; element can only contain text whereas the &lt;annotation-xml&gt; element can
contain some elements as described in the HTML5 RelaxNG schema. For this reason, they have
been implemented in the separate MathMLTextElement and MathMLInlineContainerElement
respectively. However, they are actually closer to each other than to token elements or
presentation containers. In particular they support very different attributes and are
considered by the &lt;semantics&gt; tag. Hence we move their implementations in a new
MathMLAnnotation class.

No new tests, already covered by existing tests.

* CMakeLists.txt: Add MathMLAnnotationElement.
* mathml/MathMLAllInOne.cpp: Ditto.
* WebCore.xcodeproj/project.pbxproj: Ditto.
* mathml/MathMLAnnotationElement.cpp: Added.
(WebCore::MathMLAnnotationElement::MathMLAnnotationElement): ASSERT that this class is only
for annotation and annotation-xml.
(WebCore::MathMLAnnotationElement::create):
(WebCore::MathMLAnnotationElement::createElementRenderer): Move implementation from
MathMLTextElement and MathMLInlineContainerElement.
(WebCore::MathMLAnnotationElement::childShouldCreateRenderer): Move implementation from
MathMLTextElement and MathMLElement.
(WebCore::MathMLAnnotationElement::attributeChanged): Move implementation from MathMLElement.
* mathml/MathMLAnnotationElement.h: Override isSemanticAnnotation and isPresentationMathML
to return true.
* mathml/MathMLElement.cpp:
(WebCore::MathMLElement::childShouldCreateRenderer): Move the annotation-xml case into
MathMLAnnotationElement.
(WebCore::MathMLElement::attributeChanged): Deleted. This was only used for semantic
annotations and so the code is moved into MathMLAnnotationElement.
* mathml/MathMLElement.h:
(WebCore::MathMLElement::isMathMLToken): Return false and let derived class override this.
(WebCore::MathMLElement::isSemanticAnnotation): Ditto.
(WebCore::MathMLElement::updateSelectedChild): Make this public so that is can be used
by MathMLAnnotationElement::attributeChanged.
* mathml/MathMLInlineContainerElement.cpp:
(WebCore::MathMLInlineContainerElement::createElementRenderer): The annotation-xml case is
now handled in MathMLAnnotationElement.
* mathml/MathMLTextElement.cpp:
(WebCore::MathMLTextElement::createElementRenderer): The annotation case is handled is now
handled in  MathMLAnnotationElement.
(WebCore::MathMLTextElement::childShouldCreateRenderer): Ditto.
* mathml/MathMLTextElement.h: Override isToken to return true.
* mathml/mathtags.in: Map annotation and annotation-xml to MathMLAnnotationElement.</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="#trunkSourceWebCoremathmlMathMLElementcpp">trunk/Source/WebCore/mathml/MathMLElement.cpp</a></li>
<li><a href="#trunkSourceWebCoremathmlMathMLElementh">trunk/Source/WebCore/mathml/MathMLElement.h</a></li>
<li><a href="#trunkSourceWebCoremathmlMathMLInlineContainerElementcpp">trunk/Source/WebCore/mathml/MathMLInlineContainerElement.cpp</a></li>
<li><a href="#trunkSourceWebCoremathmlMathMLTextElementcpp">trunk/Source/WebCore/mathml/MathMLTextElement.cpp</a></li>
<li><a href="#trunkSourceWebCoremathmlMathMLTextElementh">trunk/Source/WebCore/mathml/MathMLTextElement.h</a></li>
<li><a href="#trunkSourceWebCoremathmlmathtagsin">trunk/Source/WebCore/mathml/mathtags.in</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoremathmlMathMLAnnotationElementcpp">trunk/Source/WebCore/mathml/MathMLAnnotationElement.cpp</a></li>
<li><a href="#trunkSourceWebCoremathmlMathMLAnnotationElementh">trunk/Source/WebCore/mathml/MathMLAnnotationElement.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 (204691 => 204692)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2016-08-21 10:55:31 UTC (rev 204691)
+++ trunk/Source/WebCore/CMakeLists.txt        2016-08-21 12:18:43 UTC (rev 204692)
</span><span class="lines">@@ -2002,6 +2002,7 @@
</span><span class="cx">     loader/icon/IconRecord.cpp
</span><span class="cx">     loader/icon/PageURLRecord.cpp
</span><span class="cx"> 
</span><ins>+    mathml/MathMLAnnotationElement.cpp
</ins><span class="cx">     mathml/MathMLElement.cpp
</span><span class="cx">     mathml/MathMLFractionElement.cpp
</span><span class="cx">     mathml/MathMLInlineContainerElement.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (204691 => 204692)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-08-21 10:55:31 UTC (rev 204691)
+++ trunk/Source/WebCore/ChangeLog        2016-08-21 12:18:43 UTC (rev 204692)
</span><span class="lines">@@ -1,3 +1,54 @@
</span><ins>+2016-08-21  Frederic Wang  &lt;fwang@igalia.com&gt;
+
+        Introduce a MathMLAnnotationElement class for the annotation/annotation-xml elements
+        https://bugs.webkit.org/show_bug.cgi?id=160540
+
+        Reviewed by Darin Adler.
+
+        The &lt;annotation&gt; element can only contain text whereas the &lt;annotation-xml&gt; element can
+        contain some elements as described in the HTML5 RelaxNG schema. For this reason, they have
+        been implemented in the separate MathMLTextElement and MathMLInlineContainerElement
+        respectively. However, they are actually closer to each other than to token elements or
+        presentation containers. In particular they support very different attributes and are
+        considered by the &lt;semantics&gt; tag. Hence we move their implementations in a new
+        MathMLAnnotation class.
+
+        No new tests, already covered by existing tests.
+
+        * CMakeLists.txt: Add MathMLAnnotationElement.
+        * mathml/MathMLAllInOne.cpp: Ditto.
+        * WebCore.xcodeproj/project.pbxproj: Ditto.
+        * mathml/MathMLAnnotationElement.cpp: Added.
+        (WebCore::MathMLAnnotationElement::MathMLAnnotationElement): ASSERT that this class is only
+        for annotation and annotation-xml.
+        (WebCore::MathMLAnnotationElement::create):
+        (WebCore::MathMLAnnotationElement::createElementRenderer): Move implementation from
+        MathMLTextElement and MathMLInlineContainerElement.
+        (WebCore::MathMLAnnotationElement::childShouldCreateRenderer): Move implementation from
+        MathMLTextElement and MathMLElement.
+        (WebCore::MathMLAnnotationElement::attributeChanged): Move implementation from MathMLElement.
+        * mathml/MathMLAnnotationElement.h: Override isSemanticAnnotation and isPresentationMathML
+        to return true.
+        * mathml/MathMLElement.cpp:
+        (WebCore::MathMLElement::childShouldCreateRenderer): Move the annotation-xml case into
+        MathMLAnnotationElement.
+        (WebCore::MathMLElement::attributeChanged): Deleted. This was only used for semantic
+        annotations and so the code is moved into MathMLAnnotationElement.
+        * mathml/MathMLElement.h:
+        (WebCore::MathMLElement::isMathMLToken): Return false and let derived class override this.
+        (WebCore::MathMLElement::isSemanticAnnotation): Ditto.
+        (WebCore::MathMLElement::updateSelectedChild): Make this public so that is can be used
+        by MathMLAnnotationElement::attributeChanged.
+        * mathml/MathMLInlineContainerElement.cpp:
+        (WebCore::MathMLInlineContainerElement::createElementRenderer): The annotation-xml case is
+        now handled in MathMLAnnotationElement.
+        * mathml/MathMLTextElement.cpp:
+        (WebCore::MathMLTextElement::createElementRenderer): The annotation case is handled is now
+        handled in  MathMLAnnotationElement.
+        (WebCore::MathMLTextElement::childShouldCreateRenderer): Ditto.
+        * mathml/MathMLTextElement.h: Override isToken to return true.
+        * mathml/mathtags.in: Map annotation and annotation-xml to MathMLAnnotationElement.
+
</ins><span class="cx"> 2016-08-21  Michael Catanzaro  &lt;mcatanzaro@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] Clean up CursorGtk.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (204691 => 204692)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-08-21 10:55:31 UTC (rev 204691)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-08-21 12:18:43 UTC (rev 204692)
</span><span class="lines">@@ -6715,6 +6715,8 @@
</span><span class="cx">                 FA654A6C1108ABED002615E0 /* MathMLTextElement.h in Headers */ = {isa = PBXBuildFile; fileRef = FA654A6A1108ABED002615E0 /* MathMLTextElement.h */; };
</span><span class="cx">                 FA654A6C1108ABED002616F1 /* MathMLOperatorElement.h in Headers */ = {isa = PBXBuildFile; fileRef = FA654A6A1108ABED002616F1 /* MathMLOperatorElement.h */; };
</span><span class="cx">                 FA654A6C1108ABED002626F1 /* MathMLUnderOverElement.h in Headers */ = {isa = PBXBuildFile; fileRef = FA654A6A1108ABED002626F1 /* MathMLUnderOverElement.h */; };
</span><ins>+                FABE72F41059C1EB00D888CC /* MathMLAnnotationElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FABE72ED1059C1EB00D888CC /* MathMLAnnotationElement.cpp */; };
+                FABE72F51059C1EB00D888CC /* MathMLAnnotationElement.h in Headers */ = {isa = PBXBuildFile; fileRef = FABE72EE1059C1EB00D888CC /* MathMLAnnotationElement.h */; };
</ins><span class="cx">                 FABE72F41059C1EB00D999DD /* MathMLElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FABE72ED1059C1EB00D999DD /* MathMLElement.cpp */; };
</span><span class="cx">                 FABE72F51059C1EB00D999DD /* MathMLElement.h in Headers */ = {isa = PBXBuildFile; fileRef = FABE72EE1059C1EB00D999DD /* MathMLElement.h */; };
</span><span class="cx">                 FABE72F61059C1EB00D999DD /* MathMLInlineContainerElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FABE72EF1059C1EB00D999DD /* MathMLInlineContainerElement.cpp */; };
</span><span class="lines">@@ -14692,6 +14694,8 @@
</span><span class="cx">                 FA654A6A1108ABED002616F1 /* MathMLOperatorElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathMLOperatorElement.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 FA654A6A1108ABED002626F1 /* MathMLUnderOverElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathMLUnderOverElement.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 FA6E466FCD0418A9966A5B60 /* DNSResolveQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DNSResolveQueue.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                FABE72ED1059C1EB00D888CC /* MathMLAnnotationElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLAnnotationElement.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                FABE72EE1059C1EB00D888CC /* MathMLAnnotationElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathMLAnnotationElement.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 FABE72ED1059C1EB00D999DD /* MathMLElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLElement.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 FABE72EE1059C1EB00D999DD /* MathMLElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathMLElement.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 FABE72EF1059C1EB00D999DD /* MathMLInlineContainerElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLInlineContainerElement.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -24344,6 +24348,8 @@
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="cx">                                 FA654A671108ABE2002615E0 /* mathattrs.in */,
</span><ins>+                                FABE72ED1059C1EB00D888CC /* MathMLAnnotationElement.cpp */,
+                                FABE72EE1059C1EB00D888CC /* MathMLAnnotationElement.h */,
</ins><span class="cx">                                 FABE72ED1059C1EB00D999DD /* MathMLElement.cpp */,
</span><span class="cx">                                 FABE72EE1059C1EB00D999DD /* MathMLElement.h */,
</span><span class="cx">                                 0BCF83EF1059C1EB00D999DD /* MathMLFractionElement.cpp */,
</span><span class="lines">@@ -26791,6 +26797,7 @@
</span><span class="cx">                                 93309DF8099E64920056E581 /* markup.h in Headers */,
</span><span class="cx">                                 9728C3141268E4390041E89B /* MarkupAccumulator.h in Headers */,
</span><span class="cx">                                 00C60E3F13D76D7E0092A275 /* MarkupTokenizerInlines.h in Headers */,
</span><ins>+                                FABE72F51059C1EB00D888CC /* MathMLAnnotationElement.h in Headers */,
</ins><span class="cx">                                 FABE72F51059C1EB00D999DD /* MathMLElement.h in Headers */,
</span><span class="cx">                                 44A28AAC12DFB8AC00AE923B /* MathMLElementFactory.h in Headers */,
</span><span class="cx">                                 0BCF83F71059C1EB00D999DD /* MathMLFractionElement.h in Headers */,
</span><span class="lines">@@ -30599,6 +30606,7 @@
</span><span class="cx">                                 1A8F6BC50DB55CDC001DB794 /* ManifestParser.cpp in Sources */,
</span><span class="cx">                                 93309DF7099E64920056E581 /* markup.cpp in Sources */,
</span><span class="cx">                                 9728C3131268E4390041E89B /* MarkupAccumulator.cpp in Sources */,
</span><ins>+                                FABE72F41059C1EB00D888CC /* MathMLAnnotationElement.cpp in Sources */,
</ins><span class="cx">                                 FABE72F41059C1EB00D999DD /* MathMLElement.cpp in Sources */,
</span><span class="cx">                                 FABE72FD1059C21100D999DD /* MathMLElementFactory.cpp in Sources */,
</span><span class="cx">                                 0BCF83F61059C1EB00D999DD /* MathMLFractionElement.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLAllInOnecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/MathMLAllInOne.cpp (204691 => 204692)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLAllInOne.cpp        2016-08-21 10:55:31 UTC (rev 204691)
+++ trunk/Source/WebCore/mathml/MathMLAllInOne.cpp        2016-08-21 12:18:43 UTC (rev 204692)
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx"> 
</span><span class="cx"> // This all-in-one cpp file cuts down on template bloat to allow us to build our Windows release build.
</span><span class="cx"> 
</span><ins>+#include &quot;MathMLAnnotationElement.cpp&quot;
</ins><span class="cx"> #include &quot;MathMLElement.cpp&quot;
</span><span class="cx"> #include &quot;MathMLFractionElement.cpp&quot;
</span><span class="cx"> #include &quot;MathMLInlineContainerElement.cpp&quot;
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLAnnotationElementcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/mathml/MathMLAnnotationElement.cpp (0 => 204692)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLAnnotationElement.cpp                                (rev 0)
+++ trunk/Source/WebCore/mathml/MathMLAnnotationElement.cpp        2016-08-21 12:18:43 UTC (rev 204692)
</span><span class="lines">@@ -0,0 +1,108 @@
</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
+ * &quot;AS IS&quot; 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 &quot;config.h&quot;
+
+#if ENABLE(MATHML)
+#include &quot;MathMLAnnotationElement.h&quot;
+
+#include &quot;HTMLHtmlElement.h&quot;
+#include &quot;MathMLMathElement.h&quot;
+#include &quot;MathMLNames.h&quot;
+#include &quot;MathMLSelectElement.h&quot;
+#include &quot;RenderMathMLRow.h&quot;
+#include &quot;SVGSVGElement.h&quot;
+
+namespace WebCore {
+
+using namespace MathMLNames;
+
+MathMLAnnotationElement::MathMLAnnotationElement(const QualifiedName&amp; tagName, Document&amp; document)
+    : MathMLElement(tagName, document)
+{
+    ASSERT(hasTagName(annotationTag) || hasTagName(annotation_xmlTag));
+}
+
+Ref&lt;MathMLAnnotationElement&gt; MathMLAnnotationElement::create(const QualifiedName&amp; tagName, Document&amp; document)
+{
+    return adoptRef(*new MathMLAnnotationElement(tagName, document));
+}
+
+RenderPtr&lt;RenderElement&gt; MathMLAnnotationElement::createElementRenderer(RenderStyle&amp;&amp; style, const RenderTreePosition&amp; insertionPosition)
+{
+    if (hasTagName(MathMLNames::annotationTag))
+        return MathMLElement::createElementRenderer(WTFMove(style), insertionPosition);
+
+    // FIXME: Do we really need to create a RenderMathMLRow?
+    ASSERT(hasTagName(annotation_xmlTag));
+    return createRenderer&lt;RenderMathMLRow&gt;(*this, WTFMove(style));
+}
+
+bool MathMLAnnotationElement::childShouldCreateRenderer(const Node&amp; child) const
+{
+    // For &lt;annotation&gt;, only text children are allowed.
+    if (hasTagName(MathMLNames::annotationTag))
+        return child.isTextNode();
+
+    // For &lt;annotation-xml&gt;, we follow these definitions from the HTML5 RelaxNG schema:
+    // - annotation-xml.model.mathml
+    // - annotation-xml.model.svg
+    // - annotation-xml.model.xhtml
+
+    ASSERT(hasTagName(annotation_xmlTag));
+    auto&amp; value = attributeWithoutSynchronization(encodingAttr);
+
+    if (is&lt;MathMLElement&gt;(child) &amp;&amp; (MathMLSelectElement::isMathMLEncoding(value) || MathMLSelectElement::isHTMLEncoding(value))) {
+        auto&amp; mathmlElement = downcast&lt;MathMLElement&gt;(child);
+        return is&lt;MathMLMathElement&gt;(mathmlElement);
+    }
+
+    if (is&lt;SVGElement&gt;(child) &amp;&amp; (MathMLSelectElement::isSVGEncoding(value) || MathMLSelectElement::isHTMLEncoding(value))) {
+        auto&amp; svgElement = downcast&lt;SVGElement&gt;(child);
+        return is&lt;SVGSVGElement&gt;(svgElement);
+    }
+
+    if (is&lt;HTMLElement&gt;(child) &amp;&amp; MathMLSelectElement::isHTMLEncoding(value)) {
+        auto&amp; htmlElement = downcast&lt;HTMLElement&gt;(child);
+        return is&lt;HTMLHtmlElement&gt;(htmlElement) || (isFlowContent(htmlElement) &amp;&amp; StyledElement::childShouldCreateRenderer(child));
+    }
+
+    return false;
+}
+
+void MathMLAnnotationElement::attributeChanged(const QualifiedName&amp; name, const AtomicString&amp; oldValue, const AtomicString&amp; newValue, AttributeModificationReason reason)
+{
+    if (name == MathMLNames::srcAttr || name == MathMLNames::encodingAttr) {
+        auto* parent = parentElement();
+        if (is&lt;MathMLElement&gt;(parent) &amp;&amp; parent-&gt;hasTagName(semanticsTag))
+            downcast&lt;MathMLElement&gt;(*parent).updateSelectedChild();
+    }
+    MathMLElement::attributeChanged(name, oldValue, newValue, reason);
+}
+
+}
+
+#endif // ENABLE(MATHML)
</ins></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLAnnotationElementhfromrev204691trunkSourceWebCoremathmlMathMLTextElementh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/mathml/MathMLAnnotationElement.h (from rev 204691, trunk/Source/WebCore/mathml/MathMLTextElement.h) (0 => 204692)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLAnnotationElement.h                                (rev 0)
+++ trunk/Source/WebCore/mathml/MathMLAnnotationElement.h        2016-08-21 12:18:43 UTC (rev 204692)
</span><span class="lines">@@ -0,0 +1,49 @@
</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
+ * &quot;AS IS&quot; 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.
+ */
+
+#pragma once
+
+#if ENABLE(MATHML)
+#include &quot;MathMLElement.h&quot;
+
+namespace WebCore {
+
+class MathMLAnnotationElement final : public MathMLElement {
+public:
+    static Ref&lt;MathMLAnnotationElement&gt; create(const QualifiedName&amp; tagName, Document&amp;);
+private:
+    MathMLAnnotationElement(const QualifiedName&amp; tagName, Document&amp;);
+    RenderPtr&lt;RenderElement&gt; createElementRenderer(RenderStyle&amp;&amp;, const RenderTreePosition&amp;) final;
+
+    bool isSemanticAnnotation() const final { return true; }
+    bool isPresentationMathML() const final { return true; }
+
+    bool childShouldCreateRenderer(const Node&amp;) const final;
+    void attributeChanged(const QualifiedName&amp;, const AtomicString&amp; oldValue, const AtomicString&amp; newValue, AttributeModificationReason) final;
+};
+
+}
+
+#endif // ENABLE(MATHML)
</ins></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/MathMLElement.cpp (204691 => 204692)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLElement.cpp        2016-08-21 10:55:31 UTC (rev 204691)
+++ trunk/Source/WebCore/mathml/MathMLElement.cpp        2016-08-21 12:18:43 UTC (rev 204692)
</span><span class="lines">@@ -279,43 +279,10 @@
</span><span class="cx"> 
</span><span class="cx"> bool MathMLElement::childShouldCreateRenderer(const Node&amp; child) const
</span><span class="cx"> {
</span><del>-    if (hasTagName(annotation_xmlTag)) {
-        auto&amp; value = attributeWithoutSynchronization(MathMLNames::encodingAttr);
-
-        // See annotation-xml.model.mathml, annotation-xml.model.svg and annotation-xml.model.xhtml in the HTML5 RelaxNG schema.
-
-        if (is&lt;MathMLElement&gt;(child) &amp;&amp; (MathMLSelectElement::isMathMLEncoding(value) || MathMLSelectElement::isHTMLEncoding(value))) {
-            auto&amp; mathmlElement = downcast&lt;MathMLElement&gt;(child);
-            return is&lt;MathMLMathElement&gt;(mathmlElement);
-        }
-
-        if (is&lt;SVGElement&gt;(child) &amp;&amp; (MathMLSelectElement::isSVGEncoding(value) || MathMLSelectElement::isHTMLEncoding(value))) {
-            auto&amp; svgElement = downcast&lt;SVGElement&gt;(child);
-            return is&lt;SVGSVGElement&gt;(svgElement);
-        }
-
-        if (is&lt;HTMLElement&gt;(child) &amp;&amp; MathMLSelectElement::isHTMLEncoding(value)) {
-            auto&amp; htmlElement = downcast&lt;HTMLElement&gt;(child);
-            return is&lt;HTMLHtmlElement&gt;(htmlElement) || (isFlowContent(htmlElement) &amp;&amp; StyledElement::childShouldCreateRenderer(child));
-        }
-
-        return false;
-    }
-
</del><span class="cx">     // In general, only MathML children are allowed. Text nodes are only visible in token MathML elements.
</span><span class="cx">     return is&lt;MathMLElement&gt;(child);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MathMLElement::attributeChanged(const QualifiedName&amp; name, const AtomicString&amp; oldValue, const AtomicString&amp; newValue, AttributeModificationReason reason)
-{
-    if (isSemanticAnnotation() &amp;&amp; (name == MathMLNames::srcAttr || name == MathMLNames::encodingAttr)) {
-        auto* parent = parentElement();
-        if (is&lt;MathMLElement&gt;(parent) &amp;&amp; parent-&gt;hasTagName(semanticsTag))
-            downcast&lt;MathMLElement&gt;(*parent).updateSelectedChild();
-    }
-    StyledElement::attributeChanged(name, oldValue, newValue, reason);
-}
-
</del><span class="cx"> bool MathMLElement::willRespondToMouseClickEvents()
</span><span class="cx"> {
</span><span class="cx">     return isLink() || StyledElement::willRespondToMouseClickEvents();
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/MathMLElement.h (204691 => 204692)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLElement.h        2016-08-21 10:55:31 UTC (rev 204691)
+++ trunk/Source/WebCore/mathml/MathMLElement.h        2016-08-21 12:18:43 UTC (rev 204692)
</span><span class="lines">@@ -42,16 +42,8 @@
</span><span class="cx">     unsigned colSpan() const;
</span><span class="cx">     unsigned rowSpan() const;
</span><span class="cx"> 
</span><del>-    bool isMathMLToken() const
-    {
-        return hasTagName(MathMLNames::miTag) || hasTagName(MathMLNames::mnTag) || hasTagName(MathMLNames::moTag) || hasTagName(MathMLNames::msTag) || hasTagName(MathMLNames::mtextTag);
-    }
-
-    bool isSemanticAnnotation() const
-    {
-        return hasTagName(MathMLNames::annotationTag) || hasTagName(MathMLNames::annotation_xmlTag);
-    }
-
</del><ins>+    virtual bool isMathMLToken() const { return false; }
+    virtual bool isSemanticAnnotation() const { return false; }
</ins><span class="cx">     virtual bool isPresentationMathML() const;
</span><span class="cx"> 
</span><span class="cx">     bool hasTagName(const MathMLQualifiedName&amp; name) const { return hasLocalName(name.localName()); }
</span><span class="lines">@@ -96,12 +88,13 @@
</span><span class="cx">     virtual Optional&lt;bool&gt; specifiedDisplayStyle();
</span><span class="cx">     Optional&lt;MathVariant&gt; specifiedMathVariant();
</span><span class="cx"> 
</span><ins>+    virtual void updateSelectedChild() { }
+
</ins><span class="cx"> protected:
</span><span class="cx">     MathMLElement(const QualifiedName&amp; tagName, Document&amp;);
</span><span class="cx"> 
</span><span class="cx">     void parseAttribute(const QualifiedName&amp;, const AtomicString&amp;) override;
</span><span class="cx">     bool childShouldCreateRenderer(const Node&amp;) const override;
</span><del>-    void attributeChanged(const QualifiedName&amp;, const AtomicString&amp; oldValue, const AtomicString&amp; newValue, AttributeModificationReason) override;
</del><span class="cx"> 
</span><span class="cx">     bool isPresentationAttribute(const QualifiedName&amp;) const override;
</span><span class="cx">     void collectStyleForPresentationAttribute(const QualifiedName&amp;, const AtomicString&amp;, MutableStyleProperties&amp;) override;
</span><span class="lines">@@ -123,7 +116,6 @@
</span><span class="cx">     Optional&lt;MathVariant&gt; m_mathVariant;
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    virtual void updateSelectedChild() { }
</del><span class="cx">     static Length parseNumberAndUnit(const StringView&amp;);
</span><span class="cx">     static Length parseNamedSpace(const StringView&amp;);
</span><span class="cx">     static MathVariant parseMathVariantAttribute(const AtomicString&amp; attributeValue);
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLInlineContainerElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/MathMLInlineContainerElement.cpp (204691 => 204692)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLInlineContainerElement.cpp        2016-08-21 10:55:31 UTC (rev 204691)
+++ trunk/Source/WebCore/mathml/MathMLInlineContainerElement.cpp        2016-08-21 12:18:43 UTC (rev 204692)
</span><span class="lines">@@ -65,7 +65,7 @@
</span><span class="cx"> 
</span><span class="cx"> RenderPtr&lt;RenderElement&gt; MathMLInlineContainerElement::createElementRenderer(RenderStyle&amp;&amp; style, const RenderTreePosition&amp;)
</span><span class="cx"> {
</span><del>-    if (hasTagName(annotation_xmlTag) || hasTagName(merrorTag) || hasTagName(mphantomTag) || hasTagName(mrowTag) || hasTagName(mstyleTag))
</del><ins>+    if (hasTagName(merrorTag) || hasTagName(mphantomTag) || hasTagName(mrowTag) || hasTagName(mstyleTag))
</ins><span class="cx">         return createRenderer&lt;RenderMathMLRow&gt;(*this, WTFMove(style));
</span><span class="cx">     if (hasTagName(msqrtTag) || hasTagName(mrootTag))
</span><span class="cx">         return createRenderer&lt;RenderMathMLRoot&gt;(*this, WTFMove(style));
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLTextElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/MathMLTextElement.cpp (204691 => 204692)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLTextElement.cpp        2016-08-21 10:55:31 UTC (rev 204691)
+++ trunk/Source/WebCore/mathml/MathMLTextElement.cpp        2016-08-21 12:18:43 UTC (rev 204692)
</span><span class="lines">@@ -73,11 +73,8 @@
</span><span class="cx">     MathMLElement::parseAttribute(name, value);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RenderPtr&lt;RenderElement&gt; MathMLTextElement::createElementRenderer(RenderStyle&amp;&amp; style, const RenderTreePosition&amp; insertionPosition)
</del><ins>+RenderPtr&lt;RenderElement&gt; MathMLTextElement::createElementRenderer(RenderStyle&amp;&amp; style, const RenderTreePosition&amp;)
</ins><span class="cx"> {
</span><del>-    if (hasTagName(MathMLNames::annotationTag))
-        return MathMLElement::createElementRenderer(WTFMove(style), insertionPosition);
-
</del><span class="cx">     ASSERT(hasTagName(MathMLNames::miTag) || hasTagName(MathMLNames::mnTag) || hasTagName(MathMLNames::msTag) || hasTagName(MathMLNames::mtextTag));
</span><span class="cx"> 
</span><span class="cx">     return createRenderer&lt;RenderMathMLToken&gt;(*this, WTFMove(style));
</span><span class="lines">@@ -88,9 +85,6 @@
</span><span class="cx">     if (hasTagName(MathMLNames::mspaceTag))
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    if (hasTagName(MathMLNames::annotationTag))
-        return child.isTextNode();
-
</del><span class="cx">     // The HTML specification defines &lt;mi&gt;, &lt;mo&gt;, &lt;mn&gt;, &lt;ms&gt; and &lt;mtext&gt; as insertion points.
</span><span class="cx">     return isPhrasingContent(child) &amp;&amp; StyledElement::childShouldCreateRenderer(child);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLTextElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/MathMLTextElement.h (204691 => 204692)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLTextElement.h        2016-08-21 10:55:31 UTC (rev 204691)
+++ trunk/Source/WebCore/mathml/MathMLTextElement.h        2016-08-21 12:18:43 UTC (rev 204692)
</span><span class="lines">@@ -48,6 +48,7 @@
</span><span class="cx"> 
</span><span class="cx">     void didAttachRenderers() final;
</span><span class="cx"> 
</span><ins>+    bool isMathMLToken() const final { return true; }
</ins><span class="cx">     bool isPresentationMathML() const final { return true; }
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlmathtagsin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/mathtags.in (204691 => 204692)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/mathtags.in        2016-08-21 10:55:31 UTC (rev 204691)
+++ trunk/Source/WebCore/mathml/mathtags.in        2016-08-21 12:18:43 UTC (rev 204692)
</span><span class="lines">@@ -3,8 +3,8 @@
</span><span class="cx"> guardFactoryWith=&quot;ENABLE(MATHML)&quot;
</span><span class="cx"> fallbackInterfaceName=&quot;MathMLElement&quot;
</span><span class="cx"> 
</span><del>-annotation interfaceName=MathMLTextElement
-annotation-xml interfaceName=MathMLInlineContainerElement
</del><ins>+annotation interfaceName=MathMLAnnotationElement
+annotation-xml interfaceName=MathMLAnnotationElement
</ins><span class="cx"> maction interfaceName=MathMLSelectElement
</span><span class="cx"> math
</span><span class="cx"> mfrac interfaceName=MathMLFractionElement
</span></span></pre>
</div>
</div>

</body>
</html>