<!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>[197764] 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/197764">197764</a></dd>
<dt>Author</dt> <dd>antti@apple.com</dd>
<dt>Date</dt> <dd>2016-03-08 06:59:53 -0800 (Tue, 08 Mar 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>ElementRuleCollector should not mutate document and style
https://bugs.webkit.org/show_bug.cgi?id=155113
Reviewed by Andreas Kling.
Move applying of style relations out of ElementRuleCollector and StyleResolver.
This gets us closer to making StyleResolver const for Element.
* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* css/ElementRuleCollector.cpp:
(WebCore::ElementRuleCollector::ElementRuleCollector):
No need for style parameter anymore.
(WebCore::ElementRuleCollector::collectMatchingRules):
(WebCore::ElementRuleCollector::sortAndTransferMatchedRules):
(WebCore::ElementRuleCollector::ruleMatches):
Client will now do the style and element mutations. Just collect the data here.
(WebCore::ElementRuleCollector::collectMatchingRulesForList):
(WebCore::ElementRuleCollector::commitStyleRelations): Deleted.
Moves to StyleRelations.cpp
* css/ElementRuleCollector.h:
(WebCore::ElementRuleCollector::hasMatchedRules):
(WebCore::ElementRuleCollector::matchedPseudoElementIds):
(WebCore::ElementRuleCollector::styleRelations):
(WebCore::ElementRuleCollector::didMatchUncommonAttributeSelector):
* css/MediaQueryMatcher.cpp:
(WebCore::MediaQueryMatcher::prepareEvaluator):
(WebCore::MediaQueryMatcher::evaluate):
* css/SelectorChecker.cpp:
(WebCore::addStyleRelation):
(WebCore::isFirstChildElement):
(WebCore::isFirstOfType):
(WebCore::countElementsBefore):
(WebCore::countElementsOfTypeBefore):
(WebCore::SelectorChecker::matchRecursively):
(WebCore::SelectorChecker::checkOne):
* css/SelectorChecker.h:
(WebCore::SelectorChecker::CheckingContext::CheckingContext):
* css/StyleMedia.cpp:
(WebCore::StyleMedia::matchMedium):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::StyleResolver):
(WebCore::isAtShadowBoundary):
(WebCore::StyleResolver::styleForElement):
Apply the style relations affecting current style immediately.
Pass the rest to the client.
(WebCore::StyleResolver::styleForKeyframe):
(WebCore::StyleResolver::pseudoStyleForElement):
(WebCore::StyleResolver::pseudoStyleRulesForElement):
* css/StyleResolver.h:
(WebCore::ElementStyle::ElementStyle):
* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateAddStyleRelationIfResolvingStyle):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateAddStyleRelation):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateSelectorCheckerExcludingPseudoElements):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateDirectAdjacentTreeWalker):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateIndirectAdjacentTreeWalker):
(WebCore::SelectorCompiler::addStyleRelationFunction):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsActive):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsEmpty):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsFirstChild):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsHovered):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsLastChild):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsOnlyChild):
(WebCore::SelectorCompiler::makeContextStyleUniqueIfNecessaryAndTestIsPlaceholderShown):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthChild):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthChildOf):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthLastChild):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthLastChildOf):
* dom/Document.cpp:
(WebCore::Document::styleForElementIgnoringPendingStylesheets):
Apply style relations.
(WebCore::Document::updateLayoutIfDimensionsOutOfDate):
* dom/Element.cpp:
(WebCore::Element::styleResolver):
(WebCore::Element::resolveStyle):
(WebCore::Element::didDetachRenderers):
(WebCore::Element::resolveCustomStyle):
Return ElementStyle (which contains style relations along with the render style).
Rename for consistency.
(WebCore::Element::cloneAttributesFromElement):
(WebCore::Element::customStyleForRenderer): Deleted.
* dom/Element.h:
(WebCore::Element::isVisibleInViewportChanged):
* dom/PseudoElement.cpp:
(WebCore::PseudoElement::clearHostElement):
(WebCore::PseudoElement::resolveCustomStyle):
(WebCore::PseudoElement::didAttachRenderers):
(WebCore::PseudoElement::customStyleForRenderer): Deleted.
* dom/PseudoElement.h:
* html/HTMLTitleElement.cpp:
(WebCore::HTMLTitleElement::computedTextWithDirection):
* html/shadow/SliderThumbElement.cpp:
(WebCore::SliderThumbElement::hostInput):
(WebCore::SliderThumbElement::resolveCustomStyle):
(WebCore::SliderThumbElement::shadowPseudoId):
(WebCore::SliderContainerElement::createElementRenderer):
(WebCore::SliderContainerElement::resolveCustomStyle):
(WebCore::SliderContainerElement::shadowPseudoId):
(WebCore::SliderThumbElement::customStyleForRenderer): Deleted.
(WebCore::SliderContainerElement::customStyleForRenderer): Deleted.
* html/shadow/SliderThumbElement.h:
* html/shadow/TextControlInnerElements.cpp:
(WebCore::TextControlInnerElement::create):
(WebCore::TextControlInnerElement::resolveCustomStyle):
(WebCore::TextControlInnerTextElement::renderer):
(WebCore::TextControlInnerTextElement::resolveCustomStyle):
(WebCore::TextControlPlaceholderElement::TextControlPlaceholderElement):
(WebCore::TextControlPlaceholderElement::resolveCustomStyle):
(WebCore::TextControlInnerElement::customStyleForRenderer): Deleted.
(WebCore::TextControlInnerTextElement::customStyleForRenderer): Deleted.
(WebCore::TextControlPlaceholderElement::customStyleForRenderer): Deleted.
* html/shadow/TextControlInnerElements.h:
* rendering/RenderElement.cpp:
(WebCore::RenderElement::getUncachedPseudoStyle):
* rendering/RenderNamedFlowFragment.cpp:
(WebCore::RenderNamedFlowFragment::computeStyleInRegion):
(WebCore::RenderNamedFlowFragment::computeChildrenStyleInRegion):
* style/StyleRelations.cpp: Added.
(WebCore::Style::commitRelationsToRenderStyle):
Commit relations affecting style that is being computed.
(WebCore::Style::commitRelationsToDocument):
Commit relations that mutate document.
* style/StyleRelations.h: Added.
Factor style relation data structures and functions to a file of their own.
(WebCore::Style::Relation::Relation):
* style/StyleSharingResolver.cpp:
(WebCore::Style::SharingResolver::styleSharingCandidateMatchesRuleSet):
* style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::styleForElement):
Apply style relations.
* style/StyleTreeResolver.h:
* svg/SVGElement.cpp:
(WebCore::SVGElement::synchronizeSystemLanguage):
(WebCore::SVGElement::resolveCustomStyle):
(WebCore::SVGElement::customStyleForRenderer): Deleted.
* svg/SVGElement.h:
* 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="#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="#trunkSourceWebCorecssSelectorCheckercpp">trunk/Source/WebCore/css/SelectorChecker.cpp</a></li>
<li><a href="#trunkSourceWebCorecssSelectorCheckerh">trunk/Source/WebCore/css/SelectorChecker.h</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="#trunkSourceWebCorecssjitSelectorCompilercpp">trunk/Source/WebCore/cssjit/SelectorCompiler.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDocumentcpp">trunk/Source/WebCore/dom/Document.cpp</a></li>
<li><a href="#trunkSourceWebCoredomElementcpp">trunk/Source/WebCore/dom/Element.cpp</a></li>
<li><a href="#trunkSourceWebCoredomElementh">trunk/Source/WebCore/dom/Element.h</a></li>
<li><a href="#trunkSourceWebCoredomPseudoElementcpp">trunk/Source/WebCore/dom/PseudoElement.cpp</a></li>
<li><a href="#trunkSourceWebCoredomPseudoElementh">trunk/Source/WebCore/dom/PseudoElement.h</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLTitleElementcpp">trunk/Source/WebCore/html/HTMLTitleElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlshadowSliderThumbElementcpp">trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlshadowSliderThumbElementh">trunk/Source/WebCore/html/shadow/SliderThumbElement.h</a></li>
<li><a href="#trunkSourceWebCorehtmlshadowTextControlInnerElementscpp">trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlshadowTextControlInnerElementsh">trunk/Source/WebCore/html/shadow/TextControlInnerElements.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="#trunkSourceWebCorestyleStyleSharingResolvercpp">trunk/Source/WebCore/style/StyleSharingResolver.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="#trunkSourceWebCoresvgSVGElementh">trunk/Source/WebCore/svg/SVGElement.h</a></li>
<li><a href="#trunkSourceWebCoresvgSVGElementRareDatah">trunk/Source/WebCore/svg/SVGElementRareData.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorestyleStyleRelationscpp">trunk/Source/WebCore/style/StyleRelations.cpp</a></li>
<li><a href="#trunkSourceWebCorestyleStyleRelationsh">trunk/Source/WebCore/style/StyleRelations.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 (197763 => 197764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2016-03-08 14:50:15 UTC (rev 197763)
+++ trunk/Source/WebCore/CMakeLists.txt        2016-03-08 14:59:53 UTC (rev 197764)
</span><span class="lines">@@ -2635,6 +2635,7 @@
</span><span class="cx"> style/RenderTreePosition.cpp
</span><span class="cx"> style/StyleChange.cpp
</span><span class="cx"> style/StyleFontSizeFunctions.cpp
</span><ins>+ style/StyleRelations.cpp
</ins><span class="cx"> style/StyleResolveForDocument.cpp
</span><span class="cx"> style/StyleSharingResolver.cpp
</span><span class="cx"> style/StyleTreeResolver.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (197763 => 197764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-03-08 14:50:15 UTC (rev 197763)
+++ trunk/Source/WebCore/ChangeLog        2016-03-08 14:59:53 UTC (rev 197764)
</span><span class="lines">@@ -1,3 +1,165 @@
</span><ins>+2016-03-07 Antti Koivisto <antti@apple.com>
+
+ ElementRuleCollector should not mutate document and style
+ https://bugs.webkit.org/show_bug.cgi?id=155113
+
+ Reviewed by Andreas Kling.
+
+ Move applying of style relations out of ElementRuleCollector and StyleResolver.
+ This gets us closer to making StyleResolver const for Element.
+
+ * CMakeLists.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * css/ElementRuleCollector.cpp:
+ (WebCore::ElementRuleCollector::ElementRuleCollector):
+
+ No need for style parameter anymore.
+
+ (WebCore::ElementRuleCollector::collectMatchingRules):
+ (WebCore::ElementRuleCollector::sortAndTransferMatchedRules):
+ (WebCore::ElementRuleCollector::ruleMatches):
+
+ Client will now do the style and element mutations. Just collect the data here.
+
+ (WebCore::ElementRuleCollector::collectMatchingRulesForList):
+ (WebCore::ElementRuleCollector::commitStyleRelations): Deleted.
+
+ Moves to StyleRelations.cpp
+
+ * css/ElementRuleCollector.h:
+ (WebCore::ElementRuleCollector::hasMatchedRules):
+ (WebCore::ElementRuleCollector::matchedPseudoElementIds):
+ (WebCore::ElementRuleCollector::styleRelations):
+ (WebCore::ElementRuleCollector::didMatchUncommonAttributeSelector):
+ * css/MediaQueryMatcher.cpp:
+ (WebCore::MediaQueryMatcher::prepareEvaluator):
+ (WebCore::MediaQueryMatcher::evaluate):
+ * css/SelectorChecker.cpp:
+ (WebCore::addStyleRelation):
+ (WebCore::isFirstChildElement):
+ (WebCore::isFirstOfType):
+ (WebCore::countElementsBefore):
+ (WebCore::countElementsOfTypeBefore):
+ (WebCore::SelectorChecker::matchRecursively):
+ (WebCore::SelectorChecker::checkOne):
+ * css/SelectorChecker.h:
+ (WebCore::SelectorChecker::CheckingContext::CheckingContext):
+ * css/StyleMedia.cpp:
+ (WebCore::StyleMedia::matchMedium):
+ * css/StyleResolver.cpp:
+ (WebCore::StyleResolver::StyleResolver):
+ (WebCore::isAtShadowBoundary):
+ (WebCore::StyleResolver::styleForElement):
+
+ Apply the style relations affecting current style immediately.
+ Pass the rest to the client.
+
+ (WebCore::StyleResolver::styleForKeyframe):
+ (WebCore::StyleResolver::pseudoStyleForElement):
+ (WebCore::StyleResolver::pseudoStyleRulesForElement):
+ * css/StyleResolver.h:
+ (WebCore::ElementStyle::ElementStyle):
+ * cssjit/SelectorCompiler.cpp:
+ (WebCore::SelectorCompiler::SelectorCodeGenerator::generateAddStyleRelationIfResolvingStyle):
+ (WebCore::SelectorCompiler::SelectorCodeGenerator::generateAddStyleRelation):
+ (WebCore::SelectorCompiler::SelectorCodeGenerator::generateSelectorCheckerExcludingPseudoElements):
+ (WebCore::SelectorCompiler::SelectorCodeGenerator::generateDirectAdjacentTreeWalker):
+ (WebCore::SelectorCompiler::SelectorCodeGenerator::generateIndirectAdjacentTreeWalker):
+ (WebCore::SelectorCompiler::addStyleRelationFunction):
+ (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsActive):
+ (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsEmpty):
+ (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsFirstChild):
+ (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsHovered):
+ (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsLastChild):
+ (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsOnlyChild):
+ (WebCore::SelectorCompiler::makeContextStyleUniqueIfNecessaryAndTestIsPlaceholderShown):
+ (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthChild):
+ (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthChildOf):
+ (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthLastChild):
+ (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthLastChildOf):
+ * dom/Document.cpp:
+ (WebCore::Document::styleForElementIgnoringPendingStylesheets):
+
+ Apply style relations.
+
+ (WebCore::Document::updateLayoutIfDimensionsOutOfDate):
+ * dom/Element.cpp:
+ (WebCore::Element::styleResolver):
+ (WebCore::Element::resolveStyle):
+ (WebCore::Element::didDetachRenderers):
+ (WebCore::Element::resolveCustomStyle):
+
+ Return ElementStyle (which contains style relations along with the render style).
+ Rename for consistency.
+
+ (WebCore::Element::cloneAttributesFromElement):
+ (WebCore::Element::customStyleForRenderer): Deleted.
+ * dom/Element.h:
+ (WebCore::Element::isVisibleInViewportChanged):
+ * dom/PseudoElement.cpp:
+ (WebCore::PseudoElement::clearHostElement):
+ (WebCore::PseudoElement::resolveCustomStyle):
+ (WebCore::PseudoElement::didAttachRenderers):
+ (WebCore::PseudoElement::customStyleForRenderer): Deleted.
+ * dom/PseudoElement.h:
+ * html/HTMLTitleElement.cpp:
+ (WebCore::HTMLTitleElement::computedTextWithDirection):
+ * html/shadow/SliderThumbElement.cpp:
+ (WebCore::SliderThumbElement::hostInput):
+ (WebCore::SliderThumbElement::resolveCustomStyle):
+ (WebCore::SliderThumbElement::shadowPseudoId):
+ (WebCore::SliderContainerElement::createElementRenderer):
+ (WebCore::SliderContainerElement::resolveCustomStyle):
+ (WebCore::SliderContainerElement::shadowPseudoId):
+ (WebCore::SliderThumbElement::customStyleForRenderer): Deleted.
+ (WebCore::SliderContainerElement::customStyleForRenderer): Deleted.
+ * html/shadow/SliderThumbElement.h:
+ * html/shadow/TextControlInnerElements.cpp:
+ (WebCore::TextControlInnerElement::create):
+ (WebCore::TextControlInnerElement::resolveCustomStyle):
+ (WebCore::TextControlInnerTextElement::renderer):
+ (WebCore::TextControlInnerTextElement::resolveCustomStyle):
+ (WebCore::TextControlPlaceholderElement::TextControlPlaceholderElement):
+ (WebCore::TextControlPlaceholderElement::resolveCustomStyle):
+ (WebCore::TextControlInnerElement::customStyleForRenderer): Deleted.
+ (WebCore::TextControlInnerTextElement::customStyleForRenderer): Deleted.
+ (WebCore::TextControlPlaceholderElement::customStyleForRenderer): Deleted.
+ * html/shadow/TextControlInnerElements.h:
+ * rendering/RenderElement.cpp:
+ (WebCore::RenderElement::getUncachedPseudoStyle):
+ * rendering/RenderNamedFlowFragment.cpp:
+ (WebCore::RenderNamedFlowFragment::computeStyleInRegion):
+ (WebCore::RenderNamedFlowFragment::computeChildrenStyleInRegion):
+ * style/StyleRelations.cpp: Added.
+ (WebCore::Style::commitRelationsToRenderStyle):
+
+ Commit relations affecting style that is being computed.
+
+ (WebCore::Style::commitRelationsToDocument):
+
+ Commit relations that mutate document.
+
+ * style/StyleRelations.h: Added.
+
+ Factor style relation data structures and functions to a file of their own.
+
+ (WebCore::Style::Relation::Relation):
+ * style/StyleSharingResolver.cpp:
+ (WebCore::Style::SharingResolver::styleSharingCandidateMatchesRuleSet):
+ * style/StyleTreeResolver.cpp:
+ (WebCore::Style::TreeResolver::styleForElement):
+
+ Apply style relations.
+
+ * style/StyleTreeResolver.h:
+ * svg/SVGElement.cpp:
+ (WebCore::SVGElement::synchronizeSystemLanguage):
+ (WebCore::SVGElement::resolveCustomStyle):
+ (WebCore::SVGElement::customStyleForRenderer): Deleted.
+ * svg/SVGElement.h:
+ * svg/SVGElementRareData.h:
+ (WebCore::SVGElementRareData::overrideComputedStyle):
+
</ins><span class="cx"> 2016-03-08 Youenn Fablet <youenn.fablet@crf.canon.fr>
</span><span class="cx">
</span><span class="cx"> [Fetch API] Implement fetch skeleton
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (197763 => 197764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-03-08 14:50:15 UTC (rev 197763)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-03-08 14:59:53 UTC (rev 197764)
</span><span class="lines">@@ -6627,6 +6627,8 @@
</span><span class="cx">                 E45390490EAFD637003695C8 /* WebCoreSystemInterfaceIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = E45390380EAFD637003695C8 /* WebCoreSystemInterfaceIOS.mm */; };
</span><span class="cx">                 E453904D0EAFD637003695C8 /* WidgetIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = E453903C0EAFD637003695C8 /* WidgetIOS.mm */; };
</span><span class="cx">                 E45390AE0EAFF4B5003695C8 /* SystemMemoryIOS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E45390AD0EAFF4B5003695C8 /* SystemMemoryIOS.cpp */; };
</span><ins>+                E461802D1C8DD2900026C02C /* StyleRelations.h in Headers */ = {isa = PBXBuildFile; fileRef = E461802C1C8DD2900026C02C /* StyleRelations.h */; };
+                E461802F1C8DD4D20026C02C /* StyleRelations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E461802E1C8DD4D20026C02C /* StyleRelations.cpp */; };
</ins><span class="cx">                 E461D65D1BB0C7F000CB5645 /* AuthorStyleSheets.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E461D65C1BB0C7F000CB5645 /* AuthorStyleSheets.cpp */; };
</span><span class="cx">                 E461D65F1BB0C80D00CB5645 /* AuthorStyleSheets.h in Headers */ = {isa = PBXBuildFile; fileRef = E461D65E1BB0C80D00CB5645 /* AuthorStyleSheets.h */; };
</span><span class="cx">                 E462A4A1113E71BE004A4220 /* IntPointHash.h in Headers */ = {isa = PBXBuildFile; fileRef = E462A4A0113E71BE004A4220 /* IntPointHash.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -14664,6 +14666,8 @@
</span><span class="cx">                 E45390380EAFD637003695C8 /* WebCoreSystemInterfaceIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreSystemInterfaceIOS.mm; sourceTree = "<group>"; };
</span><span class="cx">                 E453903C0EAFD637003695C8 /* WidgetIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WidgetIOS.mm; sourceTree = "<group>"; };
</span><span class="cx">                 E45390AD0EAFF4B5003695C8 /* SystemMemoryIOS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SystemMemoryIOS.cpp; sourceTree = "<group>"; };
</span><ins>+                E461802C1C8DD2900026C02C /* StyleRelations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleRelations.h; sourceTree = "<group>"; };
+                E461802E1C8DD4D20026C02C /* StyleRelations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleRelations.cpp; sourceTree = "<group>"; };
</ins><span class="cx">                 E461D65C1BB0C7F000CB5645 /* AuthorStyleSheets.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AuthorStyleSheets.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 E461D65E1BB0C80D00CB5645 /* AuthorStyleSheets.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AuthorStyleSheets.h; sourceTree = "<group>"; };
</span><span class="cx">                 E462A4A0113E71BE004A4220 /* IntPointHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IntPointHash.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -23549,6 +23553,8 @@
</span><span class="cx">                                 E401E0A31C3C0B8300F34D10 /* StyleChange.h */,
</span><span class="cx">                                 E4D58EB617B4ED8900CBDCA8 /* StyleFontSizeFunctions.cpp */,
</span><span class="cx">                                 E4D58EB717B4ED8900CBDCA8 /* StyleFontSizeFunctions.h */,
</span><ins>+                                E461802E1C8DD4D20026C02C /* StyleRelations.cpp */,
+                                E461802C1C8DD2900026C02C /* StyleRelations.h */,
</ins><span class="cx">                                 E4D58EB217B4DBDC00CBDCA8 /* StyleResolveForDocument.cpp */,
</span><span class="cx">                                 E4D58EB317B4DBDC00CBDCA8 /* StyleResolveForDocument.h */,
</span><span class="cx">                                 E47A3AC21C5EABBE00CCBFA7 /* StyleSharingResolver.cpp */,
</span><span class="lines">@@ -25220,6 +25226,7 @@
</span><span class="cx">                                 FD315FFF12B0267600C1A359 /* ChannelMergerNode.h in Headers */,
</span><span class="cx">                                 FD31600212B0267600C1A359 /* ChannelSplitterNode.h in Headers */,
</span><span class="cx">                                 6550B6A0099DF0270090D781 /* CharacterData.h in Headers */,
</span><ins>+                                E461802D1C8DD2900026C02C /* StyleRelations.h in Headers */,
</ins><span class="cx">                                 C5592F781A92AA28001F8862 /* CharacterProperties.h in Headers */,
</span><span class="cx">                                 97B8FFD116AE7F960038388D /* CharacterReferenceParserInlines.h in Headers */,
</span><span class="cx">                                 B2C3DA2A0D006C1D00EF6F26 /* CharsetData.h in Headers */,
</span><span class="lines">@@ -29297,6 +29304,7 @@
</span><span class="cx">                                 BC64B4D90CB4298A005F2B62 /* CSSFontFaceSrcValue.cpp in Sources */,
</span><span class="cx">                                 4A6E9FC313C17D1D0046A7F8 /* CSSFontFeatureValue.cpp in Sources */,
</span><span class="cx">                                 BC64B4DB0CB4298A005F2B62 /* CSSFontSelector.cpp in Sources */,
</span><ins>+                                E461802F1C8DD4D20026C02C /* StyleRelations.cpp in Sources */,
</ins><span class="cx">                                 A80E6CF10A1989CA007FB8C5 /* CSSFontValue.cpp in Sources */,
</span><span class="cx">                                 BC02A6460E09AAE9004B6D2B /* CSSFunctionValue.cpp in Sources */,
</span><span class="cx">                                 BC23E4E10DAACE0F009FDC91 /* CSSGradientValue.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorecssElementRuleCollectorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/ElementRuleCollector.cpp (197763 => 197764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/ElementRuleCollector.cpp        2016-03-08 14:50:15 UTC (rev 197763)
+++ trunk/Source/WebCore/css/ElementRuleCollector.cpp        2016-03-08 14:59:53 UTC (rev 197764)
</span><span class="lines">@@ -78,9 +78,8 @@
</span><span class="cx"> const bool includeEmptyRules;
</span><span class="cx"> };
</span><span class="cx">
</span><del>-ElementRuleCollector::ElementRuleCollector(Element& element, RenderStyle* style, const DocumentRuleSets& ruleSets, const SelectorFilter* selectorFilter)
</del><ins>+ElementRuleCollector::ElementRuleCollector(Element& element, const DocumentRuleSets& ruleSets, const SelectorFilter* selectorFilter)
</ins><span class="cx"> : m_element(element)
</span><del>- , m_style(style)
</del><span class="cx"> , m_authorStyle(*ruleSets.authorStyle())
</span><span class="cx"> , m_userStyle(ruleSets.userStyle())
</span><span class="cx"> , m_selectorFilter(selectorFilter)
</span><span class="lines">@@ -133,7 +132,6 @@
</span><span class="cx"> void ElementRuleCollector::collectMatchingRules(const MatchRequest& matchRequest, StyleResolver::RuleRange& ruleRange)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(matchRequest.ruleSet);
</span><del>- ASSERT_WITH_MESSAGE(!(m_mode == SelectorChecker::Mode::ResolvingStyle && !m_style), "When resolving style, the SelectorChecker must have a style to set the pseudo elements and/or to do marking. The SelectorCompiler also rely on that behavior.");
</del><span class="cx"> ASSERT_WITH_MESSAGE(!(m_mode == SelectorChecker::Mode::CollectingRulesIgnoringVirtualPseudoElements && m_pseudoStyleRequest.pseudoId != NOPSEUDO), "When in StyleInvalidation or SharingRules, SelectorChecker does not try to match the pseudo ID. While ElementRuleCollector supports matching a particular pseudoId in this case, this would indicate a error at the call site since matching a particular element should be unnecessary.");
</span><span class="cx">
</span><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><span class="lines">@@ -194,10 +192,7 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- // Now transfer the set of matched rules over to our list of declarations.
</del><span class="cx"> for (const MatchedRule& matchedRule : m_matchedRules) {
</span><del>- if (m_style && matchedRule.ruleData->containsUncommonAttributeSelector())
- m_style->setUnique();
</del><span class="cx"> m_result.addMatchedProperties(matchedRule.ruleData->rule()->properties(), matchedRule.ruleData->rule(), matchedRule.ruleData->linkMatchType(), matchedRule.ruleData->propertyWhitelistType());
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -414,7 +409,12 @@
</span><span class="cx"> #if CSS_SELECTOR_JIT_PROFILING
</span><span class="cx"> ruleData.compiledSelectorUsed();
</span><span class="cx"> #endif
</span><del>- return selectorChecker(&m_element, &specificity);
</del><ins>+ bool selectorMatches = selectorChecker(&m_element, &specificity);
+
+ if (selectorMatches && ruleData.containsUncommonAttributeSelector())
+ m_didMatchUncommonAttributeSelector = true;
+
+ return selectorMatches;
</ins><span class="cx"> }
</span><span class="cx"> #endif // ENABLE(CSS_SELECTOR_JIT)
</span><span class="cx">
</span><span class="lines">@@ -450,86 +450,16 @@
</span><span class="cx"> selectorMatches = selectorChecker.match(*selector, m_element, context, specificity);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- commitStyleRelations(context.styleRelations);
</del><ins>+ if (ruleData.containsUncommonAttributeSelector()) {
+ if (selectorMatches || context.pseudoIDSet)
+ m_didMatchUncommonAttributeSelector = true;
+ }
+ m_matchedPseudoElementIds.merge(context.pseudoIDSet);
+ m_styleRelations.appendVector(context.styleRelations);
</ins><span class="cx">
</span><del>- if (context.pseudoIDSet)
- m_style->setHasPseudoStyles(context.pseudoIDSet);
-
</del><span class="cx"> return selectorMatches;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-// FIXME: Rule collector should not be doing mutations. Move this somewhere else.
-void ElementRuleCollector::commitStyleRelations(const SelectorChecker::StyleRelations& styleRelations)
-{
- for (auto& relation : styleRelations) {
- switch (relation.type) {
- case SelectorChecker::StyleRelation::AffectedByActive:
- if (&relation.element == &m_element)
- m_style->setAffectedByActive();
- else
- relation.element.setChildrenAffectedByActive();
- break;
- case SelectorChecker::StyleRelation::AffectedByDrag:
- if (&relation.element == &m_element)
- m_style->setAffectedByDrag();
- else
- relation.element.setChildrenAffectedByDrag();
- break;
- case SelectorChecker::StyleRelation::AffectedByEmpty:
- relation.element.setStyleAffectedByEmpty();
- if (&relation.element == &m_element)
- m_style->setEmptyState(relation.value);
- break;
- case SelectorChecker::StyleRelation::AffectedByHover:
- if (&relation.element == &m_element)
- m_style->setAffectedByHover();
- else
- relation.element.setChildrenAffectedByHover();
- break;
- case SelectorChecker::StyleRelation::AffectedByPreviousSibling:
- relation.element.setStyleIsAffectedByPreviousSibling();
- break;
- case SelectorChecker::StyleRelation::AffectsNextSibling:
- relation.element.setAffectsNextSiblingElementStyle();
- break;
- case SelectorChecker::StyleRelation::ChildrenAffectedByBackwardPositionalRules:
- relation.element.setChildrenAffectedByBackwardPositionalRules();
- break;
- case SelectorChecker::StyleRelation::ChildrenAffectedByFirstChildRules:
- relation.element.setChildrenAffectedByFirstChildRules();
- break;
- case SelectorChecker::StyleRelation::ChildrenAffectedByPropertyBasedBackwardPositionalRules:
- relation.element.setChildrenAffectedByBackwardPositionalRules();
- relation.element.setChildrenAffectedByPropertyBasedBackwardPositionalRules();
- break;
- case SelectorChecker::StyleRelation::ChildrenAffectedByLastChildRules:
- relation.element.setChildrenAffectedByLastChildRules();
- break;
- case SelectorChecker::StyleRelation::FirstChild:
- if (&relation.element == &m_element)
- m_style->setFirstChildState();
- else if (auto* style = relation.element.renderStyle())
- style->setFirstChildState();
- break;
- case SelectorChecker::StyleRelation::LastChild:
- if (&relation.element == &m_element)
- m_style->setLastChildState();
- else if (auto* style = relation.element.renderStyle())
- style->setLastChildState();
- break;
- case SelectorChecker::StyleRelation::NthChildIndex:
- relation.element.setChildIndex(relation.value);
- break;
- case SelectorChecker::StyleRelation::Unique:
- if (&relation.element == &m_element)
- m_style->setUnique();
- else if (auto* style = relation.element.renderStyle())
- style->setUnique();
- break;
- }
- }
-}
-
</del><span class="cx"> void ElementRuleCollector::collectMatchingRulesForList(const RuleSet::RuleDataVector* rules, const MatchRequest& matchRequest, StyleResolver::RuleRange& ruleRange)
</span><span class="cx"> {
</span><span class="cx"> if (!rules)
</span></span></pre></div>
<a id="trunkSourceWebCorecssElementRuleCollectorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/ElementRuleCollector.h (197763 => 197764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/ElementRuleCollector.h        2016-03-08 14:50:15 UTC (rev 197763)
+++ trunk/Source/WebCore/css/ElementRuleCollector.h        2016-03-08 14:59:53 UTC (rev 197764)
</span><span class="lines">@@ -45,7 +45,7 @@
</span><span class="cx">
</span><span class="cx"> class ElementRuleCollector {
</span><span class="cx"> public:
</span><del>- ElementRuleCollector(Element&, RenderStyle*, const DocumentRuleSets&, const SelectorFilter*);
</del><ins>+ ElementRuleCollector(Element&, const DocumentRuleSets&, const SelectorFilter*);
</ins><span class="cx"> ElementRuleCollector(Element&, const RuleSet& authorStyle, const SelectorFilter*);
</span><span class="cx">
</span><span class="cx"> void matchAllRules(bool matchAuthorAndUserStyles, bool includeSMILProperties);
</span><span class="lines">@@ -67,6 +67,10 @@
</span><span class="cx"> bool hasMatchedRules() const { return !m_matchedRules.isEmpty(); }
</span><span class="cx"> void clearMatchedRules();
</span><span class="cx">
</span><ins>+ const PseudoIdSet& matchedPseudoElementIds() const { return m_matchedPseudoElementIds; }
+ const Style::Relations& styleRelations() const { return m_styleRelations; }
+ bool didMatchUncommonAttributeSelector() const { return m_didMatchUncommonAttributeSelector; }
+
</ins><span class="cx"> private:
</span><span class="cx"> void addElementStyleProperties(const StyleProperties*, bool isCacheable = true);
</span><span class="cx">
</span><span class="lines">@@ -87,10 +91,7 @@
</span><span class="cx">
</span><span class="cx"> void addMatchedRule(const MatchedRule&);
</span><span class="cx">
</span><del>- void commitStyleRelations(const SelectorChecker::StyleRelations&);
-
</del><span class="cx"> Element& m_element;
</span><del>- RenderStyle* m_style { nullptr };
</del><span class="cx"> const RuleSet& m_authorStyle;
</span><span class="cx"> const RuleSet* m_userStyle { nullptr };
</span><span class="cx"> const SelectorFilter* m_selectorFilter { nullptr };
</span><span class="lines">@@ -108,7 +109,10 @@
</span><span class="cx">
</span><span class="cx"> // Output.
</span><span class="cx"> Vector<RefPtr<StyleRule>> m_matchedRuleList;
</span><ins>+ bool m_didMatchUncommonAttributeSelector { false };
</ins><span class="cx"> StyleResolver::MatchResult m_result;
</span><ins>+ Style::Relations m_styleRelations;
+ PseudoIdSet m_matchedPseudoElementIds;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecssMediaQueryMatchercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/MediaQueryMatcher.cpp (197763 => 197764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/MediaQueryMatcher.cpp        2016-03-08 14:50:15 UTC (rev 197763)
+++ trunk/Source/WebCore/css/MediaQueryMatcher.cpp        2016-03-08 14:59:53 UTC (rev 197764)
</span><span class="lines">@@ -85,9 +85,9 @@
</span><span class="cx"> if (!documentElement)
</span><span class="cx"> return nullptr;
</span><span class="cx">
</span><del>- RefPtr<RenderStyle> rootStyle = m_document->ensureStyleResolver().styleForElement(*documentElement, m_document->renderStyle(), MatchOnlyUserAgentRules);
</del><ins>+ auto rootStyle = m_document->ensureStyleResolver().styleForElement(*documentElement, m_document->renderStyle(), MatchOnlyUserAgentRules).renderStyle;
</ins><span class="cx">
</span><del>- return std::make_unique<MediaQueryEvaluator>(mediaType(), m_document->frame(), rootStyle.get());
</del><ins>+ return std::make_unique<MediaQueryEvaluator>(mediaType(), m_document->frame(), rootStyle.ptr());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool MediaQueryMatcher::evaluate(const MediaQuerySet* media)
</span></span></pre></div>
<a id="trunkSourceWebCorecssSelectorCheckercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/SelectorChecker.cpp (197763 => 197764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/SelectorChecker.cpp        2016-03-08 14:50:15 UTC (rev 197763)
+++ trunk/Source/WebCore/css/SelectorChecker.cpp        2016-03-08 14:59:53 UTC (rev 197764)
</span><span class="lines">@@ -84,12 +84,12 @@
</span><span class="cx">
</span><span class="cx"> };
</span><span class="cx">
</span><del>-static inline void addStyleRelation(SelectorChecker::CheckingContext& checkingContext, const Element& element, SelectorChecker::StyleRelation::Type type, unsigned value = 1)
</del><ins>+static inline void addStyleRelation(SelectorChecker::CheckingContext& checkingContext, const Element& element, Style::Relation::Type type, unsigned value = 1)
</ins><span class="cx"> {
</span><del>- ASSERT(value == 1 || type == SelectorChecker::StyleRelation::NthChildIndex || type == SelectorChecker::StyleRelation::AffectedByEmpty);
</del><ins>+ ASSERT(value == 1 || type == Style::Relation::NthChildIndex || type == Style::Relation::AffectedByEmpty);
</ins><span class="cx"> if (checkingContext.resolvingMode != SelectorChecker::Mode::ResolvingStyle)
</span><span class="cx"> return;
</span><del>- checkingContext.styleRelations.append({ const_cast<Element&>(element), type, value });
</del><ins>+ checkingContext.styleRelations.append({ element, type, value });
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static inline bool isFirstChildElement(const Element& element)
</span><span class="lines">@@ -105,7 +105,7 @@
</span><span class="cx"> static inline bool isFirstOfType(SelectorChecker::CheckingContext& checkingContext, const Element& element, const QualifiedName& type)
</span><span class="cx"> {
</span><span class="cx"> for (const Element* sibling = ElementTraversal::previousSibling(element); sibling; sibling = ElementTraversal::previousSibling(*sibling)) {
</span><del>- addStyleRelation(checkingContext, *sibling, SelectorChecker::StyleRelation::AffectsNextSibling);
</del><ins>+ addStyleRelation(checkingContext, *sibling, Style::Relation::AffectsNextSibling);
</ins><span class="cx">
</span><span class="cx"> if (sibling->hasTagName(type))
</span><span class="cx"> return false;
</span><span class="lines">@@ -127,7 +127,7 @@
</span><span class="cx"> int count = 0;
</span><span class="cx"> for (const Element* sibling = ElementTraversal::previousSibling(element); sibling; sibling = ElementTraversal::previousSibling(*sibling)) {
</span><span class="cx">
</span><del>- addStyleRelation(checkingContext, *sibling, SelectorChecker::StyleRelation::AffectsNextSibling);
</del><ins>+ addStyleRelation(checkingContext, *sibling, Style::Relation::AffectsNextSibling);
</ins><span class="cx">
</span><span class="cx"> unsigned index = sibling->childIndex();
</span><span class="cx"> if (index) {
</span><span class="lines">@@ -143,7 +143,7 @@
</span><span class="cx"> {
</span><span class="cx"> int count = 0;
</span><span class="cx"> for (const Element* sibling = ElementTraversal::previousSibling(element); sibling; sibling = ElementTraversal::previousSibling(*sibling)) {
</span><del>- addStyleRelation(checkingContext, *sibling, SelectorChecker::StyleRelation::AffectsNextSibling);
</del><ins>+ addStyleRelation(checkingContext, *sibling, Style::Relation::AffectsNextSibling);
</ins><span class="cx">
</span><span class="cx"> if (sibling->hasTagName(type))
</span><span class="cx"> ++count;
</span><span class="lines">@@ -328,13 +328,13 @@
</span><span class="cx">
</span><span class="cx"> case CSSSelector::DirectAdjacent:
</span><span class="cx"> {
</span><del>- addStyleRelation(checkingContext, *context.element, StyleRelation::AffectedByPreviousSibling);
</del><ins>+ addStyleRelation(checkingContext, *context.element, Style::Relation::AffectedByPreviousSibling);
</ins><span class="cx">
</span><span class="cx"> Element* previousElement = context.element->previousElementSibling();
</span><span class="cx"> if (!previousElement)
</span><span class="cx"> return MatchResult::fails(Match::SelectorFailsAllSiblings);
</span><span class="cx">
</span><del>- addStyleRelation(checkingContext, *previousElement, StyleRelation::AffectsNextSibling);
</del><ins>+ addStyleRelation(checkingContext, *previousElement, Style::Relation::AffectsNextSibling);
</ins><span class="cx">
</span><span class="cx"> nextContext.element = previousElement;
</span><span class="cx"> nextContext.firstSelectorOfTheFragment = nextContext.selector;
</span><span class="lines">@@ -349,12 +349,12 @@
</span><span class="cx"> return MatchResult::updateWithMatchType(result, matchType);
</span><span class="cx"> }
</span><span class="cx"> case CSSSelector::IndirectAdjacent:
</span><del>- addStyleRelation(checkingContext, *context.element, StyleRelation::AffectedByPreviousSibling);
</del><ins>+ addStyleRelation(checkingContext, *context.element, Style::Relation::AffectedByPreviousSibling);
</ins><span class="cx">
</span><span class="cx"> nextContext.element = context.element->previousElementSibling();
</span><span class="cx"> nextContext.firstSelectorOfTheFragment = nextContext.selector;
</span><span class="cx"> for (; nextContext.element; nextContext.element = nextContext.element->previousElementSibling()) {
</span><del>- addStyleRelation(checkingContext, *nextContext.element, StyleRelation::AffectsNextSibling);
</del><ins>+ addStyleRelation(checkingContext, *nextContext.element, Style::Relation::AffectsNextSibling);
</ins><span class="cx">
</span><span class="cx"> PseudoIdSet ignoreDynamicPseudo;
</span><span class="cx"> unsigned indirectAdjacentSpecificity = 0;
</span><span class="lines">@@ -682,7 +682,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- addStyleRelation(checkingContext, *context.element, StyleRelation::AffectedByEmpty, result);
</del><ins>+ addStyleRelation(checkingContext, *context.element, Style::Relation::AffectedByEmpty, result);
</ins><span class="cx">
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="lines">@@ -691,15 +691,15 @@
</span><span class="cx"> if (const Element* parentElement = element.parentElement()) {
</span><span class="cx"> bool isFirstChild = isFirstChildElement(element);
</span><span class="cx"> if (isFirstChild)
</span><del>- addStyleRelation(checkingContext, element, StyleRelation::FirstChild);
- addStyleRelation(checkingContext, *parentElement, StyleRelation::ChildrenAffectedByFirstChildRules);
</del><ins>+ addStyleRelation(checkingContext, element, Style::Relation::FirstChild);
+ addStyleRelation(checkingContext, *parentElement, Style::Relation::ChildrenAffectedByFirstChildRules);
</ins><span class="cx"> return isFirstChild;
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx"> case CSSSelector::PseudoClassFirstOfType:
</span><span class="cx"> // first-of-type matches the first element of its type
</span><span class="cx"> if (element.parentElement()) {
</span><del>- addStyleRelation(checkingContext, element, StyleRelation::AffectedByPreviousSibling);
</del><ins>+ addStyleRelation(checkingContext, element, Style::Relation::AffectedByPreviousSibling);
</ins><span class="cx"> return isFirstOfType(checkingContext, element, element.tagQName());
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="lines">@@ -708,15 +708,15 @@
</span><span class="cx"> if (const Element* parentElement = element.parentElement()) {
</span><span class="cx"> bool isLastChild = parentElement->isFinishedParsingChildren() && isLastChildElement(element);
</span><span class="cx"> if (isLastChild)
</span><del>- addStyleRelation(checkingContext, element, StyleRelation::LastChild);
- addStyleRelation(checkingContext, *parentElement, StyleRelation::ChildrenAffectedByLastChildRules);
</del><ins>+ addStyleRelation(checkingContext, element, Style::Relation::LastChild);
+ addStyleRelation(checkingContext, *parentElement, Style::Relation::ChildrenAffectedByLastChildRules);
</ins><span class="cx"> return isLastChild;
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx"> case CSSSelector::PseudoClassLastOfType:
</span><span class="cx"> // last-of-type matches the last element of its type
</span><span class="cx"> if (Element* parentElement = element.parentElement()) {
</span><del>- addStyleRelation(checkingContext, *parentElement, StyleRelation::ChildrenAffectedByBackwardPositionalRules);
</del><ins>+ addStyleRelation(checkingContext, *parentElement, Style::Relation::ChildrenAffectedByBackwardPositionalRules);
</ins><span class="cx"> if (!parentElement->isFinishedParsingChildren())
</span><span class="cx"> return false;
</span><span class="cx"> return isLastOfType(element, element.tagQName());
</span><span class="lines">@@ -726,20 +726,20 @@
</span><span class="cx"> if (Element* parentElement = element.parentElement()) {
</span><span class="cx"> bool firstChild = isFirstChildElement(element);
</span><span class="cx"> bool onlyChild = firstChild && parentElement->isFinishedParsingChildren() && isLastChildElement(element);
</span><del>- addStyleRelation(checkingContext, *parentElement, StyleRelation::ChildrenAffectedByFirstChildRules);
- addStyleRelation(checkingContext, *parentElement, StyleRelation::ChildrenAffectedByLastChildRules);
</del><ins>+ addStyleRelation(checkingContext, *parentElement, Style::Relation::ChildrenAffectedByFirstChildRules);
+ addStyleRelation(checkingContext, *parentElement, Style::Relation::ChildrenAffectedByLastChildRules);
</ins><span class="cx"> if (firstChild)
</span><del>- addStyleRelation(checkingContext, element, StyleRelation::FirstChild);
</del><ins>+ addStyleRelation(checkingContext, element, Style::Relation::FirstChild);
</ins><span class="cx"> if (onlyChild)
</span><del>- addStyleRelation(checkingContext, element, StyleRelation::LastChild);
</del><ins>+ addStyleRelation(checkingContext, element, Style::Relation::LastChild);
</ins><span class="cx"> return onlyChild;
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx"> case CSSSelector::PseudoClassOnlyOfType:
</span><span class="cx"> // FIXME: This selector is very slow.
</span><span class="cx"> if (Element* parentElement = element.parentElement()) {
</span><del>- addStyleRelation(checkingContext, element, StyleRelation::AffectedByPreviousSibling);
- addStyleRelation(checkingContext, *parentElement, StyleRelation::ChildrenAffectedByBackwardPositionalRules);
</del><ins>+ addStyleRelation(checkingContext, element, Style::Relation::AffectedByPreviousSibling);
+ addStyleRelation(checkingContext, *parentElement, Style::Relation::ChildrenAffectedByBackwardPositionalRules);
</ins><span class="cx"> if (!parentElement->isFinishedParsingChildren())
</span><span class="cx"> return false;
</span><span class="cx"> return isFirstOfType(checkingContext, element, element.tagQName()) && isLastOfType(element, element.tagQName());
</span><span class="lines">@@ -778,7 +778,7 @@
</span><span class="cx"> }
</span><span class="cx"> case CSSSelector::PseudoClassPlaceholderShown:
</span><span class="cx"> if (is<HTMLTextFormControlElement>(element)) {
</span><del>- addStyleRelation(checkingContext, element, StyleRelation::Unique);
</del><ins>+ addStyleRelation(checkingContext, element, Style::Relation::Unique);
</ins><span class="cx"> return downcast<HTMLTextFormControlElement>(element).isPlaceholderVisible();
</span><span class="cx"> }
</span><span class="cx"> return false;
</span><span class="lines">@@ -793,12 +793,12 @@
</span><span class="cx"> specificity = CSSSelector::addSpecificities(specificity, selectorListSpecificity);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- addStyleRelation(checkingContext, element, StyleRelation::AffectedByPreviousSibling);
</del><ins>+ addStyleRelation(checkingContext, element, Style::Relation::AffectedByPreviousSibling);
</ins><span class="cx">
</span><span class="cx"> int count = 1;
</span><span class="cx"> if (const CSSSelectorList* selectorList = selector.selectorList()) {
</span><span class="cx"> for (Element* sibling = ElementTraversal::previousSibling(element); sibling; sibling = ElementTraversal::previousSibling(*sibling)) {
</span><del>- addStyleRelation(checkingContext, *sibling, StyleRelation::AffectsNextSibling);
</del><ins>+ addStyleRelation(checkingContext, *sibling, Style::Relation::AffectsNextSibling);
</ins><span class="cx">
</span><span class="cx"> unsigned ignoredSpecificity;
</span><span class="cx"> if (matchSelectorList(checkingContext, context, *sibling, *selectorList, ignoredSpecificity))
</span><span class="lines">@@ -806,7 +806,7 @@
</span><span class="cx"> }
</span><span class="cx"> } else {
</span><span class="cx"> count += countElementsBefore(checkingContext, element);
</span><del>- addStyleRelation(checkingContext, element, StyleRelation::NthChildIndex, count);
</del><ins>+ addStyleRelation(checkingContext, element, Style::Relation::NthChildIndex, count);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (selector.matchNth(count))
</span><span class="lines">@@ -818,7 +818,7 @@
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> if (element.parentElement()) {
</span><del>- addStyleRelation(checkingContext, element, StyleRelation::AffectedByPreviousSibling);
</del><ins>+ addStyleRelation(checkingContext, element, Style::Relation::AffectedByPreviousSibling);
</ins><span class="cx">
</span><span class="cx"> int count = 1 + countElementsOfTypeBefore(checkingContext, element, element.tagQName());
</span><span class="cx"> if (selector.matchNth(count))
</span><span class="lines">@@ -835,9 +835,9 @@
</span><span class="cx"> return false;
</span><span class="cx"> specificity = CSSSelector::addSpecificities(specificity, selectorListSpecificity);
</span><span class="cx">
</span><del>- addStyleRelation(checkingContext, *parentElement, StyleRelation::ChildrenAffectedByPropertyBasedBackwardPositionalRules);
</del><ins>+ addStyleRelation(checkingContext, *parentElement, Style::Relation::ChildrenAffectedByPropertyBasedBackwardPositionalRules);
</ins><span class="cx"> } else
</span><del>- addStyleRelation(checkingContext, *parentElement, StyleRelation::ChildrenAffectedByBackwardPositionalRules);
</del><ins>+ addStyleRelation(checkingContext, *parentElement, Style::Relation::ChildrenAffectedByBackwardPositionalRules);
</ins><span class="cx">
</span><span class="cx"> if (!parentElement->isFinishedParsingChildren())
</span><span class="cx"> return false;
</span><span class="lines">@@ -860,7 +860,7 @@
</span><span class="cx"> if (!selector.parseNth())
</span><span class="cx"> break;
</span><span class="cx"> if (Element* parentElement = element.parentElement()) {
</span><del>- addStyleRelation(checkingContext, *parentElement, StyleRelation::ChildrenAffectedByBackwardPositionalRules);
</del><ins>+ addStyleRelation(checkingContext, *parentElement, Style::Relation::ChildrenAffectedByBackwardPositionalRules);
</ins><span class="cx">
</span><span class="cx"> if (!parentElement->isFinishedParsingChildren())
</span><span class="cx"> return false;
</span><span class="lines">@@ -902,7 +902,7 @@
</span><span class="cx"> return false;
</span><span class="cx"> return element.isLink() && context.visitedMatchType == VisitedMatchType::Enabled;
</span><span class="cx"> case CSSSelector::PseudoClassDrag:
</span><del>- addStyleRelation(checkingContext, element, StyleRelation::AffectedByDrag);
</del><ins>+ addStyleRelation(checkingContext, element, Style::Relation::AffectedByDrag);
</ins><span class="cx">
</span><span class="cx"> if (element.renderer() && element.renderer()->isDragging())
</span><span class="cx"> return true;
</span><span class="lines">@@ -911,7 +911,7 @@
</span><span class="cx"> return matchesFocusPseudoClass(element);
</span><span class="cx"> case CSSSelector::PseudoClassHover:
</span><span class="cx"> if (m_strictParsing || element.isLink() || canMatchHoverOrActiveInQuirksMode(context)) {
</span><del>- addStyleRelation(checkingContext, element, StyleRelation::AffectedByHover);
</del><ins>+ addStyleRelation(checkingContext, element, Style::Relation::AffectedByHover);
</ins><span class="cx">
</span><span class="cx"> if (element.hovered() || InspectorInstrumentation::forcePseudoState(const_cast<Element&>(element), CSSSelector::PseudoClassHover))
</span><span class="cx"> return true;
</span><span class="lines">@@ -919,7 +919,7 @@
</span><span class="cx"> break;
</span><span class="cx"> case CSSSelector::PseudoClassActive:
</span><span class="cx"> if (m_strictParsing || element.isLink() || canMatchHoverOrActiveInQuirksMode(context)) {
</span><del>- addStyleRelation(checkingContext, element, StyleRelation::AffectedByActive);
</del><ins>+ addStyleRelation(checkingContext, element, Style::Relation::AffectedByActive);
</ins><span class="cx">
</span><span class="cx"> if (element.active() || InspectorInstrumentation::forcePseudoState(const_cast<Element&>(element), CSSSelector::PseudoClassActive))
</span><span class="cx"> return true;
</span></span></pre></div>
<a id="trunkSourceWebCorecssSelectorCheckerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/SelectorChecker.h (197763 => 197764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/SelectorChecker.h        2016-03-08 14:50:15 UTC (rev 197763)
+++ trunk/Source/WebCore/css/SelectorChecker.h        2016-03-08 14:59:53 UTC (rev 197764)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #include "CSSSelector.h"
</span><span class="cx"> #include "Element.h"
</span><span class="cx"> #include "SpaceSplitString.h"
</span><ins>+#include "StyleRelations.h"
</ins><span class="cx"> #include <wtf/HashSet.h>
</span><span class="cx"> #include <wtf/Vector.h>
</span><span class="cx">
</span><span class="lines">@@ -76,29 +77,6 @@
</span><span class="cx">
</span><span class="cx"> SelectorChecker(Document&);
</span><span class="cx">
</span><del>- struct StyleRelation {
- enum Type {
- AffectedByActive,
- AffectedByDrag,
- AffectedByEmpty,
- AffectedByHover,
- AffectedByPreviousSibling,
- AffectsNextSibling,
- ChildrenAffectedByBackwardPositionalRules,
- ChildrenAffectedByFirstChildRules,
- ChildrenAffectedByPropertyBasedBackwardPositionalRules,
- ChildrenAffectedByLastChildRules,
- FirstChild,
- LastChild,
- NthChildIndex,
- Unique,
- };
- Element& element;
- Type type;
- unsigned value;
- };
- using StyleRelations = Vector<StyleRelation, 8>;
-
</del><span class="cx"> struct CheckingContext {
</span><span class="cx"> CheckingContext(SelectorChecker::Mode resolvingMode)
</span><span class="cx"> : resolvingMode(resolvingMode)
</span><span class="lines">@@ -111,7 +89,7 @@
</span><span class="cx"> const ContainerNode* scope { nullptr };
</span><span class="cx">
</span><span class="cx"> // FIXME: It would be nicer to have a separate object for return values. This requires some more work in the selector compiler.
</span><del>- StyleRelations styleRelations;
</del><ins>+ Style::Relations styleRelations;
</ins><span class="cx"> PseudoIdSet pseudoIDSet;
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleMediacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleMedia.cpp (197763 => 197764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleMedia.cpp        2016-03-08 14:50:15 UTC (rev 197763)
+++ trunk/Source/WebCore/css/StyleMedia.cpp        2016-03-08 14:59:53 UTC (rev 197764)
</span><span class="lines">@@ -61,13 +61,13 @@
</span><span class="cx"> if (!documentElement)
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- RefPtr<RenderStyle> rootStyle = document->ensureStyleResolver().styleForElement(*documentElement, document->renderStyle(), MatchOnlyUserAgentRules);
</del><ins>+ auto rootStyle = document->ensureStyleResolver().styleForElement(*documentElement, document->renderStyle(), MatchOnlyUserAgentRules).renderStyle;
</ins><span class="cx">
</span><span class="cx"> RefPtr<MediaQuerySet> media = MediaQuerySet::create();
</span><span class="cx"> if (!media->parse(query))
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- MediaQueryEvaluator screenEval(type(), m_frame, rootStyle.get());
</del><ins>+ MediaQueryEvaluator screenEval(type(), m_frame, rootStyle.ptr());
</ins><span class="cx"> return screenEval.eval(media.get());
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleResolvercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleResolver.cpp (197763 => 197764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleResolver.cpp        2016-03-08 14:50:15 UTC (rev 197763)
+++ trunk/Source/WebCore/css/StyleResolver.cpp        2016-03-08 14:59:53 UTC (rev 197764)
</span><span class="lines">@@ -267,7 +267,7 @@
</span><span class="cx"> m_medium = std::make_unique<MediaQueryEvaluator>("all");
</span><span class="cx">
</span><span class="cx"> if (root)
</span><del>- m_rootDefaultStyle = styleForElement(*root, m_document.renderStyle(), MatchOnlyUserAgentRules);
</del><ins>+ m_rootDefaultStyle = styleForElement(*root, m_document.renderStyle(), MatchOnlyUserAgentRules).renderStyle;
</ins><span class="cx">
</span><span class="cx"> if (m_rootDefaultStyle && view)
</span><span class="cx"> m_medium = std::make_unique<MediaQueryEvaluator>(view->mediaType(), &view->frame(), m_rootDefaultStyle.get());
</span><span class="lines">@@ -371,7 +371,7 @@
</span><span class="cx"> return parentNode && parentNode->isShadowRoot();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-Ref<RenderStyle> StyleResolver::styleForElement(Element& element, RenderStyle* parentStyle, RuleMatchingBehavior matchingBehavior, const RenderRegion* regionForStyling, const SelectorFilter* selectorFilter)
</del><ins>+ElementStyle StyleResolver::styleForElement(Element& 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><span class="lines">@@ -386,20 +386,22 @@
</span><span class="cx"> state.setParentStyle(RenderStyle::clone(state.style()));
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ auto& style = *state.style();
+
</ins><span class="cx"> if (element.isLink()) {
</span><del>- state.style()->setIsLink(true);
</del><ins>+ style.setIsLink(true);
</ins><span class="cx"> EInsideLink linkState = state.elementLinkState();
</span><span class="cx"> if (linkState != NotInsideLink) {
</span><span class="cx"> bool forceVisited = InspectorInstrumentation::forcePseudoState(element, CSSSelector::PseudoClassVisited);
</span><span class="cx"> if (forceVisited)
</span><span class="cx"> linkState = InsideVisitedLink;
</span><span class="cx"> }
</span><del>- state.style()->setInsideLink(linkState);
</del><ins>+ style.setInsideLink(linkState);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement(element);
</span><span class="cx">
</span><del>- ElementRuleCollector collector(element, state.style(), m_ruleSets, m_state.selectorFilter());
</del><ins>+ ElementRuleCollector collector(element, m_ruleSets, m_state.selectorFilter());
</ins><span class="cx"> collector.setRegionForStyling(regionForStyling);
</span><span class="cx"> collector.setMedium(m_medium.get());
</span><span class="cx">
</span><span class="lines">@@ -408,6 +410,15 @@
</span><span class="cx"> else
</span><span class="cx"> collector.matchAllRules(m_matchAuthorAndUserStyles, matchingBehavior != MatchAllRulesExcludingSMIL);
</span><span class="cx">
</span><ins>+ if (collector.matchedPseudoElementIds())
+ style.setHasPseudoStyles(collector.matchedPseudoElementIds());
+
+ // This is required for style sharing.
+ if (collector.didMatchUncommonAttributeSelector())
+ style.setUnique();
+
+ auto elementStyleRelations = Style::commitRelationsToRenderStyle(style, element, collector.styleRelations());
+
</ins><span class="cx"> applyMatchedProperties(collector.matchedResult(), element);
</span><span class="cx">
</span><span class="cx"> // Clean up our style object's display and text decorations (among other fixups).
</span><span class="lines">@@ -418,8 +429,7 @@
</span><span class="cx">
</span><span class="cx"> state.clear(); // Clear out for the next resolve.
</span><span class="cx">
</span><del>- // Now return the style.
- return state.takeStyle();
</del><ins>+ return { state.takeStyle(), WTFMove(elementStyleRelations) };
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Ref<RenderStyle> StyleResolver::styleForKeyframe(const RenderStyle* elementStyle, const StyleKeyframe* keyframe, KeyframeValue& keyframeValue)
</span><span class="lines">@@ -558,7 +568,7 @@
</span><span class="cx"> // those rules.
</span><span class="cx">
</span><span class="cx"> // Check UA, user and author rules.
</span><del>- ElementRuleCollector collector(element, m_state.style(), m_ruleSets, m_state.selectorFilter());
</del><ins>+ ElementRuleCollector collector(element, m_ruleSets, m_state.selectorFilter());
</ins><span class="cx"> collector.setPseudoStyleRequest(pseudoStyleRequest);
</span><span class="cx"> collector.setMedium(m_medium.get());
</span><span class="cx"> collector.matchUARules();
</span><span class="lines">@@ -568,6 +578,8 @@
</span><span class="cx"> collector.matchAuthorRules(false);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ ASSERT(!collector.matchedPseudoElementIds());
+
</ins><span class="cx"> if (collector.matchedResult().matchedProperties().isEmpty())
</span><span class="cx"> return nullptr;
</span><span class="cx">
</span><span class="lines">@@ -1040,7 +1052,7 @@
</span><span class="cx">
</span><span class="cx"> m_state = State(*element, nullptr);
</span><span class="cx">
</span><del>- ElementRuleCollector collector(*element, nullptr, m_ruleSets, m_state.selectorFilter());
</del><ins>+ ElementRuleCollector collector(*element, m_ruleSets, m_state.selectorFilter());
</ins><span class="cx"> collector.setMode(SelectorChecker::Mode::CollectingRules);
</span><span class="cx"> collector.setPseudoStyleRequest(PseudoStyleRequest(pseudoId));
</span><span class="cx"> collector.setMedium(m_medium.get());
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleResolverh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleResolver.h (197763 => 197764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleResolver.h        2016-03-08 14:50:15 UTC (rev 197763)
+++ trunk/Source/WebCore/css/StyleResolver.h        2016-03-08 14:59:53 UTC (rev 197764)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx"> #include "ScrollTypes.h"
</span><span class="cx"> #include "SelectorChecker.h"
</span><span class="cx"> #include "StyleInheritedData.h"
</span><ins>+#include "StyleRelations.h"
</ins><span class="cx"> #include "ViewportStyleResolver.h"
</span><span class="cx"> #include <bitset>
</span><span class="cx"> #include <memory>
</span><span class="lines">@@ -123,6 +124,16 @@
</span><span class="cx"> RenderScrollbar* scrollbar;
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+struct ElementStyle {
+ ElementStyle(Ref<RenderStyle>&& renderStyle, std::unique_ptr<Style::Relations> relations = { })
+ : renderStyle(WTFMove(renderStyle))
+ , relations(WTFMove(relations))
+ { }
+
+ Ref<RenderStyle> renderStyle;
+ std::unique_ptr<Style::Relations> relations;
+};
+
</ins><span class="cx"> // This class selects a RenderStyle for a given element based on a collection of stylesheets.
</span><span class="cx"> class StyleResolver {
</span><span class="cx"> WTF_MAKE_NONCOPYABLE(StyleResolver); WTF_MAKE_FAST_ALLOCATED;
</span><span class="lines">@@ -130,7 +141,7 @@
</span><span class="cx"> StyleResolver(Document&);
</span><span class="cx"> ~StyleResolver();
</span><span class="cx">
</span><del>- Ref<RenderStyle> styleForElement(Element&, RenderStyle* parentStyle, RuleMatchingBehavior = MatchAllRules, const RenderRegion* regionForStyling = nullptr, const SelectorFilter* = nullptr);
</del><ins>+ ElementStyle styleForElement(Element&, RenderStyle* parentStyle, RuleMatchingBehavior = MatchAllRules, const RenderRegion* regionForStyling = nullptr, const SelectorFilter* = nullptr);
</ins><span class="cx">
</span><span class="cx"> void keyframeStylesForAnimation(Element&, const RenderStyle*, KeyframeList&);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorecssjitSelectorCompilercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/cssjit/SelectorCompiler.cpp (197763 => 197764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/cssjit/SelectorCompiler.cpp        2016-03-08 14:50:15 UTC (rev 197763)
+++ trunk/Source/WebCore/cssjit/SelectorCompiler.cpp        2016-03-08 14:59:53 UTC (rev 197764)
</span><span class="lines">@@ -47,6 +47,7 @@
</span><span class="cx"> #include "SVGElement.h"
</span><span class="cx"> #include "SelectorCheckerTestFunctions.h"
</span><span class="cx"> #include "StackAllocator.h"
</span><ins>+#include "StyleRelations.h"
</ins><span class="cx"> #include "StyledElement.h"
</span><span class="cx"> #include <JavaScriptCore/GPRInfo.h>
</span><span class="cx"> #include <JavaScriptCore/LinkBuffer.h>
</span><span class="lines">@@ -323,8 +324,8 @@
</span><span class="cx"> void generateElementIsTarget(Assembler::JumpList& failureCases);
</span><span class="cx">
</span><span class="cx"> // Helpers.
</span><del>- void generateAddStyleRelationIfResolvingStyle(Assembler::RegisterID element, SelectorChecker::StyleRelation::Type, Optional<Assembler::RegisterID> value = { });
- void generateAddStyleRelation(Assembler::RegisterID checkingContext, Assembler::RegisterID element, SelectorChecker::StyleRelation::Type, Optional<Assembler::RegisterID> value = { });
</del><ins>+ void generateAddStyleRelationIfResolvingStyle(Assembler::RegisterID element, Style::Relation::Type, Optional<Assembler::RegisterID> value = { });
+ void generateAddStyleRelation(Assembler::RegisterID checkingContext, Assembler::RegisterID element, Style::Relation::Type, Optional<Assembler::RegisterID> value = { });
</ins><span class="cx"> Assembler::Jump branchOnResolvingModeWithCheckingContext(Assembler::RelationalCondition, SelectorChecker::Mode, Assembler::RegisterID checkingContext);
</span><span class="cx"> Assembler::Jump branchOnResolvingMode(Assembler::RelationalCondition, SelectorChecker::Mode, Assembler::RegisterID checkingContext);
</span><span class="cx"> void generateElementIsFirstLink(Assembler::JumpList& failureCases, Assembler::RegisterID element);
</span><span class="lines">@@ -1891,7 +1892,7 @@
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx"> if (shouldMarkStyleIsAffectedByPreviousSibling(fragment))
</span><del>- generateAddStyleRelationIfResolvingStyle(elementAddressRegister, SelectorChecker::StyleRelation::AffectedByPreviousSibling);
</del><ins>+ generateAddStyleRelationIfResolvingStyle(elementAddressRegister, Style::Relation::AffectedByPreviousSibling);
</ins><span class="cx"> generateBacktrackingTailsIfNeeded(failureCases, fragment);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2135,7 +2136,7 @@
</span><span class="cx"> void SelectorCodeGenerator::generateDirectAdjacentTreeWalker(Assembler::JumpList& failureCases, const SelectorFragment& fragment)
</span><span class="cx"> {
</span><span class="cx"> generateWalkToPreviousAdjacent(failureCases, fragment);
</span><del>- generateAddStyleRelationIfResolvingStyle(elementAddressRegister, SelectorChecker::StyleRelation::AffectsNextSibling);
</del><ins>+ generateAddStyleRelationIfResolvingStyle(elementAddressRegister, Style::Relation::AffectsNextSibling);
</ins><span class="cx">
</span><span class="cx"> Assembler::JumpList matchingTagNameFailureCases;
</span><span class="cx"> Assembler::JumpList matchingPostTagNameFailureCases;
</span><span class="lines">@@ -2160,7 +2161,7 @@
</span><span class="cx"> m_backtrackingLevels.last().indirectAdjacentTreeWalkerBacktrackingPoint = m_assembler.label();
</span><span class="cx">
</span><span class="cx"> generateWalkToPreviousAdjacent(failureCases, fragment);
</span><del>- generateAddStyleRelationIfResolvingStyle(elementAddressRegister, SelectorChecker::StyleRelation::AffectsNextSibling);
</del><ins>+ generateAddStyleRelationIfResolvingStyle(elementAddressRegister, Style::Relation::AffectsNextSibling);
</ins><span class="cx">
</span><span class="cx"> if (fragment.backtrackingFlags & BacktrackingFlag::IndirectAdjacentEntryPoint)
</span><span class="cx"> m_backtrackingLevels.last().indirectAdjacentEntryPoint = m_assembler.label();
</span><span class="lines">@@ -2170,7 +2171,7 @@
</span><span class="cx"> localFailureCases.linkTo(loopStart, &m_assembler);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void SelectorCodeGenerator::generateAddStyleRelationIfResolvingStyle(Assembler::RegisterID element, SelectorChecker::StyleRelation::Type relationType, Optional<Assembler::RegisterID> value)
</del><ins>+void SelectorCodeGenerator::generateAddStyleRelationIfResolvingStyle(Assembler::RegisterID element, Style::Relation::Type relationType, Optional<Assembler::RegisterID> value)
</ins><span class="cx"> {
</span><span class="cx"> if (m_selectorContext == SelectorContext::QuerySelector)
</span><span class="cx"> return;
</span><span class="lines">@@ -2185,10 +2186,10 @@
</span><span class="cx">
</span><span class="cx"> static void addStyleRelationFunction(SelectorChecker::CheckingContext* checkingContext, Element* element)
</span><span class="cx"> {
</span><del>- checkingContext->styleRelations.append({ *element, SelectorChecker::StyleRelation::AffectedByActive, 1 });
</del><ins>+ checkingContext->styleRelations.append({ *element, Style::Relation::AffectedByActive, 1 });
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void SelectorCodeGenerator::generateAddStyleRelation(Assembler::RegisterID checkingContext, Assembler::RegisterID element, SelectorChecker::StyleRelation::Type relationType, Optional<Assembler::RegisterID> value)
</del><ins>+void SelectorCodeGenerator::generateAddStyleRelation(Assembler::RegisterID checkingContext, Assembler::RegisterID element, Style::Relation::Type relationType, Optional<Assembler::RegisterID> value)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(m_selectorContext != SelectorContext::QuerySelector);
</span><span class="cx">
</span><span class="lines">@@ -2199,20 +2200,20 @@
</span><span class="cx"> functionCall.call();
</span><span class="cx">
</span><span class="cx"> Assembler::Address vectorAddress(checkingContext, OBJECT_OFFSETOF(SelectorChecker::CheckingContext, styleRelations));
</span><del>- auto dataAddress = vectorAddress.withOffset(SelectorChecker::StyleRelations::dataMemoryOffset());
- auto sizeAddress = vectorAddress.withOffset(SelectorChecker::StyleRelations::sizeMemoryOffset());
</del><ins>+ auto dataAddress = vectorAddress.withOffset(Style::Relations::dataMemoryOffset());
+ auto sizeAddress = vectorAddress.withOffset(Style::Relations::sizeMemoryOffset());
</ins><span class="cx">
</span><span class="cx"> LocalRegister relationPointer(m_registerAllocator);
</span><span class="cx"> m_assembler.load32(sizeAddress, relationPointer);
</span><span class="cx"> m_assembler.sub32(Assembler::TrustedImm32(1), relationPointer);
</span><del>- m_assembler.mul32(Assembler::TrustedImm32(sizeof(SelectorChecker::StyleRelation)), relationPointer, relationPointer);
</del><ins>+ m_assembler.mul32(Assembler::TrustedImm32(sizeof(Style::Relation)), relationPointer, relationPointer);
</ins><span class="cx"> m_assembler.addPtr(dataAddress, relationPointer);
</span><span class="cx">
</span><del>- Assembler::Address typeAddress(relationPointer, OBJECT_OFFSETOF(SelectorChecker::StyleRelation, type));
</del><ins>+ Assembler::Address typeAddress(relationPointer, OBJECT_OFFSETOF(Style::Relation, type));
</ins><span class="cx"> m_assembler.store32(Assembler::TrustedImm32(relationType), typeAddress);
</span><span class="cx">
</span><span class="cx"> if (value) {
</span><del>- Assembler::Address valueAddress(relationPointer, OBJECT_OFFSETOF(SelectorChecker::StyleRelation, value));
</del><ins>+ Assembler::Address valueAddress(relationPointer, OBJECT_OFFSETOF(Style::Relation, value));
</ins><span class="cx"> m_assembler.store32(*value, valueAddress);
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -3056,7 +3057,7 @@
</span><span class="cx"> {
</span><span class="cx"> generateSpecialFailureInQuirksModeForActiveAndHoverIfNeeded(failureCases, fragment);
</span><span class="cx">
</span><del>- generateAddStyleRelationIfResolvingStyle(elementAddressRegister, SelectorChecker::StyleRelation::AffectedByActive);
</del><ins>+ generateAddStyleRelationIfResolvingStyle(elementAddressRegister, Style::Relation::AffectedByActive);
</ins><span class="cx">
</span><span class="cx"> FunctionCall functionCall(m_assembler, m_registerAllocator, m_stackAllocator, m_functionCalls);
</span><span class="cx"> functionCall.setFunctionAddress(elementIsActive);
</span><span class="lines">@@ -3105,7 +3106,7 @@
</span><span class="cx"> m_assembler.move(Assembler::TrustedImm32(1), isEmptyResults);
</span><span class="cx"> notEmpty.link(&m_assembler);
</span><span class="cx">
</span><del>- generateAddStyleRelationIfResolvingStyle(elementAddressRegister, SelectorChecker::StyleRelation::AffectedByEmpty, Assembler::RegisterID(isEmptyResults));
</del><ins>+ generateAddStyleRelationIfResolvingStyle(elementAddressRegister, Style::Relation::AffectedByEmpty, Assembler::RegisterID(isEmptyResults));
</ins><span class="cx">
</span><span class="cx"> failureCases.append(m_assembler.branchTest32(Assembler::Zero, isEmptyResults));
</span><span class="cx"> }
</span><span class="lines">@@ -3140,14 +3141,14 @@
</span><span class="cx"> LocalRegister checkingContext(m_registerAllocator);
</span><span class="cx"> Assembler::Jump notResolvingStyle = jumpIfNotResolvingStyle(checkingContext);
</span><span class="cx">
</span><del>- generateAddStyleRelation(checkingContext, parentElement, SelectorChecker::StyleRelation::ChildrenAffectedByFirstChildRules);
</del><ins>+ generateAddStyleRelation(checkingContext, parentElement, Style::Relation::ChildrenAffectedByFirstChildRules);
</ins><span class="cx"> m_registerAllocator.deallocateRegister(parentElement);
</span><span class="cx">
</span><span class="cx"> // The parent marking is unconditional. If the matching is not a success, we can now fail.
</span><span class="cx"> // Otherwise we need to apply setFirstChildState() on the RenderStyle.
</span><span class="cx"> failureCases.append(m_assembler.branchTest32(Assembler::NonZero, isFirstChildRegister));
</span><span class="cx">
</span><del>- generateAddStyleRelation(checkingContext, elementAddressRegister, SelectorChecker::StyleRelation::FirstChild);
</del><ins>+ generateAddStyleRelation(checkingContext, elementAddressRegister, Style::Relation::FirstChild);
</ins><span class="cx">
</span><span class="cx"> notResolvingStyle.link(&m_assembler);
</span><span class="cx"> failureCases.append(m_assembler.branchTest32(Assembler::NonZero, isFirstChildRegister));
</span><span class="lines">@@ -3162,7 +3163,7 @@
</span><span class="cx"> {
</span><span class="cx"> generateSpecialFailureInQuirksModeForActiveAndHoverIfNeeded(failureCases, fragment);
</span><span class="cx">
</span><del>- generateAddStyleRelationIfResolvingStyle(elementAddressRegister, SelectorChecker::StyleRelation::AffectedByHover);
</del><ins>+ generateAddStyleRelationIfResolvingStyle(elementAddressRegister, Style::Relation::AffectedByHover);
</ins><span class="cx">
</span><span class="cx"> FunctionCall functionCall(m_assembler, m_registerAllocator, m_stackAllocator, m_functionCalls);
</span><span class="cx"> functionCall.setFunctionAddress(elementIsHovered);
</span><span class="lines">@@ -3224,14 +3225,14 @@
</span><span class="cx"> LocalRegister checkingContext(m_registerAllocator);
</span><span class="cx"> Assembler::Jump notResolvingStyle = jumpIfNotResolvingStyle(checkingContext);
</span><span class="cx">
</span><del>- generateAddStyleRelation(checkingContext, parentElement, SelectorChecker::StyleRelation::ChildrenAffectedByLastChildRules);
</del><ins>+ generateAddStyleRelation(checkingContext, parentElement, Style::Relation::ChildrenAffectedByLastChildRules);
</ins><span class="cx"> m_registerAllocator.deallocateRegister(parentElement);
</span><span class="cx">
</span><span class="cx"> // The parent marking is unconditional. If the matching is not a success, we can now fail.
</span><span class="cx"> // Otherwise we need to apply setLastChildState() on the RenderStyle.
</span><span class="cx"> failureCases.append(m_assembler.branchTest32(Assembler::NonZero, isLastChildRegister));
</span><span class="cx">
</span><del>- generateAddStyleRelation(checkingContext, elementAddressRegister, SelectorChecker::StyleRelation::LastChild);
</del><ins>+ generateAddStyleRelation(checkingContext, elementAddressRegister, Style::Relation::LastChild);
</ins><span class="cx">
</span><span class="cx"> notResolvingStyle.link(&m_assembler);
</span><span class="cx"> failureCases.append(m_assembler.branchTest32(Assembler::NonZero, isLastChildRegister));
</span><span class="lines">@@ -3283,8 +3284,8 @@
</span><span class="cx"> LocalRegister checkingContext(m_registerAllocator);
</span><span class="cx"> Assembler::Jump notResolvingStyle = jumpIfNotResolvingStyle(checkingContext);
</span><span class="cx">
</span><del>- generateAddStyleRelation(checkingContext, parentElement, SelectorChecker::StyleRelation::ChildrenAffectedByFirstChildRules);
- generateAddStyleRelation(checkingContext, parentElement, SelectorChecker::StyleRelation::ChildrenAffectedByLastChildRules);
</del><ins>+ generateAddStyleRelation(checkingContext, parentElement, Style::Relation::ChildrenAffectedByFirstChildRules);
+ generateAddStyleRelation(checkingContext, parentElement, Style::Relation::ChildrenAffectedByLastChildRules);
</ins><span class="cx">
</span><span class="cx"> m_registerAllocator.deallocateRegister(parentElement);
</span><span class="cx">
</span><span class="lines">@@ -3292,8 +3293,8 @@
</span><span class="cx"> // Otherwise we need to apply setLastChildState() on the RenderStyle.
</span><span class="cx"> failureCases.append(m_assembler.branchTest32(Assembler::NonZero, isOnlyChildRegister));
</span><span class="cx">
</span><del>- generateAddStyleRelation(checkingContext, elementAddressRegister, SelectorChecker::StyleRelation::FirstChild);
- generateAddStyleRelation(checkingContext, elementAddressRegister, SelectorChecker::StyleRelation::LastChild);
</del><ins>+ generateAddStyleRelation(checkingContext, elementAddressRegister, Style::Relation::FirstChild);
+ generateAddStyleRelation(checkingContext, elementAddressRegister, Style::Relation::LastChild);
</ins><span class="cx">
</span><span class="cx"> notResolvingStyle.link(&m_assembler);
</span><span class="cx"> failureCases.append(m_assembler.branchTest32(Assembler::NonZero, isOnlyChildRegister));
</span><span class="lines">@@ -3303,7 +3304,7 @@
</span><span class="cx"> {
</span><span class="cx"> if (is<HTMLTextFormControlElement>(*element)) {
</span><span class="cx"> if (checkingContext->resolvingMode == SelectorChecker::Mode::ResolvingStyle)
</span><del>- checkingContext->styleRelations.append({ *element, SelectorChecker::StyleRelation::Unique, 1 });
</del><ins>+ checkingContext->styleRelations.append({ *element, Style::Relation::Unique, 1 });
</ins><span class="cx"> return downcast<HTMLTextFormControlElement>(*element).isPlaceholderVisible();
</span><span class="cx"> }
</span><span class="cx"> return false;
</span><span class="lines">@@ -3457,7 +3458,7 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> if (!isAdjacentRelation(fragment.relationToRightFragment))
</span><del>- generateAddStyleRelationIfResolvingStyle(elementAddressRegister, SelectorChecker::StyleRelation::AffectedByPreviousSibling);
</del><ins>+ generateAddStyleRelationIfResolvingStyle(elementAddressRegister, Style::Relation::AffectedByPreviousSibling);
</ins><span class="cx">
</span><span class="cx"> // Setup the counter at 1.
</span><span class="cx"> LocalRegisterWithPreference elementCounter(m_registerAllocator, JSC::GPRInfo::argumentGPR1);
</span><span class="lines">@@ -3475,7 +3476,7 @@
</span><span class="cx">
</span><span class="cx"> Assembler::JumpList noCachedChildIndexCases;
</span><span class="cx"> generateWalkToPreviousAdjacentElement(noMoreSiblingsCases, previousSibling);
</span><del>- generateAddStyleRelationIfResolvingStyle(previousSibling, SelectorChecker::StyleRelation::AffectsNextSibling);
</del><ins>+ generateAddStyleRelationIfResolvingStyle(previousSibling, Style::Relation::AffectsNextSibling);
</ins><span class="cx"> noCachedChildIndexCases.append(m_assembler.branchTest32(Assembler::Zero, Assembler::Address(previousSibling, Node::nodeFlagsMemoryOffset()), Assembler::TrustedImm32(Node::flagHasRareData())));
</span><span class="cx"> {
</span><span class="cx"> LocalRegister elementRareData(m_registerAllocator);
</span><span class="lines">@@ -3491,13 +3492,13 @@
</span><span class="cx">
</span><span class="cx"> Assembler::Label loopStart = m_assembler.label();
</span><span class="cx"> generateWalkToPreviousAdjacentElement(noMoreSiblingsCases, previousSibling);
</span><del>- generateAddStyleRelationIfResolvingStyle(previousSibling, SelectorChecker::StyleRelation::AffectsNextSibling);
</del><ins>+ generateAddStyleRelationIfResolvingStyle(previousSibling, Style::Relation::AffectsNextSibling);
</ins><span class="cx"> m_assembler.add32(Assembler::TrustedImm32(1), elementCounter);
</span><span class="cx"> m_assembler.jump().linkTo(loopStart, &m_assembler);
</span><span class="cx"> noMoreSiblingsCases.link(&m_assembler);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- generateAddStyleRelationIfResolvingStyle(elementAddressRegister, SelectorChecker::StyleRelation::NthChildIndex, Assembler::RegisterID(elementCounter));
</del><ins>+ generateAddStyleRelationIfResolvingStyle(elementAddressRegister, Style::Relation::NthChildIndex, Assembler::RegisterID(elementCounter));
</ins><span class="cx">
</span><span class="cx"> for (const auto& slot : validSubsetFilters)
</span><span class="cx"> generateNthFilterTest(failureCases, elementCounter, slot.first, slot.second);
</span><span class="lines">@@ -3524,7 +3525,7 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> if (!isAdjacentRelation(fragment.relationToRightFragment))
</span><del>- generateAddStyleRelationIfResolvingStyle(elementAddressRegister, SelectorChecker::StyleRelation::AffectedByPreviousSibling);
</del><ins>+ generateAddStyleRelationIfResolvingStyle(elementAddressRegister, Style::Relation::AffectedByPreviousSibling);
</ins><span class="cx">
</span><span class="cx"> for (const NthChildOfSelectorInfo* nthChildOfSelectorInfo : validSubsetFilters) {
</span><span class="cx"> // Setup the counter at 1.
</span><span class="lines">@@ -3541,7 +3542,7 @@
</span><span class="cx"> Assembler::Label loopStart = m_assembler.label();
</span><span class="cx">
</span><span class="cx"> generateWalkToPreviousAdjacentElement(noMoreSiblingsCases, previousSibling);
</span><del>- generateAddStyleRelationIfResolvingStyle(previousSibling, SelectorChecker::StyleRelation::AffectsNextSibling);
</del><ins>+ generateAddStyleRelationIfResolvingStyle(previousSibling, Style::Relation::AffectsNextSibling);
</ins><span class="cx">
</span><span class="cx"> Assembler::JumpList localFailureCases;
</span><span class="cx"> generateElementMatchesSelectorList(localFailureCases, previousSibling, nthChildOfSelectorInfo->selectorList);
</span><span class="lines">@@ -3564,7 +3565,7 @@
</span><span class="cx"> LocalRegister parentElement(m_registerAllocator);
</span><span class="cx"> generateWalkToParentElement(failureCases, parentElement);
</span><span class="cx">
</span><del>- generateAddStyleRelationIfResolvingStyle(parentElement, SelectorChecker::StyleRelation::ChildrenAffectedByBackwardPositionalRules);
</del><ins>+ generateAddStyleRelationIfResolvingStyle(parentElement, Style::Relation::ChildrenAffectedByBackwardPositionalRules);
</ins><span class="cx">
</span><span class="cx"> failureCases.append(m_assembler.branchTest32(Assembler::Zero, Assembler::Address(parentElement, Node::nodeFlagsMemoryOffset()), Assembler::TrustedImm32(Node::flagIsParsingChildrenFinished())));
</span><span class="cx">
</span><span class="lines">@@ -3607,7 +3608,7 @@
</span><span class="cx"> LocalRegister parentElement(m_registerAllocator);
</span><span class="cx"> generateWalkToParentElement(failureCases, parentElement);
</span><span class="cx">
</span><del>- generateAddStyleRelationIfResolvingStyle(parentElement, SelectorChecker::StyleRelation::ChildrenAffectedByPropertyBasedBackwardPositionalRules);
</del><ins>+ generateAddStyleRelationIfResolvingStyle(parentElement, Style::Relation::ChildrenAffectedByPropertyBasedBackwardPositionalRules);
</ins><span class="cx">
</span><span class="cx"> failureCases.append(m_assembler.branchTest32(Assembler::Zero, Assembler::Address(parentElement, Node::nodeFlagsMemoryOffset()), Assembler::TrustedImm32(Node::flagIsParsingChildrenFinished())));
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (197763 => 197764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2016-03-08 14:50:15 UTC (rev 197763)
+++ trunk/Source/WebCore/dom/Document.cpp        2016-03-08 14:59:53 UTC (rev 197764)
</span><span class="lines">@@ -2032,7 +2032,11 @@
</span><span class="cx"> ResourceLoadSuspender suspender;
</span><span class="cx">
</span><span class="cx"> TemporaryChange<bool> change(m_ignorePendingStylesheets, true);
</span><del>- return element.resolveStyle(parentStyle);
</del><ins>+ auto elementStyle = element.resolveStyle(parentStyle);
+
+ Style::commitRelationsToDocument(WTFMove(elementStyle.relations));
+
+ return WTFMove(elementStyle.renderStyle);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool Document::updateLayoutIfDimensionsOutOfDate(Element& element, DimensionsCheck dimensionsCheck)
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.cpp (197763 => 197764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.cpp        2016-03-08 14:50:15 UTC (rev 197763)
+++ trunk/Source/WebCore/dom/Element.cpp        2016-03-08 14:59:53 UTC (rev 197764)
</span><span class="lines">@@ -1367,7 +1367,7 @@
</span><span class="cx"> return document().ensureStyleResolver();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-Ref<RenderStyle> Element::resolveStyle(RenderStyle* parentStyle)
</del><ins>+ElementStyle Element::resolveStyle(RenderStyle* parentStyle)
</ins><span class="cx"> {
</span><span class="cx"> return styleResolver().styleForElement(*this, parentStyle);
</span><span class="cx"> }
</span><span class="lines">@@ -3287,10 +3287,10 @@
</span><span class="cx"> ASSERT(hasCustomStyleResolveCallbacks());
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<RenderStyle> Element::customStyleForRenderer(RenderStyle&, RenderStyle*)
</del><ins>+Optional<ElementStyle> Element::resolveCustomStyle(RenderStyle&, RenderStyle*)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(hasCustomStyleResolveCallbacks());
</span><del>- return nullptr;
</del><ins>+ return Nullopt;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void Element::cloneAttributesFromElement(const Element& other)
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.h (197763 => 197764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.h        2016-03-08 14:50:15 UTC (rev 197763)
+++ trunk/Source/WebCore/dom/Element.h        2016-03-08 14:59:53 UTC (rev 197764)
</span><span class="lines">@@ -52,6 +52,7 @@
</span><span class="cx"> class PseudoElement;
</span><span class="cx"> class RenderNamedFlowFragment;
</span><span class="cx"> class RenderTreePosition;
</span><ins>+struct ElementStyle;
</ins><span class="cx">
</span><span class="cx"> enum SpellcheckAttributeState {
</span><span class="cx"> SpellcheckAttributeTrue,
</span><span class="lines">@@ -479,7 +480,7 @@
</span><span class="cx"> virtual void didAttachRenderers();
</span><span class="cx"> virtual void willDetachRenderers();
</span><span class="cx"> virtual void didDetachRenderers();
</span><del>- virtual RefPtr<RenderStyle> customStyleForRenderer(RenderStyle& parentStyle, RenderStyle* shadowHostStyle);
</del><ins>+ virtual Optional<ElementStyle> resolveCustomStyle(RenderStyle& parentStyle, RenderStyle* shadowHostStyle);
</ins><span class="cx">
</span><span class="cx"> LayoutRect absoluteEventHandlerBounds(bool& includesFixedPositionElements) override;
</span><span class="cx">
</span><span class="lines">@@ -498,7 +499,7 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> StyleResolver& styleResolver();
</span><del>- Ref<RenderStyle> resolveStyle(RenderStyle* parentStyle);
</del><ins>+ ElementStyle resolveStyle(RenderStyle* parentStyle);
</ins><span class="cx">
</span><span class="cx"> virtual void isVisibleInViewportChanged() { }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoredomPseudoElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/PseudoElement.cpp (197763 => 197764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/PseudoElement.cpp        2016-03-08 14:50:15 UTC (rev 197763)
+++ trunk/Source/WebCore/dom/PseudoElement.cpp        2016-03-08 14:59:53 UTC (rev 197764)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #include "RenderElement.h"
</span><span class="cx"> #include "RenderImage.h"
</span><span class="cx"> #include "RenderQuote.h"
</span><ins>+#include "StyleResolver.h"
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="lines">@@ -76,9 +77,12 @@
</span><span class="cx"> m_hostElement = nullptr;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<RenderStyle> PseudoElement::customStyleForRenderer(RenderStyle& parentStyle, RenderStyle*)
</del><ins>+Optional<ElementStyle> PseudoElement::resolveCustomStyle(RenderStyle& parentStyle, RenderStyle*)
</ins><span class="cx"> {
</span><del>- return m_hostElement->renderer()->getCachedPseudoStyle(m_pseudoId, &parentStyle);
</del><ins>+ auto* style = m_hostElement->renderer()->getCachedPseudoStyle(m_pseudoId, &parentStyle);
+ if (!style)
+ return Nullopt;
+ return ElementStyle(*style);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PseudoElement::didAttachRenderers()
</span></span></pre></div>
<a id="trunkSourceWebCoredomPseudoElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/PseudoElement.h (197763 => 197764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/PseudoElement.h        2016-03-08 14:50:15 UTC (rev 197763)
+++ trunk/Source/WebCore/dom/PseudoElement.h        2016-03-08 14:59:53 UTC (rev 197764)
</span><span class="lines">@@ -45,7 +45,7 @@
</span><span class="cx"> Element* hostElement() const { return m_hostElement; }
</span><span class="cx"> void clearHostElement();
</span><span class="cx">
</span><del>- RefPtr<RenderStyle> customStyleForRenderer(RenderStyle& parentStyle, RenderStyle* shadowHostStyle) override;
</del><ins>+ Optional<ElementStyle> resolveCustomStyle(RenderStyle& parentStyle, RenderStyle* shadowHostStyle) override;
</ins><span class="cx"> void didAttachRenderers() override;
</span><span class="cx"> void didRecalcStyle(Style::Change) override;
</span><span class="cx"> bool rendererIsNeeded(const RenderStyle&) override;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLTitleElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLTitleElement.cpp (197763 => 197764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLTitleElement.cpp        2016-03-08 14:50:15 UTC (rev 197763)
+++ trunk/Source/WebCore/html/HTMLTitleElement.cpp        2016-03-08 14:59:53 UTC (rev 197764)
</span><span class="lines">@@ -82,7 +82,7 @@
</span><span class="cx"> if (RenderStyle* computedStyle = this->computedStyle())
</span><span class="cx"> direction = computedStyle->direction();
</span><span class="cx"> else {
</span><del>- auto style = resolveStyle(parentElement() ? parentElement()->renderStyle() : nullptr);
</del><ins>+ auto style = styleResolver().styleForElement(*this, parentElement() ? parentElement()->renderStyle() : nullptr).renderStyle;
</ins><span class="cx"> direction = style.get().direction();
</span><span class="cx"> }
</span><span class="cx"> return StringWithDirection(text(), direction);
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlshadowSliderThumbElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp (197763 => 197764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp        2016-03-08 14:50:15 UTC (rev 197763)
+++ trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp        2016-03-08 14:59:53 UTC (rev 197764)
</span><span class="lines">@@ -44,6 +44,7 @@
</span><span class="cx"> #include "RenderSlider.h"
</span><span class="cx"> #include "RenderTheme.h"
</span><span class="cx"> #include "ShadowRoot.h"
</span><ins>+#include "StyleResolver.h"
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(IOS_TOUCH_EVENTS)
</span><span class="cx"> #include "Document.h"
</span><span class="lines">@@ -573,7 +574,7 @@
</span><span class="cx"> return downcast<HTMLInputElement>(shadowHost());
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<RenderStyle> SliderThumbElement::customStyleForRenderer(RenderStyle&, RenderStyle* hostStyle)
</del><ins>+Optional<ElementStyle> SliderThumbElement::resolveCustomStyle(RenderStyle&, RenderStyle* hostStyle)
</ins><span class="cx"> {
</span><span class="cx"> // This doesn't actually compute style. This is just a hack to pick shadow pseudo id when host style is known.
</span><span class="cx">
</span><span class="lines">@@ -581,7 +582,7 @@
</span><span class="cx"> static NeverDestroyed<const AtomicString> mediaSliderThumbShadowPseudoId("-webkit-media-slider-thumb", AtomicString::ConstructFromLiteral);
</span><span class="cx">
</span><span class="cx"> if (!hostStyle)
</span><del>- return nullptr;
</del><ins>+ return Nullopt;
</ins><span class="cx">
</span><span class="cx"> switch (hostStyle->appearance()) {
</span><span class="cx"> case MediaSliderPart:
</span><span class="lines">@@ -596,7 +597,7 @@
</span><span class="cx"> m_shadowPseudoId = sliderThumbShadowPseudoId;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- return nullptr;
</del><ins>+ return Nullopt;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> const AtomicString& SliderThumbElement::shadowPseudoId() const
</span><span class="lines">@@ -627,7 +628,7 @@
</span><span class="cx"> return createRenderer<RenderSliderContainer>(*this, WTFMove(style));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<RenderStyle> SliderContainerElement::customStyleForRenderer(RenderStyle&, RenderStyle* hostStyle)
</del><ins>+Optional<ElementStyle> SliderContainerElement::resolveCustomStyle(RenderStyle&, RenderStyle* hostStyle)
</ins><span class="cx"> {
</span><span class="cx"> // This doesn't actually compute style. This is just a hack to pick shadow pseudo id when host style is known.
</span><span class="cx">
</span><span class="lines">@@ -635,7 +636,7 @@
</span><span class="cx"> static NeverDestroyed<const AtomicString> sliderContainer("-webkit-slider-container", AtomicString::ConstructFromLiteral);
</span><span class="cx">
</span><span class="cx"> if (!hostStyle)
</span><del>- return nullptr;
</del><ins>+ return Nullopt;
</ins><span class="cx">
</span><span class="cx"> switch (hostStyle->appearance()) {
</span><span class="cx"> case MediaSliderPart:
</span><span class="lines">@@ -650,7 +651,7 @@
</span><span class="cx"> m_shadowPseudoId = sliderContainer;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- return nullptr;
</del><ins>+ return Nullopt;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> const AtomicString& SliderContainerElement::shadowPseudoId() const
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlshadowSliderThumbElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/shadow/SliderThumbElement.h (197763 => 197764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/shadow/SliderThumbElement.h        2016-03-08 14:50:15 UTC (rev 197763)
+++ trunk/Source/WebCore/html/shadow/SliderThumbElement.h        2016-03-08 14:59:53 UTC (rev 197764)
</span><span class="lines">@@ -78,7 +78,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> void willDetachRenderers() override;
</span><span class="cx">
</span><del>- RefPtr<RenderStyle> customStyleForRenderer(RenderStyle&, RenderStyle*) override;
</del><ins>+ Optional<ElementStyle> resolveCustomStyle(RenderStyle&, RenderStyle*) override;
</ins><span class="cx"> const AtomicString& shadowPseudoId() const override;
</span><span class="cx">
</span><span class="cx"> void startDragging();
</span><span class="lines">@@ -135,7 +135,7 @@
</span><span class="cx"> private:
</span><span class="cx"> SliderContainerElement(Document&);
</span><span class="cx"> RenderPtr<RenderElement> createElementRenderer(Ref<RenderStyle>&&, const RenderTreePosition&) override;
</span><del>- RefPtr<RenderStyle> customStyleForRenderer(RenderStyle&, RenderStyle*) override;
</del><ins>+ Optional<ElementStyle> resolveCustomStyle(RenderStyle&, RenderStyle*) override;
</ins><span class="cx"> const AtomicString& shadowPseudoId() const override;
</span><span class="cx">
</span><span class="cx"> AtomicString m_shadowPseudoId;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlshadowTextControlInnerElementscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp (197763 => 197764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp        2016-03-08 14:50:15 UTC (rev 197763)
+++ trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp        2016-03-08 14:59:53 UTC (rev 197764)
</span><span class="lines">@@ -40,6 +40,7 @@
</span><span class="cx"> #include "RenderView.h"
</span><span class="cx"> #include "ScriptController.h"
</span><span class="cx"> #include "ShadowRoot.h"
</span><ins>+#include "StyleResolver.h"
</ins><span class="cx"> #include "TextEvent.h"
</span><span class="cx"> #include "TextEventInputType.h"
</span><span class="cx"> #include <wtf/Ref.h>
</span><span class="lines">@@ -74,7 +75,7 @@
</span><span class="cx"> return adoptRef(*new TextControlInnerElement(document));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<RenderStyle> TextControlInnerElement::customStyleForRenderer(RenderStyle&, RenderStyle* shadowHostStyle)
</del><ins>+Optional<ElementStyle> TextControlInnerElement::resolveCustomStyle(RenderStyle&, RenderStyle* shadowHostStyle)
</ins><span class="cx"> {
</span><span class="cx"> auto innerContainerStyle = RenderStyle::create();
</span><span class="cx"> innerContainerStyle.get().inheritFrom(shadowHostStyle);
</span><span class="lines">@@ -88,7 +89,7 @@
</span><span class="cx"> // We don't want the shadow dom to be editable, so we set this block to read-only in case the input itself is editable.
</span><span class="cx"> innerContainerStyle.get().setUserModify(READ_ONLY);
</span><span class="cx">
</span><del>- return WTFMove(innerContainerStyle);
</del><ins>+ return ElementStyle(WTFMove(innerContainerStyle));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // ---------------------------
</span><span class="lines">@@ -133,9 +134,9 @@
</span><span class="cx"> return downcast<RenderTextControlInnerBlock>(HTMLDivElement::renderer());
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<RenderStyle> TextControlInnerTextElement::customStyleForRenderer(RenderStyle&, RenderStyle* shadowHostStyle)
</del><ins>+Optional<ElementStyle> TextControlInnerTextElement::resolveCustomStyle(RenderStyle&, RenderStyle* shadowHostStyle)
</ins><span class="cx"> {
</span><del>- return downcast<HTMLTextFormControlElement>(*shadowHost()).createInnerTextStyle(*shadowHostStyle);
</del><ins>+ return ElementStyle(downcast<HTMLTextFormControlElement>(*shadowHost()).createInnerTextStyle(*shadowHostStyle));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // ----------------------------
</span><span class="lines">@@ -147,18 +148,17 @@
</span><span class="cx"> setHasCustomStyleResolveCallbacks();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<RenderStyle> TextControlPlaceholderElement::customStyleForRenderer(RenderStyle& parentStyle, RenderStyle* shadowHostStyle)
</del><ins>+Optional<ElementStyle> TextControlPlaceholderElement::resolveCustomStyle(RenderStyle& parentStyle, RenderStyle* shadowHostStyle)
</ins><span class="cx"> {
</span><span class="cx"> auto style = resolveStyle(&parentStyle);
</span><span class="cx">
</span><span class="cx"> auto& controlElement = downcast<HTMLTextFormControlElement>(*containingShadowRoot()->host());
</span><del>- style->setDisplay(controlElement.isPlaceholderVisible() ? BLOCK : NONE);
</del><ins>+ style.renderStyle->setDisplay(controlElement.isPlaceholderVisible() ? BLOCK : NONE);
</ins><span class="cx">
</span><span class="cx"> if (is<HTMLInputElement>(controlElement)) {
</span><span class="cx"> auto& inputElement = downcast<HTMLInputElement>(controlElement);
</span><del>- style->setTextOverflow(inputElement.shouldTruncateText(*shadowHostStyle) ? TextOverflowEllipsis : TextOverflowClip);
</del><ins>+ style.renderStyle->setTextOverflow(inputElement.shouldTruncateText(*shadowHostStyle) ? TextOverflowEllipsis : TextOverflowClip);
</ins><span class="cx"> }
</span><del>-
</del><span class="cx"> return WTFMove(style);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlshadowTextControlInnerElementsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/shadow/TextControlInnerElements.h (197763 => 197764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/shadow/TextControlInnerElements.h        2016-03-08 14:50:15 UTC (rev 197763)
+++ trunk/Source/WebCore/html/shadow/TextControlInnerElements.h        2016-03-08 14:59:53 UTC (rev 197764)
</span><span class="lines">@@ -48,7 +48,7 @@
</span><span class="cx">
</span><span class="cx"> protected:
</span><span class="cx"> TextControlInnerElement(Document&);
</span><del>- RefPtr<RenderStyle> customStyleForRenderer(RenderStyle& parentStyle, RenderStyle* shadowHostStyle) override;
</del><ins>+ Optional<ElementStyle> resolveCustomStyle(RenderStyle& parentStyle, RenderStyle* shadowHostStyle) override;
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> bool isMouseFocusable() const override { return false; }
</span><span class="lines">@@ -65,7 +65,7 @@
</span><span class="cx"> private:
</span><span class="cx"> TextControlInnerTextElement(Document&);
</span><span class="cx"> RenderPtr<RenderElement> createElementRenderer(Ref<RenderStyle>&&, const RenderTreePosition&) override;
</span><del>- RefPtr<RenderStyle> customStyleForRenderer(RenderStyle& parentStyle, RenderStyle* shadowHostStyle) override;
</del><ins>+ Optional<ElementStyle> resolveCustomStyle(RenderStyle& parentStyle, RenderStyle* shadowHostStyle) override;
</ins><span class="cx"> bool isMouseFocusable() const override { return false; }
</span><span class="cx"> bool isTextControlInnerTextElement() const override { return true; }
</span><span class="cx"> };
</span><span class="lines">@@ -77,7 +77,7 @@
</span><span class="cx"> private:
</span><span class="cx"> TextControlPlaceholderElement(Document&);
</span><span class="cx">
</span><del>- RefPtr<RenderStyle> customStyleForRenderer(RenderStyle& parentStyle, RenderStyle* shadowHostStyle) override;
</del><ins>+ Optional<ElementStyle> resolveCustomStyle(RenderStyle& parentStyle, RenderStyle* shadowHostStyle) override;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> class SearchFieldResultsButtonElement final : public HTMLDivElement {
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (197763 => 197764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderElement.cpp        2016-03-08 14:50:15 UTC (rev 197763)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp        2016-03-08 14:59:53 UTC (rev 197764)
</span><span class="lines">@@ -1576,9 +1576,9 @@
</span><span class="cx"> auto& styleResolver = element()->styleResolver();
</span><span class="cx">
</span><span class="cx"> if (pseudoStyleRequest.pseudoId == FIRST_LINE_INHERITED) {
</span><del>- RefPtr<RenderStyle> result = styleResolver.styleForElement(*element(), parentStyle);
</del><ins>+ auto result = styleResolver.styleForElement(*element(), parentStyle).renderStyle;
</ins><span class="cx"> result->setStyleType(FIRST_LINE_INHERITED);
</span><del>- return result.release();
</del><ins>+ return WTFMove(result);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return styleResolver.pseudoStyleForElement(*element(), pseudoStyleRequest, *parentStyle);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderNamedFlowFragmentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderNamedFlowFragment.cpp (197763 => 197764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderNamedFlowFragment.cpp        2016-03-08 14:50:15 UTC (rev 197763)
+++ trunk/Source/WebCore/rendering/RenderNamedFlowFragment.cpp        2016-03-08 14:59:53 UTC (rev 197764)
</span><span class="lines">@@ -352,9 +352,9 @@
</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<RenderStyle> renderObjectRegionStyle = renderer.element()->styleResolver().styleForElement(*renderer.element(), &parentStyle, MatchAllRules, this);
</del><ins>+ auto renderObjectRegionStyle = renderer.element()->styleResolver().styleForElement(*renderer.element(), &parentStyle, MatchAllRules, this).renderStyle;
</ins><span class="cx">
</span><del>- return renderObjectRegionStyle.release();
</del><ins>+ return WTFMove(renderObjectRegionStyle);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void RenderNamedFlowFragment::computeChildrenStyleInRegion(RenderElement& renderer)
</span></span></pre></div>
<a id="trunkSourceWebCorestyleStyleRelationscpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/style/StyleRelations.cpp (0 => 197764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/StyleRelations.cpp         (rev 0)
+++ trunk/Source/WebCore/style/StyleRelations.cpp        2016-03-08 14:59:53 UTC (rev 197764)
</span><span class="lines">@@ -0,0 +1,146 @@
</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. AND ITS CONTRIBUTORS ``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 ITS 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 "config.h"
+#include "StyleRelations.h"
+
+#include "Element.h"
+#include "NodeRenderStyle.h"
+#include "RenderStyle.h"
+
+namespace WebCore {
+namespace Style {
+
+std::unique_ptr<Relations> commitRelationsToRenderStyle(RenderStyle& style, const Element& element, const Relations& relations)
+{
+ std::unique_ptr<Relations> remainingRelations;
+
+ auto appendStyleRelation = [&remainingRelations] (const Relation& relation) {
+ if (!remainingRelations)
+ remainingRelations = std::make_unique<Relations>();
+ remainingRelations->append(relation);
+ };
+
+ for (auto& relation : relations) {
+ if (&relation.element != &element) {
+ appendStyleRelation(relation);
+ continue;
+ }
+ switch (relation.type) {
+ case Relation::AffectedByActive:
+ style.setAffectedByActive();
+ break;
+ case Relation::AffectedByDrag:
+ style.setAffectedByDrag();
+ break;
+ case Relation::AffectedByEmpty:
+ style.setEmptyState(relation.value);
+ appendStyleRelation(relation);
+ break;
+ case Relation::AffectedByHover:
+ style.setAffectedByHover();
+ break;
+ case Relation::FirstChild:
+ style.setFirstChildState();
+ break;
+ case Relation::LastChild:
+ style.setLastChildState();
+ break;
+ case Relation::Unique:
+ style.setUnique();
+ break;
+ case Relation::AffectedByPreviousSibling:
+ case Relation::AffectsNextSibling:
+ case Relation::ChildrenAffectedByBackwardPositionalRules:
+ case Relation::ChildrenAffectedByFirstChildRules:
+ case Relation::ChildrenAffectedByPropertyBasedBackwardPositionalRules:
+ case Relation::ChildrenAffectedByLastChildRules:
+ case Relation::NthChildIndex:
+ appendStyleRelation(relation);
+ break;
+ }
+ }
+ return remainingRelations;
+}
+
+void commitRelationsToDocument(std::unique_ptr<Relations> relations)
+{
+ if (!relations)
+ return;
+ for (auto& relation : *relations) {
+ auto& element = const_cast<Element&>(relation.element);
+ switch (relation.type) {
+ case Relation::AffectedByActive:
+ element.setChildrenAffectedByActive();
+ break;
+ case Relation::AffectedByDrag:
+ element.setChildrenAffectedByDrag();
+ break;
+ case Relation::AffectedByEmpty:
+ element.setStyleAffectedByEmpty();
+ break;
+ case Relation::AffectedByHover:
+ element.setChildrenAffectedByHover();
+ break;
+ case Relation::AffectedByPreviousSibling:
+ element.setStyleIsAffectedByPreviousSibling();
+ break;
+ case Relation::AffectsNextSibling:
+ element.setAffectsNextSiblingElementStyle();
+ break;
+ case Relation::ChildrenAffectedByBackwardPositionalRules:
+ element.setChildrenAffectedByBackwardPositionalRules();
+ break;
+ case Relation::ChildrenAffectedByFirstChildRules:
+ element.setChildrenAffectedByFirstChildRules();
+ break;
+ case Relation::ChildrenAffectedByPropertyBasedBackwardPositionalRules:
+ element.setChildrenAffectedByBackwardPositionalRules();
+ element.setChildrenAffectedByPropertyBasedBackwardPositionalRules();
+ break;
+ case Relation::ChildrenAffectedByLastChildRules:
+ element.setChildrenAffectedByLastChildRules();
+ break;
+ case Relation::FirstChild:
+ if (auto* style = element.renderStyle())
+ style->setFirstChildState();
+ break;
+ case Relation::LastChild:
+ if (auto* style = element.renderStyle())
+ style->setLastChildState();
+ break;
+ case Relation::NthChildIndex:
+ element.setChildIndex(relation.value);
+ break;
+ case Relation::Unique:
+ if (auto* style = element.renderStyle())
+ style->setUnique();
+ break;
+ }
+ }
+}
+
+}
+}
</ins></span></pre></div>
<a id="trunkSourceWebCorestyleStyleRelationsh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/style/StyleRelations.h (0 => 197764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/StyleRelations.h         (rev 0)
+++ trunk/Source/WebCore/style/StyleRelations.h        2016-03-08 14:59:53 UTC (rev 197764)
</span><span class="lines">@@ -0,0 +1,74 @@
</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. AND ITS CONTRIBUTORS ``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 ITS 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 StyleRelations_h
+#define StyleRelations_h
+
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class Element;
+class RenderStyle;
+
+namespace Style {
+
+struct Relation {
+ enum Type {
+ AffectedByActive,
+ AffectedByDrag,
+ AffectedByEmpty,
+ AffectedByHover,
+ AffectedByPreviousSibling,
+ AffectsNextSibling,
+ ChildrenAffectedByBackwardPositionalRules,
+ ChildrenAffectedByFirstChildRules,
+ ChildrenAffectedByPropertyBasedBackwardPositionalRules,
+ ChildrenAffectedByLastChildRules,
+ FirstChild,
+ LastChild,
+ NthChildIndex,
+ Unique,
+ };
+ const Element& element;
+ Type type;
+ unsigned value;
+
+ Relation(const Element& element, Type type, unsigned value = 1)
+ : element(element)
+ , type(type)
+ , value(value)
+ { }
+};
+
+using Relations = Vector<Relation, 8>;
+
+std::unique_ptr<Relations> commitRelationsToRenderStyle(RenderStyle&, const Element&, const Relations&);
+void commitRelationsToDocument(std::unique_ptr<Relations>);
+
+}
+}
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebCorestyleStyleSharingResolvercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/style/StyleSharingResolver.cpp (197763 => 197764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/StyleSharingResolver.cpp        2016-03-08 14:50:15 UTC (rev 197763)
+++ trunk/Source/WebCore/style/StyleSharingResolver.cpp        2016-03-08 14:59:53 UTC (rev 197764)
</span><span class="lines">@@ -322,7 +322,7 @@
</span><span class="cx"> if (!ruleSet)
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- ElementRuleCollector collector(const_cast<StyledElement&>(element), nullptr, m_ruleSets, &m_selectorFilter);
</del><ins>+ ElementRuleCollector collector(const_cast<StyledElement&>(element), m_ruleSets, &m_selectorFilter);
</ins><span class="cx"> return collector.hasAnyMatchingRules(ruleSet);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorestyleStyleTreeResolvercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/style/StyleTreeResolver.cpp (197763 => 197764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/StyleTreeResolver.cpp        2016-03-08 14:50:15 UTC (rev 197763)
+++ trunk/Source/WebCore/style/StyleTreeResolver.cpp        2016-03-08 14:59:53 UTC (rev 197764)
</span><span class="lines">@@ -179,17 +179,20 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (element.hasCustomStyleResolveCallbacks()) {
</span><del>- RenderStyle* shadowHostStyle = nullptr;
- if (auto* shadowRoot = scope().shadowRoot)
- shadowHostStyle = shadowRoot->host()->renderStyle();
- if (RefPtr<RenderStyle> style = element.customStyleForRenderer(inheritedStyle, shadowHostStyle))
- return style.releaseNonNull();
</del><ins>+ RenderStyle* shadowHostStyle = scope().shadowRoot ? scope().shadowRoot->host()->renderStyle() : nullptr;
+ if (auto customStyle = element.resolveCustomStyle(inheritedStyle, shadowHostStyle)) {
+ Style::commitRelationsToDocument(WTFMove(customStyle->relations));
+ return WTFMove(customStyle->renderStyle);
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (auto* sharingElement = scope().sharingResolver.resolve(element))
</span><span class="cx"> return *sharingElement->renderStyle();
</span><span class="cx">
</span><del>- return scope().styleResolver.styleForElement(element, &inheritedStyle, MatchAllRules, nullptr, &scope().selectorFilter);
</del><ins>+ auto elementStyle = scope().styleResolver.styleForElement(element, &inheritedStyle, MatchAllRules, nullptr, &scope().selectorFilter);
+
+ Style::commitRelationsToDocument(WTFMove(elementStyle.relations));
+ return WTFMove(elementStyle.renderStyle);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if ENABLE(CSS_REGIONS)
</span></span></pre></div>
<a id="trunkSourceWebCorestyleStyleTreeResolverh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/style/StyleTreeResolver.h (197763 => 197764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/StyleTreeResolver.h        2016-03-08 14:50:15 UTC (rev 197763)
+++ trunk/Source/WebCore/style/StyleTreeResolver.h        2016-03-08 14:59:53 UTC (rev 197764)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx">
</span><span class="cx"> #include "RenderStyleConstants.h"
</span><span class="cx"> #include "RenderTreePosition.h"
</span><ins>+#include "SelectorChecker.h"
</ins><span class="cx"> #include "SelectorFilter.h"
</span><span class="cx"> #include "StyleChange.h"
</span><span class="cx"> #include "StyleSharingResolver.h"
</span><span class="lines">@@ -62,6 +63,7 @@
</span><span class="cx"> Change resolveElement(Element&);
</span><span class="cx"> void resolveBeforeOrAfterPseudoElement(Element&, Change, PseudoId, RenderTreePosition&);
</span><span class="cx">
</span><ins>+
</ins><span class="cx"> void createRenderTreeRecursively(Element&, RenderStyle&, RenderTreePosition&, RefPtr<RenderStyle>&& resolvedStyle);
</span><span class="cx"> void createRenderer(Element&, RenderTreePosition&, RefPtr<RenderStyle>&& resolvedStyle);
</span><span class="cx"> void createRenderTreeForBeforeOrAfterPseudoElement(Element&, PseudoId, RenderTreePosition&);
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGElement.cpp (197763 => 197764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGElement.cpp        2016-03-08 14:50:15 UTC (rev 197763)
+++ trunk/Source/WebCore/svg/SVGElement.cpp        2016-03-08 14:59:53 UTC (rev 197764)
</span><span class="lines">@@ -786,11 +786,11 @@
</span><span class="cx"> contextElement->synchronizeSystemLanguage();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<RenderStyle> SVGElement::customStyleForRenderer(RenderStyle& parentStyle, RenderStyle*)
</del><ins>+Optional<ElementStyle> SVGElement::resolveCustomStyle(RenderStyle& parentStyle, RenderStyle*)
</ins><span class="cx"> {
</span><span class="cx"> // If the element is in a <use> tree we get the style from the definition tree.
</span><span class="cx"> if (auto* styleElement = this->correspondingElement())
</span><del>- return styleElement->styleResolver().styleForElement(*styleElement, &parentStyle);
</del><ins>+ return styleElement->resolveStyle(&parentStyle);
</ins><span class="cx">
</span><span class="cx"> return resolveStyle(&parentStyle);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGElement.h (197763 => 197764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGElement.h        2016-03-08 14:50:15 UTC (rev 197763)
+++ trunk/Source/WebCore/svg/SVGElement.h        2016-03-08 14:59:53 UTC (rev 197764)
</span><span class="lines">@@ -119,7 +119,7 @@
</span><span class="cx"> void synchronizeAnimatedSVGAttribute(const QualifiedName&) const;
</span><span class="cx"> static void synchronizeAllAnimatedSVGAttribute(SVGElement*);
</span><span class="cx">
</span><del>- RefPtr<RenderStyle> customStyleForRenderer(RenderStyle& parentStyle, RenderStyle* shadowHostStyle) override;
</del><ins>+ Optional<ElementStyle> resolveCustomStyle(RenderStyle& parentStyle, RenderStyle* shadowHostStyle) override;
</ins><span class="cx">
</span><span class="cx"> static void synchronizeRequiredFeatures(SVGElement* contextElement);
</span><span class="cx"> static void synchronizeRequiredExtensions(SVGElement* contextElement);
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGElementRareDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGElementRareData.h (197763 => 197764)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGElementRareData.h        2016-03-08 14:50:15 UTC (rev 197763)
+++ trunk/Source/WebCore/svg/SVGElementRareData.h        2016-03-08 14:59:53 UTC (rev 197764)
</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 "base value" for the SMIL animation sandwhich model.
</span><del>- m_overrideComputedStyle = element.styleResolver().styleForElement(element, parentStyle, MatchAllRulesExcludingSMIL);
</del><ins>+ m_overrideComputedStyle = element.styleResolver().styleForElement(element, parentStyle, MatchAllRulesExcludingSMIL).renderStyle;
</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>