<!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>[206951] 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/206951">206951</a></dd>
<dt>Author</dt> <dd>antti@apple.com</dd>
<dt>Date</dt> <dd>2016-10-08 01:42:03 -0700 (Sat, 08 Oct 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Move StyleResolver ownership from Document/ShadowRoot to Style::Scope
https://bugs.webkit.org/show_bug.cgi?id=163148
Reviewed by Andreas Kling.
Reduce duplication between Document and ShadowRoot.
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::propertyValue):
* css/CSSStyleSheet.cpp:
(WebCore::CSSStyleSheet::didMutateRules):
* css/ElementRuleCollector.cpp:
(WebCore::ElementRuleCollector::matchHostPseudoClassRules):
(WebCore::ElementRuleCollector::matchSlottedPseudoElementRules):
* css/MediaQueryMatcher.cpp:
(WebCore::MediaQueryMatcher::documentElementUserAgentStyle):
* css/StyleMedia.cpp:
(WebCore::StyleMedia::matchMedium):
* css/parser/SizesAttributeParser.cpp:
(WebCore::SizesAttributeParser::mediaConditionMatches):
* dom/Document.cpp:
(WebCore::Document::~Document):
(WebCore::Document::childrenChanged):
(WebCore::Document::isPageBoxVisible):
(WebCore::Document::pageSizeAndMarginsInPixels):
(WebCore::Document::userAgentShadowTreeStyleResolver):
(WebCore::Document::fontsNeedUpdate):
(WebCore::Document::didClearStyleResolver):
(WebCore::Document::updateViewportUnitsOnResize):
(WebCore::Document::createStyleResolver): Deleted.
(WebCore::Document::clearStyleResolver): Deleted.
* dom/Document.h:
(WebCore::Document::styleResolverIfExists): Deleted.
(WebCore::Document::ensureStyleResolver): Deleted.
* dom/Element.cpp:
(WebCore::Element::styleResolver):
* dom/ShadowRoot.cpp:
(WebCore::ShadowRoot::styleResolver): Deleted.
(WebCore::ShadowRoot::styleResolverIfExists): Deleted.
(WebCore::ShadowRoot::resetStyleResolver): Deleted.
* dom/ShadowRoot.h:
* page/DOMWindow.cpp:
(WebCore::DOMWindow::getMatchedCSSRules):
* page/FrameView.cpp:
(WebCore::FrameView::layout):
* page/Page.cpp:
(WebCore::Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment):
* page/PrintContext.cpp:
(WebCore::PrintContext::pageProperty):
* platform/MemoryPressureHandler.cpp:
(WebCore::MemoryPressureHandler::releaseCriticalMemory):
* style/AttributeChangeInvalidation.cpp:
(WebCore::Style::mayBeAffectedByHostStyle):
* style/ClassChangeInvalidation.cpp:
(WebCore::Style::mayBeAffectedByHostStyle):
* style/IdChangeInvalidation.cpp:
(WebCore::Style::mayBeAffectedByHostStyle):
* style/StyleScope.cpp:
(WebCore::Style::Scope::resolver):
(WebCore::Style::Scope::resolverIfExists):
(WebCore::Style::Scope::clearResolver):
(WebCore::Style::Scope::analyzeStyleSheetChange):
(WebCore::Style::Scope::updateActiveStyleSheets):
(WebCore::Style::Scope::updateStyleResolver):
(WebCore::Style::Scope::styleResolver): Deleted.
(WebCore::Style::Scope::styleResolverIfExists): Deleted.
* style/StyleScope.h:
* style/StyleSharingResolver.cpp:
(WebCore::Style::SharingResolver::resolve):
(WebCore::Style::SharingResolver::canShareStyleWithElement):
* style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::Scope::Scope):
(WebCore::Style::TreeResolver::resolve):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssCSSComputedStyleDeclarationcpp">trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSStyleSheetcpp">trunk/Source/WebCore/css/CSSStyleSheet.cpp</a></li>
<li><a href="#trunkSourceWebCorecssElementRuleCollectorcpp">trunk/Source/WebCore/css/ElementRuleCollector.cpp</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="#trunkSourceWebCorecssparserSizesAttributeParsercpp">trunk/Source/WebCore/css/parser/SizesAttributeParser.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDocumentcpp">trunk/Source/WebCore/dom/Document.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDocumenth">trunk/Source/WebCore/dom/Document.h</a></li>
<li><a href="#trunkSourceWebCoredomElementcpp">trunk/Source/WebCore/dom/Element.cpp</a></li>
<li><a href="#trunkSourceWebCoredomShadowRootcpp">trunk/Source/WebCore/dom/ShadowRoot.cpp</a></li>
<li><a href="#trunkSourceWebCoredomShadowRooth">trunk/Source/WebCore/dom/ShadowRoot.h</a></li>
<li><a href="#trunkSourceWebCorepageDOMWindowcpp">trunk/Source/WebCore/page/DOMWindow.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFrameViewcpp">trunk/Source/WebCore/page/FrameView.cpp</a></li>
<li><a href="#trunkSourceWebCorepagePagecpp">trunk/Source/WebCore/page/Page.cpp</a></li>
<li><a href="#trunkSourceWebCorepagePrintContextcpp">trunk/Source/WebCore/page/PrintContext.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformMemoryPressureHandlercpp">trunk/Source/WebCore/platform/MemoryPressureHandler.cpp</a></li>
<li><a href="#trunkSourceWebCorestyleAttributeChangeInvalidationcpp">trunk/Source/WebCore/style/AttributeChangeInvalidation.cpp</a></li>
<li><a href="#trunkSourceWebCorestyleClassChangeInvalidationcpp">trunk/Source/WebCore/style/ClassChangeInvalidation.cpp</a></li>
<li><a href="#trunkSourceWebCorestyleIdChangeInvalidationcpp">trunk/Source/WebCore/style/IdChangeInvalidation.cpp</a></li>
<li><a href="#trunkSourceWebCorestyleStyleScopecpp">trunk/Source/WebCore/style/StyleScope.cpp</a></li>
<li><a href="#trunkSourceWebCorestyleStyleScopeh">trunk/Source/WebCore/style/StyleScope.h</a></li>
<li><a href="#trunkSourceWebCorestyleStyleSharingResolvercpp">trunk/Source/WebCore/style/StyleSharingResolver.cpp</a></li>
<li><a href="#trunkSourceWebCorestyleStyleTreeResolvercpp">trunk/Source/WebCore/style/StyleTreeResolver.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (206950 => 206951)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-10-08 08:31:00 UTC (rev 206950)
+++ trunk/Source/WebCore/ChangeLog        2016-10-08 08:42:03 UTC (rev 206951)
</span><span class="lines">@@ -1,3 +1,79 @@
</span><ins>+2016-10-08 Antti Koivisto <antti@apple.com>
+
+ Move StyleResolver ownership from Document/ShadowRoot to Style::Scope
+ https://bugs.webkit.org/show_bug.cgi?id=163148
+
+ Reviewed by Andreas Kling.
+
+ Reduce duplication between Document and ShadowRoot.
+
+ * css/CSSComputedStyleDeclaration.cpp:
+ (WebCore::ComputedStyleExtractor::propertyValue):
+ * css/CSSStyleSheet.cpp:
+ (WebCore::CSSStyleSheet::didMutateRules):
+ * css/ElementRuleCollector.cpp:
+ (WebCore::ElementRuleCollector::matchHostPseudoClassRules):
+ (WebCore::ElementRuleCollector::matchSlottedPseudoElementRules):
+ * css/MediaQueryMatcher.cpp:
+ (WebCore::MediaQueryMatcher::documentElementUserAgentStyle):
+ * css/StyleMedia.cpp:
+ (WebCore::StyleMedia::matchMedium):
+ * css/parser/SizesAttributeParser.cpp:
+ (WebCore::SizesAttributeParser::mediaConditionMatches):
+ * dom/Document.cpp:
+ (WebCore::Document::~Document):
+ (WebCore::Document::childrenChanged):
+ (WebCore::Document::isPageBoxVisible):
+ (WebCore::Document::pageSizeAndMarginsInPixels):
+ (WebCore::Document::userAgentShadowTreeStyleResolver):
+ (WebCore::Document::fontsNeedUpdate):
+ (WebCore::Document::didClearStyleResolver):
+ (WebCore::Document::updateViewportUnitsOnResize):
+ (WebCore::Document::createStyleResolver): Deleted.
+ (WebCore::Document::clearStyleResolver): Deleted.
+ * dom/Document.h:
+ (WebCore::Document::styleResolverIfExists): Deleted.
+ (WebCore::Document::ensureStyleResolver): Deleted.
+ * dom/Element.cpp:
+ (WebCore::Element::styleResolver):
+ * dom/ShadowRoot.cpp:
+ (WebCore::ShadowRoot::styleResolver): Deleted.
+ (WebCore::ShadowRoot::styleResolverIfExists): Deleted.
+ (WebCore::ShadowRoot::resetStyleResolver): Deleted.
+ * dom/ShadowRoot.h:
+ * page/DOMWindow.cpp:
+ (WebCore::DOMWindow::getMatchedCSSRules):
+ * page/FrameView.cpp:
+ (WebCore::FrameView::layout):
+ * page/Page.cpp:
+ (WebCore::Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment):
+ * page/PrintContext.cpp:
+ (WebCore::PrintContext::pageProperty):
+ * platform/MemoryPressureHandler.cpp:
+ (WebCore::MemoryPressureHandler::releaseCriticalMemory):
+ * style/AttributeChangeInvalidation.cpp:
+ (WebCore::Style::mayBeAffectedByHostStyle):
+ * style/ClassChangeInvalidation.cpp:
+ (WebCore::Style::mayBeAffectedByHostStyle):
+ * style/IdChangeInvalidation.cpp:
+ (WebCore::Style::mayBeAffectedByHostStyle):
+ * style/StyleScope.cpp:
+ (WebCore::Style::Scope::resolver):
+ (WebCore::Style::Scope::resolverIfExists):
+ (WebCore::Style::Scope::clearResolver):
+ (WebCore::Style::Scope::analyzeStyleSheetChange):
+ (WebCore::Style::Scope::updateActiveStyleSheets):
+ (WebCore::Style::Scope::updateStyleResolver):
+ (WebCore::Style::Scope::styleResolver): Deleted.
+ (WebCore::Style::Scope::styleResolverIfExists): Deleted.
+ * style/StyleScope.h:
+ * style/StyleSharingResolver.cpp:
+ (WebCore::Style::SharingResolver::resolve):
+ (WebCore::Style::SharingResolver::canShareStyleWithElement):
+ * style/StyleTreeResolver.cpp:
+ (WebCore::Style::TreeResolver::Scope::Scope):
+ (WebCore::Style::TreeResolver::resolve):
+
</ins><span class="cx"> 2016-10-07 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> window.navigator.language incorrectly returns all lowercase string
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSComputedStyleDeclarationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (206950 => 206951)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp        2016-10-08 08:31:00 UTC (rev 206950)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp        2016-10-08 08:42:03 UTC (rev 206951)
</span><span class="lines">@@ -70,6 +70,7 @@
</span><span class="cx"> #include "StylePropertyShorthand.h"
</span><span class="cx"> #include "StylePropertyShorthandFunctions.h"
</span><span class="cx"> #include "StyleResolver.h"
</span><ins>+#include "StyleScope.h"
</ins><span class="cx"> #include "WebKitCSSFilterValue.h"
</span><span class="cx"> #include "WebKitCSSTransformValue.h"
</span><span class="cx"> #include "WebKitFontFamilyNames.h"
</span><span class="lines">@@ -2494,7 +2495,7 @@
</span><span class="cx"> // FIXME: Some of these cases could be narrowed down or optimized better.
</span><span class="cx"> forceFullLayout = isLayoutDependent(propertyID, style, renderer)
</span><span class="cx"> || styledNode->isInShadowTree()
</span><del>- || (document.styleResolverIfExists() && document.styleResolverIfExists()->hasViewportDependentMediaQueries() && document.ownerElement());
</del><ins>+ || (document.styleScope().resolverIfExists() && document.styleScope().resolverIfExists()->hasViewportDependentMediaQueries() && document.ownerElement());
</ins><span class="cx">
</span><span class="cx"> if (forceFullLayout) {
</span><span class="cx"> document.updateLayoutIgnorePendingStylesheets();
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSStyleSheetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSStyleSheet.cpp (206950 => 206951)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSStyleSheet.cpp        2016-10-08 08:31:00 UTC (rev 206950)
+++ trunk/Source/WebCore/css/CSSStyleSheet.cpp        2016-10-08 08:42:03 UTC (rev 206951)
</span><span class="lines">@@ -177,7 +177,7 @@
</span><span class="cx">
</span><span class="cx"> if (mutationType == RuleInsertion && !contentsWereClonedForMutation && !scope->activeStyleSheetsContains(this)) {
</span><span class="cx"> if (insertedKeyframesRule) {
</span><del>- if (auto* resolver = scope->styleResolverIfExists())
</del><ins>+ if (auto* resolver = scope->resolverIfExists())
</ins><span class="cx"> resolver->addKeyframeStyle(*insertedKeyframesRule);
</span><span class="cx"> return;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecssElementRuleCollectorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/ElementRuleCollector.cpp (206950 => 206951)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/ElementRuleCollector.cpp        2016-10-08 08:31:00 UTC (rev 206950)
+++ trunk/Source/WebCore/css/ElementRuleCollector.cpp        2016-10-08 08:42:03 UTC (rev 206951)
</span><span class="lines">@@ -45,6 +45,7 @@
</span><span class="cx"> #include "SelectorFilter.h"
</span><span class="cx"> #include "ShadowRoot.h"
</span><span class="cx"> #include "StyleProperties.h"
</span><ins>+#include "StyleScope.h"
</ins><span class="cx"> #include "StyledElement.h"
</span><span class="cx">
</span><span class="cx"> #include <wtf/TemporaryChange.h>
</span><span class="lines">@@ -234,7 +235,7 @@
</span><span class="cx">
</span><span class="cx"> matchRequest.treeContextOrdinal++;
</span><span class="cx">
</span><del>- auto& shadowAuthorStyle = m_element.shadowRoot()->styleResolver().ruleSets().authorStyle();
</del><ins>+ auto& shadowAuthorStyle = m_element.shadowRoot()->styleScope().resolver().ruleSets().authorStyle();
</ins><span class="cx"> auto& shadowHostRules = shadowAuthorStyle.hostPseudoClassRules();
</span><span class="cx"> if (shadowHostRules.isEmpty())
</span><span class="cx"> return;
</span><span class="lines">@@ -265,11 +266,11 @@
</span><span class="cx">
</span><span class="cx"> // In nested case the slot may itself be assigned to a slot. Collect ::slotted rules from all the nested trees.
</span><span class="cx"> maybeSlotted = slot;
</span><del>- if (!hostShadowRoot->styleResolver().ruleSets().isAuthorStyleDefined())
</del><ins>+ if (!hostShadowRoot->styleScope().resolver().ruleSets().isAuthorStyleDefined())
</ins><span class="cx"> continue;
</span><span class="cx"> // Find out if there are any ::slotted rules in the shadow tree matching the current slot.
</span><span class="cx"> // FIXME: This is really part of the slot style and could be cached when resolving it.
</span><del>- ElementRuleCollector collector(*slot, hostShadowRoot->styleResolver().ruleSets().authorStyle(), nullptr);
</del><ins>+ ElementRuleCollector collector(*slot, hostShadowRoot->styleScope().resolver().ruleSets().authorStyle(), nullptr);
</ins><span class="cx"> auto slottedPseudoElementRules = collector.collectSlottedPseudoElementRulesForSlot(matchRequest.includeEmptyRules);
</span><span class="cx"> if (!slottedPseudoElementRules)
</span><span class="cx"> continue;
</span></span></pre></div>
<a id="trunkSourceWebCorecssMediaQueryMatchercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/MediaQueryMatcher.cpp (206950 => 206951)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/MediaQueryMatcher.cpp        2016-10-08 08:31:00 UTC (rev 206950)
+++ trunk/Source/WebCore/css/MediaQueryMatcher.cpp        2016-10-08 08:42:03 UTC (rev 206951)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #include "NodeRenderStyle.h"
</span><span class="cx"> #include "RenderElement.h"
</span><span class="cx"> #include "StyleResolver.h"
</span><ins>+#include "StyleScope.h"
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="lines">@@ -65,7 +66,7 @@
</span><span class="cx"> if (!documentElement)
</span><span class="cx"> return nullptr;
</span><span class="cx">
</span><del>- return m_document->ensureStyleResolver().styleForElement(*documentElement, m_document->renderStyle(), MatchOnlyUserAgentRules).renderStyle;
</del><ins>+ return m_document->styleScope().resolver().styleForElement(*documentElement, m_document->renderStyle(), MatchOnlyUserAgentRules).renderStyle;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool MediaQueryMatcher::evaluate(const MediaQuerySet& media)
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleMediacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleMedia.cpp (206950 => 206951)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleMedia.cpp        2016-10-08 08:31:00 UTC (rev 206950)
+++ trunk/Source/WebCore/css/StyleMedia.cpp        2016-10-08 08:42:03 UTC (rev 206951)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx"> #include "NodeRenderStyle.h"
</span><span class="cx"> #include "RenderElement.h"
</span><span class="cx"> #include "StyleResolver.h"
</span><ins>+#include "StyleScope.h"
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="lines">@@ -62,7 +63,7 @@
</span><span class="cx"> if (!documentElement)
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- auto rootStyle = document->ensureStyleResolver().styleForElement(*documentElement, document->renderStyle(), MatchOnlyUserAgentRules).renderStyle;
</del><ins>+ auto rootStyle = document->styleScope().resolver().styleForElement(*documentElement, document->renderStyle(), MatchOnlyUserAgentRules).renderStyle;
</ins><span class="cx">
</span><span class="cx"> auto media = MediaQuerySet::create();
</span><span class="cx"> if (!media->parse(query))
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserSizesAttributeParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/SizesAttributeParser.cpp (206950 => 206951)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/SizesAttributeParser.cpp        2016-10-08 08:31:00 UTC (rev 206950)
+++ trunk/Source/WebCore/css/parser/SizesAttributeParser.cpp        2016-10-08 08:42:03 UTC (rev 206951)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx"> #include "MediaQueryEvaluator.h"
</span><span class="cx"> #include "RenderView.h"
</span><span class="cx"> #include "SizesCalcParser.h"
</span><ins>+#include "StyleScope.h"
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="lines">@@ -110,7 +111,7 @@
</span><span class="cx"> if (!renderer)
</span><span class="cx"> return false;
</span><span class="cx"> auto& style = renderer->style();
</span><del>- return MediaQueryEvaluator { "screen", m_document, &style }.evaluate(mediaCondition, m_document.styleResolverIfExists());
</del><ins>+ return MediaQueryEvaluator { "screen", m_document, &style }.evaluate(mediaCondition, const_cast<Style::Scope&>(m_document.styleScope()).resolverIfExists());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool SizesAttributeParser::parse(CSSParserTokenRange range)
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (206950 => 206951)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2016-10-08 08:31:00 UTC (rev 206950)
+++ trunk/Source/WebCore/dom/Document.cpp        2016-10-08 08:42:03 UTC (rev 206951)
</span><span class="lines">@@ -631,7 +631,7 @@
</span><span class="cx">
</span><span class="cx"> extensionStyleSheets().detachFromDocument();
</span><span class="cx">
</span><del>- clearStyleResolver(); // We need to destroy CSSFontSelector before destroying m_cachedResourceLoader.
</del><ins>+ styleScope().clearResolver(); // We need to destroy CSSFontSelector before destroying m_cachedResourceLoader.
</ins><span class="cx"> m_fontSelector->clearDocument();
</span><span class="cx"> m_fontSelector->unregisterForInvalidationCallbacks(*this);
</span><span class="cx">
</span><span class="lines">@@ -863,7 +863,7 @@
</span><span class="cx"> return;
</span><span class="cx"> m_documentElement = newDocumentElement;
</span><span class="cx"> // The root style used for media query matching depends on the document element.
</span><del>- clearStyleResolver();
</del><ins>+ styleScope().clearResolver();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if ENABLE(CUSTOM_ELEMENTS)
</span><span class="lines">@@ -2097,13 +2097,13 @@
</span><span class="cx">
</span><span class="cx"> bool Document::isPageBoxVisible(int pageIndex)
</span><span class="cx"> {
</span><del>- std::unique_ptr<RenderStyle> pageStyle(ensureStyleResolver().styleForPage(pageIndex));
</del><ins>+ std::unique_ptr<RenderStyle> pageStyle(styleScope().resolver().styleForPage(pageIndex));
</ins><span class="cx"> return pageStyle->visibility() != HIDDEN; // display property doesn't apply to @page.
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void Document::pageSizeAndMarginsInPixels(int pageIndex, IntSize& pageSize, int& marginTop, int& marginRight, int& marginBottom, int& marginLeft)
</span><span class="cx"> {
</span><del>- std::unique_ptr<RenderStyle> style = ensureStyleResolver().styleForPage(pageIndex);
</del><ins>+ std::unique_ptr<RenderStyle> style = styleScope().resolver().styleForPage(pageIndex);
</ins><span class="cx">
</span><span class="cx"> int width = pageSize.width();
</span><span class="cx"> int height = pageSize.height();
</span><span class="lines">@@ -2139,12 +2139,6 @@
</span><span class="cx"> marginLeft = style->marginLeft().isAuto() ? marginLeft : intValueForLength(style->marginLeft(), width);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Document::createStyleResolver()
-{
- m_styleResolver = std::make_unique<StyleResolver>(*this);
- m_styleResolver->appendAuthorStyleSheets(styleScope().activeStyleSheets());
-}
-
</del><span class="cx"> StyleResolver& Document::userAgentShadowTreeStyleResolver()
</span><span class="cx"> {
</span><span class="cx"> if (!m_userAgentShadowTreeStyleResolver) {
</span><span class="lines">@@ -2151,7 +2145,7 @@
</span><span class="cx"> m_userAgentShadowTreeStyleResolver = std::make_unique<StyleResolver>(*this);
</span><span class="cx">
</span><span class="cx"> // FIXME: Filter out shadow pseudo elements we don't want to expose to authors.
</span><del>- auto& documentAuthorStyle = ensureStyleResolver().ruleSets().authorStyle();
</del><ins>+ auto& documentAuthorStyle = styleScope().resolver().ruleSets().authorStyle();
</ins><span class="cx"> if (documentAuthorStyle.hasShadowPseudoElementRules())
</span><span class="cx"> m_userAgentShadowTreeStyleResolver->ruleSets().authorStyle().copyShadowPseudoElementRulesFrom(documentAuthorStyle);
</span><span class="cx"> }
</span><span class="lines">@@ -2161,16 +2155,15 @@
</span><span class="cx">
</span><span class="cx"> void Document::fontsNeedUpdate(FontSelector&)
</span><span class="cx"> {
</span><del>- if (m_styleResolver)
- m_styleResolver->invalidateMatchedPropertiesCache();
</del><ins>+ if (auto* resolver = styleScope().resolverIfExists())
+ resolver->invalidateMatchedPropertiesCache();
</ins><span class="cx"> if (pageCacheState() != NotInPageCache || !renderView())
</span><span class="cx"> return;
</span><span class="cx"> scheduleForcedStyleRecalc();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Document::clearStyleResolver()
</del><ins>+void Document::didClearStyleResolver()
</ins><span class="cx"> {
</span><del>- m_styleResolver = nullptr;
</del><span class="cx"> m_userAgentShadowTreeStyleResolver = nullptr;
</span><span class="cx">
</span><span class="cx"> m_fontSelector->buildStarted();
</span><span class="lines">@@ -3491,7 +3484,7 @@
</span><span class="cx"> if (!hasStyleWithViewportUnits())
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- ensureStyleResolver().clearCachedPropertiesAffectedByViewportUnits();
</del><ins>+ styleScope().resolver().clearCachedPropertiesAffectedByViewportUnits();
</ins><span class="cx">
</span><span class="cx"> // FIXME: Ideally, we should save the list of elements that have viewport units and only iterate over those.
</span><span class="cx"> for (Element* element = ElementTraversal::firstWithin(rootNode()); element; element = ElementTraversal::nextIncludingPseudo(*element)) {
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.h (206950 => 206951)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.h        2016-10-08 08:31:00 UTC (rev 206950)
+++ trunk/Source/WebCore/dom/Document.h        2016-10-08 08:42:03 UTC (rev 206951)
</span><span class="lines">@@ -487,16 +487,8 @@
</span><span class="cx">
</span><span class="cx"> bool isSrcdocDocument() const { return m_isSrcdocDocument; }
</span><span class="cx">
</span><del>- StyleResolver* styleResolverIfExists() const { return m_styleResolver.get(); }
-
</del><span class="cx"> bool sawElementsInKnownNamespaces() const { return m_sawElementsInKnownNamespaces; }
</span><span class="cx">
</span><del>- StyleResolver& ensureStyleResolver()
- {
- if (!m_styleResolver)
- createStyleResolver();
- return *m_styleResolver;
- }
</del><span class="cx"> StyleResolver& userAgentShadowTreeStyleResolver();
</span><span class="cx">
</span><span class="cx"> CSSFontSelector& fontSelector() { return m_fontSelector; }
</span><span class="lines">@@ -1230,7 +1222,7 @@
</span><span class="cx">
</span><span class="cx"> void didRemoveAllPendingStylesheet();
</span><span class="cx"> void setNeedsNotifyRemoveAllPendingStylesheet() { m_needsNotifyRemoveAllPendingStylesheet = true; }
</span><del>- void clearStyleResolver();
</del><ins>+ void didClearStyleResolver();
</ins><span class="cx">
</span><span class="cx"> bool inStyleRecalc() const { return m_inStyleRecalc; }
</span><span class="cx"> bool inRenderTreeUpdate() const { return m_inRenderTreeUpdate; }
</span><span class="lines">@@ -1352,8 +1344,6 @@
</span><span class="cx">
</span><span class="cx"> void buildAccessKeyMap(TreeScope* root);
</span><span class="cx">
</span><del>- void createStyleResolver();
-
</del><span class="cx"> void loadEventDelayTimerFired();
</span><span class="cx">
</span><span class="cx"> void pendingTasksTimerFired();
</span><span class="lines">@@ -1397,7 +1387,6 @@
</span><span class="cx">
</span><span class="cx"> unsigned m_referencingNodeCount;
</span><span class="cx">
</span><del>- std::unique_ptr<StyleResolver> m_styleResolver;
</del><span class="cx"> std::unique_ptr<StyleResolver> m_userAgentShadowTreeStyleResolver;
</span><span class="cx"> bool m_hasNodesWithPlaceholderStyle;
</span><span class="cx"> bool m_needsNotifyRemoveAllPendingStylesheet;
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.cpp (206950 => 206951)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.cpp        2016-10-08 08:31:00 UTC (rev 206950)
+++ trunk/Source/WebCore/dom/Element.cpp        2016-10-08 08:42:03 UTC (rev 206951)
</span><span class="lines">@@ -97,6 +97,7 @@
</span><span class="cx"> #include "SlotAssignment.h"
</span><span class="cx"> #include "StyleProperties.h"
</span><span class="cx"> #include "StyleResolver.h"
</span><ins>+#include "StyleScope.h"
</ins><span class="cx"> #include "StyleTreeResolver.h"
</span><span class="cx"> #include "TextIterator.h"
</span><span class="cx"> #include "VoidCallback.h"
</span><span class="lines">@@ -1429,9 +1430,9 @@
</span><span class="cx"> StyleResolver& Element::styleResolver()
</span><span class="cx"> {
</span><span class="cx"> if (auto* shadowRoot = containingShadowRoot())
</span><del>- return shadowRoot->styleResolver();
</del><ins>+ return shadowRoot->styleScope().resolver();
</ins><span class="cx">
</span><del>- return document().ensureStyleResolver();
</del><ins>+ return document().styleScope().resolver();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ElementStyle Element::resolveStyle(const RenderStyle* parentStyle)
</span></span></pre></div>
<a id="trunkSourceWebCoredomShadowRootcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ShadowRoot.cpp (206950 => 206951)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ShadowRoot.cpp        2016-10-08 08:31:00 UTC (rev 206950)
+++ trunk/Source/WebCore/dom/ShadowRoot.cpp        2016-10-08 08:42:03 UTC (rev 206951)
</span><span class="lines">@@ -41,7 +41,6 @@
</span><span class="cx">
</span><span class="cx"> struct SameSizeAsShadowRoot : public DocumentFragment, public TreeScope {
</span><span class="cx"> unsigned countersAndFlags[1];
</span><del>- void* styleResolver;
</del><span class="cx"> void* styleScope;
</span><span class="cx"> void* host;
</span><span class="cx"> void* slotAssignment;
</span><span class="lines">@@ -80,33 +79,6 @@
</span><span class="cx"> removeDetachedChildren();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-StyleResolver& ShadowRoot::styleResolver()
-{
- if (m_type == Mode::UserAgent)
- return document().userAgentShadowTreeStyleResolver();
-
- if (!m_styleResolver) {
- // FIXME: We could share style resolver with shadow roots that have identical style.
- m_styleResolver = std::make_unique<StyleResolver>(document());
- if (m_styleScope)
- m_styleResolver->appendAuthorStyleSheets(m_styleScope->activeStyleSheets());
- }
- return *m_styleResolver;
-}
-
-StyleResolver* ShadowRoot::styleResolverIfExists()
-{
- if (m_type == Mode::UserAgent)
- return &document().userAgentShadowTreeStyleResolver();
-
- return m_styleResolver.get();
-}
-
-void ShadowRoot::resetStyleResolver()
-{
- m_styleResolver = nullptr;
-}
-
</del><span class="cx"> Style::Scope& ShadowRoot::styleScope()
</span><span class="cx"> {
</span><span class="cx"> if (!m_styleScope)
</span><span class="lines">@@ -114,14 +86,6 @@
</span><span class="cx"> return *m_styleScope;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void ShadowRoot::updateStyle()
-{
- if (!m_styleScope)
- return;
- // FIXME: Make optimized updated work.
- m_styleScope->didChangeContentsOrInterpretation();
-}
-
</del><span class="cx"> String ShadowRoot::innerHTML() const
</span><span class="cx"> {
</span><span class="cx"> return createMarkup(*this, ChildrenOnly);
</span></span></pre></div>
<a id="trunkSourceWebCoredomShadowRooth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ShadowRoot.h (206950 => 206951)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ShadowRoot.h        2016-10-08 08:31:00 UTC (rev 206950)
+++ trunk/Source/WebCore/dom/ShadowRoot.h        2016-10-08 08:42:03 UTC (rev 206951)
</span><span class="lines">@@ -61,13 +61,8 @@
</span><span class="cx">
</span><span class="cx"> using TreeScope::rootNode;
</span><span class="cx">
</span><del>- StyleResolver& styleResolver();
- StyleResolver* styleResolverIfExists();
</del><span class="cx"> Style::Scope& styleScope();
</span><span class="cx">
</span><del>- void updateStyle();
- void resetStyleResolver();
-
</del><span class="cx"> bool resetStyleInheritance() const { return m_resetStyleInheritance; }
</span><span class="cx"> void setResetStyleInheritance(bool);
</span><span class="cx">
</span><span class="lines">@@ -114,7 +109,6 @@
</span><span class="cx">
</span><span class="cx"> Element* m_host { nullptr };
</span><span class="cx">
</span><del>- std::unique_ptr<StyleResolver> m_styleResolver;
</del><span class="cx"> std::unique_ptr<Style::Scope> m_styleScope;
</span><span class="cx">
</span><span class="cx"> std::unique_ptr<SlotAssignment> m_slotAssignment;
</span></span></pre></div>
<a id="trunkSourceWebCorepageDOMWindowcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMWindow.cpp (206950 => 206951)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMWindow.cpp        2016-10-08 08:31:00 UTC (rev 206950)
+++ trunk/Source/WebCore/page/DOMWindow.cpp        2016-10-08 08:42:03 UTC (rev 206951)
</span><span class="lines">@@ -1442,7 +1442,7 @@
</span><span class="cx">
</span><span class="cx"> PseudoId pseudoId = CSSSelector::pseudoId(pseudoType);
</span><span class="cx">
</span><del>- auto matchedRules = m_frame->document()->ensureStyleResolver().pseudoStyleRulesForElement(element, pseudoId, rulesToInclude);
</del><ins>+ auto matchedRules = m_frame->document()->styleScope().resolver().pseudoStyleRulesForElement(element, pseudoId, rulesToInclude);
</ins><span class="cx"> if (matchedRules.isEmpty())
</span><span class="cx"> return nullptr;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.cpp (206950 => 206951)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameView.cpp        2016-10-08 08:31:00 UTC (rev 206950)
+++ trunk/Source/WebCore/page/FrameView.cpp        2016-10-08 08:42:03 UTC (rev 206951)
</span><span class="lines">@@ -1332,7 +1332,7 @@
</span><span class="cx"> m_layoutPhase = InPreLayoutStyleUpdate;
</span><span class="cx">
</span><span class="cx"> // Viewport-dependent media queries may cause us to need completely different style information.
</span><del>- StyleResolver* styleResolver = document.styleResolverIfExists();
</del><ins>+ auto* styleResolver = document.styleScope().resolverIfExists();
</ins><span class="cx"> if (!styleResolver || styleResolver->hasMediaQueriesAffectedByViewportChange()) {
</span><span class="cx"> LOG(Layout, " hasMediaQueriesAffectedByViewportChange, enqueueing style recalc");
</span><span class="cx"> document.styleScope().didChangeContentsOrInterpretation();
</span></span></pre></div>
<a id="trunkSourceWebCorepagePagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Page.cpp (206950 => 206951)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Page.cpp        2016-10-08 08:31:00 UTC (rev 206950)
+++ trunk/Source/WebCore/page/Page.cpp        2016-10-08 08:42:03 UTC (rev 206951)
</span><span class="lines">@@ -491,7 +491,7 @@
</span><span class="cx"> // the properties cache.
</span><span class="cx"> if (!frame->document())
</span><span class="cx"> continue;
</span><del>- if (StyleResolver* styleResolver = frame->document()->styleResolverIfExists())
</del><ins>+ if (StyleResolver* styleResolver = frame->document()->styleScope().resolverIfExists())
</ins><span class="cx"> styleResolver->invalidateMatchedPropertiesCache();
</span><span class="cx"> frame->document()->scheduleForcedStyleRecalc();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorepagePrintContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/PrintContext.cpp (206950 => 206951)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/PrintContext.cpp        2016-10-08 08:31:00 UTC (rev 206950)
+++ trunk/Source/WebCore/page/PrintContext.cpp        2016-10-08 08:42:03 UTC (rev 206951)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #include "RenderView.h"
</span><span class="cx"> #include "StyleInheritedData.h"
</span><span class="cx"> #include "StyleResolver.h"
</span><ins>+#include "StyleScope.h"
</ins><span class="cx"> #include <wtf/text/WTFString.h>
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -251,7 +252,7 @@
</span><span class="cx"> PrintContext printContext(frame);
</span><span class="cx"> printContext.begin(800); // Any width is OK here.
</span><span class="cx"> document->updateLayout();
</span><del>- std::unique_ptr<RenderStyle> style = document->ensureStyleResolver().styleForPage(pageNumber);
</del><ins>+ std::unique_ptr<RenderStyle> style = document->styleScope().resolver().styleForPage(pageNumber);
</ins><span class="cx">
</span><span class="cx"> // Implement formatters for properties we care about.
</span><span class="cx"> if (!strcmp(propertyName, "margin-left")) {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformMemoryPressureHandlercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/MemoryPressureHandler.cpp (206950 => 206951)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/MemoryPressureHandler.cpp        2016-10-08 08:31:00 UTC (rev 206950)
+++ trunk/Source/WebCore/platform/MemoryPressureHandler.cpp        2016-10-08 08:42:03 UTC (rev 206951)
</span><span class="lines">@@ -39,6 +39,7 @@
</span><span class="cx"> #include "Page.h"
</span><span class="cx"> #include "PageCache.h"
</span><span class="cx"> #include "ScrollingThread.h"
</span><ins>+#include "StyleScope.h"
</ins><span class="cx"> #include "StyledElement.h"
</span><span class="cx"> #include "WorkerThread.h"
</span><span class="cx"> #include <JavaScriptCore/IncrementalSweeper.h>
</span><span class="lines">@@ -128,7 +129,7 @@
</span><span class="cx"> Vector<RefPtr<Document>> documents;
</span><span class="cx"> copyToVector(Document::allDocuments(), documents);
</span><span class="cx"> for (auto& document : documents)
</span><del>- document->clearStyleResolver();
</del><ins>+ document->styleScope().clearResolver();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCorestyleAttributeChangeInvalidationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/style/AttributeChangeInvalidation.cpp (206950 => 206951)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/AttributeChangeInvalidation.cpp        2016-10-08 08:31:00 UTC (rev 206950)
+++ trunk/Source/WebCore/style/AttributeChangeInvalidation.cpp        2016-10-08 08:42:03 UTC (rev 206951)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #include "ShadowRoot.h"
</span><span class="cx"> #include "StyleInvalidationAnalysis.h"
</span><span class="cx"> #include "StyleResolver.h"
</span><ins>+#include "StyleScope.h"
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> namespace Style {
</span><span class="lines">@@ -37,7 +38,7 @@
</span><span class="cx">
</span><span class="cx"> static bool mayBeAffectedByHostStyle(ShadowRoot& shadowRoot, bool isHTML, const QualifiedName& attributeName)
</span><span class="cx"> {
</span><del>- auto& shadowRuleSets = shadowRoot.styleResolver().ruleSets();
</del><ins>+ auto& shadowRuleSets = shadowRoot.styleScope().resolver().ruleSets();
</ins><span class="cx"> if (shadowRuleSets.authorStyle().hostPseudoClassRules().isEmpty())
</span><span class="cx"> return false;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorestyleClassChangeInvalidationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/style/ClassChangeInvalidation.cpp (206950 => 206951)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/ClassChangeInvalidation.cpp        2016-10-08 08:31:00 UTC (rev 206950)
+++ trunk/Source/WebCore/style/ClassChangeInvalidation.cpp        2016-10-08 08:42:03 UTC (rev 206951)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #include "SpaceSplitString.h"
</span><span class="cx"> #include "StyleInvalidationAnalysis.h"
</span><span class="cx"> #include "StyleResolver.h"
</span><ins>+#include "StyleScope.h"
</ins><span class="cx"> #include <wtf/BitVector.h>
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -87,7 +88,7 @@
</span><span class="cx">
</span><span class="cx"> static bool mayBeAffectedByHostStyle(ShadowRoot& shadowRoot, AtomicStringImpl* changedClass)
</span><span class="cx"> {
</span><del>- auto& shadowRuleSets = shadowRoot.styleResolver().ruleSets();
</del><ins>+ auto& shadowRuleSets = shadowRoot.styleScope().resolver().ruleSets();
</ins><span class="cx"> if (shadowRuleSets.authorStyle().hostPseudoClassRules().isEmpty())
</span><span class="cx"> return false;
</span><span class="cx"> return shadowRuleSets.features().classesInRules.contains(changedClass);
</span></span></pre></div>
<a id="trunkSourceWebCorestyleIdChangeInvalidationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/style/IdChangeInvalidation.cpp (206950 => 206951)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/IdChangeInvalidation.cpp        2016-10-08 08:31:00 UTC (rev 206950)
+++ trunk/Source/WebCore/style/IdChangeInvalidation.cpp        2016-10-08 08:42:03 UTC (rev 206951)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #include "ElementChildIterator.h"
</span><span class="cx"> #include "ShadowRoot.h"
</span><span class="cx"> #include "StyleResolver.h"
</span><ins>+#include "StyleScope.h"
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> namespace Style {
</span><span class="lines">@@ -36,7 +37,7 @@
</span><span class="cx">
</span><span class="cx"> static bool mayBeAffectedByHostStyle(ShadowRoot& shadowRoot, const AtomicString& changedId)
</span><span class="cx"> {
</span><del>- auto& shadowRuleSets = shadowRoot.styleResolver().ruleSets();
</del><ins>+ auto& shadowRuleSets = shadowRoot.styleScope().resolver().ruleSets();
</ins><span class="cx"> if (shadowRuleSets.authorStyle().hostPseudoClassRules().isEmpty())
</span><span class="cx"> return false;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorestyleStyleScopecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/style/StyleScope.cpp (206950 => 206951)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/StyleScope.cpp        2016-10-08 08:31:00 UTC (rev 206950)
+++ trunk/Source/WebCore/style/StyleScope.cpp        2016-10-08 08:42:03 UTC (rev 206951)
</span><span class="lines">@@ -71,22 +71,34 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-StyleResolver& Scope::styleResolver()
</del><ins>+StyleResolver& Scope::resolver()
</ins><span class="cx"> {
</span><del>- if (m_shadowRoot)
- return m_shadowRoot->styleResolver();
</del><ins>+ if (m_shadowRoot && m_shadowRoot->mode() == ShadowRoot::Mode::UserAgent)
+ return m_document.userAgentShadowTreeStyleResolver();
</ins><span class="cx">
</span><del>- return m_document.ensureStyleResolver();
</del><ins>+ if (!m_resolver) {
+ m_resolver = std::make_unique<StyleResolver>(m_document);
+ m_resolver->appendAuthorStyleSheets(m_activeStyleSheets);
+ }
+ return *m_resolver;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-StyleResolver* Scope::styleResolverIfExists()
</del><ins>+StyleResolver* Scope::resolverIfExists()
</ins><span class="cx"> {
</span><del>- if (m_shadowRoot)
- return m_shadowRoot->styleResolverIfExists();
</del><ins>+ if (m_shadowRoot && m_shadowRoot->mode() == ShadowRoot::Mode::UserAgent)
+ return &m_document.userAgentShadowTreeStyleResolver();
</ins><span class="cx">
</span><del>- return m_document.styleResolverIfExists();
</del><ins>+ return m_resolver.get();
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+void Scope::clearResolver()
+{
+ m_resolver = nullptr;
+
+ if (!m_shadowRoot)
+ m_document.didClearStyleResolver();
+}
+
</ins><span class="cx"> Scope& Scope::forNode(Node& node)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(node.inDocument());
</span><span class="lines">@@ -118,7 +130,8 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (m_shadowRoot) {
</span><del>- m_shadowRoot->updateStyle();
</del><ins>+ // FIXME: Make optimized updates work.
+ didChangeContentsOrInterpretation();
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -248,10 +261,10 @@
</span><span class="cx">
</span><span class="cx"> unsigned newStylesheetCount = newStylesheets.size();
</span><span class="cx">
</span><del>- if (!styleResolverIfExists())
</del><ins>+ if (!resolverIfExists())
</ins><span class="cx"> return Reconstruct;
</span><span class="cx">
</span><del>- StyleResolver& styleResolver = *styleResolverIfExists();
</del><ins>+ auto& styleResolver = *resolverIfExists();
</ins><span class="cx">
</span><span class="cx"> // Find out which stylesheets are new.
</span><span class="cx"> unsigned oldStylesheetCount = m_activeStyleSheets.size();
</span><span class="lines">@@ -323,7 +336,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (!m_document.hasLivingRenderTree()) {
</span><del>- m_document.clearStyleResolver();
</del><ins>+ clearResolver();
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -330,7 +343,7 @@
</span><span class="cx"> // Don't bother updating, since we haven't loaded all our style info yet
</span><span class="cx"> // and haven't calculated the style resolver for the first time.
</span><span class="cx"> if (!m_shadowRoot && !m_didUpdateActiveStyleSheets && m_pendingStyleSheetCount) {
</span><del>- m_document.clearStyleResolver();
</del><ins>+ clearResolver();
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -378,13 +391,10 @@
</span><span class="cx"> void Scope::updateStyleResolver(Vector<RefPtr<CSSStyleSheet>>& activeStyleSheets, StyleResolverUpdateType updateType)
</span><span class="cx"> {
</span><span class="cx"> if (updateType == Reconstruct) {
</span><del>- if (m_shadowRoot)
- m_shadowRoot->resetStyleResolver();
- else
- m_document.clearStyleResolver();
</del><ins>+ clearResolver();
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><del>- auto& styleResolver = this->styleResolver();
</del><ins>+ auto& styleResolver = resolver();
</ins><span class="cx">
</span><span class="cx"> if (updateType == Reset) {
</span><span class="cx"> styleResolver.ruleSets().resetAuthorStyle();
</span></span></pre></div>
<a id="trunkSourceWebCorestyleStyleScopeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/style/StyleScope.h (206950 => 206951)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/StyleScope.h        2016-10-08 08:31:00 UTC (rev 206950)
+++ trunk/Source/WebCore/style/StyleScope.h        2016-10-08 08:42:03 UTC (rev 206951)
</span><span class="lines">@@ -89,8 +89,9 @@
</span><span class="cx"> bool hasPendingUpdate() const { return !!m_pendingUpdateType; }
</span><span class="cx"> void flushPendingUpdate();
</span><span class="cx">
</span><del>- StyleResolver& styleResolver();
- StyleResolver* styleResolverIfExists();
</del><ins>+ StyleResolver& resolver();
+ StyleResolver* resolverIfExists();
+ void clearResolver();
</ins><span class="cx">
</span><span class="cx"> static Scope& forNode(Node&);
</span><span class="cx">
</span><span class="lines">@@ -114,6 +115,8 @@
</span><span class="cx"> Document& m_document;
</span><span class="cx"> ShadowRoot* m_shadowRoot { nullptr };
</span><span class="cx">
</span><ins>+ std::unique_ptr<StyleResolver> m_resolver;
+
</ins><span class="cx"> Vector<RefPtr<StyleSheet>> m_styleSheetsForStyleSheetList;
</span><span class="cx"> Vector<RefPtr<CSSStyleSheet>> m_activeStyleSheets;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorestyleStyleSharingResolvercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/style/StyleSharingResolver.cpp (206950 => 206951)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/StyleSharingResolver.cpp        2016-10-08 08:31:00 UTC (rev 206950)
+++ trunk/Source/WebCore/style/StyleSharingResolver.cpp        2016-10-08 08:42:03 UTC (rev 206951)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx"> #include "RenderStyle.h"
</span><span class="cx"> #include "SVGElement.h"
</span><span class="cx"> #include "ShadowRoot.h"
</span><ins>+#include "StyleScope.h"
</ins><span class="cx"> #include "StyleUpdate.h"
</span><span class="cx"> #include "StyledElement.h"
</span><span class="cx"> #include "VisitedLinkState.h"
</span><span class="lines">@@ -97,7 +98,7 @@
</span><span class="cx"> return nullptr;
</span><span class="cx"> if (elementHasDirectionAuto(element))
</span><span class="cx"> return nullptr;
</span><del>- if (element.shadowRoot() && !element.shadowRoot()->styleResolver().ruleSets().authorStyle().hostPseudoClassRules().isEmpty())
</del><ins>+ if (element.shadowRoot() && !element.shadowRoot()->styleScope().resolver().ruleSets().authorStyle().hostPseudoClassRules().isEmpty())
</ins><span class="cx"> return nullptr;
</span><span class="cx">
</span><span class="cx"> Context context {
</span><span class="lines">@@ -287,7 +288,7 @@
</span><span class="cx"> if (candidateElement.matchesDefaultPseudoClass() != element.matchesDefaultPseudoClass())
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- if (element.shadowRoot() && !element.shadowRoot()->styleResolver().ruleSets().authorStyle().hostPseudoClassRules().isEmpty())
</del><ins>+ if (element.shadowRoot() && !element.shadowRoot()->styleScope().resolver().ruleSets().authorStyle().hostPseudoClassRules().isEmpty())
</ins><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> #if ENABLE(FULLSCREEN_API)
</span></span></pre></div>
<a id="trunkSourceWebCorestyleStyleTreeResolvercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/style/StyleTreeResolver.cpp (206950 => 206951)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/StyleTreeResolver.cpp        2016-10-08 08:31:00 UTC (rev 206950)
+++ trunk/Source/WebCore/style/StyleTreeResolver.cpp        2016-10-08 08:42:03 UTC (rev 206951)
</span><span class="lines">@@ -83,13 +83,13 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> TreeResolver::Scope::Scope(Document& document)
</span><del>- : styleResolver(document.ensureStyleResolver())
</del><ins>+ : styleResolver(document.styleScope().resolver())
</ins><span class="cx"> , sharingResolver(document, styleResolver.ruleSets(), selectorFilter)
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> TreeResolver::Scope::Scope(ShadowRoot& shadowRoot, Scope& enclosingScope)
</span><del>- : styleResolver(shadowRoot.styleResolver())
</del><ins>+ : styleResolver(shadowRoot.styleScope().resolver())
</ins><span class="cx"> , sharingResolver(shadowRoot.documentScope(), styleResolver.ruleSets(), selectorFilter)
</span><span class="cx"> , shadowRoot(&shadowRoot)
</span><span class="cx"> , enclosingScope(&enclosingScope)
</span><span class="lines">@@ -440,7 +440,7 @@
</span><span class="cx">
</span><span class="cx"> Element* documentElement = m_document.documentElement();
</span><span class="cx"> if (!documentElement) {
</span><del>- m_document.ensureStyleResolver();
</del><ins>+ m_document.styleScope().resolver();
</ins><span class="cx"> return nullptr;
</span><span class="cx"> }
</span><span class="cx"> if (change != Force && !documentElement->childNeedsStyleRecalc() && !documentElement->needsStyleRecalc())
</span></span></pre>
</div>
</div>
</body>
</html>