LayoutTests:
authoradele <adele@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 31 Mar 2006 05:49:47 +0000 (05:49 +0000)
committeradele <adele@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 31 Mar 2006 05:49:47 +0000 (05:49 +0000)
        Reviewed by Darin.

        - Test for http://bugzilla.opendarwin.org/show_bug.cgi?id=8056
          Flexible boxes do not repaint their top, left and children's overflows

        * fast/repaint/flexible-box-overflow-expected.checksum: Added.
        * fast/repaint/flexible-box-overflow-expected.png: Added.
        * fast/repaint/flexible-box-overflow-expected.txt: Added.
        * fast/repaint/flexible-box-overflow-horizontal-expected.checksum: Added.
        * fast/repaint/flexible-box-overflow-horizontal-expected.png: Added.
        * fast/repaint/flexible-box-overflow-horizontal-expected.txt: Added.
        * fast/repaint/flexible-box-overflow-horizontal.html: Added.
        * fast/repaint/flexible-box-overflow.html: Added.

WebCore:

        Tests: fast/repaint/flexible-box-overflow.html fast/repaint/flexible-box-overflow-horizontal.html

        Reviewed by Darin.

        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8056
          Flexible boxes do not repaint their top, left and children's overflows

        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::layoutBlockChildren):
        * rendering/RenderFlexibleBox.cpp:
        (WebCore::FlexBoxIterator::next):
        (WebCore::RenderFlexibleBox::layoutHorizontalBox): Update top overflow when
        determining vertical positions. Update horizontal overflows after horizontal
        positions are determined.
        (WebCore::RenderFlexibleBox::layoutVerticalBox):  Update left overflow when
        determining horizontal positions. Update vertical overflows after vertical
        positions are determined.
        (WebCore::RenderFlexibleBox::allowedChildFlex):

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

12 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/repaint/flexible-box-overflow-expected.checksum [new file with mode: 0644]
LayoutTests/fast/repaint/flexible-box-overflow-expected.png [new file with mode: 0644]
LayoutTests/fast/repaint/flexible-box-overflow-expected.txt [new file with mode: 0644]
LayoutTests/fast/repaint/flexible-box-overflow-horizontal-expected.checksum [new file with mode: 0644]
LayoutTests/fast/repaint/flexible-box-overflow-horizontal-expected.png [new file with mode: 0644]
LayoutTests/fast/repaint/flexible-box-overflow-horizontal-expected.txt [new file with mode: 0644]
LayoutTests/fast/repaint/flexible-box-overflow-horizontal.html [new file with mode: 0644]
LayoutTests/fast/repaint/flexible-box-overflow.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/rendering/RenderBlock.cpp
WebCore/rendering/RenderFlexibleBox.cpp

index fe5484236eca9b5bc2a6e9bb8024232d50d1da35..76271fe2896fa5cb83df20f062984489b62f4d97 100644 (file)
@@ -1,3 +1,19 @@
+2006-03-30  Mitz Pettel  <opendarwin.org@mitzpettel.com>
+
+        Reviewed by Darin.
+
+        - Test for http://bugzilla.opendarwin.org/show_bug.cgi?id=8056
+          Flexible boxes do not repaint their top, left and children's overflows
+
+        * fast/repaint/flexible-box-overflow-expected.checksum: Added.
+        * fast/repaint/flexible-box-overflow-expected.png: Added.
+        * fast/repaint/flexible-box-overflow-expected.txt: Added.
+        * fast/repaint/flexible-box-overflow-horizontal-expected.checksum: Added.
+        * fast/repaint/flexible-box-overflow-horizontal-expected.png: Added.
+        * fast/repaint/flexible-box-overflow-horizontal-expected.txt: Added.
+        * fast/repaint/flexible-box-overflow-horizontal.html: Added.
+        * fast/repaint/flexible-box-overflow.html: Added.
+
 2006-03-30  Mitz Pettel  <opendarwin.org@mitzpettel.com>
 
         Reviewed by Darin.
