Title: [120477] trunk
Revision
120477
Author
[email protected]
Date
2012-06-15 10:57:57 -0700 (Fri, 15 Jun 2012)

Log Message

Cleanup empty anonymous block continuation.
https://bugs.webkit.org/show_bug.cgi?id=74976

Reviewed by Julien Chaffraix.

Source/WebCore: 

Fix rendering on http://docs.google.com/demo.

Test: fast/inline/inline-empty-block-continuation-remove.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::removeChild): If we are removing our last child,
and are an anonymous block which is part of a continuation chain, then
we need to first fix our continuation chain by setting our previous
continuation renderer to point to the next continuation renderer. Then,
we reset our continuation pointer and destroy ourselves. Since we no
longer are part of continuation chain, we will be removed and previous
and next anonymous block will be merged automatically.
* rendering/RenderObject.cpp:
(WebCore::RenderObject::previousInPreOrder): add an argument to previousInOrder
- stayWithin.
(WebCore):
* rendering/RenderObject.h:
(RenderObject):

LayoutTests: 

* fast/inline/inline-empty-block-continuation-remove-expected.html: Added.
* fast/inline/inline-empty-block-continuation-remove.html: Added.
and a bunch of rebaselines in existing tests.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (120476 => 120477)


--- trunk/LayoutTests/ChangeLog	2012-06-15 17:47:18 UTC (rev 120476)
+++ trunk/LayoutTests/ChangeLog	2012-06-15 17:57:57 UTC (rev 120477)
@@ -1,3 +1,14 @@
+2012-06-15  Abhishek Arya  <[email protected]>
+
+        Cleanup empty anonymous block continuation.
+        https://bugs.webkit.org/show_bug.cgi?id=74976
+
+        Reviewed by Julien Chaffraix.
+
+        * fast/inline/inline-empty-block-continuation-remove-expected.html: Added.
+        * fast/inline/inline-empty-block-continuation-remove.html: Added.
+        and a bunch of rebaselines in existing tests.
+
 2012-06-15  Zan Dobersek  <[email protected]>
 
         Clean up the flaky tests section in Gtk's TestExpectations file. Remove

Added: trunk/LayoutTests/fast/inline/inline-empty-block-continuation-remove-expected.html (0 => 120477)


--- trunk/LayoutTests/fast/inline/inline-empty-block-continuation-remove-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/inline-empty-block-continuation-remove-expected.html	2012-06-15 17:57:57 UTC (rev 120477)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<body>
+WebKit Bug 88022 - Cleanup empty anonymous block continuation.<br />
+Test passes if you see orange and purple text should be on the same line.
+<a id="target"><b style="color: orange">ONE</b><b id="two" style="color: purple">TWO</b></a>
+</body>
+</html>
+
Property changes on: trunk/LayoutTests/fast/inline/inline-empty-block-continuation-remove-expected.html
___________________________________________________________________

Added: svn:executable

Added: trunk/LayoutTests/fast/inline/inline-empty-block-continuation-remove.html (0 => 120477)


--- trunk/LayoutTests/fast/inline/inline-empty-block-continuation-remove.html	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/inline-empty-block-continuation-remove.html	2012-06-15 17:57:57 UTC (rev 120477)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<body>
+WebKit Bug 88022 - Cleanup empty anonymous block continuation.<br />
+Test passes if you see orange and purple text should be on the same line.
+<a id="target"><b style="color: orange">ONE</b><b id="two" style="color: purple">TWO</b></a>
+<script>
+target = document.getElementById("target");
+two = document.getElementById("two");
+
+target.offsetTop; // force a layout
+two.style.display = "block";
+target.offsetTop; // force a layout
+two.style.display = "inline";
+</script>
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/inline/inline-empty-block-continuation-remove.html
___________________________________________________________________

Added: svn:executable

Modified: trunk/LayoutTests/platform/mac/editing/deleting/delete-3800834-fix-expected.txt (120476 => 120477)


