Changeset 98667 in webkit


Ignore:
Timestamp:
Oct 27, 2011 5:37:02 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

[chromium] Track when CCLayerImpl properties have changed.
https://bugs.webkit.org/show_bug.cgi?id=70442

Patch by Shawn Singh <shawnsingh@chromium.org> on 2011-10-27
Reviewed by James Robinson.

Source/WebCore:

To determine a good scissor rect, we must determine what
will change on the screen on the next redraw. This patch
tracks the necessary information on CCLayerImpl and marks
a flag indicating whether this layer will "damage" the screen.
The other portion of "change", the updateRect, was already
landed in https://bugs.webkit.org/show_bug.cgi?id=69441.

New unit test added to CCLayerImplTest to test this patch.

  • platform/graphics/chromium/cc/CCLayerImpl.cpp:

(WebCore::CCLayerImpl::CCLayerImpl):
(WebCore::CCLayerImpl::scrollBy):
(WebCore::CCLayerImpl::noteLayerPropertyChangedForSubtree):
(WebCore::CCLayerImpl::noteLayerPropertyChangedForDescendants):
(WebCore::CCLayerImpl::setBounds):
(WebCore::CCLayerImpl::setMaskLayer):
(WebCore::CCLayerImpl::setReplicaLayer):
(WebCore::CCLayerImpl::setDrawsContent):
(WebCore::CCLayerImpl::setAnchorPoint):
(WebCore::CCLayerImpl::setAnchorPointZ):
(WebCore::CCLayerImpl::setMasksToBounds):
(WebCore::CCLayerImpl::setOpaque):
(WebCore::CCLayerImpl::setOpacity):
(WebCore::CCLayerImpl::setPosition):
(WebCore::CCLayerImpl::setPreserves3D):
(WebCore::CCLayerImpl::setSublayerTransform):
(WebCore::CCLayerImpl::setTransform):
(WebCore::CCLayerImpl::setDebugBorderColor):
(WebCore::CCLayerImpl::setDebugBorderWidth):
(WebCore::CCLayerImpl::setContentBounds):
(WebCore::CCLayerImpl::setScrollPosition):
(WebCore::CCLayerImpl::setScrollDelta):
(WebCore::CCLayerImpl::setDoubleSided):

  • platform/graphics/chromium/cc/CCLayerImpl.h:

(WebCore::CCLayerImpl::layerPropertyChanged):
(WebCore::CCLayerImpl::resetLayerPropertyChanged):

Source/WebKit/chromium:

  • WebKit.gypi:
  • tests/CCLayerImplTest.cpp: Added.

(WebCore::TEST):

