<!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>[196031] 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/196031">196031</a></dd>
<dt>Author</dt> <dd>antti@apple.com</dd>
<dt>Date</dt> <dd>2016-02-02 14:34:45 -0800 (Tue, 02 Feb 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Factor style sharing code out of StyleResolver
https://bugs.webkit.org/show_bug.cgi?id=153768

Reviewed by Darin Adler.

Move the code to a new class, Style::SharingResolver.

When resolving document style we query the sharing resolver first before using the regular style resolver.
Other paths that call style resolver were mostly already disabling it with DisallowStyleSharing flag.

* WebCore.xcodeproj/project.pbxproj:
* css/ElementRuleCollector.cpp:
(WebCore::MatchRequest::MatchRequest):
(WebCore::ElementRuleCollector::matchAllRules):
(WebCore::ElementRuleCollector::hasAnyMatchingRules):

    More const.

* css/ElementRuleCollector.h:
(WebCore::ElementRuleCollector::setRegionForStyling):
(WebCore::ElementRuleCollector::setMedium):
* css/MediaQueryMatcher.cpp:
(WebCore::MediaQueryMatcher::prepareEvaluator):
* css/StyleMedia.cpp:
(WebCore::StyleMedia::matchMedium):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::State::cacheBorderAndBackground):
(WebCore::StyleResolver::StyleResolver):
(WebCore::StyleResolver::sweepMatchedPropertiesCache):
(WebCore::StyleResolver::State::State):
(WebCore::StyleResolver::State::setStyle):
(WebCore::isAtShadowBoundary):
(WebCore::StyleResolver::styleForElement):
(WebCore::StyleResolver::classNamesAffectedByRules): Deleted.
(WebCore::parentElementPreventsSharing): Deleted.
(WebCore::StyleResolver::locateCousinList): Deleted.
(WebCore::StyleResolver::styleSharingCandidateMatchesRuleSet): Deleted.
(WebCore::StyleResolver::canShareStyleWithControl): Deleted.
(WebCore::elementHasDirectionAuto): Deleted.
(WebCore::StyleResolver::sharingCandidateHasIdenticalStyleAffectingAttributes): Deleted.
(WebCore::StyleResolver::canShareStyleWithElement): Deleted.
(WebCore::StyleResolver::findSiblingForStyleSharing): Deleted.
(WebCore::StyleResolver::locateSharedStyle): Deleted.

    Style sharing code moves to SharingResolver.

* css/StyleResolver.h:
(WebCore::StyleResolver::mediaQueryEvaluator):
(WebCore::StyleResolver::State::regionForStyling):
(WebCore::StyleResolver::State::elementLinkState):
(WebCore::StyleResolver::State::setApplyPropertyToRegularStyle):
(WebCore::StyleResolver::State::setApplyPropertyToVisitedLinkStyle):
(WebCore::StyleResolver::state):
(WebCore::StyleResolver::setTextOrientation):
(WebCore::StyleResolver::State::setElementAffectedByClassRules): Deleted.
(WebCore::StyleResolver::State::elementAffectedByClassRules): Deleted.
(WebCore::StyleResolver::styleNotYetAvailable): Deleted.

    Placeholder code moves to TreeResolver.

* dom/VisitedLinkState.cpp:
(WebCore::linkAttribute):
(WebCore::VisitedLinkState::invalidateStyleForAllLinks):
(WebCore::linkHashForElement):
(WebCore::VisitedLinkState::invalidateStyleForLink):
(WebCore::VisitedLinkState::determineLinkStateSlowCase):
* dom/VisitedLinkState.h:
(WebCore::VisitedLinkState::determineLinkState):
* html/HTMLFormControlElement.h:
* rendering/RenderElement.cpp:
(WebCore::RenderElement::getUncachedPseudoStyle):
* rendering/RenderNamedFlowFragment.cpp:
(WebCore::RenderNamedFlowFragment::computeStyleInRegion):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::isStyleAvailable):
(WebCore::RenderStyle::hasUniquePseudoStyle):
* style/StyleSharingResolver.cpp: Added.
(WebCore::Style::SharingResolver::SharingResolver):
(WebCore::Style::parentElementPreventsSharing):
(WebCore::Style::elementHasDirectionAuto):
(WebCore::Style::SharingResolver::searchSimilar):
(WebCore::Style::SharingResolver::findSibling):
(WebCore::Style::SharingResolver::locateCousinList):
(WebCore::Style::canShareStyleWithControl):
(WebCore::Style::SharingResolver::canShareStyleWithElement):
(WebCore::Style::SharingResolver::styleSharingCandidateMatchesRuleSet):
(WebCore::Style::SharingResolver::sharingCandidateHasIdenticalStyleAffectingAttributes):
(WebCore::Style::SharingResolver::classNamesAffectedByRules):
* style/StyleSharingResolver.h: Added.
* style/StyleTreeResolver.cpp:
(WebCore::Style::ensurePlaceholderStyle):
(WebCore::Style::TreeResolver::TreeResolver):
(WebCore::Style::TreeResolver::styleForElement):

    Try to use SharingResolver first.
    Also move placeholder style handling here, it is only relevant when resolving document style.

