2006-03-25 Mitz Pettel <opendarwin.org@mitzpettel.com>
authoreseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 26 Mar 2006 22:58:26 +0000 (22:58 +0000)
committereseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 26 Mar 2006 22:58:26 +0000 (22:58 +0000)
        Reviewed by darin.  Landed by eseidel.

        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7916
          Box repaint rect does not include the left overflow

        * manual-tests/left-overflow-repaint.html: Added.
        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::overflowRect): Changed m_overflowWidth and m_overflowHeight
        to overflowWidth() and overflowHeight() since RenderTable overrides the latter.
        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::getAbsoluteRepaintRect): Include top and left overflows.
        * rendering/RenderFlow.cpp:
        (WebCore::RenderFlow::getAbsoluteRepaintRect): Removed redundant code.
        * rendering/RenderTableCell.cpp: Removed subclass implementation of
        getAbsoluteRepaintRect().
        * rendering/RenderTableCell.h:
        * rendering/bidi.cpp:
        (WebCore::RenderBlock::layoutInlineChildren): Include left overflow in repaint rect.

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

WebCore/ChangeLog
WebCore/dom/Element.cpp
WebCore/manual-tests/left-overflow-repaint.html [new file with mode: 0644]
WebCore/platform/Brush.h
WebCore/rendering/RenderBlock.cpp
WebCore/rendering/RenderBox.cpp
WebCore/rendering/RenderFlow.cpp
WebCore/rendering/RenderTableCell.cpp
WebCore/rendering/RenderTableCell.h
WebCore/rendering/bidi.cpp

index 92bbfef..c81a1b7 100644 (file)
@@ -1,3 +1,24 @@
+2006-03-25  Mitz Pettel  <opendarwin.org@mitzpettel.com>
+
+        Reviewed by darin.  Landed by eseidel.
+
+        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7916
+          Box repaint rect does not include the left overflow
+
+        * manual-tests/left-overflow-repaint.html: Added.
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::overflowRect): Changed m_overflowWidth and m_overflowHeight
+        to overflowWidth() and overflowHeight() since RenderTable overrides the latter.
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::getAbsoluteRepaintRect): Include top and left overflows.
+        * rendering/RenderFlow.cpp:
+        (WebCore::RenderFlow::getAbsoluteRepaintRect): Removed redundant code.
+        * rendering/RenderTableCell.cpp: Removed subclass implementation of
+        getAbsoluteRepaintRect().
+        * rendering/RenderTableCell.h:
+        * rendering/bidi.cpp:
+        (WebCore::RenderBlock::layoutInlineChildren): Include left overflow in repaint rect.
+
 2006-03-25  Eric Seidel  <eseidel@apple.com>
 
         Reviewed by andersca.
index c4e4328..c78f2aa 100644 (file)
 #include "config.h"
 #include "Element.h"
 
-#include "CSSStyleSelector.h"
+#include "cssstyleselector.h"
 #include "Document.h"
 #include "ExceptionCode.h"
-#include "htmlnames.h"
+#include "HTMLNames.h"
 #include "Frame.h"
 #include "htmlnames.h"
 #include "NamedAttrMap.h"
diff --git a/WebCore/manual-tests/left-overflow-repaint.html b/WebCore/manual-tests/left-overflow-repaint.html
new file mode 100644 (file)
index 0000000..b39410f
--- /dev/null
@@ -0,0 +1,61 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+        "http://www.w3.org/TR/html4/strict.dtd">
+<html lang="en">
+<head>
+</head>
+<body>
+<p><b>BUG ID:</b> <a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=7916">Bugzilla bug 7916</a> Box repaint rect does not include the left overflow</p>
+
+<p id="test" style="background-color:skyblue; padding:3px;"><b>STEPS TO TEST:</b> 
+Scroll and resize the window as necessary to bring the three test cases below into view.
+Press each Test button once. Do not scroll, resize, or hide the window or switch to another
+tab.
+</p>
+
+<p id="success" style="background-color:palegreen; padding:3px;"><b>TEST PASS:</b> 
+In each test, &ldquo;Lorem&rdquo; will move down along with &ldquo;ipsum&rdquo;. 
+</p>
+
+<p id="failure" style="background-color:#FF3300; padding:3px;"><b>TEST FAIL:</b>  
+&ldquo;Lorem&rdquo; will stay behind as &ldquo;ipsum&rdquo; moves down.
+</p>
+
+<div style="height: 120px">
+    <p>
+    <button onclick="document.getElementById('t').style.marginTop = '2em'">
+        Test 1
+    </button>
+    Move block with left overflow
+    </p>
+    <div id="t" style="text-indent: -50px; background: silver; margin-left: 50px;">
+        Lorem ipsum
+    </div>
+</div>
+<hr>
+<div style="height: 120px">
+    <p>
+    <button onclick="document.getElementById('u').style.lineHeight = '3'">
+        Test 2
+    </button>
+    </p>
+    Move line with left overflow
+    <div style="text-indent: -50px; background: silver; margin-left: 50px;">
+        Lorem <span id="u">ipsum</span>
+    </div>
+</div>
+<hr>
+<div style="height: 120px">
+    <p>
+    <button onclick="document.getElementById('v').style.height = '3em'">
+        Test 3
+    </button>
+    Change height of table cell with left overflow
+    </p>
+    <table style="margin-left: 50px;"><tr>
+    <td id="v" style="text-indent: -50px; background: silver;">
+        Lorem ipsum
+    </td></tr></table>
+</div>
+
+</body>
+</html>
index aad2c7f..612a9f2 100644 (file)
@@ -37,7 +37,7 @@ public:
         SolidPattern,
     };
 
