WebCore:
authorddkilzer <ddkilzer@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 1 Jul 2006 02:51:32 +0000 (02:51 +0000)
committerddkilzer <ddkilzer@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 1 Jul 2006 02:51:32 +0000 (02:51 +0000)
        Reviewed by Hyatt.

        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7204
          float inserted in fixed height block via DOM not repainted

        Test: fast/repaint/float-move-during-layout.html

        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::layoutBlockChildren):
        (WebCore::RenderBlock::repaintOverhangingFloats): Renamed repaintFloatingDescendants()
        to this and limited it to repainting overhanging floats. Added a boolean parameter that forces
        all descendant overhanging floats (that don't have their own layer) to paint.
        * rendering/RenderBlock.h:
        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::repaintDuringLayoutIfMoved): Changed to paint all descendant
        floats.
        * rendering/RenderObject.cpp:
        (WebCore::RenderObject::repaintOverhangingFloats):
        * rendering/RenderObject.h:

LayoutTests:

        Reviewed by Hyatt.

        - test for http://bugzilla.opendarwin.org/show_bug.cgi?id=7204
          float inserted in fixed height block via DOM not repainted

        * fast/repaint/float-move-during-layout-expected.checksum: Added.
        * fast/repaint/float-move-during-layout-expected.png: Added.
        * fast/repaint/float-move-during-layout-expected.txt: Added.
        * fast/repaint/float-move-during-layout.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/repaint/float-move-during-layout-expected.checksum [new file with mode: 0644]
LayoutTests/fast/repaint/float-move-during-layout-expected.png [new file with mode: 0644]
LayoutTests/fast/repaint/float-move-during-layout-expected.txt [new file with mode: 0644]
LayoutTests/fast/repaint/float-move-during-layout.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/rendering/RenderBlock.cpp
WebCore/rendering/RenderBlock.h
WebCore/rendering/RenderBox.cpp
WebCore/rendering/RenderObject.cpp
WebCore/rendering/RenderObject.h

index 45b14d1dfc9b7a2e6ae3580d514b87a88fdf3b90..c255946bc3570720fdb00faa87c531312075bcc8 100644 (file)
@@ -1,3 +1,15 @@
+2006-06-30  Mitz Pettel  <opendarwin.org@mitzpettel.com>
+
+        Reviewed by Hyatt.
+
+        - test for http://bugzilla.opendarwin.org/show_bug.cgi?id=7204
+          float inserted in fixed height block via DOM not repainted
+
+        * fast/repaint/float-move-during-layout-expected.checksum: Added.
+        * fast/repaint/float-move-during-layout-expected.png: Added.
+        * fast/repaint/float-move-during-layout-expected.txt: Added.
+        * fast/repaint/float-move-during-layout.html: Added.
+
 2006-06-30  Levi Weintraub  <lweintraub@apple.com>
 
         Reviewed by justin
