[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

mitz at apple.com mitz at apple.com
Thu Apr 8 00:16:38 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit fa973d40c4c1e2b27ada62ebd11f16148f1958b6
Author: mitz at apple.com <mitz at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Dec 4 00:16:50 2009 +0000

    Fixed <rdar://problem/7401617> Selection painting issue in hardware-
    accelerated layers
    which is another part of https://bugs.webkit.org/show_bug.cgi?id=23628
    Fix selection painting to do container-relative repaints
    
    Reviewed by Darin Adler.
    
    Test: fast/repaint/block-selection-gap-in-composited-layer.html
    
    * rendering/RenderBlock.cpp:
    (WebCore::RenderBlock::selectionGapRectsForRepaint): Compute and paint
    gap rects in the coordinate space of the repaint container.
    * rendering/RenderLayerCompositor.cpp:
    (WebCore::RenderLayerCompositor::recursiveRepaintLayerRect): Added a
    FIXME.
    * rendering/RenderView.cpp:
    (WebCore::RenderView::setSelection): Map block selection gap rects from
    the repaint container’s coordinate space to the view’s coordinate space
    before adding them to the cached selection bounds.
    (WebCore::RenderView::clearSelection): Changed to use
    repaintRectangleInViewAndCompositedLayers() so that the selection rect
    is invalidated in composited layers as well.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51668 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/fast/repaint/block-selection-gap-in-composited-layer.html b/LayoutTests/fast/repaint/block-selection-gap-in-composited-layer.html
new file mode 100644
index 0000000..1f7c3e7
--- /dev/null
+++ b/LayoutTests/fast/repaint/block-selection-gap-in-composited-layer.html
@@ -0,0 +1,20 @@
+<head>
+    <script src="resources/repaint.js" type="text/javascript" charset="utf-8"></script>
+    <script type="text/javascript" charset="utf-8">
+    function repaintTest()
+    {
+        var target = document.getElementById("target");
+        getSelection().setBaseAndExtent(target, 0, target.nextSibling, 1);
+    }
+    </script>
+    <style>
+        #target::selection { background-color: #0f0; }
+    </style>
+</head>
+<body onload="runRepaintTest()">
+    <div style="-webkit-transform: translateZ(0); margin-top: 50px; margin-left: 50px;">
+        <div id="target" style="background-color: red; width: 100px; height: 100px; position: absolute;"><br></div>a
+    </div>
+    <script>
+    </script>
+</body>
diff --git a/LayoutTests/platform/mac/fast/repaint/block-selection-gap-in-composited-layer-expected.checksum b/LayoutTests/platform/mac/fast/repaint/block-selection-gap-in-composited-layer-expected.checksum
new file mode 100644
index 0000000..3563601
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/repaint/block-selection-gap-in-composited-layer-expected.checksum
@@ -0,0 +1 @@
+6bcc4f2a827d62944f4ce8a4dd13b430
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/repaint/block-selection-gap-in-composited-layer-expected.png b/LayoutTests/platform/mac/fast/repaint/block-selection-gap-in-composited-layer-expected.png
new file mode 100644
index 0000000..4d8cd77
Binary files /dev/null and b/LayoutTests/platform/mac/fast/repaint/block-selection-gap-in-composited-layer-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/repaint/block-selection-gap-in-composited-layer-expected.txt b/LayoutTests/platform/mac/fast/repaint/block-selection-gap-in-composited-layer-expected.txt
new file mode 100644
index 0000000..aff7dbf
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/repaint/block-selection-gap-in-composited-layer-expected.txt
@@ -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,50) size 784x542
+layer at (58,50) size 734x18
+  RenderBlock {DIV} at (50,0) size 734x18
+    RenderText {#text} at (0,0) size 7x18
+      text run at (0,0) width 7: "a"
+layer at (58,50) size 100x100
+  RenderBlock (positioned) {DIV} at (0,0) size 100x100 [bgcolor=#FF0000]
+    RenderBR {BR} at (0,0) size 0x18
+selection start: position 0 of child 0 {BR} of child 1 {DIV} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
+selection end:   position 1 of child 2 {#text} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index f55cb92..53b8cdf 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,28 @@
+2009-12-03  Dan Bernstein  <mitz at apple.com>
+
+        Reviewed by Darin Adler.
+
+        Fixed <rdar://problem/7401617> Selection painting issue in hardware-
+        accelerated layers
+        which is another part of https://bugs.webkit.org/show_bug.cgi?id=23628
+        Fix selection painting to do container-relative repaints
+
+        Test: fast/repaint/block-selection-gap-in-composited-layer.html
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::selectionGapRectsForRepaint): Compute and paint
+        gap rects in the coordinate space of the repaint container.
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::recursiveRepaintLayerRect): Added a
+        FIXME.
+        * rendering/RenderView.cpp:
+        (WebCore::RenderView::setSelection): Map block selection gap rects from
+        the repaint container’s coordinate space to the view’s coordinate space
+        before adding them to the cached selection bounds.
+        (WebCore::RenderView::clearSelection): Changed to use
+        repaintRectangleInViewAndCompositedLayers() so that the selection rect
+        is invalidated in composited layers as well.
+
 2009-12-03  Jonathan Dixon  <joth at chromium.org>
 
         Reviewed by Dimitri Glazkov.
diff --git a/WebCore/rendering/RenderBlock.cpp b/WebCore/rendering/RenderBlock.cpp
index 0e69b38..f130a1c 100644
--- a/WebCore/rendering/RenderBlock.cpp
+++ b/WebCore/rendering/RenderBlock.cpp
@@ -44,6 +44,7 @@
 #include "RenderView.h"
 #include "SelectionController.h"
 #include "Settings.h"
+#include "TransformState.h"
 #include <wtf/StdLibExtras.h>
 
 using namespace std;
@@ -1907,23 +1908,23 @@ bool RenderBlock::isSelectionRoot() const
     return false;
 }
 
