LayoutTests:
authorthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 May 2007 04:49:54 +0000 (04:49 +0000)
committerthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 May 2007 04:49:54 +0000 (04:49 +0000)
        Reviewed by Darin.

        - repaint test and updated results for http://bugs.webkit.org/show_bug.cgi?id=13655
          Incomplete repaint when text-shadow is used in a render layer with explicit height

        * fast/repaint/layer-full-repaint-expected.checksum: Added.
        * fast/repaint/layer-full-repaint-expected.png: Added.
        * fast/repaint/layer-full-repaint-expected.txt: Added.
        * fast/repaint/layer-full-repaint.html: Added.
        * fast/repaint/repaint-resized-overflow-expected.checksum:
        * fast/repaint/repaint-resized-overflow-expected.png:

WebCore:

        Reviewed by Darin.

        - fix http://bugs.webkit.org/show_bug.cgi?id=13655
          Incomplete repaint when text-shadow is used in a render layer with explicit height

        Test: fast/repaint/layer-full-repaint.html

        Removed custom repaint logic from RenderLayer. repaintAfterLayoutIfNeeded()
        knows how to do everything we need now. The only catch is that we cannot
        rely on its "do a full repaint if the object needs layout" behavior, since
        by the time we call it, the needs layout flag has been reset. The solution
        is to cache the need for a full repaint in the layer.

        * page/FrameView.cpp:
        (WebCore::FrameView::layout): Removed call to checkForRepaintOnResize().
        * rendering/RenderLayer.cpp:
        (WebCore::RenderLayer::checkForRepaintOnResize): Removed.
        (WebCore::RenderLayer::RenderLayer): Replaced the m_repaintOverflowOnResize
        flag with a m_needsFullRepaint flag, which indicates that the layer needs
        to do a full repaint in the next call to updateLayerPositions().
        (WebCore::RenderLayer::updateLayerPositions): Simplified the repaint logic.
        Either call repaintAfterLayoutIfNeeded() or do a full repaint, depending on
        m_needsFullRepaint.
        * rendering/RenderLayer.h:
        (WebCore::RenderLayer::setNeedsFullRepaint):
        * rendering/RenderObject.cpp:
        (WebCore::RenderObject::setNeedsLayout): Mark the layer for full repaint.

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

12 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/repaint/layer-full-repaint-expected.checksum [new file with mode: 0644]
LayoutTests/fast/repaint/layer-full-repaint-expected.png [new file with mode: 0644]
LayoutTests/fast/repaint/layer-full-repaint-expected.txt [new file with mode: 0644]
LayoutTests/fast/repaint/layer-full-repaint.html [new file with mode: 0644]
LayoutTests/fast/repaint/repaint-resized-overflow-expected.checksum
LayoutTests/fast/repaint/repaint-resized-overflow-expected.png
WebCore/ChangeLog
WebCore/page/FrameView.cpp
WebCore/rendering/RenderLayer.cpp
WebCore/rendering/RenderLayer.h
WebCore/rendering/RenderObject.cpp

index aca64037f0ea66713f3ee0ab8d9cdc9246eca96b..cf81407cface2e2043e6f7e0b695f970416571d0 100644 (file)
@@ -1,3 +1,17 @@
+2007-05-10  Mitz Pettel  <mitz@webkit.org>
+
+        Reviewed by Darin.
+
+        - repaint test and updated results for http://bugs.webkit.org/show_bug.cgi?id=13655
+          Incomplete repaint when text-shadow is used in a render layer with explicit height
+
+        * fast/repaint/layer-full-repaint-expected.checksum: Added.
+        * fast/repaint/layer-full-repaint-expected.png: Added.
+        * fast/repaint/layer-full-repaint-expected.txt: Added.
+        * fast/repaint/layer-full-repaint.html: Added.
+        * fast/repaint/repaint-resized-overflow-expected.checksum:
+        * fast/repaint/repaint-resized-overflow-expected.png:
+
 2007-05-10  Justin Garcia  <justin.garcia@apple.com>
 
         Reviewed by ggaren
