Reviewed by Hyatt.
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 May 2006 06:42:30 +0000 (06:42 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 May 2006 06:42:30 +0000 (06:42 +0000)
        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8789
          RenderStyle::getPseudoStyle() always returns 0

        No test possible (no functionality change).

        * dom/Node.cpp:
        (WebCore::Node::diff): When checking if :before or :after has changed,
        return NoInherit unless both pseudoStyles are known and equal.
        * rendering/render_style.cpp:
        (WebCore::RenderStyle::getPseudoStyle): Fixed to match the requested
        type against the pseudoStyle's styleType instead of our own.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@14277 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/dom/Node.cpp
WebCore/rendering/render_style.cpp

index e158e5c4cee425828f95486064e6542e7d403ea0..e33b3cc15d6a9902335699864f831b08a284b930 100644 (file)
@@ -1,3 +1,19 @@
+2006-05-09  Mitz Pettel  <opendarwin.org@mitzpettel.com>
+
+        Reviewed by Hyatt.
+
+        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8789
+          RenderStyle::getPseudoStyle() always returns 0
+
+        No test possible (no functionality change).
+
+        * dom/Node.cpp:
+        (WebCore::Node::diff): When checking if :before or :after has changed,
+        return NoInherit unless both pseudoStyles are known and equal.
+        * rendering/render_style.cpp:
+        (WebCore::RenderStyle::getPseudoStyle): Fixed to match the requested
+        type against the pseudoStyle's styleType instead of our own.
+
 2006-05-09  Darin Adler  <darin@apple.com>
 
         - another attempt to fix the Windows build
index a740057d49d48e2d65a193b47fa55d8f27c4e812..1eb64fe40fc31d5efb461ad8e9f1226f96e08502 100644 (file)
@@ -643,10 +643,24 @@ Node::StyleChange Node::diff( WebCore::RenderStyle *s1, WebCore::RenderStyle *s2
     
     // If the pseudoStyles have changed, we want any StyleChange that is not NoChange
     // because setStyle will do the right thing with anything else.
-    if (ch == NoChange && s1->hasPseudoStyle(RenderStyle::BEFORE))
-        ch = diff(s1->getPseudoStyle(RenderStyle::BEFORE), s2->getPseudoStyle(RenderStyle::BEFORE));
-    if (ch == NoChange && s1->hasPseudoStyle(RenderStyle::AFTER))
-        ch = diff(s1->getPseudoStyle(RenderStyle::AFTER), s2->getPseudoStyle(RenderStyle::AFTER));
+    if (ch == NoChange && s1->hasPseudoStyle(RenderStyle::BEFORE)) {
+        RenderStyle* ps2 = s2->getPseudoStyle(RenderStyle::BEFORE);
+        if (!ps2)
+            ch = NoInherit;
+        else {
+            RenderStyle* ps1 = s1->getPseudoStyle(RenderStyle::BEFORE);
+            ch = ps1 && *ps1 == *ps2 ? NoChange : NoInherit;
+        }
+    }
+    if (ch == NoChange && s1->hasPseudoStyle(RenderStyle::AFTER)) {
+        RenderStyle* ps2 = s2->getPseudoStyle(RenderStyle::AFTER);
+        if (!ps2)
+            ch = NoInherit;
+        else {
+            RenderStyle* ps1 = s1->getPseudoStyle(RenderStyle::AFTER);
+            ch = ps2 && *ps1 == *ps2 ? NoChange : NoInherit;
+        }
+    }
     
     return ch;
 }
index 53b7aee2c489fb4a9072a098ec3e1adb7c09271e..f04da636e0ca8335b43b24ec2c9d153010bd72a0 100644 (file)
@@ -661,11 +661,11 @@ void RenderStyle::setHasPseudoStyle(PseudoId pseudo)
 
 RenderStyle* RenderStyle::getPseudoStyle(PseudoId pid)
 {
-    RenderStyle* ps = 0;
-    if (noninherited_flags._styleType == NOPSEUDO)
-        for (ps = pseudoStyle; ps; ps = ps->pseudoStyle)
-            if (ps->styleType() == pid)
-                break;
+    if (!pseudoStyle || styleType() != NOPSEUDO)
+        return 0;
+    RenderStyle* ps = pseudoStyle;
+    while (ps && ps->styleType() != pid)
+        ps = ps->pseudoStyle;
     return ps;
 }