https://bugs.webkit.org/show_bug.cgi?id=50970
authorhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Dec 2010 23:01:51 +0000 (23:01 +0000)
committerhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Dec 2010 23:01:51 +0000 (23:01 +0000)
Reviewed by Dan Bernstein.

It's arguably a bug, but we don't let inline flow layers paint floating
descendants.  The containing block of the inline flow paints them instead.
However our shouldPaint logic has always been flawed and has turned off propagation
of painting when an inline flow layer is enclosing the float.

Change enclosingSelfPaintingLayer to enclosingFloatPaintingLayer to be more precise
and for now limit it to RenderBoxes.

Added fast/block/float/floatstack.html

WebCore:

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::addOverhangingFloats):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::enclosingFloatPaintingLayer):
* rendering/RenderBox.h:
* rendering/RenderObject.cpp:
* rendering/RenderObject.h:

LayoutTests:

* fast/block/float/floatstack.html: Added.
* platform/mac/fast/block/float/floatstack-expected.checksum: Added.
* platform/mac/fast/block/float/floatstack-expected.png: Added.
* platform/mac/fast/block/float/floatstack-expected.txt: Added.
* platform/mac/fast/repaint/positioned-document-element-expected.checksum:
* platform/mac/fast/repaint/positioned-document-element-expected.png:

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

12 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac/fast/block/float/floatstack-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/float/floatstack-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/float/floatstack-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/repaint/positioned-document-element-expected.checksum
LayoutTests/platform/mac/fast/repaint/positioned-document-element-expected.png
WebCore/ChangeLog
WebCore/rendering/RenderBlock.cpp
WebCore/rendering/RenderBox.cpp
WebCore/rendering/RenderBox.h
WebCore/rendering/RenderObject.cpp
WebCore/rendering/RenderObject.h

index f7deb93..16ee217 100644 (file)
@@ -1,3 +1,26 @@
+2010-12-14  David Hyatt  <hyatt@apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        https://bugs.webkit.org/show_bug.cgi?id=50970
+        
+        It's arguably a bug, but we don't let inline flow layers paint floating
+        descendants.  The containing block of the inline flow paints them instead.
+        However our shouldPaint logic has always been flawed and has turned off propagation
+        of painting when an inline flow layer is enclosing the float.
+        
+        Change enclosingSelfPaintingLayer to enclosingFloatPaintingLayer to be more precise
+        and for now limit it to RenderBoxes. 
+        
+        Added fast/block/float/floatstack.html
+
+        * fast/block/float/floatstack.html: Added.
+        * platform/mac/fast/block/float/floatstack-expected.checksum: Added.
+        * platform/mac/fast/block/float/floatstack-expected.png: Added.
+        * platform/mac/fast/block/float/floatstack-expected.txt: Added.
+        * platform/mac/fast/repaint/positioned-document-element-expected.checksum:
+        * platform/mac/fast/repaint/positioned-document-element-expected.png:
+
 2010-12-14  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r74040.