diff --git a/LayoutTests/fast/repaint/layer-full-repaint-expected.checksum b/LayoutTests/fast/repaint/layer-full-repaint-expected.checksum
new file mode 100644 (file)
index 0000000..4a08994
--- /dev/null
@@ -0,0 +1 @@
+ac11919b3374bdf25310762585898e18
\ No newline at end of file
diff --git a/LayoutTests/fast/repaint/layer-full-repaint-expected.png b/LayoutTests/fast/repaint/layer-full-repaint-expected.png
new file mode 100644 (file)
index 0000000..3ab9f1a
Binary files /dev/null and b/LayoutTests/fast/repaint/layer-full-repaint-expected.png differ
diff --git a/LayoutTests/fast/repaint/layer-full-repaint-expected.txt b/LayoutTests/fast/repaint/layer-full-repaint-expected.txt
new file mode 100644 (file)
index 0000000..6647456
--- /dev/null
@@ -0,0 +1,7 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x116
+  RenderBlock {HTML} at (0,0) size 800x116
+    RenderBody {BODY} at (8,8) size 784x100
+layer at (8,8) size 100x100
+  RenderBlock (relative positioned) {DIV} at (0,0) size 100x100 [bgcolor=#008000]
diff --git a/LayoutTests/fast/repaint/layer-full-repaint.html b/LayoutTests/fast/repaint/layer-full-repaint.html
new file mode 100644 (file)
index 0000000..8e28df8
--- /dev/null
@@ -0,0 +1,29 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+    <title>Test for http://bugs.webkit.org/show_bug.cgi?id=13655</title>
+    <style type="text/css">
+        div {
+            position: relative;
+            height: 100px;
+            width: 100px;
+            background-color: red;
+        }
+        
+        div.selected {
+            background-color: green;
+            text-shadow: red 5px 5px 0;
+        }
+    </style>
+    <script src="repaint.js" type="text/javascript"></script>
+    <script>
+        function repaintTest()
+        {
+           document.getElementById('test').className = "selected";
+        }
+    </script>
+</head>
+<body onload="runRepaintTest();">
+        <div id="test"></div>
+</body>
+</html>
index 6b82a371158099068b93548fdca004cf1cbabce1..a2e215881968908a1990c5f62d261126f3df0df8 100644 (file)
@@ -1 +1 @@
-4a08fade6137f2ea6dca995ae001e2e6
\ No newline at end of file
+7bcff2ca869022f6515c572a36c58b4c
\ No newline at end of file
index d58a1662152722d48d55de76e61d14cd42b8ae50..d194ffc583d546a9505d49e44dfce0288c57a433 100644 (file)
Binary files a/LayoutTests/fast/repaint/repaint-resized-overflow-expected.png and b/LayoutTests/fast/repaint/repaint-resized-overflow-expected.png differ
index 44dc812830e90610d2af5b401eb2f87dbeaa2556..264af83f55a25d275cc7adfe66ae087dd72c2b91 100644 (file)
@@ -1,3 +1,33 @@
+2007-05-10  Mitz Pettel  <mitz@webkit.org>
+
+        Reviewed by Darin.
+
+        - fix http://bugs.webkit.org/show_bug.cgi?id=13655
+          Incomplete repaint when text-shadow is used in a render layer with explicit height
+
+        Test: fast/repaint/layer-full-repaint.html
+
+        Removed custom repaint logic from RenderLayer. repaintAfterLayoutIfNeeded()
+        knows how to do everything we need now. The only catch is that we cannot
+        rely on its "do a full repaint if the object needs layout" behavior, since
+        by the time we call it, the needs layout flag has been reset. The solution
+        is to cache the need for a full repaint in the layer.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::layout): Removed call to checkForRepaintOnResize().
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::checkForRepaintOnResize): Removed.
+        (WebCore::RenderLayer::RenderLayer): Replaced the m_repaintOverflowOnResize
+        flag with a m_needsFullRepaint flag, which indicates that the layer needs
+        to do a full repaint in the next call to updateLayerPositions().
+        (WebCore::RenderLayer::updateLayerPositions): Simplified the repaint logic.
+        Either call repaintAfterLayoutIfNeeded() or do a full repaint, depending on
+        m_needsFullRepaint.
+        * rendering/RenderLayer.h:
+        (WebCore::RenderLayer::setNeedsFullRepaint):
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::setNeedsLayout): Mark the layer for full repaint.
+
 2007-05-10  Justin Garcia  <justin.garcia@apple.com>
 
         Reviewed by ggaren
index 656d6677848485e5450976d3f1a8abe51d19a3cf..0bbb8e153411a7105c909071136c560432e9985d 100644 (file)
@@ -405,9 +405,6 @@ void FrameView::layout(bool allowSubtree)
     
     RenderLayer* layer = root->enclosingLayer();
      
-    if (!d->doFullRepaint)
-        layer->checkForRepaintOnResize();
-
     pauseScheduledEvents();
 
     if (subtree)
index a43a2da5d4ac4355c8c6712139adcd6a9d5452cf..3f52ce3d01d11f9372294eee6646306bbf20f733 100644 (file)
@@ -141,7 +141,7 @@ RenderLayer::RenderLayer(RenderObject* object)
     , m_isOverflowOnly(shouldBeOverflowOnly())
     , m_usedTransparency(false)
     , m_inOverflowRelayout(false)
