Changeset 104782 in webkit


Ignore:
Timestamp:
Jan 11, 2012 7:46:47 PM (12 years ago)
Author:
enne@google.com
Message:

Repaint all graphics layers when their renderer offset changes
https://bugs.webkit.org/show_bug.cgi?id=75730

Reviewed by Simon Fraser.

Source/WebCore:

In RenderLayerBacking, only the main graphics layer gets repainted
when the offset changes. If the offset on other graphics layers (e.g.
the foreground layer) changes, they should get repainted as well.

Test: compositing/geometry/foreground-offset-change.html

  • platform/graphics/GraphicsLayer.cpp:

(WebCore::GraphicsLayer::setOffsetFromRenderer):
(WebCore::GraphicsLayer::paintGraphicsLayerContents):

  • platform/graphics/GraphicsLayer.h:
  • rendering/RenderLayerBacking.cpp:

(WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
(WebCore::RenderLayerBacking::paintContents):

LayoutTests:

  • compositing/geometry/foreground-offset-change-expected.png: Added.
  • compositing/geometry/foreground-offset-change-expected.txt: Added.
  • compositing/geometry/foreground-offset-change.html: Added.
Location:
trunk
Files:
3 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r104781 r104782  
     12012-01-11  Adrienne Walker  <enne@google.com>
     2
     3        Repaint all graphics layers when their renderer offset changes
     4        https://bugs.webkit.org/show_bug.cgi?id=75730
     5
     6        Reviewed by Simon Fraser.
     7
     8        * compositing/geometry/foreground-offset-change-expected.png: Added.
     9        * compositing/geometry/foreground-offset-change-expected.txt: Added.
     10        * compositing/geometry/foreground-offset-change.html: Added.
     11
    1122012-01-11  Dmitry Titov  <dimich@chromium.org>
    213
  • trunk/Source/WebCore/ChangeLog

    r104780 r104782  
     12012-01-11  Adrienne Walker  <enne@google.com>
     2
     3        Repaint all graphics layers when their renderer offset changes
     4        https://bugs.webkit.org/show_bug.cgi?id=75730
     5
     6        Reviewed by Simon Fraser.
     7
     8        In RenderLayerBacking, only the main graphics layer gets repainted
     9        when the offset changes. If the offset on other graphics layers (e.g.
     10        the foreground layer) changes, they should get repainted as well.
     11
     12        Test: compositing/geometry/foreground-offset-change.html
     13
     14        * platform/graphics/GraphicsLayer.cpp:
     15        (WebCore::GraphicsLayer::setOffsetFromRenderer):
     16        (WebCore::GraphicsLayer::paintGraphicsLayerContents):
     17        * platform/graphics/GraphicsLayer.h:
     18        * rendering/RenderLayerBacking.cpp:
     19        (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
     20        (WebCore::RenderLayerBacking::paintContents):
     21
    1222012-01-11  Scott Violet  <sky@google.com>
    223
  • trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp

    r102608 r104782  
    3131
    3232#include "FloatPoint.h"
     33#include "GraphicsContext.h"
     34#include "LayoutTypes.h"
    3335#include "RotateTransformOperation.h"
    3436#include "TextStream.h"
     
    262264}
    263265
     266void GraphicsLayer::setOffsetFromRenderer(const IntSize& offset)
     267{
     268    if (offset == m_offsetFromRenderer)
     269        return;
     270
     271    m_offsetFromRenderer = offset;
     272
     273    // If the compositing layer offset changes, we need to repaint.
     274    setNeedsDisplay();
     275}
     276
    264277void GraphicsLayer::setBackgroundColor(const Color& color)
    265278{
     
    279292    s_inPaintContents = true;
    280293#endif
    281     if (m_client)
    282         m_client->paintContents(this, context, m_paintingPhase, clip);
     294    if (m_client) {
     295        LayoutSize offset = offsetFromRenderer();
     296        context.translate(-offset);
     297
     298        LayoutRect clipRect(clip);
     299        clipRect.move(offset);
     300
     301        m_client->paintContents(this, context, m_paintingPhase, clipRect);
     302    }
    283303#ifndef NDEBUG
    284304    s_inPaintContents = false;
  • trunk/Source/WebCore/platform/graphics/GraphicsLayer.h

    r104698 r104782  
    259259    // Offset is origin of the renderer minus origin of the graphics layer (so either zero or negative).
    260260    IntSize offsetFromRenderer() const { return m_offsetFromRenderer; }
    261     void setOffsetFromRenderer(const IntSize& offset) { m_offsetFromRenderer = offset; }
     261    void setOffsetFromRenderer(const IntSize&);
    262262
    263263    // The position of the layer (the location of its top-left corner in its parent)
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r104698 r104782  
    454454
    455455    m_graphicsLayer->setPosition(FloatPoint() + (relativeCompositingBounds.location() - graphicsLayerParentLocation));
    456    
    457     LayoutSize oldOffsetFromRenderer = m_graphicsLayer->offsetFromRenderer();
    458456    m_graphicsLayer->setOffsetFromRenderer(localCompositingBounds.location() - LayoutPoint());
    459    
    460     // If the compositing layer offset changes, we need to repaint.
    461     if (oldOffsetFromRenderer != m_graphicsLayer->offsetFromRenderer())
    462         m_graphicsLayer->setNeedsDisplay();
    463457   
    464458    FloatSize oldSize = m_graphicsLayer->size();
     
    12351229        InspectorInstrumentationCookie cookie = InspectorInstrumentation::willPaint(m_owningLayer->renderer()->frame(), clip);
    12361230
    1237         LayoutSize offset = graphicsLayer->offsetFromRenderer();
    1238         context.translate(-offset);
    1239 
    1240         LayoutRect clipRect(clip);
    1241         clipRect.move(offset);
    1242 
    12431231        // The dirtyRect is in the coords of the painting root.
    12441232        LayoutRect dirtyRect = compositedBounds();
    1245         dirtyRect.intersect(clipRect);
     1233        dirtyRect.intersect(clip);
    12461234
    12471235        // We have to use the same root as for hit testing, because both methods can compute and cache clipRects.
Note: See TracChangeset for help on using the changeset viewer.