Title: [87351] trunk
Revision
87351
Author
[email protected]
Date
2011-05-25 19:31:38 -0700 (Wed, 25 May 2011)

Log Message

2011-05-24  MORITA Hajime  <[email protected]>

        RenderText with empty text is not created inside ShadowContentElement
        https://bugs.webkit.org/show_bug.cgi?id=61111

        - Added tests that capture the probelem.
        - Updated expectations that were wrong.

        * fast/html/details-replace-summary-child.html: Added.
        * fast/html/details-replace-text.html: Added.
        * platform/gtk/fast/html/details-no-summary4-expected.txt:
        * platform/gtk/fast/html/details-open-_javascript_-expected.txt:
        * platform/gtk/fast/html/details-open4-expected.txt:
        * platform/mac/fast/html/details-add-details-child-2-expected.txt:
        * platform/mac/fast/html/details-no-summary4-expected.txt:
        * platform/mac/fast/html/details-open-_javascript_-expected.txt:
        * platform/mac/fast/html/details-open4-expected.txt:
        * platform/mac/fast/html/details-replace-summary-child-expected.png: Added.
        * platform/mac/fast/html/details-replace-summary-child-expected.txt: Added.
        * platform/mac/fast/html/details-replace-text-expected.png: Added.
        * platform/mac/fast/html/details-replace-text-expected.txt: Added.
        * platform/qt/fast/html/details-no-summary4-expected.txt:
        * platform/qt/fast/html/details-open-_javascript_-expected.txt:
        * platform/qt/fast/html/details-open4-expected.txt:
2011-05-24  MORITA Hajime  <[email protected]>

        Reviewed by Dimitri Glazkov.

        RenderText with empty text is not created inside ShadowContentElement
        https://bugs.webkit.org/show_bug.cgi?id=61111

        - Changed Text::rendererIsNeeded() to be shadow-aware.
        - previousRenderer(), nextRenderer() and parentRenderer() on NodeRenderingContext is now
          safe even if it's used with an attached node, which was originally used only during attach().
          We need this change because these APIs are called inside CharacterData::updateRenderer() callstack.

        Tests: fast/html/details-replace-summary-child.html
               fast/html/details-replace-text.html

        * dom/NodeRenderingContext.cpp:
        (WebCore::NodeRenderingContext::NodeRenderingContext):
        (WebCore::NodeRenderingContext::nextRenderer):
        (WebCore::NodeRenderingContext::previousRenderer):
        (WebCore::NodeRenderingContext::parentRenderer):
        (WebCore::NodeRenderingContext::shouldCreateRenderer):
        * dom/NodeRenderingContext.h:
        (WebCore::NodeRenderingContext::parentNodeForRenderingAndStyle):
        * dom/Text.cpp:
        (WebCore::Text::rendererIsNeeded):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (87350 => 87351)


--- trunk/LayoutTests/ChangeLog	2011-05-26 01:58:06 UTC (rev 87350)
+++ trunk/LayoutTests/ChangeLog	2011-05-26 02:31:38 UTC (rev 87351)
@@ -1,3 +1,28 @@
+2011-05-24  MORITA Hajime  <[email protected]>
+
+        RenderText with empty text is not created inside ShadowContentElement 
+        https://bugs.webkit.org/show_bug.cgi?id=61111
+
+        - Added tests that capture the probelem.
+        - Updated expectations that were wrong.
+
+        * fast/html/details-replace-summary-child.html: Added.
+        * fast/html/details-replace-text.html: Added.
+        * platform/gtk/fast/html/details-no-summary4-expected.txt:
+        * platform/gtk/fast/html/details-open-_javascript_-expected.txt:
+        * platform/gtk/fast/html/details-open4-expected.txt:
+        * platform/mac/fast/html/details-add-details-child-2-expected.txt:
+        * platform/mac/fast/html/details-no-summary4-expected.txt:
+        * platform/mac/fast/html/details-open-_javascript_-expected.txt:
+        * platform/mac/fast/html/details-open4-expected.txt:
+        * platform/mac/fast/html/details-replace-summary-child-expected.png: Added.
+        * platform/mac/fast/html/details-replace-summary-child-expected.txt: Added.
+        * platform/mac/fast/html/details-replace-text-expected.png: Added.
+        * platform/mac/fast/html/details-replace-text-expected.txt: Added.
+        * platform/qt/fast/html/details-no-summary4-expected.txt:
+        * platform/qt/fast/html/details-open-_javascript_-expected.txt:
+        * platform/qt/fast/html/details-open4-expected.txt:
+
 2011-05-25  Adam Klein  <[email protected]>
 
         Unreviewed. Add Win/CRASH expectation for new crashy plugin test,

Added: trunk/LayoutTests/fast/html/details-replace-summary-child.html (0 => 87351)


--- trunk/LayoutTests/fast/html/details-replace-summary-child.html	                        (rev 0)
+++ trunk/LayoutTests/fast/html/details-replace-summary-child.html	2011-05-26 02:31:38 UTC (rev 87351)
@@ -0,0 +1,31 @@
+<html>
+<head>
+<style>
+span { display: inline-block; font-family: monospace; }
+</style>
+<script>
+function test()
+{
+   var s2 = document.getElementById("s2");
+   var s3 = document.createElement("span");
+   s3.innerHTML = "Details3";
+   var parent = s2.parentNode;
+   parent.replaceChild(s3, s2);
+}
+
+function runTest()
+{
+    if (window.layoutTestController)
+        document.getElementById("run").click();
+}
+</script>
+<body _onload_="runTest()">
+<details open>
+  <summary>
+    <span id="s1">Details1</span>
+    <span id="s2">Details2</span>
+  </summary>
+</details>
+<input id="run" type="button" value="click" _onclick_="test()">
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/html/details-replace-summary-child.html
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/fast/html/details-replace-text.html (0 => 87351)


--- trunk/LayoutTests/fast/html/details-replace-text.html	                        (rev 0)
+++ trunk/LayoutTests/fast/html/details-replace-text.html	2011-05-26 02:31:38 UTC (rev 87351)
@@ -0,0 +1,28 @@
+<html>
+<head>
+<style>
+span { display: inline-block; font-family: monospace; }
+</style>
+<script>
+function test()
+{
+   var summary = document.getElementById("s2");
+   var text = summary.previousSibling;
+   text.data = "" ";
+}
+
+function runTest()
+{
+    if (window.layoutTestController)
+        document.getElementById("run").click();
+}
+</script>
+<body _onload_="runTest()">
+<details open>
+  <span id="s1">Details1</span>
+  <summary>Summary</summary>
+  Text<span id="s2">Details2</span>
+</details>
+<input id="run" type="button" value="click" _onclick_="test()">
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/html/details-replace-text.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/LayoutTests/platform/chromium/test_expectations.txt (87350 => 87351)


--- trunk/LayoutTests/platform/chromium/test_expectations.txt	2011-05-26 01:58:06 UTC (rev 87350)
+++ trunk/LayoutTests/platform/chromium/test_expectations.txt	2011-05-26 02:31:38 UTC (rev 87351)
@@ -4115,6 +4115,10 @@
 
 BUGCR83683 : fast/dom/HTMLLinkElement/prerender.html = TEXT
 
+// Needs expectations
+BUGMORRITA : fast/html/details-replace-text.html = FAIL
+BUGMORRITA : fast/html/details-replace-summary-child.html = FAIL
+
 // Regression from webkit r87118
 BUGWK61342 MAC : fast/repaint/fixed-move-after-keyboard-scroll.html = IMAGE+TEXT
 BUGWK61342 MAC : fast/dom/vertical-scrollbar-in-rtl.html = TEXT

Modified: trunk/LayoutTests/platform/gtk/fast/html/details-no-summary4-expected.txt (87350 => 87351)


--- trunk/LayoutTests/platform/gtk/fast/html/details-no-summary4-expected.txt	2011-05-26 01:58:06 UTC (rev 87350)
+++ trunk/LayoutTests/platform/gtk/fast/html/details-no-summary4-expected.txt	2011-05-26 02:31:38 UTC (rev 87351)
@@ -10,6 +10,5 @@
             text run at (16,0) width 44: "Details"
         RenderBlock (anonymous) at (0,19) size 784x29
           RenderTextControl {INPUT} at (2,2) size 194x25 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
-          RenderText {#text} at (0,0) size 0x0
 layer at (13,32) size 188x19
   RenderBlock {DIV} at (3,3) size 188x19

Modified: trunk/LayoutTests/platform/gtk/fast/html/details-open-_javascript_-expected.txt (87350 => 87351)


--- trunk/LayoutTests/platform/gtk/fast/html/details-open-_javascript_-expected.txt	2011-05-26 01:58:06 UTC (rev 87350)
+++ trunk/LayoutTests/platform/gtk/fast/html/details-open-_javascript_-expected.txt	2011-05-26 02:31:38 UTC (rev 87351)
@@ -10,7 +10,6 @@
             text run at (16,0) width 48: "details1"
         RenderBlock (anonymous) at (0,19) size 784x29
           RenderTextControl {INPUT} at (2,2) size 194x25 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
-          RenderText {#text} at (0,0) size 0x0
       RenderDetails {DETAILS} at (0,48) size 784x19
         RenderSummary {SUMMARY} at (0,0) size 784x19
           RenderDetailsMarker {DIV} at (0,5) size 10x10: right

Modified: trunk/LayoutTests/platform/gtk/fast/html/details-open4-expected.txt (87350 => 87351)


--- trunk/LayoutTests/platform/gtk/fast/html/details-open4-expected.txt	2011-05-26 01:58:06 UTC (rev 87350)
+++ trunk/LayoutTests/platform/gtk/fast/html/details-open4-expected.txt	2011-05-26 02:31:38 UTC (rev 87351)
@@ -10,6 +10,5 @@
             text run at (16,0) width 58: "summary"
         RenderBlock (anonymous) at (0,19) size 784x29
           RenderTextControl {INPUT} at (2,2) size 194x25 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
-          RenderText {#text} at (0,0) size 0x0
 layer at (13,32) size 188x19
   RenderBlock {DIV} at (3,3) size 188x19

Modified: trunk/LayoutTests/platform/mac/fast/html/details-add-details-child-2-expected.txt (87350 => 87351)


--- trunk/LayoutTests/platform/mac/fast/html/details-add-details-child-2-expected.txt	2011-05-26 01:58:06 UTC (rev 87350)
+++ trunk/LayoutTests/platform/mac/fast/html/details-add-details-child-2-expected.txt	2011-05-26 02:31:38 UTC (rev 87351)
@@ -13,4 +13,3 @@
             RenderInline {B} at (0,0) size 142x18
               RenderText {#text} at (0,0) size 142x18
                 text run at (0,0) width 142: "should have bold test"
-          RenderText {#text} at (0,0) size 0x0

Modified: trunk/LayoutTests/platform/mac/fast/html/details-no-summary4-expected.txt (87350 => 87351)


--- trunk/LayoutTests/platform/mac/fast/html/details-no-summary4-expected.txt	2011-05-26 01:58:06 UTC (rev 87350)
+++ trunk/LayoutTests/platform/mac/fast/html/details-no-summary4-expected.txt	2011-05-26 02:31:38 UTC (rev 87351)
@@ -10,6 +10,5 @@
             text run at (16,0) width 44: "Details"
         RenderBlock (anonymous) at (0,18) size 784x23
           RenderTextControl {INPUT} at (2,2) size 125x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
-          RenderText {#text} at (0,0) size 0x0
 layer at (13,31) size 119x13
   RenderBlock {DIV} at (3,3) size 119x13

Modified: trunk/LayoutTests/platform/mac/fast/html/details-open-_javascript_-expected.txt (87350 => 87351)


--- trunk/LayoutTests/platform/mac/fast/html/details-open-_javascript_-expected.txt	2011-05-26 01:58:06 UTC (rev 87350)
+++ trunk/LayoutTests/platform/mac/fast/html/details-open-_javascript_-expected.txt	2011-05-26 02:31:38 UTC (rev 87351)
@@ -10,7 +10,6 @@
             text run at (16,0) width 48: "details1"
         RenderBlock (anonymous) at (0,18) size 784x23
           RenderTextControl {INPUT} at (2,2) size 125x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
-          RenderText {#text} at (0,0) size 0x0
       RenderDetails {DETAILS} at (0,41) size 784x18
         RenderSummary {SUMMARY} at (0,0) size 784x18
           RenderDetailsMarker {DIV} at (0,4) size 10x10: right

Modified: trunk/LayoutTests/platform/mac/fast/html/details-open4-expected.txt (87350 => 87351)


--- trunk/LayoutTests/platform/mac/fast/html/details-open4-expected.txt	2011-05-26 01:58:06 UTC (rev 87350)
+++ trunk/LayoutTests/platform/mac/fast/html/details-open4-expected.txt	2011-05-26 02:31:38 UTC (rev 87351)
@@ -10,6 +10,5 @@
             text run at (16,0) width 58: "summary"
         RenderBlock (anonymous) at (0,18) size 784x23
           RenderTextControl {INPUT} at (2,2) size 125x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
-          RenderText {#text} at (0,0) size 0x0
 layer at (13,31) size 119x13
   RenderBlock {DIV} at (3,3) size 119x13

Added: trunk/LayoutTests/platform/mac/fast/html/details-replace-summary-child-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/fast/html/details-replace-summary-child-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/mac/fast/html/details-replace-summary-child-expected.txt (0 => 87351)


--- trunk/LayoutTests/platform/mac/fast/html/details-replace-summary-child-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/html/details-replace-summary-child-expected.txt	2011-05-26 02:31:38 UTC (rev 87351)
@@ -0,0 +1,25 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderDetails {DETAILS} at (0,0) size 784x18
+        RenderSummary {SUMMARY} at (0,0) size 784x18
+          RenderDetailsMarker {DIV} at (0,4) size 10x10: down
+          RenderText {#text} at (16,0) size 4x18
+            text run at (16,0) width 4: " "
+          RenderBlock {SPAN} at (20,2) size 64x15
+            RenderText {#text} at (0,0) size 64x15
+              text run at (0,0) width 64: "Details1"
+          RenderText {#text} at (84,0) size 4x18
+            text run at (84,0) width 4: " "
+          RenderBlock {SPAN} at (88,2) size 64x15
+            RenderText {#text} at (0,0) size 64x15
+              text run at (0,0) width 64: "Details3"
+          RenderText {#text} at (0,0) size 0x0
+      RenderBlock (anonymous) at (0,18) size 784x22
+        RenderButton {INPUT} at (2,2) size 41x18 [bgcolor=#C0C0C0]
+          RenderBlock (anonymous) at (8,2) size 25x13
+            RenderText at (0,0) size 25x13
+              text run at (0,0) width 25: "click"
+        RenderText {#text} at (0,0) size 0x0
Property changes on: trunk/LayoutTests/platform/mac/fast/html/details-replace-summary-child-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/platform/mac/fast/html/details-replace-text-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/fast/html/details-replace-text-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/mac/fast/html/details-replace-text-expected.txt (0 => 87351)


--- trunk/LayoutTests/platform/mac/fast/html/details-replace-text-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/html/details-replace-text-expected.txt	2011-05-26 02:31:38 UTC (rev 87351)
@@ -0,0 +1,25 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderDetails {DETAILS} at (0,0) size 784x36
+        RenderSummary {SUMMARY} at (0,0) size 784x18
+          RenderDetailsMarker {DIV} at (0,4) size 10x10: down
+          RenderText {#text} at (16,0) size 61x18
+            text run at (16,0) width 61: "Summary"
+        RenderBlock (anonymous) at (0,18) size 784x18
+          RenderBlock {SPAN} at (0,2) size 64x15
+            RenderText {#text} at (0,0) size 64x15
+              text run at (0,0) width 64: "Details1"
+          RenderText {#text} at (64,0) size 4x18
+            text run at (64,0) width 4: " "
+          RenderBlock {SPAN} at (68,2) size 64x15
+            RenderText {#text} at (0,0) size 64x15
+              text run at (0,0) width 64: "Details2"
+      RenderBlock (anonymous) at (0,36) size 784x22
+        RenderButton {INPUT} at (2,2) size 41x18 [bgcolor=#C0C0C0]
+          RenderBlock (anonymous) at (8,2) size 25x13
+            RenderText at (0,0) size 25x13
+              text run at (0,0) width 25: "click"
+        RenderText {#text} at (0,0) size 0x0
Property changes on: trunk/LayoutTests/platform/mac/fast/html/details-replace-text-expected.txt
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/LayoutTests/platform/qt/fast/html/details-no-summary4-expected.txt (87350 => 87351)


--- trunk/LayoutTests/platform/qt/fast/html/details-no-summary4-expected.txt	2011-05-26 01:58:06 UTC (rev 87350)
+++ trunk/LayoutTests/platform/qt/fast/html/details-no-summary4-expected.txt	2011-05-26 02:31:38 UTC (rev 87351)
@@ -10,6 +10,5 @@
             text run at (16,0) width 46: "Details"
         RenderBlock (anonymous) at (0,22) size 784x30
           RenderTextControl {INPUT} at (2,2) size 166x26
-          RenderText {#text} at (0,0) size 0x0
 layer at (12,34) size 162x22
   RenderBlock {DIV} at (2,2) size 162x22

Modified: trunk/LayoutTests/platform/qt/fast/html/details-open-_javascript_-expected.txt (87350 => 87351)


--- trunk/LayoutTests/platform/qt/fast/html/details-open-_javascript_-expected.txt	2011-05-26 01:58:06 UTC (rev 87350)
+++ trunk/LayoutTests/platform/qt/fast/html/details-open-_javascript_-expected.txt	2011-05-26 02:31:38 UTC (rev 87351)
@@ -10,7 +10,6 @@
             text run at (16,0) width 51: "details1"
         RenderBlock (anonymous) at (0,22) size 784x30
           RenderTextControl {INPUT} at (2,2) size 166x26
-          RenderText {#text} at (0,0) size 0x0
       RenderDetails {DETAILS} at (0,52) size 784x22
         RenderSummary {SUMMARY} at (0,0) size 784x22
           RenderDetailsMarker {DIV} at (0,6) size 10x10: right

Modified: trunk/LayoutTests/platform/qt/fast/html/details-open4-expected.txt (87350 => 87351)


--- trunk/LayoutTests/platform/qt/fast/html/details-open4-expected.txt	2011-05-26 01:58:06 UTC (rev 87350)
+++ trunk/LayoutTests/platform/qt/fast/html/details-open4-expected.txt	2011-05-26 02:31:38 UTC (rev 87351)
@@ -10,6 +10,5 @@
             text run at (16,0) width 64: "summary"
         RenderBlock (anonymous) at (0,22) size 784x30
           RenderTextControl {INPUT} at (2,2) size 166x26
-          RenderText {#text} at (0,0) size 0x0
 layer at (12,34) size 162x22
   RenderBlock {DIV} at (2,2) size 162x22

Modified: trunk/Source/WebCore/ChangeLog (87350 => 87351)


--- trunk/Source/WebCore/ChangeLog	2011-05-26 01:58:06 UTC (rev 87350)
+++ trunk/Source/WebCore/ChangeLog	2011-05-26 02:31:38 UTC (rev 87351)
@@ -1,3 +1,29 @@
+2011-05-24  MORITA Hajime  <[email protected]>
+
+        Reviewed by Dimitri Glazkov.
+
+        RenderText with empty text is not created inside ShadowContentElement 
+        https://bugs.webkit.org/show_bug.cgi?id=61111        
+
+        - Changed Text::rendererIsNeeded() to be shadow-aware.
+        - previousRenderer(), nextRenderer() and parentRenderer() on NodeRenderingContext is now
+          safe even if it's used with an attached node, which was originally used only during attach().
+          We need this change because these APIs are called inside CharacterData::updateRenderer() callstack.
+        
+        Tests: fast/html/details-replace-summary-child.html
+               fast/html/details-replace-text.html
+
+        * dom/NodeRenderingContext.cpp:
+        (WebCore::NodeRenderingContext::NodeRenderingContext):
+        (WebCore::NodeRenderingContext::nextRenderer):
+        (WebCore::NodeRenderingContext::previousRenderer):
+        (WebCore::NodeRenderingContext::parentRenderer):
+        (WebCore::NodeRenderingContext::shouldCreateRenderer):
+        * dom/NodeRenderingContext.h:
+        (WebCore::NodeRenderingContext::parentNodeForRenderingAndStyle):
+        * dom/Text.cpp:
+        (WebCore::Text::rendererIsNeeded):
+
 2011-05-25  Sailesh Agrawal  <[email protected]>
 
         Reviewed by Tony Chang.

Modified: trunk/Source/WebCore/dom/NodeRenderingContext.cpp (87350 => 87351)


--- trunk/Source/WebCore/dom/NodeRenderingContext.cpp	2011-05-26 01:58:06 UTC (rev 87350)
+++ trunk/Source/WebCore/dom/NodeRenderingContext.cpp	2011-05-26 02:31:38 UTC (rev 87351)
@@ -74,7 +74,7 @@
 }
 
 NodeRenderingContext::NodeRenderingContext(Node* node, RenderStyle* style)
-    : m_location(LocationNotInTree)
+    : m_location(LocationUndetermined)
     , m_phase(AttachStraight)
     , m_node(node)
     , m_parentNodeForRenderingAndStyle(0)
@@ -99,6 +99,13 @@
 
 RenderObject* NodeRenderingContext::nextRenderer() const
 {
+    if (RenderObject* renderer = m_node->renderer()) {
+        ASSERT(m_location == LocationUndetermined);
+        return renderer->nextSibling();
+    }
+
+    ASSERT(m_location != LocationUndetermined);
+
     if (m_phase != AttachContentForwarded)
         return m_node->nextRenderer();
     // Returns 0 here to insert renderer at the end of child list.
@@ -107,9 +114,34 @@
     return 0;
 }
 
+RenderObject* NodeRenderingContext::previousRenderer() const
+{
+    if (RenderObject* renderer = m_node->renderer()) {
+        ASSERT(m_location == LocationUndetermined);
+        return renderer->previousSibling();
+    }
+
+    ASSERT(m_location != LocationUndetermined);
+
+    if (m_phase != AttachContentForwarded)
+        return m_node->previousRenderer();
+    // Returns lastChild() here to insert renderer at the end of child list.
+    // We assume content children are always attached in tree order and
+    // there is no partial render tree creation.
+    if (RenderObject* parent = parentRenderer())
+        return parent->lastChild();
+    return 0;
+}
+
 RenderObject* NodeRenderingContext::parentRenderer() const
 {
-    return m_parentNodeForRenderingAndStyle->renderer();
+    if (RenderObject* renderer = m_node->renderer()) {
+        ASSERT(m_location == LocationUndetermined);
+        return renderer->parent();
+    }
+
+    ASSERT(m_location != LocationUndetermined);
+    return m_parentNodeForRenderingAndStyle ? m_parentNodeForRenderingAndStyle->renderer() : 0;
 }
 
 void NodeRenderingContext::hostChildrenChanged()
@@ -120,6 +152,7 @@
 
 bool NodeRenderingContext::shouldCreateRenderer() const
 {
+    ASSERT(m_location != LocationUndetermined);
     ASSERT(parentNodeForRenderingAndStyle());
 
     if (m_location == LocationNotInTree || m_phase == AttachContentLight)
@@ -197,10 +230,11 @@
 {
     Node* node = m_context.node();
     Document* document = node->document();
-
     if (!document->shouldCreateRenderers())
         return;
 
+    RenderObject* parentRenderer = m_context.parentRenderer();
+    RenderObject* nextRenderer = m_context.nextRenderer();
     RenderObject* newRenderer = createRendererAndStyle();
 
 #if ENABLE(FULLSCREEN_API)
@@ -215,7 +249,7 @@
         return;
 
     // Note: Adding newRenderer instead of renderer(). renderer() may be a child of newRenderer.
-    m_context.parentRenderer()->addChild(newRenderer, m_context.nextRenderer());
+    parentRenderer->addChild(newRenderer, nextRenderer);
 }
 
 }

Modified: trunk/Source/WebCore/dom/NodeRenderingContext.h (87350 => 87351)


--- trunk/Source/WebCore/dom/NodeRenderingContext.h	2011-05-26 01:58:06 UTC (rev 87350)
+++ trunk/Source/WebCore/dom/NodeRenderingContext.h	2011-05-26 02:31:38 UTC (rev 87351)
@@ -48,6 +48,7 @@
     ContainerNode* parentNodeForRenderingAndStyle() const;
     RenderObject* parentRenderer() const;
     RenderObject* nextRenderer() const;
+    RenderObject* previousRenderer() const;
 
     RenderStyle* style() const;
     void setStyle(PassRefPtr<RenderStyle>);
@@ -58,7 +59,9 @@
     void hostChildrenChanged();
 
 private:
+
     enum TreeLocation {
+        LocationUndetermined,
         LocationNotInTree,
         LocationLightChild,
         LocationShadowChild,
@@ -85,6 +88,7 @@
 
 inline ContainerNode* NodeRenderingContext::parentNodeForRenderingAndStyle() const
 {
+    ASSERT(m_location != LocationUndetermined);
     return m_parentNodeForRenderingAndStyle;
 }
 
@@ -93,7 +97,6 @@
     return m_style.get();
 }
 
-
 class NodeRendererFactory {
     WTF_MAKE_NONCOPYABLE(NodeRendererFactory);
     WTF_MAKE_FAST_ALLOCATED;

Modified: trunk/Source/WebCore/dom/Text.cpp (87350 => 87351)


--- trunk/Source/WebCore/dom/Text.cpp	2011-05-26 01:58:06 UTC (rev 87350)
+++ trunk/Source/WebCore/dom/Text.cpp	2011-05-26 02:31:38 UTC (rev 87351)
@@ -199,15 +199,14 @@
     if (!onlyWS)
         return true;
 
-    RenderObject *par = parentNode()->renderer();
-    
+    RenderObject* par = context.parentRenderer();
     if (par->isTable() || par->isTableRow() || par->isTableSection() || par->isTableCol() || par->isFrameSet())
         return false;
     
     if (context.style()->preserveNewline()) // pre/pre-wrap/pre-line always make renderers.
         return true;
     
-    RenderObject *prev = previousRenderer();
+    RenderObject* prev = context.previousRenderer();
     if (prev && prev->isBR()) // <span><br/> <br/></span>
         return false;
         
@@ -219,10 +218,10 @@
         if (par->isRenderBlock() && !par->childrenInline() && (!prev || !prev->isInline()))
             return false;
         
-        RenderObject *first = par->firstChild();
+        RenderObject* first = par->firstChild();
         while (first && first->isFloatingOrPositioned())
             first = first->nextSibling();
-        RenderObject *next = nextRenderer();
+        RenderObject* next = context.nextRenderer();
         if (!first || next == first)
             // Whitespace at the start of a block just goes away.  Don't even
             // make a render object for this text.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to