⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 130676 in webkit


Ignore:
Timestamp:
Oct 8, 2012, 1:10:22 PM (14 years ago)
Author:
Simon Fraser
Message:

Some GraphicsLayer cleanup to separate the concepts of using a tile cache, and being the main tile cache layer
​https://bugs.webkit.org/show_bug.cgi?id=98574

Reviewed by Dean Jackson.

GraphicsLayerCA assumed that using a TileCache equated to being the main page tile
cache layer, which has some special considerations. Make these two concepts separate
to get closer to being able to use TileCaches in place of CATiledLayer.

Source/WebCore:

  • platform/graphics/GraphicsLayer.h:

(GraphicsLayer): Remove m_usingTileCache member, which was not appropriate
for this class to have.

  • platform/graphics/GraphicsLayer.cpp:

(WebCore::GraphicsLayer::GraphicsLayer): Remove init of m_usingTileCache.
(WebCore::GraphicsLayer::debugBorderInfo): Can no longer use m_usingTileCache to
get the blue color, so moved code into a virtual debugBorderInfo() method.
(WebCore::GraphicsLayer::updateDebugIndicators): Call the virtual debugBorderInfo().

  • platform/graphics/GraphicsLayerClient.h: Remove the usingTileCache() callback;

we now just cache this information in the GraphicsLayerCA on creation.

  • platform/graphics/ca/GraphicsLayerCA.cpp:

(WebCore::GraphicsLayerCA::GraphicsLayerCA): Init m_isPageTileCacheLayer to false,
then set to m_isPageTileCacheLayer if the client says we should create a tile cache.
(WebCore::GraphicsLayerCA::platformCALayerShowRepaintCounter): Overidden to avoid duplicate repaint
counters in the top-left tile.
(WebCore::GraphicsLayerCA::updateLayerBackgroundColor): If this layer is the page tile cache layer,
we allow setting of its background color.
(WebCore::GraphicsLayerCA::debugBorderInfo): Overidden to use a blue color for tiles.
(WebCore::GraphicsLayerCA::requiresTiledLayer): Don't make CATiledLayers for the page tile cache.

  • platform/graphics/ca/GraphicsLayerCA.h:

(GraphicsLayerCA):

  • platform/graphics/ca/PlatformCALayerClient.h:

(PlatformCALayerClient): Need to pass the platform layer into platformCALayerShowRepaintCounter()
so we can distinguish between calls for tiles, and calls for the tile cache layer itself.

  • platform/graphics/ca/mac/TileCache.mm:

(WebCore::TileCache::shouldShowRepaintCounters): Pass 0 to platformCALayerShowRepaintCounter() to
indicate that we're asking about a tile.

  • platform/graphics/mac/WebLayer.mm:

(drawLayerContents): Now we can just rely on platformCALayerShowRepaintCounter() to tell us whether
to draw the repaint counter.
(-[WebLayer setNeedsDisplayInRect:]):

  • platform/graphics/mac/WebTiledLayer.mm:

(-[WebTiledLayer setNeedsDisplayInRect:]):

  • rendering/RenderLayerBacking.h:

(WebCore::RenderLayerBacking::usingTileCache):
(RenderLayerBacking):

  • rendering/RenderLayerCompositor.cpp:

(WebCore::RenderLayerCompositor::documentBackgroundColorDidChange): We can ask the RenderLayerBacking
whether it's for the tile cache, rather than going to the GraphicsLayer.

  • platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp:

(WebCore::MediaPlayerPrivateQuickTimeVisualContext::LayerClient::platformCALayerShowRepaintCounter):

Source/WebKit/win:

  • FullscreenVideoController.cpp:

(FullscreenVideoController::LayerClient::platformCALayerShowRepaintCounter):

