Title: [103160] trunk/Source/WebCore
- Revision
- 103160
- Author
- [email protected]
- Date
- 2011-12-17 19:17:27 -0800 (Sat, 17 Dec 2011)
Log Message
CSSStyleSelector: Clean up matchRules().
<http://webkit.org/b/74794>
Reviewed by Antti Koivisto.
- Early return from the isCollectingRulesOnly() path to reduce nesting.
- Move the creation of m_ruleList out of the loop that builds the list.
- Removed some comments from the Captain Obvious department.
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::matchRules):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (103159 => 103160)
--- trunk/Source/WebCore/ChangeLog 2011-12-18 03:06:33 UTC (rev 103159)
+++ trunk/Source/WebCore/ChangeLog 2011-12-18 03:17:27 UTC (rev 103160)
@@ -1,5 +1,19 @@
2011-12-17 Andreas Kling <[email protected]>
+ CSSStyleSelector: Clean up matchRules().
+ <http://webkit.org/b/74794>
+
+ Reviewed by Antti Koivisto.
+
+ - Early return from the isCollectingRulesOnly() path to reduce nesting.
+ - Move the creation of m_ruleList out of the loop that builds the list.
+ - Removed some comments from the Captain Obvious department.
+
+ * css/CSSStyleSelector.cpp:
+ (WebCore::CSSStyleSelector::matchRules):
+
+2011-12-17 Andreas Kling <[email protected]>
+
RuleSet: Remove style sheet null-check in addRulesFromSheet().
<http://webkit.org/b/74792>
Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (103159 => 103160)
--- trunk/Source/WebCore/css/CSSStyleSelector.cpp 2011-12-18 03:06:33 UTC (rev 103159)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp 2011-12-18 03:17:27 UTC (rev 103160)
@@ -642,32 +642,30 @@
matchRulesForList(rules->tagRules(m_element->localName().impl()), firstRuleIndex, lastRuleIndex, includeEmptyRules);
matchRulesForList(rules->universalRules(), firstRuleIndex, lastRuleIndex, includeEmptyRules);
- // If we didn't match any rules, we're done.
if (m_matchedRules.isEmpty())
return;
- // Sort the set of matched rules.
sortMatchedRules();
- // Now transfer the set of matched rules over to our list of decls.
- if (!m_checker.isCollectingRulesOnly()) {
- // FIXME: This sucks, the inspector should get the style from the visited style itself.
- bool swapVisitedUnvisited = InspectorInstrumentation::forcePseudoState(m_element, CSSSelector::PseudoVisited);
- for (unsigned i = 0; i < m_matchedRules.size(); i++) {
- if (m_style && m_matchedRules[i]->containsUncommonAttributeSelector())
- m_style->setAffectedByUncommonAttributeSelectors();
- unsigned linkMatchType = m_matchedRules[i]->linkMatchType();
- if (swapVisitedUnvisited && linkMatchType && linkMatchType != SelectorChecker::MatchAll)
- linkMatchType = (linkMatchType == SelectorChecker::MatchVisited) ? SelectorChecker::MatchLink : SelectorChecker::MatchVisited;
- addMatchedDeclaration(m_matchedRules[i]->rule()->declaration(), linkMatchType, m_matchedRules[i]->regionStyleRule());
- }
- } else {
- for (unsigned i = 0; i < m_matchedRules.size(); i++) {
- if (!m_ruleList)
- m_ruleList = CSSRuleList::create();
+ if (m_checker.isCollectingRulesOnly()) {
+ if (!m_ruleList)
+ m_ruleList = CSSRuleList::create();
+ for (unsigned i = 0; i < m_matchedRules.size(); ++i)
m_ruleList->append(m_matchedRules[i]->rule());
- }
+ return;
}
+
+ // Now transfer the set of matched rules over to our list of declarations.
+ // FIXME: This sucks, the inspector should get the style from the visited style itself.
+ bool swapVisitedUnvisited = InspectorInstrumentation::forcePseudoState(m_element, CSSSelector::PseudoVisited);
+ for (unsigned i = 0; i < m_matchedRules.size(); i++) {
+ if (m_style && m_matchedRules[i]->containsUncommonAttributeSelector())
+ m_style->setAffectedByUncommonAttributeSelectors();
+ unsigned linkMatchType = m_matchedRules[i]->linkMatchType();
+ if (swapVisitedUnvisited && linkMatchType && linkMatchType != SelectorChecker::MatchAll)
+ linkMatchType = (linkMatchType == SelectorChecker::MatchVisited) ? SelectorChecker::MatchLink : SelectorChecker::MatchVisited;
+ addMatchedDeclaration(m_matchedRules[i]->rule()->declaration(), linkMatchType, m_matchedRules[i]->regionStyleRule());
+ }
}
class MatchingUARulesScope {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes