Changeset 166308 in webkit


Ignore:
Timestamp:
Mar 26, 2014 12:36:49 PM (10 years ago)
Author:
Simon Fraser
Message:

Add a custom behavior flag to GraphicsLayer, piped down to PlatformCALayer, for scrolling layers
https://bugs.webkit.org/show_bug.cgi?id=130778

Reviewed by Tim Horton.

Make it possible to put a "custom behavior" flag on a layer so that,
with UI-side compositing, we know to create a specific type of
layer or view for that GraphicsLayer.

Source/WebCore:

  • WebCore.exp.in:
  • platform/graphics/GraphicsLayer.cpp:

(WebCore::GraphicsLayer::GraphicsLayer):

  • platform/graphics/GraphicsLayer.h:

(WebCore::GraphicsLayer::setCustomBehavior):
(WebCore::GraphicsLayer::customBehavior):

  • platform/graphics/ca/GraphicsLayerCA.cpp:

(WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
(WebCore::GraphicsLayerCA::updateCustomBehavior):
(WebCore::GraphicsLayerCA::setCustomBehavior):

  • platform/graphics/ca/GraphicsLayerCA.h:
  • platform/graphics/ca/PlatformCALayer.h:
  • platform/graphics/ca/mac/PlatformCALayerMac.h:
  • platform/graphics/ca/mac/PlatformCALayerMac.mm:

(PlatformCALayerMac::PlatformCALayerMac):

  • rendering/RenderLayerBacking.cpp:

(WebCore::RenderLayerBacking::updateScrollingLayers):

Source/WebKit2:

  • Shared/mac/RemoteLayerTreeTransaction.h:
  • Shared/mac/RemoteLayerTreeTransaction.mm:

(WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
(WebKit::RemoteLayerTreeTransaction::LayerProperties::encode):
(WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
(WebKit::dumpChangedLayers):

  • WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:

(PlatformCALayerRemote::customBehavior):
(PlatformCALayerRemote::updateCustomBehavior):

  • WebProcess/WebPage/mac/PlatformCALayerRemote.h:
Location:
trunk/Source
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r166307 r166308  
     12014-03-26  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Add a custom behavior flag to GraphicsLayer, piped down to PlatformCALayer, for scrolling layers
     4        https://bugs.webkit.org/show_bug.cgi?id=130778
     5
     6        Reviewed by Tim Horton.
     7
     8        Make it possible to put a "custom behavior" flag on a layer so that,
     9        with UI-side compositing, we know to create a specific type of
     10        layer or view for that GraphicsLayer.
     11
     12        * WebCore.exp.in:
     13        * platform/graphics/GraphicsLayer.cpp:
     14        (WebCore::GraphicsLayer::GraphicsLayer):
     15        * platform/graphics/GraphicsLayer.h:
     16        (WebCore::GraphicsLayer::setCustomBehavior):
     17        (WebCore::GraphicsLayer::customBehavior):
     18        * platform/graphics/ca/GraphicsLayerCA.cpp:
     19        (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
     20        (WebCore::GraphicsLayerCA::updateCustomBehavior):
     21        (WebCore::GraphicsLayerCA::setCustomBehavior):
     22        * platform/graphics/ca/GraphicsLayerCA.h:
     23        * platform/graphics/ca/PlatformCALayer.h:
     24        * platform/graphics/ca/mac/PlatformCALayerMac.h:
     25        * platform/graphics/ca/mac/PlatformCALayerMac.mm:
     26        (PlatformCALayerMac::PlatformCALayerMac):
     27        * rendering/RenderLayerBacking.cpp:
     28        (WebCore::RenderLayerBacking::updateScrollingLayers):
     29
    1302014-03-26  Brent Fulgham  <bfulgham@apple.com>
    231
  • trunk/Source/WebCore/WebCore.exp.in

    r166298 r166308  
    546546__ZN7WebCore15GraphicsLayerCA16setMasksToBoundsEb
    547547__ZN7WebCore15GraphicsLayerCA17setContentsOpaqueEb
     548__ZN7WebCore15GraphicsLayerCA17setCustomBehaviorENS_13GraphicsLayer14CustomBehaviorE
    548549__ZN7WebCore15GraphicsLayerCA17suspendAnimationsEd
    549550__ZN7WebCore15GraphicsLayerCA18setAllowTiledLayerEb
  • trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp

    r165804 r166308  
    100100    , m_repaintCount(0)
    101101    , m_customAppearance(NoCustomAppearance)
     102    , m_customBehavior(NoCustomBehavior)
    102103{
    103104#ifndef NDEBUG
  • trunk/Source/WebCore/platform/graphics/GraphicsLayer.h

    r165676 r166308  
    444444    CustomAppearance customAppearance() const { return m_customAppearance; }
    445445
     446    enum CustomBehavior { NoCustomBehavior, CustomScrollingBehavior };
     447    virtual void setCustomBehavior(CustomBehavior customBehavior) { m_customBehavior = customBehavior; }
     448    CustomBehavior customBehavior() const { return m_customBehavior; }
     449
    446450    // z-position is the z-equivalent of position(). It's only used for debugging purposes.
    447451    virtual float zPosition() const { return m_zPosition; }
     
    612616    int m_repaintCount;
    613617    CustomAppearance m_customAppearance;
     618    CustomBehavior m_customBehavior;
    614619};
    615620
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp

    r165863 r166308  
    14101410        updateCustomAppearance();
    14111411
     1412    if (m_uncommittedChanges & CustomBehaviorChanged)
     1413        updateCustomBehavior();
     1414
    14121415    if (m_uncommittedChanges & ChildrenChanged) {
    14131416        updateSublayerList();
     
    29532956}
    29542957
     2958void GraphicsLayerCA::updateCustomBehavior()
     2959{
     2960    m_layer->updateCustomBehavior(m_customBehavior);
     2961}
     2962
    29552963void GraphicsLayerCA::setShowDebugBorder(bool showBorder)
    29562964{
     
    30523060    GraphicsLayer::setCustomAppearance(customAppearance);
    30533061    noteLayerPropertyChanged(CustomAppearanceChanged);
     3062}
     3063
     3064void GraphicsLayerCA::setCustomBehavior(CustomBehavior customBehavior)
     3065{
     3066    if (customBehavior == m_customBehavior)
     3067        return;
     3068
     3069    GraphicsLayer::setCustomBehavior(customBehavior);
     3070    noteLayerPropertyChanged(CustomBehaviorChanged);
    30543071}
    30553072
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h

    r165676 r166308  
    139139
    140140    virtual void setCustomAppearance(CustomAppearance);
     141    virtual void setCustomBehavior(CustomBehavior);
    141142
    142143    virtual void layerDidDisplay(PlatformLayer*);
     
    390391    void updateContentsScale(float pageScaleFactor);
    391392    void updateCustomAppearance();
    392    
     393    void updateCustomBehavior();
     394
    393395    enum StructuralLayerPurpose {
    394396        NoStructuralLayer = 0,
     
    448450        DebugIndicatorsChanged = 1 << 30,
    449451        CustomAppearanceChanged = 1 << 31,
    450         BlendModeChanged        = 1 << 32
    451     };
    452     typedef unsigned LayerChangeFlags;
     452        CustomBehaviorChanged = 1 << 32,
     453        BlendModeChanged = 1 << 33
     454    };
     455    typedef uint64_t LayerChangeFlags;
    453456    enum ScheduleFlushOrNot { ScheduleFlush, DontScheduleFlush };
    454457    void noteLayerPropertyChanged(LayerChangeFlags, ScheduleFlushOrNot = ScheduleFlush);
  • trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h

    r165676 r166308  
    198198    virtual void updateCustomAppearance(GraphicsLayer::CustomAppearance) = 0;
    199199
     200    virtual GraphicsLayer::CustomBehavior customBehavior() const = 0;
     201    virtual void updateCustomBehavior(GraphicsLayer::CustomBehavior) = 0;
     202
    200203    virtual TiledBacking* tiledBacking() = 0;
    201204
  • trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h

    r165676 r166308  
    137137    virtual void updateCustomAppearance(GraphicsLayer::CustomAppearance) override;
    138138
     139    virtual GraphicsLayer::CustomBehavior customBehavior() const override { return m_customBehavior; }
     140    virtual void updateCustomBehavior(GraphicsLayer::CustomBehavior) override { }
     141
    139142    virtual TiledBacking* tiledBacking() override;
    140143
     
    158161    OwnPtr<PlatformCALayerList> m_customSublayers;
    159162    GraphicsLayer::CustomAppearance m_customAppearance;
     163    GraphicsLayer::CustomBehavior m_customBehavior;
    160164};
    161165
  • trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm

    r165676 r166308  
    166166    : PlatformCALayer(layerType, owner)
    167167    , m_customAppearance(GraphicsLayer::NoCustomAppearance)
     168    , m_customBehavior(GraphicsLayer::NoCustomBehavior)
    168169{
    169170    Class layerClass = Nil;
     
    206207    : PlatformCALayer([layer isKindOfClass:getAVPlayerLayerClass()] ? LayerTypeAVPlayerLayer : LayerTypeCustom, owner)
    207208    , m_customAppearance(GraphicsLayer::NoCustomAppearance)
     209    , m_customBehavior(GraphicsLayer::NoCustomBehavior)
    208210{
    209211    m_layer = layer;
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r166304 r166308  
    14321432        m_scrollingLayer->setDrawsContent(false);
    14331433        m_scrollingLayer->setMasksToBounds(true);
    1434 
     1434#if PLATFORM(IOS)
     1435        m_scrollingLayer->setCustomBehavior(GraphicsLayer::CustomScrollingBehavior);
     1436#endif
    14351437        // Inner layer which renders the content that scrolls.
    14361438        m_scrollingContentsLayer = createGraphicsLayer("Scrolled Contents");
  • trunk/Source/WebKit2/ChangeLog

    r166301 r166308  
     12014-03-26  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Add a custom behavior flag to GraphicsLayer, piped down to PlatformCALayer, for scrolling layers
     4        https://bugs.webkit.org/show_bug.cgi?id=130778
     5
     6        Reviewed by Tim Horton.
     7
     8        Make it possible to put a "custom behavior" flag on a layer so that,
     9        with UI-side compositing, we know to create a specific type of
     10        layer or view for that GraphicsLayer.
     11
     12        * Shared/mac/RemoteLayerTreeTransaction.h:
     13        * Shared/mac/RemoteLayerTreeTransaction.mm:
     14        (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
     15        (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode):
     16        (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
     17        (WebKit::dumpChangedLayers):
     18        * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
     19        (PlatformCALayerRemote::customBehavior):
     20        (PlatformCALayerRemote::updateCustomBehavior):
     21        * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
     22
    1232014-03-26  Zoltan Horvath  <zoltan@webkit.org>
    224
  • trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h

    r165652 r166308  
    7676        FiltersChanged = 1 << 25,
    7777        EdgeAntialiasingMaskChanged = 1 << 26,
    78         CustomAppearanceChanged = 1 << 27
     78        CustomAppearanceChanged = 1 << 27,
     79        CustomBehaviorChanged = 1 << 28
    7980    };
    8081    typedef unsigned LayerChange;
     
    128129        unsigned edgeAntialiasingMask;
    129130        WebCore::GraphicsLayer::CustomAppearance customAppearance;
     131        WebCore::GraphicsLayer::CustomBehavior customBehavior;
    130132        WebCore::PlatformCALayer::FilterType minificationFilter;
    131133        WebCore::PlatformCALayer::FilterType magnificationFilter;
  • trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm

    r165863 r166308  
    8888    , edgeAntialiasingMask(kCALayerLeftEdge | kCALayerRightEdge | kCALayerBottomEdge | kCALayerTopEdge)
    8989    , customAppearance(GraphicsLayer::NoCustomAppearance)
     90    , customBehavior(GraphicsLayer::NoCustomBehavior)
    9091    , minificationFilter(PlatformCALayer::FilterType::Linear)
    9192    , magnificationFilter(PlatformCALayer::FilterType::Linear)
     
    117118    , edgeAntialiasingMask(other.edgeAntialiasingMask)
    118119    , customAppearance(other.customAppearance)
     120    , customBehavior(other.customBehavior)
    119121    , minificationFilter(other.minificationFilter)
    120122    , magnificationFilter(other.magnificationFilter)
     
    225227    if (changedProperties & CustomAppearanceChanged)
    226228        encoder.encodeEnum(customAppearance);
     229
     230    if (changedProperties & CustomBehaviorChanged)
     231        encoder.encodeEnum(customBehavior);
    227232}
    228233
     
    385390    if (result.changedProperties & CustomAppearanceChanged) {
    386391        if (!decoder.decodeEnum(result.customAppearance))
     392            return false;
     393    }
     394
     395    if (result.changedProperties & CustomBehaviorChanged) {
     396        if (!decoder.decodeEnum(result.customBehavior))
    387397            return false;
    388398    }
     
    805815        if (layerProperties.changedProperties & RemoteLayerTreeTransaction::CustomAppearanceChanged)
    806816            dumpProperty<GraphicsLayer::CustomAppearance>(ts, "customAppearance", layerProperties.customAppearance);
     817
     818        if (layerProperties.changedProperties & RemoteLayerTreeTransaction::CustomBehaviorChanged)
     819            dumpProperty<GraphicsLayer::CustomBehavior>(ts, "customBehavior", layerProperties.customBehavior);
    807820
    808821        ts << ")";
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp

    r165863 r166308  
    564564}
    565565
     566GraphicsLayer::CustomBehavior PlatformCALayerRemote::customBehavior() const
     567{
     568    return m_properties.customBehavior;
     569}
     570
     571void PlatformCALayerRemote::updateCustomBehavior(GraphicsLayer::CustomBehavior customBehavior)
     572{
     573    m_properties.customBehavior = customBehavior;
     574    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::CustomBehaviorChanged);
     575}
     576
    566577PassRefPtr<PlatformCALayer> PlatformCALayerRemote::createCompatibleLayer(PlatformCALayer::LayerType layerType, PlatformCALayerClient* client) const
    567578{
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h

    r165676 r166308  
    139139    virtual void updateCustomAppearance(WebCore::GraphicsLayer::CustomAppearance) override;
    140140
     141    virtual WebCore::GraphicsLayer::CustomBehavior customBehavior() const override;
     142    virtual void updateCustomBehavior(WebCore::GraphicsLayer::CustomBehavior) override;
     143
    141144    virtual WebCore::TiledBacking* tiledBacking() override { return nullptr; }
    142145
Note: See TracChangeset for help on using the changeset viewer.