Reviewed by Hyatt.
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 May 2006 06:56:13 +0000 (06:56 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 May 2006 06:56:13 +0000 (06:56 +0000)
        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8760
          crash (hang?) on subtlegradient.com article page

        * manual-tests/first-line-style-crash.html: Added.

        * css/cssstyleselector.cpp:
        (WebCore::CSSStyleSelector::createStyleForElement): Changed to not return the
        shared styleNotYetAvailable if allowSharing is off.
        * rendering/RenderObject.cpp:
        (WebCore::RenderObject::getPseudoStyle): In the FIRST_LINE_INHERITED case,
        set the styleType on the style returned from createStyleForElement().
        * rendering/render_style.h:
        (WebCore::RenderStyle::setStyleType): Added. Called from RenderObject::getPseudoStyle().

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

WebCore/ChangeLog
WebCore/css/cssstyleselector.cpp
WebCore/manual-tests/first-line-style-crash.html [new file with mode: 0644]
WebCore/rendering/RenderObject.cpp
WebCore/rendering/render_style.h

index e33b3cc15d6a9902335699864f831b08a284b930..f34ff45f6f41cc7b125479a8ad7d7927fdbcaefb 100644 (file)
@@ -1,3 +1,21 @@
+2006-05-09  Mitz Pettel  <opendarwin.org@mitzpettel.com>
+
+        Reviewed by Hyatt.
+
+        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8760
+          crash (hang?) on subtlegradient.com article page
+
+        * manual-tests/first-line-style-crash.html: Added.
+
+        * css/cssstyleselector.cpp:
+        (WebCore::CSSStyleSelector::createStyleForElement): Changed to not return the
+        shared styleNotYetAvailable if allowSharing is off.
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::getPseudoStyle): In the FIRST_LINE_INHERITED case,
+        set the styleType on the style returned from createStyleForElement().
+        * rendering/render_style.h:
+        (WebCore::RenderStyle::setStyleType): Added. Called from RenderObject::getPseudoStyle().
+
 2006-05-09  Mitz Pettel  <opendarwin.org@mitzpettel.com>
 
         Reviewed by Hyatt.
index 96ebf0c5d4003389e4ac2a603c6ef3c50e99bd10..c22f6ca103ad8ac23f95a3a6e3b9015c4108373e 100644 (file)
@@ -686,7 +686,7 @@ RenderStyle* CSSStyleSelector::locateSharedStyle()
 
 RenderStyle* CSSStyleSelector::styleForElement(Element* e, RenderStyle* defaultParent, bool allowSharing)
 {
-    if (!e->document()->haveStylesheetsLoaded()) {
+    if (allowSharing && !e->document()->haveStylesheetsLoaded()) {
         if (!styleNotYetAvailable) {
             styleNotYetAvailable = ::new RenderStyle();
             styleNotYetAvailable->setDisplay(NONE);
diff --git a/WebCore/manual-tests/first-line-style-crash.html b/WebCore/manual-tests/first-line-style-crash.html
new file mode 100644 (file)
index 0000000..4c5fd3c
--- /dev/null
@@ -0,0 +1,23 @@
+<html>
+<head>
+<link rel="stylesheet" type="text/css" href="resources/aFileThatProbablyDoesNotExist.css">
+<style type="text/css">
+    div:first-line { color: green; }
+</style>
+</head>
+<body>
+    <p>
+        Regression test for <i><a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=8760">http://bugzilla.opendarwin.org/show_bug.cgi?id=8760</a>
+        crash (hang?) on subtlegradient.com article page</i>.
+    </p>
+    <p>
+        No crash means test PASS.
+    </p>
+    <hr>
+    <div>
+        <span id="t">Lorem ipsum</span>
+    </div>
+    <script type="text/javascript">
+        document.getElementById("t").offsetTop;
+    </script>
+</body>
index da70464f269dc0ca73af1042702dfe0522e07599..4ba10ca239b661d15502760ada9ee70f724848de 100644 (file)
@@ -2361,9 +2361,10 @@ RenderStyle* RenderObject::getPseudoStyle(RenderStyle::PseudoId pseudo, RenderSt
     if (!node)
         return 0;
     
-    if (pseudo == RenderStyle::FIRST_LINE_INHERITED)
+    if (pseudo == RenderStyle::FIRST_LINE_INHERITED) {
         result = document()->styleSelector()->styleForElement(static_cast<Element*>(node), parentStyle, false);
-    else
+        result->setStyleType(RenderStyle::FIRST_LINE_INHERITED);
+    } else
         result = document()->styleSelector()->pseudoStyleForElement(pseudo, static_cast<Element*>(node), parentStyle);
     if (result) {
         style()->addPseudoStyle(result);
index 6e775eee2499bde00566ccbc53035c07b6de67bd..4082ad875c8de7f18d52e94262f6febeaf386247 100644 (file)
@@ -1086,6 +1086,7 @@ public:
     void inheritFrom(const RenderStyle* inheritParent);
 
     PseudoId styleType() { return  static_cast<PseudoId>(noninherited_flags._styleType); }
+    void setStyleType(PseudoId styleType) { noninherited_flags._styleType = styleType; }
 
     RenderStyle* getPseudoStyle(PseudoId pi);
     void addPseudoStyle(RenderStyle* pseudo);