Location:
trunk/Source
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r130672 r130676  
     12012-10-08  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Some GraphicsLayer cleanup to separate the concepts of using a tile cache, and being the main tile cache layer
     4        https://bugs.webkit.org/show_bug.cgi?id=98574
     5
     6        Reviewed by Dean Jackson.
     7
     8        GraphicsLayerCA assumed that using a TileCache equated to being the main page tile
     9        cache layer, which has some special considerations. Make these two concepts separate
     10        to get closer to being able to use TileCaches in place of CATiledLayer.
     11
     12        * platform/graphics/GraphicsLayer.h:
     13        (GraphicsLayer): Remove m_usingTileCache member, which was not appropriate
     14        for this class to have.
     15        * platform/graphics/GraphicsLayer.cpp:
     16        (WebCore::GraphicsLayer::GraphicsLayer): Remove init of m_usingTileCache.
     17        (WebCore::GraphicsLayer::debugBorderInfo): Can no longer use m_usingTileCache to
     18        get the blue color, so moved code into a virtual debugBorderInfo() method.
     19        (WebCore::GraphicsLayer::updateDebugIndicators): Call the virtual debugBorderInfo().
     20        * platform/graphics/GraphicsLayerClient.h: Remove the usingTileCache() callback;
     21        we now just cache this information in the GraphicsLayerCA on creation.
     22        * platform/graphics/ca/GraphicsLayerCA.cpp:
     23        (WebCore::GraphicsLayerCA::GraphicsLayerCA): Init m_isPageTileCacheLayer to false,
     24        then set to m_isPageTileCacheLayer if the client says we should create a tile cache.
     25        (WebCore::GraphicsLayerCA::platformCALayerShowRepaintCounter): Overidden to avoid duplicate repaint
     26        counters in the top-left tile.
     27        (WebCore::GraphicsLayerCA::updateLayerBackgroundColor): If this layer is the page tile cache layer,
     28        we allow setting of its background color.
     29        (WebCore::GraphicsLayerCA::debugBorderInfo): Overidden to use a blue color for tiles.
     30        (WebCore::GraphicsLayerCA::requiresTiledLayer): Don't make CATiledLayers for the page tile cache.
     31        * platform/graphics/ca/GraphicsLayerCA.h:
     32        (GraphicsLayerCA):
     33        * platform/graphics/ca/PlatformCALayerClient.h:
     34        (PlatformCALayerClient): Need to pass the platform layer into platformCALayerShowRepaintCounter()
     35        so we can distinguish between calls for tiles, and calls for the tile cache layer itself.
     36        * platform/graphics/ca/mac/TileCache.mm:
     37        (WebCore::TileCache::shouldShowRepaintCounters): Pass 0 to platformCALayerShowRepaintCounter() to
     38        indicate that we're asking about a tile.
     39        * platform/graphics/mac/WebLayer.mm:
     40        (drawLayerContents): Now we can just rely on platformCALayerShowRepaintCounter() to tell us whether
     41        to draw the repaint counter.
     42        (-[WebLayer setNeedsDisplayInRect:]):
     43        * platform/graphics/mac/WebTiledLayer.mm:
     44        (-[WebTiledLayer setNeedsDisplayInRect:]):
     45        * rendering/RenderLayerBacking.h:
     46        (WebCore::RenderLayerBacking::usingTileCache):
     47        (RenderLayerBacking):
     48        * rendering/RenderLayerCompositor.cpp:
     49        (WebCore::RenderLayerCompositor::documentBackgroundColorDidChange): We can ask the RenderLayerBacking
     50        whether it's for the tile cache, rather than going to the GraphicsLayer.
     51        * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp:
     52        (WebCore::MediaPlayerPrivateQuickTimeVisualContext::LayerClient::platformCALayerShowRepaintCounter):
     53
    1542012-10-08  Huang Dongsung  <luxtella@company100.net>
    255
  • trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp

    r130185 r130676  
    8181    , m_maintainsPixelAlignment(false)
    8282    , m_appliesPageScale(false)
    83     , m_usingTileCache(false)
    8483    , m_paintingPhase(GraphicsLayerPaintAllWithOverflowClip)
    8584    , m_contentsOrientation(CompositingCoordinatesTopDown)
    … …  
    340339}
    341340
     341void GraphicsLayer::getDebugBorderInfo(Color& color, float& width) const
     342{
     343    if (drawsContent()) {
     344        if (m_usingTiledLayer) {
     345            color = Color(255, 128, 0, 128); // tiled layer: orange
     346            width = 2;
     347            return;
     348        }
     349
     350        color = Color(0, 128, 32, 128); // normal layer: green
     351        width = 2;
     352        return;
     353    }
     354   
     355    if (masksToBounds()) {
     356        color = Color(128, 255, 255, 48); // masking layer: pale blue
     357        width = 20;
     358        return;
     359    }
     360       
     361    color = Color(255, 255, 0, 192); // container: yellow
     362    width = 2;
     363}
     364
    342365void GraphicsLayer::updateDebugIndicators()
    343366{
    344     if (GraphicsLayer::showDebugBorders()) {
    345         if (drawsContent()) {
    346             if (m_usingTileCache) // tile cache layer: dark blue
    347                 setDebugBorder(Color(0, 0, 128, 128), 0.5);
    348             else if (m_usingTiledLayer)
    349                 setDebugBorder(Color(255, 128, 0, 128), 2); // tiled layer: orange
    350             else
    351                 setDebugBorder(Color(0, 128, 32, 128), 2); // normal layer: green
    352         } else if (masksToBounds()) {
    353             setDebugBorder(Color(128, 255, 255, 48), 20); // masking layer: pale blue
    354         } else
    355             setDebugBorder(Color(255, 255, 0, 192), 2); // container: yellow
    356     }
     367    if (!GraphicsLayer::showDebugBorders())
     368        return;
     369
     370    Color borderColor;
     371    float width = 0;
     372    getDebugBorderInfo(borderColor, width);
     373    setDebugBorder(borderColor, width);
    357374}
    358375
  • trunk/Source/WebCore/platform/graphics/GraphicsLayer.h

    r130439 r130676  
    437437
    438438    void dumpProperties(TextStream&, int indent, LayerTreeAsTextBehavior) const;
     439    virtual void getDebugBorderInfo(Color&, float& width) const;
    439440
    440441    GraphicsLayerClient* m_client;
    … …  
    472473    bool m_maintainsPixelAlignment : 1;
    473474    bool m_appliesPageScale : 1; // Set for the layer which has the page scale applied to it.
    474     bool m_usingTileCache : 1;
    475475
    476476    GraphicsLayerPaintingPhase m_paintingPhase;
  • trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h

    r130439 r130676  
    5959
    6060    virtual bool shouldUseTileCache(const GraphicsLayer*) const { return false; }
    61     virtual bool usingTileCache(const GraphicsLayer*) const { return false; }
    6261   
    6362    // Callback for when hardware-accelerated animation started.
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp

    r130612 r130676  
    275275    , m_contentsLayerHasBackgroundColor(false)
    276276    , m_allowTiledLayer(true)
     277    , m_isPageTileCacheLayer(false)
    277278    , m_uncommittedChanges(0)
    278279{
    … …  
    280281    if (client && client->shouldUseTileCache(this)) {
    281282        layerType = PlatformCALayer::LayerTypeTileCacheLayer;
    282         m_usingTileCache = true;
     283        m_isPageTileCacheLayer = true;
    283284    }
    284285
    … …  
    993994}
    994995
     996bool GraphicsLayerCA::platformCALayerShowRepaintCounter(PlatformCALayer* platformLayer) const
     997{
     998    // The repaint counters are painted into the TileCache tiles (which have no corresponding platform layer),
     999    // so we don't want to overpaint the repaint counter when called with the TileCache's own layer.
     1000    if (m_isPageTileCacheLayer && platformLayer)
     1001        return false;
     1002   
     1003    return showRepaintCounter();
     1004}
     1005
    9951006void GraphicsLayerCA::platformCALayerPaintContents(GraphicsContext& context, const IntRect& clip)
    9961007{
    … …  
    14981509void GraphicsLayerCA::updateLayerBackgroundColor()
    14991510{
    1500     if (m_layer->layerType() == PlatformCALayer::LayerTypeTileCacheLayer) {
     1511    if (m_isPageTileCacheLayer) {
    15011512        m_layer->setBackgroundColor(m_backgroundColor);
    15021513        return;
    … …  
    23922403}
    23932404
     2405void GraphicsLayerCA::getDebugBorderInfo(Color& color, float& width) const
     2406{
     2407    if (m_isPageTileCacheLayer) {
     2408        color = Color(0, 0, 128, 128); // tile cache layer: dark blue
     2409        width = 0.5;
     2410        return;
     2411    }
     2412
     2413    GraphicsLayer::getDebugBorderInfo(color, width);
     2414}
     2415
    23942416void GraphicsLayerCA::setDebugBorder(const Color& color, float borderWidth)
    23952417{   
    … …  
    24292451bool GraphicsLayerCA::requiresTiledLayer(float pageScaleFactor) const
    24302452{
    2431     if (!m_drawsContent || !m_allowTiledLayer || m_layer->layerType() == PlatformCALayer::LayerTypeTileCacheLayer)
     2453    if (!m_drawsContent || !m_allowTiledLayer || m_isPageTileCacheLayer)
    24322454        return false;
    24332455
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h

    r130439 r130676  
    154154    virtual void platformCALayerPaintContents(GraphicsContext&, const IntRect& clip);
    155155    virtual bool platformCALayerShowDebugBorders() const { return showDebugBorders(); }
    156     virtual bool platformCALayerShowRepaintCounter() const { return showRepaintCounter(); }
     156    virtual bool platformCALayerShowRepaintCounter(PlatformCALayer*) const;
    157157    virtual int platformCALayerIncrementRepaintCount() { return incrementRepaintCount(); }
    158158
    … …  
    228228
    229229    virtual void setReplicatedByLayer(GraphicsLayer*);
     230
     231    virtual void getDebugBorderInfo(Color&, float& width) const;
    230232
    231233    void computePixelAlignment(float pixelAlignmentScale, const FloatPoint& positionRelativeToBase,
    … …  
    404406    bool m_contentsLayerHasBackgroundColor : 1;
    405407    bool m_allowTiledLayer : 1;
     408    bool m_isPageTileCacheLayer : 1;
    406409
    407410    RetainPtr<CGImageRef> m_uncorrectedContentsImage;
  • trunk/Source/WebCore/platform/graphics/ca/PlatformCALayerClient.h

    r127757 r130676  
    5353    virtual void platformCALayerPaintContents(GraphicsContext&, const IntRect& inClip) = 0;
    5454    virtual bool platformCALayerShowDebugBorders() const = 0;
    55     virtual bool platformCALayerShowRepaintCounter() const = 0;
     55    virtual bool platformCALayerShowRepaintCounter(PlatformCALayer*) const = 0;
    5656    virtual int platformCALayerIncrementRepaintCount() = 0;
    5757   
  • trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm

    r130612 r130676  
    481481        return false;
    482482
    483     return layerContents->platformCALayerShowRepaintCounter();
     483    return layerContents->platformCALayerShowRepaintCounter(0);
    484484}
    485485
  • trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp

    r95901 r130676  
    9797#endif
    9898
    99     if (owner()->owner()->platformCALayerShowRepaintCounter()) {
     99    if (owner()->owner()->platformCALayerShowRepaintCounter(owner())) {
    100100        FontCachePurgePreventer fontCachePurgePreventer;
    101101
    … …  
    166166            CACFLayerSetNeedsDisplay(tileAtIndex(i), dirtyRect ? &rect : 0);
    167167
    168         if (m_owner->owner() && m_owner->owner()->platformCALayerShowRepaintCounter()) {
     168        if (m_owner->owner() && m_owner->owner()->platformCALayerShowRepaintCounter(m_owner)) {
    169169            CGRect layerBounds = m_owner->bounds();
    170170            CGRect indicatorRect = CGRectMake(layerBounds.origin.x, layerBounds.origin.y, 80, 25);
    … …  
    173173    } else if (owner()->layerType() == PlatformCALayer::LayerTypeWebLayer) {
    174174        if (owner() && owner()->owner()) {
    175             if (owner()->owner()->platformCALayerShowRepaintCounter()) {
     175            if (owner()->owner()->platformCALayerShowRepaintCounter(owner())) {
    176176                FloatRect layerBounds = owner()->bounds();
    177177                FloatRect repaintCounterRect = layerBounds;
  • trunk/Source/WebCore/platform/graphics/mac/WebLayer.mm

    r122670 r130676  
    110110    layerContents = platformLayer->owner();
    111111    ASSERT(layerContents);
    112     if (platformLayer->layerType() != PlatformCALayer::LayerTypeTileCacheLayer && layerContents && layerContents->platformCALayerShowRepaintCounter()) {
     112    if (layerContents && layerContents->platformCALayerShowRepaintCounter(platformLayer)) {
    113113        bool isTiledLayer = [layer isKindOfClass:[CATiledLayer class]];
    114114
    … …  
    179179            [super setNeedsDisplayInRect:dirtyRect];
    180180
    181             if (layerOwner->platformCALayerShowRepaintCounter()) {
     181            if (layerOwner->platformCALayerShowRepaintCounter(platformLayer)) {
    182182                CGRect bounds = [self bounds];
    183183                CGRect indicatorRect = CGRectMake(bounds.origin.x, bounds.origin.y, 52, 27);
  • trunk/Source/WebCore/platform/graphics/mac/WebTiledLayer.mm

    r122145 r130676  
    8585            [super setNeedsDisplayInRect:dirtyRect];
    8686
    87             if (layerOwner->platformCALayerShowRepaintCounter()) {
     87            if (layerOwner->platformCALayerShowRepaintCounter(platformLayer)) {
    8888                CGRect bounds = [self bounds];
    8989                CGRect indicatorRect = CGRectMake(bounds.origin.x, bounds.origin.y, 52, 27);
  • trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp

    r121053 r130676  
    102102    virtual void platformCALayerPaintContents(GraphicsContext&, const IntRect& inClip) { }
    103103    virtual bool platformCALayerShowDebugBorders() const { return false; }
    104     virtual bool platformCALayerShowRepaintCounter() const { return false; }
     104    virtual bool platformCALayerShowRepaintCounter(PlatformCALayer*) const { return false; }
    105105    virtual int platformCALayerIncrementRepaintCount() { return 0; }
    106106
  • trunk/Source/WebCore/rendering/RenderLayerBacking.h

    r130439 r130676  
    134134    void positionOverflowControlsLayers(const IntSize& offsetFromRoot);
    135135
     136    bool usingTileCache() const { return m_usingTiledCacheLayer; }
     137
    136138    // GraphicsLayerClient interface
    137139    virtual bool shouldUseTileCache(const GraphicsLayer*) const;
    138     virtual bool usingTileCache(const GraphicsLayer*) const { return m_usingTiledCacheLayer; }
    139140    virtual void notifyAnimationStarted(const GraphicsLayer*, double startTime);
    140141    virtual void notifyFlushRequired(const GraphicsLayer*);
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r130439 r130676  
    19361936{
    19371937    RenderLayerBacking* backing = rootRenderLayer()->backing();
    1938     if (!backing)
     1938    if (!backing || !backing->usingTileCache())
    19391939        return;
    19401940
    19411941    GraphicsLayer* graphicsLayer = backing->graphicsLayer();
    1942     if (!graphicsLayer->client()->usingTileCache(graphicsLayer))
    1943         return;
    1944 
    19451942    Color backgroundColor = m_renderView->frameView()->documentBackgroundColor();
    19461943    if (!backgroundColor.isValid() || backgroundColor.hasAlpha())
  • trunk/Source/WebKit/win/ChangeLog

    r130612 r130676  
     12012-10-08  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Some GraphicsLayer cleanup to separate the concepts of using a tile cache, and being the main tile cache layer
     4        https://bugs.webkit.org/show_bug.cgi?id=98574
     5
     6        Reviewed by Dean Jackson.
     7
     8        GraphicsLayerCA assumed that using a TileCache equated to being the main page tile
     9        cache layer, which has some special considerations. Make these two concepts separate
     10        to get closer to being able to use TileCaches in place of CATiledLayer.
     11
     12        * FullscreenVideoController.cpp:
     13        (FullscreenVideoController::LayerClient::platformCALayerShowRepaintCounter):
     14
    1152012-10-07  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
    216
  • trunk/Source/WebKit/win/FullscreenVideoController.cpp

    r124719 r130676  
    190190    virtual void platformCALayerPaintContents(GraphicsContext&, const IntRect& inClip) { }
    191191    virtual bool platformCALayerShowDebugBorders() const { return false; }
    192     virtual bool platformCALayerShowRepaintCounter() const { return false; }
     192    virtual bool platformCALayerShowRepaintCounter(PlatformCALayer*) const { return false; }
    193193    virtual int platformCALayerIncrementRepaintCount() { return 0; }
    194194
Note: See TracChangeset for help on using the changeset viewer.