diff --git a/LayoutTests/fast/repaint/flexible-box-overflow-expected.checksum b/LayoutTests/fast/repaint/flexible-box-overflow-expected.checksum
new file mode 100644 (file)
index 0000000..f4ea7b8
--- /dev/null
@@ -0,0 +1 @@
+255a1105b5dafc72a3d1a8e636dbe816
\ No newline at end of file
diff --git a/LayoutTests/fast/repaint/flexible-box-overflow-expected.png b/LayoutTests/fast/repaint/flexible-box-overflow-expected.png
new file mode 100644 (file)
index 0000000..ee3b26f
Binary files /dev/null and b/LayoutTests/fast/repaint/flexible-box-overflow-expected.png differ
diff --git a/LayoutTests/fast/repaint/flexible-box-overflow-expected.txt b/LayoutTests/fast/repaint/flexible-box-overflow-expected.txt
new file mode 100644 (file)
index 0000000..eebaddf
--- /dev/null
@@ -0,0 +1,42 @@
+layer at (0,0) size 800x600
+  RenderCanvas at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x552
+      RenderBlock {P} at (0,0) size 784x36
+        RenderText {TEXT} at (0,0) size 226x18
+          text run at (0,0) width 226: "This is a test for regressions against "
+        RenderInline {I} at (0,0) size 762x36
+          RenderInline {A} at (0,0) size 348x18 [color=#0000EE]
+            RenderText {TEXT} at (226,0) size 348x18
+              text run at (226,0) width 348: "http://bugzilla.opendarwin.org/show_bug.cgi?id=8056"
+          RenderText {TEXT} at (574,0) size 762x36
+            text run at (574,0) width 4: " "
+            text run at (578,0) width 184: "Flexible boxes do not repaint"
+            text run at (0,18) width 238: "their top, left and children's overflows"
+        RenderText {TEXT} at (238,18) size 4x18
+          text run at (238,18) width 4: "."
+      RenderBlock {HR} at (0,52) size 784x2 [border: (1px inset #000000)]
+      RenderBlock {DIV} at (0,62) size 784x100
+        RenderFlexibleBox {DIV} at (10,10) size 80x80 [bgcolor=#FFFF00]
+          RenderBlock {DIV} at (-10,-10) size 100x100 [border: (1px solid #000000)]
+            RenderText {TEXT} at (1,1) size 177x18
+              text run at (1,1) width 177: "Lorem ipsum dolor sit amet."
+      RenderBlock {DIV} at (0,182) size 784x100
+        RenderFlexibleBox {DIV} at (10,10) size 80x80 [bgcolor=#FFFF00]
+          RenderBlock {DIV} at (-10,-10) size 100x100 [border: (1px solid #000000)]
+      RenderBlock {DIV} at (0,302) size 784x100
+        RenderFlexibleBox {DIV} at (10,10) size 80x80 [bgcolor=#FFFF00]
+          RenderBlock {DIV} at (-10,-10) size 100x100 [border: (1px solid #000000)]
+      RenderBlock {DIV} at (0,422) size 784x100
+        RenderFlexibleBox {DIV} at (10,10) size 80x80 [bgcolor=#FFFF00]
+          RenderBlock {DIV} at (-10,-10) size 100x100 [border: (1px solid #000000)]
+            RenderText {TEXT} at (1,1) size 98x144
+              text run at (1,1) width 84: "Lorem ipsum"
+              text run at (1,19) width 89: "dolor sit amet,"
+              text run at (1,37) width 78: "consectetuer"
+              text run at (1,55) width 91: "adipiscing elit."
+              text run at (1,73) width 98: "Etiam et ipsum."
+              text run at (1,91) width 31: "Nam"
+              text run at (1,109) width 98: "consectetuer mi"
+              text run at (1,127) width 61: "eget velit."
diff --git a/LayoutTests/fast/repaint/flexible-box-overflow-horizontal-expected.checksum b/LayoutTests/fast/repaint/flexible-box-overflow-horizontal-expected.checksum
new file mode 100644 (file)
index 0000000..e01128b
--- /dev/null
@@ -0,0 +1 @@
+968adf852d17bb8694866fb2a2584128
\ No newline at end of file
diff --git a/LayoutTests/fast/repaint/flexible-box-overflow-horizontal-expected.png b/LayoutTests/fast/repaint/flexible-box-overflow-horizontal-expected.png
new file mode 100644 (file)
index 0000000..125bec8
Binary files /dev/null and b/LayoutTests/fast/repaint/flexible-box-overflow-horizontal-expected.png differ
diff --git a/LayoutTests/fast/repaint/flexible-box-overflow-horizontal-expected.txt b/LayoutTests/fast/repaint/flexible-box-overflow-horizontal-expected.txt
new file mode 100644 (file)
index 0000000..eebaddf
--- /dev/null
@@ -0,0 +1,42 @@
+layer at (0,0) size 800x600
+  RenderCanvas at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x552
+      RenderBlock {P} at (0,0) size 784x36
+        RenderText {TEXT} at (0,0) size 226x18
+          text run at (0,0) width 226: "This is a test for regressions against "
+        RenderInline {I} at (0,0) size 762x36
+          RenderInline {A} at (0,0) size 348x18 [color=#0000EE]
+            RenderText {TEXT} at (226,0) size 348x18
+              text run at (226,0) width 348: "http://bugzilla.opendarwin.org/show_bug.cgi?id=8056"
+          RenderText {TEXT} at (574,0) size 762x36
+            text run at (574,0) width 4: " "
+            text run at (578,0) width 184: "Flexible boxes do not repaint"
+            text run at (0,18) width 238: "their top, left and children's overflows"
+        RenderText {TEXT} at (238,18) size 4x18
+          text run at (238,18) width 4: "."
+      RenderBlock {HR} at (0,52) size 784x2 [border: (1px inset #000000)]
+      RenderBlock {DIV} at (0,62) size 784x100
+        RenderFlexibleBox {DIV} at (10,10) size 80x80 [bgcolor=#FFFF00]
+          RenderBlock {DIV} at (-10,-10) size 100x100 [border: (1px solid #000000)]
+            RenderText {TEXT} at (1,1) size 177x18
+              text run at (1,1) width 177: "Lorem ipsum dolor sit amet."
+      RenderBlock {DIV} at (0,182) size 784x100
+        RenderFlexibleBox {DIV} at (10,10) size 80x80 [bgcolor=#FFFF00]
+          RenderBlock {DIV} at (-10,-10) size 100x100 [border: (1px solid #000000)]
+      RenderBlock {DIV} at (0,302) size 784x100
+        RenderFlexibleBox {DIV} at (10,10) size 80x80 [bgcolor=#FFFF00]
+          RenderBlock {DIV} at (-10,-10) size 100x100 [border: (1px solid #000000)]
+      RenderBlock {DIV} at (0,422) size 784x100
+        RenderFlexibleBox {DIV} at (10,10) size 80x80 [bgcolor=#FFFF00]
+          RenderBlock {DIV} at (-10,-10) size 100x100 [border: (1px solid #000000)]
+            RenderText {TEXT} at (1,1) size 98x144
+              text run at (1,1) width 84: "Lorem ipsum"
+              text run at (1,19) width 89: "dolor sit amet,"
+              text run at (1,37) width 78: "consectetuer"
+              text run at (1,55) width 91: "adipiscing elit."
+              text run at (1,73) width 98: "Etiam et ipsum."
+              text run at (1,91) width 31: "Nam"
+              text run at (1,109) width 98: "consectetuer mi"
+              text run at (1,127) width 61: "eget velit."
diff --git a/LayoutTests/fast/repaint/flexible-box-overflow-horizontal.html b/LayoutTests/fast/repaint/flexible-box-overflow-horizontal.html
new file mode 100644 (file)
index 0000000..0bd27f9
--- /dev/null
@@ -0,0 +1,70 @@
+<html>
+<head>
+<script type="text/javascript">
+if (window.layoutTestController) {
+    layoutTestController.testRepaint();
+    layoutTestController.repaintSweepHorizontally();
+}
+</script>
+<style>
+div.flexbox {
+  height: 80px;
+  width: 80px;
+  background-color: yellow;
+  display: -moz-box;
+  display: -khtml-box;
+  display: box;
+  -moz-box-align: center;
+  -khtml-box-align: center;
+  box-align: center;
+}
+
+div.horizontal {
+  -moz-box-orient: horizontal;
+  -khtml-box-orient: horizontal;
+  box-orient: horizontal;
+}
+
+div.vertical {
+  -moz-box-orient: vertical;
+  -khtml-box-orient: vertical;
+  box-orient: vertical;
+}
+
+div.bigbox {
+  height: 98px;
+  width: 98px;
+  border: 1px solid black;
+  margin-left: -10px;
+  margin-top: -10px;
+}
+</style>
+</head>
+<body>
+<p>
+    This is a test for regressions against <i><a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=8056">http://bugzilla.opendarwin.org/show_bug.cgi?id=8056</a>
+    Flexible boxes do not repaint their top, left and children's overflows</i>.
+</p>
+<hr>
+<div style="padding:10px;">
+<div class="flexbox horizontal">
+<div class="bigbox" style="white-space: pre;">Lorem ipsum dolor sit amet.</div>
+</div>
+</div>
+<div style="padding:10px; margin-top: 20px;">
+<div class="flexbox horizontal">
+<div class="bigbox"></div>
+</div>
+</div>
+<div style="padding:10px; margin-top: 20px;">
+<div class="flexbox vertical">
+<div class="bigbox"></div>
+</div>
+</div>
+<div style="padding:10px; margin-top: 20px; margin-bottom: 40px;">
+<div class="flexbox vertical">
+<div class="bigbox">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam et ipsum. Nam consectetuer mi eget velit.</div>
+</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/repaint/flexible-box-overflow.html b/LayoutTests/fast/repaint/flexible-box-overflow.html
new file mode 100644 (file)
index 0000000..e23282b
--- /dev/null
@@ -0,0 +1,68 @@
+<html>
+<head>
+<script type="text/javascript">
+if (window.layoutTestController)
+    layoutTestController.testRepaint();
+</script>
+<style>
+div.flexbox {
+  height: 80px;
+  width: 80px;
+  background-color: yellow;
+  display: -moz-box;
+  display: -khtml-box;
+  display: box;
+  -moz-box-align: center;
+  -khtml-box-align: center;
+  box-align: center;
+}
+
+div.horizontal {
+  -moz-box-orient: horizontal;
+  -khtml-box-orient: horizontal;
+  box-orient: horizontal;
+}
+
+div.vertical {
+  -moz-box-orient: vertical;
+  -khtml-box-orient: vertical;
+  box-orient: vertical;
+}
+
+div.bigbox {
+  height: 98px;
+  width: 98px;
+  border: 1px solid black;
+  margin-left: -10px;
+  margin-top: -10px;
+}
+</style>
+</head>
+<body>
+<p>
+    This is a test for regressions against <i><a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=8056">http://bugzilla.opendarwin.org/show_bug.cgi?id=8056</a>
+    Flexible boxes do not repaint their top, left and children's overflows</i>.
+</p>
+<hr>
+<div style="padding:10px;">
+<div class="flexbox horizontal">
+<div class="bigbox" style="white-space: pre;">Lorem ipsum dolor sit amet.</div>
+</div>
+</div>
+<div style="padding:10px; margin-top: 20px;">
+<div class="flexbox horizontal">
+<div class="bigbox"></div>
+</div>
+</div>
+<div style="padding:10px; margin-top: 20px;">
+<div class="flexbox vertical">
+<div class="bigbox"></div>
+</div>
+</div>
+<div style="padding:10px; margin-top: 20px; margin-bottom: 40px;">
+<div class="flexbox vertical">
+<div class="bigbox">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam et ipsum. Nam consectetuer mi eget velit.</div>
+</div>
+</div>
+</body>
+</html>
index 1178fed861552fba09743b44660f8a0464a2e5ce..a7a0bc92eda26237aa29d699153c792789cdcc88 100644 (file)
@@ -1,3 +1,24 @@
+2006-03-30  Mitz Pettel  <opendarwin.org@mitzpettel.com>
+
+        Tests: fast/repaint/flexible-box-overflow.html fast/repaint/flexible-box-overflow-horizontal.html
+
+        Reviewed by Darin.
+        
+        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8056
+          Flexible boxes do not repaint their top, left and children's overflows
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::layoutBlockChildren):
+        * rendering/RenderFlexibleBox.cpp:
+        (WebCore::FlexBoxIterator::next):
+        (WebCore::RenderFlexibleBox::layoutHorizontalBox): Update top overflow when
+        determining vertical positions. Update horizontal overflows after horizontal
+        positions are determined.
+        (WebCore::RenderFlexibleBox::layoutVerticalBox):  Update left overflow when
+        determining horizontal positions. Update vertical overflows after vertical
+        positions are determined.
+        (WebCore::RenderFlexibleBox::allowedChildFlex):
+
 2006-03-30  Mitz Pettel  <opendarwin.org@mitzpettel.com>
 
         Tests: fast/repaint/text-shadow.html fast/repaint/text-shadow-horizontal.html
index 8a5486b0e3cf4317ed6b5ed336b335e31837c115..e85007c9f3f8374e27d28af61424d3763bc57cfa 100644 (file)
@@ -1102,8 +1102,7 @@ void RenderBlock::layoutBlockChildren(bool relayoutChildren)
         addOverhangingFloats(static_cast<RenderBlock *>(child), -child->xPos(), -child->yPos());
 
         // See if this child has made our overflow need to grow.
-        int rightChildPos = child->xPos() + kMax(child->overflowWidth(false), child->width());
-        m_overflowWidth = kMax(rightChildPos, m_overflowWidth);
+        m_overflowWidth = kMax(child->xPos() + child->overflowWidth(false), m_overflowWidth);
         m_overflowLeft = kMin(child->xPos() + child->overflowLeft(false), m_overflowLeft);
         
         // Insert our compact into the block margin if we have one.
index b3d766a135697202b86f22296015ac89f5d8f54c..ab3564eedc1304d786600dd59568b56d7e27ed8e 100644 (file)
@@ -70,8 +70,7 @@ public:
                     if (currentOrdinal > lastOrdinal)
                         return 0;
                     current = box->firstChild();
-                }
-                else {
+                } else {
                     currentOrdinal--;
                     if (currentOrdinal == 0)
                         return 0;
@@ -490,6 +489,7 @@ void RenderFlexibleBox::layoutHorizontalBox(bool relayoutChildren)
 
             placeChild(child, xPos, childY);
             m_overflowHeight = kMax(m_overflowHeight, childY + child->overflowHeight(false));
+            m_overflowTop = kMin(m_overflowTop, child->yPos() + child->overflowTop(false));
             
             xPos += child->width() + child->marginRight();
     
@@ -575,9 +575,6 @@ void RenderFlexibleBox::layoutHorizontalBox(bool relayoutChildren)
 
     m_flexingChildren = false;
     
-    if (xPos > m_overflowWidth)
-        m_overflowWidth = xPos;
-
     if (remainingSpace > 0 && ((style()->direction() == LTR && style()->boxPack() != BSTART) ||
                                (style()->direction() == RTL && style()->boxPack() != BEND))) {
         // Children must be repositioned.
@@ -621,8 +618,7 @@ void RenderFlexibleBox::layoutHorizontalBox(bool relayoutChildren)
                     child = iterator.next();
                 }
             }
-        }
-        else {
+        } else {
             if (style()->boxPack() == BCENTER)
                 offset += remainingSpace/2;
             else // END for LTR, START for RTL
@@ -639,6 +635,22 @@ void RenderFlexibleBox::layoutHorizontalBox(bool relayoutChildren)
         }
     }
     
+    child = iterator.first();
+    while (child && child->isPositioned()) {
+        child = iterator.next();
+    }
+    
+    if (child) {
+        m_overflowLeft = kMin(child->xPos() + child->overflowLeft(false), m_overflowLeft);
+
+        RenderObject* lastChild = child;
+        while ((child = iterator.next())) {
+            if (!child->isPositioned())
+                lastChild = child;
+        }
+        m_overflowWidth = kMax(lastChild->xPos() + lastChild->overflowWidth(false), m_overflowWidth);
+    }
+    
     // So that the calcHeight in layoutBlock() knows to relayout positioned objects because of
     // a height change, we revert our height back to the intrinsic height before returning.
     if (heightSpecified)
@@ -838,10 +850,8 @@ void RenderFlexibleBox::layoutVerticalBox(bool relayoutChildren)
             m_height += child->height() + child->marginBottom();
     
             // See if this child has made our overflow need to grow.
-            // XXXdwh Work with left overflow as well as right overflow.
-            int rightChildPos = child->xPos() + kMax(child->overflowWidth(false), child->width());
-            if (rightChildPos > m_overflowWidth)
-                m_overflowWidth = rightChildPos;
+            m_overflowWidth = kMax(child->xPos() + child->overflowWidth(false), m_overflowWidth);
+            m_overflowLeft = kMin(child->xPos() + child->overflowLeft(false), m_overflowLeft);
             
             child = iterator.next();
         }
@@ -981,8 +991,7 @@ void RenderFlexibleBox::layoutVerticalBox(bool relayoutChildren)
                     child = iterator.next();
                 }
             }
-        }
-        else {
+        } else {
             if (style()->boxPack() == BCENTER)
                 offset += remainingSpace/2;
             else // END
@@ -999,6 +1008,22 @@ void RenderFlexibleBox::layoutVerticalBox(bool relayoutChildren)
         }
     }
     
+    child = iterator.first();
+    while (child && child->isPositioned()) {
+        child = iterator.next();
+    }
+    
+    if (child) {
+        m_overflowTop = kMin(child->yPos() + child->overflowTop(false), m_overflowTop);
+
+        RenderObject* lastChild = child;
+        while ((child = iterator.next())) {
+            if (!child->isPositioned())
+                lastChild = child;
+        }
+        m_overflowHeight = kMax(lastChild->yPos() + lastChild->overflowHeight(false), m_overflowHeight);
+    }
+
     // So that the calcHeight in layoutBlock() knows to relayout positioned objects because of
     // a height change, we revert our height back to the intrinsic height before returning.
     if (heightSpecified)
@@ -1040,8 +1065,7 @@ int RenderFlexibleBox::allowedChildFlex(RenderObject* child, bool expanding, uns
             if (maxW == INT_MAX)
                 return maxW;
             return kMax(0, maxW - w);
-        }
-        else {
+        } else {
             // FIXME: For now just handle fixed values.
             int maxH = INT_MAX;
             int h = child->overrideHeight() - (child->borderTop() + child->borderBottom() + child->paddingTop() + child->paddingBottom());
@@ -1067,8 +1091,7 @@ int RenderFlexibleBox::allowedChildFlex(RenderObject* child, bool expanding, uns
             
         int allowedShrinkage = kMin(0, minW - w);
         return allowedShrinkage;
-    }
-    else {
+    } else {
         if (child->style()->minHeight().isFixed()) {
             int minH = child->style()->minHeight().value();
             int h = child->contentHeight();