Location:
trunk/Source
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r98664 r98667  
     12011-10-27  Shawn Singh  <shawnsingh@chromium.org>
     2
     3        [chromium] Track when CCLayerImpl properties have changed.
     4        https://bugs.webkit.org/show_bug.cgi?id=70442
     5
     6        Reviewed by James Robinson.
     7
     8        To determine a good scissor rect, we must determine what
     9        will change on the screen on the next redraw.  This patch
     10        tracks the necessary information on CCLayerImpl and marks
     11        a flag indicating whether this layer will "damage" the screen.
     12        The other portion of "change", the updateRect, was already
     13        landed in https://bugs.webkit.org/show_bug.cgi?id=69441.
     14
     15        New unit test added to CCLayerImplTest to test this patch.
     16
     17        * platform/graphics/chromium/cc/CCLayerImpl.cpp:
     18        (WebCore::CCLayerImpl::CCLayerImpl):
     19        (WebCore::CCLayerImpl::scrollBy):
     20        (WebCore::CCLayerImpl::noteLayerPropertyChangedForSubtree):
     21        (WebCore::CCLayerImpl::noteLayerPropertyChangedForDescendants):
     22        (WebCore::CCLayerImpl::setBounds):
     23        (WebCore::CCLayerImpl::setMaskLayer):
     24        (WebCore::CCLayerImpl::setReplicaLayer):
     25        (WebCore::CCLayerImpl::setDrawsContent):
     26        (WebCore::CCLayerImpl::setAnchorPoint):
     27        (WebCore::CCLayerImpl::setAnchorPointZ):
     28        (WebCore::CCLayerImpl::setMasksToBounds):
     29        (WebCore::CCLayerImpl::setOpaque):
     30        (WebCore::CCLayerImpl::setOpacity):
     31        (WebCore::CCLayerImpl::setPosition):
     32        (WebCore::CCLayerImpl::setPreserves3D):
     33        (WebCore::CCLayerImpl::setSublayerTransform):
     34        (WebCore::CCLayerImpl::setTransform):
     35        (WebCore::CCLayerImpl::setDebugBorderColor):
     36        (WebCore::CCLayerImpl::setDebugBorderWidth):
     37        (WebCore::CCLayerImpl::setContentBounds):
     38        (WebCore::CCLayerImpl::setScrollPosition):
     39        (WebCore::CCLayerImpl::setScrollDelta):
     40        (WebCore::CCLayerImpl::setDoubleSided):
     41        * platform/graphics/chromium/cc/CCLayerImpl.h:
     42        (WebCore::CCLayerImpl::layerPropertyChanged):
     43        (WebCore::CCLayerImpl::resetLayerPropertyChanged):
     44
    1452011-10-27  Anders Carlsson  <andersca@apple.com>
    246
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp

    r98567 r98667  
    4444    , m_anchorPointZ(0)
    4545    , m_doubleSided(true)
     46    , m_layerPropertyChanged(false)
    4647    , m_masksToBounds(false)
    4748    , m_opaque(false)
     
    127128    // Clamp newDelta so that position + delta stays within scroll bounds.
    128129    m_scrollDelta = newDelta.expandedTo(minDelta).shrunkTo(maxDelta);
     130    noteLayerPropertyChangedForSubtree();
    129131}
    130132
     
    224226}
    225227
     228void CCLayerImpl::noteLayerPropertyChangedForSubtree()
     229{
     230    m_layerPropertyChanged = true;
     231    noteLayerPropertyChangedForDescendants();
     232}
     233
     234void CCLayerImpl::noteLayerPropertyChangedForDescendants()
     235{
     236    for (size_t i = 0; i < m_children.size(); ++i)
     237        m_children[i]->noteLayerPropertyChangedForSubtree();
     238}
     239
     240void CCLayerImpl::setBounds(const IntSize& bounds)
     241{
     242    if (m_bounds != bounds) {
     243        m_bounds = bounds;
     244
     245        if (masksToBounds())
     246            noteLayerPropertyChangedForSubtree();
     247        else
     248            m_layerPropertyChanged = true;
     249    }
     250}
     251
     252void CCLayerImpl::setMaskLayer(PassRefPtr<CCLayerImpl> maskLayer)
     253{
     254    if (m_maskLayer != maskLayer) {
     255        m_maskLayer = maskLayer;
     256        noteLayerPropertyChangedForSubtree();
     257    }
     258}
     259
     260void CCLayerImpl::setReplicaLayer(PassRefPtr<CCLayerImpl> replicaLayer)
     261{
     262    if (m_replicaLayer != replicaLayer) {
     263        m_replicaLayer = replicaLayer;
     264        noteLayerPropertyChangedForSubtree();
     265    }
     266}
     267
     268void CCLayerImpl::setDrawsContent(bool drawsContent)
     269{
     270    if (m_drawsContent != drawsContent) {
     271        m_drawsContent = drawsContent;
     272        m_layerPropertyChanged = true;
     273    }
     274}
     275
     276void CCLayerImpl::setAnchorPoint(const FloatPoint& anchorPoint)
     277{
     278    if (m_anchorPoint != anchorPoint) {
     279        m_anchorPoint = anchorPoint;
     280        noteLayerPropertyChangedForSubtree();
     281    }
     282}
     283
     284void CCLayerImpl::setAnchorPointZ(float anchorPointZ)
     285{
     286    if (m_anchorPointZ != anchorPointZ) {
     287        m_anchorPointZ = anchorPointZ;
     288        noteLayerPropertyChangedForSubtree();
     289    }
     290}
     291
     292void CCLayerImpl::setMasksToBounds(bool masksToBounds)
     293{
     294    if (m_masksToBounds != masksToBounds) {
     295        m_masksToBounds = masksToBounds;
     296        noteLayerPropertyChangedForSubtree();
     297    }
     298}
     299
     300void CCLayerImpl::setOpaque(bool opaque)
     301{
     302    if (m_opaque != opaque) {
     303        m_opaque = opaque;
     304        noteLayerPropertyChangedForSubtree();
     305    }
     306}
     307
     308void CCLayerImpl::setOpacity(float opacity)
     309{
     310    if (m_opacity != opacity) {
     311        m_opacity = opacity;
     312        noteLayerPropertyChangedForSubtree();
     313    }
     314}
     315
     316void CCLayerImpl::setPosition(const FloatPoint& position)
     317{
     318    if (m_position != position) {
     319        m_position = position;
     320        noteLayerPropertyChangedForSubtree();
     321    }
     322}
     323
     324void CCLayerImpl::setPreserves3D(bool preserves3D)
     325{
     326    if (m_preserves3D != preserves3D) {
     327        m_preserves3D = preserves3D;
     328        noteLayerPropertyChangedForSubtree();
     329    }
     330}
     331
     332void CCLayerImpl::setSublayerTransform(const TransformationMatrix& sublayerTransform)
     333{
     334    if (m_sublayerTransform != sublayerTransform) {
     335        m_sublayerTransform = sublayerTransform;
     336        // sublayer transform does not affect the current layer; it affects only its children.
     337        noteLayerPropertyChangedForDescendants();
     338    }
     339}
     340
     341void CCLayerImpl::setTransform(const TransformationMatrix& transform)
     342{
     343    if (m_transform != transform) {
     344        m_transform = transform;
     345        noteLayerPropertyChangedForSubtree();
     346    }
     347}
     348
     349void CCLayerImpl::setDebugBorderColor(Color debugBorderColor)
     350{
     351    if (m_debugBorderColor != debugBorderColor) {
     352        m_debugBorderColor = debugBorderColor;
     353        m_layerPropertyChanged = true;
     354    }
     355}
     356
     357void CCLayerImpl::setDebugBorderWidth(float debugBorderWidth)
     358{
     359    if (m_debugBorderWidth != debugBorderWidth) {
     360        m_debugBorderWidth = debugBorderWidth;
     361        m_layerPropertyChanged = true;
     362    }
     363}
     364
     365void CCLayerImpl::setContentBounds(const IntSize& contentBounds)
     366{
     367    if (m_contentBounds != contentBounds) {
     368        m_contentBounds = contentBounds;
     369        m_layerPropertyChanged = true;
     370    }
     371}
     372
     373void CCLayerImpl::setScrollPosition(const IntPoint& scrollPosition)
     374{
     375    if (m_scrollPosition != scrollPosition) {
     376        m_scrollPosition = scrollPosition;
     377        noteLayerPropertyChangedForSubtree();
     378    }
     379}
     380
     381void CCLayerImpl::setScrollDelta(const IntSize& scrollDelta)
     382{
     383    if (m_scrollDelta != scrollDelta) {
     384        m_scrollDelta = scrollDelta;
     385        noteLayerPropertyChangedForSubtree();
     386    }
     387}
     388
     389void CCLayerImpl::setDoubleSided(bool doubleSided)
     390{
     391    if (m_doubleSided != doubleSided) {
     392        m_doubleSided = doubleSided;
     393        noteLayerPropertyChangedForSubtree();
     394    }
     395}
     396
    226397}
    227398
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h

    r98567 r98667  
    5959    void removeAllChildren();
    6060
    61     void setMaskLayer(PassRefPtr<CCLayerImpl> maskLayer) { m_maskLayer = maskLayer; }
     61    void setMaskLayer(PassRefPtr<CCLayerImpl>);
    6262    CCLayerImpl* maskLayer() const { return m_maskLayer.get(); }
    6363
    64     void setReplicaLayer(PassRefPtr<CCLayerImpl> replicaLayer) { m_replicaLayer = replicaLayer; }
     64    void setReplicaLayer(PassRefPtr<CCLayerImpl>);
    6565    CCLayerImpl* replicaLayer() const { return m_replicaLayer.get(); }
    6666
     
    7676
    7777    // Returns true if this layer has content to draw.
    78     void setDrawsContent(bool drawsContent) { m_drawsContent = drawsContent; }
     78    void setDrawsContent(bool);
    7979    bool drawsContent() const { return m_drawsContent; }
    8080
     
    8484    void cleanupResources();
    8585
    86     void setAnchorPoint(const FloatPoint& anchorPoint) { m_anchorPoint = anchorPoint; }
     86    void setAnchorPoint(const FloatPoint&);
    8787    const FloatPoint& anchorPoint() const { return m_anchorPoint; }
    8888
    89     void setAnchorPointZ(float anchorPointZ) { m_anchorPointZ = anchorPointZ; }
     89    void setAnchorPointZ(float);
    9090    float anchorPointZ() const { return m_anchorPointZ; }
    9191
    92     void setMasksToBounds(bool masksToBounds) { m_masksToBounds = masksToBounds; }
     92    void setMasksToBounds(bool);
    9393    bool masksToBounds() const { return m_masksToBounds; }
    9494
    95     void setOpaque(bool opaque) { m_opaque = opaque; }
     95    void setOpaque(bool);
    9696    bool opaque() const { return m_opaque; }
    9797
    98     void setOpacity(float opacity) { m_opacity = opacity; }
     98    void setOpacity(float);
    9999    float opacity() const { return m_opacity; }
    100100
    101     void setPosition(const FloatPoint& position) { m_position = position; }
     101    void setPosition(const FloatPoint&);
    102102    const FloatPoint& position() const { return m_position; }
    103103
    104     void setPreserves3D(bool preserves3D) { m_preserves3D = preserves3D; }
     104    void setPreserves3D(bool);
    105105    bool preserves3D() const { return m_preserves3D; }
    106106
     
    111111    bool isNonCompositedContent() const { return m_isNonCompositedContent; }
    112112
    113     void setSublayerTransform(const TransformationMatrix& sublayerTransform) { m_sublayerTransform = sublayerTransform; }
     113    void setSublayerTransform(const TransformationMatrix&);
    114114    const TransformationMatrix& sublayerTransform() const { return m_sublayerTransform; }
    115115
    116     void setTransform(const TransformationMatrix& transform) { m_transform = transform; }
     116    void setTransform(const TransformationMatrix&);
    117117    const TransformationMatrix& transform() const { return m_transform; }
    118118
     
    121121
    122122    // Debug layer border - visual effect only, do not change geometry/clipping/etc.
    123     void setDebugBorderColor(Color c) { m_debugBorderColor = c; }
     123    void setDebugBorderColor(Color);
    124124    Color debugBorderColor() const { return m_debugBorderColor; }
    125     void setDebugBorderWidth(float width) { m_debugBorderWidth = width; }
     125    void setDebugBorderWidth(float);
    126126    float debugBorderWidth() const { return m_debugBorderWidth; }
    127127
     
    141141
    142142    const IntSize& bounds() const { return m_bounds; }
    143     void setBounds(const IntSize& bounds) { m_bounds = bounds; }
     143    void setBounds(const IntSize&);
    144144
    145145    const IntSize& contentBounds() const { return m_contentBounds; }
    146     void setContentBounds(const IntSize& contentBounds) { m_contentBounds = contentBounds; }
     146    void setContentBounds(const IntSize&);
    147147
    148148    const IntPoint& scrollPosition() const { return m_scrollPosition; }
    149     void setScrollPosition(const IntPoint& scrollPosition) { m_scrollPosition = scrollPosition; }
     149    void setScrollPosition(const IntPoint&);
    150150
    151151    const IntSize& maxScrollPosition() const {return m_maxScrollPosition; }
     
    153153
    154154    const IntSize& scrollDelta() const { return m_scrollDelta; }
    155     void setScrollDelta(const IntSize& scrollDelta) { m_scrollDelta = scrollDelta; }
     155    void setScrollDelta(const IntSize&);
    156156
    157157    void scrollBy(const IntSize& scroll);
     
    162162
    163163    bool doubleSided() const { return m_doubleSided; }
    164     void setDoubleSided(bool doubleSided) { m_doubleSided = doubleSided; }
     164    void setDoubleSided(bool);
    165165
    166166    // Returns the rect containtaining this layer in the current view's coordinate system.
     
    178178    String layerTreeAsText() const;
    179179
     180    bool layerPropertyChanged() const { return m_layerPropertyChanged; }
     181    void resetLayerPropertyChanged() { m_layerPropertyChanged = false; }
     182
    180183protected:
    181184    explicit CCLayerImpl(int);
     
    188191    friend class TreeSynchronizer;
    189192    void clearChildList(); // Warning: This does not preserve tree structure invariants and so is only exposed to the tree synchronizer.
     193
     194    void noteLayerPropertyChangedForSubtree();
     195
     196    // Note carefully this does not affect the current layer.
     197    void noteLayerPropertyChangedForDescendants();
    190198
    191199    virtual const char* layerTypeAsString() const { return "LayerChromium"; }
     
    210218    // Whether the "back" of this layer should draw.
    211219    bool m_doubleSided;
     220
     221    // Tracks if drawing-related properties have changed since last redraw.
     222    bool m_layerPropertyChanged;
    212223
    213224    IntRect m_visibleLayerRect;
  • trunk/Source/WebKit/chromium/ChangeLog

    r98651 r98667  
     12011-10-27  Shawn Singh  <shawnsingh@chromium.org>
     2
     3        [chromium] Track when CCLayerImpl properties have changed.
     4        https://bugs.webkit.org/show_bug.cgi?id=70442
     5
     6        Reviewed by James Robinson.
     7
     8        * WebKit.gypi:
     9        * tests/CCLayerImplTest.cpp: Added.
     10        (WebCore::TEST):
     11
    1122011-10-27  Vsevolod Vlasov  <vsevik@chromium.org>
    213
  • trunk/Source/WebKit/chromium/WebKit.gypi

    r98630 r98667  
    5555            'tests/ArenaTestHelpers.h',
    5656            'tests/AssociatedURLLoaderTest.cpp',
     57            'tests/CCLayerImplTest.cpp',
    5758            'tests/CCLayerSorterTest.cpp',
    5859            'tests/CCLayerTreeHostCommonTest.cpp',
Note: See TracChangeset for help on using the changeset viewer.