Title: [129974] trunk/Source/WebCore
Revision
129974
Author
[email protected]
Date
2012-09-29 02:21:11 -0700 (Sat, 29 Sep 2012)

Log Message

Slightly improve clarity of the patch in bug 78595.
https://bugs.webkit.org/show_bug.cgi?id=97944

Reviewed by Andreas Kling.

Since all types of relations, except SubSelector are effectively ignoring the calculated value of pseudoId, make the code reflect that a bit more clearly.

No change in behavior, covered by test in bug 78595.

* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::checkSelector): Added ignoreDynamicPseudo value that's given to all callsites that should ignore the result.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (129973 => 129974)


--- trunk/Source/WebCore/ChangeLog	2012-09-29 08:49:57 UTC (rev 129973)
+++ trunk/Source/WebCore/ChangeLog	2012-09-29 09:21:11 UTC (rev 129974)
@@ -1,3 +1,17 @@
+2012-09-29  Dimitri Glazkov  <[email protected]>
+
+        Slightly improve clarity of the patch in bug 78595.
+        https://bugs.webkit.org/show_bug.cgi?id=97944
+
+        Reviewed by Andreas Kling.
+
+        Since all types of relations, except SubSelector are effectively ignoring the calculated value of pseudoId, make the code reflect that a bit more clearly. 
+
+        No change in behavior, covered by test in bug 78595.
+
+        * css/SelectorChecker.cpp:
+        (WebCore::SelectorChecker::checkSelector): Added ignoreDynamicPseudo value that's given to all callsites that should ignore the result.
+
 2012-09-29  Kent Tamura  <[email protected]>
 
         Remove LocalizedDate*.*

Modified: trunk/Source/WebCore/css/SelectorChecker.cpp (129973 => 129974)


--- trunk/Source/WebCore/css/SelectorChecker.cpp	2012-09-29 08:49:57 UTC (rev 129973)
+++ trunk/Source/WebCore/css/SelectorChecker.cpp	2012-09-29 09:21:11 UTC (rev 129974)
@@ -456,6 +456,7 @@
     SelectorCheckingContext nextContext(context);
     nextContext.selector = historySelector;
 
+    PseudoId ignoreDynamicPseudo = NOPSEUDO;
     if (relation != CSSSelector::SubSelector) {
         // Abort if the next selector would exceed the scope.
         if (context.element == context.scope)
@@ -472,9 +473,6 @@
         nextContext.pseudoStyle = NOPSEUDO;
     }
 
-    PseudoId nonSubSelectorPseudo(NOPSEUDO);
-    PseudoId& currentDynamicPseudo = relation == CSSSelector::SubSelector ? dynamicPseudo : nonSubSelectorPseudo;
-
     switch (relation) {
     case CSSSelector::Descendant:
         nextContext.element = context.element->parentElement();
@@ -482,7 +480,7 @@
         nextContext.elementStyle = 0;
         nextContext.elementParentStyle = 0;
         for (; nextContext.element; nextContext.element = nextContext.element->parentElement()) {
-            SelectorMatch match = checkSelector(nextContext, currentDynamicPseudo, hasUnknownPseudoElements);
+            SelectorMatch match = checkSelector(nextContext, ignoreDynamicPseudo, hasUnknownPseudoElements);
             if (match == SelectorMatches || match == SelectorFailsCompletely)
                 return match;
             if (nextContext.element == nextContext.scope)
@@ -497,7 +495,7 @@
         nextContext.isSubSelector = false;
         nextContext.elementStyle = 0;
         nextContext.elementParentStyle = 0;
-        return checkSelector(nextContext, currentDynamicPseudo, hasUnknownPseudoElements);
+        return checkSelector(nextContext, ignoreDynamicPseudo, hasUnknownPseudoElements);
 
     case CSSSelector::DirectAdjacent:
         if (m_mode == ResolvingStyle && context.element->parentElement()) {
@@ -511,7 +509,7 @@
         nextContext.isSubSelector = false;
         nextContext.elementStyle = 0;
         nextContext.elementParentStyle = 0;
-        return checkSelector(nextContext, currentDynamicPseudo, hasUnknownPseudoElements);
+        return checkSelector(nextContext, ignoreDynamicPseudo, hasUnknownPseudoElements);
 
     case CSSSelector::IndirectAdjacent:
         if (m_mode == ResolvingStyle && context.element->parentElement()) {
@@ -524,7 +522,7 @@
         nextContext.elementStyle = 0;
         nextContext.elementParentStyle = 0;
         for (; nextContext.element; nextContext.element = nextContext.element->previousElementSibling()) {
-            SelectorMatch match = checkSelector(nextContext, currentDynamicPseudo, hasUnknownPseudoElements);
+            SelectorMatch match = checkSelector(nextContext, ignoreDynamicPseudo, hasUnknownPseudoElements);
             if (match == SelectorMatches || match == SelectorFailsAllSiblings || match == SelectorFailsCompletely)
                 return match;
         };
@@ -538,7 +536,7 @@
              && !((RenderScrollbar::scrollbarForStyleResolve() || dynamicPseudo == SCROLLBAR_CORNER || dynamicPseudo == RESIZER) && nextContext.selector->m_match == CSSSelector::PseudoClass))
             return SelectorFailsCompletely;
         nextContext.isSubSelector = true;
-        return checkSelector(nextContext, currentDynamicPseudo, hasUnknownPseudoElements);
+        return checkSelector(nextContext, dynamicPseudo, hasUnknownPseudoElements);
 
     case CSSSelector::ShadowDescendant:
         {
@@ -552,7 +550,7 @@
             nextContext.isSubSelector = false;
             nextContext.elementStyle = 0;
             nextContext.elementParentStyle = 0;
-            return checkSelector(nextContext, currentDynamicPseudo, hasUnknownPseudoElements);
+            return checkSelector(nextContext, ignoreDynamicPseudo, hasUnknownPseudoElements);
         }
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to