-    , m_repaintOverflowOnResize(false)
+    , m_needsFullRepaint(false)
     , m_overflowStatusDirty(true)
     , m_visibleContentStatusDirty(true)
     , m_hasVisibleContent(false)
@@ -174,15 +174,6 @@ RenderLayer::~RenderLayer()
     ASSERT(!m_clipRects);
 }
 
-void RenderLayer::checkForRepaintOnResize()
-{
-    // FIXME: The second part of the condition is probably no longer needed. The first part can be
-    // done when the object is marked for layout instead of walking the tree here.
-    m_repaintOverflowOnResize = m_object->selfNeedsLayout() || m_object->hasOverflowClip() && m_object->normalChildNeedsLayout();
-    for (RenderLayer* child = firstChild(); child; child = child->nextSibling())
-        child->checkForRepaintOnResize();
-}
-
 void RenderLayer::updateLayerPositions(bool doFullRepaint, bool checkForRepaint)
 {
     if (doFullRepaint) {
@@ -209,13 +200,12 @@ void RenderLayer::updateLayerPositions(bool doFullRepaint, bool checkForRepaint)
         IntRect newOutlineBox = m_object->absoluteOutlineBox();
         if (checkForRepaint) {
             if (view && !view->printing()) {
-                bool didMove = newOutlineBox.location() != m_outlineBox.location();
-                if (!didMove && !m_repaintOverflowOnResize)
-                    m_object->repaintAfterLayoutIfNeeded(m_repaintRect, m_outlineBox);
-                else if (didMove || newRect != m_repaintRect) {
+                if (m_needsFullRepaint) {
                     view->repaintViewRectangle(m_repaintRect);
-                    view->repaintViewRectangle(newRect);
-                }
+                    if (newRect != m_repaintRect)
+                        view->repaintViewRectangle(newRect);
+                } else
+                    m_object->repaintAfterLayoutIfNeeded(m_repaintRect, m_outlineBox);
             }
         }
         m_repaintRect = newRect;
@@ -224,6 +214,8 @@ void RenderLayer::updateLayerPositions(bool doFullRepaint, bool checkForRepaint)
         m_repaintRect = IntRect();
         m_outlineBox = IntRect();
     }
+
+    m_needsFullRepaint = false;
     
     for (RenderLayer* child = firstChild(); child; child = child->nextSibling())
         child->updateLayerPositions(doFullRepaint, checkForRepaint);
index b0fc48b49c9bae74c5fe62c4828fec48646e763e..67f5726a55adc23a219cc4cfd2a842a7dbc90ed4 100644 (file)
@@ -280,7 +280,6 @@ public:
     
     void updateLayerPosition();
     void updateLayerPositions(bool doFullRepaint = false, bool checkForRepaint = true);
-    void checkForRepaintOnResize();
 
     void relativePositionOffset(int& relX, int& relY) { relX += m_relX; relY += m_relY; }
 
@@ -339,6 +338,7 @@ public:
     void updateHoverActiveState(const HitTestRequest&, HitTestResult&);
 
     IntRect repaintRect() const { return m_repaintRect; }
+    void setNeedsFullRepaint(bool f = true) { m_needsFullRepaint = f; }
     
     int staticX() const { return m_staticX; }
     int staticY() const { return m_staticY; }
@@ -447,7 +447,7 @@ protected:
                                  // we ended up painting this layer or any descendants (and therefore need to
                                  // blend).
     bool m_inOverflowRelayout : 1;
-    bool m_repaintOverflowOnResize : 1;
+    bool m_needsFullRepaint : 1;
 
     bool m_overflowStatusDirty : 1;
     bool m_horizontalOverflow : 1;
index fb5ecdd89dc92b20f4f90bd43bbafc6a70fc87ca..12ef25c85b8bb5962415cd91cd7c292eff0e2d67 100644 (file)
@@ -684,8 +684,12 @@ void RenderObject::setNeedsLayout(bool b, bool markParents)
     bool alreadyNeededLayout = m_needsLayout;
     m_needsLayout = b;
     if (b) {
-        if (!alreadyNeededLayout && markParents)
-            markContainingBlocksForLayout();
+        if (!alreadyNeededLayout) {
+            if (markParents)
+                markContainingBlocksForLayout();
+            if (hasLayer())
+                layer()->setNeedsFullRepaint();
+        }
     } else {
         m_posChildNeedsLayout = false;
         m_normalChildNeedsLayout = false;