<!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>[195465] 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/195465">195465</a></dd>
<dt>Author</dt> <dd>antti@apple.com</dd>
<dt>Date</dt> <dd>2016-01-22 12:00:34 -0800 (Fri, 22 Jan 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Style resolver initialization cleanups
https://bugs.webkit.org/show_bug.cgi?id=153356

Reviewed by Simon Fraser.

    Simplify StyleResolver::State initialization.
    Also use more references and other cleanups.

* css/MediaQueryMatcher.cpp:
(WebCore::MediaQueryMatcher::prepareEvaluator):
* css/StyleMedia.cpp:
(WebCore::StyleMedia::matchMedium):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::State::clear):
(WebCore::StyleResolver::StyleResolver):
(WebCore::StyleResolver::classNamesAffectedByRules):
(WebCore::StyleResolver::State::State):

    Initialize State using a constructor instead of bunch of construction functions.
    Remove m_styledElement field which is just a casted version of m_element.

(WebCore::StyleResolver::State::updateConversionData):
(WebCore::StyleResolver::State::setStyle):
(WebCore::StyleResolver::sharingCandidateHasIdenticalStyleAffectingAttributes):
(WebCore::StyleResolver::canShareStyleWithElement):
(WebCore::StyleResolver::locateSharedStyle):
(WebCore::isAtShadowBoundary):
(WebCore::StyleResolver::styleForElement):
(WebCore::StyleResolver::styleForKeyframe):
(WebCore::StyleResolver::keyframeStylesForAnimation):
(WebCore::StyleResolver::pseudoStyleForElement):
(WebCore::StyleResolver::styleForPage):
(WebCore::StyleResolver::pseudoStyleRulesForElement):
(WebCore::StyleResolver::clearCachedPropertiesAffectedByViewportUnits):
(WebCore::isCacheableInMatchedPropertiesCache):

    Disallow caching of document element style entirely because the writing-mode and direction properties have special handling.
    The existing check wasn't robust.