-    Brush::Brush(const Color &c = Color::black, BrushStyle style = SolidPattern)
+    Brush(const Color &c = Color::black, BrushStyle style = SolidPattern)
         : brushColor(c), brushStyle(style) { }
 
     const Color &color() const { return brushColor; }
index 16c4daf..80b2223 100644 (file)
@@ -363,7 +363,7 @@ IntRect RenderBlock::overflowRect(bool includeInterior) const
         return borderBox();
     int l = overflowLeft(includeInterior);
     int t = kMin(overflowTop(includeInterior), -borderTopExtra());
-    return IntRect(l, t, m_overflowWidth - 2*l, m_overflowHeight + borderTopExtra() + borderBottomExtra() - 2*t);
+    return IntRect(l, t, overflowWidth(includeInterior) - 2*l, overflowHeight(includeInterior) + borderTopExtra() + borderBottomExtra() - 2*t);
 }
 
 bool RenderBlock::isSelfCollapsingBlock() const
index b38c18e..49e7996 100644 (file)
@@ -768,7 +768,7 @@ void RenderBox::setInlineBoxWrapper(InlineBox* b)
 
 IntRect RenderBox::getAbsoluteRepaintRect()
 {
-    IntRect r(0, 0, overflowWidth(false), overflowHeight(false));
+    IntRect r = overflowRect(false);
     if (style()) {
         if (style()->hasAppearance())
             // The theme may wish to inflate the rect used when repainting.
index e1b818a..bcd9498 100644 (file)
@@ -506,19 +506,8 @@ IntRect RenderFlow::getAbsoluteRepaintRect()
         }
         
         return r;
-    }
-    else {
-        if (firstLineBox() && firstLineBox()->topOverflow() < 0) {
-            int ow = style() ? style()->outlineSize() : 0;
-            IntRect r(-ow, -ow+firstLineBox()->topOverflow(),
-                    overflowWidth(false)+ow*2,
-                    overflowHeight(false)+ow*2-firstLineBox()->topOverflow());
-            computeAbsoluteRepaintRect(r);
-            return r;
-        }
-    }
-
-    return RenderContainer::getAbsoluteRepaintRect();
+    } else
+        return RenderContainer::getAbsoluteRepaintRect();
 }
 
 int
index c4a5e29..81b9d11 100644 (file)
@@ -685,15 +685,6 @@ void RenderTableCell::paintCollapsedBorder(GraphicsContext* p, int _tx, int _ty,
     }
 }
 
-IntRect RenderTableCell::getAbsoluteRepaintRect()
-{
-    int ow = style() ? style()->outlineSize() : 0;
-    IntRect r(-ow, -ow - borderTopExtra(), 
-            overflowWidth(false) + ow * 2, overflowHeight(false) + borderTopExtra() + borderBottomExtra() + ow * 2);
-    computeAbsoluteRepaintRect(r);
-    return r;
-}
-
 void RenderTableCell::paintBackgroundsBehindCell(PaintInfo& i, int _tx, int _ty, RenderObject* backgroundObject)
 {
     if (!backgroundObject)
index 36c5b55..abb8744 100644 (file)
@@ -106,8 +106,6 @@ public:
     virtual void dump(QTextStream *stream, DeprecatedString ind = "") const;
 #endif
 
-    virtual IntRect getAbsoluteRepaintRect();
-    
     void paintBackgroundsBehindCell(PaintInfo&, int tx, int ty, RenderObject* backgroundObject);
 
 protected:
index a0ba4fa..4a2c805 100644 (file)
@@ -1713,7 +1713,8 @@ IntRect RenderBlock::layoutInlineChildren(bool relayoutChildren)
     checkLinesForOverflow();
 
     if (useRepaintRect) {
-        repaintRect.setWidth(kMax((int)m_width, m_overflowWidth));
+        repaintRect.setX(m_overflowLeft);
+        repaintRect.setWidth(kMax((int)m_width, m_overflowWidth) - m_overflowLeft);
         if (repaintRect.height() == 0)
             repaintRect.setHeight(kMax(oldLineBottom, m_overflowHeight) - repaintRect.y());
     }