Title: [162843] trunk/Source/WebCore
Revision
162843
Author
[email protected]
Date
2014-01-27 09:12:46 -0800 (Mon, 27 Jan 2014)

Log Message

REGRESSION(r133214): Don't invalidate style when adding classes that don't match rules
https://bugs.webkit.org/show_bug.cgi?id=126177

Reviewed by Anders Carlsson.
        
Spotted by Elliott Sprehn in Chromium.

* dom/Element.cpp:
(WebCore::checkSelectorForClassChange):
        
    Remove unnecessary templating.

(WebCore::Element::classAttributeChanged):
        
    Fix logic error with 'continue'.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (162842 => 162843)


--- trunk/Source/WebCore/ChangeLog	2014-01-27 16:57:30 UTC (rev 162842)
+++ trunk/Source/WebCore/ChangeLog	2014-01-27 17:12:46 UTC (rev 162843)
@@ -1,3 +1,21 @@
+2014-01-27  Antti Koivisto  <[email protected]>
+
+        REGRESSION(r133214): Don't invalidate style when adding classes that don't match rules
+        https://bugs.webkit.org/show_bug.cgi?id=126177
+
+        Reviewed by Anders Carlsson.
+        
+        Spotted by Elliott Sprehn in Chromium.
+
+        * dom/Element.cpp:
+        (WebCore::checkSelectorForClassChange):
+        
+            Remove unnecessary templating.
+
+        (WebCore::Element::classAttributeChanged):
+        
+            Fix logic error with 'continue'.
+
 2014-01-27  Brendan Long  <[email protected]>
 
         [GStreamer] Lockup when playing Icecast radio

Modified: trunk/Source/WebCore/dom/Element.cpp (162842 => 162843)


--- trunk/Source/WebCore/dom/Element.cpp	2014-01-27 16:57:30 UTC (rev 162842)
+++ trunk/Source/WebCore/dom/Element.cpp	2014-01-27 17:12:46 UTC (rev 162843)
@@ -1153,42 +1153,43 @@
     return classStringHasClassName(newClassString.characters16(), length);
 }
 
-template<typename Checker>
-static bool checkSelectorForClassChange(const SpaceSplitString& changedClasses, const Checker& checker)
+static bool checkSelectorForClassChange(const SpaceSplitString& changedClasses, const StyleResolver& styleResolver)
 {
     unsigned changedSize = changedClasses.size();
     for (unsigned i = 0; i < changedSize; ++i) {
-        if (checker.hasSelectorForClass(changedClasses[i]))
+        if (styleResolver.hasSelectorForClass(changedClasses[i]))
             return true;
     }
     return false;
 }
 
-template<typename Checker>
-static bool checkSelectorForClassChange(const SpaceSplitString& oldClasses, const SpaceSplitString& newClasses, const Checker& checker)
+static bool checkSelectorForClassChange(const SpaceSplitString& oldClasses, const SpaceSplitString& newClasses, const StyleResolver& styleResolver)
 {
     unsigned oldSize = oldClasses.size();
     if (!oldSize)
-        return checkSelectorForClassChange(newClasses, checker);
+        return checkSelectorForClassChange(newClasses, styleResolver);
     BitVector remainingClassBits;
     remainingClassBits.ensureSize(oldSize);
     // Class vectors tend to be very short. This is faster than using a hash table.
     unsigned newSize = newClasses.size();
     for (unsigned i = 0; i < newSize; ++i) {
+        bool foundFromBoth = false;
         for (unsigned j = 0; j < oldSize; ++j) {
             if (newClasses[i] == oldClasses[j]) {
                 remainingClassBits.quickSet(j);
-                continue;
+                foundFromBoth = true;
             }
         }
-        if (checker.hasSelectorForClass(newClasses[i]))
+        if (foundFromBoth)
+            continue;
+        if (styleResolver.hasSelectorForClass(newClasses[i]))
             return true;
     }
     for (unsigned i = 0; i < oldSize; ++i) {
         // If the bit is not set the the corresponding class has been removed.
         if (remainingClassBits.quickGet(i))
             continue;
-        if (checker.hasSelectorForClass(oldClasses[i]))
+        if (styleResolver.hasSelectorForClass(oldClasses[i]))
             return true;
     }
     return false;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to