Title: [156187] trunk/Source/WebCore
Revision
156187
Author
[email protected]
Date
2013-09-20 12:27:04 -0700 (Fri, 20 Sep 2013)

Log Message

Move the SharingRules mode outside of SelectorChecker
https://bugs.webkit.org/show_bug.cgi?id=121652

Reviewed by Antti Koivisto.

The SharingRules handling inside SelectorChecker is a weird hack
to hit a specific branch of ElementRuleCollector.

This patch moves the exception to ElementRuleCollector, where it is easier
to understand what it is for.

* css/ElementRuleCollector.cpp:
(WebCore::ElementRuleCollector::doCollectMatchingRulesForList):
* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::match):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (156186 => 156187)


--- trunk/Source/WebCore/ChangeLog	2013-09-20 19:09:05 UTC (rev 156186)
+++ trunk/Source/WebCore/ChangeLog	2013-09-20 19:27:04 UTC (rev 156187)
@@ -1,3 +1,21 @@
+2013-09-20  Benjamin Poulain  <[email protected]>
+
+        Move the SharingRules mode outside of SelectorChecker
+        https://bugs.webkit.org/show_bug.cgi?id=121652
+
+        Reviewed by Antti Koivisto.
+
+        The SharingRules handling inside SelectorChecker is a weird hack
+        to hit a specific branch of ElementRuleCollector.
+
+        This patch moves the exception to ElementRuleCollector, where it is easier
+        to understand what it is for.
+
+        * css/ElementRuleCollector.cpp:
+        (WebCore::ElementRuleCollector::doCollectMatchingRulesForList):
+        * css/SelectorChecker.cpp:
+        (WebCore::SelectorChecker::match):
+
 2013-09-20  Yoav Weiss  <[email protected]>
 
         Fixed img src URLS with multiple spaces

Modified: trunk/Source/WebCore/css/ElementRuleCollector.cpp (156186 => 156187)


--- trunk/Source/WebCore/css/ElementRuleCollector.cpp	2013-09-20 19:09:05 UTC (rev 156186)
+++ trunk/Source/WebCore/css/ElementRuleCollector.cpp	2013-09-20 19:27:04 UTC (rev 156187)
@@ -410,6 +410,12 @@
             cookie = InspectorInstrumentation::willMatchRule(&document(), rule, m_inspectorCSSOMWrappers, document().styleSheetCollection());
         PseudoId dynamicPseudo = NOPSEUDO;
         if (ruleMatches(ruleData, matchRequest.scope, dynamicPseudo)) {
+            // For SharingRules testing, any match is good enough, we don't care what is matched.
+            if (m_mode == SelectorChecker::SharingRules) {
+                addMatchedRule(&ruleData);
+                break;
+            }
+
             // If the rule has no properties to apply, then ignore it in the non-debug mode.
             const StylePropertySet& properties = rule->properties();
             if (properties.isEmpty() && !matchRequest.includeEmptyRules) {

Modified: trunk/Source/WebCore/css/SelectorChecker.cpp (156186 => 156187)


--- trunk/Source/WebCore/css/SelectorChecker.cpp	2013-09-20 19:09:05 UTC (rev 156186)
+++ trunk/Source/WebCore/css/SelectorChecker.cpp	2013-09-20 19:27:04 UTC (rev 156187)
@@ -150,7 +150,7 @@
 // * SelectorFailsCompletely  - the selector fails for e and any sibling or ancestor of e
 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext& context, PseudoId& dynamicPseudo) const
 {
-    // first selector has to match
+    // The first selector has to match.
     if (!checkOne(context))
         return SelectorFailsLocally;
 
@@ -171,7 +171,7 @@
             PseudoId pseudoId = CSSSelector::pseudoId(context.selector->pseudoType());
             if (pseudoId == FIRST_LETTER)
                 context.element->document().styleSheetCollection()->setUsesFirstLetterRules(true);
-            if (pseudoId != NOPSEUDO && m_mode != SharingRules)
+            if (pseudoId != NOPSEUDO)
                 dynamicPseudo = pseudoId;
         }
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to