diff --git a/LayoutTests/fast/repaint/float-move-during-layout-expected.checksum b/LayoutTests/fast/repaint/float-move-during-layout-expected.checksum
new file mode 100644 (file)
index 0000000..c1fa97c
--- /dev/null
@@ -0,0 +1,2 @@
+0fb4a2a4a3128fb2fd4922d7ae8b3872
+\ No newline at end of file
diff --git a/LayoutTests/fast/repaint/float-move-during-layout-expected.png b/LayoutTests/fast/repaint/float-move-during-layout-expected.png
new file mode 100644 (file)
index 0000000..a3dd14d
Binary files /dev/null and b/LayoutTests/fast/repaint/float-move-during-layout-expected.png differ
diff --git a/LayoutTests/fast/repaint/float-move-during-layout-expected.txt b/LayoutTests/fast/repaint/float-move-during-layout-expected.txt
new file mode 100644 (file)
index 0000000..4acf407
--- /dev/null
@@ -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
+      RenderBlock {P} at (0,0) size 784x36
+        RenderText {#text} at (0,0) size 151x18
+          text run at (0,0) width 151: "This is a repaint test for "
+        RenderInline {I} at (0,0) size 780x36
+          RenderInline {A} at (0,0) size 348x18 [color=#0000EE]
+            RenderText {#text} at (151,0) size 348x18
+              text run at (151,0) width 348: "http://bugzilla.opendarwin.org/show_bug.cgi?id=7204"
+          RenderText {#text} at (499,0) size 780x36
+            text run at (499,0) width 4: " "
+            text run at (503,0) width 277: "float inserted in fixed height block via DOM"
+            text run at (0,18) width 84: "not repainted"
+        RenderText {#text} at (84,18) size 4x18
+          text run at (84,18) width 4: "."
+      RenderBlock {P} at (0,52) size 784x18
+        RenderText {#text} at (0,0) size 244x18
+          text run at (0,0) width 244: "There should be a green square below."
+      RenderBlock {HR} at (0,86) size 784x2 [border: (1px inset #000000)]
+      RenderBlock {DIV} at (0,96) size 784x100
+      RenderBlock {DIV} at (0,196) size 784x0
+        RenderBlock (floating) {DIV} at (0,0) size 100x100 [bgcolor=#008000]
diff --git a/LayoutTests/fast/repaint/float-move-during-layout.html b/LayoutTests/fast/repaint/float-move-during-layout.html
new file mode 100644 (file)
index 0000000..a9f89c5
--- /dev/null
@@ -0,0 +1,26 @@
+<HTML>
+       <HEAD>
+               <TITLE></TITLE>
+        <script src="repaint.js" type="text/javascript"></script>
+        <script type="text/javascript">
+           function repaintTest()
+           {
+                document.getElementById('t').style.height = '100px';
+           }
+        </script>
+       </HEAD>
+       <BODY onload="runRepaintTest();">
+          <p>
+              This is a repaint test for <i><a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=7204">http://bugzilla.opendarwin.org/show_bug.cgi?id=7204</a>
+              float inserted in fixed height block via DOM not repainted</i>.
+          </p>
+          <p>
+              There should be a green square below.
+          </p>
+          <hr>
+        <div id="t"></div>
+        <div id="s">
+            <div style="float:left; background: green; width: 100px; height: 100px;"></div>
+        </div>
+       </BODY>
+</HTML>
index 90b851e7eb9e826f7e8aa69076b3ff1ae59e1e15..75268da030158c6a1c22bdc877b1fa319126d0be 100644 (file)
@@ -1,3 +1,25 @@
+2006-06-30  Mitz Pettel  <opendarwin.org@mitzpettel.com>
+
+        Reviewed by Hyatt.
+
+        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7204
+          float inserted in fixed height block via DOM not repainted
+
+        Test: fast/repaint/float-move-during-layout.html
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::layoutBlockChildren):
+        (WebCore::RenderBlock::repaintOverhangingFloats): Renamed repaintFloatingDescendants()
+        to this and limited it to repainting overhanging floats. Added a boolean parameter that forces
+        all descendant overhanging floats (that don't have their own layer) to paint.
+        * rendering/RenderBlock.h:
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::repaintDuringLayoutIfMoved): Changed to paint all descendant
+        floats.
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::repaintOverhangingFloats):
+        * rendering/RenderObject.h:
+
 2006-06-30  Levi Weintraub  <lweintraub@apple.com>
 
         Reviewed by justin
index e7fd59763101cc056c499656eb7e99eafc854abd..4e6baa2795c233bf6b62a5875e095503b25563e5 100644 (file)
@@ -1118,7 +1118,7 @@ void RenderBlock::layoutBlockChildren(bool relayoutChildren)
                 // The child's repaints during layout were done before it reached its final position,
                 // so they were wrong.
                 child->repaint();
-                child->repaintFloatingDescendants();
+                child->repaintOverhangingFloats();
             }
         }
 
@@ -1183,7 +1183,7 @@ void RenderBlock::getAbsoluteRepaintRectIncludingFloats(IntRect& bounds, IntRect
     }
 }
 
-void RenderBlock::repaintFloatingDescendants()
+void RenderBlock::repaintOverhangingFloats(bool paintAllDescendants)
 {
     // Repaint any overhanging floats (if we know we're the one to paint them).
     if (hasOverhangingFloats()) {
@@ -1196,11 +1196,12 @@ void RenderBlock::repaintFloatingDescendants()
         FloatingObject* r;
         DeprecatedPtrListIterator<FloatingObject> it(*m_floatingObjects);
         for ( ; (r = it.current()); ++it) {
-            // Only repaint the object if our noPaint flag isn't set and if it isn't in
-            // its own layer.
-            if (!r->noPaint && !r->node->layer()) {                
+            // Only repaint the object if it is overhanging, is not in its own layer, and
+            // is our responsibility to paint (noPaint isn't set). When paintAllDescendants is true, the latter
+            // condition is replaced with being a descendant of us.
+            if (r->endY > m_height && (paintAllDescendants && r->node->hasAncestor(this) || !r->noPaint) && !r->node->layer()) {                
                 r->node->repaint();
-                r->node->repaintFloatingDescendants();
+                r->node->repaintOverhangingFloats();
             }
         }
     }
index 91053fe25f0affcf366670a84be65c65b6570cde..3f0a9fd9457f45171987812b4c506bf2136abe3d 100644 (file)
@@ -107,7 +107,7 @@ public:
     virtual void removeChild(RenderObject*);
 
     virtual void repaintObjectsBeforeLayout();
-    virtual void repaintFloatingDescendants();
+    virtual void repaintOverhangingFloats(bool paintAllDescendants);
     virtual void getAbsoluteRepaintRectIncludingFloats(IntRect& bounds, IntRect& fullBounds);
 
     virtual void setStyle(RenderStyle*);
index 51362202724b3a6c680271d65219d4b1a48068ff..779781f6a9923682a8822c5f3db5c3a28a64106e 100644 (file)
@@ -933,10 +933,10 @@ void RenderBox::repaintDuringLayoutIfMoved(int oldX, int oldY)
         // since the object may not have gotten a layout.
         m_x = oldX; m_y = oldY;
         repaint();
-        repaintFloatingDescendants();
+        repaintOverhangingFloats(true);
         m_x = newX; m_y = newY;
         repaint();
-        repaintFloatingDescendants();
+        repaintOverhangingFloats(true);
     }
 }
 
index 34d948b9a860903867111d9bad3eda1cc387013e..0aca7f0bfd5806d0102b6c99b822c8895130c8e6 100644 (file)
@@ -1720,7 +1720,7 @@ void RenderObject::repaintDuringLayoutIfMoved(int x, int y)
 {
 }
 
-void RenderObject::repaintFloatingDescendants()
+void RenderObject::repaintOverhangingFloats(bool paintAllDescendants)
 {
 }
 
index 30005bf2f1e0388d9c3b8ffb87375a763bf134fc..69aea1849865507c42f0f15431d7c1b382c0dd38 100644 (file)
@@ -722,7 +722,7 @@ public:
     virtual void repaintDuringLayoutIfMoved(int oldX, int oldY);
 
     // Called to repaint a block's floats.
-    virtual void repaintFloatingDescendants();
+    virtual void repaintOverhangingFloats(bool paintAllDescendants = false);
 
     // Called before layout to repaint all dirty children (with selfNeedsLayout() set).
     virtual void repaintObjectsBeforeLayout();