Changeset 167529 in webkit


Ignore:
Timestamp:
Apr 18, 2014 10:31:39 PM (10 years ago)
Author:
Simon Fraser
Message:

Contents of directly composited image layers are sometimes missing
https://bugs.webkit.org/show_bug.cgi?id=131880

Reviewed by Tim Horton.

Source/WebCore:
RenderLayerBacking::updateGraphicsLayerGeometry() tested whether a
GraphicsLayer had a contents layer to determine whether to call code
that updates the contents rect. However, on Mac, we don't make a contents
layer until later at layer flush time. That would result in an empty
contentsRect being set.

Fix by renaming GraphicsLayer::hasContentsLayer() to usesContentsLayer(),
and on Mac consulting the m_contentsLayerPurpose flag, which is set
at the appropriate time.

Test: compositing/images/update-content-rect.html

  • platform/ScrollView.cpp:

(WebCore::positionScrollbarLayer):

  • platform/graphics/GraphicsLayer.cpp:

(WebCore::GraphicsLayer::getDebugBorderInfo):

  • platform/graphics/GraphicsLayer.h:

(WebCore::GraphicsLayer::usesContentsLayer):
(WebCore::GraphicsLayer::hasContentsLayer): Deleted.

  • platform/graphics/ca/GraphicsLayerCA.h:

(WebCore::GraphicsLayerCA::hasContentsLayer): Deleted.

  • platform/graphics/texmap/GraphicsLayerTextureMapper.h:

(WebCore::GraphicsLayerTextureMapper::usesContentsLayer):
(WebCore::GraphicsLayerTextureMapper::hasContentsLayer): Deleted.

  • platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
  • rendering/RenderLayerBacking.cpp:

(WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
(WebCore::RenderLayerBacking::positionOverflowControlsLayers):
(WebCore::RenderLayerBacking::compositingLayerType):

LayoutTests:
Test that that shows the issue in Safari, but not in the test
runner because of timing issues, but maybe it will some day.

  • compositing/images/update-content-rect-expected.html: Added.
  • compositing/images/update-content-rect.html: Added.
Location:
trunk
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r167528 r167529  
     12014-04-18  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Contents of directly composited image layers are sometimes missing
     4        https://bugs.webkit.org/show_bug.cgi?id=131880
     5
     6        Reviewed by Tim Horton.
     7       
     8        Test that that shows the issue in Safari, but not in the test
     9        runner because of timing issues, but maybe it will some day.
     10
     11        * compositing/images/update-content-rect-expected.html: Added.
     12        * compositing/images/update-content-rect.html: Added.
     13
    1142014-04-18  Commit Queue  <commit-queue@webkit.org>
    215
  • trunk/Source/WebCore/ChangeLog

    r167528 r167529  
     12014-04-18  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Contents of directly composited image layers are sometimes missing
     4        https://bugs.webkit.org/show_bug.cgi?id=131880
     5
     6        Reviewed by Tim Horton.
     7       
     8        RenderLayerBacking::updateGraphicsLayerGeometry() tested whether a
     9        GraphicsLayer had a contents layer to determine whether to call code
     10        that updates the contents rect. However, on Mac, we don't make a contents
     11        layer until later at layer flush time. That would result in an empty
     12        contentsRect being set.
     13       
     14        Fix by renaming GraphicsLayer::hasContentsLayer() to usesContentsLayer(),
     15        and on Mac consulting the m_contentsLayerPurpose flag, which is set
     16        at the appropriate time.
     17
     18        Test: compositing/images/update-content-rect.html
     19
     20        * platform/ScrollView.cpp:
     21        (WebCore::positionScrollbarLayer):
     22        * platform/graphics/GraphicsLayer.cpp:
     23        (WebCore::GraphicsLayer::getDebugBorderInfo):
     24        * platform/graphics/GraphicsLayer.h:
     25        (WebCore::GraphicsLayer::usesContentsLayer):
     26        (WebCore::GraphicsLayer::hasContentsLayer): Deleted.
     27        * platform/graphics/ca/GraphicsLayerCA.h:
     28        (WebCore::GraphicsLayerCA::hasContentsLayer): Deleted.
     29        * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
     30        (WebCore::GraphicsLayerTextureMapper::usesContentsLayer):
     31        (WebCore::GraphicsLayerTextureMapper::hasContentsLayer): Deleted.
     32        * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
     33        * rendering/RenderLayerBacking.cpp:
     34        (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
     35        (WebCore::RenderLayerBacking::positionOverflowControlsLayers):
     36        (WebCore::RenderLayerBacking::compositingLayerType):
     37
    1382014-04-18  Commit Queue  <commit-queue@webkit.org>
    239
  • trunk/Source/WebCore/platform/ScrollView.cpp

    r167503 r167529  
    10501050    graphicsLayer->setSize(scrollbarRect.size());
    10511051
    1052     if (graphicsLayer->hasContentsLayer()) {
     1052    if (graphicsLayer->usesContentsLayer()) {
    10531053        graphicsLayer->setContentsRect(IntRect(0, 0, scrollbarRect.width(), scrollbarRect.height()));
    10541054        return;
  • trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp

    r167319 r167529  
    371371    }
    372372
    373     if (hasContentsLayer()) {
     373    if (usesContentsLayer()) {
    374374        color = Color(255, 150, 255, 200); // non-painting layer with contents: pink
    375375        width = 2;
  • trunk/Source/WebCore/platform/graphics/GraphicsLayer.h

    r167472 r167529  
    409409    // Should unify setContentsToMedia and setContentsToCanvas
    410410    virtual void setContentsToPlatformLayer(PlatformLayer* layer) { setContentsToMedia(layer); }
    411     virtual bool hasContentsLayer() const { return false; }
     411    virtual bool usesContentsLayer() const { return false; }
    412412
    413413    // Callback from the underlying graphics system to draw layer contents.
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h

    r167144 r167529  
    134134    virtual void setContentsToSolidColor(const Color&);
    135135
    136     virtual bool hasContentsLayer() const { return m_contentsLayer; }
     136    virtual bool usesContentsLayer() const override { return m_contentsLayerPurpose != NoContentsLayer; }
    137137   
    138138    virtual void setShowDebugBorder(bool) override;
  • trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h

    r166889 r167529  
    7777    virtual void flushCompositingStateForThisLayerOnly();
    7878    virtual void setName(const String& name);
    79     virtual bool hasContentsLayer() const { return m_contentsLayer; }
     79    virtual bool usesContentsLayer() const { return m_contentsLayer; }
    8080    virtual PlatformLayer* platformLayer() const { return m_contentsLayer; }
    8181
  • trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h

    r166784 r167529  
    110110    virtual void suspendAnimations(double time) override;
    111111    virtual void resumeAnimations() override;
    112     virtual bool hasContentsLayer() const override { return m_canvasPlatformLayer || m_compositedImage; }
     112    virtual bool usesContentsLayer() const override { return m_canvasPlatformLayer || m_compositedImage; }
    113113
    114114    void syncPendingStateChangesIncludingSubLayers();
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r167472 r167529  
    988988    bool didUpdateContentsRect = false;
    989989    updateDirectlyCompositedContents(isSimpleContainer, didUpdateContentsRect);
    990     if (!didUpdateContentsRect && m_graphicsLayer->hasContentsLayer())
     990    if (!didUpdateContentsRect && m_graphicsLayer->usesContentsLayer())
    991991        resetContentsRect();
    992992
     
    12761276        layer->setPosition(hBarRect.location() - offsetFromRenderer);
    12771277        layer->setSize(hBarRect.size());
    1278         if (layer->hasContentsLayer()) {
     1278        if (layer->usesContentsLayer()) {
    12791279            IntRect barRect = IntRect(IntPoint(), hBarRect.size());
    12801280            layer->setContentsRect(barRect);
    12811281            layer->setContentsClippingRect(barRect);
    12821282        }
    1283         layer->setDrawsContent(m_owningLayer.horizontalScrollbar() && !layer->hasContentsLayer());
     1283        layer->setDrawsContent(m_owningLayer.horizontalScrollbar() && !layer->usesContentsLayer());
    12841284    }
    12851285   
     
    12881288        layer->setPosition(vBarRect.location() - offsetFromRenderer);
    12891289        layer->setSize(vBarRect.size());
    1290         if (layer->hasContentsLayer()) {
     1290        if (layer->usesContentsLayer()) {
    12911291            IntRect barRect = IntRect(IntPoint(), vBarRect.size());
    12921292            layer->setContentsRect(barRect);
    12931293            layer->setContentsClippingRect(barRect);
    12941294        }
    1295         layer->setDrawsContent(m_owningLayer.verticalScrollbar() && !layer->hasContentsLayer());
     1295        layer->setDrawsContent(m_owningLayer.verticalScrollbar() && !layer->usesContentsLayer());
    12961296    }
    12971297
     
    25812581CompositingLayerType RenderLayerBacking::compositingLayerType() const
    25822582{
    2583     if (m_graphicsLayer->hasContentsLayer())
     2583    if (m_graphicsLayer->usesContentsLayer())
    25842584        return MediaCompositingLayer;
    25852585
Note: See TracChangeset for help on using the changeset viewer.