-GapRects RenderBlock::selectionGapRectsForRepaint(RenderBoxModelObject* /*repaintContainer*/)
+GapRects RenderBlock::selectionGapRectsForRepaint(RenderBoxModelObject* repaintContainer)
 {
     ASSERT(!needsLayout());
 
     if (!shouldPaintSelectionGaps())
         return GapRects();
 
-    // FIXME: this is broken with transforms and a non-null repaintContainer
-    FloatPoint absContentPoint = localToAbsolute(FloatPoint());
-    if (hasOverflowClip())
-        absContentPoint -= layer()->scrolledContentOffset();
+    // FIXME: this is broken with transforms
+    TransformState transformState(TransformState::ApplyTransformDirection, FloatPoint());
+    mapLocalToContainer(repaintContainer, false, false, transformState);
+    FloatPoint offsetFromRepaintContainer = transformState.mappedPoint();
 
     int lastTop = 0;
     int lastLeft = leftSelectionOffset(this, lastTop);
     int lastRight = rightSelectionOffset(this, lastTop);
     
-    return fillSelectionGaps(this, absContentPoint.x(), absContentPoint.y(), absContentPoint.x(), absContentPoint.y(), lastTop, lastLeft, lastRight);
+    return fillSelectionGaps(this, offsetFromRepaintContainer.x(), offsetFromRepaintContainer.y(), offsetFromRepaintContainer.x(), offsetFromRepaintContainer.y(), lastTop, lastLeft, lastRight);
 }
 
 void RenderBlock::paintSelection(PaintInfo& paintInfo, int tx, int ty)
diff --git a/WebCore/rendering/RenderLayerCompositor.cpp b/WebCore/rendering/RenderLayerCompositor.cpp
index 6f87e54..2f5e267 100644
--- a/WebCore/rendering/RenderLayerCompositor.cpp
+++ b/WebCore/rendering/RenderLayerCompositor.cpp
@@ -770,6 +770,7 @@ void RenderLayerCompositor::repaintCompositedLayersAbsoluteRect(const IntRect& a
 
 void RenderLayerCompositor::recursiveRepaintLayerRect(RenderLayer* layer, const IntRect& rect)
 {
+    // FIXME: This method does not work correctly with transforms.
     if (layer->isComposited())
         layer->setBackingNeedsRepaintInRect(rect);
 
@@ -778,7 +779,8 @@ void RenderLayerCompositor::recursiveRepaintLayerRect(RenderLayer* layer, const
             size_t listSize = negZOrderList->size();
             for (size_t i = 0; i < listSize; ++i) {
                 RenderLayer* curLayer = negZOrderList->at(i);
-                int x = 0, y = 0;
+                int x = 0;
+                int y = 0;
                 curLayer->convertToLayerCoords(layer, x, y);
                 IntRect childRect(rect);
                 childRect.move(-x, -y);
@@ -790,7 +792,8 @@ void RenderLayerCompositor::recursiveRepaintLayerRect(RenderLayer* layer, const
             size_t listSize = posZOrderList->size();
             for (size_t i = 0; i < listSize; ++i) {
                 RenderLayer* curLayer = posZOrderList->at(i);
-                int x = 0, y = 0;
+                int x = 0;
+                int y = 0;
                 curLayer->convertToLayerCoords(layer, x, y);
                 IntRect childRect(rect);
                 childRect.move(-x, -y);
@@ -802,7 +805,8 @@ void RenderLayerCompositor::recursiveRepaintLayerRect(RenderLayer* layer, const
         size_t listSize = normalFlowList->size();
         for (size_t i = 0; i < listSize; ++i) {
             RenderLayer* curLayer = normalFlowList->at(i);
-            int x = 0, y = 0;
+            int x = 0;
+            int y = 0;
             curLayer->convertToLayerCoords(layer, x, y);
             IntRect childRect(rect);
             childRect.move(-x, -y);
diff --git a/WebCore/rendering/RenderView.cpp b/WebCore/rendering/RenderView.cpp
index 77fa3f1..2b1a525 100644
--- a/WebCore/rendering/RenderView.cpp
+++ b/WebCore/rendering/RenderView.cpp
@@ -446,7 +446,10 @@ void RenderView::setSelection(RenderObject* start, int startPos, RenderObject* e
                     break;
                 blockInfo = new RenderBlockSelectionInfo(cb);
                 newSelectedBlocks.set(cb, blockInfo);
-                m_cachedSelectionBounds.unite(blockInfo->rects());
+                IntRect rect = blockInfo->rects();
+                if (blockInfo->repaintContainer())
+                    rect = blockInfo->repaintContainer()->localToAbsoluteQuad(FloatQuad(rect)).enclosingBoundingBox();
+                m_cachedSelectionBounds.unite(rect);
                 cb = cb->containingBlock();
             }
         }
@@ -523,7 +526,7 @@ void RenderView::setSelection(RenderObject* start, int startPos, RenderObject* e
 
 void RenderView::clearSelection()
 {
-    repaintViewRectangle(m_cachedSelectionBounds);
+    repaintRectangleInViewAndCompositedLayers(m_cachedSelectionBounds);
     setSelection(0, -1, 0, -1, RepaintNewMinusOld);
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list