--- trunk/LayoutTests/platform/mac/editing/deleting/delete-3800834-fix-expected.txt	2012-06-15 17:47:18 UTC (rev 120476)
+++ trunk/LayoutTests/platform/mac/editing/deleting/delete-3800834-fix-expected.txt	2012-06-15 17:57:57 UTC (rev 120477)
@@ -31,11 +31,8 @@
   RenderBlock {HTML} at (0,0) size 800x600
     RenderBody {BODY} at (8,8) size 784x584
       RenderBlock {DIV} at (0,0) size 784x56 [border: (2px solid #FF0000)]
-        RenderBlock (anonymous) at (14,14) size 756x28
-          RenderInline {SPAN} at (0,0) size 37x28
-            RenderText {#text} at (0,0) size 37x28
-              text run at (0,0) width 37: "Foo"
-        RenderBlock (anonymous) at (14,42) size 756x0
-        RenderBlock (anonymous) at (14,42) size 756x0
-          RenderInline {SPAN} at (0,0) size 0x0
+        RenderInline {SPAN} at (0,0) size 37x28
+          RenderText {#text} at (14,14) size 37x28
+            text run at (14,14) width 37: "Foo"
+        RenderInline {SPAN} at (0,0) size 0x28
 caret: position 3 of child 0 {#text} of child 1 {SPAN} of child 1 {DIV} of body

Modified: trunk/LayoutTests/platform/mac/fast/dynamic/011-expected.txt (120476 => 120477)


--- trunk/LayoutTests/platform/mac/fast/dynamic/011-expected.txt	2012-06-15 17:47:18 UTC (rev 120476)
+++ trunk/LayoutTests/platform/mac/fast/dynamic/011-expected.txt	2012-06-15 17:57:57 UTC (rev 120477)
@@ -3,10 +3,8 @@
 layer at (0,0) size 800x600
   RenderBlock {HTML} at (0,0) size 800x600
     RenderBody {BODY} at (8,8) size 784x584
-      RenderBlock (anonymous) at (0,0) size 784x0
-        RenderInline {SPAN} at (0,0) size 0x0
-      RenderBlock (anonymous) at (0,0) size 784x0
       RenderBlock (anonymous) at (0,0) size 784x36
+        RenderInline {SPAN} at (0,0) size 0x0
         RenderInline {SPAN} at (0,0) size 781x36
           RenderInline {SPAN} at (0,0) size 781x36
             RenderText {#text} at (0,0) size 781x36

Modified: trunk/LayoutTests/platform/mac/fast/forms/formmove3-expected.txt (120476 => 120477)


--- trunk/LayoutTests/platform/mac/fast/forms/formmove3-expected.txt	2012-06-15 17:47:18 UTC (rev 120476)
+++ trunk/LayoutTests/platform/mac/fast/forms/formmove3-expected.txt	2012-06-15 17:57:57 UTC (rev 120477)
@@ -6,8 +6,6 @@
       RenderBlock (anonymous) at (0,0) size 784x0
         RenderInline {A} at (0,0) size 0x0
           RenderText {#text} at (0,0) size 0x0
-      RenderBlock (anonymous) at (0,0) size 784x0
-      RenderBlock (anonymous) at (0,0) size 784x0
         RenderInline {A} at (0,0) size 0x0
       RenderBlock {DIV} at (0,0) size 784x28
         RenderBlock (anonymous) at (0,0) size 784x0

Modified: trunk/LayoutTests/platform/mac/fast/forms/preserveFormDuringResidualStyle-expected.txt (120476 => 120477)


--- trunk/LayoutTests/platform/mac/fast/forms/preserveFormDuringResidualStyle-expected.txt	2012-06-15 17:47:18 UTC (rev 120476)
+++ trunk/LayoutTests/platform/mac/fast/forms/preserveFormDuringResidualStyle-expected.txt	2012-06-15 17:57:57 UTC (rev 120477)
@@ -6,8 +6,6 @@
       RenderBlock (anonymous) at (0,0) size 784x0
         RenderInline {FONT} at (0,0) size 0x0
           RenderText {#text} at (0,0) size 0x0
-      RenderBlock (anonymous) at (0,0) size 784x0
-      RenderBlock (anonymous) at (0,0) size 784x0
         RenderInline {FONT} at (0,0) size 0x0
       RenderBlock {CENTER} at (0,0) size 784x25
         RenderBlock (anonymous) at (0,0) size 784x0

Modified: trunk/LayoutTests/platform/mac/fast/invalid/001-expected.txt (120476 => 120477)


--- trunk/LayoutTests/platform/mac/fast/invalid/001-expected.txt	2012-06-15 17:47:18 UTC (rev 120476)
+++ trunk/LayoutTests/platform/mac/fast/invalid/001-expected.txt	2012-06-15 17:57:57 UTC (rev 120477)
@@ -5,8 +5,6 @@
     RenderBody {BODY} at (8,8) size 784x584
       RenderBlock (anonymous) at (0,0) size 784x0
         RenderInline {B} at (0,0) size 0x0
-      RenderBlock (anonymous) at (0,0) size 784x0
-      RenderBlock (anonymous) at (0,0) size 784x0
         RenderInline {B} at (0,0) size 0x0
       RenderBlock {P} at (0,0) size 784x18
         RenderInline {B} at (0,0) size 36x18

Modified: trunk/LayoutTests/platform/mac/fast/invalid/003-expected.txt (120476 => 120477)


--- trunk/LayoutTests/platform/mac/fast/invalid/003-expected.txt	2012-06-15 17:47:18 UTC (rev 120476)
+++ trunk/LayoutTests/platform/mac/fast/invalid/003-expected.txt	2012-06-15 17:57:57 UTC (rev 120477)
@@ -8,11 +8,9 @@
           RenderInline {I} at (0,0) size 89x18
             RenderText {#text} at (0,0) size 89x18
               text run at (0,0) width 89: "Italic and Red"
-      RenderBlock (anonymous) at (0,18) size 784x0 [color=#FF0000]
-      RenderBlock (anonymous) at (0,18) size 784x0
-        RenderInline {FONT} at (0,0) size 0x0 [color=#FF0000]
-          RenderInline {I} at (0,0) size 0x0
-        RenderInline {I} at (0,0) size 0x0
+        RenderInline {FONT} at (0,0) size 0x18 [color=#FF0000]
+          RenderInline {I} at (0,0) size 0x18
+        RenderInline {I} at (0,0) size 0x18
       RenderBlock (anonymous) at (0,34) size 784x18
         RenderBlock {P} at (0,0) size 784x18
           RenderInline {FONT} at (0,0) size 93x18 [color=#FF0000]
@@ -39,8 +37,6 @@
         RenderInline {FONT} at (0,0) size 0x0 [color=#FF0000]
           RenderInline {I} at (0,0) size 0x0
             RenderText {#text} at (0,0) size 0x0
-      RenderBlock (anonymous) at (0,136) size 784x0 [color=#FF0000]
-      RenderBlock (anonymous) at (0,136) size 784x0
         RenderInline {FONT} at (0,0) size 0x0 [color=#FF0000]
           RenderInline {I} at (0,0) size 0x0
       RenderBlock {P} at (0,136) size 784x18

Modified: trunk/LayoutTests/platform/mac/fast/invalid/004-expected.txt (120476 => 120477)


--- trunk/LayoutTests/platform/mac/fast/invalid/004-expected.txt	2012-06-15 17:47:18 UTC (rev 120476)
+++ trunk/LayoutTests/platform/mac/fast/invalid/004-expected.txt	2012-06-15 17:57:57 UTC (rev 120477)
@@ -18,8 +18,6 @@
         RenderInline {FONT} at (0,0) size 0x0
         RenderText {#text} at (0,0) size 0x0
         RenderInline {B} at (0,0) size 0x0
-      RenderBlock (anonymous) at (0,206) size 784x0
-      RenderBlock (anonymous) at (0,206) size 784x0
         RenderInline {B} at (0,0) size 0x0
       RenderBlock {P} at (0,206) size 784x18
         RenderInline {B} at (0,0) size 97x18

Modified: trunk/LayoutTests/platform/mac/fast/invalid/007-expected.txt (120476 => 120477)


--- trunk/LayoutTests/platform/mac/fast/invalid/007-expected.txt	2012-06-15 17:47:18 UTC (rev 120476)
+++ trunk/LayoutTests/platform/mac/fast/invalid/007-expected.txt	2012-06-15 17:57:57 UTC (rev 120477)
@@ -6,8 +6,6 @@
       RenderBlock (anonymous) at (0,0) size 784x0
         RenderInline {LABEL} at (0,0) size 0x0
           RenderInline {A} at (0,0) size 0x0
-      RenderBlock (anonymous) at (0,0) size 784x0
-      RenderBlock (anonymous) at (0,0) size 784x0
         RenderInline {LABEL} at (0,0) size 0x0
           RenderInline {A} at (0,0) size 0x0
       RenderBlock (anonymous) at (0,0) size 784x36

Modified: trunk/LayoutTests/platform/mac/fast/invalid/019-expected.txt (120476 => 120477)


--- trunk/LayoutTests/platform/mac/fast/invalid/019-expected.txt	2012-06-15 17:47:18 UTC (rev 120476)
+++ trunk/LayoutTests/platform/mac/fast/invalid/019-expected.txt	2012-06-15 17:57:57 UTC (rev 120477)
@@ -6,8 +6,6 @@
       RenderBlock (anonymous) at (0,0) size 784x0
         RenderInline {B} at (0,0) size 0x0
           RenderInline {NOBR} at (0,0) size 0x0
-      RenderBlock (anonymous) at (0,0) size 784x0
-      RenderBlock (anonymous) at (0,0) size 784x0
         RenderInline {B} at (0,0) size 0x0
           RenderInline {NOBR} at (0,0) size 0x0
       RenderBlock {DIV} at (0,0) size 784x64

Modified: trunk/LayoutTests/platform/mac/fast/multicol/span/clone-anonymous-block-non-inline-child-crash-expected.txt (120476 => 120477)


--- trunk/LayoutTests/platform/mac/fast/multicol/span/clone-anonymous-block-non-inline-child-crash-expected.txt	2012-06-15 17:47:18 UTC (rev 120476)
+++ trunk/LayoutTests/platform/mac/fast/multicol/span/clone-anonymous-block-non-inline-child-crash-expected.txt	2012-06-15 17:57:57 UTC (rev 120477)
@@ -9,6 +9,7 @@
       RenderInline {LABEL} at (0,0) size 102x18
         RenderText {#text} at (0,0) size 102x18
           text run at (0,0) width 102: "Some inline text"
+      RenderInline {LABEL} at (0,0) size 0x0
     RenderBlock (anonymous) at (5,23) size 379x285
       RenderBlock {SUMMARY} at (0,0) size 379x285
         RenderBlock (anonymous) at (0,0) size 379x18

Modified: trunk/LayoutTests/platform/mac/tables/mozilla/bugs/bug647-expected.txt (120476 => 120477)


--- trunk/LayoutTests/platform/mac/tables/mozilla/bugs/bug647-expected.txt	2012-06-15 17:47:18 UTC (rev 120476)
+++ trunk/LayoutTests/platform/mac/tables/mozilla/bugs/bug647-expected.txt	2012-06-15 17:57:57 UTC (rev 120477)
@@ -18,8 +18,6 @@
                         RenderBlock (anonymous) at (2,2) size 90x0
                           RenderInline {FONT} at (0,0) size 0x0
                             RenderText {#text} at (0,0) size 0x0
-                        RenderBlock (anonymous) at (2,2) size 90x0
-                        RenderBlock (anonymous) at (2,2) size 90x0
                           RenderInline {FONT} at (0,0) size 0x0
                         RenderBlock {CENTER} at (2,2) size 90x13
                           RenderInline {FONT} at (0,0) size 24x13

Modified: trunk/Source/WebCore/ChangeLog (120476 => 120477)


--- trunk/Source/WebCore/ChangeLog	2012-06-15 17:47:18 UTC (rev 120476)
+++ trunk/Source/WebCore/ChangeLog	2012-06-15 17:57:57 UTC (rev 120477)
@@ -1,3 +1,29 @@
+2012-06-15  Abhishek Arya  <[email protected]>
+
+        Cleanup empty anonymous block continuation.
+        https://bugs.webkit.org/show_bug.cgi?id=74976
+
+        Reviewed by Julien Chaffraix.
+
+        Fix rendering on http://docs.google.com/demo.
+
+        Test: fast/inline/inline-empty-block-continuation-remove.html
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::removeChild): If we are removing our last child,
+        and are an anonymous block which is part of a continuation chain, then
+        we need to first fix our continuation chain by setting our previous
+        continuation renderer to point to the next continuation renderer. Then,
+        we reset our continuation pointer and destroy ourselves. Since we no
+        longer are part of continuation chain, we will be removed and previous
+        and next anonymous block will be merged automatically.
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::previousInPreOrder): add an argument to previousInOrder
+        - stayWithin.
+        (WebCore):
+        * rendering/RenderObject.h:
+        (RenderObject):
+
 2012-06-15  Taiju Tsuiki  <[email protected]>
 
         Web Inspector: Move FileSystem frame management from frontend to backend

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (120476 => 120477)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2012-06-15 17:47:18 UTC (rev 120476)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2012-06-15 17:57:57 UTC (rev 120477)
@@ -1233,6 +1233,29 @@
         // If this was our last child be sure to clear out our line boxes.
         if (childrenInline())
             deleteLineBoxTree();
+
+        // If we are an empty anonymous block in the continuation chain,
+        // we need to remove ourself and fix the continuation chain.
+        if (!beingDestroyed() && isAnonymousBlockContinuation()) {
+            for (RenderObject* curr = this; curr; curr = curr->previousInPreOrder(parent())) {
+                if (curr->virtualContinuation() != this)
+                    continue;
+
+                // Found our previous continuation. We just need to point it to
+                // |this|'s next continuation.
+                RenderBoxModelObject* nextContinuation = continuation();
+                if (curr->isRenderInline())
+                    toRenderInline(curr)->setContinuation(nextContinuation);
+                else if (curr->isRenderBlock())
+                    toRenderBlock(curr)->setContinuation(nextContinuation);
+                else
+                    ASSERT_NOT_REACHED();
+
+                break;
+            }
+            setContinuation(0);
+            destroy();
+        }
     }
 }
 

Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (120476 => 120477)


--- trunk/Source/WebCore/rendering/RenderObject.cpp	2012-06-15 17:47:18 UTC (rev 120476)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2012-06-15 17:57:57 UTC (rev 120477)
@@ -389,6 +389,14 @@
     return parent();
 }
 
+RenderObject* RenderObject::previousInPreOrder(const RenderObject* stayWithin) const
+{
+    if (this == stayWithin)
+        return 0;
+
+    return previousInPreOrder();
+}
+
 RenderObject* RenderObject::childAt(unsigned index) const
 {
     RenderObject* child = firstChild();

Modified: trunk/Source/WebCore/rendering/RenderObject.h (120476 => 120477)


--- trunk/Source/WebCore/rendering/RenderObject.h	2012-06-15 17:47:18 UTC (rev 120476)
+++ trunk/Source/WebCore/rendering/RenderObject.h	2012-06-15 17:57:57 UTC (rev 120477)
@@ -193,6 +193,7 @@
     RenderObject* nextInPreOrderAfterChildren() const;
     RenderObject* nextInPreOrderAfterChildren(const RenderObject* stayWithin) const;
     RenderObject* previousInPreOrder() const;
+    RenderObject* previousInPreOrder(const RenderObject* stayWithin) const;
     RenderObject* childAt(unsigned) const;
 
     RenderObject* firstLeafChild() const;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to