Fix for 3712133, crash from first-line pseudo-style use.
authorhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Jul 2004 23:24:25 +0000 (23:24 +0000)
committerhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Jul 2004 23:24:25 +0000 (23:24 +0000)
        Reviewed by kocienda

        * khtml/css/cssstyleselector.cpp:
        (khtml::CSSStyleSelector::styleForElement):
        * khtml/css/cssstyleselector.h:
        * khtml/rendering/render_object.cpp:
        (RenderObject::getPseudoStyle):

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

WebCore/ChangeLog-2005-08-23
WebCore/khtml/css/cssstyleselector.cpp
WebCore/khtml/css/cssstyleselector.h
WebCore/khtml/rendering/render_object.cpp

index b6c234d..c2d7e66 100644 (file)
@@ -1,3 +1,15 @@
+2004-07-07  David Hyatt  <hyatt@apple.com>
+
+       Fix for 3712133, crash from first-line pseudo-style use.
+       
+        Reviewed by kocienda
+
+        * khtml/css/cssstyleselector.cpp:
+        (khtml::CSSStyleSelector::styleForElement):
+        * khtml/css/cssstyleselector.h:
+        * khtml/rendering/render_object.cpp:
+        (RenderObject::getPseudoStyle):
+
 2004-07-07  Ken Kocienda  <kocienda@apple.com>
 
         Reviewed by Hyatt
index 27acaff..7e23f12 100644 (file)
@@ -630,7 +630,7 @@ RenderStyle* CSSStyleSelector::locateSharedStyle()
     return 0;
 }
 
-RenderStyle* CSSStyleSelector::styleForElement(ElementImpl* e, RenderStyle* defaultParent)
+RenderStyle* CSSStyleSelector::styleForElement(ElementImpl* e, RenderStyle* defaultParent, bool allowSharing)
 {
     if (!e->getDocument()->haveStylesheetsLoaded()) {
         if (!styleNotYetAvailable) {
@@ -642,9 +642,11 @@ RenderStyle* CSSStyleSelector::styleForElement(ElementImpl* e, RenderStyle* defa
     }
     
     initElementAndPseudoState(e);
-    style = locateSharedStyle();
-    if (style)
-        return style;
+    if (allowSharing) {
+        style = locateSharedStyle();
+        if (style)
+            return style;
+    }
     initForStyleResolve(e, defaultParent);
 
     style = new (e->getDocument()->renderArena()) RenderStyle();
index 50c24db..6145c26 100644 (file)
@@ -106,7 +106,7 @@ namespace khtml
 
         void initElementAndPseudoState(DOM::ElementImpl* e);
         void initForStyleResolve(DOM::ElementImpl* e, RenderStyle* parentStyle);
-       RenderStyle *styleForElement(DOM::ElementImpl* e, RenderStyle* parentStyle=0);
+       RenderStyle *styleForElement(DOM::ElementImpl* e, RenderStyle* parentStyle=0, bool allowSharing=true);
         RenderStyle* pseudoStyleForElement(RenderStyle::PseudoId pseudoStyle, 
                                            DOM::ElementImpl* e, RenderStyle* parentStyle=0);
 
index 39455e6..1b99f92 100644 (file)
@@ -2095,7 +2095,7 @@ RenderStyle* RenderObject::getPseudoStyle(RenderStyle::PseudoId pseudo, RenderSt
     
     if (pseudo == RenderStyle::FIRST_LINE_INHERITED)
         result = document()->styleSelector()->styleForElement(static_cast<DOM::ElementImpl*>(node), 
-                                                              parentStyle);
+                                                              parentStyle, false);
     else
         result = document()->styleSelector()->pseudoStyleForElement(pseudo, static_cast<DOM::ElementImpl*>(node), 
                                                                     parentStyle);