(WebCore::extractDirectionAndWritingMode):
(WebCore::StyleResolver::applyMatchedProperties):
(WebCore::StyleResolver::applyPropertyToStyle):
(WebCore::StyleResolver::State::initElement): Deleted.
(WebCore::StyleResolver::initElement): Deleted.
(WebCore::StyleResolver::State::initForStyleResolve): Deleted.
* css/StyleResolver.h:
(WebCore::StyleResolver::mediaQueryEvaluator):
(WebCore::StyleResolver::State::State):
(WebCore::StyleResolver::State::document):
(WebCore::StyleResolver::State::element):
(WebCore::StyleResolver::State::style):
(WebCore::StyleResolver::State::takeStyle):
(WebCore::StyleResolver::State::styledElement): Deleted.
* dom/Element.cpp:
(WebCore::Element::resolveStyle):
* page/animation/KeyframeAnimation.cpp:
(WebCore::KeyframeAnimation::KeyframeAnimation):
* rendering/RenderElement.cpp:
(WebCore::RenderElement::getUncachedPseudoStyle):
(WebCore::RenderElement::containingBlockForFixedPosition):
* rendering/RenderNamedFlowFragment.cpp:
(WebCore::RenderNamedFlowFragment::computeStyleInRegion):
* style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::styleForElement):
* svg/SVGElement.cpp:
(WebCore::SVGElement::customStyleForRenderer):
(WebCore::SVGElement::computedStyle):
(WebCore::addQualifiedName):
* svg/SVGElementRareData.h:
(WebCore::SVGElementRareData::ensureAnimatedSMILStyleProperties):
(WebCore::SVGElementRareData::overrideComputedStyle):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssMediaQueryMatchercpp">trunk/Source/WebCore/css/MediaQueryMatcher.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStyleMediacpp">trunk/Source/WebCore/css/StyleMedia.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStyleResolvercpp">trunk/Source/WebCore/css/StyleResolver.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStyleResolverh">trunk/Source/WebCore/css/StyleResolver.h</a></li>
<li><a href="#trunkSourceWebCoredomElementcpp">trunk/Source/WebCore/dom/Element.cpp</a></li>
<li><a href="#trunkSourceWebCorepageanimationKeyframeAnimationcpp">trunk/Source/WebCore/page/animation/KeyframeAnimation.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderElementcpp">trunk/Source/WebCore/rendering/RenderElement.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderNamedFlowFragmentcpp">trunk/Source/WebCore/rendering/RenderNamedFlowFragment.cpp</a></li>
<li><a href="#trunkSourceWebCorestyleStyleTreeResolvercpp">trunk/Source/WebCore/style/StyleTreeResolver.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGElementcpp">trunk/Source/WebCore/svg/SVGElement.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGElementRareDatah">trunk/Source/WebCore/svg/SVGElementRareData.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (195464 => 195465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-01-22 19:44:54 UTC (rev 195464)
+++ trunk/Source/WebCore/ChangeLog        2016-01-22 20:00:34 UTC (rev 195465)
</span><span class="lines">@@ -1,3 +1,77 @@
</span><ins>+2016-01-22  Antti Koivisto  &lt;antti@apple.com&gt;
+
+        Style resolver initialization cleanups
+        https://bugs.webkit.org/show_bug.cgi?id=153356
+
+        Reviewed by Simon Fraser.
+
+            Simplify StyleResolver::State initialization.
+            Also use more references and other cleanups.
+
+        * css/MediaQueryMatcher.cpp:
+        (WebCore::MediaQueryMatcher::prepareEvaluator):
+        * css/StyleMedia.cpp:
+        (WebCore::StyleMedia::matchMedium):
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::State::clear):
+        (WebCore::StyleResolver::StyleResolver):
+        (WebCore::StyleResolver::classNamesAffectedByRules):
+        (WebCore::StyleResolver::State::State):
+
+            Initialize State using a constructor instead of bunch of construction functions.
+            Remove m_styledElement field which is just a casted version of m_element.
+
+        (WebCore::StyleResolver::State::updateConversionData):
+        (WebCore::StyleResolver::State::setStyle):
+        (WebCore::StyleResolver::sharingCandidateHasIdenticalStyleAffectingAttributes):
+        (WebCore::StyleResolver::canShareStyleWithElement):
+        (WebCore::StyleResolver::locateSharedStyle):
+        (WebCore::isAtShadowBoundary):
+        (WebCore::StyleResolver::styleForElement):
+        (WebCore::StyleResolver::styleForKeyframe):
+        (WebCore::StyleResolver::keyframeStylesForAnimation):
+        (WebCore::StyleResolver::pseudoStyleForElement):
+        (WebCore::StyleResolver::styleForPage):
+        (WebCore::StyleResolver::pseudoStyleRulesForElement):
+        (WebCore::StyleResolver::clearCachedPropertiesAffectedByViewportUnits):
+        (WebCore::isCacheableInMatchedPropertiesCache):
+
+            Disallow caching of document element style entirely because the writing-mode and direction properties have special handling.
+            The existing check wasn't robust.
+
+        (WebCore::extractDirectionAndWritingMode):
+        (WebCore::StyleResolver::applyMatchedProperties):
+        (WebCore::StyleResolver::applyPropertyToStyle):
+        (WebCore::StyleResolver::State::initElement): Deleted.
+        (WebCore::StyleResolver::initElement): Deleted.
+        (WebCore::StyleResolver::State::initForStyleResolve): Deleted.
+        * css/StyleResolver.h:
+        (WebCore::StyleResolver::mediaQueryEvaluator):
+        (WebCore::StyleResolver::State::State):
+        (WebCore::StyleResolver::State::document):
+        (WebCore::StyleResolver::State::element):
+        (WebCore::StyleResolver::State::style):
+        (WebCore::StyleResolver::State::takeStyle):
+        (WebCore::StyleResolver::State::styledElement): Deleted.
+        * dom/Element.cpp:
+        (WebCore::Element::resolveStyle):
+        * page/animation/KeyframeAnimation.cpp:
+        (WebCore::KeyframeAnimation::KeyframeAnimation):
+        * rendering/RenderElement.cpp:
+        (WebCore::RenderElement::getUncachedPseudoStyle):
+        (WebCore::RenderElement::containingBlockForFixedPosition):
+        * rendering/RenderNamedFlowFragment.cpp:
+        (WebCore::RenderNamedFlowFragment::computeStyleInRegion):
+        * style/StyleTreeResolver.cpp:
+        (WebCore::Style::TreeResolver::styleForElement):
+        * svg/SVGElement.cpp:
+        (WebCore::SVGElement::customStyleForRenderer):
+        (WebCore::SVGElement::computedStyle):
+        (WebCore::addQualifiedName):
+        * svg/SVGElementRareData.h:
+        (WebCore::SVGElementRareData::ensureAnimatedSMILStyleProperties):
+        (WebCore::SVGElementRareData::overrideComputedStyle):
+
</ins><span class="cx"> 2016-01-22  Chris Fleizach  &lt;cfleizach@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         AX: &lt;code&gt; group and friends should have a custom subrole
</span></span></pre></div>
<a id="trunkSourceWebCorecssMediaQueryMatchercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/MediaQueryMatcher.cpp (195464 => 195465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/MediaQueryMatcher.cpp        2016-01-22 19:44:54 UTC (rev 195464)
+++ trunk/Source/WebCore/css/MediaQueryMatcher.cpp        2016-01-22 20:00:34 UTC (rev 195465)
</span><span class="lines">@@ -85,7 +85,7 @@
</span><span class="cx">     if (!documentElement)
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><del>-    RefPtr&lt;RenderStyle&gt; rootStyle = m_document-&gt;ensureStyleResolver().styleForElement(documentElement, m_document-&gt;renderStyle(), DisallowStyleSharing, MatchOnlyUserAgentRules);
</del><ins>+    RefPtr&lt;RenderStyle&gt; rootStyle = m_document-&gt;ensureStyleResolver().styleForElement(*documentElement, m_document-&gt;renderStyle(), DisallowStyleSharing, MatchOnlyUserAgentRules);
</ins><span class="cx"> 
</span><span class="cx">     return std::make_unique&lt;MediaQueryEvaluator&gt;(mediaType(), m_document-&gt;frame(), rootStyle.get());
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleMediacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleMedia.cpp (195464 => 195465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleMedia.cpp        2016-01-22 19:44:54 UTC (rev 195464)
+++ trunk/Source/WebCore/css/StyleMedia.cpp        2016-01-22 20:00:34 UTC (rev 195465)
</span><span class="lines">@@ -61,7 +61,7 @@
</span><span class="cx">     if (!documentElement)
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    RefPtr&lt;RenderStyle&gt; rootStyle = document-&gt;ensureStyleResolver().styleForElement(documentElement, document-&gt;renderStyle(), DisallowStyleSharing, MatchOnlyUserAgentRules);
</del><ins>+    RefPtr&lt;RenderStyle&gt; rootStyle = document-&gt;ensureStyleResolver().styleForElement(*documentElement, document-&gt;renderStyle(), DisallowStyleSharing, MatchOnlyUserAgentRules);
</ins><span class="cx"> 
</span><span class="cx">     RefPtr&lt;MediaQuerySet&gt; media = MediaQuerySet::create();
</span><span class="cx">     if (!media-&gt;parse(query))
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleResolvercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleResolver.cpp (195464 => 195465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleResolver.cpp        2016-01-22 19:44:54 UTC (rev 195464)
+++ trunk/Source/WebCore/css/StyleResolver.cpp        2016-01-22 20:00:34 UTC (rev 195465)
</span><span class="lines">@@ -191,7 +191,6 @@
</span><span class="cx"> inline void StyleResolver::State::clear()
</span><span class="cx"> {
</span><span class="cx">     m_element = nullptr;
</span><del>-    m_styledElement = nullptr;
</del><span class="cx">     m_parentStyle = nullptr;
</span><span class="cx">     m_regionForStyling = nullptr;
</span><span class="cx">     m_pendingImageProperties.clear();
</span><span class="lines">@@ -265,7 +264,7 @@
</span><span class="cx">         m_medium = std::make_unique&lt;MediaQueryEvaluator&gt;(&quot;all&quot;);
</span><span class="cx"> 
</span><span class="cx">     if (root)
</span><del>-        m_rootDefaultStyle = styleForElement(root, m_document.renderStyle(), DisallowStyleSharing, MatchOnlyUserAgentRules);
</del><ins>+        m_rootDefaultStyle = styleForElement(*root, m_document.renderStyle(), DisallowStyleSharing, MatchOnlyUserAgentRules);
</ins><span class="cx"> 
</span><span class="cx">     if (m_rootDefaultStyle &amp;&amp; view)
</span><span class="cx">         m_medium = std::make_unique&lt;MediaQueryEvaluator&gt;(view-&gt;mediaType(), &amp;view-&gt;frame(), m_rootDefaultStyle.get());
</span><span class="lines">@@ -342,56 +341,29 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline void StyleResolver::State::updateConversionData()
</del><ins>+StyleResolver::State::State(Element&amp; element, RenderStyle* parentStyle, const RenderRegion* regionForStyling, const SelectorFilter* selectorFilter)
+    : m_element(&amp;element)
+    , m_parentStyle(parentStyle)
+    , m_regionForStyling(regionForStyling)
+    , m_elementLinkState(element.document().visitedLinkState().determineLinkState(element))
+    , m_selectorFilter(selectorFilter)
</ins><span class="cx"> {
</span><del>-    m_cssToLengthConversionData = CSSToLengthConversionData(m_style.get(), m_rootElementStyle, m_element ? document().renderView() : nullptr);
-}
</del><ins>+    bool resetStyleInheritance = hasShadowRootParent(element) &amp;&amp; downcast&lt;ShadowRoot&gt;(element.parentNode())-&gt;resetStyleInheritance();
+    if (resetStyleInheritance)
+        m_parentStyle = nullptr;
</ins><span class="cx"> 
</span><del>-inline void StyleResolver::State::initElement(Element* element)
-{
-    m_element = element;
-    m_styledElement = element &amp;&amp; is&lt;StyledElement&gt;(*element) ? downcast&lt;StyledElement&gt;(element) : nullptr;
-    m_elementLinkState = element ? element-&gt;document().visitedLinkState().determineLinkState(*element) : NotInsideLink;
</del><ins>+    auto&amp; document = element.document();
+    auto* documentElement = document.documentElement();
+    m_rootElementStyle = (!documentElement || documentElement == &amp;element) ? document.renderStyle() : documentElement-&gt;renderStyle();
+
</ins><span class="cx">     updateConversionData();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline void StyleResolver::initElement(Element* e)
</del><ins>+inline void StyleResolver::State::updateConversionData()
</ins><span class="cx"> {
</span><del>-    if (m_state.element() != e) {
-        m_state.initElement(e);
-        if (e &amp;&amp; e == e-&gt;document().documentElement()) {
-            e-&gt;document().setDirectionSetOnDocumentElement(false);
-            e-&gt;document().setWritingModeSetOnDocumentElement(false);
-        }
-    }
</del><ins>+    m_cssToLengthConversionData = CSSToLengthConversionData(m_style.get(), m_rootElementStyle, m_element ? document().renderView() : nullptr);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline void StyleResolver::State::initForStyleResolve(Document&amp; document, Element* e, RenderStyle* parentStyle, const RenderRegion* regionForStyling, const SelectorFilter* selectorFilter)
-{
-    m_regionForStyling = regionForStyling;
-
-    if (e) {
-        bool resetStyleInheritance = hasShadowRootParent(*e) &amp;&amp; downcast&lt;ShadowRoot&gt;(*e-&gt;parentNode()).resetStyleInheritance();
-        m_parentStyle = resetStyleInheritance ? nullptr : parentStyle;
-    } else
-        m_parentStyle = parentStyle;
-
-    Node* docElement = e ? e-&gt;document().documentElement() : nullptr;
-    RenderStyle* docStyle = document.renderStyle();
-    m_rootElementStyle = docElement &amp;&amp; e != docElement ? docElement-&gt;renderStyle() : docStyle;
-
-    m_style = nullptr;
-    m_pendingImageProperties.clear();
-    m_fontDirty = false;
-    
-    m_authorRollback = nullptr;
-    m_userRollback = nullptr;
-
-    m_selectorFilter = selectorFilter;
-
-    updateConversionData();
-}
-
</del><span class="cx"> inline void StyleResolver::State::setStyle(Ref&lt;RenderStyle&gt;&amp;&amp; style)
</span><span class="cx"> {
</span><span class="cx">     m_style = WTFMove(style);
</span><span class="lines">@@ -524,7 +496,7 @@
</span><span class="cx">     } else
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    if (state.styledElement()-&gt;presentationAttributeStyle() != sharingCandidate.presentationAttributeStyle())
</del><ins>+    if (downcast&lt;StyledElement&gt;(*state.element()).presentationAttributeStyle() != sharingCandidate.presentationAttributeStyle())
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     if (state.element()-&gt;hasTagName(progressTag)) {
</span><span class="lines">@@ -568,7 +540,7 @@
</span><span class="cx">         return false;
</span><span class="cx">     if (!sharingCandidateHasIdenticalStyleAffectingAttributes(element))
</span><span class="cx">         return false;
</span><del>-    if (element.additionalPresentationAttributeStyle() != state.styledElement()-&gt;additionalPresentationAttributeStyle())
</del><ins>+    if (element.additionalPresentationAttributeStyle() != downcast&lt;StyledElement&gt;(*state.element()).additionalPresentationAttributeStyle())
</ins><span class="cx">         return false;
</span><span class="cx">     if (element.affectsNextSiblingElementStyle() || element.styleIsAffectedByPreviousSibling())
</span><span class="cx">         return false;
</span><span class="lines">@@ -645,18 +617,19 @@
</span><span class="cx"> RenderStyle* StyleResolver::locateSharedStyle()
</span><span class="cx"> {
</span><span class="cx">     State&amp; state = m_state;
</span><del>-    if (!state.styledElement() || !state.parentStyle())
</del><ins>+    if (!is&lt;StyledElement&gt;(state.element()) || !state.parentStyle())
</ins><span class="cx">         return nullptr;
</span><ins>+    auto&amp; styledElement = downcast&lt;StyledElement&gt;(*state.element());
</ins><span class="cx"> 
</span><span class="cx">     // If the element has inline style it is probably unique.
</span><del>-    if (state.styledElement()-&gt;inlineStyle())
</del><ins>+    if (styledElement.inlineStyle())
</ins><span class="cx">         return nullptr;
</span><del>-    if (state.styledElement()-&gt;isSVGElement() &amp;&amp; downcast&lt;SVGElement&gt;(*state.styledElement()).animatedSMILStyleProperties())
</del><ins>+    if (styledElement.isSVGElement() &amp;&amp; downcast&lt;SVGElement&gt;(styledElement).animatedSMILStyleProperties())
</ins><span class="cx">         return nullptr;
</span><span class="cx">     // Ids stop style sharing if they show up in the stylesheets.
</span><del>-    if (state.styledElement()-&gt;hasID() &amp;&amp; m_ruleSets.features().idsInRules.contains(state.styledElement()-&gt;idForStyleResolution().impl()))
</del><ins>+    if (styledElement.hasID() &amp;&amp; m_ruleSets.features().idsInRules.contains(styledElement.idForStyleResolution().impl()))
</ins><span class="cx">         return nullptr;
</span><del>-    if (parentElementPreventsSharing(state.element()-&gt;parentElement()))
</del><ins>+    if (parentElementPreventsSharing(styledElement.parentElement()))
</ins><span class="cx">         return nullptr;
</span><span class="cx">     if (state.element() == state.document().cssTarget())
</span><span class="cx">         return nullptr;
</span><span class="lines">@@ -671,7 +644,7 @@
</span><span class="cx">     unsigned count = 0;
</span><span class="cx">     unsigned visitedNodeCount = 0;
</span><span class="cx">     StyledElement* shareElement = nullptr;
</span><del>-    Node* cousinList = state.styledElement()-&gt;previousSibling();
</del><ins>+    Node* cousinList = styledElement.previousSibling();
</ins><span class="cx">     while (cousinList) {
</span><span class="cx">         shareElement = findSiblingForStyleSharing(cousinList, count);
</span><span class="cx">         if (shareElement)
</span><span class="lines">@@ -690,7 +663,7 @@
</span><span class="cx">     if (styleSharingCandidateMatchesRuleSet(m_ruleSets.uncommonAttribute()))
</span><span class="cx">         return nullptr;
</span><span class="cx">     // Tracking child index requires unique style for each node. This may get set by the sibling rule match above.
</span><del>-    if (parentElementPreventsSharing(state.element()-&gt;parentElement()))
</del><ins>+    if (parentElementPreventsSharing(styledElement.parentElement()))
</ins><span class="cx">         return nullptr;
</span><span class="cx">     return shareElement-&gt;renderStyle();
</span><span class="cx"> }
</span><span class="lines">@@ -703,27 +676,33 @@
</span><span class="cx">     return parentNode &amp;&amp; parentNode-&gt;isShadowRoot();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Ref&lt;RenderStyle&gt; StyleResolver::styleForElement(Element* element, RenderStyle* defaultParent,
</del><ins>+Ref&lt;RenderStyle&gt; StyleResolver::styleForElement(Element&amp; element, RenderStyle* parentStyle,
</ins><span class="cx">     StyleSharingBehavior sharingBehavior, RuleMatchingBehavior matchingBehavior, const RenderRegion* regionForStyling, const SelectorFilter* selectorFilter)
</span><span class="cx"> {
</span><span class="cx">     RELEASE_ASSERT(!m_inLoadPendingImages);
</span><span class="cx"> 
</span><span class="cx">     // Once an element has a renderer, we don't try to destroy it, since otherwise the renderer
</span><span class="cx">     // will vanish if a style recalc happens during loading.
</span><del>-    if (sharingBehavior == AllowStyleSharing &amp;&amp; !element-&gt;document().haveStylesheetsLoaded() &amp;&amp; !element-&gt;renderer()) {
</del><ins>+    if (sharingBehavior == AllowStyleSharing &amp;&amp; !m_document.haveStylesheetsLoaded() &amp;&amp; !element.renderer()) {
</ins><span class="cx">         if (!s_styleNotYetAvailable) {
</span><span class="cx">             s_styleNotYetAvailable = &amp;RenderStyle::create().leakRef();
</span><span class="cx">             s_styleNotYetAvailable-&gt;setDisplay(NONE);
</span><del>-            s_styleNotYetAvailable-&gt;fontCascade().update(&amp;document().fontSelector());
</del><ins>+            s_styleNotYetAvailable-&gt;fontCascade().update(&amp;m_document.fontSelector());
</ins><span class="cx">         }
</span><del>-        element-&gt;document().setHasNodesWithPlaceholderStyle();
</del><ins>+        m_document.setHasNodesWithPlaceholderStyle();
</ins><span class="cx">         return *s_styleNotYetAvailable;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    m_state = State(element, parentStyle, regionForStyling, selectorFilter);
</ins><span class="cx">     State&amp; state = m_state;
</span><del>-    initElement(element);
-    state.initForStyleResolve(document(), element, defaultParent, regionForStyling, selectorFilter);
</del><span class="cx"> 
</span><ins>+    if (&amp;element == m_document.documentElement() &amp;&amp; matchingBehavior == MatchAllRules) {
+        // These bits may be set when resolving document element style.
+        // FIXME: Style resolver shouldn't mutate document.
+        m_document.setDirectionSetOnDocumentElement(false);
+        m_document.setWritingModeSetOnDocumentElement(false);
+    }
+
</ins><span class="cx">     if (sharingBehavior == AllowStyleSharing) {
</span><span class="cx">         if (RenderStyle* sharedStyle = locateSharedStyle()) {
</span><span class="cx">             state.clear();
</span><span class="lines">@@ -733,17 +712,17 @@
</span><span class="cx"> 
</span><span class="cx">     if (state.parentStyle()) {
</span><span class="cx">         state.setStyle(RenderStyle::create());
</span><del>-        state.style()-&gt;inheritFrom(state.parentStyle(), isAtShadowBoundary(element) ? RenderStyle::AtShadowBoundary : RenderStyle::NotAtShadowBoundary);
</del><ins>+        state.style()-&gt;inheritFrom(state.parentStyle(), isAtShadowBoundary(&amp;element) ? RenderStyle::AtShadowBoundary : RenderStyle::NotAtShadowBoundary);
</ins><span class="cx">     } else {
</span><span class="cx">         state.setStyle(defaultStyleForElement());
</span><span class="cx">         state.setParentStyle(RenderStyle::clone(state.style()));
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (element-&gt;isLink()) {
</del><ins>+    if (element.isLink()) {
</ins><span class="cx">         state.style()-&gt;setIsLink(true);
</span><span class="cx">         EInsideLink linkState = state.elementLinkState();
</span><span class="cx">         if (linkState != NotInsideLink) {
</span><del>-            bool forceVisited = InspectorInstrumentation::forcePseudoState(*element, CSSSelector::PseudoClassVisited);
</del><ins>+            bool forceVisited = InspectorInstrumentation::forcePseudoState(element, CSSSelector::PseudoClassVisited);
</ins><span class="cx">             if (forceVisited)
</span><span class="cx">                 linkState = InsideVisitedLink;
</span><span class="cx">         }
</span><span class="lines">@@ -751,11 +730,11 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     bool needsCollection = false;
</span><del>-    CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement(*element, needsCollection);
</del><ins>+    CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement(element, needsCollection);
</ins><span class="cx">     if (needsCollection)
</span><span class="cx">         m_ruleSets.collectFeatures();
</span><span class="cx"> 
</span><del>-    ElementRuleCollector collector(*element, state.style(), m_ruleSets, m_state.selectorFilter());
</del><ins>+    ElementRuleCollector collector(element, state.style(), m_ruleSets, m_state.selectorFilter());
</ins><span class="cx">     collector.setRegionForStyling(regionForStyling);
</span><span class="cx">     collector.setMedium(m_medium.get());
</span><span class="cx"> 
</span><span class="lines">@@ -767,7 +746,7 @@
</span><span class="cx">     applyMatchedProperties(collector.matchedResult(), element);
</span><span class="cx"> 
</span><span class="cx">     // Clean up our style object's display and text decorations (among other fixups).
</span><del>-    adjustRenderStyle(*state.style(), *state.parentStyle(), element);
</del><ins>+    adjustRenderStyle(*state.style(), *state.parentStyle(), &amp;element);
</ins><span class="cx"> 
</span><span class="cx">     if (state.style()-&gt;hasViewportUnits())
</span><span class="cx">         document().setHasStyleWithViewportUnits();
</span><span class="lines">@@ -836,12 +815,12 @@
</span><span class="cx">     return state.takeStyle();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void StyleResolver::keyframeStylesForAnimation(Element* e, const RenderStyle* elementStyle, KeyframeList&amp; list)
</del><ins>+void StyleResolver::keyframeStylesForAnimation(Element&amp; element, const RenderStyle* elementStyle, KeyframeList&amp; list)
</ins><span class="cx"> {
</span><span class="cx">     list.clear();
</span><span class="cx"> 
</span><span class="cx">     // Get the keyframesRule for this name
</span><del>-    if (!e || list.animationName().isEmpty())
</del><ins>+    if (list.animationName().isEmpty())
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     m_keyframesRuleMap.checkConsistency();
</span><span class="lines">@@ -856,8 +835,7 @@
</span><span class="cx">     const Vector&lt;RefPtr&lt;StyleKeyframe&gt;&gt;&amp; keyframes = keyframesRule-&gt;keyframes();
</span><span class="cx">     for (unsigned i = 0; i &lt; keyframes.size(); ++i) {
</span><span class="cx">         // Apply the declaration to the style. This is a simplified version of the logic in styleForElement
</span><del>-        initElement(e);
-        m_state.initForStyleResolve(document(), e, nullptr);
</del><ins>+        m_state = State(element, nullptr);
</ins><span class="cx"> 
</span><span class="cx">         const StyleKeyframe* keyframe = keyframes[i].get();
</span><span class="cx"> 
</span><span class="lines">@@ -897,18 +875,12 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;RenderStyle&gt; StyleResolver::pseudoStyleForElement(Element* element, const PseudoStyleRequest&amp; pseudoStyleRequest, RenderStyle* parentStyle)
</del><ins>+PassRefPtr&lt;RenderStyle&gt; StyleResolver::pseudoStyleForElement(Element&amp; element, const PseudoStyleRequest&amp; pseudoStyleRequest, RenderStyle&amp; parentStyle)
</ins><span class="cx"> {
</span><del>-    ASSERT(parentStyle);
-    if (!element)
-        return nullptr;
</del><ins>+    m_state = State(element, &amp;parentStyle);
</ins><span class="cx"> 
</span><span class="cx">     State&amp; state = m_state;
</span><span class="cx"> 
</span><del>-    initElement(element);
-
-    state.initForStyleResolve(document(), element, parentStyle);
-
</del><span class="cx">     if (m_state.parentStyle()) {
</span><span class="cx">         state.setStyle(RenderStyle::create());
</span><span class="cx">         state.style()-&gt;inheritFrom(m_state.parentStyle());
</span><span class="lines">@@ -921,7 +893,7 @@
</span><span class="cx">     // those rules.
</span><span class="cx"> 
</span><span class="cx">     // Check UA, user and author rules.
</span><del>-    ElementRuleCollector collector(*element, m_state.style(), m_ruleSets, m_state.selectorFilter());
</del><ins>+    ElementRuleCollector collector(element, m_state.style(), m_ruleSets, m_state.selectorFilter());
</ins><span class="cx">     collector.setPseudoStyleRequest(pseudoStyleRequest);
</span><span class="cx">     collector.setMedium(m_medium.get());
</span><span class="cx">     collector.matchUARules();
</span><span class="lines">@@ -955,8 +927,12 @@
</span><span class="cx"> {
</span><span class="cx">     RELEASE_ASSERT(!m_inLoadPendingImages);
</span><span class="cx"> 
</span><del>-    m_state.initForStyleResolve(m_document, m_document.documentElement(), m_document.renderStyle());
</del><ins>+    auto* documentElement = m_document.documentElement();
+    if (!documentElement)
+        return RenderStyle::create();
</ins><span class="cx"> 
</span><ins>+    m_state = State(*documentElement, m_document.renderStyle());
+
</ins><span class="cx">     m_state.setStyle(RenderStyle::create());
</span><span class="cx">     m_state.style()-&gt;inheritFrom(m_state.rootElementStyle());
</span><span class="cx"> 
</span><span class="lines">@@ -1397,10 +1373,9 @@
</span><span class="cx">     if (!element || !element-&gt;document().haveStylesheetsLoaded())
</span><span class="cx">         return Vector&lt;RefPtr&lt;StyleRule&gt;&gt;();
</span><span class="cx"> 
</span><del>-    initElement(element);
-    m_state.initForStyleResolve(document(), element, nullptr);
</del><ins>+    m_state = State(*element, nullptr);
</ins><span class="cx"> 
</span><del>-    ElementRuleCollector collector(*element, m_state.style(), m_ruleSets, m_state.selectorFilter());
</del><ins>+    ElementRuleCollector collector(*element, nullptr, m_ruleSets, m_state.selectorFilter());
</ins><span class="cx">     collector.setMode(SelectorChecker::Mode::CollectingRules);
</span><span class="cx">     collector.setPseudoStyleRequest(PseudoStyleRequest(pseudoId));
</span><span class="cx">     collector.setMedium(m_medium.get());
</span><span class="lines">@@ -1555,10 +1530,11 @@
</span><span class="cx">         m_matchedPropertiesCache.remove(key);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool isCacheableInMatchedPropertiesCache(const Element* element, const RenderStyle* style, const RenderStyle* parentStyle)
</del><ins>+static bool isCacheableInMatchedPropertiesCache(const Element&amp; element, const RenderStyle* style, const RenderStyle* parentStyle)
</ins><span class="cx"> {
</span><del>-    // FIXME: CSSPropertyWebkitWritingMode modifies state when applying to document element. We can't skip the applying by caching.
-    if (element == element-&gt;document().documentElement() &amp;&amp; element-&gt;document().writingModeSetOnDocumentElement())
</del><ins>+    // FIXME: Writing mode and direction properties modify state when applying to document element by calling
+    // Document::setWritingMode/DirectionSetOnDocumentElement. We can't skip the applying by caching.
+    if (&amp;element == element.document().documentElement())
</ins><span class="cx">         return false;
</span><span class="cx">     if (style-&gt;unique() || (style-&gt;styleType() != NOPSEUDO &amp;&amp; parentStyle-&gt;unique()))
</span><span class="cx">         return false;
</span><span class="lines">@@ -1607,9 +1583,8 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void StyleResolver::applyMatchedProperties(const MatchResult&amp; matchResult, const Element* element, ShouldUseMatchedPropertiesCache shouldUseMatchedPropertiesCache)
</del><ins>+void StyleResolver::applyMatchedProperties(const MatchResult&amp; matchResult, const Element&amp; element, ShouldUseMatchedPropertiesCache shouldUseMatchedPropertiesCache)
</ins><span class="cx"> {
</span><del>-    ASSERT(element);
</del><span class="cx">     State&amp; state = m_state;
</span><span class="cx">     unsigned cacheHash = shouldUseMatchedPropertiesCache &amp;&amp; matchResult.isCacheable ? computeMatchedPropertiesHash(matchResult.matchedProperties().data(), matchResult.matchedProperties().size()) : 0;
</span><span class="cx">     bool applyInheritedOnly = false;
</span><span class="lines">@@ -1620,7 +1595,7 @@
</span><span class="cx">         // style declarations. We then only need to apply the inherited properties, if any, as their values can depend on the 
</span><span class="cx">         // element context. This is fast and saves memory by reusing the style data structures.
</span><span class="cx">         state.style()-&gt;copyNonInheritedFrom(cacheItem-&gt;renderStyle.get());
</span><del>-        if (state.parentStyle()-&gt;inheritedDataShared(cacheItem-&gt;parentRenderStyle.get()) &amp;&amp; !isAtShadowBoundary(element)) {
</del><ins>+        if (state.parentStyle()-&gt;inheritedDataShared(cacheItem-&gt;parentRenderStyle.get()) &amp;&amp; !isAtShadowBoundary(&amp;element)) {
</ins><span class="cx">             EInsideLink linkStatus = state.style()-&gt;insideLink();
</span><span class="cx">             // If the cache item parent style has identical inherited properties to the current parent style then the
</span><span class="cx">             // resulting style will be identical too. We copy the inherited properties over from the cache and are done.
</span><span class="lines">@@ -1706,15 +1681,15 @@
</span><span class="cx">     
</span><span class="cx">     if (cacheItem || !cacheHash)
</span><span class="cx">         return;
</span><del>-    if (!isCacheableInMatchedPropertiesCache(state.element(), state.style(), state.parentStyle()))
</del><ins>+    if (!isCacheableInMatchedPropertiesCache(*state.element(), state.style(), state.parentStyle()))
</ins><span class="cx">         return;
</span><span class="cx">     addToMatchedPropertiesCache(state.style(), state.parentStyle(), cacheHash, matchResult);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void StyleResolver::applyPropertyToStyle(CSSPropertyID id, CSSValue* value, RenderStyle* style)
</span><span class="cx"> {
</span><del>-    initElement(nullptr);
-    m_state.initForStyleResolve(document(), nullptr, style);
</del><ins>+    m_state = State();
+    m_state.setParentStyle(*style);
</ins><span class="cx">     m_state.setStyle(*style);
</span><span class="cx">     applyPropertyToCurrentStyle(id, value);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleResolverh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleResolver.h (195464 => 195465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleResolver.h        2016-01-22 19:44:54 UTC (rev 195464)
+++ trunk/Source/WebCore/css/StyleResolver.h        2016-01-22 20:00:34 UTC (rev 195465)
</span><span class="lines">@@ -135,12 +135,12 @@
</span><span class="cx">     StyleResolver(Document&amp;);
</span><span class="cx">     ~StyleResolver();
</span><span class="cx"> 
</span><del>-    Ref&lt;RenderStyle&gt; styleForElement(Element*, RenderStyle* parentStyle, StyleSharingBehavior = AllowStyleSharing,
</del><ins>+    Ref&lt;RenderStyle&gt; styleForElement(Element&amp;, RenderStyle* parentStyle, StyleSharingBehavior = AllowStyleSharing,
</ins><span class="cx">         RuleMatchingBehavior = MatchAllRules, const RenderRegion* regionForStyling = nullptr, const SelectorFilter* = nullptr);
</span><span class="cx"> 
</span><del>-    void keyframeStylesForAnimation(Element*, const RenderStyle*, KeyframeList&amp;);
</del><ins>+    void keyframeStylesForAnimation(Element&amp;, const RenderStyle*, KeyframeList&amp;);
</ins><span class="cx"> 
</span><del>-    PassRefPtr&lt;RenderStyle&gt; pseudoStyleForElement(Element*, const PseudoStyleRequest&amp;, RenderStyle* parentStyle);
</del><ins>+    PassRefPtr&lt;RenderStyle&gt; pseudoStyleForElement(Element&amp;, const PseudoStyleRequest&amp;, RenderStyle&amp; parentStyle);
</ins><span class="cx"> 
</span><span class="cx">     Ref&lt;RenderStyle&gt; styleForPage(int pageIndex);
</span><span class="cx">     Ref&lt;RenderStyle&gt; defaultStyleForElement();
</span><span class="lines">@@ -160,7 +160,6 @@
</span><span class="cx">     const MediaQueryEvaluator&amp; mediaQueryEvaluator() const { return *m_medium; }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    void initElement(Element*);
</del><span class="cx">     RenderStyle* locateSharedStyle();
</span><span class="cx">     bool styleSharingCandidateMatchesRuleSet(RuleSet*);
</span><span class="cx">     Node* locateCousinList(Element* parent, unsigned&amp; visitedNodeCount) const;
</span><span class="lines">@@ -333,7 +332,7 @@
</span><span class="cx">     bool fastRejectSelector(const RuleData&amp;) const;
</span><span class="cx"> 
</span><span class="cx">     enum ShouldUseMatchedPropertiesCache { DoNotUseMatchedPropertiesCache = 0, UseMatchedPropertiesCache };
</span><del>-    void applyMatchedProperties(const MatchResult&amp;, const Element*, ShouldUseMatchedPropertiesCache = UseMatchedPropertiesCache);
</del><ins>+    void applyMatchedProperties(const MatchResult&amp;, const Element&amp;, ShouldUseMatchedPropertiesCache = UseMatchedPropertiesCache);
</ins><span class="cx"> 
</span><span class="cx">     void applyCascadedProperties(CascadedProperties&amp;, int firstProperty, int lastProperty, const MatchResult*);
</span><span class="cx">     void cascadeMatches(CascadedProperties&amp;, const MatchResult&amp;, bool important, int startIndex, int endIndex, bool inheritedOnly);
</span><span class="lines">@@ -359,33 +358,16 @@
</span><span class="cx">     typedef HashMap&lt;CSSPropertyID, RefPtr&lt;CSSValue&gt;&gt; PendingImagePropertyMap;
</span><span class="cx"> 
</span><span class="cx">     class State {
</span><del>-        WTF_MAKE_NONCOPYABLE(State);
</del><span class="cx">     public:
</span><del>-        State()
-            : m_element(nullptr)
-            , m_styledElement(nullptr)
-            , m_parentStyle(nullptr)
-            , m_rootElementStyle(nullptr)
-            , m_regionForStyling(nullptr)
-            , m_elementLinkState(NotInsideLink)
-            , m_elementAffectedByClassRules(false)
-            , m_applyPropertyToRegularStyle(true)
-            , m_applyPropertyToVisitedLinkStyle(false)
-            , m_fontDirty(false)
-            , m_fontSizeHasViewportUnits(false)
-            , m_hasUAAppearance(false)
-            , m_backgroundData(BackgroundFillLayer)
-        {
-        }
</del><ins>+        State() { }
+        State(Element&amp;, RenderStyle* parentStyle, const RenderRegion* regionForStyling = nullptr, const SelectorFilter* = nullptr);
</ins><span class="cx"> 
</span><span class="cx">     public:
</span><del>-        void initElement(Element*);
-        void initForStyleResolve(Document&amp;, Element*, RenderStyle* parentStyle, const RenderRegion* regionForStyling = nullptr, const SelectorFilter* = nullptr);
</del><span class="cx">         void clear();
</span><span class="cx"> 
</span><span class="cx">         Document&amp; document() const { return m_element-&gt;document(); }
</span><span class="cx">         Element* element() const { return m_element; }
</span><del>-        StyledElement* styledElement() const { return m_styledElement; }
</del><ins>+
</ins><span class="cx">         void setStyle(Ref&lt;RenderStyle&gt;&amp;&amp;);
</span><span class="cx">         RenderStyle* style() const { return m_style.get(); }
</span><span class="cx">         Ref&lt;RenderStyle&gt; takeStyle() { return m_style.releaseNonNull(); }
</span><span class="lines">@@ -444,34 +426,28 @@
</span><span class="cx">     private:
</span><span class="cx">         void updateConversionData();
</span><span class="cx"> 
</span><del>-        Element* m_element;
</del><ins>+        Element* m_element { nullptr };
</ins><span class="cx">         RefPtr&lt;RenderStyle&gt; m_style;
</span><del>-        StyledElement* m_styledElement;
</del><span class="cx">         RefPtr&lt;RenderStyle&gt; m_parentStyle;
</span><del>-        RenderStyle* m_rootElementStyle;
</del><ins>+        RenderStyle* m_rootElementStyle { nullptr };
</ins><span class="cx"> 
</span><del>-        // Required to ASSERT in applyProperties.
-        const RenderRegion* m_regionForStyling;
</del><ins>+        const RenderRegion* m_regionForStyling { nullptr };
</ins><span class="cx">         
</span><del>-        EInsideLink m_elementLinkState;
</del><ins>+        EInsideLink m_elementLinkState { NotInsideLink };
</ins><span class="cx"> 
</span><del>-        bool m_elementAffectedByClassRules;
</del><ins>+        bool m_elementAffectedByClassRules { false };
+        bool m_applyPropertyToRegularStyle { true };
+        bool m_applyPropertyToVisitedLinkStyle { false };
+        bool m_fontDirty { false };
+        bool m_fontSizeHasViewportUnits { false };
+        bool m_hasUAAppearance { false };
</ins><span class="cx"> 
</span><del>-        bool m_applyPropertyToRegularStyle;
-        bool m_applyPropertyToVisitedLinkStyle;
-
-        PendingImagePropertyMap m_pendingImageProperties;
-
-        Vector&lt;RefPtr&lt;ReferenceFilterOperation&gt;&gt; m_filtersWithPendingSVGDocuments;
-
-        bool m_fontDirty;
-        bool m_fontSizeHasViewportUnits;
-
-        bool m_hasUAAppearance;
</del><span class="cx">         BorderData m_borderData;
</span><del>-        FillLayer m_backgroundData;
</del><ins>+        FillLayer m_backgroundData { BackgroundFillLayer };
</ins><span class="cx">         Color m_backgroundColor;
</span><span class="cx"> 
</span><ins>+        PendingImagePropertyMap m_pendingImageProperties;
+        Vector&lt;RefPtr&lt;ReferenceFilterOperation&gt;&gt; m_filtersWithPendingSVGDocuments;
</ins><span class="cx">         CSSToLengthConversionData m_cssToLengthConversionData;
</span><span class="cx">         
</span><span class="cx">         CascadeLevel m_cascadeLevel { UserAgentLevel };
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.cpp (195464 => 195465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.cpp        2016-01-22 19:44:54 UTC (rev 195464)
+++ trunk/Source/WebCore/dom/Element.cpp        2016-01-22 20:00:34 UTC (rev 195465)
</span><span class="lines">@@ -1404,7 +1404,7 @@
</span><span class="cx"> 
</span><span class="cx"> Ref&lt;RenderStyle&gt; Element::resolveStyle(RenderStyle* parentStyle)
</span><span class="cx"> {
</span><del>-    return styleResolver().styleForElement(this, parentStyle);
</del><ins>+    return styleResolver().styleForElement(*this, parentStyle);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // Returns true is the given attribute is an event handler.
</span></span></pre></div>
<a id="trunkSourceWebCorepageanimationKeyframeAnimationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/animation/KeyframeAnimation.cpp (195464 => 195465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/animation/KeyframeAnimation.cpp        2016-01-22 19:44:54 UTC (rev 195464)
+++ trunk/Source/WebCore/page/animation/KeyframeAnimation.cpp        2016-01-22 20:00:34 UTC (rev 195465)
</span><span class="lines">@@ -49,7 +49,7 @@
</span><span class="cx"> {
</span><span class="cx">     // Get the keyframe RenderStyles
</span><span class="cx">     if (m_object &amp;&amp; m_object-&gt;element())
</span><del>-        m_object-&gt;element()-&gt;styleResolver().keyframeStylesForAnimation(m_object-&gt;element(), unanimatedStyle, m_keyframes);
</del><ins>+        m_object-&gt;element()-&gt;styleResolver().keyframeStylesForAnimation(*m_object-&gt;element(), unanimatedStyle, m_keyframes);
</ins><span class="cx"> 
</span><span class="cx">     // Update the m_transformFunctionListValid flag based on whether the function lists in the keyframes match.
</span><span class="cx">     validateTransformFunctionList();
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (195464 => 195465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderElement.cpp        2016-01-22 19:44:54 UTC (rev 195464)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp        2016-01-22 20:00:34 UTC (rev 195465)
</span><span class="lines">@@ -1590,12 +1590,12 @@
</span><span class="cx">     auto&amp; styleResolver = element()-&gt;styleResolver();
</span><span class="cx"> 
</span><span class="cx">     if (pseudoStyleRequest.pseudoId == FIRST_LINE_INHERITED) {
</span><del>-        RefPtr&lt;RenderStyle&gt; result = styleResolver.styleForElement(element(), parentStyle, DisallowStyleSharing);
</del><ins>+        RefPtr&lt;RenderStyle&gt; result = styleResolver.styleForElement(*element(), parentStyle, DisallowStyleSharing);
</ins><span class="cx">         result-&gt;setStyleType(FIRST_LINE_INHERITED);
</span><span class="cx">         return result.release();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return styleResolver.pseudoStyleForElement(element(), pseudoStyleRequest, parentStyle);
</del><ins>+    return styleResolver.pseudoStyleForElement(*element(), pseudoStyleRequest, *parentStyle);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> RenderBlock* RenderElement::containingBlockForFixedPosition() const
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderNamedFlowFragmentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderNamedFlowFragment.cpp (195464 => 195465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderNamedFlowFragment.cpp        2016-01-22 19:44:54 UTC (rev 195464)
+++ trunk/Source/WebCore/rendering/RenderNamedFlowFragment.cpp        2016-01-22 20:00:34 UTC (rev 195465)
</span><span class="lines">@@ -352,7 +352,7 @@
</span><span class="cx">     ASSERT(!renderer.isAnonymous());
</span><span class="cx"> 
</span><span class="cx">     // FIXME: Region styling fails for pseudo-elements because the renderers don't have a node.
</span><del>-    RefPtr&lt;RenderStyle&gt; renderObjectRegionStyle = renderer.element()-&gt;styleResolver().styleForElement(renderer.element(), &amp;parentStyle, DisallowStyleSharing, MatchAllRules, this);
</del><ins>+    RefPtr&lt;RenderStyle&gt; renderObjectRegionStyle = renderer.element()-&gt;styleResolver().styleForElement(*renderer.element(), &amp;parentStyle, DisallowStyleSharing, MatchAllRules, this);
</ins><span class="cx"> 
</span><span class="cx">     return renderObjectRegionStyle.release();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorestyleStyleTreeResolvercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/style/StyleTreeResolver.cpp (195464 => 195465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/StyleTreeResolver.cpp        2016-01-22 19:44:54 UTC (rev 195464)
+++ trunk/Source/WebCore/style/StyleTreeResolver.cpp        2016-01-22 20:00:34 UTC (rev 195465)
</span><span class="lines">@@ -127,7 +127,7 @@
</span><span class="cx">         if (RefPtr&lt;RenderStyle&gt; style = element.customStyleForRenderer(inheritedStyle))
</span><span class="cx">             return style.releaseNonNull();
</span><span class="cx">     }
</span><del>-    return m_styleResolver.styleForElement(&amp;element, &amp;inheritedStyle, AllowStyleSharing, MatchAllRules, nullptr, &amp;m_selectorFilter);
</del><ins>+    return m_styleResolver.styleForElement(element, &amp;inheritedStyle, AllowStyleSharing, MatchAllRules, nullptr, &amp;m_selectorFilter);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(CSS_REGIONS)
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGElement.cpp (195464 => 195465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGElement.cpp        2016-01-22 19:44:54 UTC (rev 195464)
+++ trunk/Source/WebCore/svg/SVGElement.cpp        2016-01-22 20:00:34 UTC (rev 195465)
</span><span class="lines">@@ -793,7 +793,7 @@
</span><span class="cx"> {
</span><span class="cx">     // If the element is in a &lt;use&gt; tree we get the style from the definition tree.
</span><span class="cx">     if (auto* styleElement = this-&gt;correspondingElement())
</span><del>-        return styleElement-&gt;styleResolver().styleForElement(styleElement, &amp;parentStyle, DisallowStyleSharing);
</del><ins>+        return styleElement-&gt;styleResolver().styleForElement(*styleElement, &amp;parentStyle, DisallowStyleSharing);
</ins><span class="cx"> 
</span><span class="cx">     return resolveStyle(&amp;parentStyle);
</span><span class="cx"> }
</span><span class="lines">@@ -827,7 +827,7 @@
</span><span class="cx">             parentStyle = &amp;renderer-&gt;style();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return m_svgRareData-&gt;overrideComputedStyle(this, parentStyle);
</del><ins>+    return m_svgRareData-&gt;overrideComputedStyle(*this, parentStyle);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static void addQualifiedName(HashMap&lt;AtomicString, QualifiedName&gt;&amp; map, const QualifiedName&amp; name)
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGElementRareDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGElementRareData.h (195464 => 195465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGElementRareData.h        2016-01-22 19:44:54 UTC (rev 195464)
+++ trunk/Source/WebCore/svg/SVGElementRareData.h        2016-01-22 20:00:34 UTC (rev 195465)
</span><span class="lines">@@ -65,14 +65,13 @@
</span><span class="cx">         return *m_animatedSMILStyleProperties;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    RenderStyle* overrideComputedStyle(Element* element, RenderStyle* parentStyle)
</del><ins>+    RenderStyle* overrideComputedStyle(Element&amp; element, RenderStyle* parentStyle)
</ins><span class="cx">     {
</span><del>-        ASSERT(element);
</del><span class="cx">         if (!m_useOverrideComputedStyle)
</span><span class="cx">             return 0;
</span><span class="cx">         if (!m_overrideComputedStyle || m_needsOverrideComputedStyleUpdate) {
</span><span class="cx">             // The style computed here contains no CSS Animations/Transitions or SMIL induced rules - this is needed to compute the &quot;base value&quot; for the SMIL animation sandwhich model.
</span><del>-            m_overrideComputedStyle = element-&gt;styleResolver().styleForElement(element, parentStyle, DisallowStyleSharing, MatchAllRulesExcludingSMIL);
</del><ins>+            m_overrideComputedStyle = element.styleResolver().styleForElement(element, parentStyle, DisallowStyleSharing, MatchAllRulesExcludingSMIL);
</ins><span class="cx">             m_needsOverrideComputedStyleUpdate = false;
</span><span class="cx">         }
</span><span class="cx">         ASSERT(m_overrideComputedStyle);
</span></span></pre>
</div>
</div>

</body>
</html>