(WebCore::Style::postResolutionCallbacksAreSuspended):
(WebCore::Style::isPlaceholderStyle):
* style/StyleTreeResolver.h:
* svg/SVGElement.cpp:
(WebCore::SVGElement::customStyleForRenderer):
* svg/SVGElementRareData.h:
(WebCore::SVGElementRareData::overrideComputedStyle):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorevcxprojWebCorevcxproj">trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorecssElementRuleCollectorcpp">trunk/Source/WebCore/css/ElementRuleCollector.cpp</a></li>
<li><a href="#trunkSourceWebCorecssElementRuleCollectorh">trunk/Source/WebCore/css/ElementRuleCollector.h</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="#trunkSourceWebCoredomVisitedLinkStatecpp">trunk/Source/WebCore/dom/VisitedLinkState.cpp</a></li>
<li><a href="#trunkSourceWebCoredomVisitedLinkStateh">trunk/Source/WebCore/dom/VisitedLinkState.h</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLFormControlElementh">trunk/Source/WebCore/html/HTMLFormControlElement.h</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="#trunkSourceWebCorerenderingstyleRenderStylecpp">trunk/Source/WebCore/rendering/style/RenderStyle.cpp</a></li>
<li><a href="#trunkSourceWebCorestyleStyleTreeResolvercpp">trunk/Source/WebCore/style/StyleTreeResolver.cpp</a></li>
<li><a href="#trunkSourceWebCorestyleStyleTreeResolverh">trunk/Source/WebCore/style/StyleTreeResolver.h</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>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorestyleStyleSharingResolvercpp">trunk/Source/WebCore/style/StyleSharingResolver.cpp</a></li>
<li><a href="#trunkSourceWebCorestyleStyleSharingResolverh">trunk/Source/WebCore/style/StyleSharingResolver.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (196030 => 196031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2016-02-02 22:34:40 UTC (rev 196030)
+++ trunk/Source/WebCore/CMakeLists.txt        2016-02-02 22:34:45 UTC (rev 196031)
</span><span class="lines">@@ -2639,6 +2639,7 @@
</span><span class="cx">     style/StyleChange.cpp
</span><span class="cx">     style/StyleFontSizeFunctions.cpp
</span><span class="cx">     style/StyleResolveForDocument.cpp
</span><ins>+    style/StyleSharingResolver.cpp
</ins><span class="cx">     style/StyleTreeResolver.cpp
</span><span class="cx"> 
</span><span class="cx">     svg/SVGAElement.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (196030 => 196031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-02-02 22:34:40 UTC (rev 196030)
+++ trunk/Source/WebCore/ChangeLog        2016-02-02 22:34:45 UTC (rev 196031)
</span><span class="lines">@@ -1,3 +1,110 @@
</span><ins>+2016-02-02  Antti Koivisto  &lt;antti@apple.com&gt;
+
+        Factor style sharing code out of StyleResolver
+        https://bugs.webkit.org/show_bug.cgi?id=153768
+
+        Reviewed by Darin Adler.
+
+        Move the code to a new class, Style::SharingResolver.
+
+        When resolving document style we query the sharing resolver first before using the regular style resolver.
+        Other paths that call style resolver were mostly already disabling it with DisallowStyleSharing flag.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * css/ElementRuleCollector.cpp:
+        (WebCore::MatchRequest::MatchRequest):
+        (WebCore::ElementRuleCollector::matchAllRules):
+        (WebCore::ElementRuleCollector::hasAnyMatchingRules):
+
+            More const.
+
+        * css/ElementRuleCollector.h:
+        (WebCore::ElementRuleCollector::setRegionForStyling):
+        (WebCore::ElementRuleCollector::setMedium):
+        * css/MediaQueryMatcher.cpp:
+        (WebCore::MediaQueryMatcher::prepareEvaluator):
+        * css/StyleMedia.cpp:
+        (WebCore::StyleMedia::matchMedium):
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::State::cacheBorderAndBackground):
+        (WebCore::StyleResolver::StyleResolver):
+        (WebCore::StyleResolver::sweepMatchedPropertiesCache):
+        (WebCore::StyleResolver::State::State):
+        (WebCore::StyleResolver::State::setStyle):
+        (WebCore::isAtShadowBoundary):
+        (WebCore::StyleResolver::styleForElement):
+        (WebCore::StyleResolver::classNamesAffectedByRules): Deleted.
+        (WebCore::parentElementPreventsSharing): Deleted.
+        (WebCore::StyleResolver::locateCousinList): Deleted.
+        (WebCore::StyleResolver::styleSharingCandidateMatchesRuleSet): Deleted.
+        (WebCore::StyleResolver::canShareStyleWithControl): Deleted.
+        (WebCore::elementHasDirectionAuto): Deleted.
+        (WebCore::StyleResolver::sharingCandidateHasIdenticalStyleAffectingAttributes): Deleted.
+        (WebCore::StyleResolver::canShareStyleWithElement): Deleted.
+        (WebCore::StyleResolver::findSiblingForStyleSharing): Deleted.
+        (WebCore::StyleResolver::locateSharedStyle): Deleted.
+
+            Style sharing code moves to SharingResolver.
+
+        * css/StyleResolver.h:
+        (WebCore::StyleResolver::mediaQueryEvaluator):
+        (WebCore::StyleResolver::State::regionForStyling):
+        (WebCore::StyleResolver::State::elementLinkState):
+        (WebCore::StyleResolver::State::setApplyPropertyToRegularStyle):
+        (WebCore::StyleResolver::State::setApplyPropertyToVisitedLinkStyle):
+        (WebCore::StyleResolver::state):
+        (WebCore::StyleResolver::setTextOrientation):
+        (WebCore::StyleResolver::State::setElementAffectedByClassRules): Deleted.
+        (WebCore::StyleResolver::State::elementAffectedByClassRules): Deleted.
+        (WebCore::StyleResolver::styleNotYetAvailable): Deleted.
+
+            Placeholder code moves to TreeResolver.
+
+        * dom/VisitedLinkState.cpp:
+        (WebCore::linkAttribute):
+        (WebCore::VisitedLinkState::invalidateStyleForAllLinks):
+        (WebCore::linkHashForElement):
+        (WebCore::VisitedLinkState::invalidateStyleForLink):
+        (WebCore::VisitedLinkState::determineLinkStateSlowCase):
+        * dom/VisitedLinkState.h:
+        (WebCore::VisitedLinkState::determineLinkState):
+        * html/HTMLFormControlElement.h:
+        * rendering/RenderElement.cpp:
+        (WebCore::RenderElement::getUncachedPseudoStyle):
+        * rendering/RenderNamedFlowFragment.cpp:
+        (WebCore::RenderNamedFlowFragment::computeStyleInRegion):
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::isStyleAvailable):
+        (WebCore::RenderStyle::hasUniquePseudoStyle):
+        * style/StyleSharingResolver.cpp: Added.
+        (WebCore::Style::SharingResolver::SharingResolver):
+        (WebCore::Style::parentElementPreventsSharing):
+        (WebCore::Style::elementHasDirectionAuto):
+        (WebCore::Style::SharingResolver::searchSimilar):
+        (WebCore::Style::SharingResolver::findSibling):
+        (WebCore::Style::SharingResolver::locateCousinList):
+        (WebCore::Style::canShareStyleWithControl):
+        (WebCore::Style::SharingResolver::canShareStyleWithElement):
+        (WebCore::Style::SharingResolver::styleSharingCandidateMatchesRuleSet):
+        (WebCore::Style::SharingResolver::sharingCandidateHasIdenticalStyleAffectingAttributes):
+        (WebCore::Style::SharingResolver::classNamesAffectedByRules):
+        * style/StyleSharingResolver.h: Added.
+        * style/StyleTreeResolver.cpp:
+        (WebCore::Style::ensurePlaceholderStyle):
+        (WebCore::Style::TreeResolver::TreeResolver):
+        (WebCore::Style::TreeResolver::styleForElement):
+
+            Try to use SharingResolver first.
+            Also move placeholder style handling here, it is only relevant when resolving document style.
+
+        (WebCore::Style::postResolutionCallbacksAreSuspended):
+        (WebCore::Style::isPlaceholderStyle):
+        * style/StyleTreeResolver.h:
+        * svg/SVGElement.cpp:
+        (WebCore::SVGElement::customStyleForRenderer):
+        * svg/SVGElementRareData.h:
+        (WebCore::SVGElementRareData::overrideComputedStyle):
+
</ins><span class="cx"> 2016-02-02  Tim Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         &lt;attachment&gt; icon should be a folder for the custom MIME type multipart/x-folder
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojWebCorevcxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (196030 => 196031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2016-02-02 22:34:40 UTC (rev 196030)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2016-02-02 22:34:45 UTC (rev 196031)
</span><span class="lines">@@ -19245,6 +19245,7 @@
</span><span class="cx">     &lt;ClCompile Include=&quot;..\style\StyleChange.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\style\StyleFontSizeFunctions.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\style\StyleResolveForDocument.cpp&quot; /&gt;
</span><ins>+    &lt;ClCompile Include=&quot;..\style\StyleSharingResolver.cpp&quot; /&gt;
</ins><span class="cx">     &lt;ClCompile Include=&quot;..\style\StyleTreeResolver.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\bridge\jsc\BridgeJSC.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\bridge\c\c_class.cpp&quot; /&gt;
</span><span class="lines">@@ -22812,6 +22813,7 @@
</span><span class="cx">     &lt;ClInclude Include=&quot;..\style\StyleChange.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\style\StyleFontSizeFunctions.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\style\StyleResolveForDocument.h&quot; /&gt;
</span><ins>+    &lt;ClInclude Include=&quot;..\style\StyleSharingResolver.h&quot; /&gt;
</ins><span class="cx">     &lt;ClInclude Include=&quot;..\style\StyleTreeResolver.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\bridge\Bridge.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\bridge\jsc\BridgeJSC.h&quot; /&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (196030 => 196031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-02-02 22:34:40 UTC (rev 196030)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-02-02 22:34:45 UTC (rev 196031)
</span><span class="lines">@@ -6588,6 +6588,8 @@
</span><span class="cx">                 E47127CB163438AE00ED6F5A /* StyleInvalidationAnalysis.h in Headers */ = {isa = PBXBuildFile; fileRef = E47A97CF163059FC005DCD99 /* StyleInvalidationAnalysis.h */; };
</span><span class="cx">                 E4778B7F115A581A00B5D372 /* JSCustomEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4778B7D115A581A00B5D372 /* JSCustomEvent.cpp */; };
</span><span class="cx">                 E4778B80115A581A00B5D372 /* JSCustomEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = E4778B7E115A581A00B5D372 /* JSCustomEvent.h */; };
</span><ins>+                E47A3AC31C5EABBE00CCBFA7 /* StyleSharingResolver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E47A3AC21C5EABBE00CCBFA7 /* StyleSharingResolver.cpp */; };
+                E47A3AC61C5EAC9D00CCBFA7 /* StyleSharingResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = E47A3AC41C5EAC7900CCBFA7 /* StyleSharingResolver.h */; };
</ins><span class="cx">                 E47B4BE80E71241600038854 /* CachedResourceHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = E47B4BE60E71241600038854 /* CachedResourceHandle.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 E47B4BE90E71241600038854 /* CachedResourceHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E47B4BE70E71241600038854 /* CachedResourceHandle.cpp */; };
</span><span class="cx">                 E47E276516036ED200EE2AFB /* ExtensionStyleSheets.h in Headers */ = {isa = PBXBuildFile; fileRef = E47E276416036ED200EE2AFB /* ExtensionStyleSheets.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -14553,6 +14555,8 @@
</span><span class="cx">                 E46A2B1D17CA76B1000DBCD8 /* ElementChildIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementChildIterator.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E4778B7D115A581A00B5D372 /* JSCustomEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCustomEvent.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E4778B7E115A581A00B5D372 /* JSCustomEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCustomEvent.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                E47A3AC21C5EABBE00CCBFA7 /* StyleSharingResolver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleSharingResolver.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                E47A3AC41C5EAC7900CCBFA7 /* StyleSharingResolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleSharingResolver.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 E47A97CE163059FC005DCD99 /* StyleInvalidationAnalysis.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleInvalidationAnalysis.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E47A97CF163059FC005DCD99 /* StyleInvalidationAnalysis.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleInvalidationAnalysis.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E47B4BE60E71241600038854 /* CachedResourceHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedResourceHandle.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -23342,6 +23346,8 @@
</span><span class="cx">                                 E4D58EB317B4DBDC00CBDCA8 /* StyleResolveForDocument.h */,
</span><span class="cx">                                 E4DEAA1517A93DC3000E0430 /* StyleTreeResolver.cpp */,
</span><span class="cx">                                 E4DEAA1617A93DC3000E0430 /* StyleTreeResolver.h */,
</span><ins>+                                E47A3AC21C5EABBE00CCBFA7 /* StyleSharingResolver.cpp */,
+                                E47A3AC41C5EAC7900CCBFA7 /* StyleSharingResolver.h */,
</ins><span class="cx">                         );
</span><span class="cx">                         path = style;
</span><span class="cx">                         sourceTree = &quot;&lt;group&gt;&quot;;
</span><span class="lines">@@ -26896,6 +26902,7 @@
</span><span class="cx">                                 44A28AAF12DFB8BF00AE923B /* MathMLNames.h in Headers */,
</span><span class="cx">                                 439046E012DA25E17BAF80A2 /* MathMLOperatorDictionary.h in Headers */,
</span><span class="cx">                                 FA654A6C1108ABED002615E0 /* MathMLTextElement.h in Headers */,
</span><ins>+                                E47A3AC61C5EAC9D00CCBFA7 /* StyleSharingResolver.h in Headers */,
</ins><span class="cx">                                 49D5DC2C0F423A73008F20FD /* Matrix3DTransformOperation.h in Headers */,
</span><span class="cx">                                 49E911C70EF86D47009D0CAF /* MatrixTransformOperation.h in Headers */,
</span><span class="cx">                                 5CBC8DAD1AAA302200E1C803 /* MediaAccessibilitySoftLink.h in Headers */,
</span><span class="lines">@@ -30091,6 +30098,7 @@
</span><span class="cx">                                 A80E7E9A0A1A83E3007FB8C5 /* JSHTMLOptionElement.cpp in Sources */,
</span><span class="cx">                                 448A29C00A46D9CB0030759F /* JSHTMLOptionsCollection.cpp in Sources */,
</span><span class="cx">                                 448AD27C0A48137A0023D179 /* JSHTMLOptionsCollectionCustom.cpp in Sources */,
</span><ins>+                                E47A3AC31C5EABBE00CCBFA7 /* StyleSharingResolver.cpp in Sources */,
</ins><span class="cx">                                 4AD0173C127E82860015035F /* JSHTMLOutputElement.cpp in Sources */,
</span><span class="cx">                                 1AE2ABA60A1CE90500B42B25 /* JSHTMLParagraphElement.cpp in Sources */,
</span><span class="cx">                                 1AE2ABA80A1CE90500B42B25 /* JSHTMLParamElement.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorecssElementRuleCollectorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/ElementRuleCollector.cpp (196030 => 196031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/ElementRuleCollector.cpp        2016-02-02 22:34:40 UTC (rev 196030)
+++ trunk/Source/WebCore/css/ElementRuleCollector.cpp        2016-02-02 22:34:45 UTC (rev 196031)
</span><span class="lines">@@ -68,7 +68,7 @@
</span><span class="cx"> 
</span><span class="cx"> class MatchRequest {
</span><span class="cx"> public:
</span><del>-    MatchRequest(RuleSet* ruleSet, bool includeEmptyRules = false)
</del><ins>+    MatchRequest(const RuleSet* ruleSet, bool includeEmptyRules = false)
</ins><span class="cx">         : ruleSet(ruleSet)
</span><span class="cx">         , includeEmptyRules(includeEmptyRules)
</span><span class="cx">     {
</span><span class="lines">@@ -529,7 +529,7 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool ElementRuleCollector::hasAnyMatchingRules(RuleSet* ruleSet)
</del><ins>+bool ElementRuleCollector::hasAnyMatchingRules(const RuleSet* ruleSet)
</ins><span class="cx"> {
</span><span class="cx">     clearMatchedRules();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecssElementRuleCollectorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/ElementRuleCollector.h (196030 => 196031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/ElementRuleCollector.h        2016-02-02 22:34:40 UTC (rev 196030)
+++ trunk/Source/WebCore/css/ElementRuleCollector.h        2016-02-02 22:34:45 UTC (rev 196031)
</span><span class="lines">@@ -58,7 +58,7 @@
</span><span class="cx">     void setRegionForStyling(const RenderRegion* regionForStyling) { m_regionForStyling = regionForStyling; }
</span><span class="cx">     void setMedium(const MediaQueryEvaluator* medium) { m_isPrintStyle = medium-&gt;mediaTypeMatchSpecific(&quot;print&quot;); }
</span><span class="cx"> 
</span><del>-    bool hasAnyMatchingRules(RuleSet*);
</del><ins>+    bool hasAnyMatchingRules(const RuleSet*);
</ins><span class="cx"> 
</span><span class="cx">     StyleResolver::MatchResult&amp; matchedResult();
</span><span class="cx">     const Vector&lt;RefPtr&lt;StyleRule&gt;&gt;&amp; matchedRuleList() const;
</span></span></pre></div>
<a id="trunkSourceWebCorecssMediaQueryMatchercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/MediaQueryMatcher.cpp (196030 => 196031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/MediaQueryMatcher.cpp        2016-02-02 22:34:40 UTC (rev 196030)
+++ trunk/Source/WebCore/css/MediaQueryMatcher.cpp        2016-02-02 22:34:45 UTC (rev 196031)
</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(), 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 (196030 => 196031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleMedia.cpp        2016-02-02 22:34:40 UTC (rev 196030)
+++ trunk/Source/WebCore/css/StyleMedia.cpp        2016-02-02 22:34:45 UTC (rev 196031)
</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(), 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 (196030 => 196031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleResolver.cpp        2016-02-02 22:34:40 UTC (rev 196030)
+++ trunk/Source/WebCore/css/StyleResolver.cpp        2016-02-02 22:34:45 UTC (rev 196031)
</span><span class="lines">@@ -176,8 +176,6 @@
</span><span class="cx"> 
</span><span class="cx"> static void extractDirectionAndWritingMode(const RenderStyle&amp;, const StyleResolver::MatchResult&amp;, TextDirection&amp;, WritingMode&amp;);
</span><span class="cx"> 
</span><del>-RenderStyle* StyleResolver::s_styleNotYetAvailable;
-
</del><span class="cx"> inline void StyleResolver::State::cacheBorderAndBackground()
</span><span class="cx"> {
</span><span class="cx">     m_hasUAAppearance = m_style-&gt;hasAppearance();
</span><span class="lines">@@ -264,7 +262,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(), 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">@@ -332,15 +330,6 @@
</span><span class="cx">     m_matchedPropertiesCacheAdditionsSinceLastSweep = 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool StyleResolver::classNamesAffectedByRules(const SpaceSplitString&amp; classNames) const
-{
-    for (unsigned i = 0; i &lt; classNames.size(); ++i) {
-        if (m_ruleSets.features().classesInRules.contains(classNames[i].impl()))
-            return true;
-    }
-    return false;
-}
-
</del><span class="cx"> StyleResolver::State::State(Element&amp; element, RenderStyle* parentStyle, const RenderRegion* regionForStyling, const SelectorFilter* selectorFilter)
</span><span class="cx">     : m_element(&amp;element)
</span><span class="cx">     , m_parentStyle(parentStyle)
</span><span class="lines">@@ -369,305 +358,6 @@
</span><span class="cx">     m_style = WTFMove(style);
</span><span class="cx">     updateConversionData();
</span><span class="cx"> }
</span><del>-
-static const unsigned cStyleSearchThreshold = 10;
-static const unsigned cStyleSearchLevelThreshold = 10;
-
-static inline bool parentElementPreventsSharing(const Element* parentElement)
-{
-    if (!parentElement)
-        return false;
-    return parentElement-&gt;hasFlagsSetDuringStylingOfChildren();
-}
-
-Node* StyleResolver::locateCousinList(Element* parent, unsigned&amp; visitedNodeCount) const
-{
-    if (visitedNodeCount &gt;= cStyleSearchThreshold * cStyleSearchLevelThreshold)
-        return nullptr;
-    if (!is&lt;StyledElement&gt;(parent))
-        return nullptr;
-    StyledElement* styledParent = downcast&lt;StyledElement&gt;(parent);
-    if (styledParent-&gt;inlineStyle())
-        return nullptr;
-    if (is&lt;SVGElement&gt;(*styledParent) &amp;&amp; downcast&lt;SVGElement&gt;(*styledParent).animatedSMILStyleProperties())
-        return nullptr;
-    if (styledParent-&gt;hasID() &amp;&amp; m_ruleSets.features().idsInRules.contains(styledParent-&gt;idForStyleResolution().impl()))
-        return nullptr;
-
-    RenderStyle* parentStyle = styledParent-&gt;renderStyle();
-    unsigned subcount = 0;
-    Node* thisCousin = styledParent;
-    Node* currentNode = styledParent-&gt;previousSibling();
-
-    // Reserve the tries for this level. This effectively makes sure that the algorithm
-    // will never go deeper than cStyleSearchLevelThreshold levels into recursion.
-    visitedNodeCount += cStyleSearchThreshold;
-    while (thisCousin) {
-        while (currentNode) {
-            ++subcount;
-            if (currentNode-&gt;renderStyle() == parentStyle &amp;&amp; currentNode-&gt;lastChild()
-                &amp;&amp; is&lt;Element&gt;(*currentNode) &amp;&amp; !parentElementPreventsSharing(downcast&lt;Element&gt;(currentNode))
-                ) {
-                // Adjust for unused reserved tries.
-                visitedNodeCount -= cStyleSearchThreshold - subcount;
-                return currentNode-&gt;lastChild();
-            }
-            if (subcount &gt;= cStyleSearchThreshold)
-                return nullptr;
-            currentNode = currentNode-&gt;previousSibling();
-        }
-        currentNode = locateCousinList(thisCousin-&gt;parentElement(), visitedNodeCount);
-        thisCousin = currentNode;
-    }
-
-    return nullptr;
-}
-
-bool StyleResolver::styleSharingCandidateMatchesRuleSet(RuleSet* ruleSet)
-{
-    if (!ruleSet)
-        return false;
-
-    ElementRuleCollector collector(*m_state.element(), m_state.style(), m_ruleSets, m_state.selectorFilter());
-    return collector.hasAnyMatchingRules(ruleSet);
-}
-
-bool StyleResolver::canShareStyleWithControl(StyledElement&amp; element) const
-{
-    const State&amp; state = m_state;
-    if (!is&lt;HTMLInputElement&gt;(element) || !is&lt;HTMLInputElement&gt;(*state.element()))
-        return false;
-
-    auto&amp; thisInputElement = downcast&lt;HTMLInputElement&gt;(element);
-    auto&amp; otherInputElement = downcast&lt;HTMLInputElement&gt;(*state.element());
-
-    if (thisInputElement.isAutoFilled() != otherInputElement.isAutoFilled())
-        return false;
-    if (thisInputElement.shouldAppearChecked() != otherInputElement.shouldAppearChecked())
-        return false;
-    if (thisInputElement.shouldAppearIndeterminate() != otherInputElement.shouldAppearIndeterminate())
-        return false;
-    if (thisInputElement.isRequired() != otherInputElement.isRequired())
-        return false;
-
-    if (element.isDisabledFormControl() != state.element()-&gt;isDisabledFormControl())
-        return false;
-
-    if (element.isDefaultButtonForForm() != state.element()-&gt;isDefaultButtonForForm())
-        return false;
-
-    if (element.isInRange() != state.element()-&gt;isInRange())
-        return false;
-
-    if (element.isOutOfRange() != state.element()-&gt;isOutOfRange())
-        return false;
-
-    return true;
-}
-
-static inline bool elementHasDirectionAuto(Element&amp; element)
-{
-    // FIXME: This line is surprisingly hot, we may wish to inline hasDirectionAuto into StyleResolver.
-    return is&lt;HTMLElement&gt;(element) &amp;&amp; downcast&lt;HTMLElement&gt;(element).hasDirectionAuto();
-}
-
-bool StyleResolver::sharingCandidateHasIdenticalStyleAffectingAttributes(StyledElement&amp; sharingCandidate) const
-{
-    const State&amp; state = m_state;
-    if (state.element()-&gt;elementData() == sharingCandidate.elementData())
-        return true;
-    if (state.element()-&gt;fastGetAttribute(XMLNames::langAttr) != sharingCandidate.fastGetAttribute(XMLNames::langAttr))
-        return false;
-    if (state.element()-&gt;fastGetAttribute(langAttr) != sharingCandidate.fastGetAttribute(langAttr))
-        return false;
-
-    if (!state.elementAffectedByClassRules()) {
-        if (sharingCandidate.hasClass() &amp;&amp; classNamesAffectedByRules(sharingCandidate.classNames()))
-            return false;
-    } else if (sharingCandidate.hasClass()) {
-        // SVG elements require a (slow!) getAttribute comparision because &quot;class&quot; is an animatable attribute for SVG.
-        if (state.element()-&gt;isSVGElement()) {
-            if (state.element()-&gt;getAttribute(classAttr) != sharingCandidate.getAttribute(classAttr))
-                return false;
-        } else {
-            if (state.element()-&gt;classNames() != sharingCandidate.classNames())
-                return false;
-        }
-    } else
-        return false;
-
-    if (downcast&lt;StyledElement&gt;(*state.element()).presentationAttributeStyle() != sharingCandidate.presentationAttributeStyle())
-        return false;
-
-    if (state.element()-&gt;hasTagName(progressTag)) {
-        if (state.element()-&gt;shouldAppearIndeterminate() != sharingCandidate.shouldAppearIndeterminate())
-            return false;
-    }
-
-    return true;
-}
-
-bool StyleResolver::canShareStyleWithElement(StyledElement&amp; element) const
-{
-    auto* style = element.renderStyle();
-    const State&amp; state = m_state;
-
-    if (!style)
-        return false;
-    if (style-&gt;unique())
-        return false;
-    if (style-&gt;hasUniquePseudoStyle())
-        return false;
-    if (element.tagQName() != state.element()-&gt;tagQName())
-        return false;
-    if (element.inlineStyle())
-        return false;
-    if (element.needsStyleRecalc())
-        return false;
-    if (element.isSVGElement() &amp;&amp; downcast&lt;SVGElement&gt;(element).animatedSMILStyleProperties())
-        return false;
-    if (element.isLink() != state.element()-&gt;isLink())
-        return false;
-    if (element.hovered() != state.element()-&gt;hovered())
-        return false;
-    if (element.active() != state.element()-&gt;active())
-        return false;
-    if (element.focused() != state.element()-&gt;focused())
-        return false;
-    if (element.shadowPseudoId() != state.element()-&gt;shadowPseudoId())
-        return false;
-    if (&amp;element == element.document().cssTarget())
-        return false;
-    if (!sharingCandidateHasIdenticalStyleAffectingAttributes(element))
-        return false;
-    if (element.additionalPresentationAttributeStyle() != downcast&lt;StyledElement&gt;(*state.element()).additionalPresentationAttributeStyle())
-        return false;
-    if (element.affectsNextSiblingElementStyle() || element.styleIsAffectedByPreviousSibling())
-        return false;
-
-    if (element.hasID() &amp;&amp; m_ruleSets.features().idsInRules.contains(element.idForStyleResolution().impl()))
-        return false;
-
-    bool isControl = is&lt;HTMLFormControlElement&gt;(element);
-
-    if (isControl != is&lt;HTMLFormControlElement&gt;(*state.element()))
-        return false;
-
-    if (isControl &amp;&amp; !canShareStyleWithControl(element))
-        return false;
-
-    if (style-&gt;transitions() || style-&gt;animations())
-        return false;
-
-    // Turn off style sharing for elements that can gain layers for reasons outside of the style system.
-    // See comments in RenderObject::setStyle().
-    if (element.hasTagName(iframeTag) || element.hasTagName(frameTag) || element.hasTagName(embedTag) || element.hasTagName(objectTag) || element.hasTagName(appletTag) || element.hasTagName(canvasTag))
-        return false;
-
-    if (elementHasDirectionAuto(element))
-        return false;
-
-    if (element.isLink() &amp;&amp; state.elementLinkState() != style-&gt;insideLink())
-        return false;
-
-    if (element.elementData() != state.element()-&gt;elementData()) {
-        if (element.fastGetAttribute(readonlyAttr) != state.element()-&gt;fastGetAttribute(readonlyAttr))
-            return false;
-        if (element.isSVGElement()) {
-            if (element.getAttribute(typeAttr) != state.element()-&gt;getAttribute(typeAttr))
-                return false;
-        } else {
-            if (element.fastGetAttribute(typeAttr) != state.element()-&gt;fastGetAttribute(typeAttr))
-                return false;
-        }
-    }
-
-    if (element.matchesValidPseudoClass() != state.element()-&gt;matchesValidPseudoClass())
-        return false;
-
-    if (element.matchesInvalidPseudoClass() != state.element()-&gt;matchesValidPseudoClass())
-        return false;
-
-#if ENABLE(VIDEO_TRACK)
-    // Deny sharing styles between WebVTT and non-WebVTT nodes.
-    if (is&lt;WebVTTElement&gt;(*state.element()))
-        return false;
-#endif
-
-#if ENABLE(FULLSCREEN_API)
-    if (&amp;element == element.document().webkitCurrentFullScreenElement() || state.element() == state.document().webkitCurrentFullScreenElement())
-        return false;
-#endif
-    return true;
-}
-
-inline StyledElement* StyleResolver::findSiblingForStyleSharing(Node* node, unsigned&amp; count) const
-{
-    for (; node; node = node-&gt;previousSibling()) {
-        if (!is&lt;StyledElement&gt;(*node))
-            continue;
-        if (canShareStyleWithElement(downcast&lt;StyledElement&gt;(*node)))
-            break;
-        if (count++ == cStyleSearchThreshold)
-            return nullptr;
-    }
-    return downcast&lt;StyledElement&gt;(node);
-}
-
-RenderStyle* StyleResolver::locateSharedStyle()
-{
-    State&amp; state = m_state;
-    if (!is&lt;StyledElement&gt;(state.element()) || !state.parentStyle())
-        return nullptr;
-    auto&amp; styledElement = downcast&lt;StyledElement&gt;(*state.element());
-
-    // If the element has inline style it is probably unique.
-    if (styledElement.inlineStyle())
-        return nullptr;
-    if (styledElement.isSVGElement() &amp;&amp; downcast&lt;SVGElement&gt;(styledElement).animatedSMILStyleProperties())
-        return nullptr;
-    // Ids stop style sharing if they show up in the stylesheets.
-    if (styledElement.hasID() &amp;&amp; m_ruleSets.features().idsInRules.contains(styledElement.idForStyleResolution().impl()))
-        return nullptr;
-    if (parentElementPreventsSharing(styledElement.parentElement()))
-        return nullptr;
-    if (state.element() == state.document().cssTarget())
-        return nullptr;
-    if (elementHasDirectionAuto(*state.element()))
-        return nullptr;
-
-    // Cache whether state.element is affected by any known class selectors.
-    // FIXME: This shouldn't be a member variable. The style sharing code could be factored out of StyleResolver.
-    state.setElementAffectedByClassRules(state.element() &amp;&amp; state.element()-&gt;hasClass() &amp;&amp; classNamesAffectedByRules(state.element()-&gt;classNames()));
-
-    // Check previous siblings and their cousins.
-    unsigned count = 0;
-    unsigned visitedNodeCount = 0;
-    StyledElement* shareElement = nullptr;
-    Node* cousinList = styledElement.previousSibling();
-    while (cousinList) {
-        shareElement = findSiblingForStyleSharing(cousinList, count);
-        if (shareElement)
-            break;
-        cousinList = locateCousinList(cousinList-&gt;parentElement(), visitedNodeCount);
-    }
-
-    // If we have exhausted all our budget or our cousins.
-    if (!shareElement)
-        return nullptr;
-
-    // Can't share if sibling rules apply. This is checked at the end as it should rarely fail.
-    if (styleSharingCandidateMatchesRuleSet(m_ruleSets.sibling()))
-        return nullptr;
-    // Can't share if attribute rules apply.
-    if (styleSharingCandidateMatchesRuleSet(m_ruleSets.uncommonAttribute()))
-        return nullptr;
-    // Tracking child index requires unique style for each node. This may get set by the sibling rule match above.
-    if (parentElementPreventsSharing(styledElement.parentElement()))
-        return nullptr;
-    return shareElement-&gt;renderStyle();
-}
-
</del><span class="cx"> static inline bool isAtShadowBoundary(const Element* element)
</span><span class="cx"> {
</span><span class="cx">     if (!element)
</span><span class="lines">@@ -676,33 +366,13 @@
</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&amp; element, RenderStyle* parentStyle,
-    StyleSharingBehavior sharingBehavior, RuleMatchingBehavior matchingBehavior, const RenderRegion* regionForStyling, const SelectorFilter* selectorFilter)
</del><ins>+Ref&lt;RenderStyle&gt; StyleResolver::styleForElement(Element&amp; element, RenderStyle* parentStyle, RuleMatchingBehavior matchingBehavior, const RenderRegion* regionForStyling, const SelectorFilter* selectorFilter)
</ins><span class="cx"> {
</span><span class="cx">     RELEASE_ASSERT(!m_inLoadPendingImages);
</span><span class="cx"> 
</span><del>-    // Once an element has a renderer, we don't try to destroy it, since otherwise the renderer
-    // will vanish if a style recalc happens during loading.
-    if (sharingBehavior == AllowStyleSharing &amp;&amp; !m_document.haveStylesheetsLoaded() &amp;&amp; !element.renderer()) {
-        if (!s_styleNotYetAvailable) {
-            s_styleNotYetAvailable = &amp;RenderStyle::create().leakRef();
-            s_styleNotYetAvailable-&gt;setDisplay(NONE);
-            s_styleNotYetAvailable-&gt;fontCascade().update(&amp;m_document.fontSelector());
-        }
-        m_document.setHasNodesWithPlaceholderStyle();
-        return *s_styleNotYetAvailable;
-    }
-
</del><span class="cx">     m_state = State(element, parentStyle, regionForStyling, selectorFilter);
</span><span class="cx">     State&amp; state = m_state;
</span><span class="cx"> 
</span><del>-    if (sharingBehavior == AllowStyleSharing) {
-        if (RenderStyle* sharedStyle = locateSharedStyle()) {
-            state.clear();
-            return *sharedStyle;
-        }
-    }
-
</del><span class="cx">     if (state.parentStyle()) {
</span><span class="cx">         state.setStyle(RenderStyle::create());
</span><span class="cx">         state.style()-&gt;inheritFrom(state.parentStyle(), isAtShadowBoundary(&amp;element) ? RenderStyle::AtShadowBoundary : RenderStyle::NotAtShadowBoundary);
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleResolverh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleResolver.h (196030 => 196031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleResolver.h        2016-02-02 22:34:40 UTC (rev 196030)
+++ trunk/Source/WebCore/css/StyleResolver.h        2016-02-02 22:34:45 UTC (rev 196031)
</span><span class="lines">@@ -93,11 +93,6 @@
</span><span class="cx"> class WebKitCSSFilterValue;
</span><span class="cx"> struct ResourceLoaderOptions;
</span><span class="cx"> 
</span><del>-enum StyleSharingBehavior {
-    AllowStyleSharing,
-    DisallowStyleSharing,
-};
-
</del><span class="cx"> // MatchOnlyUserAgentRules is used in media queries, where relative units
</span><span class="cx"> // are interpreted according to the document root element style, and styled only
</span><span class="cx"> // from the User Agent Stylesheet rules.
</span><span class="lines">@@ -135,8 +130,7 @@
</span><span class="cx">     StyleResolver(Document&amp;);
</span><span class="cx">     ~StyleResolver();
</span><span class="cx"> 
</span><del>-    Ref&lt;RenderStyle&gt; styleForElement(Element&amp;, RenderStyle* parentStyle, StyleSharingBehavior = AllowStyleSharing,
-        RuleMatchingBehavior = MatchAllRules, const RenderRegion* regionForStyling = nullptr, const SelectorFilter* = nullptr);
</del><ins>+    Ref&lt;RenderStyle&gt; styleForElement(Element&amp;, RenderStyle* parentStyle, RuleMatchingBehavior = MatchAllRules, const RenderRegion* regionForStyling = nullptr, const SelectorFilter* = nullptr);
</ins><span class="cx"> 
</span><span class="cx">     void keyframeStylesForAnimation(Element&amp;, const RenderStyle*, KeyframeList&amp;);
</span><span class="cx"> 
</span><span class="lines">@@ -160,12 +154,6 @@
</span><span class="cx">     const MediaQueryEvaluator&amp; mediaQueryEvaluator() const { return *m_medium; }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    RenderStyle* locateSharedStyle();
-    bool styleSharingCandidateMatchesRuleSet(RuleSet*);
-    Node* locateCousinList(Element* parent, unsigned&amp; visitedNodeCount) const;
-    StyledElement* findSiblingForStyleSharing(Node*, unsigned&amp; count) const;
-    bool canShareStyleWithElement(StyledElement&amp;) const;
-
</del><span class="cx">     Ref&lt;RenderStyle&gt; styleForKeyframe(const RenderStyle*, const StyleKeyframe*, KeyframeValue&amp;);
</span><span class="cx"> 
</span><span class="cx"> public:
</span><span class="lines">@@ -378,8 +366,6 @@
</span><span class="cx"> 
</span><span class="cx">         const RenderRegion* regionForStyling() const { return m_regionForStyling; }
</span><span class="cx">         EInsideLink elementLinkState() const { return m_elementLinkState; }
</span><del>-        void setElementAffectedByClassRules(bool isAffected) { m_elementAffectedByClassRules = isAffected; }
-        bool elementAffectedByClassRules() const { return m_elementAffectedByClassRules; }
</del><span class="cx"> 
</span><span class="cx">         void setApplyPropertyToRegularStyle(bool isApply) { m_applyPropertyToRegularStyle = isApply; }
</span><span class="cx">         void setApplyPropertyToVisitedLinkStyle(bool isApply) { m_applyPropertyToVisitedLinkStyle = isApply; }
</span><span class="lines">@@ -435,7 +421,6 @@
</span><span class="cx">         
</span><span class="cx">         EInsideLink m_elementLinkState { NotInsideLink };
</span><span class="cx"> 
</span><del>-        bool m_elementAffectedByClassRules { false };
</del><span class="cx">         bool m_applyPropertyToRegularStyle { true };
</span><span class="cx">         bool m_applyPropertyToVisitedLinkStyle { false };
</span><span class="cx">         bool m_fontDirty { false };
</span><span class="lines">@@ -459,8 +444,6 @@
</span><span class="cx"> 
</span><span class="cx">     State&amp; state() { return m_state; }
</span><span class="cx"> 
</span><del>-    static RenderStyle* styleNotYetAvailable() { return s_styleNotYetAvailable; }
-
</del><span class="cx">     PassRefPtr&lt;StyleImage&gt; styleImage(CSSPropertyID, CSSValue&amp;);
</span><span class="cx">     PassRefPtr&lt;StyleImage&gt; cachedOrPendingFromValue(CSSPropertyID, CSSImageValue&amp;);
</span><span class="cx">     PassRefPtr&lt;StyleImage&gt; generatedOrPendingFromValue(CSSPropertyID, CSSImageGeneratorValue&amp;);
</span><span class="lines">@@ -488,12 +471,8 @@
</span><span class="cx">     void setTextOrientation(TextOrientation textOrientation) { m_state.setTextOrientation(textOrientation); }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    static RenderStyle* s_styleNotYetAvailable;
-
</del><span class="cx">     void cacheBorderAndBackground();
</span><span class="cx"> 
</span><del>-    bool canShareStyleWithControl(StyledElement&amp;) const;
-
</del><span class="cx">     void applyProperty(CSSPropertyID, CSSValue*, SelectorChecker::LinkMatchMask = SelectorChecker::MatchDefault, const MatchResult* = nullptr);
</span><span class="cx">     RefPtr&lt;CSSValue&gt; resolvedVariableValue(CSSPropertyID, const CSSVariableDependentValue&amp;);
</span><span class="cx"> 
</span><span class="lines">@@ -520,9 +499,6 @@
</span><span class="cx">     // the last reference to a style declaration are garbage collected.
</span><span class="cx">     void sweepMatchedPropertiesCache();
</span><span class="cx"> 
</span><del>-    bool classNamesAffectedByRules(const SpaceSplitString&amp;) const;
-    bool sharingCandidateHasIdenticalStyleAffectingAttributes(StyledElement&amp;) const;
-
</del><span class="cx">     unsigned m_matchedPropertiesCacheAdditionsSinceLastSweep;
</span><span class="cx"> 
</span><span class="cx">     typedef HashMap&lt;unsigned, MatchedPropertiesCacheItem&gt; MatchedPropertiesCache;
</span></span></pre></div>
<a id="trunkSourceWebCoredomVisitedLinkStatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/VisitedLinkState.cpp (196030 => 196031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/VisitedLinkState.cpp        2016-02-02 22:34:40 UTC (rev 196030)
+++ trunk/Source/WebCore/dom/VisitedLinkState.cpp        2016-02-02 22:34:45 UTC (rev 196031)
</span><span class="lines">@@ -41,7 +41,7 @@
</span><span class="cx"> 
</span><span class="cx"> using namespace HTMLNames;
</span><span class="cx"> 
</span><del>-inline static const AtomicString* linkAttribute(Element&amp; element)
</del><ins>+inline static const AtomicString* linkAttribute(const Element&amp; element)
</ins><span class="cx"> {
</span><span class="cx">     if (!element.isLink())
</span><span class="cx">         return 0;
</span><span class="lines">@@ -67,7 +67,7 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline static LinkHash linkHashForElement(Document&amp; document, Element&amp; element)
</del><ins>+inline static LinkHash linkHashForElement(Document&amp; document, const Element&amp; element)
</ins><span class="cx"> {
</span><span class="cx">     if (is&lt;HTMLAnchorElement&gt;(element))
</span><span class="cx">         return downcast&lt;HTMLAnchorElement&gt;(element).visitedLinkHash();
</span><span class="lines">@@ -86,7 +86,7 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-EInsideLink VisitedLinkState::determineLinkStateSlowCase(Element&amp; element)
</del><ins>+EInsideLink VisitedLinkState::determineLinkStateSlowCase(const Element&amp; element)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(element.isLink());
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomVisitedLinkStateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/VisitedLinkState.h (196030 => 196031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/VisitedLinkState.h        2016-02-02 22:34:40 UTC (rev 196030)
+++ trunk/Source/WebCore/dom/VisitedLinkState.h        2016-02-02 22:34:45 UTC (rev 196031)
</span><span class="lines">@@ -45,16 +45,16 @@
</span><span class="cx"> 
</span><span class="cx">     void invalidateStyleForAllLinks();
</span><span class="cx">     void invalidateStyleForLink(LinkHash);
</span><del>-    EInsideLink determineLinkState(Element&amp;);
</del><ins>+    EInsideLink determineLinkState(const Element&amp;);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    EInsideLink determineLinkStateSlowCase(Element&amp;);
</del><ins>+    EInsideLink determineLinkStateSlowCase(const Element&amp;);
</ins><span class="cx"> 
</span><span class="cx">     Document&amp; m_document;
</span><span class="cx">     HashSet&lt;LinkHash, LinkHashHash&gt; m_linksCheckedForVisitedState;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-inline EInsideLink VisitedLinkState::determineLinkState(Element&amp; element)
</del><ins>+inline EInsideLink VisitedLinkState::determineLinkState(const Element&amp; element)
</ins><span class="cx"> {
</span><span class="cx">     if (!element.isLink())
</span><span class="cx">         return NotInsideLink;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLFormControlElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLFormControlElement.h (196030 => 196031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLFormControlElement.h        2016-02-02 22:34:40 UTC (rev 196030)
+++ trunk/Source/WebCore/html/HTMLFormControlElement.h        2016-02-02 22:34:45 UTC (rev 196031)
</span><span class="lines">@@ -71,6 +71,7 @@
</span><span class="cx">     void dispatchFormControlInputEvent();
</span><span class="cx"> 
</span><span class="cx">     virtual bool isDisabledFormControl() const override;
</span><ins>+    virtual bool isDefaultButtonForForm() const override;
</ins><span class="cx"> 
</span><span class="cx">     virtual bool isFocusable() const override;
</span><span class="cx">     virtual bool isEnumeratable() const override { return false; }
</span><span class="lines">@@ -168,7 +169,6 @@
</span><span class="cx">     virtual short tabIndex() const override final;
</span><span class="cx"> 
</span><span class="cx">     virtual HTMLFormElement* virtualForm() const override;
</span><del>-    virtual bool isDefaultButtonForForm() const override;
</del><span class="cx">     bool isValidFormControlElement() const;
</span><span class="cx"> 
</span><span class="cx">     bool computeIsDisabledByFieldsetAncestor() const;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (196030 => 196031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderElement.cpp        2016-02-02 22:34:40 UTC (rev 196030)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp        2016-02-02 22:34:45 UTC (rev 196031)
</span><span class="lines">@@ -1590,7 +1590,7 @@
</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);
</ins><span class="cx">         result-&gt;setStyleType(FIRST_LINE_INHERITED);
</span><span class="cx">         return result.release();
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderNamedFlowFragmentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderNamedFlowFragment.cpp (196030 => 196031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderNamedFlowFragment.cpp        2016-02-02 22:34:40 UTC (rev 196030)
+++ trunk/Source/WebCore/rendering/RenderNamedFlowFragment.cpp        2016-02-02 22:34:45 UTC (rev 196031)
</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, MatchAllRules, this);
</ins><span class="cx"> 
</span><span class="cx">     return renderObjectRegionStyle.release();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleRenderStylecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (196030 => 196031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp        2016-02-02 22:34:40 UTC (rev 196030)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp        2016-02-02 22:34:45 UTC (rev 196031)
</span><span class="lines">@@ -42,6 +42,7 @@
</span><span class="cx"> #include &quot;StyleResolver.h&quot;
</span><span class="cx"> #include &quot;StyleScrollSnapPoints.h&quot;
</span><span class="cx"> #include &quot;StyleSelfAlignmentData.h&quot;
</span><ins>+#include &quot;StyleTreeResolver.h&quot;
</ins><span class="cx"> #include &quot;WillChangeData.h&quot;
</span><span class="cx"> #include &lt;wtf/MathExtras.h&gt;
</span><span class="cx"> #include &lt;wtf/PointerComparison.h&gt;
</span><span class="lines">@@ -293,7 +294,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool RenderStyle::isStyleAvailable() const
</span><span class="cx"> {
</span><del>-    return this != StyleResolver::styleNotYetAvailable();
</del><ins>+    return !Style::isPlaceholderStyle(*this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool RenderStyle::hasUniquePseudoStyle() const
</span></span></pre></div>
<a id="trunkSourceWebCorestyleStyleSharingResolvercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/style/StyleSharingResolver.cpp (0 => 196031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/StyleSharingResolver.cpp                                (rev 0)
+++ trunk/Source/WebCore/style/StyleSharingResolver.cpp        2016-02-02 22:34:45 UTC (rev 196031)
</span><span class="lines">@@ -0,0 +1,373 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;StyleSharingResolver.h&quot;
+
+#include &quot;DocumentRuleSets.h&quot;
+#include &quot;ElementRuleCollector.h&quot;
+#include &quot;HTMLInputElement.h&quot;
+#include &quot;HTMLNames.h&quot;
+#include &quot;NodeRenderStyle.h&quot;
+#include &quot;RenderStyle.h&quot;
+#include &quot;SVGElement.h&quot;
+#include &quot;StyledElement.h&quot;
+#include &quot;VisitedLinkState.h&quot;
+#include &quot;WebVTTElement.h&quot;
+#include &quot;XMLNames.h&quot;
+
+namespace WebCore {
+namespace Style {
+
+static const unsigned cStyleSearchThreshold = 10;
+static const unsigned cStyleSearchLevelThreshold = 10;
+
+struct SharingResolver::Context {
+    const StyledElement&amp; element;
+    bool elementAffectedByClassRules;
+    EInsideLink elementLinkState;
+};
+
+SharingResolver::SharingResolver(const Document&amp; document, const DocumentRuleSets&amp; ruleSets, const SelectorFilter&amp; selectorFilter)
+    : m_document(document)
+    , m_ruleSets(ruleSets)
+    , m_selectorFilter(selectorFilter)
+{
+}
+
+static inline bool parentElementPreventsSharing(const Element&amp; parentElement)
+{
+    return parentElement.hasFlagsSetDuringStylingOfChildren();
+}
+
+static inline bool elementHasDirectionAuto(const Element&amp; element)
+{
+    // FIXME: This line is surprisingly hot, we may wish to inline hasDirectionAuto into StyleResolver.
+    return is&lt;HTMLElement&gt;(element) &amp;&amp; downcast&lt;HTMLElement&gt;(element).hasDirectionAuto();
+}
+
+const Element* SharingResolver::resolve(const Element&amp; searchElement) const
+{
+    if (!is&lt;StyledElement&gt;(searchElement))
+        return nullptr;
+    auto&amp; element = downcast&lt;StyledElement&gt;(searchElement);
+    if (!element.parentElement())
+        return nullptr;
+    auto&amp; parentElement = *element.parentElement();
+    if (!parentElement.renderStyle())
+        return nullptr;
+    // If the element has inline style it is probably unique.
+    if (element.inlineStyle())
+        return nullptr;
+    if (element.isSVGElement() &amp;&amp; downcast&lt;SVGElement&gt;(element).animatedSMILStyleProperties())
+        return nullptr;
+    // Ids stop style sharing if they show up in the stylesheets.
+    if (element.hasID() &amp;&amp; m_ruleSets.features().idsInRules.contains(element.idForStyleResolution().impl()))
+        return nullptr;
+    if (parentElementPreventsSharing(parentElement))
+        return nullptr;
+    if (&amp;element == m_document.cssTarget())
+        return nullptr;
+    if (elementHasDirectionAuto(element))
+        return nullptr;
+
+    Context context {
+        element,
+        element.hasClass() &amp;&amp; classNamesAffectedByRules(element.classNames()),
+        m_document.visitedLinkState().determineLinkState(element)
+    };
+
+    // Check previous siblings and their cousins.
+    unsigned count = 0;
+    unsigned visitedNodeCount = 0;
+    StyledElement* shareElement = nullptr;
+    Node* cousinList = element.previousSibling();
+    while (cousinList) {
+        shareElement = findSibling(context, cousinList, count);
+        if (shareElement)
+            break;
+        cousinList = locateCousinList(cousinList-&gt;parentElement(), visitedNodeCount);
+    }
+
+    // If we have exhausted all our budget or our cousins.
+    if (!shareElement)
+        return nullptr;
+
+    // Can't share if sibling rules apply. This is checked at the end as it should rarely fail.
+    if (styleSharingCandidateMatchesRuleSet(element, m_ruleSets.sibling()))
+        return nullptr;
+    // Can't share if attribute rules apply.
+    if (styleSharingCandidateMatchesRuleSet(element, m_ruleSets.uncommonAttribute()))
+        return nullptr;
+    // Tracking child index requires unique style for each node. This may get set by the sibling rule match above.
+    if (parentElementPreventsSharing(parentElement))
+        return nullptr;
+
+    return shareElement;
+}
+
+StyledElement* SharingResolver::findSibling(const Context&amp; context, Node* node, unsigned&amp; count) const
+{
+    for (; node; node = node-&gt;previousSibling()) {
+        if (!is&lt;StyledElement&gt;(*node))
+            continue;
+        if (canShareStyleWithElement(context, downcast&lt;StyledElement&gt;(*node)))
+            break;
+        if (count++ == cStyleSearchThreshold)
+            return nullptr;
+    }
+    return downcast&lt;StyledElement&gt;(node);
+}
+
+Node* SharingResolver::locateCousinList(Element* parent, unsigned&amp; visitedNodeCount) const
+{
+    if (visitedNodeCount &gt;= cStyleSearchThreshold * cStyleSearchLevelThreshold)
+        return nullptr;
+    if (!is&lt;StyledElement&gt;(parent))
+        return nullptr;
+    auto&amp; styledParent = downcast&lt;StyledElement&gt;(*parent);
+    if (styledParent.inlineStyle())
+        return nullptr;
+    if (is&lt;SVGElement&gt;(styledParent) &amp;&amp; downcast&lt;SVGElement&gt;(styledParent).animatedSMILStyleProperties())
+        return nullptr;
+    if (styledParent.hasID() &amp;&amp; m_ruleSets.features().idsInRules.contains(styledParent.idForStyleResolution().impl()))
+        return nullptr;
+
+    RenderStyle* parentStyle = styledParent.renderStyle();
+    unsigned subcount = 0;
+    Node* thisCousin = &amp;styledParent;
+    Node* currentNode = styledParent.previousSibling();
+
+    // Reserve the tries for this level. This effectively makes sure that the algorithm
+    // will never go deeper than cStyleSearchLevelThreshold levels into recursion.
+    visitedNodeCount += cStyleSearchThreshold;
+    while (thisCousin) {
+        for (; currentNode; currentNode = currentNode-&gt;previousSibling()) {
+            if (++subcount &gt; cStyleSearchThreshold)
+                return nullptr;
+            if (!is&lt;Element&gt;(*currentNode))
+                continue;
+            auto&amp; currentElement = downcast&lt;Element&gt;(*currentNode);
+            if (currentElement.renderStyle() != parentStyle)
+                continue;
+            if (!currentElement.lastChild())
+                continue;
+            if (!parentElementPreventsSharing(currentElement)) {
+                // Adjust for unused reserved tries.
+                visitedNodeCount -= cStyleSearchThreshold - subcount;
+                return currentNode-&gt;lastChild();
+            }
+        }
+        currentNode = locateCousinList(thisCousin-&gt;parentElement(), visitedNodeCount);
+        thisCousin = currentNode;
+    }
+
+    return nullptr;
+}
+
+static bool canShareStyleWithControl(const HTMLFormControlElement&amp; element, const HTMLFormControlElement&amp; formElement)
+{
+    if (!is&lt;HTMLInputElement&gt;(formElement) || !is&lt;HTMLInputElement&gt;(element))
+        return false;
+
+    auto&amp; thisInputElement = downcast&lt;HTMLInputElement&gt;(formElement);
+    auto&amp; otherInputElement = downcast&lt;HTMLInputElement&gt;(element);
+
+    if (thisInputElement.isAutoFilled() != otherInputElement.isAutoFilled())
+        return false;
+    if (thisInputElement.shouldAppearChecked() != otherInputElement.shouldAppearChecked())
+        return false;
+    if (thisInputElement.shouldAppearIndeterminate() != otherInputElement.shouldAppearIndeterminate())
+        return false;
+    if (thisInputElement.isRequired() != otherInputElement.isRequired())
+        return false;
+
+    if (formElement.isDisabledFormControl() != element.isDisabledFormControl())
+        return false;
+
+    if (formElement.isDefaultButtonForForm() != element.isDefaultButtonForForm())
+        return false;
+
+    if (formElement.isInRange() != element.isInRange())
+        return false;
+
+    if (formElement.isOutOfRange() != element.isOutOfRange())
+        return false;
+
+    return true;
+}
+
+bool SharingResolver::canShareStyleWithElement(const Context&amp; context, const StyledElement&amp; candidateElement) const
+{
+    auto&amp; element = context.element;
+    auto* style = candidateElement.renderStyle();
+    if (!style)
+        return false;
+    if (style-&gt;unique())
+        return false;
+    if (style-&gt;hasUniquePseudoStyle())
+        return false;
+    if (candidateElement.tagQName() != element.tagQName())
+        return false;
+    if (candidateElement.inlineStyle())
+        return false;
+    if (candidateElement.needsStyleRecalc())
+        return false;
+    if (candidateElement.isSVGElement() &amp;&amp; downcast&lt;SVGElement&gt;(candidateElement).animatedSMILStyleProperties())
+        return false;
+    if (candidateElement.isLink() != element.isLink())
+        return false;
+    if (candidateElement.hovered() != element.hovered())
+        return false;
+    if (candidateElement.active() != element.active())
+        return false;
+    if (candidateElement.focused() != element.focused())
+        return false;
+    if (candidateElement.shadowPseudoId() != element.shadowPseudoId())
+        return false;
+    if (&amp;candidateElement == m_document.cssTarget())
+        return false;
+    if (!sharingCandidateHasIdenticalStyleAffectingAttributes(context, candidateElement))
+        return false;
+    if (const_cast&lt;StyledElement&amp;&gt;(candidateElement).additionalPresentationAttributeStyle() != const_cast&lt;StyledElement&amp;&gt;(element).additionalPresentationAttributeStyle())
+        return false;
+    if (candidateElement.affectsNextSiblingElementStyle() || candidateElement.styleIsAffectedByPreviousSibling())
+        return false;
+
+    if (candidateElement.hasID() &amp;&amp; m_ruleSets.features().idsInRules.contains(candidateElement.idForStyleResolution().impl()))
+        return false;
+
+    bool isControl = is&lt;HTMLFormControlElement&gt;(candidateElement);
+
+    if (isControl != is&lt;HTMLFormControlElement&gt;(element))
+        return false;
+
+    if (isControl &amp;&amp; !canShareStyleWithControl(downcast&lt;HTMLFormControlElement&gt;(element), downcast&lt;HTMLFormControlElement&gt;(candidateElement)))
+        return false;
+
+    if (style-&gt;transitions() || style-&gt;animations())
+        return false;
+
+    // Turn off style sharing for elements that can gain layers for reasons outside of the style system.
+    // See comments in RenderObject::setStyle().
+    if (candidateElement.hasTagName(HTMLNames::iframeTag) || candidateElement.hasTagName(HTMLNames::frameTag))
+        return false;
+
+    if (candidateElement.hasTagName(HTMLNames::embedTag) || candidateElement.hasTagName(HTMLNames::objectTag) || candidateElement.hasTagName(HTMLNames::appletTag) || candidateElement.hasTagName(HTMLNames::canvasTag))
+        return false;
+
+    if (elementHasDirectionAuto(candidateElement))
+        return false;
+
+    if (candidateElement.isLink() &amp;&amp; context.elementLinkState != style-&gt;insideLink())
+        return false;
+
+    if (candidateElement.elementData() != element.elementData()) {
+        if (candidateElement.fastGetAttribute(HTMLNames::readonlyAttr) != element.fastGetAttribute(HTMLNames::readonlyAttr))
+            return false;
+        if (candidateElement.isSVGElement()) {
+            if (candidateElement.getAttribute(HTMLNames::typeAttr) != element.getAttribute(HTMLNames::typeAttr))
+                return false;
+        } else {
+            if (candidateElement.fastGetAttribute(HTMLNames::typeAttr) != element.fastGetAttribute(HTMLNames::typeAttr))
+                return false;
+        }
+    }
+
+    if (candidateElement.matchesValidPseudoClass() != element.matchesValidPseudoClass())
+        return false;
+
+    if (element.matchesInvalidPseudoClass() != element.matchesValidPseudoClass())
+        return false;
+
+#if ENABLE(VIDEO_TRACK)
+    // Deny sharing styles between WebVTT and non-WebVTT nodes.
+    if (is&lt;WebVTTElement&gt;(element))
+        return false;
+#endif
+
+#if ENABLE(FULLSCREEN_API)
+    if (&amp;element == m_document.webkitCurrentFullScreenElement() || &amp;element == m_document.webkitCurrentFullScreenElement())
+        return false;
+#endif
+    return true;
+}
+
+bool SharingResolver::styleSharingCandidateMatchesRuleSet(const StyledElement&amp; element, const RuleSet* ruleSet) const
+{
+    if (!ruleSet)
+        return false;
+
+    ElementRuleCollector collector(const_cast&lt;StyledElement&amp;&gt;(element), nullptr, m_ruleSets, &amp;m_selectorFilter);
+    return collector.hasAnyMatchingRules(ruleSet);
+}
+
+bool SharingResolver::sharingCandidateHasIdenticalStyleAffectingAttributes(const Context&amp; context, const StyledElement&amp; sharingCandidate) const
+{
+    auto&amp; element = context.element;
+    if (element.elementData() == sharingCandidate.elementData())
+        return true;
+    if (element.fastGetAttribute(XMLNames::langAttr) != sharingCandidate.fastGetAttribute(XMLNames::langAttr))
+        return false;
+    if (element.fastGetAttribute(HTMLNames::langAttr) != sharingCandidate.fastGetAttribute(HTMLNames::langAttr))
+        return false;
+
+    if (context.elementAffectedByClassRules) {
+        if (!sharingCandidate.hasClass())
+            return false;
+        // SVG elements require a (slow!) getAttribute comparision because &quot;class&quot; is an animatable attribute for SVG.
+        if (element.isSVGElement()) {
+            if (element.getAttribute(HTMLNames::classAttr) != sharingCandidate.getAttribute(HTMLNames::classAttr))
+                return false;
+        } else {
+            if (element.classNames() != sharingCandidate.classNames())
+                return false;
+        }
+    } else if (sharingCandidate.hasClass() &amp;&amp; classNamesAffectedByRules(sharingCandidate.classNames()))
+        return false;
+
+    if (const_cast&lt;StyledElement&amp;&gt;(element).presentationAttributeStyle() != const_cast&lt;StyledElement&amp;&gt;(sharingCandidate).presentationAttributeStyle())
+        return false;
+
+    if (element.hasTagName(HTMLNames::progressTag)) {
+        if (element.shouldAppearIndeterminate() != sharingCandidate.shouldAppearIndeterminate())
+            return false;
+    }
+
+    return true;
+}
+
+bool SharingResolver::classNamesAffectedByRules(const SpaceSplitString&amp; classNames) const
+{
+    for (unsigned i = 0; i &lt; classNames.size(); ++i) {
+        if (m_ruleSets.features().classesInRules.contains(classNames[i].impl()))
+            return true;
+    }
+    return false;
+}
+
+
+}
+}
</ins></span></pre></div>
<a id="trunkSourceWebCorestyleStyleSharingResolverh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/style/StyleSharingResolver.h (0 => 196031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/StyleSharingResolver.h                                (rev 0)
+++ trunk/Source/WebCore/style/StyleSharingResolver.h        2016-02-02 22:34:45 UTC (rev 196031)
</span><span class="lines">@@ -0,0 +1,66 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef StyleSharingResolver_h
+#define StyleSharingResolver_h
+
+namespace WebCore {
+
+class Document;
+class DocumentRuleSets;
+class Element;
+class Node;
+class RuleSet;
+class SelectorFilter;
+class SpaceSplitString;
+class StyledElement;
+
+namespace Style {
+
+class SharingResolver {
+public:
+    SharingResolver(const Document&amp;, const DocumentRuleSets&amp;, const SelectorFilter&amp;);
+
+    const Element* resolve(const Element&amp;) const;
+
+private:
+    struct Context;
+
+    StyledElement* findSibling(const Context&amp;, Node*, unsigned&amp; count) const;
+    Node* locateCousinList(Element* parent, unsigned&amp; visitedNodeCount) const;
+    bool canShareStyleWithElement(const Context&amp;, const StyledElement&amp; candidateElement) const;
+    bool styleSharingCandidateMatchesRuleSet(const StyledElement&amp;, const RuleSet*) const;
+    bool sharingCandidateHasIdenticalStyleAffectingAttributes(const Context&amp;, const StyledElement&amp; sharingCandidate) const;
+    bool classNamesAffectedByRules(const SpaceSplitString&amp; classNames) const;
+
+    const Document&amp; m_document;
+    const DocumentRuleSets&amp; m_ruleSets;
+    const SelectorFilter&amp; m_selectorFilter;
+};
+
+}
+}
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebCorestyleStyleTreeResolvercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/style/StyleTreeResolver.cpp (196030 => 196031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/StyleTreeResolver.cpp        2016-02-02 22:34:40 UTC (rev 196030)
+++ trunk/Source/WebCore/style/StyleTreeResolver.cpp        2016-02-02 22:34:45 UTC (rev 196031)
</span><span class="lines">@@ -96,10 +96,24 @@
</span><span class="cx">     bool m_didPush { false };
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+
+static RenderStyle* placeholderStyle;
+
+static void ensurePlaceholderStyle(Document&amp; document)
+{
+    if (placeholderStyle)
+        return;
+    placeholderStyle = &amp;RenderStyle::create().leakRef();
+    placeholderStyle-&gt;setDisplay(NONE);
+    placeholderStyle-&gt;fontCascade().update(&amp;document.fontSelector());
+}
+
</ins><span class="cx"> TreeResolver::TreeResolver(Document&amp; document)
</span><span class="cx">     : m_document(document)
</span><span class="cx">     , m_styleResolver(document.ensureStyleResolver())
</span><ins>+    , m_sharingResolver(document, m_styleResolver.ruleSets(), m_selectorFilter)
</ins><span class="cx"> {
</span><ins>+    ensurePlaceholderStyle(document);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> TreeResolver::TreeResolver(ShadowRoot&amp; shadowRoot, TreeResolver&amp; shadowHostTreeResolver)
</span><span class="lines">@@ -107,6 +121,7 @@
</span><span class="cx">     , m_styleResolver(shadowRoot.styleResolver())
</span><span class="cx">     , m_shadowRoot(&amp;shadowRoot)
</span><span class="cx">     , m_shadowHostTreeResolver(&amp;shadowHostTreeResolver)
</span><ins>+    , m_sharingResolver(m_document, m_styleResolver.ruleSets(), m_selectorFilter)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -123,11 +138,20 @@
</span><span class="cx"> 
</span><span class="cx"> Ref&lt;RenderStyle&gt; TreeResolver::styleForElement(Element&amp; element, RenderStyle&amp; inheritedStyle)
</span><span class="cx"> {
</span><ins>+    if (!m_document.haveStylesheetsLoaded() &amp;&amp; !element.renderer()) {
+        m_document.setHasNodesWithPlaceholderStyle();
+        return *placeholderStyle;
+    }
+
</ins><span class="cx">     if (element.hasCustomStyleResolveCallbacks()) {
</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(element, &amp;inheritedStyle, AllowStyleSharing, MatchAllRules, nullptr, &amp;m_selectorFilter);
</del><ins>+
+    if (auto* sharingElement = m_sharingResolver.resolve(element))
+        return *sharingElement-&gt;renderStyle();
+
+    return m_styleResolver.styleForElement(element, &amp;inheritedStyle, MatchAllRules, nullptr, &amp;m_selectorFilter);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(CSS_REGIONS)
</span><span class="lines">@@ -948,5 +972,10 @@
</span><span class="cx">     return resolutionNestingDepth;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool isPlaceholderStyle(const RenderStyle&amp; style)
+{
+    return &amp;style == placeholderStyle;
</ins><span class="cx"> }
</span><ins>+
</ins><span class="cx"> }
</span><ins>+}
</ins></span></pre></div>
<a id="trunkSourceWebCorestyleStyleTreeResolverh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/style/StyleTreeResolver.h (196030 => 196031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/StyleTreeResolver.h        2016-02-02 22:34:40 UTC (rev 196030)
+++ trunk/Source/WebCore/style/StyleTreeResolver.h        2016-02-02 22:34:45 UTC (rev 196031)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #include &quot;RenderStyleConstants.h&quot;
</span><span class="cx"> #include &quot;SelectorFilter.h&quot;
</span><span class="cx"> #include &quot;StyleChange.h&quot;
</span><ins>+#include &quot;StyleSharingResolver.h&quot;
</ins><span class="cx"> #include &lt;functional&gt;
</span><span class="cx"> #include &lt;wtf/RefPtr.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -85,6 +86,7 @@
</span><span class="cx">     TreeResolver* m_shadowHostTreeResolver { nullptr };
</span><span class="cx"> 
</span><span class="cx">     SelectorFilter m_selectorFilter;
</span><ins>+    SharingResolver m_sharingResolver;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> void detachRenderTree(Element&amp;);
</span><span class="lines">@@ -95,6 +97,8 @@
</span><span class="cx"> void queuePostResolutionCallback(std::function&lt;void ()&gt;);
</span><span class="cx"> bool postResolutionCallbacksAreSuspended();
</span><span class="cx"> 
</span><ins>+bool isPlaceholderStyle(const RenderStyle&amp;);
+
</ins><span class="cx"> class PostResolutionCallbackDisabler {
</span><span class="cx"> public:
</span><span class="cx">     explicit PostResolutionCallbackDisabler(Document&amp;);
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGElement.cpp (196030 => 196031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGElement.cpp        2016-02-02 22:34:40 UTC (rev 196030)
+++ trunk/Source/WebCore/svg/SVGElement.cpp        2016-02-02 22:34:45 UTC (rev 196031)
</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);
</ins><span class="cx"> 
</span><span class="cx">     return resolveStyle(&amp;parentStyle);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGElementRareDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGElementRareData.h (196030 => 196031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGElementRareData.h        2016-02-02 22:34:40 UTC (rev 196030)
+++ trunk/Source/WebCore/svg/SVGElementRareData.h        2016-02-02 22:34:45 UTC (rev 196031)
</span><span class="lines">@@ -71,7 +71,7 @@
</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.styleResolver().styleForElement(element, parentStyle, DisallowStyleSharing, MatchAllRulesExcludingSMIL);
</del><ins>+            m_overrideComputedStyle = element.styleResolver().styleForElement(element, parentStyle, 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>