<!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>[177910] 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/177910">177910</a></dd>
<dt>Author</dt> <dd>darin@apple.com</dd>
<dt>Date</dt> <dd>2015-01-05 09:11:40 -0800 (Mon, 05 Jan 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Modernize and streamline HTMLStackItem
https://bugs.webkit.org/show_bug.cgi?id=140056

Reviewed by Anders Carlsson.

* html/HTMLHtmlElement.cpp:
(WebCore::HTMLHtmlElement::create): Changed to return Ref.
* html/HTMLHtmlElement.h: Ditto.

* html/parser/HTMLConstructionSite.cpp:
(WebCore::hasImpliedEndTag): Update to use reference instead of pointer.
(WebCore::causesFosterParenting): Moved here from HTMLStackItem.h.
(WebCore::HTMLConstructionSite::insertHTMLHtmlStartTagBeforeHTML): Update
for references instead of pointers.
(WebCore::HTMLConstructionSite::insertHTMLHtmlStartTagInBody): Ditto.
(WebCore::HTMLConstructionSite::insertHTMLBodyStartTagInBody): Ditto.
(WebCore::HTMLConstructionSite::insertComment): Ditto.
(WebCore::HTMLConstructionSite::insertCommentOnHTMLHtmlElement): Ditto.
(WebCore::HTMLConstructionSite::insertHTMLHeadElement): Ditto.
(WebCore::HTMLConstructionSite::insertHTMLBodyElement): Ditto.
(WebCore::HTMLConstructionSite::insertHTMLFormElement): Ditto.
(WebCore::HTMLConstructionSite::insertHTMLElement): Ditto.
(WebCore::HTMLConstructionSite::insertSelfClosingHTMLElement): Ditto.
(WebCore::HTMLConstructionSite::insertFormattingElement): Ditto.
(WebCore::HTMLConstructionSite::insertScriptElement): Ditto.
(WebCore::HTMLConstructionSite::insertForeignElement): Ditto.
(WebCore::HTMLConstructionSite::insertTextNode): Ditto.
(WebCore::HTMLConstructionSite::reparent): Ditto.
(WebCore::HTMLConstructionSite::insertAlreadyParsedChild): Ditto.
(WebCore::HTMLConstructionSite::takeAllChildren): Ditto.
(WebCore::HTMLConstructionSite::ownerDocumentForCurrentNode): Ditto.
(WebCore::HTMLConstructionSite::createElementFromSavedToken): Ditto.
(WebCore::HTMLConstructionSite::indexOfFirstUnopenFormattingElement): Ditto.
(WebCore::HTMLConstructionSite::reconstructTheActiveFormattingElements): Ditto.
(WebCore::HTMLConstructionSite::generateImpliedEndTagsWithExclusion): Ditto.
(WebCore::HTMLConstructionSite::findFosterSite): Ditto.
(WebCore::HTMLConstructionSite::shouldFosterParent): Removed unneeded
isElementNode check, since causesFosterParenting will return false for a
document fragment node.

* html/parser/HTMLConstructionSite.h: Updated to use references instead of
pointers. Also removed the unneeded currentElementRecord function.

* html/parser/HTMLElementStack.cpp:
(WebCore::HTMLNames::isRootNode): Updated to use references instead of pointers.
(WebCore::HTMLNames::isScopeMarker): Ditto.
(WebCore::HTMLNames::isListItemScopeMarker): Ditto.
(WebCore::HTMLNames::isTableScopeMarker): Ditto.
(WebCore::HTMLNames::isTableBodyScopeMarker): Ditto.
(WebCore::HTMLNames::isTableRowScopeMarker): Ditto.
(WebCore::HTMLNames::isForeignContentScopeMarker): Ditto.
(WebCore::HTMLNames::isButtonScopeMarker): Ditto.
(WebCore::HTMLNames::isSelectScopeMarker): Ditto.
(WebCore::HTMLElementStack::ElementRecord::replaceElement): Ditto.
(WebCore::HTMLElementStack::hasOnlyOneElement): Ditto.
(WebCore::HTMLElementStack::popHTMLHeadElement): Ditto.
(WebCore::HTMLElementStack::popHTMLBodyElement): Ditto.
(WebCore::HTMLElementStack::popAll): Ditto.
(WebCore::HTMLElementStack::pop): Ditto.
(WebCore::HTMLElementStack::popUntil): Ditto.
(WebCore::HTMLElementStack::popUntilNumberedHeaderElementPopped): Ditto.
(WebCore::HTMLElementStack::isMathMLTextIntegrationPoint): Ditto. Also removed
unneeded isElementNode check.
(WebCore::HTMLElementStack::isHTMLIntegrationPoint): Ditto.
(WebCore::HTMLElementStack::pushRootNode): Ditto.
(WebCore::HTMLElementStack::pushRootNodeCommon): Ditto.
(WebCore::HTMLElementStack::pushHTMLHeadElement): Ditto.
(WebCore::HTMLElementStack::pushHTMLBodyElement): Ditto.
(WebCore::HTMLElementStack::insertAbove): Ditto.
(WebCore::HTMLElementStack::topRecord): Ditto.
(WebCore::HTMLElementStack::oneBelowTop): Ditto.
(WebCore::HTMLElementStack::removeHTMLHeadElement): Ditto.
(WebCore::HTMLElementStack::remove): Ditto.
(WebCore::HTMLElementStack::find): Ditto.
(WebCore::HTMLElementStack::topmost): Ditto.
(WebCore::inScopeCommon): Ditto.
(WebCore::HTMLElementStack::hasNumberedHeaderElementInScope): Ditto.
(WebCore::HTMLElementStack::inScope): Ditto.
(WebCore::HTMLElementStack::htmlElement): Ditto.
(WebCore::HTMLElementStack::headElement): Ditto.
(WebCore::HTMLElementStack::bodyElement): Ditto.
(WebCore::HTMLElementStack::rootNode): Ditto.
(WebCore::HTMLElementStack::popCommon): Ditto.
(WebCore::HTMLElementStack::removeNonTopCommon): Ditto.
(WebCore::HTMLElementStack::furthestBlockForFormattingElement): Ditto.
(WebCore::HTMLElementStack::show): Ditto.

* html/parser/HTMLElementStack.h: Use reference instead of pointer.

* html/parser/HTMLFormattingElementList.cpp:
(WebCore::HTMLFormattingElementList::closestElementInScopeWithName): Update
to use references instead of pointer.
(WebCore::HTMLFormattingElementList::swapTo): Ditto.
(WebCore::HTMLFormattingElementList::tryToEnsureNoahsArkConditionQuickly): Ditto.
(WebCore::HTMLFormattingElementList::ensureNoahsArkCondition): Ditto.
(WebCore::HTMLFormattingElementList::show): Ditto.

* html/parser/HTMLFormattingElementList.h: Use reference instead of pointer
and a raw pointer instead of a RefPtr.

* html/parser/HTMLStackItem.h: Removed unneeded includes. Got rid of &quot;type&quot;
concept and simply overload the create functions and constructors for both
Element and DOcumentFragment. Renamed isElementNode and isDocumentFragmentNode
to remove the &quot;Node&quot; suffix. Removed unused getAttributeItem, hasLocalName, and
one of the overloads of matchesHTMLTag. Moved all the policy functions such as
causesFosterParenting out of this class into free functions or into other
source files. Got rid of m_isDocumentFragmentNode boolean. Moved function
bodies out of the class definition. Marked all data members const since they
are all initialized in the constructor and never touched again. Restructured
the isSpecialNode function to avoid the repeated checks of the namespace.

* html/parser/HTMLTreeBuilder.cpp:
(WebCore::HTMLTreeBuilder::isParsingTemplateContents): Use reference instead of
pointer and free functions instead of member functions.
(WebCore::HTMLTreeBuilder::HTMLTreeBuilder): Ditto.
(WebCore::HTMLTreeBuilder::FragmentParsingContext::FragmentParsingContext): Ditto.
(WebCore::HTMLTreeBuilder::FragmentParsingContext::contextElement): Ditto.
(WebCore::HTMLTreeBuilder::constructTree): Ditto.
(WebCore::HTMLTreeBuilder::processFakePEndTagIfPInButtonScope): Ditto.
(WebCore::HTMLTreeBuilder::processCloseWhenNestedTag): Ditto.
(WebCore::HTMLTreeBuilder::processStartTagForInBody): Ditto.
(WebCore::HTMLTreeBuilder::processTemplateStartTag): Ditto.
(WebCore::HTMLTreeBuilder::processTemplateEndTag): Ditto.
(WebCore::HTMLTreeBuilder::processColgroupEndTagForInColumnGroup): Ditto.
(WebCore::HTMLTreeBuilder::closeTheCell): Ditto.
(WebCore::HTMLTreeBuilder::processStartTagForInTable): Ditto.
(WebCore::HTMLTreeBuilder::processStartTag): Ditto.
(WebCore::HTMLTreeBuilder::processHtmlStartTagForInBody): Ditto.
(WebCore::HTMLTreeBuilder::processBodyEndTagForInBody): Ditto.
(WebCore::HTMLTreeBuilder::processAnyOtherEndTagForInBody): Ditto.
(WebCore::HTMLTreeBuilder::callTheAdoptionAgency): Ditto.
(WebCore::HTMLTreeBuilder::resetInsertionModeAppropriately): Ditto.
(WebCore::HTMLTreeBuilder::processEndTagForInTableBody): Ditto.
(WebCore::HTMLTreeBuilder::processEndTagForInRow): Ditto.
(WebCore::HTMLTreeBuilder::processEndTagForInCell): Ditto.
(WebCore::HTMLTreeBuilder::processEndTagForInBody): Ditto.
(WebCore::HTMLTreeBuilder::processCaptionEndTagForInCaption): Ditto.
(WebCore::HTMLTreeBuilder::processTrEndTagForInRow): Ditto.
(WebCore::HTMLTreeBuilder::processTableEndTagForInTable): Ditto.
(WebCore::HTMLTreeBuilder::processEndTag): Ditto.
(WebCore::HTMLTreeBuilder::processCharacterBuffer): Ditto.
(WebCore::HTMLTreeBuilder::processEndOfFile): Ditto.
(WebCore::HTMLTreeBuilder::adjustedCurrentStackItem): Ditto.
(WebCore::HTMLTreeBuilder::shouldProcessTokenInForeignContent): Ditto.
(WebCore::HTMLTreeBuilder::processTokenInForeignContent): Ditto.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLHtmlElementcpp">trunk/Source/WebCore/html/HTMLHtmlElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLHtmlElementh">trunk/Source/WebCore/html/HTMLHtmlElement.h</a></li>
<li><a href="#trunkSourceWebCorehtmlparserHTMLConstructionSitecpp">trunk/Source/WebCore/html/parser/HTMLConstructionSite.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlparserHTMLConstructionSiteh">trunk/Source/WebCore/html/parser/HTMLConstructionSite.h</a></li>
<li><a href="#trunkSourceWebCorehtmlparserHTMLElementStackcpp">trunk/Source/WebCore/html/parser/HTMLElementStack.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlparserHTMLElementStackh">trunk/Source/WebCore/html/parser/HTMLElementStack.h</a></li>
<li><a href="#trunkSourceWebCorehtmlparserHTMLFormattingElementListcpp">trunk/Source/WebCore/html/parser/HTMLFormattingElementList.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlparserHTMLFormattingElementListh">trunk/Source/WebCore/html/parser/HTMLFormattingElementList.h</a></li>
<li><a href="#trunkSourceWebCorehtmlparserHTMLStackItemh">trunk/Source/WebCore/html/parser/HTMLStackItem.h</a></li>
<li><a href="#trunkSourceWebCorehtmlparserHTMLTreeBuildercpp">trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (177909 => 177910)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-01-05 15:05:46 UTC (rev 177909)
+++ trunk/Source/WebCore/ChangeLog        2015-01-05 17:11:40 UTC (rev 177910)
</span><span class="lines">@@ -1,3 +1,151 @@
</span><ins>+2015-01-05  Darin Adler  &lt;darin@apple.com&gt;
+
+        Modernize and streamline HTMLStackItem
+        https://bugs.webkit.org/show_bug.cgi?id=140056
+
+        Reviewed by Anders Carlsson.
+
+        * html/HTMLHtmlElement.cpp:
+        (WebCore::HTMLHtmlElement::create): Changed to return Ref.
+        * html/HTMLHtmlElement.h: Ditto.
+
+        * html/parser/HTMLConstructionSite.cpp:
+        (WebCore::hasImpliedEndTag): Update to use reference instead of pointer.
+        (WebCore::causesFosterParenting): Moved here from HTMLStackItem.h.
+        (WebCore::HTMLConstructionSite::insertHTMLHtmlStartTagBeforeHTML): Update
+        for references instead of pointers.
+        (WebCore::HTMLConstructionSite::insertHTMLHtmlStartTagInBody): Ditto.
+        (WebCore::HTMLConstructionSite::insertHTMLBodyStartTagInBody): Ditto.
+        (WebCore::HTMLConstructionSite::insertComment): Ditto.
+        (WebCore::HTMLConstructionSite::insertCommentOnHTMLHtmlElement): Ditto.
+        (WebCore::HTMLConstructionSite::insertHTMLHeadElement): Ditto.
+        (WebCore::HTMLConstructionSite::insertHTMLBodyElement): Ditto.
+        (WebCore::HTMLConstructionSite::insertHTMLFormElement): Ditto.
+        (WebCore::HTMLConstructionSite::insertHTMLElement): Ditto.
+        (WebCore::HTMLConstructionSite::insertSelfClosingHTMLElement): Ditto.
+        (WebCore::HTMLConstructionSite::insertFormattingElement): Ditto.
+        (WebCore::HTMLConstructionSite::insertScriptElement): Ditto.
+        (WebCore::HTMLConstructionSite::insertForeignElement): Ditto.
+        (WebCore::HTMLConstructionSite::insertTextNode): Ditto.
+        (WebCore::HTMLConstructionSite::reparent): Ditto.
+        (WebCore::HTMLConstructionSite::insertAlreadyParsedChild): Ditto.
+        (WebCore::HTMLConstructionSite::takeAllChildren): Ditto.
+        (WebCore::HTMLConstructionSite::ownerDocumentForCurrentNode): Ditto.
+        (WebCore::HTMLConstructionSite::createElementFromSavedToken): Ditto.
+        (WebCore::HTMLConstructionSite::indexOfFirstUnopenFormattingElement): Ditto.
+        (WebCore::HTMLConstructionSite::reconstructTheActiveFormattingElements): Ditto.
+        (WebCore::HTMLConstructionSite::generateImpliedEndTagsWithExclusion): Ditto.
+        (WebCore::HTMLConstructionSite::findFosterSite): Ditto.
+        (WebCore::HTMLConstructionSite::shouldFosterParent): Removed unneeded
+        isElementNode check, since causesFosterParenting will return false for a
+        document fragment node.
+
+        * html/parser/HTMLConstructionSite.h: Updated to use references instead of
+        pointers. Also removed the unneeded currentElementRecord function.
+
+        * html/parser/HTMLElementStack.cpp:
+        (WebCore::HTMLNames::isRootNode): Updated to use references instead of pointers.
+        (WebCore::HTMLNames::isScopeMarker): Ditto.
+        (WebCore::HTMLNames::isListItemScopeMarker): Ditto.
+        (WebCore::HTMLNames::isTableScopeMarker): Ditto.
+        (WebCore::HTMLNames::isTableBodyScopeMarker): Ditto.
+        (WebCore::HTMLNames::isTableRowScopeMarker): Ditto.
+        (WebCore::HTMLNames::isForeignContentScopeMarker): Ditto.
+        (WebCore::HTMLNames::isButtonScopeMarker): Ditto.
+        (WebCore::HTMLNames::isSelectScopeMarker): Ditto.
+        (WebCore::HTMLElementStack::ElementRecord::replaceElement): Ditto.
+        (WebCore::HTMLElementStack::hasOnlyOneElement): Ditto.
+        (WebCore::HTMLElementStack::popHTMLHeadElement): Ditto.
+        (WebCore::HTMLElementStack::popHTMLBodyElement): Ditto.
+        (WebCore::HTMLElementStack::popAll): Ditto.
+        (WebCore::HTMLElementStack::pop): Ditto.
+        (WebCore::HTMLElementStack::popUntil): Ditto.
+        (WebCore::HTMLElementStack::popUntilNumberedHeaderElementPopped): Ditto.
+        (WebCore::HTMLElementStack::isMathMLTextIntegrationPoint): Ditto. Also removed
+        unneeded isElementNode check.
+        (WebCore::HTMLElementStack::isHTMLIntegrationPoint): Ditto.
+        (WebCore::HTMLElementStack::pushRootNode): Ditto.
+        (WebCore::HTMLElementStack::pushRootNodeCommon): Ditto.
+        (WebCore::HTMLElementStack::pushHTMLHeadElement): Ditto.
+        (WebCore::HTMLElementStack::pushHTMLBodyElement): Ditto.
+        (WebCore::HTMLElementStack::insertAbove): Ditto.
+        (WebCore::HTMLElementStack::topRecord): Ditto.
+        (WebCore::HTMLElementStack::oneBelowTop): Ditto.
+        (WebCore::HTMLElementStack::removeHTMLHeadElement): Ditto.
+        (WebCore::HTMLElementStack::remove): Ditto.
+        (WebCore::HTMLElementStack::find): Ditto.
+        (WebCore::HTMLElementStack::topmost): Ditto.
+        (WebCore::inScopeCommon): Ditto.
+        (WebCore::HTMLElementStack::hasNumberedHeaderElementInScope): Ditto.
+        (WebCore::HTMLElementStack::inScope): Ditto.
+        (WebCore::HTMLElementStack::htmlElement): Ditto.
+        (WebCore::HTMLElementStack::headElement): Ditto.
+        (WebCore::HTMLElementStack::bodyElement): Ditto.
+        (WebCore::HTMLElementStack::rootNode): Ditto.
+        (WebCore::HTMLElementStack::popCommon): Ditto.
+        (WebCore::HTMLElementStack::removeNonTopCommon): Ditto.
+        (WebCore::HTMLElementStack::furthestBlockForFormattingElement): Ditto.
+        (WebCore::HTMLElementStack::show): Ditto.
+
+        * html/parser/HTMLElementStack.h: Use reference instead of pointer.
+
+        * html/parser/HTMLFormattingElementList.cpp:
+        (WebCore::HTMLFormattingElementList::closestElementInScopeWithName): Update
+        to use references instead of pointer.
+        (WebCore::HTMLFormattingElementList::swapTo): Ditto.
+        (WebCore::HTMLFormattingElementList::tryToEnsureNoahsArkConditionQuickly): Ditto.
+        (WebCore::HTMLFormattingElementList::ensureNoahsArkCondition): Ditto.
+        (WebCore::HTMLFormattingElementList::show): Ditto.
+
+        * html/parser/HTMLFormattingElementList.h: Use reference instead of pointer
+        and a raw pointer instead of a RefPtr.
+
+        * html/parser/HTMLStackItem.h: Removed unneeded includes. Got rid of &quot;type&quot;
+        concept and simply overload the create functions and constructors for both
+        Element and DOcumentFragment. Renamed isElementNode and isDocumentFragmentNode
+        to remove the &quot;Node&quot; suffix. Removed unused getAttributeItem, hasLocalName, and
+        one of the overloads of matchesHTMLTag. Moved all the policy functions such as
+        causesFosterParenting out of this class into free functions or into other
+        source files. Got rid of m_isDocumentFragmentNode boolean. Moved function
+        bodies out of the class definition. Marked all data members const since they
+        are all initialized in the constructor and never touched again. Restructured
+        the isSpecialNode function to avoid the repeated checks of the namespace.
+
+        * html/parser/HTMLTreeBuilder.cpp:
+        (WebCore::HTMLTreeBuilder::isParsingTemplateContents): Use reference instead of
+        pointer and free functions instead of member functions.
+        (WebCore::HTMLTreeBuilder::HTMLTreeBuilder): Ditto.
+        (WebCore::HTMLTreeBuilder::FragmentParsingContext::FragmentParsingContext): Ditto.
+        (WebCore::HTMLTreeBuilder::FragmentParsingContext::contextElement): Ditto.
+        (WebCore::HTMLTreeBuilder::constructTree): Ditto.
+        (WebCore::HTMLTreeBuilder::processFakePEndTagIfPInButtonScope): Ditto.
+        (WebCore::HTMLTreeBuilder::processCloseWhenNestedTag): Ditto.
+        (WebCore::HTMLTreeBuilder::processStartTagForInBody): Ditto.
+        (WebCore::HTMLTreeBuilder::processTemplateStartTag): Ditto.
+        (WebCore::HTMLTreeBuilder::processTemplateEndTag): Ditto.
+        (WebCore::HTMLTreeBuilder::processColgroupEndTagForInColumnGroup): Ditto.
+        (WebCore::HTMLTreeBuilder::closeTheCell): Ditto.
+        (WebCore::HTMLTreeBuilder::processStartTagForInTable): Ditto.
+        (WebCore::HTMLTreeBuilder::processStartTag): Ditto.
+        (WebCore::HTMLTreeBuilder::processHtmlStartTagForInBody): Ditto.
+        (WebCore::HTMLTreeBuilder::processBodyEndTagForInBody): Ditto.
+        (WebCore::HTMLTreeBuilder::processAnyOtherEndTagForInBody): Ditto.
+        (WebCore::HTMLTreeBuilder::callTheAdoptionAgency): Ditto.
+        (WebCore::HTMLTreeBuilder::resetInsertionModeAppropriately): Ditto.
+        (WebCore::HTMLTreeBuilder::processEndTagForInTableBody): Ditto.
+        (WebCore::HTMLTreeBuilder::processEndTagForInRow): Ditto.
+        (WebCore::HTMLTreeBuilder::processEndTagForInCell): Ditto.
+        (WebCore::HTMLTreeBuilder::processEndTagForInBody): Ditto.
+        (WebCore::HTMLTreeBuilder::processCaptionEndTagForInCaption): Ditto.
+        (WebCore::HTMLTreeBuilder::processTrEndTagForInRow): Ditto.
+        (WebCore::HTMLTreeBuilder::processTableEndTagForInTable): Ditto.
+        (WebCore::HTMLTreeBuilder::processEndTag): Ditto.
+        (WebCore::HTMLTreeBuilder::processCharacterBuffer): Ditto.
+        (WebCore::HTMLTreeBuilder::processEndOfFile): Ditto.
+        (WebCore::HTMLTreeBuilder::adjustedCurrentStackItem): Ditto.
+        (WebCore::HTMLTreeBuilder::shouldProcessTokenInForeignContent): Ditto.
+        (WebCore::HTMLTreeBuilder::processTokenInForeignContent): Ditto.
+
</ins><span class="cx"> 2015-01-05  peavo@outlook.com  &lt;peavo@outlook.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [WinCairo] Crash when font data pointer is null.
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLHtmlElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLHtmlElement.cpp (177909 => 177910)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLHtmlElement.cpp        2015-01-05 15:05:46 UTC (rev 177909)
+++ trunk/Source/WebCore/html/HTMLHtmlElement.cpp        2015-01-05 17:11:40 UTC (rev 177910)
</span><span class="lines">@@ -42,14 +42,14 @@
</span><span class="cx">     ASSERT(hasTagName(htmlTag));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr&lt;HTMLHtmlElement&gt; HTMLHtmlElement::create(Document&amp; document)
</del><ins>+Ref&lt;HTMLHtmlElement&gt; HTMLHtmlElement::create(Document&amp; document)
</ins><span class="cx"> {
</span><del>-    return adoptRef(new HTMLHtmlElement(htmlTag, document));
</del><ins>+    return adoptRef(*new HTMLHtmlElement(htmlTag, document));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr&lt;HTMLHtmlElement&gt; HTMLHtmlElement::create(const QualifiedName&amp; tagName, Document&amp; document)
</del><ins>+Ref&lt;HTMLHtmlElement&gt; HTMLHtmlElement::create(const QualifiedName&amp; tagName, Document&amp; document)
</ins><span class="cx"> {
</span><del>-    return adoptRef(new HTMLHtmlElement(tagName, document));
</del><ins>+    return adoptRef(*new HTMLHtmlElement(tagName, document));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool HTMLHtmlElement::isURLAttribute(const Attribute&amp; attribute) const
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLHtmlElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLHtmlElement.h (177909 => 177910)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLHtmlElement.h        2015-01-05 15:05:46 UTC (rev 177909)
+++ trunk/Source/WebCore/html/HTMLHtmlElement.h        2015-01-05 17:11:40 UTC (rev 177910)
</span><span class="lines">@@ -30,8 +30,8 @@
</span><span class="cx"> 
</span><span class="cx"> class HTMLHtmlElement final : public HTMLElement {
</span><span class="cx"> public:
</span><del>-    static RefPtr&lt;HTMLHtmlElement&gt; create(Document&amp;);
-    static RefPtr&lt;HTMLHtmlElement&gt; create(const QualifiedName&amp;, Document&amp;);
</del><ins>+    static Ref&lt;HTMLHtmlElement&gt; create(Document&amp;);
+    static Ref&lt;HTMLHtmlElement&gt; create(const QualifiedName&amp;, Document&amp;);
</ins><span class="cx"> 
</span><span class="cx">     void insertedByParser();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlparserHTMLConstructionSitecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/parser/HTMLConstructionSite.cpp (177909 => 177910)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/parser/HTMLConstructionSite.cpp        2015-01-05 15:05:46 UTC (rev 177909)
+++ trunk/Source/WebCore/html/parser/HTMLConstructionSite.cpp        2015-01-05 17:11:40 UTC (rev 177910)
</span><span class="lines">@@ -56,18 +56,18 @@
</span><span class="cx">     element-&gt;parserSetAttributes(token-&gt;attributes());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool hasImpliedEndTag(const HTMLStackItem* item)
</del><ins>+static bool hasImpliedEndTag(const HTMLStackItem&amp; item)
</ins><span class="cx"> {
</span><del>-    return item-&gt;hasTagName(ddTag)
-        || item-&gt;hasTagName(dtTag)
-        || item-&gt;hasTagName(liTag)
-        || is&lt;HTMLOptionElement&gt;(*item-&gt;node())
-        || is&lt;HTMLOptGroupElement&gt;(*item-&gt;node())
-        || item-&gt;hasTagName(pTag)
-        || item-&gt;hasTagName(rbTag)
-        || item-&gt;hasTagName(rpTag)
-        || item-&gt;hasTagName(rtTag)
-        || item-&gt;hasTagName(rtcTag);
</del><ins>+    return item.hasTagName(ddTag)
+        || item.hasTagName(dtTag)
+        || item.hasTagName(liTag)
+        || is&lt;HTMLOptionElement&gt;(item.node())
+        || is&lt;HTMLOptGroupElement&gt;(item.node())
+        || item.hasTagName(pTag)
+        || item.hasTagName(rbTag)
+        || item.hasTagName(rpTag)
+        || item.hasTagName(rtTag)
+        || item.hasTagName(rtcTag);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static bool shouldUseLengthLimit(const ContainerNode* node)
</span><span class="lines">@@ -77,6 +77,15 @@
</span><span class="cx">         &amp;&amp; !node-&gt;hasTagName(SVGNames::scriptTag);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static inline bool causesFosterParenting(const HTMLStackItem&amp; item)
+{
+    return item.hasTagName(HTMLNames::tableTag)
+        || item.hasTagName(HTMLNames::tbodyTag)
+        || item.hasTagName(HTMLNames::tfootTag)
+        || item.hasTagName(HTMLNames::theadTag)
+        || item.hasTagName(HTMLNames::trTag);
+}
+
</ins><span class="cx"> static inline bool isAllWhitespace(const String&amp; string)
</span><span class="cx"> {
</span><span class="cx">     return string.isAllSpecialCharacters&lt;isHTMLSpace&gt;();
</span><span class="lines">@@ -250,10 +259,10 @@
</span><span class="cx"> 
</span><span class="cx"> void HTMLConstructionSite::insertHTMLHtmlStartTagBeforeHTML(AtomicHTMLToken* token)
</span><span class="cx"> {
</span><del>-    RefPtr&lt;HTMLHtmlElement&gt; element = HTMLHtmlElement::create(*m_document);
-    setAttributes(element.get(), token, m_parserContentPolicy);
-    attachLater(m_attachmentRoot, element);
-    m_openElements.pushHTMLHtmlElement(HTMLStackItem::create(element, token));
</del><ins>+    Ref&lt;HTMLHtmlElement&gt; element = HTMLHtmlElement::create(*m_document);
+    setAttributes(element.ptr(), token, m_parserContentPolicy);
+    attachLater(m_attachmentRoot, element.ptr());
+    m_openElements.pushHTMLHtmlElement(HTMLStackItem::create(element.copyRef(), *token));
</ins><span class="cx"> 
</span><span class="cx">     executeQueuedTasks();
</span><span class="cx">     element-&gt;insertedByParser();
</span><span class="lines">@@ -279,12 +288,12 @@
</span><span class="cx">     if (m_isParsingFragment)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    mergeAttributesFromTokenIntoElement(token, m_openElements.htmlElement());
</del><ins>+    mergeAttributesFromTokenIntoElement(token, &amp;m_openElements.htmlElement());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLConstructionSite::insertHTMLBodyStartTagInBody(AtomicHTMLToken* token)
</span><span class="cx"> {
</span><del>-    mergeAttributesFromTokenIntoElement(token, m_openElements.bodyElement());
</del><ins>+    mergeAttributesFromTokenIntoElement(token, &amp;m_openElements.bodyElement());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLConstructionSite::setDefaultCompatibilityMode()
</span><span class="lines">@@ -423,7 +432,7 @@
</span><span class="cx"> void HTMLConstructionSite::insertComment(AtomicHTMLToken* token)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(token-&gt;type() == HTMLToken::Comment);
</span><del>-    attachLater(currentNode(), Comment::create(ownerDocumentForCurrentNode(), token-&gt;comment()));
</del><ins>+    attachLater(&amp;currentNode(), Comment::create(ownerDocumentForCurrentNode(), token-&gt;comment()));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLConstructionSite::insertCommentOnDocument(AtomicHTMLToken* token)
</span><span class="lines">@@ -435,15 +444,15 @@
</span><span class="cx"> void HTMLConstructionSite::insertCommentOnHTMLHtmlElement(AtomicHTMLToken* token)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(token-&gt;type() == HTMLToken::Comment);
</span><del>-    ContainerNode* parent = m_openElements.rootNode();
-    attachLater(parent, Comment::create(parent-&gt;document(), token-&gt;comment()));
</del><ins>+    ContainerNode&amp; parent = m_openElements.rootNode();
+    attachLater(&amp;parent, Comment::create(parent.document(), token-&gt;comment()));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLConstructionSite::insertHTMLHeadElement(AtomicHTMLToken* token)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!shouldFosterParent());
</span><del>-    m_head = HTMLStackItem::create(createHTMLElement(token), token);
-    attachLater(currentNode(), m_head-&gt;element());
</del><ins>+    m_head = HTMLStackItem::create(*createHTMLElement(token), *token);
+    attachLater(&amp;currentNode(), &amp;m_head-&gt;element());
</ins><span class="cx">     m_openElements.pushHTMLHeadElement(m_head);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -451,8 +460,8 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!shouldFosterParent());
</span><span class="cx">     RefPtr&lt;Element&gt; body = createHTMLElement(token);
</span><del>-    attachLater(currentNode(), body);
-    m_openElements.pushHTMLBodyElement(HTMLStackItem::create(body.release(), token));
</del><ins>+    attachLater(&amp;currentNode(), body.get());
+    m_openElements.pushHTMLBodyElement(HTMLStackItem::create(body.releaseNonNull(), *token));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLConstructionSite::insertHTMLFormElement(AtomicHTMLToken* token, bool isDemoted)
</span><span class="lines">@@ -461,15 +470,15 @@
</span><span class="cx">     ASSERT(is&lt;HTMLFormElement&gt;(*element));
</span><span class="cx">     m_form = static_pointer_cast&lt;HTMLFormElement&gt;(element.release());
</span><span class="cx">     m_form-&gt;setDemoted(isDemoted);
</span><del>-    attachLater(currentNode(), m_form);
-    m_openElements.push(HTMLStackItem::create(m_form, token));
</del><ins>+    attachLater(&amp;currentNode(), m_form);
+    m_openElements.push(HTMLStackItem::create(*m_form, *token));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLConstructionSite::insertHTMLElement(AtomicHTMLToken* token)
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;Element&gt; element = createHTMLElement(token);
</span><del>-    attachLater(currentNode(), element);
-    m_openElements.push(HTMLStackItem::create(element.release(), token));
</del><ins>+    attachLater(&amp;currentNode(), element);
+    m_openElements.push(HTMLStackItem::create(element.releaseNonNull(), *token));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLConstructionSite::insertSelfClosingHTMLElement(AtomicHTMLToken* token)
</span><span class="lines">@@ -478,7 +487,7 @@
</span><span class="cx">     // Normally HTMLElementStack is responsible for calling finishParsingChildren,
</span><span class="cx">     // but self-closing elements are never in the element stack so the stack
</span><span class="cx">     // doesn't get a chance to tell them that we're done parsing their children.
</span><del>-    attachLater(currentNode(), createHTMLElement(token), true);
</del><ins>+    attachLater(&amp;currentNode(), createHTMLElement(token), true);
</ins><span class="cx">     // FIXME: Do we want to acknowledge the token's self-closing flag?
</span><span class="cx">     // http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#acknowledge-self-closing-flag
</span><span class="cx"> }
</span><span class="lines">@@ -489,7 +498,7 @@
</span><span class="cx">     // Possible active formatting elements include:
</span><span class="cx">     // a, b, big, code, em, font, i, nobr, s, small, strike, strong, tt, and u.
</span><span class="cx">     insertHTMLElement(token);
</span><del>-    m_activeFormattingElements.append(currentElementRecord()-&gt;stackItem());
</del><ins>+    m_activeFormattingElements.append(&amp;currentStackItem());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLConstructionSite::insertScriptElement(AtomicHTMLToken* token)
</span><span class="lines">@@ -504,8 +513,8 @@
</span><span class="cx">     RefPtr&lt;HTMLScriptElement&gt; element = HTMLScriptElement::create(scriptTag, ownerDocumentForCurrentNode(), parserInserted, alreadyStarted);
</span><span class="cx">     setAttributes(element.get(), token, m_parserContentPolicy);
</span><span class="cx">     if (scriptingContentIsAllowed(m_parserContentPolicy))
</span><del>-        attachLater(currentNode(), element);
-    m_openElements.push(HTMLStackItem::create(element.release(), token));
</del><ins>+        attachLater(&amp;currentNode(), element);
+    m_openElements.push(HTMLStackItem::create(element.releaseNonNull(), *token));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLConstructionSite::insertForeignElement(AtomicHTMLToken* token, const AtomicString&amp; namespaceURI)
</span><span class="lines">@@ -515,15 +524,15 @@
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;Element&gt; element = createElement(token, namespaceURI);
</span><span class="cx">     if (scriptingContentIsAllowed(m_parserContentPolicy) || !toScriptElementIfPossible(element.get()))
</span><del>-        attachLater(currentNode(), element, token-&gt;selfClosing());
</del><ins>+        attachLater(&amp;currentNode(), element, token-&gt;selfClosing());
</ins><span class="cx">     if (!token-&gt;selfClosing())
</span><del>-        m_openElements.push(HTMLStackItem::create(element.release(), token, namespaceURI));
</del><ins>+        m_openElements.push(HTMLStackItem::create(element.releaseNonNull(), *token, namespaceURI));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLConstructionSite::insertTextNode(const String&amp; characters, WhitespaceMode whitespaceMode)
</span><span class="cx"> {
</span><span class="cx">     HTMLConstructionSiteTask task(HTMLConstructionSiteTask::Insert);
</span><del>-    task.parent = currentNode();
</del><ins>+    task.parent = &amp;currentNode();
</ins><span class="cx"> 
</span><span class="cx">     if (shouldFosterParent())
</span><span class="cx">         findFosterSite(task);
</span><span class="lines">@@ -571,37 +580,37 @@
</span><span class="cx"> void HTMLConstructionSite::reparent(HTMLElementStack::ElementRecord&amp; newParent, HTMLElementStack::ElementRecord&amp; child)
</span><span class="cx"> {
</span><span class="cx">     HTMLConstructionSiteTask task(HTMLConstructionSiteTask::Reparent);
</span><del>-    task.parent = newParent.node();
-    task.child = child.element();
</del><ins>+    task.parent = &amp;newParent.node();
+    task.child = &amp;child.element();
</ins><span class="cx">     m_taskQueue.append(task);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLConstructionSite::reparent(HTMLElementStack::ElementRecord&amp; newParent, HTMLStackItem&amp; child)
</span><span class="cx"> {
</span><span class="cx">     HTMLConstructionSiteTask task(HTMLConstructionSiteTask::Reparent);
</span><del>-    task.parent = newParent.node();
-    task.child = child.element();
</del><ins>+    task.parent = &amp;newParent.node();
+    task.child = &amp;child.element();
</ins><span class="cx">     m_taskQueue.append(task);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLConstructionSite::insertAlreadyParsedChild(HTMLStackItem&amp; newParent, HTMLElementStack::ElementRecord&amp; child)
</span><span class="cx"> {
</span><del>-    if (newParent.causesFosterParenting()) {
-        fosterParent(child.element());
</del><ins>+    if (causesFosterParenting(newParent)) {
+        fosterParent(&amp;child.element());
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     HTMLConstructionSiteTask task(HTMLConstructionSiteTask::InsertAlreadyParsedChild);
</span><del>-    task.parent = newParent.node();
-    task.child = child.element();
</del><ins>+    task.parent = &amp;newParent.node();
+    task.child = &amp;child.element();
</ins><span class="cx">     m_taskQueue.append(task);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLConstructionSite::takeAllChildren(HTMLStackItem&amp; newParent, HTMLElementStack::ElementRecord&amp; oldParent)
</span><span class="cx"> {
</span><span class="cx">     HTMLConstructionSiteTask task(HTMLConstructionSiteTask::TakeAllChildren);
</span><del>-    task.parent = newParent.node();
-    task.child = oldParent.node();
</del><ins>+    task.parent = &amp;newParent.node();
+    task.child = &amp;oldParent.node();
</ins><span class="cx">     m_taskQueue.append(task);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -616,10 +625,10 @@
</span><span class="cx"> inline Document&amp; HTMLConstructionSite::ownerDocumentForCurrentNode()
</span><span class="cx"> {
</span><span class="cx"> #if ENABLE(TEMPLATE_ELEMENT)
</span><del>-    if (is&lt;HTMLTemplateElement&gt;(*currentNode()))
-        return downcast&lt;HTMLTemplateElement&gt;(*currentElement()).content()-&gt;document();
</del><ins>+    if (is&lt;HTMLTemplateElement&gt;(currentNode()))
+        return downcast&lt;HTMLTemplateElement&gt;(currentNode()).content()-&gt;document();
</ins><span class="cx"> #endif
</span><del>-    return currentNode()-&gt;document();
</del><ins>+    return currentNode().document();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> PassRefPtr&lt;Element&gt; HTMLConstructionSite::createHTMLElement(AtomicHTMLToken* token)
</span><span class="lines">@@ -646,7 +655,7 @@
</span><span class="cx">         element = createHTMLElement(&amp;fakeToken);
</span><span class="cx">     else
</span><span class="cx">         element = createElement(&amp;fakeToken, item-&gt;namespaceURI());
</span><del>-    return HTMLStackItem::create(element.release(), &amp;fakeToken, item-&gt;namespaceURI());
</del><ins>+    return HTMLStackItem::create(element.releaseNonNull(), fakeToken, item-&gt;namespaceURI());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool HTMLConstructionSite::indexOfFirstUnopenFormattingElement(unsigned&amp; firstUnopenElementIndex) const
</span><span class="lines">@@ -657,7 +666,7 @@
</span><span class="cx">     do {
</span><span class="cx">         --index;
</span><span class="cx">         const HTMLFormattingElementList::Entry&amp; entry = m_activeFormattingElements.at(index);
</span><del>-        if (entry.isMarker() || m_openElements.contains(entry.element())) {
</del><ins>+        if (entry.isMarker() || m_openElements.contains(&amp;entry.element())) {
</ins><span class="cx">             firstUnopenElementIndex = index + 1;
</span><span class="cx">             return firstUnopenElementIndex &lt; m_activeFormattingElements.size();
</span><span class="cx">         }
</span><span class="lines">@@ -676,8 +685,8 @@
</span><span class="cx">     ASSERT(unopenEntryIndex &lt; m_activeFormattingElements.size());
</span><span class="cx">     for (; unopenEntryIndex &lt; m_activeFormattingElements.size(); ++unopenEntryIndex) {
</span><span class="cx">         HTMLFormattingElementList::Entry&amp; unopenedEntry = m_activeFormattingElements.at(unopenEntryIndex);
</span><del>-        RefPtr&lt;HTMLStackItem&gt; reconstructed = createElementFromSavedToken(unopenedEntry.stackItem().get());
-        attachLater(currentNode(), reconstructed-&gt;node());
</del><ins>+        RefPtr&lt;HTMLStackItem&gt; reconstructed = createElementFromSavedToken(unopenedEntry.stackItem());
+        attachLater(&amp;currentNode(), &amp;reconstructed-&gt;node());
</ins><span class="cx">         m_openElements.push(reconstructed);
</span><span class="cx">         unopenedEntry.replaceElement(reconstructed.release());
</span><span class="cx">     }
</span><span class="lines">@@ -685,7 +694,7 @@
</span><span class="cx"> 
</span><span class="cx"> void HTMLConstructionSite::generateImpliedEndTagsWithExclusion(const AtomicString&amp; tagName)
</span><span class="cx"> {
</span><del>-    while (hasImpliedEndTag(currentStackItem()) &amp;&amp; !currentStackItem()-&gt;matchesHTMLTag(tagName))
</del><ins>+    while (hasImpliedEndTag(currentStackItem()) &amp;&amp; !currentStackItem().matchesHTMLTag(tagName))
</ins><span class="cx">         m_openElements.pop();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -706,7 +715,7 @@
</span><span class="cx">     // When a node is to be foster parented, the last template element with no table element is below it in the stack of open elements is the foster parent element (NOT the template's parent!)
</span><span class="cx">     HTMLElementStack::ElementRecord* lastTemplateElement = m_openElements.topmost(templateTag.localName());
</span><span class="cx">     if (lastTemplateElement &amp;&amp; !m_openElements.inTableScope(tableTag)) {
</span><del>-        task.parent = lastTemplateElement-&gt;element();
</del><ins>+        task.parent = &amp;lastTemplateElement-&gt;element();
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -714,31 +723,30 @@
</span><span class="cx"> 
</span><span class="cx">     HTMLElementStack::ElementRecord* lastTableElementRecord = m_openElements.topmost(tableTag.localName());
</span><span class="cx">     if (lastTableElementRecord) {
</span><del>-        Element* lastTableElement = lastTableElementRecord-&gt;element();
-        ContainerNode* parent = lastTableElement-&gt;parentNode();
</del><ins>+        Element&amp; lastTableElement = lastTableElementRecord-&gt;element();
+        ContainerNode* parent = lastTableElement.parentNode();
</ins><span class="cx">         // When parsing HTML fragments, we skip step 4.2 (&quot;Let root be a new html element with no attributes&quot;) for efficiency,
</span><span class="cx">         // and instead use the DocumentFragment as a root node. So we must treat the root node (DocumentFragment) as if it is a html element here.
</span><del>-        bool parentCanBeFosterParent = parent &amp;&amp; (parent-&gt;isElementNode() || (m_isParsingFragment &amp;&amp; parent == m_openElements.rootNode()));
</del><ins>+        bool parentCanBeFosterParent = parent &amp;&amp; (parent-&gt;isElementNode() || (m_isParsingFragment &amp;&amp; parent == &amp;m_openElements.rootNode()));
</ins><span class="cx"> #if ENABLE(TEMPLATE_ELEMENT)
</span><span class="cx">         parentCanBeFosterParent = parentCanBeFosterParent || (is&lt;DocumentFragment&gt;(parent) &amp;&amp; downcast&lt;DocumentFragment&gt;(parent)-&gt;isTemplateContent());
</span><span class="cx"> #endif
</span><span class="cx">         if (parentCanBeFosterParent) {
</span><span class="cx">             task.parent = parent;
</span><del>-            task.nextChild = lastTableElement;
</del><ins>+            task.nextChild = &amp;lastTableElement;
</ins><span class="cx">             return;
</span><span class="cx">         }
</span><del>-        task.parent = lastTableElementRecord-&gt;next()-&gt;element();
</del><ins>+        task.parent = &amp;lastTableElementRecord-&gt;next()-&gt;element();
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     // Fragment case
</span><del>-    task.parent = m_openElements.rootNode(); // DocumentFragment
</del><ins>+    task.parent = &amp;m_openElements.rootNode(); // DocumentFragment
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool HTMLConstructionSite::shouldFosterParent() const
</span><span class="cx"> {
</span><span class="cx">     return m_redirectAttachToFosterParent
</span><del>-        &amp;&amp; currentStackItem()-&gt;isElementNode()
-        &amp;&amp; currentStackItem()-&gt;causesFosterParenting();
</del><ins>+        &amp;&amp; causesFosterParenting(currentStackItem());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLConstructionSite::fosterParent(PassRefPtr&lt;Node&gt; node)
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlparserHTMLConstructionSiteh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/parser/HTMLConstructionSite.h (177909 => 177910)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/parser/HTMLConstructionSite.h        2015-01-05 15:05:46 UTC (rev 177909)
+++ trunk/Source/WebCore/html/parser/HTMLConstructionSite.h        2015-01-05 17:11:40 UTC (rev 177910)
</span><span class="lines">@@ -138,17 +138,16 @@
</span><span class="cx">     bool inQuirksMode();
</span><span class="cx"> 
</span><span class="cx">     bool isEmpty() const { return !m_openElements.stackDepth(); }
</span><del>-    HTMLElementStack::ElementRecord* currentElementRecord() const { return m_openElements.topRecord(); }
-    Element* currentElement() const { return m_openElements.top(); }
-    ContainerNode* currentNode() const { return m_openElements.topNode(); }
-    HTMLStackItem* currentStackItem() const { return m_openElements.topStackItem(); }
</del><ins>+    Element&amp; currentElement() const { return m_openElements.top(); }
+    ContainerNode&amp; currentNode() const { return m_openElements.topNode(); }
+    HTMLStackItem&amp; currentStackItem() const { return m_openElements.topStackItem(); }
</ins><span class="cx">     HTMLStackItem* oneBelowTop() const { return m_openElements.oneBelowTop(); }
</span><span class="cx">     Document&amp; ownerDocumentForCurrentNode();
</span><del>-    HTMLElementStack* openElements() const { return &amp;m_openElements; }
-    HTMLFormattingElementList* activeFormattingElements() const { return &amp;m_activeFormattingElements; }
-    bool currentIsRootNode() { return m_openElements.topNode() == m_openElements.rootNode(); }
</del><ins>+    HTMLElementStack&amp; openElements() const { return m_openElements; }
+    HTMLFormattingElementList&amp; activeFormattingElements() const { return m_activeFormattingElements; }
+    bool currentIsRootNode() { return &amp;m_openElements.topNode() == &amp;m_openElements.rootNode(); }
</ins><span class="cx"> 
</span><del>-    Element* head() const { return m_head-&gt;element(); }
</del><ins>+    Element&amp; head() const { return m_head-&gt;element(); }
</ins><span class="cx">     HTMLStackItem* headStackItem() const { return m_head.get(); }
</span><span class="cx"> 
</span><span class="cx">     void setForm(HTMLFormElement*);
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlparserHTMLElementStackcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/parser/HTMLElementStack.cpp (177909 => 177910)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/parser/HTMLElementStack.cpp        2015-01-05 15:05:46 UTC (rev 177909)
+++ trunk/Source/WebCore/html/parser/HTMLElementStack.cpp        2015-01-05 17:11:40 UTC (rev 177910)
</span><span class="lines">@@ -36,91 +36,90 @@
</span><span class="cx"> 
</span><span class="cx"> using namespace HTMLNames;
</span><span class="cx"> 
</span><del>-
</del><span class="cx"> namespace {
</span><span class="cx"> 
</span><del>-inline bool isRootNode(HTMLStackItem* item)
</del><ins>+inline bool isRootNode(HTMLStackItem&amp; item)
</ins><span class="cx"> {
</span><del>-    return item-&gt;isDocumentFragmentNode()
-        || item-&gt;hasTagName(htmlTag);
</del><ins>+    return item.isDocumentFragment()
+        || item.hasTagName(htmlTag);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline bool isScopeMarker(HTMLStackItem* item)
</del><ins>+inline bool isScopeMarker(HTMLStackItem&amp; item)
</ins><span class="cx"> {
</span><del>-    return item-&gt;hasTagName(appletTag)
-        || item-&gt;hasTagName(captionTag)
-        || item-&gt;hasTagName(marqueeTag)
-        || item-&gt;hasTagName(objectTag)
-        || is&lt;HTMLTableElement&gt;(*item-&gt;node())
-        || item-&gt;hasTagName(tdTag)
-        || item-&gt;hasTagName(thTag)
-        || item-&gt;hasTagName(MathMLNames::miTag)
-        || item-&gt;hasTagName(MathMLNames::moTag)
-        || item-&gt;hasTagName(MathMLNames::mnTag)
-        || item-&gt;hasTagName(MathMLNames::msTag)
-        || item-&gt;hasTagName(MathMLNames::mtextTag)
-        || item-&gt;hasTagName(MathMLNames::annotation_xmlTag)
-        || item-&gt;hasTagName(SVGNames::foreignObjectTag)
-        || item-&gt;hasTagName(SVGNames::descTag)
-        || item-&gt;hasTagName(SVGNames::titleTag)
</del><ins>+    return item.hasTagName(appletTag)
+        || item.hasTagName(captionTag)
+        || item.hasTagName(marqueeTag)
+        || item.hasTagName(objectTag)
+        || is&lt;HTMLTableElement&gt;(item.node())
+        || item.hasTagName(tdTag)
+        || item.hasTagName(thTag)
+        || item.hasTagName(MathMLNames::miTag)
+        || item.hasTagName(MathMLNames::moTag)
+        || item.hasTagName(MathMLNames::mnTag)
+        || item.hasTagName(MathMLNames::msTag)
+        || item.hasTagName(MathMLNames::mtextTag)
+        || item.hasTagName(MathMLNames::annotation_xmlTag)
+        || item.hasTagName(SVGNames::foreignObjectTag)
+        || item.hasTagName(SVGNames::descTag)
+        || item.hasTagName(SVGNames::titleTag)
</ins><span class="cx"> #if ENABLE(TEMPLATE_ELEMENT)
</span><del>-        || item-&gt;hasTagName(templateTag)
</del><ins>+        || item.hasTagName(templateTag)
</ins><span class="cx"> #endif
</span><span class="cx">         || isRootNode(item);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline bool isListItemScopeMarker(HTMLStackItem* item)
</del><ins>+inline bool isListItemScopeMarker(HTMLStackItem&amp; item)
</ins><span class="cx"> {
</span><span class="cx">     return isScopeMarker(item)
</span><del>-        || item-&gt;hasTagName(olTag)
-        || item-&gt;hasTagName(ulTag);
</del><ins>+        || item.hasTagName(olTag)
+        || item.hasTagName(ulTag);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline bool isTableScopeMarker(HTMLStackItem* item)
</del><ins>+inline bool isTableScopeMarker(HTMLStackItem&amp; item)
</ins><span class="cx"> {
</span><del>-    return is&lt;HTMLTableElement&gt;(*item-&gt;node())
</del><ins>+    return is&lt;HTMLTableElement&gt;(item.node())
</ins><span class="cx"> #if ENABLE(TEMPLATE_ELEMENT)
</span><del>-        || item-&gt;hasTagName(templateTag)
</del><ins>+        || item.hasTagName(templateTag)
</ins><span class="cx"> #endif
</span><span class="cx">         || isRootNode(item);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline bool isTableBodyScopeMarker(HTMLStackItem* item)
</del><ins>+inline bool isTableBodyScopeMarker(HTMLStackItem&amp; item)
</ins><span class="cx"> {
</span><del>-    return item-&gt;hasTagName(tbodyTag)
-        || item-&gt;hasTagName(tfootTag)
-        || item-&gt;hasTagName(theadTag)
</del><ins>+    return item.hasTagName(tbodyTag)
+        || item.hasTagName(tfootTag)
+        || item.hasTagName(theadTag)
</ins><span class="cx"> #if ENABLE(TEMPLATE_ELEMENT)
</span><del>-        || item-&gt;hasTagName(templateTag)
</del><ins>+        || item.hasTagName(templateTag)
</ins><span class="cx"> #endif
</span><span class="cx">         || isRootNode(item);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline bool isTableRowScopeMarker(HTMLStackItem* item)
</del><ins>+inline bool isTableRowScopeMarker(HTMLStackItem&amp; item)
</ins><span class="cx"> {
</span><del>-    return item-&gt;hasTagName(trTag)
</del><ins>+    return item.hasTagName(trTag)
</ins><span class="cx"> #if ENABLE(TEMPLATE_ELEMENT)
</span><del>-        || item-&gt;hasTagName(templateTag)
</del><ins>+        || item.hasTagName(templateTag)
</ins><span class="cx"> #endif
</span><span class="cx">         || isRootNode(item);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline bool isForeignContentScopeMarker(HTMLStackItem* item)
</del><ins>+inline bool isForeignContentScopeMarker(HTMLStackItem&amp; item)
</ins><span class="cx"> {
</span><span class="cx">     return HTMLElementStack::isMathMLTextIntegrationPoint(item)
</span><span class="cx">         || HTMLElementStack::isHTMLIntegrationPoint(item)
</span><del>-        || item-&gt;isInHTMLNamespace();
</del><ins>+        || isInHTMLNamespace(item);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline bool isButtonScopeMarker(HTMLStackItem* item)
</del><ins>+inline bool isButtonScopeMarker(HTMLStackItem&amp; item)
</ins><span class="cx"> {
</span><span class="cx">     return isScopeMarker(item)
</span><del>-        || item-&gt;hasTagName(buttonTag);
</del><ins>+        || item.hasTagName(buttonTag);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline bool isSelectScopeMarker(HTMLStackItem* item)
</del><ins>+inline bool isSelectScopeMarker(HTMLStackItem&amp; item)
</ins><span class="cx"> {
</span><del>-    return !is&lt;HTMLOptGroupElement&gt;(*item-&gt;node()) &amp;&amp; !is&lt;HTMLOptionElement&gt;(*item-&gt;node());
</del><ins>+    return !is&lt;HTMLOptGroupElement&gt;(item.node()) &amp;&amp; !is&lt;HTMLOptionElement&gt;(item.node());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span><span class="lines">@@ -139,7 +138,7 @@
</span><span class="cx"> void HTMLElementStack::ElementRecord::replaceElement(PassRefPtr&lt;HTMLStackItem&gt; item)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(item);
</span><del>-    ASSERT(!m_item || m_item-&gt;isElementNode());
</del><ins>+    ASSERT(!m_item || m_item-&gt;isElement());
</ins><span class="cx">     // FIXME: Should this call finishParsingChildren?
</span><span class="cx">     m_item = item;
</span><span class="cx"> }
</span><span class="lines">@@ -167,7 +166,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool HTMLElementStack::hasOnlyOneElement() const
</span><span class="cx"> {
</span><del>-    return !topRecord()-&gt;next();
</del><ins>+    return !topRecord().next();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool HTMLElementStack::secondElementIsHTMLBodyElement() const
</span><span class="lines">@@ -184,15 +183,15 @@
</span><span class="cx"> 
</span><span class="cx"> void HTMLElementStack::popHTMLHeadElement()
</span><span class="cx"> {
</span><del>-    ASSERT(top() == m_headElement);
-    m_headElement = 0;
</del><ins>+    ASSERT(&amp;top() == m_headElement);
+    m_headElement = nullptr;
</ins><span class="cx">     popCommon();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLElementStack::popHTMLBodyElement()
</span><span class="cx"> {
</span><del>-    ASSERT(top() == m_bodyElement);
-    m_bodyElement = 0;
</del><ins>+    ASSERT(&amp;top() == m_bodyElement);
+    m_bodyElement = nullptr;
</ins><span class="cx">     popCommon();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -203,20 +202,20 @@
</span><span class="cx">     m_bodyElement = 0;
</span><span class="cx">     m_stackDepth = 0;
</span><span class="cx">     while (m_top) {
</span><del>-        topNode()-&gt;finishParsingChildren();
</del><ins>+        topNode().finishParsingChildren();
</ins><span class="cx">         m_top = m_top-&gt;releaseNext();
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLElementStack::pop()
</span><span class="cx"> {
</span><del>-    ASSERT(!topStackItem()-&gt;hasTagName(HTMLNames::headTag));
</del><ins>+    ASSERT(!topStackItem().hasTagName(HTMLNames::headTag));
</ins><span class="cx">     popCommon();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLElementStack::popUntil(const AtomicString&amp; tagName)
</span><span class="cx"> {
</span><del>-    while (!topStackItem()-&gt;matchesHTMLTag(tagName)) {
</del><ins>+    while (!topStackItem().matchesHTMLTag(tagName)) {
</ins><span class="cx">         // pop() will ASSERT if a &lt;body&gt;, &lt;head&gt; or &lt;html&gt; will be popped.
</span><span class="cx">         pop();
</span><span class="cx">     }
</span><span class="lines">@@ -230,14 +229,14 @@
</span><span class="cx"> 
</span><span class="cx"> void HTMLElementStack::popUntilNumberedHeaderElementPopped()
</span><span class="cx"> {
</span><del>-    while (!topStackItem()-&gt;isNumberedHeaderElement())
</del><ins>+    while (!isNumberedHeaderElement(topStackItem()))
</ins><span class="cx">         pop();
</span><span class="cx">     pop();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLElementStack::popUntil(Element* element)
</span><span class="cx"> {
</span><del>-    while (top() != element)
</del><ins>+    while (&amp;top() != element)
</ins><span class="cx">         pop();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -269,24 +268,20 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // http://www.whatwg.org/specs/web-apps/current-work/multipage/tree-construction.html#mathml-text-integration-point
</span><del>-bool HTMLElementStack::isMathMLTextIntegrationPoint(HTMLStackItem* item)
</del><ins>+bool HTMLElementStack::isMathMLTextIntegrationPoint(HTMLStackItem&amp; item)
</ins><span class="cx"> {
</span><del>-    if (!item-&gt;isElementNode())
-        return false;
-    return item-&gt;hasTagName(MathMLNames::miTag)
-        || item-&gt;hasTagName(MathMLNames::moTag)
-        || item-&gt;hasTagName(MathMLNames::mnTag)
-        || item-&gt;hasTagName(MathMLNames::msTag)
-        || item-&gt;hasTagName(MathMLNames::mtextTag);
</del><ins>+    return item.hasTagName(MathMLNames::miTag)
+        || item.hasTagName(MathMLNames::moTag)
+        || item.hasTagName(MathMLNames::mnTag)
+        || item.hasTagName(MathMLNames::msTag)
+        || item.hasTagName(MathMLNames::mtextTag);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // http://www.whatwg.org/specs/web-apps/current-work/multipage/tree-construction.html#html-integration-point
</span><del>-bool HTMLElementStack::isHTMLIntegrationPoint(HTMLStackItem* item)
</del><ins>+bool HTMLElementStack::isHTMLIntegrationPoint(HTMLStackItem&amp; item)
</ins><span class="cx"> {
</span><del>-    if (!item-&gt;isElementNode())
-        return false;
-    if (item-&gt;hasTagName(MathMLNames::annotation_xmlTag)) {
-        Attribute* encodingAttr = item-&gt;getAttributeItem(MathMLNames::encodingAttr);
</del><ins>+    if (item.hasTagName(MathMLNames::annotation_xmlTag)) {
+        const Attribute* encodingAttr = item.findAttribute(MathMLNames::encodingAttr);
</ins><span class="cx">         if (encodingAttr) {
</span><span class="cx">             const String&amp; encoding = encodingAttr-&gt;value();
</span><span class="cx">             return equalIgnoringCase(encoding, &quot;text/html&quot;)
</span><span class="lines">@@ -294,9 +289,9 @@
</span><span class="cx">         }
</span><span class="cx">         return false;
</span><span class="cx">     }
</span><del>-    return item-&gt;hasTagName(SVGNames::foreignObjectTag)
-        || item-&gt;hasTagName(SVGNames::descTag)
-        || item-&gt;hasTagName(SVGNames::titleTag);
</del><ins>+    return item.hasTagName(SVGNames::foreignObjectTag)
+        || item.hasTagName(SVGNames::descTag)
+        || item.hasTagName(SVGNames::titleTag);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLElementStack::popUntilForeignContentScopeMarker()
</span><span class="lines">@@ -307,7 +302,7 @@
</span><span class="cx">     
</span><span class="cx"> void HTMLElementStack::pushRootNode(PassRefPtr&lt;HTMLStackItem&gt; rootItem)
</span><span class="cx"> {
</span><del>-    ASSERT(rootItem-&gt;isDocumentFragmentNode());
</del><ins>+    ASSERT(rootItem-&gt;isDocumentFragment());
</ins><span class="cx">     pushRootNodeCommon(rootItem);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -321,7 +316,7 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!m_top);
</span><span class="cx">     ASSERT(!m_rootNode);
</span><del>-    m_rootNode = rootItem-&gt;node();
</del><ins>+    m_rootNode = &amp;rootItem-&gt;node();
</ins><span class="cx">     pushCommon(rootItem);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -329,7 +324,7 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(item-&gt;hasTagName(HTMLNames::headTag));
</span><span class="cx">     ASSERT(!m_headElement);
</span><del>-    m_headElement = item-&gt;element();
</del><ins>+    m_headElement = &amp;item-&gt;element();
</ins><span class="cx">     pushCommon(item);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -337,7 +332,7 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(item-&gt;hasTagName(HTMLNames::bodyTag));
</span><span class="cx">     ASSERT(!m_bodyElement);
</span><del>-    m_bodyElement = item-&gt;element();
</del><ins>+    m_bodyElement = &amp;item-&gt;element();
</ins><span class="cx">     pushCommon(item);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -370,16 +365,16 @@
</span><span class="cx"> 
</span><span class="cx">         m_stackDepth++;
</span><span class="cx">         recordAbove-&gt;setNext(std::make_unique&lt;ElementRecord&gt;(item, recordAbove-&gt;releaseNext()));
</span><del>-        recordAbove-&gt;next()-&gt;element()-&gt;beginParsingChildren();
</del><ins>+        recordAbove-&gt;next()-&gt;element().beginParsingChildren();
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     ASSERT_NOT_REACHED();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-HTMLElementStack::ElementRecord* HTMLElementStack::topRecord() const
</del><ins>+HTMLElementStack::ElementRecord&amp; HTMLElementStack::topRecord() const
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(m_top);
</span><del>-    return m_top.get();
</del><ins>+    return *m_top;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> HTMLStackItem* HTMLElementStack::oneBelowTop() const
</span><span class="lines">@@ -387,26 +382,26 @@
</span><span class="cx">     // We should never call this if there are fewer than 2 elements on the stack.
</span><span class="cx">     ASSERT(m_top);
</span><span class="cx">     ASSERT(m_top-&gt;next());
</span><del>-    if (m_top-&gt;next()-&gt;stackItem()-&gt;isElementNode())
-        return m_top-&gt;next()-&gt;stackItem().get();
-    return 0;
</del><ins>+    if (m_top-&gt;next()-&gt;stackItem().isElement())
+        return &amp;m_top-&gt;next()-&gt;stackItem();
+    return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLElementStack::removeHTMLHeadElement(Element* element)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(m_headElement == element);
</span><del>-    if (m_top-&gt;element() == element) {
</del><ins>+    if (&amp;m_top-&gt;element() == element) {
</ins><span class="cx">         popHTMLHeadElement();
</span><span class="cx">         return;
</span><span class="cx">     }
</span><del>-    m_headElement = 0;
</del><ins>+    m_headElement = nullptr;
</ins><span class="cx">     removeNonTopCommon(element);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLElementStack::remove(Element* element)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!element-&gt;hasTagName(HTMLNames::headTag));
</span><del>-    if (m_top-&gt;element() == element) {
</del><ins>+    if (&amp;m_top-&gt;element() == element) {
</ins><span class="cx">         pop();
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="lines">@@ -415,20 +410,20 @@
</span><span class="cx"> 
</span><span class="cx"> HTMLElementStack::ElementRecord* HTMLElementStack::find(Element* element) const
</span><span class="cx"> {
</span><del>-    for (ElementRecord* pos = m_top.get(); pos; pos = pos-&gt;next()) {
-        if (pos-&gt;node() == element)
-            return pos;
</del><ins>+    for (ElementRecord* record = m_top.get(); record; record = record-&gt;next()) {
+        if (&amp;record-&gt;node() == element)
+            return record;
</ins><span class="cx">     }
</span><del>-    return 0;
</del><ins>+    return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> HTMLElementStack::ElementRecord* HTMLElementStack::topmost(const AtomicString&amp; tagName) const
</span><span class="cx"> {
</span><del>-    for (ElementRecord* pos = m_top.get(); pos; pos = pos-&gt;next()) {
-        if (pos-&gt;stackItem()-&gt;matchesHTMLTag(tagName))
-            return pos;
</del><ins>+    for (ElementRecord* record = m_top.get(); record; record = record-&gt;next()) {
+        if (record-&gt;stackItem().matchesHTMLTag(tagName))
+            return record;
</ins><span class="cx">     }
</span><del>-    return 0;
</del><ins>+    return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool HTMLElementStack::contains(Element* element) const
</span><span class="lines">@@ -441,12 +436,11 @@
</span><span class="cx">     return !!topmost(tagName);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-template &lt;bool isMarker(HTMLStackItem*)&gt;
-bool inScopeCommon(HTMLElementStack::ElementRecord* top, const AtomicString&amp; targetTag)
</del><ins>+template &lt;bool isMarker(HTMLStackItem&amp;)&gt; bool inScopeCommon(HTMLElementStack::ElementRecord* top, const AtomicString&amp; targetTag)
</ins><span class="cx"> {
</span><del>-    for (HTMLElementStack::ElementRecord* pos = top; pos; pos = pos-&gt;next()) {
-        HTMLStackItem* item = pos-&gt;stackItem().get();
-        if (item-&gt;matchesHTMLTag(targetTag))
</del><ins>+    for (auto* record = top; record; record = record-&gt;next()) {
+        HTMLStackItem&amp; item = record-&gt;stackItem();
+        if (item.matchesHTMLTag(targetTag))
</ins><span class="cx">             return true;
</span><span class="cx">         if (isMarker(item))
</span><span class="cx">             return false;
</span><span class="lines">@@ -458,8 +452,8 @@
</span><span class="cx"> bool HTMLElementStack::hasNumberedHeaderElementInScope() const
</span><span class="cx"> {
</span><span class="cx">     for (ElementRecord* record = m_top.get(); record; record = record-&gt;next()) {
</span><del>-        HTMLStackItem* item = record-&gt;stackItem().get();
-        if (item-&gt;isNumberedHeaderElement())
</del><ins>+        HTMLStackItem&amp; item = record-&gt;stackItem();
+        if (isNumberedHeaderElement(item))
</ins><span class="cx">             return true;
</span><span class="cx">         if (isScopeMarker(item))
</span><span class="cx">             return false;
</span><span class="lines">@@ -470,9 +464,9 @@
</span><span class="cx"> 
</span><span class="cx"> bool HTMLElementStack::inScope(Element* targetElement) const
</span><span class="cx"> {
</span><del>-    for (ElementRecord* pos = m_top.get(); pos; pos = pos-&gt;next()) {
-        HTMLStackItem* item = pos-&gt;stackItem().get();
-        if (item-&gt;node() == targetElement)
</del><ins>+    for (ElementRecord* record = m_top.get(); record; record = record-&gt;next()) {
+        HTMLStackItem&amp; item = record-&gt;stackItem();
+        if (&amp;item.node() == targetElement)
</ins><span class="cx">             return true;
</span><span class="cx">         if (isScopeMarker(item))
</span><span class="cx">             return false;
</span><span class="lines">@@ -538,28 +532,27 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-Element* HTMLElementStack::htmlElement() const
</del><ins>+Element&amp; HTMLElementStack::htmlElement() const
</ins><span class="cx"> {
</span><del>-    ASSERT(m_rootNode);
-    return downcast&lt;Element&gt;(m_rootNode);
</del><ins>+    return downcast&lt;Element&gt;(rootNode());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-Element* HTMLElementStack::headElement() const
</del><ins>+Element&amp; HTMLElementStack::headElement() const
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(m_headElement);
</span><del>-    return m_headElement;
</del><ins>+    return *m_headElement;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-Element* HTMLElementStack::bodyElement() const
</del><ins>+Element&amp; HTMLElementStack::bodyElement() const
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(m_bodyElement);
</span><del>-    return m_bodyElement;
</del><ins>+    return *m_bodyElement;
</ins><span class="cx"> }
</span><span class="cx">     
</span><del>-ContainerNode* HTMLElementStack::rootNode() const
</del><ins>+ContainerNode&amp; HTMLElementStack::rootNode() const
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(m_rootNode);
</span><del>-    return m_rootNode;
</del><ins>+    return *m_rootNode;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLElementStack::pushCommon(PassRefPtr&lt;HTMLStackItem&gt; item)
</span><span class="lines">@@ -572,10 +565,11 @@
</span><span class="cx"> 
</span><span class="cx"> void HTMLElementStack::popCommon()
</span><span class="cx"> {
</span><del>-    ASSERT(!topStackItem()-&gt;hasTagName(HTMLNames::htmlTag));
-    ASSERT(!topStackItem()-&gt;hasTagName(HTMLNames::headTag) || !m_headElement);
-    ASSERT(!topStackItem()-&gt;hasTagName(HTMLNames::bodyTag) || !m_bodyElement);
-    top()-&gt;finishParsingChildren();
</del><ins>+    ASSERT(!topStackItem().hasTagName(HTMLNames::htmlTag));
+    ASSERT(!topStackItem().hasTagName(HTMLNames::headTag) || !m_headElement);
+    ASSERT(!topStackItem().hasTagName(HTMLNames::bodyTag) || !m_bodyElement);
+
+    top().finishParsingChildren();
</ins><span class="cx">     m_top = m_top-&gt;releaseNext();
</span><span class="cx"> 
</span><span class="cx">     m_stackDepth--;
</span><span class="lines">@@ -585,13 +579,13 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!element-&gt;hasTagName(HTMLNames::htmlTag));
</span><span class="cx">     ASSERT(!element-&gt;hasTagName(HTMLNames::bodyTag));
</span><del>-    ASSERT(top() != element);
-    for (ElementRecord* pos = m_top.get(); pos; pos = pos-&gt;next()) {
-        if (pos-&gt;next()-&gt;element() == element) {
</del><ins>+    ASSERT(&amp;top() != element);
+    for (ElementRecord* record = m_top.get(); record; record = record-&gt;next()) {
+        if (&amp;record-&gt;next()-&gt;element() == element) {
</ins><span class="cx">             // FIXME: Is it OK to call finishParsingChildren()
</span><span class="cx">             // when the children aren't actually finished?
</span><span class="cx">             element-&gt;finishParsingChildren();
</span><del>-            pos-&gt;setNext(pos-&gt;next()-&gt;releaseNext());
</del><ins>+            record-&gt;setNext(record-&gt;next()-&gt;releaseNext());
</ins><span class="cx">             m_stackDepth--;
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="lines">@@ -601,15 +595,15 @@
</span><span class="cx"> 
</span><span class="cx"> HTMLElementStack::ElementRecord* HTMLElementStack::furthestBlockForFormattingElement(Element* formattingElement) const
</span><span class="cx"> {
</span><del>-    ElementRecord* furthestBlock = 0;
-    for (ElementRecord* pos = m_top.get(); pos; pos = pos-&gt;next()) {
-        if (pos-&gt;element() == formattingElement)
</del><ins>+    ElementRecord* furthestBlock = nullptr;
+    for (ElementRecord* record = m_top.get(); record; record = record-&gt;next()) {
+        if (&amp;record-&gt;element() == formattingElement)
</ins><span class="cx">             return furthestBlock;
</span><del>-        if (pos-&gt;stackItem()-&gt;isSpecialNode())
-            furthestBlock = pos;
</del><ins>+        if (isSpecialNode(record-&gt;stackItem()))
+            furthestBlock = record;
</ins><span class="cx">     }
</span><span class="cx">     ASSERT_NOT_REACHED();
</span><del>-    return 0;
</del><ins>+    return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #ifndef NDEBUG
</span><span class="lines">@@ -617,7 +611,7 @@
</span><span class="cx"> void HTMLElementStack::show()
</span><span class="cx"> {
</span><span class="cx">     for (ElementRecord* record = m_top.get(); record; record = record-&gt;next())
</span><del>-        record-&gt;element()-&gt;showNode();
</del><ins>+        record-&gt;element().showNode();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlparserHTMLElementStackh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/parser/HTMLElementStack.h (177909 => 177910)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/parser/HTMLElementStack.h        2015-01-05 15:05:46 UTC (rev 177909)
+++ trunk/Source/WebCore/html/parser/HTMLElementStack.h        2015-01-05 17:11:40 UTC (rev 177910)
</span><span class="lines">@@ -53,15 +53,16 @@
</span><span class="cx">         ElementRecord(PassRefPtr&lt;HTMLStackItem&gt;, std::unique_ptr&lt;ElementRecord&gt;);
</span><span class="cx">         ~ElementRecord();
</span><span class="cx">     
</span><del>-        Element* element() const { return m_item-&gt;element(); }
-        ContainerNode* node() const { return m_item-&gt;node(); }
</del><ins>+        Element&amp; element() const { return m_item-&gt;element(); }
+        ContainerNode&amp; node() const { return m_item-&gt;node(); }
</ins><span class="cx">         const AtomicString&amp; namespaceURI() const { return m_item-&gt;namespaceURI(); }
</span><del>-        PassRefPtr&lt;HTMLStackItem&gt; stackItem() const { return m_item; }
</del><ins>+        HTMLStackItem&amp; stackItem() const { return *m_item; }
</ins><span class="cx">         void replaceElement(PassRefPtr&lt;HTMLStackItem&gt;);
</span><span class="cx"> 
</span><span class="cx">         bool isAbove(ElementRecord*) const;
</span><span class="cx"> 
</span><span class="cx">         ElementRecord* next() const { return m_next.get(); }
</span><ins>+
</ins><span class="cx">     private:
</span><span class="cx">         friend class HTMLElementStack;
</span><span class="cx"> 
</span><span class="lines">@@ -76,26 +77,23 @@
</span><span class="cx"> 
</span><span class="cx">     // Inlining this function is a (small) performance win on the parsing
</span><span class="cx">     // benchmark.
</span><del>-    Element* top() const
</del><ins>+    Element&amp; top() const
</ins><span class="cx">     {
</span><del>-        ASSERT(m_top-&gt;element());
</del><span class="cx">         return m_top-&gt;element();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    ContainerNode* topNode() const
</del><ins>+    ContainerNode&amp; topNode() const
</ins><span class="cx">     {
</span><del>-        ASSERT(m_top-&gt;node());
</del><span class="cx">         return m_top-&gt;node();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    HTMLStackItem* topStackItem() const
</del><ins>+    HTMLStackItem&amp; topStackItem() const
</ins><span class="cx">     {
</span><del>-        ASSERT(m_top-&gt;stackItem());
-        return m_top-&gt;stackItem().get();
</del><ins>+        return m_top-&gt;stackItem();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     HTMLStackItem* oneBelowTop() const;
</span><del>-    ElementRecord* topRecord() const;
</del><ins>+    ElementRecord&amp; topRecord() const;
</ins><span class="cx">     ElementRecord* find(Element*) const;
</span><span class="cx">     ElementRecord* furthestBlockForFormattingElement(Element*) const;
</span><span class="cx">     ElementRecord* topmost(const AtomicString&amp; tagName) const;
</span><span class="lines">@@ -124,8 +122,8 @@
</span><span class="cx">     void popHTMLBodyElement();
</span><span class="cx">     void popAll();
</span><span class="cx"> 
</span><del>-    static bool isMathMLTextIntegrationPoint(HTMLStackItem*);
-    static bool isHTMLIntegrationPoint(HTMLStackItem*);
</del><ins>+    static bool isMathMLTextIntegrationPoint(HTMLStackItem&amp;);
+    static bool isHTMLIntegrationPoint(HTMLStackItem&amp;);
</ins><span class="cx"> 
</span><span class="cx">     void remove(Element*);
</span><span class="cx">     void removeHTMLHeadElement(Element*);
</span><span class="lines">@@ -152,12 +150,12 @@
</span><span class="cx"> #if ENABLE(TEMPLATE_ELEMENT)
</span><span class="cx">     bool hasTemplateInHTMLScope() const;
</span><span class="cx"> #endif
</span><del>-    Element* htmlElement() const;
-    Element* headElement() const;
-    Element* bodyElement() const;
-    
-    ContainerNode* rootNode() const;
</del><ins>+    Element&amp; htmlElement() const;
+    Element&amp; headElement() const;
+    Element&amp; bodyElement() const;
</ins><span class="cx"> 
</span><ins>+    ContainerNode&amp; rootNode() const;
+
</ins><span class="cx"> #ifndef NDEBUG
</span><span class="cx">     void show();
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlparserHTMLFormattingElementListcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/parser/HTMLFormattingElementList.cpp (177909 => 177910)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/parser/HTMLFormattingElementList.cpp        2015-01-05 15:05:46 UTC (rev 177909)
+++ trunk/Source/WebCore/html/parser/HTMLFormattingElementList.cpp        2015-01-05 17:11:40 UTC (rev 177910)
</span><span class="lines">@@ -50,11 +50,11 @@
</span><span class="cx">     for (unsigned i = 1; i &lt;= m_entries.size(); ++i) {
</span><span class="cx">         const Entry&amp; entry = m_entries[m_entries.size() - i];
</span><span class="cx">         if (entry.isMarker())
</span><del>-            return 0;
</del><ins>+            return nullptr;
</ins><span class="cx">         if (entry.stackItem()-&gt;matchesHTMLTag(targetName))
</span><del>-            return entry.element();
</del><ins>+            return &amp;entry.element();
</ins><span class="cx">     }
</span><del>-    return 0;
</del><ins>+    return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool HTMLFormattingElementList::contains(Element* element)
</span><span class="lines">@@ -82,9 +82,9 @@
</span><span class="cx"> void HTMLFormattingElementList::swapTo(Element* oldElement, PassRefPtr&lt;HTMLStackItem&gt; newItem, const Bookmark&amp; bookmark)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(contains(oldElement));
</span><del>-    ASSERT(!contains(newItem-&gt;element()));
</del><ins>+    ASSERT(!contains(&amp;newItem-&gt;element()));
</ins><span class="cx">     if (!bookmark.hasBeenMoved()) {
</span><del>-        ASSERT(bookmark.mark()-&gt;element() == oldElement);
</del><ins>+        ASSERT(&amp;bookmark.mark()-&gt;element() == oldElement);
</ins><span class="cx">         bookmark.mark()-&gt;replaceElement(newItem);
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="lines">@@ -143,7 +143,7 @@
</span><span class="cx">             break;
</span><span class="cx"> 
</span><span class="cx">         // Quickly reject obviously non-matching candidates.
</span><del>-        HTMLStackItem* candidate = entry.stackItem().get();
</del><ins>+        HTMLStackItem* candidate = entry.stackItem();
</ins><span class="cx">         if (newItem-&gt;localName() != candidate-&gt;localName() || newItem-&gt;namespaceURI() != candidate-&gt;namespaceURI())
</span><span class="cx">             continue;
</span><span class="cx">         if (candidate-&gt;attributes().size() != newItemAttributeCount)
</span><span class="lines">@@ -181,7 +181,7 @@
</span><span class="cx">             ASSERT(newItem-&gt;attributes().size() == candidate-&gt;attributes().size());
</span><span class="cx">             ASSERT(newItem-&gt;localName() == candidate-&gt;localName() &amp;&amp; newItem-&gt;namespaceURI() == candidate-&gt;namespaceURI());
</span><span class="cx"> 
</span><del>-            Attribute* candidateAttribute = candidate-&gt;getAttributeItem(attribute.name());
</del><ins>+            const Attribute* candidateAttribute = candidate-&gt;findAttribute(attribute.name());
</ins><span class="cx">             if (candidateAttribute &amp;&amp; candidateAttribute-&gt;value() == attribute.value())
</span><span class="cx">                 remainingCandidates.append(candidate);
</span><span class="cx">         }
</span><span class="lines">@@ -197,7 +197,7 @@
</span><span class="cx">     // however, that we wil spin the loop more than once because of how the
</span><span class="cx">     // formatting element list gets permuted.
</span><span class="cx">     for (size_t i = kNoahsArkCapacity - 1; i &lt; candidates.size(); ++i)
</span><del>-        remove(candidates[i]-&gt;element());
</del><ins>+        remove(&amp;candidates[i]-&gt;element());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #ifndef NDEBUG
</span><span class="lines">@@ -209,7 +209,7 @@
</span><span class="cx">         if (entry.isMarker())
</span><span class="cx">             fprintf(stderr, &quot;marker\n&quot;);
</span><span class="cx">         else
</span><del>-            entry.element()-&gt;showNode();
</del><ins>+            entry.element().showNode();
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlparserHTMLFormattingElementListh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/parser/HTMLFormattingElementList.h (177909 => 177910)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/parser/HTMLFormattingElementList.h        2015-01-05 15:05:46 UTC (rev 177909)
+++ trunk/Source/WebCore/html/parser/HTMLFormattingElementList.h        2015-01-05 17:11:40 UTC (rev 177910)
</span><span class="lines">@@ -61,8 +61,8 @@
</span><span class="cx"> 
</span><span class="cx">         bool isMarker() const { return !m_item; }
</span><span class="cx"> 
</span><del>-        PassRefPtr&lt;HTMLStackItem&gt; stackItem() const { return m_item; }
-        Element* element() const
</del><ins>+        HTMLStackItem* stackItem() const { return m_item.get(); }
+        Element&amp; element() const
</ins><span class="cx">         {
</span><span class="cx">             // The fact that !m_item == isMarker() is an implementation detail
</span><span class="cx">             // callers should check isMarker() before calling element().
</span><span class="lines">@@ -72,8 +72,8 @@
</span><span class="cx">         void replaceElement(PassRefPtr&lt;HTMLStackItem&gt; item) { m_item = item; }
</span><span class="cx"> 
</span><span class="cx">         // Needed for use with Vector.  These are super-hot and must be inline.
</span><del>-        bool operator==(Element* element) const { return !m_item ? !element : m_item-&gt;element() == element; }
-        bool operator!=(Element* element) const { return !m_item ? !!element : m_item-&gt;element() != element; }
</del><ins>+        bool operator==(Element* element) const { return !m_item ? !element : &amp;m_item-&gt;element() == element; }
+        bool operator!=(Element* element) const { return !m_item ? !!element : &amp;m_item-&gt;element() != element; }
</ins><span class="cx"> 
</span><span class="cx">     private:
</span><span class="cx">         RefPtr&lt;HTMLStackItem&gt; m_item;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlparserHTMLStackItemh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/parser/HTMLStackItem.h (177909 => 177910)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/parser/HTMLStackItem.h        2015-01-05 15:05:46 UTC (rev 177909)
+++ trunk/Source/WebCore/html/parser/HTMLStackItem.h        2015-01-05 17:11:40 UTC (rev 177910)
</span><span class="lines">@@ -1,5 +1,6 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 2012 Company 100, Inc. All rights reserved.
</span><ins>+ * Copyright (C) 2015 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -27,112 +28,166 @@
</span><span class="cx"> #define HTMLStackItem_h
</span><span class="cx"> 
</span><span class="cx"> #include &quot;AtomicHTMLToken.h&quot;
</span><ins>+#include &quot;DocumentFragment.h&quot;
</ins><span class="cx"> #include &quot;Element.h&quot;
</span><span class="cx"> #include &quot;HTMLNames.h&quot;
</span><span class="cx"> #include &quot;MathMLNames.h&quot;
</span><span class="cx"> #include &quot;SVGNames.h&quot;
</span><span class="cx"> 
</span><del>-#include &lt;wtf/RefCounted.h&gt;
-#include &lt;wtf/RefPtr.h&gt;
-#include &lt;wtf/text/AtomicString.h&gt;
-
</del><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-class ContainerNode;
-
</del><span class="cx"> class HTMLStackItem : public RefCounted&lt;HTMLStackItem&gt; {
</span><span class="cx"> public:
</span><del>-    enum ItemType {
-        ItemForContextElement,
-        ItemForDocumentFragmentNode
-    };
</del><ins>+    // Normal HTMLElementStack and HTMLFormattingElementList items.
+    static Ref&lt;HTMLStackItem&gt; create(Ref&lt;Element&gt;, AtomicHTMLToken&amp;, const AtomicString&amp; namespaceURI = HTMLNames::xhtmlNamespaceURI);
</ins><span class="cx"> 
</span><del>-    // Used by document fragment node and context element.
-    static RefPtr&lt;HTMLStackItem&gt; create(PassRefPtr&lt;ContainerNode&gt; node, ItemType type)
-    {
-        return adoptRef(new HTMLStackItem(node, type));
-    }
</del><ins>+    // Document fragment or element for parsing context.
+    static Ref&lt;HTMLStackItem&gt; create(Element&amp;);
+    static Ref&lt;HTMLStackItem&gt; create(DocumentFragment&amp;);
</ins><span class="cx"> 
</span><del>-    // Used by HTMLElementStack and HTMLFormattingElementList.
-    static RefPtr&lt;HTMLStackItem&gt; create(PassRefPtr&lt;ContainerNode&gt; node, AtomicHTMLToken* token, const AtomicString&amp; namespaceURI = HTMLNames::xhtmlNamespaceURI)
-    {
-        return adoptRef(new HTMLStackItem(node, token, namespaceURI));
-    }
</del><ins>+    bool isElement() const;
+    bool isDocumentFragment() const;
</ins><span class="cx"> 
</span><del>-    Element* element() const { return downcast&lt;Element&gt;(m_node.get()); }
-    ContainerNode* node() const { return m_node.get(); }
</del><ins>+    ContainerNode&amp; node() const;
+    Element&amp; element() const;
</ins><span class="cx"> 
</span><del>-    bool isDocumentFragmentNode() const { return m_isDocumentFragmentNode; }
-    bool isElementNode() const { return !m_isDocumentFragmentNode; }
</del><ins>+    const AtomicString&amp; namespaceURI() const;
+    const AtomicString&amp; localName() const;
</ins><span class="cx"> 
</span><del>-    const AtomicString&amp; namespaceURI() const { return m_namespaceURI; }
-    const AtomicString&amp; localName() const { return m_tokenLocalName; }
</del><ins>+    const Vector&lt;Attribute&gt;&amp; attributes() const;
+    const Attribute* findAttribute(const QualifiedName&amp; attributeName) const;
</ins><span class="cx"> 
</span><del>-    const Vector&lt;Attribute&gt;&amp; attributes() const { ASSERT(m_tokenLocalName); return m_tokenAttributes; }
-    Attribute* getAttributeItem(const QualifiedName&amp; attributeName)
-    {
-        ASSERT(m_tokenLocalName);
-        return findAttributeInVector(m_tokenAttributes, attributeName);
-    }
</del><ins>+    bool hasTagName(const QualifiedName&amp;) const;
+    bool matchesHTMLTag(const AtomicString&amp;) const;
</ins><span class="cx"> 
</span><del>-    bool hasLocalName(const AtomicString&amp; name) const { return m_tokenLocalName == name; }
-    bool hasTagName(const QualifiedName&amp; name) const { return m_tokenLocalName == name.localName() &amp;&amp; m_namespaceURI == name.namespaceURI(); }
</del><ins>+private:
+    HTMLStackItem(Ref&lt;Element&gt;, AtomicHTMLToken&amp;, const AtomicString&amp; namespaceURI);
+    explicit HTMLStackItem(Element&amp;);
+    explicit HTMLStackItem(DocumentFragment&amp;);
</ins><span class="cx"> 
</span><del>-    bool matchesHTMLTag(const AtomicString&amp; name) const { return m_tokenLocalName == name &amp;&amp; m_namespaceURI == HTMLNames::xhtmlNamespaceURI; }
-    bool matchesHTMLTag(const QualifiedName&amp; name) const { return m_tokenLocalName == name &amp;&amp; m_namespaceURI == HTMLNames::xhtmlNamespaceURI; }
</del><ins>+    const Ref&lt;ContainerNode&gt; m_node;
+    const AtomicString m_namespaceURI;
+    const AtomicString m_localName;
+    const Vector&lt;Attribute&gt; m_attributes;
+};
</ins><span class="cx"> 
</span><del>-    bool causesFosterParenting()
-    {
-        return hasTagName(HTMLNames::tableTag)
-            || hasTagName(HTMLNames::tbodyTag)
-            || hasTagName(HTMLNames::tfootTag)
-            || hasTagName(HTMLNames::theadTag)
-            || hasTagName(HTMLNames::trTag);
-    }
</del><ins>+bool isInHTMLNamespace(const HTMLStackItem&amp;);
+bool isNumberedHeaderElement(const HTMLStackItem&amp;);
+bool isSpecialNode(const HTMLStackItem&amp;);
</ins><span class="cx"> 
</span><del>-    bool isInHTMLNamespace() const
-    {
-        // A DocumentFragment takes the place of the document element when parsing
-        // fragments and should be considered in the HTML namespace.
-        return namespaceURI() == HTMLNames::xhtmlNamespaceURI
-            || isDocumentFragmentNode(); // FIXME: Does this also apply to ShadowRoot?
-    }
</del><ins>+inline HTMLStackItem::HTMLStackItem(Ref&lt;Element&gt; element, AtomicHTMLToken&amp; token, const AtomicString&amp; namespaceURI = HTMLNames::xhtmlNamespaceURI)
+    : m_node(WTF::move(element))
+    , m_namespaceURI(namespaceURI)
+    , m_localName(token.name())
+    , m_attributes(token.attributes())
+{
+    // FIXME: We should find a way to move the attributes vector in the normal code path instead of copying it.
+}
</ins><span class="cx"> 
</span><del>-    bool isNumberedHeaderElement() const
-    {
-        return hasTagName(HTMLNames::h1Tag)
-            || hasTagName(HTMLNames::h2Tag)
-            || hasTagName(HTMLNames::h3Tag)
-            || hasTagName(HTMLNames::h4Tag)
-            || hasTagName(HTMLNames::h5Tag)
-            || hasTagName(HTMLNames::h6Tag);
-    }
</del><ins>+inline Ref&lt;HTMLStackItem&gt; HTMLStackItem::create(Ref&lt;Element&gt; element, AtomicHTMLToken&amp; token, const AtomicString&amp; namespaceURI)
+{
+    return adoptRef(*new HTMLStackItem(WTF::move(element), token, namespaceURI));
+}
</ins><span class="cx"> 
</span><del>-    bool isTableBodyContextElement() const
-    {
-        return hasTagName(HTMLNames::tbodyTag)
-            || hasTagName(HTMLNames::tfootTag)
-            || hasTagName(HTMLNames::theadTag);
-    }
</del><ins>+inline HTMLStackItem::HTMLStackItem(Element&amp; element)
+    : m_node(element)
+    , m_namespaceURI(element.namespaceURI())
+    , m_localName(element.localName())
+{
+}
</ins><span class="cx"> 
</span><del>-    // http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#special
-    bool isSpecialNode() const
-    {
-        if (hasTagName(MathMLNames::miTag)
-            || hasTagName(MathMLNames::moTag)
-            || hasTagName(MathMLNames::mnTag)
-            || hasTagName(MathMLNames::msTag)
-            || hasTagName(MathMLNames::mtextTag)
-            || hasTagName(MathMLNames::annotation_xmlTag)
-            || hasTagName(SVGNames::foreignObjectTag)
-            || hasTagName(SVGNames::descTag)
-            || hasTagName(SVGNames::titleTag))
-            return true;
-        if (isDocumentFragmentNode())
-            return true;
-        if (!isInHTMLNamespace())
-            return false;
-        const AtomicString&amp; tagName = localName();
</del><ins>+inline Ref&lt;HTMLStackItem&gt; HTMLStackItem::create(Element&amp; element)
+{
+    return adoptRef(*new HTMLStackItem(element));
+}
+
+inline HTMLStackItem::HTMLStackItem(DocumentFragment&amp; fragment)
+    : m_node(fragment)
+{
+}
+
+inline Ref&lt;HTMLStackItem&gt; HTMLStackItem::create(DocumentFragment&amp; fragment)
+{
+    return adoptRef(*new HTMLStackItem(fragment));
+}
+
+inline ContainerNode&amp; HTMLStackItem::node() const
+{
+    return const_cast&lt;ContainerNode&amp;&gt;(m_node.get());
+}
+
+inline Element&amp; HTMLStackItem::element() const
+{
+    return downcast&lt;Element&gt;(node());
+}
+
+inline bool HTMLStackItem::isDocumentFragment() const
+{
+    return m_localName.isNull();
+}
+
+inline bool HTMLStackItem::isElement() const
+{
+    return !isDocumentFragment();
+}
+
+inline const AtomicString&amp; HTMLStackItem::namespaceURI() const
+{
+    return m_namespaceURI;
+}
+
+inline const AtomicString&amp; HTMLStackItem::localName() const
+{
+    return m_localName;
+}
+
+inline const Vector&lt;Attribute&gt;&amp; HTMLStackItem::attributes() const
+{
+    ASSERT(isElement());
+    return m_attributes;
+}
+
+inline const Attribute* HTMLStackItem::findAttribute(const QualifiedName&amp; attributeName) const
+{
+    return findAttributeInVector(const_cast&lt;Vector&lt;Attribute&gt;&amp;&gt;(attributes()), attributeName);
+}
+
+inline bool HTMLStackItem::hasTagName(const QualifiedName&amp; name) const
+{
+    return m_localName == name.localName() &amp;&amp; m_namespaceURI == name.namespaceURI();
+}
+
+inline bool HTMLStackItem::matchesHTMLTag(const AtomicString&amp; name) const
+{
+    return m_localName == name &amp;&amp; m_namespaceURI == HTMLNames::xhtmlNamespaceURI;
+}
+
+inline bool isInHTMLNamespace(const HTMLStackItem&amp; item)
+{
+    // A DocumentFragment takes the place of the document element when parsing
+    // fragments and thus should be treated as if it was in the HTML namespace.
+    // FIXME: Is this also needed for a ShadowRoot that might be a non-HTML element?
+    return item.namespaceURI() == HTMLNames::xhtmlNamespaceURI || item.isDocumentFragment();
+}
+
+inline bool isNumberedHeaderElement(const HTMLStackItem&amp; item)
+{
+    return item.namespaceURI() == HTMLNames::xhtmlNamespaceURI
+        &amp;&amp; (item.localName() == HTMLNames::h1Tag
+            || item.localName() == HTMLNames::h2Tag
+            || item.localName() == HTMLNames::h3Tag
+            || item.localName() == HTMLNames::h4Tag
+            || item.localName() == HTMLNames::h5Tag
+            || item.localName() == HTMLNames::h6Tag);
+}
+
+// http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#special
+inline bool isSpecialNode(const HTMLStackItem&amp; item)
+{
+    if (item.isDocumentFragment())
+        return true;
+    const AtomicString&amp; tagName = item.localName();
+    if (item.namespaceURI() == HTMLNames::xhtmlNamespaceURI) {
</ins><span class="cx">         return tagName == HTMLNames::addressTag
</span><span class="cx">             || tagName == HTMLNames::appletTag
</span><span class="cx">             || tagName == HTMLNames::areaTag
</span><span class="lines">@@ -164,7 +219,12 @@
</span><span class="cx">             || tagName == HTMLNames::formTag
</span><span class="cx">             || tagName == HTMLNames::frameTag
</span><span class="cx">             || tagName == HTMLNames::framesetTag
</span><del>-            || isNumberedHeaderElement()
</del><ins>+            || tagName == HTMLNames::h1Tag
+            || tagName == HTMLNames::h2Tag
+            || tagName == HTMLNames::h3Tag
+            || tagName == HTMLNames::h4Tag
+            || tagName == HTMLNames::h5Tag
+            || tagName == HTMLNames::h6Tag
</ins><span class="cx">             || tagName == HTMLNames::headTag
</span><span class="cx">             || tagName == HTMLNames::headerTag
</span><span class="cx">             || tagName == HTMLNames::hgroupTag
</span><span class="lines">@@ -197,53 +257,37 @@
</span><span class="cx">             || tagName == HTMLNames::styleTag
</span><span class="cx">             || tagName == HTMLNames::summaryTag
</span><span class="cx">             || tagName == HTMLNames::tableTag
</span><del>-            || isTableBodyContextElement()
</del><ins>+            || tagName == HTMLNames::tbodyTag
</ins><span class="cx">             || tagName == HTMLNames::tdTag
</span><span class="cx"> #if ENABLE(TEMPLATE_ELEMENT)
</span><span class="cx">             || tagName == HTMLNames::templateTag
</span><span class="cx"> #endif
</span><span class="cx">             || tagName == HTMLNames::textareaTag
</span><ins>+            || tagName == HTMLNames::tfootTag
</ins><span class="cx">             || tagName == HTMLNames::thTag
</span><ins>+            || tagName == HTMLNames::theadTag
</ins><span class="cx">             || tagName == HTMLNames::titleTag
</span><span class="cx">             || tagName == HTMLNames::trTag
</span><span class="cx">             || tagName == HTMLNames::ulTag
</span><span class="cx">             || tagName == HTMLNames::wbrTag
</span><span class="cx">             || tagName == HTMLNames::xmpTag;
</span><span class="cx">     }
</span><del>-
-private:
-    HTMLStackItem(PassRefPtr&lt;ContainerNode&gt; node, ItemType type)
-        : m_node(node)
-    {
-        switch (type) {
-        case ItemForDocumentFragmentNode:
-            m_isDocumentFragmentNode = true;
-            break;
-        case ItemForContextElement:
-            m_tokenLocalName = m_node-&gt;localName();
-            m_namespaceURI = m_node-&gt;namespaceURI();
-            m_isDocumentFragmentNode = false;
-            break;
-        }
</del><ins>+    if (item.namespaceURI() == MathMLNames::mathmlNamespaceURI) {
+        return tagName == MathMLNames::annotation_xmlTag
+            || tagName == MathMLNames::miTag
+            || tagName == MathMLNames::moTag
+            || tagName == MathMLNames::mnTag
+            || tagName == MathMLNames::msTag
+            || tagName == MathMLNames::mtextTag;
</ins><span class="cx">     }
</span><del>-
-    HTMLStackItem(PassRefPtr&lt;ContainerNode&gt; node, AtomicHTMLToken* token, const AtomicString&amp; namespaceURI = HTMLNames::xhtmlNamespaceURI)
-        : m_node(node)
-        , m_tokenLocalName(token-&gt;name())
-        , m_tokenAttributes(token-&gt;attributes())
-        , m_namespaceURI(namespaceURI)
-        , m_isDocumentFragmentNode(false)
-    {
</del><ins>+    if (item.namespaceURI() == SVGNames::svgNamespaceURI) {
+        return tagName == SVGNames::descTag
+            || tagName == SVGNames::foreignObjectTag
+            || tagName == SVGNames::titleTag;
</ins><span class="cx">     }
</span><ins>+    return false;
+}
</ins><span class="cx"> 
</span><del>-    RefPtr&lt;ContainerNode&gt; m_node;
-
-    AtomicString m_tokenLocalName;
-    Vector&lt;Attribute&gt; m_tokenAttributes;
-    AtomicString m_namespaceURI;
-    bool m_isDocumentFragmentNode;
-};
-
</del><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // HTMLStackItem_h
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlparserHTMLTreeBuildercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp (177909 => 177910)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp        2015-01-05 15:05:46 UTC (rev 177909)
+++ trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp        2015-01-05 17:11:40 UTC (rev 177910)
</span><span class="lines">@@ -241,7 +241,7 @@
</span><span class="cx"> inline bool HTMLTreeBuilder::isParsingTemplateContents() const
</span><span class="cx"> {
</span><span class="cx"> #if ENABLE(TEMPLATE_ELEMENT)
</span><del>-    return m_tree.openElements()-&gt;hasTemplateInHTMLScope();
</del><ins>+    return m_tree.openElements().hasTemplateInHTMLScope();
</ins><span class="cx"> #else
</span><span class="cx">     return false;
</span><span class="cx"> #endif
</span><span class="lines">@@ -274,7 +274,7 @@
</span><span class="cx"> 
</span><span class="cx">     // https://html.spec.whatwg.org/multipage/syntax.html#parsing-html-fragments
</span><span class="cx">     // For efficiency, we skip step 5 (&quot;Let root be a new html element with no attributes&quot;) and instead use the DocumentFragment as a root node.
</span><del>-    m_tree.openElements()-&gt;pushRootNode(HTMLStackItem::create(&amp;fragment, HTMLStackItem::ItemForDocumentFragmentNode));
</del><ins>+    m_tree.openElements().pushRootNode(HTMLStackItem::create(fragment));
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(TEMPLATE_ELEMENT)
</span><span class="cx">     if (contextElement.hasTagName(templateTag))
</span><span class="lines">@@ -298,12 +298,12 @@
</span><span class="cx">     : m_fragment(&amp;fragment)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!fragment.hasChildNodes());
</span><del>-    m_contextElementStackItem = HTMLStackItem::create(&amp;contextElement, HTMLStackItem::ItemForContextElement);
</del><ins>+    m_contextElementStackItem = HTMLStackItem::create(contextElement);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> inline Element&amp; HTMLTreeBuilder::FragmentParsingContext::contextElement() const
</span><span class="cx"> {
</span><del>-    return *contextElementStackItem().element();
</del><ins>+    return contextElementStackItem().element();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> inline HTMLStackItem&amp; HTMLTreeBuilder::FragmentParsingContext::contextElementStackItem() const
</span><span class="lines">@@ -341,7 +341,7 @@
</span><span class="cx">         processToken(token);
</span><span class="cx"> 
</span><span class="cx">     bool inForeignContent = !m_tree.isEmpty()
</span><del>-        &amp;&amp; !adjustedCurrentStackItem().isInHTMLNamespace()
</del><ins>+        &amp;&amp; !isInHTMLNamespace(adjustedCurrentStackItem())
</ins><span class="cx">         &amp;&amp; !HTMLElementStack::isHTMLIntegrationPoint(m_tree.currentStackItem())
</span><span class="cx">         &amp;&amp; !HTMLElementStack::isMathMLTextIntegrationPoint(m_tree.currentStackItem());
</span><span class="cx"> 
</span><span class="lines">@@ -432,7 +432,7 @@
</span><span class="cx"> 
</span><span class="cx"> void HTMLTreeBuilder::processFakePEndTagIfPInButtonScope()
</span><span class="cx"> {
</span><del>-    if (!m_tree.openElements()-&gt;inButtonScope(pTag.localName()))
</del><ins>+    if (!m_tree.openElements().inButtonScope(pTag.localName()))
</ins><span class="cx">         return;
</span><span class="cx">     AtomicHTMLToken endP(HTMLToken::EndTag, pTag.localName());
</span><span class="cx">     processEndTag(endP);
</span><span class="lines">@@ -494,14 +494,14 @@
</span><span class="cx"> template &lt;bool shouldClose(const HTMLStackItem&amp;)&gt; void HTMLTreeBuilder::processCloseWhenNestedTag(AtomicHTMLToken&amp; token)
</span><span class="cx"> {
</span><span class="cx">     m_framesetOk = false;
</span><del>-    for (auto* nodeRecord = m_tree.openElements()-&gt;topRecord(); ; nodeRecord = nodeRecord-&gt;next()) {
-        HTMLStackItem&amp; item = *nodeRecord-&gt;stackItem();
</del><ins>+    for (auto* nodeRecord = &amp;m_tree.openElements().topRecord(); ; nodeRecord = nodeRecord-&gt;next()) {
+        HTMLStackItem&amp; item = nodeRecord-&gt;stackItem();
</ins><span class="cx">         if (shouldClose(item)) {
</span><del>-            ASSERT(item.isElementNode());
</del><ins>+            ASSERT(item.isElement());
</ins><span class="cx">             processFakeEndTag(item.localName());
</span><span class="cx">             break;
</span><span class="cx">         }
</span><del>-        if (item.isSpecialNode() &amp;&amp; !item.hasTagName(addressTag) &amp;&amp; !item.hasTagName(divTag) &amp;&amp; !item.hasTagName(pTag))
</del><ins>+        if (isSpecialNode(item) &amp;&amp; !item.hasTagName(addressTag) &amp;&amp; !item.hasTagName(divTag) &amp;&amp; !item.hasTagName(pTag))
</ins><span class="cx">             break;
</span><span class="cx">     }
</span><span class="cx">     processFakePEndTagIfPInButtonScope();
</span><span class="lines">@@ -606,9 +606,9 @@
</span><span class="cx">     }
</span><span class="cx">     if (token.name() == bodyTag) {
</span><span class="cx">         parseError(token);
</span><del>-        bool fragmentOrTemplateCase = !m_tree.openElements()-&gt;secondElementIsHTMLBodyElement() || m_tree.openElements()-&gt;hasOnlyOneElement();
</del><ins>+        bool fragmentOrTemplateCase = !m_tree.openElements().secondElementIsHTMLBodyElement() || m_tree.openElements().hasOnlyOneElement();
</ins><span class="cx"> #if ENABLE(TEMPLATE_ELEMENT)
</span><del>-        fragmentOrTemplateCase = fragmentOrTemplateCase || m_tree.openElements()-&gt;hasTemplateInHTMLScope();
</del><ins>+        fragmentOrTemplateCase = fragmentOrTemplateCase || m_tree.openElements().hasTemplateInHTMLScope();
</ins><span class="cx"> #endif
</span><span class="cx">         if (fragmentOrTemplateCase) {
</span><span class="cx">             ASSERT(isParsingFragmentOrTemplateContents());
</span><span class="lines">@@ -620,16 +620,16 @@
</span><span class="cx">     }
</span><span class="cx">     if (token.name() == framesetTag) {
</span><span class="cx">         parseError(token);
</span><del>-        if (!m_tree.openElements()-&gt;secondElementIsHTMLBodyElement() || m_tree.openElements()-&gt;hasOnlyOneElement()) {
</del><ins>+        if (!m_tree.openElements().secondElementIsHTMLBodyElement() || m_tree.openElements().hasOnlyOneElement()) {
</ins><span class="cx">             ASSERT(isParsingFragmentOrTemplateContents());
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx">         if (!m_framesetOk)
</span><span class="cx">             return;
</span><del>-        m_tree.openElements()-&gt;bodyElement()-&gt;remove(ASSERT_NO_EXCEPTION);
-        m_tree.openElements()-&gt;popUntil(m_tree.openElements()-&gt;bodyElement());
-        m_tree.openElements()-&gt;popHTMLBodyElement();
-        ASSERT(m_tree.openElements()-&gt;top() == m_tree.openElements()-&gt;htmlElement());
</del><ins>+        m_tree.openElements().bodyElement().remove(ASSERT_NO_EXCEPTION);
+        m_tree.openElements().popUntil(&amp;m_tree.openElements().bodyElement());
+        m_tree.openElements().popHTMLBodyElement();
+        ASSERT(&amp;m_tree.openElements().top() == &amp;m_tree.openElements().htmlElement());
</ins><span class="cx">         m_tree.insertHTMLElement(&amp;token);
</span><span class="cx">         m_insertionMode = InsertionMode::InFrameset;
</span><span class="cx">         return;
</span><span class="lines">@@ -663,9 +663,9 @@
</span><span class="cx">     }
</span><span class="cx">     if (isNumberedHeaderTag(token.name())) {
</span><span class="cx">         processFakePEndTagIfPInButtonScope();
</span><del>-        if (m_tree.currentStackItem()-&gt;isNumberedHeaderElement()) {
</del><ins>+        if (isNumberedHeaderElement(m_tree.currentStackItem())) {
</ins><span class="cx">             parseError(token);
</span><del>-            m_tree.openElements()-&gt;pop();
</del><ins>+            m_tree.openElements().pop();
</ins><span class="cx">         }
</span><span class="cx">         m_tree.insertHTMLElement(&amp;token);
</span><span class="cx">         return;
</span><span class="lines">@@ -701,7 +701,7 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     if (token.name() == buttonTag) {
</span><del>-        if (m_tree.openElements()-&gt;inScope(buttonTag)) {
</del><ins>+        if (m_tree.openElements().inScope(buttonTag)) {
</ins><span class="cx">             parseError(token);
</span><span class="cx">             processFakeEndTag(buttonTag);
</span><span class="cx">             processStartTag(token); // FIXME: Could we just fall through here?
</span><span class="lines">@@ -713,13 +713,13 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     if (token.name() == aTag) {
</span><del>-        Element* activeATag = m_tree.activeFormattingElements()-&gt;closestElementInScopeWithName(aTag.localName());
</del><ins>+        Element* activeATag = m_tree.activeFormattingElements().closestElementInScopeWithName(aTag.localName());
</ins><span class="cx">         if (activeATag) {
</span><span class="cx">             parseError(token);
</span><span class="cx">             processFakeEndTag(aTag);
</span><del>-            m_tree.activeFormattingElements()-&gt;remove(activeATag);
-            if (m_tree.openElements()-&gt;contains(activeATag))
-                m_tree.openElements()-&gt;remove(activeATag);
</del><ins>+            m_tree.activeFormattingElements().remove(activeATag);
+            if (m_tree.openElements().contains(activeATag))
+                m_tree.openElements().remove(activeATag);
</ins><span class="cx">         }
</span><span class="cx">         m_tree.reconstructTheActiveFormattingElements();
</span><span class="cx">         m_tree.insertFormattingElement(&amp;token);
</span><span class="lines">@@ -732,7 +732,7 @@
</span><span class="cx">     }
</span><span class="cx">     if (token.name() == nobrTag) {
</span><span class="cx">         m_tree.reconstructTheActiveFormattingElements();
</span><del>-        if (m_tree.openElements()-&gt;inScope(nobrTag)) {
</del><ins>+        if (m_tree.openElements().inScope(nobrTag)) {
</ins><span class="cx">             parseError(token);
</span><span class="cx">             processFakeEndTag(nobrTag);
</span><span class="cx">             m_tree.reconstructTheActiveFormattingElements();
</span><span class="lines">@@ -747,12 +747,12 @@
</span><span class="cx">     if (token.name() == appletTag || token.name() == marqueeTag || token.name() == objectTag) {
</span><span class="cx">         m_tree.reconstructTheActiveFormattingElements();
</span><span class="cx">         m_tree.insertHTMLElement(&amp;token);
</span><del>-        m_tree.activeFormattingElements()-&gt;appendMarker();
</del><ins>+        m_tree.activeFormattingElements().appendMarker();
</ins><span class="cx">         m_framesetOk = false;
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     if (token.name() == tableTag) {
</span><del>-        if (!m_tree.inQuirksMode() &amp;&amp; m_tree.openElements()-&gt;inButtonScope(pTag))
</del><ins>+        if (!m_tree.inQuirksMode() &amp;&amp; m_tree.openElements().inButtonScope(pTag))
</ins><span class="cx">             processFakeEndTag(pTag);
</span><span class="cx">         m_tree.insertHTMLElement(&amp;token);
</span><span class="cx">         m_framesetOk = false;
</span><span class="lines">@@ -845,7 +845,7 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     if (token.name() == optgroupTag || token.name() == optionTag) {
</span><del>-        if (is&lt;HTMLOptionElement&gt;(*m_tree.currentStackItem()-&gt;node())) {
</del><ins>+        if (is&lt;HTMLOptionElement&gt;(m_tree.currentStackItem().node())) {
</ins><span class="cx">             AtomicHTMLToken endOption(HTMLToken::EndTag, optionTag.localName());
</span><span class="cx">             processEndTag(endOption);
</span><span class="cx">         }
</span><span class="lines">@@ -854,18 +854,18 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     if (token.name() == rbTag || token.name() == rtcTag) {
</span><del>-        if (m_tree.openElements()-&gt;inScope(rubyTag.localName())) {
</del><ins>+        if (m_tree.openElements().inScope(rubyTag.localName())) {
</ins><span class="cx">             m_tree.generateImpliedEndTags();
</span><del>-            if (!m_tree.currentStackItem()-&gt;hasTagName(rubyTag))
</del><ins>+            if (!m_tree.currentStackItem().hasTagName(rubyTag))
</ins><span class="cx">                 parseError(token);
</span><span class="cx">         }
</span><span class="cx">         m_tree.insertHTMLElement(&amp;token);
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     if (token.name() == rtTag || token.name() == rpTag) {
</span><del>-        if (m_tree.openElements()-&gt;inScope(rubyTag.localName())) {
</del><ins>+        if (m_tree.openElements().inScope(rubyTag.localName())) {
</ins><span class="cx">             m_tree.generateImpliedEndTagsWithExclusion(rtcTag.localName());
</span><del>-            if (!m_tree.currentStackItem()-&gt;hasTagName(rubyTag) &amp;&amp; !m_tree.currentStackItem()-&gt;hasTagName(rtcTag))
</del><ins>+            if (!m_tree.currentStackItem().hasTagName(rubyTag) &amp;&amp; !m_tree.currentStackItem().hasTagName(rtcTag))
</ins><span class="cx">                 parseError(token);
</span><span class="cx">         }
</span><span class="cx">         m_tree.insertHTMLElement(&amp;token);
</span><span class="lines">@@ -908,7 +908,7 @@
</span><span class="cx"> 
</span><span class="cx"> void HTMLTreeBuilder::processTemplateStartTag(AtomicHTMLToken&amp; token)
</span><span class="cx"> {
</span><del>-    m_tree.activeFormattingElements()-&gt;appendMarker();
</del><ins>+    m_tree.activeFormattingElements().appendMarker();
</ins><span class="cx">     m_tree.insertHTMLElement(&amp;token);
</span><span class="cx">     m_templateInsertionModes.append(InsertionMode::TemplateContents);
</span><span class="cx">     m_insertionMode = InsertionMode::TemplateContents;
</span><span class="lines">@@ -917,16 +917,16 @@
</span><span class="cx"> bool HTMLTreeBuilder::processTemplateEndTag(AtomicHTMLToken&amp; token)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(token.name() == templateTag.localName());
</span><del>-    if (!m_tree.openElements()-&gt;hasTemplateInHTMLScope()) {
</del><ins>+    if (!m_tree.openElements().hasTemplateInHTMLScope()) {
</ins><span class="cx">         ASSERT(m_templateInsertionModes.isEmpty() || (m_templateInsertionModes.size() == 1 &amp;&amp; m_fragmentContext.contextElement().hasTagName(templateTag)));
</span><span class="cx">         parseError(token);
</span><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx">     m_tree.generateImpliedEndTags();
</span><del>-    if (!m_tree.currentStackItem()-&gt;hasTagName(templateTag))
</del><ins>+    if (!m_tree.currentStackItem().hasTagName(templateTag))
</ins><span class="cx">         parseError(token);
</span><del>-    m_tree.openElements()-&gt;popUntilPopped(templateTag);
-    m_tree.activeFormattingElements()-&gt;clearToLastMarker();
</del><ins>+    m_tree.openElements().popUntilPopped(templateTag);
+    m_tree.activeFormattingElements().clearToLastMarker();
</ins><span class="cx">     m_templateInsertionModes.removeLast();
</span><span class="cx">     resetInsertionModeAppropriately();
</span><span class="cx">     return true;
</span><span class="lines">@@ -948,7 +948,7 @@
</span><span class="cx"> {
</span><span class="cx">     bool ignoreFakeEndTag = m_tree.currentIsRootNode();
</span><span class="cx"> #if ENABLE(TEMPLATE_ELEMENT)
</span><del>-    ignoreFakeEndTag = ignoreFakeEndTag || m_tree.currentNode()-&gt;hasTagName(templateTag);
</del><ins>+    ignoreFakeEndTag = ignoreFakeEndTag || m_tree.currentNode().hasTagName(templateTag);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     if (ignoreFakeEndTag) {
</span><span class="lines">@@ -956,7 +956,7 @@
</span><span class="cx">         // FIXME: parse error
</span><span class="cx">         return false;
</span><span class="cx">     }
</span><del>-    m_tree.openElements()-&gt;pop();
</del><ins>+    m_tree.openElements().pop();
</ins><span class="cx">     m_insertionMode = InsertionMode::InTable;
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="lines">@@ -965,12 +965,12 @@
</span><span class="cx"> void HTMLTreeBuilder::closeTheCell()
</span><span class="cx"> {
</span><span class="cx">     ASSERT(m_insertionMode == InsertionMode::InCell);
</span><del>-    if (m_tree.openElements()-&gt;inTableScope(tdTag)) {
-        ASSERT(!m_tree.openElements()-&gt;inTableScope(thTag));
</del><ins>+    if (m_tree.openElements().inTableScope(tdTag)) {
+        ASSERT(!m_tree.openElements().inTableScope(thTag));
</ins><span class="cx">         processFakeEndTag(tdTag);
</span><span class="cx">         return;
</span><span class="cx">     }
</span><del>-    ASSERT(m_tree.openElements()-&gt;inTableScope(thTag));
</del><ins>+    ASSERT(m_tree.openElements().inTableScope(thTag));
</ins><span class="cx">     processFakeEndTag(thTag);
</span><span class="cx">     ASSERT(m_insertionMode == InsertionMode::InRow);
</span><span class="cx"> }
</span><span class="lines">@@ -979,14 +979,14 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(token.type() == HTMLToken::StartTag);
</span><span class="cx">     if (token.name() == captionTag) {
</span><del>-        m_tree.openElements()-&gt;popUntilTableScopeMarker();
-        m_tree.activeFormattingElements()-&gt;appendMarker();
</del><ins>+        m_tree.openElements().popUntilTableScopeMarker();
+        m_tree.activeFormattingElements().appendMarker();
</ins><span class="cx">         m_tree.insertHTMLElement(&amp;token);
</span><span class="cx">         m_insertionMode = InsertionMode::InCaption;
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     if (token.name() == colgroupTag) {
</span><del>-        m_tree.openElements()-&gt;popUntilTableScopeMarker();
</del><ins>+        m_tree.openElements().popUntilTableScopeMarker();
</ins><span class="cx">         m_tree.insertHTMLElement(&amp;token);
</span><span class="cx">         m_insertionMode = InsertionMode::InColumnGroup;
</span><span class="cx">         return;
</span><span class="lines">@@ -998,7 +998,7 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     if (isTableBodyContextTag(token.name())) {
</span><del>-        m_tree.openElements()-&gt;popUntilTableScopeMarker();
</del><ins>+        m_tree.openElements().popUntilTableScopeMarker();
</ins><span class="cx">         m_tree.insertHTMLElement(&amp;token);
</span><span class="cx">         m_insertionMode = InsertionMode::InTableBody;
</span><span class="cx">         return;
</span><span class="lines">@@ -1036,7 +1036,7 @@
</span><span class="cx">         if (m_tree.form() &amp;&amp; !isParsingTemplateContents())
</span><span class="cx">             return;
</span><span class="cx">         m_tree.insertHTMLFormElement(&amp;token, true);
</span><del>-        m_tree.openElements()-&gt;pop();
</del><ins>+        m_tree.openElements().pop();
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> #if ENABLE(TEMPLATE_ELEMENT)
</span><span class="lines">@@ -1115,10 +1115,9 @@
</span><span class="cx"> #endif
</span><span class="cx">             || token.name() == titleTag) {
</span><span class="cx">             parseError(token);
</span><del>-            ASSERT(m_tree.head());
-            m_tree.openElements()-&gt;pushHTMLHeadElement(m_tree.headStackItem());
</del><ins>+            m_tree.openElements().pushHTMLHeadElement(m_tree.headStackItem());
</ins><span class="cx">             processStartTagForInHead(token);
</span><del>-            m_tree.openElements()-&gt;removeHTMLHeadElement(m_tree.head());
</del><ins>+            m_tree.openElements().removeHTMLHeadElement(&amp;m_tree.head());
</ins><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx">         if (token.name() == headTag) {
</span><span class="lines">@@ -1172,7 +1171,7 @@
</span><span class="cx">         break;
</span><span class="cx">     case InsertionMode::InTableBody:
</span><span class="cx">         if (token.name() == trTag) {
</span><del>-            m_tree.openElements()-&gt;popUntilTableBodyScopeMarker(); // How is there ever anything to pop?
</del><ins>+            m_tree.openElements().popUntilTableBodyScopeMarker(); // How is there ever anything to pop?
</ins><span class="cx">             m_tree.insertHTMLElement(&amp;token);
</span><span class="cx">             m_insertionMode = InsertionMode::InRow;
</span><span class="cx">             return;
</span><span class="lines">@@ -1186,14 +1185,14 @@
</span><span class="cx">         }
</span><span class="cx">         if (isCaptionColOrColgroupTag(token.name()) || isTableBodyContextTag(token.name())) {
</span><span class="cx">             // FIXME: This is slow.
</span><del>-            if (!m_tree.openElements()-&gt;inTableScope(tbodyTag) &amp;&amp; !m_tree.openElements()-&gt;inTableScope(theadTag) &amp;&amp; !m_tree.openElements()-&gt;inTableScope(tfootTag)) {
</del><ins>+            if (!m_tree.openElements().inTableScope(tbodyTag) &amp;&amp; !m_tree.openElements().inTableScope(theadTag) &amp;&amp; !m_tree.openElements().inTableScope(tfootTag)) {
</ins><span class="cx">                 ASSERT(isParsingFragmentOrTemplateContents());
</span><span class="cx">                 parseError(token);
</span><span class="cx">                 return;
</span><span class="cx">             }
</span><del>-            m_tree.openElements()-&gt;popUntilTableBodyScopeMarker();
-            ASSERT(isTableBodyContextTag(m_tree.currentStackItem()-&gt;localName()));
-            processFakeEndTag(m_tree.currentStackItem()-&gt;localName());
</del><ins>+            m_tree.openElements().popUntilTableBodyScopeMarker();
+            ASSERT(isTableBodyContextTag(m_tree.currentStackItem().localName()));
+            processFakeEndTag(m_tree.currentStackItem().localName());
</ins><span class="cx">             processStartTag(token);
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="lines">@@ -1201,10 +1200,10 @@
</span><span class="cx">         break;
</span><span class="cx">     case InsertionMode::InRow:
</span><span class="cx">         if (isTableCellContextTag(token.name())) {
</span><del>-            m_tree.openElements()-&gt;popUntilTableRowScopeMarker();
</del><ins>+            m_tree.openElements().popUntilTableRowScopeMarker();
</ins><span class="cx">             m_tree.insertHTMLElement(&amp;token);
</span><span class="cx">             m_insertionMode = InsertionMode::InCell;
</span><del>-            m_tree.activeFormattingElements()-&gt;appendMarker();
</del><ins>+            m_tree.activeFormattingElements().appendMarker();
</ins><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx">         if (token.name() == trTag
</span><span class="lines">@@ -1226,7 +1225,7 @@
</span><span class="cx">             || token.name() == trTag
</span><span class="cx">             || isTableBodyContextTag(token.name())) {
</span><span class="cx">             // FIXME: This could be more efficient.
</span><del>-            if (!m_tree.openElements()-&gt;inTableScope(tdTag) &amp;&amp; !m_tree.openElements()-&gt;inTableScope(thTag)) {
</del><ins>+            if (!m_tree.openElements().inTableScope(tdTag) &amp;&amp; !m_tree.openElements().inTableScope(thTag)) {
</ins><span class="cx">                 ASSERT(isParsingFragment());
</span><span class="cx">                 parseError(token);
</span><span class="cx">                 return;
</span><span class="lines">@@ -1324,7 +1323,7 @@
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx">         if (token.name() == optionTag) {
</span><del>-            if (is&lt;HTMLOptionElement&gt;(*m_tree.currentStackItem()-&gt;node())) {
</del><ins>+            if (is&lt;HTMLOptionElement&gt;(m_tree.currentStackItem().node())) {
</ins><span class="cx">                 AtomicHTMLToken endOption(HTMLToken::EndTag, optionTag.localName());
</span><span class="cx">                 processEndTag(endOption);
</span><span class="cx">             }
</span><span class="lines">@@ -1332,11 +1331,11 @@
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx">         if (token.name() == optgroupTag) {
</span><del>-            if (is&lt;HTMLOptionElement&gt;(*m_tree.currentStackItem()-&gt;node())) {
</del><ins>+            if (is&lt;HTMLOptionElement&gt;(m_tree.currentStackItem().node())) {
</ins><span class="cx">                 AtomicHTMLToken endOption(HTMLToken::EndTag, optionTag.localName());
</span><span class="cx">                 processEndTag(endOption);
</span><span class="cx">             }
</span><del>-            if (is&lt;HTMLOptGroupElement&gt;(*m_tree.currentStackItem()-&gt;node())) {
</del><ins>+            if (is&lt;HTMLOptGroupElement&gt;(m_tree.currentStackItem().node())) {
</ins><span class="cx">                 AtomicHTMLToken endOptgroup(HTMLToken::EndTag, optgroupTag.localName());
</span><span class="cx">                 processEndTag(endOptgroup);
</span><span class="cx">             }
</span><span class="lines">@@ -1351,7 +1350,7 @@
</span><span class="cx">         }
</span><span class="cx">         if (token.name() == inputTag || token.name() == keygenTag || token.name() == textareaTag) {
</span><span class="cx">             parseError(token);
</span><del>-            if (!m_tree.openElements()-&gt;inSelectScope(selectTag)) {
</del><ins>+            if (!m_tree.openElements().inSelectScope(selectTag)) {
</ins><span class="cx">                 ASSERT(isParsingFragment());
</span><span class="cx">                 return;
</span><span class="cx">             }
</span><span class="lines">@@ -1423,7 +1422,7 @@
</span><span class="cx"> {
</span><span class="cx">     parseError(token);
</span><span class="cx"> #if ENABLE(TEMPLATE_ELEMENT)
</span><del>-    if (m_tree.openElements()-&gt;hasTemplateInHTMLScope()) {
</del><ins>+    if (m_tree.openElements().hasTemplateInHTMLScope()) {
</ins><span class="cx">         ASSERT(isParsingTemplateContents());
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="lines">@@ -1435,7 +1434,7 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(token.type() == HTMLToken::EndTag);
</span><span class="cx">     ASSERT(token.name() == bodyTag);
</span><del>-    if (!m_tree.openElements()-&gt;inScope(bodyTag.localName())) {
</del><ins>+    if (!m_tree.openElements().inScope(bodyTag.localName())) {
</ins><span class="cx">         parseError(token);
</span><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="lines">@@ -1447,16 +1446,16 @@
</span><span class="cx"> void HTMLTreeBuilder::processAnyOtherEndTagForInBody(AtomicHTMLToken&amp; token)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(token.type() == HTMLToken::EndTag);
</span><del>-    for (auto* record = m_tree.openElements()-&gt;topRecord(); ; record = record-&gt;next()) {
-        HTMLStackItem&amp; item = *record-&gt;stackItem();
</del><ins>+    for (auto* record = &amp;m_tree.openElements().topRecord(); ; record = record-&gt;next()) {
+        HTMLStackItem&amp; item = record-&gt;stackItem();
</ins><span class="cx">         if (item.matchesHTMLTag(token.name())) {
</span><span class="cx">             m_tree.generateImpliedEndTagsWithExclusion(token.name());
</span><del>-            if (!m_tree.currentStackItem()-&gt;matchesHTMLTag(token.name()))
</del><ins>+            if (!m_tree.currentStackItem().matchesHTMLTag(token.name()))
</ins><span class="cx">                 parseError(token);
</span><del>-            m_tree.openElements()-&gt;popUntilPopped(item.element());
</del><ins>+            m_tree.openElements().popUntilPopped(&amp;item.element());
</ins><span class="cx">             return;
</span><span class="cx">         }
</span><del>-        if (item.isSpecialNode()) {
</del><ins>+        if (isSpecialNode(item)) {
</ins><span class="cx">             parseError(token);
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="lines">@@ -1476,39 +1475,39 @@
</span><span class="cx">     // 1, 2, 3 and 16 are covered by the for() loop.
</span><span class="cx">     for (int i = 0; i &lt; outerIterationLimit; ++i) {
</span><span class="cx">         // 4.
</span><del>-        Element* formattingElement = m_tree.activeFormattingElements()-&gt;closestElementInScopeWithName(token.name());
</del><ins>+        Element* formattingElement = m_tree.activeFormattingElements().closestElementInScopeWithName(token.name());
</ins><span class="cx">         // 4.a
</span><span class="cx">         if (!formattingElement)
</span><span class="cx">             return processAnyOtherEndTagForInBody(token);
</span><span class="cx">         // 4.c
</span><del>-        if ((m_tree.openElements()-&gt;contains(formattingElement)) &amp;&amp; !m_tree.openElements()-&gt;inScope(formattingElement)) {
</del><ins>+        if ((m_tree.openElements().contains(formattingElement)) &amp;&amp; !m_tree.openElements().inScope(formattingElement)) {
</ins><span class="cx">             parseError(token);
</span><span class="cx">             notImplemented(); // Check the stack of open elements for a more specific parse error.
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx">         // 4.b
</span><del>-        auto* formattingElementRecord = m_tree.openElements()-&gt;find(formattingElement);
</del><ins>+        auto* formattingElementRecord = m_tree.openElements().find(formattingElement);
</ins><span class="cx">         if (!formattingElementRecord) {
</span><span class="cx">             parseError(token);
</span><del>-            m_tree.activeFormattingElements()-&gt;remove(formattingElement);
</del><ins>+            m_tree.activeFormattingElements().remove(formattingElement);
</ins><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx">         // 4.d
</span><del>-        if (formattingElement != m_tree.currentElement())
</del><ins>+        if (formattingElement != &amp;m_tree.currentElement())
</ins><span class="cx">             parseError(token);
</span><span class="cx">         // 5.
</span><del>-        auto* furthestBlock = m_tree.openElements()-&gt;furthestBlockForFormattingElement(formattingElement);
</del><ins>+        auto* furthestBlock = m_tree.openElements().furthestBlockForFormattingElement(formattingElement);
</ins><span class="cx">         // 6.
</span><span class="cx">         if (!furthestBlock) {
</span><del>-            m_tree.openElements()-&gt;popUntilPopped(formattingElement);
-            m_tree.activeFormattingElements()-&gt;remove(formattingElement);
</del><ins>+            m_tree.openElements().popUntilPopped(formattingElement);
+            m_tree.activeFormattingElements().remove(formattingElement);
</ins><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx">         // 7.
</span><span class="cx">         ASSERT(furthestBlock-&gt;isAbove(formattingElementRecord));
</span><del>-        RefPtr&lt;HTMLStackItem&gt; commonAncestor = formattingElementRecord-&gt;next()-&gt;stackItem();
</del><ins>+        Ref&lt;HTMLStackItem&gt; commonAncestor = formattingElementRecord-&gt;next()-&gt;stackItem();
</ins><span class="cx">         // 8.
</span><del>-        HTMLFormattingElementList::Bookmark bookmark = m_tree.activeFormattingElements()-&gt;bookmarkFor(formattingElement);
</del><ins>+        HTMLFormattingElementList::Bookmark bookmark = m_tree.activeFormattingElements().bookmarkFor(formattingElement);
</ins><span class="cx">         // 9.
</span><span class="cx">         auto* node = furthestBlock;
</span><span class="cx">         auto* nextNode = node-&gt;next();
</span><span class="lines">@@ -1520,8 +1519,8 @@
</span><span class="cx">             ASSERT(node);
</span><span class="cx">             nextNode = node-&gt;next(); // Save node-&gt;next() for the next iteration in case node is deleted in 9.5.
</span><span class="cx">             // 9.5
</span><del>-            if (!m_tree.activeFormattingElements()-&gt;contains(node-&gt;element())) {
-                m_tree.openElements()-&gt;remove(node-&gt;element());
</del><ins>+            if (!m_tree.activeFormattingElements().contains(&amp;node-&gt;element())) {
+                m_tree.openElements().remove(&amp;node-&gt;element());
</ins><span class="cx">                 node = 0;
</span><span class="cx">                 continue;
</span><span class="cx">             }
</span><span class="lines">@@ -1529,10 +1528,10 @@
</span><span class="cx">             if (node == formattingElementRecord)
</span><span class="cx">                 break;
</span><span class="cx">             // 9.7
</span><del>-            RefPtr&lt;HTMLStackItem&gt; newItem = m_tree.createElementFromSavedToken(node-&gt;stackItem().get());
</del><ins>+            RefPtr&lt;HTMLStackItem&gt; newItem = m_tree.createElementFromSavedToken(&amp;node-&gt;stackItem());
</ins><span class="cx"> 
</span><del>-            HTMLFormattingElementList::Entry* nodeEntry = m_tree.activeFormattingElements()-&gt;find(node-&gt;element());
-            nodeEntry-&gt;replaceElement(newItem);
</del><ins>+            HTMLFormattingElementList::Entry* nodeEntry = m_tree.activeFormattingElements().find(&amp;node-&gt;element());
+            nodeEntry-&gt;replaceElement(newItem.copyRef());
</ins><span class="cx">             node-&gt;replaceElement(newItem.release());
</span><span class="cx"> 
</span><span class="cx">             // 9.8
</span><span class="lines">@@ -1544,18 +1543,18 @@
</span><span class="cx">             lastNode = node;
</span><span class="cx">         }
</span><span class="cx">         // 10.
</span><del>-        m_tree.insertAlreadyParsedChild(*commonAncestor, *lastNode);
</del><ins>+        m_tree.insertAlreadyParsedChild(commonAncestor.get(), *lastNode);
</ins><span class="cx">         // 11.
</span><del>-        RefPtr&lt;HTMLStackItem&gt; newItem = m_tree.createElementFromSavedToken(formattingElementRecord-&gt;stackItem().get());
</del><ins>+        RefPtr&lt;HTMLStackItem&gt; newItem = m_tree.createElementFromSavedToken(&amp;formattingElementRecord-&gt;stackItem());
</ins><span class="cx">         // 12.
</span><span class="cx">         m_tree.takeAllChildren(*newItem, *furthestBlock);
</span><span class="cx">         // 13.
</span><span class="cx">         m_tree.reparent(*furthestBlock, *newItem);
</span><span class="cx">         // 14.
</span><del>-        m_tree.activeFormattingElements()-&gt;swapTo(formattingElement, newItem, bookmark);
</del><ins>+        m_tree.activeFormattingElements().swapTo(formattingElement, newItem, bookmark);
</ins><span class="cx">         // 15.
</span><del>-        m_tree.openElements()-&gt;remove(formattingElement);
-        m_tree.openElements()-&gt;insertAbove(newItem, furthestBlock);
</del><ins>+        m_tree.openElements().remove(formattingElement);
+        m_tree.openElements().insertAbove(newItem, furthestBlock);
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1563,9 +1562,9 @@
</span><span class="cx"> {
</span><span class="cx">     // http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#reset-the-insertion-mode-appropriately
</span><span class="cx">     bool last = false;
</span><del>-    for (auto* record = m_tree.openElements()-&gt;topRecord(); ; record = record-&gt;next()) {
-        HTMLStackItem* item = record-&gt;stackItem().get();
-        if (item-&gt;node() == m_tree.openElements()-&gt;rootNode()) {
</del><ins>+    for (auto* record = &amp;m_tree.openElements().topRecord(); ; record = record-&gt;next()) {
+        HTMLStackItem* item = &amp;record-&gt;stackItem();
+        if (&amp;item-&gt;node() == &amp;m_tree.openElements().rootNode()) {
</ins><span class="cx">             last = true;
</span><span class="cx"> #if ENABLE(TEMPLATE_ELEMENT)
</span><span class="cx">             bool shouldCreateItem = isParsingFragment();
</span><span class="lines">@@ -1586,10 +1585,10 @@
</span><span class="cx">         if (item-&gt;hasTagName(selectTag)) {
</span><span class="cx"> #if ENABLE(TEMPLATE_ELEMENT)
</span><span class="cx">             if (!last) {
</span><del>-                while (item-&gt;node() != m_tree.openElements()-&gt;rootNode() &amp;&amp; !item-&gt;hasTagName(templateTag)) {
</del><ins>+                while (&amp;item-&gt;node() != &amp;m_tree.openElements().rootNode() &amp;&amp; !item-&gt;hasTagName(templateTag)) {
</ins><span class="cx">                     record = record-&gt;next();
</span><del>-                    item = record-&gt;stackItem().get();
-                    if (is&lt;HTMLTableElement&gt;(*item-&gt;node())) {
</del><ins>+                    item = &amp;record-&gt;stackItem();
+                    if (is&lt;HTMLTableElement&gt;(item-&gt;node())) {
</ins><span class="cx">                         m_insertionMode = InsertionMode::InSelectInTable;
</span><span class="cx">                         return;
</span><span class="cx">                     }
</span><span class="lines">@@ -1619,13 +1618,13 @@
</span><span class="cx">             m_insertionMode = InsertionMode::InColumnGroup;
</span><span class="cx">             return;
</span><span class="cx">         }
</span><del>-        if (is&lt;HTMLTableElement&gt;(*item-&gt;node())) {
</del><ins>+        if (is&lt;HTMLTableElement&gt;(item-&gt;node())) {
</ins><span class="cx">             m_insertionMode = InsertionMode::InTable;
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx">         if (item-&gt;hasTagName(headTag)) {
</span><span class="cx"> #if ENABLE(TEMPLATE_ELEMENT)
</span><del>-            if (!m_fragmentContext.fragment() || &amp;m_fragmentContext.contextElement() != item-&gt;node()) {
</del><ins>+            if (!m_fragmentContext.fragment() || &amp;m_fragmentContext.contextElement() != &amp;item-&gt;node()) {
</ins><span class="cx">                 m_insertionMode = InsertionMode::InHead;
</span><span class="cx">                 return;
</span><span class="cx">             }
</span><span class="lines">@@ -1662,25 +1661,25 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(token.type() == HTMLToken::EndTag);
</span><span class="cx">     if (isTableBodyContextTag(token.name())) {
</span><del>-        if (!m_tree.openElements()-&gt;inTableScope(token.name())) {
</del><ins>+        if (!m_tree.openElements().inTableScope(token.name())) {
</ins><span class="cx">             parseError(token);
</span><span class="cx">             return;
</span><span class="cx">         }
</span><del>-        m_tree.openElements()-&gt;popUntilTableBodyScopeMarker();
-        m_tree.openElements()-&gt;pop();
</del><ins>+        m_tree.openElements().popUntilTableBodyScopeMarker();
+        m_tree.openElements().pop();
</ins><span class="cx">         m_insertionMode = InsertionMode::InTable;
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     if (token.name() == tableTag) {
</span><span class="cx">         // FIXME: This is slow.
</span><del>-        if (!m_tree.openElements()-&gt;inTableScope(tbodyTag) &amp;&amp; !m_tree.openElements()-&gt;inTableScope(theadTag) &amp;&amp; !m_tree.openElements()-&gt;inTableScope(tfootTag)) {
</del><ins>+        if (!m_tree.openElements().inTableScope(tbodyTag) &amp;&amp; !m_tree.openElements().inTableScope(theadTag) &amp;&amp; !m_tree.openElements().inTableScope(tfootTag)) {
</ins><span class="cx">             ASSERT(isParsingFragmentOrTemplateContents());
</span><span class="cx">             parseError(token);
</span><span class="cx">             return;
</span><span class="cx">         }
</span><del>-        m_tree.openElements()-&gt;popUntilTableBodyScopeMarker();
-        ASSERT(isTableBodyContextTag(m_tree.currentStackItem()-&gt;localName()));
-        processFakeEndTag(m_tree.currentStackItem()-&gt;localName());
</del><ins>+        m_tree.openElements().popUntilTableBodyScopeMarker();
+        ASSERT(isTableBodyContextTag(m_tree.currentStackItem().localName()));
+        processFakeEndTag(m_tree.currentStackItem().localName());
</ins><span class="cx">         processEndTag(token);
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="lines">@@ -1712,7 +1711,7 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     if (isTableBodyContextTag(token.name())) {
</span><del>-        if (!m_tree.openElements()-&gt;inTableScope(token.name())) {
</del><ins>+        if (!m_tree.openElements().inTableScope(token.name())) {
</ins><span class="cx">             parseError(token);
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="lines">@@ -1735,15 +1734,15 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(token.type() == HTMLToken::EndTag);
</span><span class="cx">     if (isTableCellContextTag(token.name())) {
</span><del>-        if (!m_tree.openElements()-&gt;inTableScope(token.name())) {
</del><ins>+        if (!m_tree.openElements().inTableScope(token.name())) {
</ins><span class="cx">             parseError(token);
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx">         m_tree.generateImpliedEndTags();
</span><del>-        if (!m_tree.currentStackItem()-&gt;matchesHTMLTag(token.name()))
</del><ins>+        if (!m_tree.currentStackItem().matchesHTMLTag(token.name()))
</ins><span class="cx">             parseError(token);
</span><del>-        m_tree.openElements()-&gt;popUntilPopped(token.name());
-        m_tree.activeFormattingElements()-&gt;clearToLastMarker();
</del><ins>+        m_tree.openElements().popUntilPopped(token.name());
+        m_tree.activeFormattingElements().clearToLastMarker();
</ins><span class="cx">         m_insertionMode = InsertionMode::InRow;
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="lines">@@ -1756,9 +1755,9 @@
</span><span class="cx">     if (token.name() == tableTag
</span><span class="cx">         || token.name() == trTag
</span><span class="cx">         || isTableBodyContextTag(token.name())) {
</span><del>-        if (!m_tree.openElements()-&gt;inTableScope(token.name())) {
</del><ins>+        if (!m_tree.openElements().inTableScope(token.name())) {
</ins><span class="cx"> #if ENABLE(TEMPLATE_ELEMENT)
</span><del>-            ASSERT(isTableBodyContextTag(token.name()) || m_tree.openElements()-&gt;inTableScope(templateTag) || isParsingFragment());
</del><ins>+            ASSERT(isTableBodyContextTag(token.name()) || m_tree.openElements().inTableScope(templateTag) || isParsingFragment());
</ins><span class="cx"> #else
</span><span class="cx">             ASSERT(isTableBodyContextTag(token.name()) || isParsingFragment());
</span><span class="cx"> #endif
</span><span class="lines">@@ -1810,83 +1809,83 @@
</span><span class="cx">         || token.name() == sectionTag
</span><span class="cx">         || token.name() == summaryTag
</span><span class="cx">         || token.name() == ulTag) {
</span><del>-        if (!m_tree.openElements()-&gt;inScope(token.name())) {
</del><ins>+        if (!m_tree.openElements().inScope(token.name())) {
</ins><span class="cx">             parseError(token);
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx">         m_tree.generateImpliedEndTags();
</span><del>-        if (!m_tree.currentStackItem()-&gt;matchesHTMLTag(token.name()))
</del><ins>+        if (!m_tree.currentStackItem().matchesHTMLTag(token.name()))
</ins><span class="cx">             parseError(token);
</span><del>-        m_tree.openElements()-&gt;popUntilPopped(token.name());
</del><ins>+        m_tree.openElements().popUntilPopped(token.name());
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     if (token.name() == formTag) {
</span><span class="cx">         if (!isParsingTemplateContents()) {
</span><span class="cx">             RefPtr&lt;Element&gt; node = m_tree.takeForm();
</span><del>-            if (!node || !m_tree.openElements()-&gt;inScope(node.get())) {
</del><ins>+            if (!node || !m_tree.openElements().inScope(node.get())) {
</ins><span class="cx">                 parseError(token);
</span><span class="cx">                 return;
</span><span class="cx">             }
</span><span class="cx">             m_tree.generateImpliedEndTags();
</span><del>-            if (m_tree.currentNode() != node.get())
</del><ins>+            if (&amp;m_tree.currentNode() != node.get())
</ins><span class="cx">                 parseError(token);
</span><del>-            m_tree.openElements()-&gt;remove(node.get());
</del><ins>+            m_tree.openElements().remove(node.get());
</ins><span class="cx">         } else {
</span><del>-            if (!m_tree.openElements()-&gt;inScope(token.name())) {
</del><ins>+            if (!m_tree.openElements().inScope(token.name())) {
</ins><span class="cx">                 parseError(token);
</span><span class="cx">                 return;
</span><span class="cx">             }
</span><span class="cx">             m_tree.generateImpliedEndTags();
</span><del>-            if (!m_tree.currentNode()-&gt;hasTagName(formTag))
</del><ins>+            if (!m_tree.currentNode().hasTagName(formTag))
</ins><span class="cx">                 parseError(token);
</span><del>-            m_tree.openElements()-&gt;popUntilPopped(token.name());
</del><ins>+            m_tree.openElements().popUntilPopped(token.name());
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     if (token.name() == pTag) {
</span><del>-        if (!m_tree.openElements()-&gt;inButtonScope(token.name())) {
</del><ins>+        if (!m_tree.openElements().inButtonScope(token.name())) {
</ins><span class="cx">             parseError(token);
</span><span class="cx">             processFakeStartTag(pTag);
</span><del>-            ASSERT(m_tree.openElements()-&gt;inScope(token.name()));
</del><ins>+            ASSERT(m_tree.openElements().inScope(token.name()));
</ins><span class="cx">             processEndTag(token);
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx">         m_tree.generateImpliedEndTagsWithExclusion(token.name());
</span><del>-        if (!m_tree.currentStackItem()-&gt;matchesHTMLTag(token.name()))
</del><ins>+        if (!m_tree.currentStackItem().matchesHTMLTag(token.name()))
</ins><span class="cx">             parseError(token);
</span><del>-        m_tree.openElements()-&gt;popUntilPopped(token.name());
</del><ins>+        m_tree.openElements().popUntilPopped(token.name());
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     if (token.name() == liTag) {
</span><del>-        if (!m_tree.openElements()-&gt;inListItemScope(token.name())) {
</del><ins>+        if (!m_tree.openElements().inListItemScope(token.name())) {
</ins><span class="cx">             parseError(token);
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx">         m_tree.generateImpliedEndTagsWithExclusion(token.name());
</span><del>-        if (!m_tree.currentStackItem()-&gt;matchesHTMLTag(token.name()))
</del><ins>+        if (!m_tree.currentStackItem().matchesHTMLTag(token.name()))
</ins><span class="cx">             parseError(token);
</span><del>-        m_tree.openElements()-&gt;popUntilPopped(token.name());
</del><ins>+        m_tree.openElements().popUntilPopped(token.name());
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     if (token.name() == ddTag || token.name() == dtTag) {
</span><del>-        if (!m_tree.openElements()-&gt;inScope(token.name())) {
</del><ins>+        if (!m_tree.openElements().inScope(token.name())) {
</ins><span class="cx">             parseError(token);
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx">         m_tree.generateImpliedEndTagsWithExclusion(token.name());
</span><del>-        if (!m_tree.currentStackItem()-&gt;matchesHTMLTag(token.name()))
</del><ins>+        if (!m_tree.currentStackItem().matchesHTMLTag(token.name()))
</ins><span class="cx">             parseError(token);
</span><del>-        m_tree.openElements()-&gt;popUntilPopped(token.name());
</del><ins>+        m_tree.openElements().popUntilPopped(token.name());
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     if (isNumberedHeaderTag(token.name())) {
</span><del>-        if (!m_tree.openElements()-&gt;hasNumberedHeaderElementInScope()) {
</del><ins>+        if (!m_tree.openElements().hasNumberedHeaderElementInScope()) {
</ins><span class="cx">             parseError(token);
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx">         m_tree.generateImpliedEndTags();
</span><del>-        if (!m_tree.currentStackItem()-&gt;matchesHTMLTag(token.name()))
</del><ins>+        if (!m_tree.currentStackItem().matchesHTMLTag(token.name()))
</ins><span class="cx">             parseError(token);
</span><del>-        m_tree.openElements()-&gt;popUntilNumberedHeaderElementPopped();
</del><ins>+        m_tree.openElements().popUntilNumberedHeaderElementPopped();
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     if (isFormattingTag(token.name())) {
</span><span class="lines">@@ -1894,15 +1893,15 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     if (token.name() == appletTag || token.name() == marqueeTag || token.name() == objectTag) {
</span><del>-        if (!m_tree.openElements()-&gt;inScope(token.name())) {
</del><ins>+        if (!m_tree.openElements().inScope(token.name())) {
</ins><span class="cx">             parseError(token);
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx">         m_tree.generateImpliedEndTags();
</span><del>-        if (!m_tree.currentStackItem()-&gt;matchesHTMLTag(token.name()))
</del><ins>+        if (!m_tree.currentStackItem().matchesHTMLTag(token.name()))
</ins><span class="cx">             parseError(token);
</span><del>-        m_tree.openElements()-&gt;popUntilPopped(token.name());
-        m_tree.activeFormattingElements()-&gt;clearToLastMarker();
</del><ins>+        m_tree.openElements().popUntilPopped(token.name());
+        m_tree.activeFormattingElements().clearToLastMarker();
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     if (token.name() == brTag) {
</span><span class="lines">@@ -1921,41 +1920,41 @@
</span><span class="cx"> 
</span><span class="cx"> bool HTMLTreeBuilder::processCaptionEndTagForInCaption()
</span><span class="cx"> {
</span><del>-    if (!m_tree.openElements()-&gt;inTableScope(captionTag.localName())) {
</del><ins>+    if (!m_tree.openElements().inTableScope(captionTag.localName())) {
</ins><span class="cx">         ASSERT(isParsingFragment());
</span><span class="cx">         // FIXME: parse error
</span><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx">     m_tree.generateImpliedEndTags();
</span><del>-    // FIXME: parse error if (!m_tree.currentStackItem()-&gt;hasTagName(captionTag))
-    m_tree.openElements()-&gt;popUntilPopped(captionTag.localName());
-    m_tree.activeFormattingElements()-&gt;clearToLastMarker();
</del><ins>+    // FIXME: parse error if (!m_tree.currentStackItem().hasTagName(captionTag))
+    m_tree.openElements().popUntilPopped(captionTag.localName());
+    m_tree.activeFormattingElements().clearToLastMarker();
</ins><span class="cx">     m_insertionMode = InsertionMode::InTable;
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool HTMLTreeBuilder::processTrEndTagForInRow()
</span><span class="cx"> {
</span><del>-    if (!m_tree.openElements()-&gt;inTableScope(trTag)) {
</del><ins>+    if (!m_tree.openElements().inTableScope(trTag)) {
</ins><span class="cx">         ASSERT(isParsingFragmentOrTemplateContents());
</span><span class="cx">         // FIXME: parse error
</span><span class="cx">         return false;
</span><span class="cx">     }
</span><del>-    m_tree.openElements()-&gt;popUntilTableRowScopeMarker();
-    ASSERT(m_tree.currentStackItem()-&gt;hasTagName(trTag));
-    m_tree.openElements()-&gt;pop();
</del><ins>+    m_tree.openElements().popUntilTableRowScopeMarker();
+    ASSERT(m_tree.currentStackItem().hasTagName(trTag));
+    m_tree.openElements().pop();
</ins><span class="cx">     m_insertionMode = InsertionMode::InTableBody;
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool HTMLTreeBuilder::processTableEndTagForInTable()
</span><span class="cx"> {
</span><del>-    if (!m_tree.openElements()-&gt;inTableScope(tableTag)) {
</del><ins>+    if (!m_tree.openElements().inTableScope(tableTag)) {
</ins><span class="cx">         ASSERT(isParsingFragmentOrTemplateContents());
</span><span class="cx">         // FIXME: parse error.
</span><span class="cx">         return false;
</span><span class="cx">     }
</span><del>-    m_tree.openElements()-&gt;popUntilPopped(tableTag.localName());
</del><ins>+    m_tree.openElements().popUntilPopped(tableTag.localName());
</ins><span class="cx">     resetInsertionModeAppropriately();
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="lines">@@ -2017,7 +2016,7 @@
</span><span class="cx">         }
</span><span class="cx"> #endif
</span><span class="cx">         if (token.name() == headTag) {
</span><del>-            m_tree.openElements()-&gt;popHTMLHeadElement();
</del><ins>+            m_tree.openElements().popHTMLHeadElement();
</ins><span class="cx">             m_insertionMode = InsertionMode::AfterHead;
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="lines">@@ -2116,9 +2115,9 @@
</span><span class="cx">         break;
</span><span class="cx">     case InsertionMode::InHeadNoscript:
</span><span class="cx">         if (token.name() == noscriptTag) {
</span><del>-            ASSERT(m_tree.currentStackItem()-&gt;hasTagName(noscriptTag));
-            m_tree.openElements()-&gt;pop();
-            ASSERT(m_tree.currentStackItem()-&gt;hasTagName(headTag));
</del><ins>+            ASSERT(m_tree.currentStackItem().hasTagName(noscriptTag));
+            m_tree.openElements().pop();
+            ASSERT(m_tree.currentStackItem().hasTagName(headTag));
</ins><span class="cx">             m_insertionMode = InsertionMode::InHead;
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="lines">@@ -2132,10 +2131,10 @@
</span><span class="cx">     case InsertionMode::Text:
</span><span class="cx">         if (token.name() == scriptTag) {
</span><span class="cx">             // Pause ourselves so that parsing stops until the script can be processed by the caller.
</span><del>-            ASSERT(m_tree.currentStackItem()-&gt;hasTagName(scriptTag));
</del><ins>+            ASSERT(m_tree.currentStackItem().hasTagName(scriptTag));
</ins><span class="cx">             if (scriptingContentIsAllowed(m_tree.parserContentPolicy()))
</span><del>-                m_scriptToProcess = m_tree.currentElement();
-            m_tree.openElements()-&gt;pop();
</del><ins>+                m_scriptToProcess = &amp;m_tree.currentElement();
+            m_tree.openElements().pop();
</ins><span class="cx">             m_insertionMode = m_originalInsertionMode;
</span><span class="cx"> 
</span><span class="cx">             // This token will not have been created by the tokenizer if a
</span><span class="lines">@@ -2146,22 +2145,22 @@
</span><span class="cx">             m_parser.tokenizer().setState(HTMLTokenizer::DataState);
</span><span class="cx">             return;
</span><span class="cx">         }
</span><del>-        m_tree.openElements()-&gt;pop();
</del><ins>+        m_tree.openElements().pop();
</ins><span class="cx">         m_insertionMode = m_originalInsertionMode;
</span><span class="cx">         break;
</span><span class="cx">     case InsertionMode::InFrameset:
</span><span class="cx">         if (token.name() == framesetTag) {
</span><span class="cx">             bool ignoreFramesetForFragmentParsing  = m_tree.currentIsRootNode();
</span><span class="cx"> #if ENABLE(TEMPLATE_ELEMENT)
</span><del>-            ignoreFramesetForFragmentParsing = ignoreFramesetForFragmentParsing || m_tree.openElements()-&gt;hasTemplateInHTMLScope();
</del><ins>+            ignoreFramesetForFragmentParsing = ignoreFramesetForFragmentParsing || m_tree.openElements().hasTemplateInHTMLScope();
</ins><span class="cx"> #endif
</span><span class="cx">             if (ignoreFramesetForFragmentParsing) {
</span><span class="cx">                 ASSERT(isParsingFragmentOrTemplateContents());
</span><span class="cx">                 parseError(token);
</span><span class="cx">                 return;
</span><span class="cx">             }
</span><del>-            m_tree.openElements()-&gt;pop();
-            if (!isParsingFragment() &amp;&amp; !m_tree.currentStackItem()-&gt;hasTagName(framesetTag))
</del><ins>+            m_tree.openElements().pop();
+            if (!isParsingFragment() &amp;&amp; !m_tree.currentStackItem().hasTagName(framesetTag))
</ins><span class="cx">                 m_insertionMode = InsertionMode::AfterFrameset;
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="lines">@@ -2189,7 +2188,7 @@
</span><span class="cx">             || token.name() == trTag
</span><span class="cx">             || isTableCellContextTag(token.name())) {
</span><span class="cx">             parseError(token);
</span><del>-            if (m_tree.openElements()-&gt;inTableScope(token.name())) {
</del><ins>+            if (m_tree.openElements().inTableScope(token.name())) {
</ins><span class="cx">                 AtomicHTMLToken endSelect(HTMLToken::EndTag, selectTag.localName());
</span><span class="cx">                 processEndTag(endSelect);
</span><span class="cx">                 processEndTag(token);
</span><span class="lines">@@ -2200,30 +2199,30 @@
</span><span class="cx">     case InsertionMode::InSelect:
</span><span class="cx">         ASSERT(m_insertionMode == InsertionMode::InSelect || m_insertionMode == InsertionMode::InSelectInTable);
</span><span class="cx">         if (token.name() == optgroupTag) {
</span><del>-            if (is&lt;HTMLOptionElement&gt;(*m_tree.currentStackItem()-&gt;node()) &amp;&amp; m_tree.oneBelowTop() &amp;&amp; is&lt;HTMLOptGroupElement&gt;(*m_tree.oneBelowTop()-&gt;node()))
</del><ins>+            if (is&lt;HTMLOptionElement&gt;(m_tree.currentStackItem().node()) &amp;&amp; m_tree.oneBelowTop() &amp;&amp; is&lt;HTMLOptGroupElement&gt;(m_tree.oneBelowTop()-&gt;node()))
</ins><span class="cx">                 processFakeEndTag(optionTag);
</span><del>-            if (is&lt;HTMLOptGroupElement&gt;(*m_tree.currentStackItem()-&gt;node())) {
-                m_tree.openElements()-&gt;pop();
</del><ins>+            if (is&lt;HTMLOptGroupElement&gt;(m_tree.currentStackItem().node())) {
+                m_tree.openElements().pop();
</ins><span class="cx">                 return;
</span><span class="cx">             }
</span><span class="cx">             parseError(token);
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx">         if (token.name() == optionTag) {
</span><del>-            if (is&lt;HTMLOptionElement&gt;(*m_tree.currentStackItem()-&gt;node())) {
-                m_tree.openElements()-&gt;pop();
</del><ins>+            if (is&lt;HTMLOptionElement&gt;(m_tree.currentStackItem().node())) {
+                m_tree.openElements().pop();
</ins><span class="cx">                 return;
</span><span class="cx">             }
</span><span class="cx">             parseError(token);
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx">         if (token.name() == selectTag) {
</span><del>-            if (!m_tree.openElements()-&gt;inSelectScope(token.name())) {
</del><ins>+            if (!m_tree.openElements().inSelectScope(token.name())) {
</ins><span class="cx">                 ASSERT(isParsingFragment());
</span><span class="cx">                 parseError(token);
</span><span class="cx">                 return;
</span><span class="cx">             }
</span><del>-            m_tree.openElements()-&gt;popUntilPopped(selectTag.localName());
</del><ins>+            m_tree.openElements().popUntilPopped(selectTag.localName());
</ins><span class="cx">             resetInsertionModeAppropriately();
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="lines">@@ -2442,12 +2441,12 @@
</span><span class="cx">     case InsertionMode::InTableBody:
</span><span class="cx">     case InsertionMode::InRow:
</span><span class="cx">         ASSERT(m_pendingTableCharacters.isEmpty());
</span><del>-        if (m_tree.currentStackItem()-&gt;isElementNode()
-            &amp;&amp; (is&lt;HTMLTableElement&gt;(*m_tree.currentStackItem()-&gt;element())
-                || m_tree.currentStackItem()-&gt;hasTagName(HTMLNames::tbodyTag)
-                || m_tree.currentStackItem()-&gt;hasTagName(HTMLNames::tfootTag)
-                || m_tree.currentStackItem()-&gt;hasTagName(HTMLNames::theadTag)
-                || m_tree.currentStackItem()-&gt;hasTagName(HTMLNames::trTag))) {
</del><ins>+        if (is&lt;HTMLTableElement&gt;(m_tree.currentStackItem().node())
+            || m_tree.currentStackItem().hasTagName(HTMLNames::tbodyTag)
+            || m_tree.currentStackItem().hasTagName(HTMLNames::tfootTag)
+            || m_tree.currentStackItem().hasTagName(HTMLNames::theadTag)
+            || m_tree.currentStackItem().hasTagName(HTMLNames::trTag)) {
+
</ins><span class="cx">             m_originalInsertionMode = m_insertionMode;
</span><span class="cx">             m_insertionMode = InsertionMode::InTableText;
</span><span class="cx">             // Note that we fall through to the InsertionMode::InTableText case below.
</span><span class="lines">@@ -2586,9 +2585,9 @@
</span><span class="cx">             return; // FIXME: Should we break here instead of returning?
</span><span class="cx">         }
</span><span class="cx"> #if ENABLE(TEMPLATE_ELEMENT)
</span><del>-        ASSERT(m_tree.currentNode()-&gt;hasTagName(colgroupTag) || m_tree.currentNode()-&gt;hasTagName(templateTag));
</del><ins>+        ASSERT(m_tree.currentNode().hasTagName(colgroupTag) || m_tree.currentNode().hasTagName(templateTag));
</ins><span class="cx"> #else
</span><del>-        ASSERT(m_tree.currentNode()-&gt;hasTagName(colgroupTag));
</del><ins>+        ASSERT(m_tree.currentNode().hasTagName(colgroupTag));
</ins><span class="cx"> #endif
</span><span class="cx">         processColgroupEndTagForInColumnGroup();
</span><span class="cx">         FALLTHROUGH;
</span><span class="lines">@@ -2598,7 +2597,7 @@
</span><span class="cx">     case InsertionMode::InSelectInTable:
</span><span class="cx">     case InsertionMode::InSelect:
</span><span class="cx">         ASSERT(m_insertionMode == InsertionMode::InSelect || m_insertionMode == InsertionMode::InSelectInTable || m_insertionMode == InsertionMode::InTable || m_insertionMode == InsertionMode::InFrameset || m_insertionMode == InsertionMode::InTableBody || m_insertionMode == InsertionMode::InColumnGroup);
</span><del>-        if (m_tree.currentNode() != m_tree.openElements()-&gt;rootNode())
</del><ins>+        if (&amp;m_tree.currentNode() != &amp;m_tree.openElements().rootNode())
</ins><span class="cx">             parseError(token);
</span><span class="cx"> #if ENABLE(TEMPLATE_ELEMENT)
</span><span class="cx">         if (!m_templateInsertionModes.isEmpty()) {
</span><span class="lines">@@ -2613,9 +2612,9 @@
</span><span class="cx">         return;
</span><span class="cx">     case InsertionMode::Text:
</span><span class="cx">         parseError(token);
</span><del>-        if (m_tree.currentStackItem()-&gt;hasTagName(scriptTag))
</del><ins>+        if (m_tree.currentStackItem().hasTagName(scriptTag))
</ins><span class="cx">             notImplemented(); // mark the script element as &quot;already started&quot;.
</span><del>-        m_tree.openElements()-&gt;pop();
</del><ins>+        m_tree.openElements().pop();
</ins><span class="cx">         ASSERT(m_originalInsertionMode != InsertionMode::Text);
</span><span class="cx">         m_insertionMode = m_originalInsertionMode;
</span><span class="cx">         processEndOfFile(token);
</span><span class="lines">@@ -2627,8 +2626,7 @@
</span><span class="cx">         break;
</span><span class="cx"> #endif
</span><span class="cx">     }
</span><del>-    ASSERT(m_tree.currentNode());
-    m_tree.openElements()-&gt;popAll();
</del><ins>+    m_tree.openElements().popAll();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLTreeBuilder::defaultForInitial()
</span><span class="lines">@@ -2777,10 +2775,10 @@
</span><span class="cx"> HTMLStackItem&amp; HTMLTreeBuilder::adjustedCurrentStackItem() const
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!m_tree.isEmpty());
</span><del>-    if (isParsingFragment() &amp;&amp; m_tree.openElements()-&gt;hasOnlyOneElement())
</del><ins>+    if (isParsingFragment() &amp;&amp; m_tree.openElements().hasOnlyOneElement())
</ins><span class="cx">         return m_fragmentContext.contextElementStackItem();
</span><span class="cx"> 
</span><del>-    return *m_tree.currentStackItem();
</del><ins>+    return m_tree.currentStackItem();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // http://www.whatwg.org/specs/web-apps/current-work/multipage/tree-construction.html#tree-construction
</span><span class="lines">@@ -2789,9 +2787,9 @@
</span><span class="cx">     if (m_tree.isEmpty())
</span><span class="cx">         return false;
</span><span class="cx">     HTMLStackItem&amp; adjustedCurrentNode = adjustedCurrentStackItem();
</span><del>-    if (adjustedCurrentNode.isInHTMLNamespace())
</del><ins>+    if (isInHTMLNamespace(adjustedCurrentNode))
</ins><span class="cx">         return false;
</span><del>-    if (HTMLElementStack::isMathMLTextIntegrationPoint(&amp;adjustedCurrentNode)) {
</del><ins>+    if (HTMLElementStack::isMathMLTextIntegrationPoint(adjustedCurrentNode)) {
</ins><span class="cx">         if (token.type() == HTMLToken::StartTag
</span><span class="cx">             &amp;&amp; token.name() != MathMLNames::mglyphTag
</span><span class="cx">             &amp;&amp; token.name() != MathMLNames::malignmarkTag)
</span><span class="lines">@@ -2803,7 +2801,7 @@
</span><span class="cx">         &amp;&amp; token.type() == HTMLToken::StartTag
</span><span class="cx">         &amp;&amp; token.name() == SVGNames::svgTag)
</span><span class="cx">         return false;
</span><del>-    if (HTMLElementStack::isHTMLIntegrationPoint(&amp;adjustedCurrentNode)) {
</del><ins>+    if (HTMLElementStack::isHTMLIntegrationPoint(adjustedCurrentNode)) {
</ins><span class="cx">         if (token.type() == HTMLToken::StartTag)
</span><span class="cx">             return false;
</span><span class="cx">         if (token.type() == HTMLToken::Character)
</span><span class="lines">@@ -2867,7 +2865,7 @@
</span><span class="cx">             || token.name() == varTag
</span><span class="cx">             || (token.name() == fontTag &amp;&amp; (token.getAttributeItem(colorAttr) || token.getAttributeItem(faceAttr) || token.getAttributeItem(sizeAttr)))) {
</span><span class="cx">             parseError(token);
</span><del>-            m_tree.openElements()-&gt;popUntilForeignContentScopeMarker();
</del><ins>+            m_tree.openElements().popUntilForeignContentScopeMarker();
</ins><span class="cx">             processStartTag(token);
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="lines">@@ -2886,25 +2884,25 @@
</span><span class="cx">         if (adjustedCurrentNode.namespaceURI() == SVGNames::svgNamespaceURI)
</span><span class="cx">             adjustSVGTagNameCase(token);
</span><span class="cx"> 
</span><del>-        if (token.name() == SVGNames::scriptTag &amp;&amp; m_tree.currentStackItem()-&gt;hasTagName(SVGNames::scriptTag)) {
</del><ins>+        if (token.name() == SVGNames::scriptTag &amp;&amp; m_tree.currentStackItem().hasTagName(SVGNames::scriptTag)) {
</ins><span class="cx">             if (scriptingContentIsAllowed(m_tree.parserContentPolicy()))
</span><del>-                m_scriptToProcess = m_tree.currentElement();
-            m_tree.openElements()-&gt;pop();
</del><ins>+                m_scriptToProcess = &amp;m_tree.currentElement();
+            m_tree.openElements().pop();
</ins><span class="cx">             return;
</span><span class="cx">         }
</span><del>-        if (!m_tree.currentStackItem()-&gt;isInHTMLNamespace()) {
</del><ins>+        if (!isInHTMLNamespace(m_tree.currentStackItem())) {
</ins><span class="cx">             // FIXME: This code just wants an Element* iterator, instead of an ElementRecord*
</span><del>-            auto* nodeRecord = m_tree.openElements()-&gt;topRecord();
-            if (!nodeRecord-&gt;stackItem()-&gt;hasLocalName(token.name()))
</del><ins>+            auto* nodeRecord = &amp;m_tree.openElements().topRecord();
+            if (nodeRecord-&gt;stackItem().localName() != token.name())
</ins><span class="cx">                 parseError(token);
</span><span class="cx">             while (1) {
</span><del>-                if (nodeRecord-&gt;stackItem()-&gt;hasLocalName(token.name())) {
-                    m_tree.openElements()-&gt;popUntilPopped(nodeRecord-&gt;element());
</del><ins>+                if (nodeRecord-&gt;stackItem().localName() == token.name()) {
+                    m_tree.openElements().popUntilPopped(&amp;nodeRecord-&gt;element());
</ins><span class="cx">                     return;
</span><span class="cx">                 }
</span><span class="cx">                 nodeRecord = nodeRecord-&gt;next();
</span><span class="cx"> 
</span><del>-                if (nodeRecord-&gt;stackItem()-&gt;isInHTMLNamespace())
</del><ins>+                if (isInHTMLNamespace(nodeRecord-&gt;stackItem()))
</ins><span class="cx">                     break;
</span><span class="cx">             }
</span><span class="cx">         }
</span></span></pre>
</div>
</div>

</body>
</html>