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:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166308
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2014-03-26 Simon Fraser <simon.fraser@apple.com>
+
+ 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.
+
+ * 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):
+
2014-03-26 Brent Fulgham <bfulgham@apple.com>
Unreviewed test correction.
__ZN7WebCore15GraphicsLayerCA16resumeAnimationsEv
__ZN7WebCore15GraphicsLayerCA16setMasksToBoundsEb
__ZN7WebCore15GraphicsLayerCA17setContentsOpaqueEb
+__ZN7WebCore15GraphicsLayerCA17setCustomBehaviorENS_13GraphicsLayer14CustomBehaviorE
__ZN7WebCore15GraphicsLayerCA17suspendAnimationsEd
__ZN7WebCore15GraphicsLayerCA18setAllowTiledLayerEb
__ZN7WebCore15GraphicsLayerCA18setBackgroundColorERKNS_5ColorE
, m_replicatedLayer(0)
, m_repaintCount(0)
, m_customAppearance(NoCustomAppearance)
+ , m_customBehavior(NoCustomBehavior)
{
#ifndef NDEBUG
if (m_client)
virtual void setCustomAppearance(CustomAppearance customAppearance) { m_customAppearance = customAppearance; }
CustomAppearance customAppearance() const { return m_customAppearance; }
+ enum CustomBehavior { NoCustomBehavior, CustomScrollingBehavior };
+ virtual void setCustomBehavior(CustomBehavior customBehavior) { m_customBehavior = customBehavior; }
+ CustomBehavior customBehavior() const { return m_customBehavior; }
+
// z-position is the z-equivalent of position(). It's only used for debugging purposes.
virtual float zPosition() const { return m_zPosition; }
virtual void setZPosition(float);
int m_repaintCount;
CustomAppearance m_customAppearance;
+ CustomBehavior m_customBehavior;
};
#define GRAPHICSLAYER_TYPE_CASTS(ToValueTypeName, predicate) \
if (m_uncommittedChanges & CustomAppearanceChanged)
updateCustomAppearance();
+ if (m_uncommittedChanges & CustomBehaviorChanged)
+ updateCustomBehavior();
+
if (m_uncommittedChanges & ChildrenChanged) {
updateSublayerList();
// Sublayers may set this flag again, so clear it to avoid always updating sublayers in commitLayerChangesAfterSublayers().
m_layer->updateCustomAppearance(m_customAppearance);
}
+void GraphicsLayerCA::updateCustomBehavior()
+{
+ m_layer->updateCustomBehavior(m_customBehavior);
+}
+
void GraphicsLayerCA::setShowDebugBorder(bool showBorder)
{
if (showBorder == m_showDebugBorder)
noteLayerPropertyChanged(CustomAppearanceChanged);
}
+void GraphicsLayerCA::setCustomBehavior(CustomBehavior customBehavior)
+{
+ if (customBehavior == m_customBehavior)
+ return;
+
+ GraphicsLayer::setCustomBehavior(customBehavior);
+ noteLayerPropertyChanged(CustomBehaviorChanged);
+}
+
bool GraphicsLayerCA::requiresTiledLayer(float pageScaleFactor) const
{
if (!m_drawsContent || !m_allowTiledLayer || m_isPageTiledBackingLayer)
virtual void setDebugBorder(const Color&, float borderWidth);
virtual void setCustomAppearance(CustomAppearance);
+ virtual void setCustomBehavior(CustomBehavior);
virtual void layerDidDisplay(PlatformLayer*);
void updateTiles();
void updateContentsScale(float pageScaleFactor);
void updateCustomAppearance();
-
+ void updateCustomBehavior();
+
enum StructuralLayerPurpose {
NoStructuralLayer = 0,
StructuralLayerForPreserves3D,
TilesAdded = 1 < 29,
DebugIndicatorsChanged = 1 << 30,
CustomAppearanceChanged = 1 << 31,
- BlendModeChanged = 1 << 32
+ CustomBehaviorChanged = 1 << 32,
+ BlendModeChanged = 1 << 33
};
- typedef unsigned LayerChangeFlags;
+ typedef uint64_t LayerChangeFlags;
enum ScheduleFlushOrNot { ScheduleFlush, DontScheduleFlush };
void noteLayerPropertyChanged(LayerChangeFlags, ScheduleFlushOrNot = ScheduleFlush);
void noteSublayersChanged(ScheduleFlushOrNot = ScheduleFlush);
virtual GraphicsLayer::CustomAppearance customAppearance() const = 0;
virtual void updateCustomAppearance(GraphicsLayer::CustomAppearance) = 0;
+ virtual GraphicsLayer::CustomBehavior customBehavior() const = 0;
+ virtual void updateCustomBehavior(GraphicsLayer::CustomBehavior) = 0;
+
virtual TiledBacking* tiledBacking() = 0;
#if PLATFORM(WIN)
virtual GraphicsLayer::CustomAppearance customAppearance() const override { return m_customAppearance; }
virtual void updateCustomAppearance(GraphicsLayer::CustomAppearance) override;
+ virtual GraphicsLayer::CustomBehavior customBehavior() const override { return m_customBehavior; }
+ virtual void updateCustomBehavior(GraphicsLayer::CustomBehavior) override { }
+
virtual TiledBacking* tiledBacking() override;
virtual PassRefPtr<PlatformCALayer> clone(PlatformCALayerClient* owner) const override;
RetainPtr<NSObject> m_delegate;
OwnPtr<PlatformCALayerList> m_customSublayers;
GraphicsLayer::CustomAppearance m_customAppearance;
+ GraphicsLayer::CustomBehavior m_customBehavior;
};
PLATFORM_CALAYER_TYPE_CASTS(PlatformCALayerMac, isPlatformCALayerMac())
PlatformCALayerMac::PlatformCALayerMac(LayerType layerType, PlatformCALayerClient* owner)
: PlatformCALayer(layerType, owner)
, m_customAppearance(GraphicsLayer::NoCustomAppearance)
+ , m_customBehavior(GraphicsLayer::NoCustomBehavior)
{
Class layerClass = Nil;
switch (layerType) {
PlatformCALayerMac::PlatformCALayerMac(PlatformLayer* layer, PlatformCALayerClient* owner)
: PlatformCALayer([layer isKindOfClass:getAVPlayerLayerClass()] ? LayerTypeAVPlayerLayer : LayerTypeCustom, owner)
, m_customAppearance(GraphicsLayer::NoCustomAppearance)
+ , m_customBehavior(GraphicsLayer::NoCustomBehavior)
{
m_layer = layer;
commonInit();
m_scrollingLayer = createGraphicsLayer("Scrolling container");
m_scrollingLayer->setDrawsContent(false);
m_scrollingLayer->setMasksToBounds(true);
-
+#if PLATFORM(IOS)
+ m_scrollingLayer->setCustomBehavior(GraphicsLayer::CustomScrollingBehavior);
+#endif
// Inner layer which renders the content that scrolls.
m_scrollingContentsLayer = createGraphicsLayer("Scrolled Contents");
m_scrollingContentsLayer->setDrawsContent(true);
+2014-03-26 Simon Fraser <simon.fraser@apple.com>
+
+ 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.
+
+ * 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:
+
2014-03-26 Zoltan Horvath <zoltan@webkit.org>
[CSS Shapes] Remove shape-inside support
BackingStoreChanged = 1 << 24,
FiltersChanged = 1 << 25,
EdgeAntialiasingMaskChanged = 1 << 26,
- CustomAppearanceChanged = 1 << 27
+ CustomAppearanceChanged = 1 << 27,
+ CustomBehaviorChanged = 1 << 28
};
typedef unsigned LayerChange;
WebCore::Color borderColor;
unsigned edgeAntialiasingMask;
WebCore::GraphicsLayer::CustomAppearance customAppearance;
+ WebCore::GraphicsLayer::CustomBehavior customBehavior;
WebCore::PlatformCALayer::FilterType minificationFilter;
WebCore::PlatformCALayer::FilterType magnificationFilter;
bool hidden;
, borderColor(Color::black)
, edgeAntialiasingMask(kCALayerLeftEdge | kCALayerRightEdge | kCALayerBottomEdge | kCALayerTopEdge)
, customAppearance(GraphicsLayer::NoCustomAppearance)
+ , customBehavior(GraphicsLayer::NoCustomBehavior)
, minificationFilter(PlatformCALayer::FilterType::Linear)
, magnificationFilter(PlatformCALayer::FilterType::Linear)
, hidden(false)
, borderColor(other.borderColor)
, edgeAntialiasingMask(other.edgeAntialiasingMask)
, customAppearance(other.customAppearance)
+ , customBehavior(other.customBehavior)
, minificationFilter(other.minificationFilter)
, magnificationFilter(other.magnificationFilter)
, hidden(other.hidden)
if (changedProperties & CustomAppearanceChanged)
encoder.encodeEnum(customAppearance);
+
+ if (changedProperties & CustomBehaviorChanged)
+ encoder.encodeEnum(customBehavior);
}
bool RemoteLayerTreeTransaction::LayerProperties::decode(IPC::ArgumentDecoder& decoder, LayerProperties& result)
return false;
}
+ if (result.changedProperties & CustomBehaviorChanged) {
+ if (!decoder.decodeEnum(result.customBehavior))
+ return false;
+ }
+
return true;
}
if (layerProperties.changedProperties & RemoteLayerTreeTransaction::CustomAppearanceChanged)
dumpProperty<GraphicsLayer::CustomAppearance>(ts, "customAppearance", layerProperties.customAppearance);
+ if (layerProperties.changedProperties & RemoteLayerTreeTransaction::CustomBehaviorChanged)
+ dumpProperty<GraphicsLayer::CustomBehavior>(ts, "customBehavior", layerProperties.customBehavior);
+
ts << ")";
ts.decreaseIndent();
m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::CustomAppearanceChanged);
}
+GraphicsLayer::CustomBehavior PlatformCALayerRemote::customBehavior() const
+{
+ return m_properties.customBehavior;
+}
+
+void PlatformCALayerRemote::updateCustomBehavior(GraphicsLayer::CustomBehavior customBehavior)
+{
+ m_properties.customBehavior = customBehavior;
+ m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::CustomBehaviorChanged);
+}
+
PassRefPtr<PlatformCALayer> PlatformCALayerRemote::createCompatibleLayer(PlatformCALayer::LayerType layerType, PlatformCALayerClient* client) const
{
return PlatformCALayerRemote::create(layerType, client, m_context);
virtual WebCore::GraphicsLayer::CustomAppearance customAppearance() const override;
virtual void updateCustomAppearance(WebCore::GraphicsLayer::CustomAppearance) override;
+ virtual WebCore::GraphicsLayer::CustomBehavior customBehavior() const override;
+ virtual void updateCustomBehavior(WebCore::GraphicsLayer::CustomBehavior) override;
+
virtual WebCore::TiledBacking* tiledBacking() override { return nullptr; }
virtual PassRefPtr<WebCore::PlatformCALayer> clone(WebCore::PlatformCALayerClient* owner) const override;