diff --git a/LayoutTests/platform/mac/fast/block/float/floatstack-expected.checksum b/LayoutTests/platform/mac/fast/block/float/floatstack-expected.checksum
new file mode 100644 (file)
index 0000000..e2a5d2f
--- /dev/null
@@ -0,0 +1 @@
+4be38c2144444ed9e2169a79a8faa64b
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/block/float/floatstack-expected.png b/LayoutTests/platform/mac/fast/block/float/floatstack-expected.png
new file mode 100644 (file)
index 0000000..d4a8f40
Binary files /dev/null and b/LayoutTests/platform/mac/fast/block/float/floatstack-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/block/float/floatstack-expected.txt b/LayoutTests/platform/mac/fast/block/float/floatstack-expected.txt
new file mode 100644 (file)
index 0000000..2b2d7d9
--- /dev/null
@@ -0,0 +1,14 @@
+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
+      RenderBlock {DIV} at (0,0) size 300x300 [bgcolor=#EEEEEE]
+        RenderText {#text} at (0,0) size 0x0
+        RenderBlock (floating) {DIV} at (50,0) size 100x100 [bgcolor=#00FF00]
+        RenderText {#text} at (0,0) size 0x0
+layer at (18,18) size 29x18
+  RenderInline (relative positioned) {SPAN} at (0,0) size 29x18 [bgcolor=#FFFF00]
+    RenderBlock (floating) {DIV} at (0,0) size 100x100 [bgcolor=#0000FF]
+    RenderText {#text} at (150,0) size 29x18
+      text run at (150,0) width 29: "Text"
index 25dcc16..7130fb7 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/repaint/positioned-document-element-expected.png and b/LayoutTests/platform/mac/fast/repaint/positioned-document-element-expected.png differ
index 30907d0..ef3848d 100644 (file)
@@ -1,3 +1,27 @@
+2010-12-14  David Hyatt  <hyatt@apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        https://bugs.webkit.org/show_bug.cgi?id=50970
+        
+        It's arguably a bug, but we don't let inline flow layers paint floating
+        descendants.  The containing block of the inline flow paints them instead.
+        However our shouldPaint logic has always been flawed and has turned off propagation
+        of painting when an inline flow layer is enclosing the float.
+        
+        Change enclosingSelfPaintingLayer to enclosingFloatPaintingLayer to be more precise
+        and for now limit it to RenderBoxes. 
+        
+        Added fast/block/float/floatstack.html
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::addOverhangingFloats):
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::enclosingFloatPaintingLayer):
+        * rendering/RenderBox.h:
+        * rendering/RenderObject.cpp:
+        * rendering/RenderObject.h:
+
 2010-12-14  Mihai Parparita  <mihaip@chromium.org>
 
         Reviewed by Dimitri Glazkov.
index 78a92a8..cdfdf73 100644 (file)
@@ -3566,7 +3566,7 @@ int RenderBlock::addOverhangingFloats(RenderBlock* child, int logicalLeftOffset,
                 // behaves properly).  We always want to propagate the desire to paint the float as
                 // far out as we can, to the outermost block that overlaps the float, stopping only
                 // if we hit a self-painting layer boundary.
-                if (r->m_renderer->enclosingSelfPaintingLayer() == enclosingSelfPaintingLayer())
+                if (r->m_renderer->enclosingFloatPaintingLayer() == enclosingFloatPaintingLayer())
                     r->m_shouldPaint = false;
                 else
                     floatingObj->m_shouldPaint = false;
@@ -3582,7 +3582,7 @@ int RenderBlock::addOverhangingFloats(RenderBlock* child, int logicalLeftOffset,
             }
         } else {
             if (makeChildPaintOtherFloats && !r->m_shouldPaint && !r->m_renderer->hasSelfPaintingLayer() &&
-                r->m_renderer->isDescendantOf(child) && r->m_renderer->enclosingLayer() == child->enclosingLayer()) {
+                r->m_renderer->isDescendantOf(child) && r->m_renderer->enclosingFloatPaintingLayer() == child->enclosingFloatPaintingLayer()) {
                 // The float is not overhanging from this block, so if it is a descendant of the child, the child should
                 // paint it (the other case is that it is intruding into the child), unless it has its own layer or enclosing
                 // layer.
index 0f3926b..e4417a9 100644 (file)
@@ -3178,6 +3178,19 @@ int RenderBox::baselinePosition(FontBaseline baselineType, bool /*firstLine*/, L
     return 0;
 }
 
+
+RenderLayer* RenderBox::enclosingFloatPaintingLayer() const
+{
+    const RenderObject* curr = this;
+    while (curr) {
+        RenderLayer* layer = curr->hasLayer() && curr->isBox() ? toRenderBoxModelObject(curr)->layer() : 0;
+        if (layer && layer->isSelfPaintingLayer())
+            return layer;
+        curr = curr->parent();
+    }
+    return 0;
+}
+
 IntRect RenderBox::logicalVisualOverflowRectForPropagation(RenderStyle* parentStyle) const
 {
     IntRect rect = visualOverflowRectForPropagation(parentStyle);
index d68d174..67ac103 100644 (file)
@@ -357,6 +357,8 @@ public:
 
     void removeFloatingOrPositionedChildFromBlockLists();
     
+    RenderLayer* enclosingFloatPaintingLayer() const;
+    
     virtual int firstLineBoxBaseline() const { return -1; }
     virtual int lastLineBoxBaseline() const { return -1; }
 
index caff3bd..8802fb8 100644 (file)
@@ -538,18 +538,6 @@ RenderLayer* RenderObject::enclosingLayer() const
     return 0;
 }
 
-RenderLayer* RenderObject::enclosingSelfPaintingLayer() const
-{
-    const RenderObject* curr = this;
-    while (curr) {
-        RenderLayer* layer = curr->hasLayer() ? toRenderBoxModelObject(curr)->layer() : 0;
-        if (layer && layer->isSelfPaintingLayer())
-            return layer;
-        curr = curr->parent();
-    }
-    return 0;
-}
-
 RenderBox* RenderObject::enclosingBox() const
 {
     RenderObject* curr = const_cast<RenderObject*>(this);
index 5c68a6d..d254986 100644 (file)
@@ -159,7 +159,6 @@ public:
     // properly added and removed.  Since containership can be implemented by any subclass, and since a hierarchy
     // can contain a mixture of boxes and other object types, these functions need to be in the base class.
     RenderLayer* enclosingLayer() const;
-    RenderLayer* enclosingSelfPaintingLayer() const;
     void addLayers(RenderLayer* parentLayer, RenderObject* newObject);
     void removeLayers(RenderLayer* parentLayer);
     void moveLayers(RenderLayer* oldParent, RenderLayer* newParent);