Changeset 51668 in webkit


Ignore:
Timestamp:
Dec 3, 2009 4:16:50 PM (14 years ago)
Author:
mitz@apple.com
Message:

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.

Location:
trunk
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r51660 r51668  
     12009-12-03  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Fixed <rdar://problem/7401617> Selection painting issue in hardware-
     6        accelerated layers
     7        which is another part of https://bugs.webkit.org/show_bug.cgi?id=23628
     8        Fix selection painting to do container-relative repaints
     9
     10        Test: fast/repaint/block-selection-gap-in-composited-layer.html
     11
     12        * rendering/RenderBlock.cpp:
     13        (WebCore::RenderBlock::selectionGapRectsForRepaint): Compute and paint
     14        gap rects in the coordinate space of the repaint container.
     15        * rendering/RenderLayerCompositor.cpp:
     16        (WebCore::RenderLayerCompositor::recursiveRepaintLayerRect): Added a
     17        FIXME.
     18        * rendering/RenderView.cpp:
     19        (WebCore::RenderView::setSelection): Map block selection gap rects from
     20        the repaint container’s coordinate space to the view’s coordinate space
     21        before adding them to the cached selection bounds.
     22        (WebCore::RenderView::clearSelection): Changed to use
     23        repaintRectangleInViewAndCompositedLayers() so that the selection rect
     24        is invalidated in composited layers as well.
     25
    1262009-12-03  Jonathan Dixon  <joth@chromium.org>
    227
  • trunk/WebCore/rendering/RenderBlock.cpp

    r51527 r51668  
    4545#include "SelectionController.h"
    4646#include "Settings.h"
     47#include "TransformState.h"
    4748#include <wtf/StdLibExtras.h>
    4849
     
    19081909}
    19091910
    1910 GapRects RenderBlock::selectionGapRectsForRepaint(RenderBoxModelObject* /*repaintContainer*/)
     1911GapRects RenderBlock::selectionGapRectsForRepaint(RenderBoxModelObject* repaintContainer)
    19111912{
    19121913    ASSERT(!needsLayout());
     
    19151916        return GapRects();
    19161917
    1917     // FIXME: this is broken with transforms and a non-null repaintContainer
    1918     FloatPoint absContentPoint = localToAbsolute(FloatPoint());
    1919     if (hasOverflowClip())
    1920         absContentPoint -= layer()->scrolledContentOffset();
     1918    // FIXME: this is broken with transforms
     1919    TransformState transformState(TransformState::ApplyTransformDirection, FloatPoint());
     1920    mapLocalToContainer(repaintContainer, false, false, transformState);
     1921    FloatPoint offsetFromRepaintContainer = transformState.mappedPoint();
    19211922
    19221923    int lastTop = 0;
     
    19241925    int lastRight = rightSelectionOffset(this, lastTop);
    19251926   
    1926     return fillSelectionGaps(this, absContentPoint.x(), absContentPoint.y(), absContentPoint.x(), absContentPoint.y(), lastTop, lastLeft, lastRight);
     1927    return fillSelectionGaps(this, offsetFromRepaintContainer.x(), offsetFromRepaintContainer.y(), offsetFromRepaintContainer.x(), offsetFromRepaintContainer.y(), lastTop, lastLeft, lastRight);
    19271928}
    19281929
  • trunk/WebCore/rendering/RenderLayerCompositor.cpp

    r51476 r51668  
    771771void RenderLayerCompositor::recursiveRepaintLayerRect(RenderLayer* layer, const IntRect& rect)
    772772{
     773    // FIXME: This method does not work correctly with transforms.
    773774    if (layer->isComposited())
    774775        layer->setBackingNeedsRepaintInRect(rect);
     
    779780            for (size_t i = 0; i < listSize; ++i) {
    780781                RenderLayer* curLayer = negZOrderList->at(i);
    781                 int x = 0, y = 0;
     782                int x = 0;
     783                int y = 0;
    782784                curLayer->convertToLayerCoords(layer, x, y);
    783785                IntRect childRect(rect);
     
    791793            for (size_t i = 0; i < listSize; ++i) {
    792794                RenderLayer* curLayer = posZOrderList->at(i);
    793                 int x = 0, y = 0;
     795                int x = 0;
     796                int y = 0;
    794797                curLayer->convertToLayerCoords(layer, x, y);
    795798                IntRect childRect(rect);
     
    803806        for (size_t i = 0; i < listSize; ++i) {
    804807            RenderLayer* curLayer = normalFlowList->at(i);
    805             int x = 0, y = 0;
     808            int x = 0;
     809            int y = 0;
    806810            curLayer->convertToLayerCoords(layer, x, y);
    807811            IntRect childRect(rect);
  • trunk/WebCore/rendering/RenderView.cpp

    r51324 r51668  
    447447                blockInfo = new RenderBlockSelectionInfo(cb);
    448448                newSelectedBlocks.set(cb, blockInfo);
    449                 m_cachedSelectionBounds.unite(blockInfo->rects());
     449                IntRect rect = blockInfo->rects();
     450                if (blockInfo->repaintContainer())
     451                    rect = blockInfo->repaintContainer()->localToAbsoluteQuad(FloatQuad(rect)).enclosingBoundingBox();
     452                m_cachedSelectionBounds.unite(rect);
    450453                cb = cb->containingBlock();
    451454            }
     
    524527void RenderView::clearSelection()
    525528{
    526     repaintViewRectangle(m_cachedSelectionBounds);
     529    repaintRectangleInViewAndCompositedLayers(m_cachedSelectionBounds);
    527530    setSelection(0, -1, 0, -1, RepaintNewMinusOld);
    528531}
Note: See TracChangeset for help on using the changeset viewer.