<!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>[163475] trunk</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/163475">163475</a></dd>
<dt>Author</dt> <dd>antti@apple.com</dd>
<dt>Date</dt> <dd>2014-02-05 13:50:55 -0800 (Wed, 05 Feb 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>ElementRuleCollector should not use StyleResolver::State
https://bugs.webkit.org/show_bug.cgi?id=128247
Source/WebCore:
Reviewed by Andreas Kling.
Make ElementRuleCollector more reusable.
* css/ElementRuleCollector.cpp:
(WebCore::ElementRuleCollector::collectMatchingRules):
(WebCore::ElementRuleCollector::sortAndTransferMatchedRules):
(WebCore::ElementRuleCollector::matchAuthorRules):
(WebCore::ElementRuleCollector::matchUARules):
(WebCore::ElementRuleCollector::ruleMatches):
(WebCore::ElementRuleCollector::collectMatchingRulesForList):
(WebCore::ElementRuleCollector::matchAllRules):
* css/ElementRuleCollector.h:
(WebCore::ElementRuleCollector::ElementRuleCollector):
Pass the objects that are actually needed rather than the entire State.
LayoutTests:
Reviewed by Andreas Kling.
* platform/mac/fast/parser/xhtml-alternate-entities-expected.png:
* platform/mac/fast/parser/xhtml-alternate-entities-expected.txt: This is a progression.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmacfastparserxhtmlalternateentitiesexpectedpng">trunk/LayoutTests/platform/mac/fast/parser/xhtml-alternate-entities-expected.png</a></li>
<li><a href="#trunkLayoutTestsplatformmacfastparserxhtmlalternateentitiesexpectedtxt">trunk/LayoutTests/platform/mac/fast/parser/xhtml-alternate-entities-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</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="#trunkSourceWebCorecssStyleResolvercpp">trunk/Source/WebCore/css/StyleResolver.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (163474 => 163475)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-02-05 21:44:26 UTC (rev 163474)
+++ trunk/LayoutTests/ChangeLog        2014-02-05 21:50:55 UTC (rev 163475)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2014-02-05 Antti Koivisto <antti@apple.com>
+
+ ElementRuleCollector should not use StyleResolver::State
+ https://bugs.webkit.org/show_bug.cgi?id=128247
+
+ Reviewed by Andreas Kling.
+
+ * platform/mac/fast/parser/xhtml-alternate-entities-expected.png:
+ * platform/mac/fast/parser/xhtml-alternate-entities-expected.txt: This is a progression.
+
</ins><span class="cx"> 2014-02-05 Yuki Sekiguchi <yuki.sekiguchi@access-company.com>
</span><span class="cx">
</span><span class="cx"> Ruby base oddly justify its text when the text is ideograph and it contains <br> on Mac.
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacfastparserxhtmlalternateentitiesexpectedpng"></a>
<div class="binary"><h4>Modified: trunk/LayoutTests/platform/mac/fast/parser/xhtml-alternate-entities-expected.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacfastparserxhtmlalternateentitiesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/fast/parser/xhtml-alternate-entities-expected.txt (163474 => 163475)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/fast/parser/xhtml-alternate-entities-expected.txt        2014-02-05 21:44:26 UTC (rev 163474)
+++ trunk/LayoutTests/platform/mac/fast/parser/xhtml-alternate-entities-expected.txt        2014-02-05 21:50:55 UTC (rev 163475)
</span><span class="lines">@@ -18,7 +18,7 @@
</span><span class="cx"> RenderText {#text} at (0,0) size 0x0
</span><span class="cx"> RenderText {#text} at (0,0) size 0x0
</span><span class="cx"> RenderText {#text} at (0,0) size 0x0
</span><del>- RenderInline {p} at (0,0) size 489x18
</del><ins>+ RenderInline {p} at (0,0) size 489x18 [color=#FF0000]
</ins><span class="cx"> RenderInline {font} at (0,0) size 489x18
</span><span class="cx"> RenderText {#text} at (0,0) size 489x18
</span><span class="cx"> text run at (0,0) width 263: "This should be the only line on this page. "
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (163474 => 163475)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-02-05 21:44:26 UTC (rev 163474)
+++ trunk/Source/WebCore/ChangeLog        2014-02-05 21:50:55 UTC (rev 163475)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2014-02-05 Antti Koivisto <antti@apple.com>
+
+ ElementRuleCollector should not use StyleResolver::State
+ https://bugs.webkit.org/show_bug.cgi?id=128247
+
+ Reviewed by Andreas Kling.
+
+ Make ElementRuleCollector more reusable.
+
+ * css/ElementRuleCollector.cpp:
+ (WebCore::ElementRuleCollector::collectMatchingRules):
+ (WebCore::ElementRuleCollector::sortAndTransferMatchedRules):
+ (WebCore::ElementRuleCollector::matchAuthorRules):
+ (WebCore::ElementRuleCollector::matchUARules):
+ (WebCore::ElementRuleCollector::ruleMatches):
+ (WebCore::ElementRuleCollector::collectMatchingRulesForList):
+ (WebCore::ElementRuleCollector::matchAllRules):
+ * css/ElementRuleCollector.h:
+ (WebCore::ElementRuleCollector::ElementRuleCollector):
+
+ Pass the objects that are actually needed rather than the entire State.
+
</ins><span class="cx"> 2014-02-05 Brent Fulgham <bfulgham@apple.com>
</span><span class="cx">
</span><span class="cx"> [Mac] Correct copy/paste error in scrolling code.
</span></span></pre></div>
<a id="trunkSourceWebCorecssElementRuleCollectorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/ElementRuleCollector.cpp (163474 => 163475)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/ElementRuleCollector.cpp        2014-02-05 21:44:26 UTC (rev 163474)
+++ trunk/Source/WebCore/css/ElementRuleCollector.cpp        2014-02-05 21:50:55 UTC (rev 163475)
</span><span class="lines">@@ -2,7 +2,7 @@
</span><span class="cx"> * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
</span><span class="cx"> * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
</span><span class="cx"> * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
</span><del>- * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Apple Inc. All rights reserved.
</ins><span class="cx"> * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
</span><span class="cx"> * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
</span><span class="cx"> * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
</span><span class="lines">@@ -145,19 +145,13 @@
</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(m_state.element());
</del><span class="cx">
</span><del>- const StyleResolver::State& state = m_state;
- Element* element = state.element();
- const StyledElement* styledElement = state.styledElement();
- const AtomicString& pseudoId = element->shadowPseudoId();
- if (!pseudoId.isEmpty()) {
- ASSERT(styledElement);
</del><ins>+ const AtomicString& pseudoId = m_element.shadowPseudoId();
+ if (!pseudoId.isEmpty())
</ins><span class="cx"> collectMatchingRulesForList(matchRequest.ruleSet->shadowPseudoElementRules(pseudoId.impl()), matchRequest, ruleRange);
</span><del>- }
</del><span class="cx">
</span><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><del>- if (element->isWebVTTElement())
</del><ins>+ if (m_element.isWebVTTElement())
</ins><span class="cx"> collectMatchingRulesForList(matchRequest.ruleSet->cuePseudoRules(), matchRequest, ruleRange);
</span><span class="cx"> #endif
</span><span class="cx"> // Check whether other types of rules are applicable in the current tree scope. Criteria for this:
</span><span class="lines">@@ -165,23 +159,23 @@
</span><span class="cx"> // b) the tree scope allows author rules
</span><span class="cx"> // c) the rules comes from a scoped style sheet within the same tree scope
</span><span class="cx"> if (!MatchingUARulesScope::isMatchingUARules()
</span><del>- && !element->treeScope().applyAuthorStyles())
</del><ins>+ && !m_element.treeScope().applyAuthorStyles())
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> // We need to collect the rules for id, class, tag, and everything else into a buffer and
</span><span class="cx"> // then sort the buffer.
</span><del>- if (element->hasID())
- collectMatchingRulesForList(matchRequest.ruleSet->idRules(element->idForStyleResolution().impl()), matchRequest, ruleRange);
- if (styledElement && styledElement->hasClass()) {
- for (size_t i = 0; i < styledElement->classNames().size(); ++i)
- collectMatchingRulesForList(matchRequest.ruleSet->classRules(styledElement->classNames()[i].impl()), matchRequest, ruleRange);
</del><ins>+ if (m_element.hasID())
+ collectMatchingRulesForList(matchRequest.ruleSet->idRules(m_element.idForStyleResolution().impl()), matchRequest, ruleRange);
+ if (m_element.hasClass()) {
+ for (size_t i = 0; i < m_element.classNames().size(); ++i)
+ collectMatchingRulesForList(matchRequest.ruleSet->classRules(m_element.classNames()[i].impl()), matchRequest, ruleRange);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- if (element->isLink())
</del><ins>+ if (m_element.isLink())
</ins><span class="cx"> collectMatchingRulesForList(matchRequest.ruleSet->linkPseudoClassRules(), matchRequest, ruleRange);
</span><del>- if (SelectorChecker::matchesFocusPseudoClass(element))
</del><ins>+ if (SelectorChecker::matchesFocusPseudoClass(&m_element))
</ins><span class="cx"> collectMatchingRulesForList(matchRequest.ruleSet->focusPseudoClassRules(), matchRequest, ruleRange);
</span><del>- collectMatchingRulesForList(matchRequest.ruleSet->tagRules(element->localName().impl()), matchRequest, ruleRange);
</del><ins>+ collectMatchingRulesForList(matchRequest.ruleSet->tagRules(m_element.localName().impl()), matchRequest, ruleRange);
</ins><span class="cx"> collectMatchingRulesForList(matchRequest.ruleSet->universalRules(), matchRequest, ruleRange);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -203,8 +197,6 @@
</span><span class="cx">
</span><span class="cx"> void ElementRuleCollector::sortAndTransferMatchedRules()
</span><span class="cx"> {
</span><del>- const StyleResolver::State& state = m_state;
-
</del><span class="cx"> if (!m_matchedRules || m_matchedRules->isEmpty())
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="lines">@@ -219,8 +211,8 @@
</span><span class="cx">
</span><span class="cx"> // Now transfer the set of matched rules over to our list of declarations.
</span><span class="cx"> for (unsigned i = 0; i < matchedRules.size(); i++) {
</span><del>- if (state.style() && matchedRules[i]->containsUncommonAttributeSelector())
- state.style()->setUnique();
</del><ins>+ if (m_style && matchedRules[i]->containsUncommonAttributeSelector())
+ m_style->setUnique();
</ins><span class="cx"> m_result.addMatchedProperties(matchedRules[i]->rule()->properties(), matchedRules[i]->rule(), matchedRules[i]->linkMatchType(), matchedRules[i]->propertyWhitelistType(MatchingUARulesScope::isMatchingUARules()));
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -230,9 +222,6 @@
</span><span class="cx"> clearMatchedRules();
</span><span class="cx"> m_result.ranges.lastAuthorRule = m_result.matchedProperties.size() - 1;
</span><span class="cx">
</span><del>- if (!m_state.element())
- return;
-
</del><span class="cx"> // Match global author rules.
</span><span class="cx"> MatchRequest matchRequest(m_ruleSets.authorStyle(), includeEmptyRules);
</span><span class="cx"> StyleResolver::RuleRange ruleRange = m_result.ranges.authorRuleRange();
</span><span class="lines">@@ -270,11 +259,11 @@
</span><span class="cx"> matchUARules(userAgentStyleSheet);
</span><span class="cx">
</span><span class="cx"> // In quirks mode, we match rules from the quirks user agent sheet.
</span><del>- if (document().inQuirksMode())
</del><ins>+ if (m_element.document().inQuirksMode())
</ins><span class="cx"> matchUARules(CSSDefaultStyleSheets::defaultQuirksStyle);
</span><span class="cx">
</span><span class="cx"> // If document uses view source styles (in view source mode or in xml viewer mode), then we match rules from the view source style sheet.
</span><del>- if (document().isViewSource())
</del><ins>+ if (m_element.document().isViewSource())
</ins><span class="cx"> matchUARules(CSSDefaultStyleSheets::viewSourceStyle());
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -291,8 +280,6 @@
</span><span class="cx">
</span><span class="cx"> inline bool ElementRuleCollector::ruleMatches(const RuleData& ruleData, PseudoId& dynamicPseudo)
</span><span class="cx"> {
</span><del>- const StyleResolver::State& state = m_state;
-
</del><span class="cx"> bool fastCheckableSelector = ruleData.hasFastCheckableSelector();
</span><span class="cx"> if (fastCheckableSelector) {
</span><span class="cx"> // We know this selector does not include any pseudo elements.
</span><span class="lines">@@ -300,7 +287,7 @@
</span><span class="cx"> return false;
</span><span class="cx"> // We know a sufficiently simple single part selector matches simply because we found it from the rule hash.
</span><span class="cx"> // This is limited to HTML only so we don't need to check the namespace.
</span><del>- if (ruleData.hasRightmostSelectorMatchingHTMLBasedOnRuleHash() && state.element()->isHTMLElement()) {
</del><ins>+ if (ruleData.hasRightmostSelectorMatchingHTMLBasedOnRuleHash() && m_element.isHTMLElement()) {
</ins><span class="cx"> if (!ruleData.hasMultipartSelector())
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="lines">@@ -309,7 +296,7 @@
</span><span class="cx"> #if ENABLE(CSS_SELECTOR_JIT)
</span><span class="cx"> void* compiledSelectorChecker = ruleData.compiledSelectorCodeRef().code().executableAddress();
</span><span class="cx"> if (!compiledSelectorChecker && ruleData.compilationStatus() == SelectorCompilationStatus::NotCompiled) {
</span><del>- JSC::VM* vm = document().scriptExecutionContext()->vm();
</del><ins>+ JSC::VM* vm = m_element.document().scriptExecutionContext()->vm();
</ins><span class="cx"> SelectorCompilationStatus compilationStatus;
</span><span class="cx"> JSC::MacroAssemblerCodeRef compiledSelectorCodeRef;
</span><span class="cx"> compilationStatus = SelectorCompiler::compileSelector(ruleData.selector(), vm, compiledSelectorCodeRef);
</span><span class="lines">@@ -323,22 +310,22 @@
</span><span class="cx">
</span><span class="cx"> if (ruleData.compilationStatus() == SelectorCompilationStatus::SimpleSelectorChecker) {
</span><span class="cx"> SelectorCompiler::SimpleSelectorChecker selectorChecker = SelectorCompiler::simpleSelectorCheckerFunction(compiledSelectorChecker, ruleData.compilationStatus());
</span><del>- return selectorChecker(state.element());
</del><ins>+ return selectorChecker(&m_element);
</ins><span class="cx"> }
</span><span class="cx"> ASSERT(ruleData.compilationStatus() == SelectorCompilationStatus::SelectorCheckerWithCheckingContext);
</span><span class="cx">
</span><span class="cx"> SelectorCompiler::SelectorCheckerWithCheckingContext selectorChecker = SelectorCompiler::selectorCheckerFunctionWithCheckingContext(compiledSelectorChecker, ruleData.compilationStatus());
</span><span class="cx"> SelectorCompiler::CheckingContext context;
</span><del>- context.elementStyle = state.style();
</del><ins>+ context.elementStyle = m_style;
</ins><span class="cx"> context.resolvingMode = m_mode;
</span><del>- return selectorChecker(state.element(), &context);
</del><ins>+ return selectorChecker(&m_element, &context);
</ins><span class="cx"> }
</span><span class="cx"> #endif // ENABLE(CSS_SELECTOR_JIT)
</span><span class="cx">
</span><span class="cx"> if (fastCheckableSelector) {
</span><del>- if (ruleData.selector()->m_match == CSSSelector::Tag && !SelectorChecker::tagMatches(state.element(), ruleData.selector()->tagQName()))
</del><ins>+ if (ruleData.selector()->m_match == CSSSelector::Tag && !SelectorChecker::tagMatches(&m_element, ruleData.selector()->tagQName()))
</ins><span class="cx"> return false;
</span><del>- SelectorCheckerFastPath selectorCheckerFastPath(ruleData.selector(), state.element());
</del><ins>+ SelectorCheckerFastPath selectorCheckerFastPath(ruleData.selector(), &m_element);
</ins><span class="cx"> if (!selectorCheckerFastPath.matchesRightmostAttributeSelector())
</span><span class="cx"> return false;
</span><span class="cx">
</span><span class="lines">@@ -346,9 +333,9 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Slow path.
</span><del>- SelectorChecker selectorChecker(document(), m_mode);
- SelectorChecker::SelectorCheckingContext context(ruleData.selector(), state.element(), SelectorChecker::VisitedMatchEnabled);
- context.elementStyle = state.style();
</del><ins>+ SelectorChecker selectorChecker(m_element.document(), m_mode);
+ SelectorChecker::SelectorCheckingContext context(ruleData.selector(), &m_element, SelectorChecker::VisitedMatchEnabled);
+ context.elementStyle = m_style;
</ins><span class="cx"> context.pseudoId = m_pseudoStyleRequest.pseudoId;
</span><span class="cx"> context.scrollbar = m_pseudoStyleRequest.scrollbar;
</span><span class="cx"> context.scrollbarPart = m_pseudoStyleRequest.scrollbarPart;
</span><span class="lines">@@ -364,8 +351,6 @@
</span><span class="cx"> if (!rules)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- const StyleResolver::State& state = m_state;
-
</del><span class="cx"> for (unsigned i = 0, size = rules->size(); i < size; ++i) {
</span><span class="cx"> const RuleData& ruleData = rules->data()[i];
</span><span class="cx"> if (m_canUseFastReject && m_selectorFilter.fastRejectSelector<RuleData::maximumIdentifierCount>(ruleData.descendantSelectorIdentifierHashes()))
</span><span class="lines">@@ -392,8 +377,8 @@
</span><span class="cx"> if (dynamicPseudo != NOPSEUDO && m_pseudoStyleRequest.pseudoId == NOPSEUDO) {
</span><span class="cx"> if (m_mode == SelectorChecker::CollectingRules)
</span><span class="cx"> continue;
</span><del>- if (dynamicPseudo < FIRST_INTERNAL_PSEUDOID)
- state.style()->setHasPseudoStyle(dynamicPseudo);
</del><ins>+ if (dynamicPseudo < FIRST_INTERNAL_PSEUDOID && m_style)
+ m_style->setHasPseudoStyle(dynamicPseudo);
</ins><span class="cx"> } else {
</span><span class="cx"> // Update our first/last rule indices in the matched rules array.
</span><span class="cx"> ++ruleRange.lastRuleIndex;
</span><span class="lines">@@ -430,17 +415,18 @@
</span><span class="cx"> matchUserRules(false);
</span><span class="cx">
</span><span class="cx"> // Now check author rules, beginning first with presentational attributes mapped from HTML.
</span><del>- if (m_state.styledElement()) {
- addElementStyleProperties(m_state.styledElement()->presentationAttributeStyle());
</del><ins>+ if (m_element.isStyledElement()) {
+ StyledElement& styledElement = toStyledElement(m_element);
+ addElementStyleProperties(styledElement.presentationAttributeStyle());
</ins><span class="cx">
</span><span class="cx"> // Now we check additional mapped declarations.
</span><span class="cx"> // Tables and table cells share an additional mapped rule that must be applied
</span><span class="cx"> // after all attributes, since their mapped style depends on the values of multiple attributes.
</span><del>- addElementStyleProperties(m_state.styledElement()->additionalPresentationAttributeStyle());
</del><ins>+ addElementStyleProperties(styledElement.additionalPresentationAttributeStyle());
</ins><span class="cx">
</span><del>- if (m_state.styledElement()->isHTMLElement()) {
</del><ins>+ if (styledElement.isHTMLElement()) {
</ins><span class="cx"> bool isAuto;
</span><del>- TextDirection textDirection = toHTMLElement(m_state.styledElement())->directionalityIfhasDirAutoAttribute(isAuto);
</del><ins>+ TextDirection textDirection = toHTMLElement(styledElement).directionalityIfhasDirAutoAttribute(isAuto);
</ins><span class="cx"> if (isAuto)
</span><span class="cx"> m_result.addMatchedProperties(textDirection == LTR ? leftToRightDeclaration() : rightToLeftDeclaration());
</span><span class="cx"> }
</span><span class="lines">@@ -450,18 +436,21 @@
</span><span class="cx"> if (matchAuthorAndUserStyles)
</span><span class="cx"> matchAuthorRules(false);
</span><span class="cx">
</span><del>- // Now check our inline style attribute.
- if (matchAuthorAndUserStyles && m_state.styledElement() && m_state.styledElement()->inlineStyle()) {
- // Inline style is immutable as long as there is no CSSOM wrapper.
- // FIXME: Media control shadow trees seem to have problems with caching.
- bool isInlineStyleCacheable = !m_state.styledElement()->inlineStyle()->isMutable() && !m_state.styledElement()->isInShadowTree();
- // FIXME: Constify.
- addElementStyleProperties(m_state.styledElement()->inlineStyle(), isInlineStyleCacheable);
- }
</del><ins>+ if (matchAuthorAndUserStyles && m_element.isStyledElement()) {
+ StyledElement& styledElement = toStyledElement(m_element);
+ // Now check our inline style attribute.
+ if (styledElement.inlineStyle()) {
+ // Inline style is immutable as long as there is no CSSOM wrapper.
+ // FIXME: Media control shadow trees seem to have problems with caching.
+ bool isInlineStyleCacheable = !styledElement.inlineStyle()->isMutable() && !styledElement.isInShadowTree();
+ // FIXME: Constify.
+ addElementStyleProperties(styledElement.inlineStyle(), isInlineStyleCacheable);
+ }
</ins><span class="cx">
</span><del>- // Now check SMIL animation override style.
- if (includeSMILProperties && matchAuthorAndUserStyles && m_state.styledElement() && m_state.styledElement()->isSVGElement())
- addElementStyleProperties(toSVGElement(m_state.styledElement())->animatedSMILStyleProperties(), false /* isCacheable */);
</del><ins>+ // Now check SMIL animation override style.
+ if (includeSMILProperties && styledElement.isSVGElement())
+ addElementStyleProperties(toSVGElement(styledElement).animatedSMILStyleProperties(), false /* isCacheable */);
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool ElementRuleCollector::hasAnyMatchingRules(RuleSet* ruleSet)
</span></span></pre></div>
<a id="trunkSourceWebCorecssElementRuleCollectorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/ElementRuleCollector.h (163474 => 163475)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/ElementRuleCollector.h        2014-02-05 21:44:26 UTC (rev 163474)
+++ trunk/Source/WebCore/css/ElementRuleCollector.h        2014-02-05 21:50:55 UTC (rev 163475)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> /*
</span><span class="cx"> * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
</span><del>- * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2013, 2014 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * This library is free software; you can redistribute it and/or
</span><span class="cx"> * modify it under the terms of the GNU Library General Public
</span><span class="lines">@@ -40,16 +40,17 @@
</span><span class="cx">
</span><span class="cx"> class ElementRuleCollector {
</span><span class="cx"> public:
</span><del>- ElementRuleCollector(StyleResolver* styleResolver, const StyleResolver::State& state)
- : m_state(state)
- , m_ruleSets(styleResolver->ruleSets())
- , m_selectorFilter(styleResolver->selectorFilter())
</del><ins>+ ElementRuleCollector(Element& element, RenderStyle* style, const DocumentRuleSets& ruleSets, const SelectorFilter& selectorFilter)
+ : m_element(element)
+ , m_style(style)
+ , m_ruleSets(ruleSets)
+ , m_selectorFilter(selectorFilter)
</ins><span class="cx"> , m_isPrintStyle(false)
</span><span class="cx"> , m_regionForStyling(0)
</span><span class="cx"> , m_pseudoStyleRequest(NOPSEUDO)
</span><span class="cx"> , m_sameOriginOnly(false)
</span><span class="cx"> , m_mode(SelectorChecker::ResolvingStyle)
</span><del>- , m_canUseFastReject(m_selectorFilter.parentStackIsConsistent(state.parentNode()))
</del><ins>+ , m_canUseFastReject(m_selectorFilter.parentStackIsConsistent(element.parentNode()))
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -70,7 +71,6 @@
</span><span class="cx"> const Vector<RefPtr<StyleRuleBase>>& matchedRuleList() const;
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- Document& document() { return m_state.document(); }
</del><span class="cx"> void addElementStyleProperties(const StyleProperties*, bool isCacheable = true);
</span><span class="cx">
</span><span class="cx"> void matchUARules(RuleSet*);
</span><span class="lines">@@ -86,9 +86,10 @@
</span><span class="cx"> void addMatchedRule(const RuleData*);
</span><span class="cx"> void clearMatchedRules();
</span><span class="cx">
</span><del>- const StyleResolver::State& m_state;
- DocumentRuleSets& m_ruleSets;
- SelectorFilter& m_selectorFilter;
</del><ins>+ Element& m_element;
+ RenderStyle* m_style;
+ const DocumentRuleSets& m_ruleSets;
+ const SelectorFilter& m_selectorFilter;
</ins><span class="cx">
</span><span class="cx"> bool m_isPrintStyle;
</span><span class="cx"> RenderRegion* m_regionForStyling;
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleResolvercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleResolver.cpp (163474 => 163475)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleResolver.cpp        2014-02-05 21:44:26 UTC (rev 163474)
+++ trunk/Source/WebCore/css/StyleResolver.cpp        2014-02-05 21:50:55 UTC (rev 163475)
</span><span class="lines">@@ -486,7 +486,7 @@
</span><span class="cx"> if (!ruleSet)
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- ElementRuleCollector collector(this, m_state);
</del><ins>+ ElementRuleCollector collector(*m_state.element(), m_state.style(), m_ruleSets, m_selectorFilter);
</ins><span class="cx"> return collector.hasAnyMatchingRules(ruleSet);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -796,7 +796,7 @@
</span><span class="cx"> if (needsCollection)
</span><span class="cx"> m_ruleSets.collectFeatures(document().isViewSource());
</span><span class="cx">
</span><del>- ElementRuleCollector collector(this, state);
</del><ins>+ ElementRuleCollector collector(*element, state.style(), m_ruleSets, m_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">@@ -939,17 +939,17 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-PassRefPtr<RenderStyle> StyleResolver::pseudoStyleForElement(Element* e, const PseudoStyleRequest& pseudoStyleRequest, RenderStyle* parentStyle)
</del><ins>+PassRefPtr<RenderStyle> StyleResolver::pseudoStyleForElement(Element* element, const PseudoStyleRequest& pseudoStyleRequest, RenderStyle* parentStyle)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(parentStyle);
</span><del>- if (!e)
</del><ins>+ if (!element)
</ins><span class="cx"> return 0;
</span><span class="cx">
</span><span class="cx"> State& state = m_state;
</span><span class="cx">
</span><del>- initElement(e);
</del><ins>+ initElement(element);
</ins><span class="cx">
</span><del>- state.initForStyleResolve(document(), e, parentStyle);
</del><ins>+ state.initForStyleResolve(document(), element, parentStyle);
</ins><span class="cx">
</span><span class="cx"> if (m_state.parentStyle()) {
</span><span class="cx"> state.setStyle(RenderStyle::create());
</span><span class="lines">@@ -963,7 +963,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(this, state);
</del><ins>+ ElementRuleCollector collector(*element, m_state.style(), m_ruleSets, m_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">@@ -978,7 +978,7 @@
</span><span class="cx">
</span><span class="cx"> state.style()->setStyleType(pseudoStyleRequest.pseudoId);
</span><span class="cx">
</span><del>- applyMatchedProperties(collector.matchedResult(), e);
</del><ins>+ applyMatchedProperties(collector.matchedResult(), element);
</ins><span class="cx">
</span><span class="cx"> // Clean up our style object's display and text decorations (among other fixups).
</span><span class="cx"> adjustRenderStyle(*state.style(), *m_state.parentStyle(), 0);
</span><span class="lines">@@ -1452,15 +1452,15 @@
</span><span class="cx"> return pseudoStyleRulesForElement(e, NOPSEUDO, rulesToInclude);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-Vector<RefPtr<StyleRuleBase>> StyleResolver::pseudoStyleRulesForElement(Element* e, PseudoId pseudoId, unsigned rulesToInclude)
</del><ins>+Vector<RefPtr<StyleRuleBase>> StyleResolver::pseudoStyleRulesForElement(Element* element, PseudoId pseudoId, unsigned rulesToInclude)
</ins><span class="cx"> {
</span><del>- if (!e || !e->document().haveStylesheetsLoaded())
</del><ins>+ if (!element || !element->document().haveStylesheetsLoaded())
</ins><span class="cx"> return Vector<RefPtr<StyleRuleBase>>();
</span><span class="cx">
</span><del>- initElement(e);
- m_state.initForStyleResolve(document(), e, 0);
</del><ins>+ initElement(element);
+ m_state.initForStyleResolve(document(), element, 0);
</ins><span class="cx">
</span><del>- ElementRuleCollector collector(this, m_state);
</del><ins>+ ElementRuleCollector collector(*element, m_state.style(), m_ruleSets, m_selectorFilter);
</ins><span class="cx"> collector.setMode(SelectorChecker::CollectingRules);
</span><span class="cx"> collector.setPseudoStyleRequest(PseudoStyleRequest(pseudoId));
</span><span class="cx"> collector.setMedium(m_medium.get());
</span></span></pre>
</div>
</div>
</body>
</html>