Really bring the new code in line with the old style sharing code.
authorhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Oct 2004 23:27:21 +0000 (23:27 +0000)
committerhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Oct 2004 23:27:21 +0000 (23:27 +0000)
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@7784 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/khtml/css/cssstyleselector.cpp

index 3a27be8c200357b7e7460b55180ce7b40f7e4676..0b2686e0c10c007d021b26dc37446c2d049d598a 100644 (file)
@@ -531,24 +531,24 @@ NodeImpl* CSSStyleSelector::locateCousinList(ElementImpl* parent)
 {
     // FIXME: Investigate the difference between elementsCanShareStyle and a pointer compare of renderstyles.
     if (parent && parent->renderer() && !parent->inlineStyleDecl() && !parent->hasID()) {
-        DOM::NodeImpl* n;
-        for (n = parent->previousSibling(); n && !n->isElementNode(); n = n->previousSibling());
+        DOM::NodeImpl* n = parent->previousSibling();
+        RenderStyle* st = parent->renderer()->style();
         int subcount = 0;
         while (n) {
-            if (n->renderer() && /*elementsCanShareStyle(static_cast<ElementImpl*>(n), parent)) //*/n->renderer()->style() == parent->renderer()->style())
+            if (n->renderer() && n->renderer()->style() == st)
                 return n->lastChild();
             if (subcount++ == siblingThreshold)
                 return 0;
-            n = n->previousSibling(); //for (n = n->previousSibling(); n && !n->isElementNode(); n = n->previousSibling());
+            n = n->previousSibling();
         }
         if (!n && parent->parentNode() && parent->parentNode()->isElementNode())
             n = locateCousinList(static_cast<ElementImpl*>(parent->parentNode()));
         while (n) {
-            if (n->renderer() && /*elementsCanShareStyle(static_cast<ElementImpl*>(n), parent)) //*/n->renderer()->style() == parent->renderer()->style())
+            if (n->renderer() && n->renderer()->style() == st)
                 return n->lastChild();
             if (subcount++ == siblingThreshold)
                 return 0;
-            for (n = n->previousSibling(); n && !n->isElementNode(); n = n->previousSibling());
+            n = n->previousSibling();
         }
     }
     return 0;