Diff
Modified: trunk/Source/WebCore/ChangeLog (174656 => 174657)
--- trunk/Source/WebCore/ChangeLog 2014-10-13 18:50:16 UTC (rev 174656)
+++ trunk/Source/WebCore/ChangeLog 2014-10-13 20:59:32 UTC (rev 174657)
@@ -1,5 +1,51 @@
2014-10-13 Chris Dumez <[email protected]>
+ Use is<>() / downcast<>() for PlatformCALayer subclasses
+ https://bugs.webkit.org/show_bug.cgi?id=137661
+
+ Reviewed by Simon Fraser.
+
+ Use is<>() / downcast<>() for PlatformCALayer subclasses and clean up
+ the surrounding code.
+
+ No new tests, no behavior change.
+
+ * platform/graphics/ca/GraphicsLayerCA.cpp:
+ (WebCore::GraphicsLayerCA::ensureStructuralLayer):
+ (WebCore::GraphicsLayerCA::updateContentsRects):
+ (WebCore::GraphicsLayerCA::updateReplicatedLayers):
+ (WebCore::GraphicsLayerCA::swapFromOrToTiledLayer):
+ (WebCore::GraphicsLayerCA::fetchCloneLayers): Deleted.
+ * platform/graphics/ca/PlatformCALayer.h:
+ * platform/graphics/ca/TileCoverageMap.cpp:
+ (WebCore::TileCoverageMap::TileCoverageMap):
+ * platform/graphics/ca/TileGrid.cpp:
+ (WebCore::TileGrid::ensureTilesForRect):
+ * platform/graphics/ca/mac/PlatformCALayerMac.h:
+ * platform/graphics/ca/mac/PlatformCALayerMac.mm:
+ (PlatformCALayerMac::clone):
+ (PlatformCALayerMac::appendSublayer):
+ (PlatformCALayerMac::insertSublayer):
+ (PlatformCALayerMac::replaceSublayer):
+ (PlatformCALayerMac::adoptSublayers):
+ (PlatformCALayerMac::copyFiltersFrom):
+ * platform/graphics/ca/win/CACFLayerTreeHost.cpp:
+ (WebCore::CACFLayerTreeHost::setRootChildLayer):
+ * platform/graphics/ca/win/PlatformCALayerWin.cpp:
+ (PlatformCALayerWin::clone):
+ (PlatformCALayerWin::rootLayer):
+ (PlatformCALayerWin::appendSublayer):
+ (PlatformCALayerWin::insertSublayer):
+ (PlatformCALayerWin::replaceSublayer):
+ (PlatformCALayerWin::adoptSublayers):
+ (PlatformCALayerWin::copyFiltersFrom):
+ * platform/graphics/ca/win/PlatformCALayerWin.h:
+ * platform/graphics/ca/win/PlatformCALayerWinInternal.cpp:
+ (PlatformCALayerWinInternal::insertSublayer):
+ * platform/graphics/ca/win/PlatformCALayerWinInternal.h:
+
+2014-10-13 Chris Dumez <[email protected]>
+
Use is<>() / downcast<>() for Filter / FilterOperation subclasses
https://bugs.webkit.org/show_bug.cgi?id=137644
Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (174656 => 174657)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2014-10-13 18:50:16 UTC (rev 174656)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2014-10-13 20:59:32 UTC (rev 174657)
@@ -1680,7 +1680,7 @@
// If m_layer doesn't have a parent, it means it's the root layer and
// is likely hosted by something that is not expecting to be changed
ASSERT(m_structuralLayer->superlayer());
- m_structuralLayer->superlayer()->replaceSublayer(m_structuralLayer.get(), m_layer.get());
+ m_structuralLayer->superlayer()->replaceSublayer(*m_structuralLayer, *m_layer);
moveOrCopyAnimations(Move, m_structuralLayer.get(), m_layer.get());
@@ -1953,7 +1953,7 @@
m_contentsClippingLayer->setName("Contents Clipping");
#endif
m_contentsLayer->removeFromSuperlayer();
- m_contentsClippingLayer->appendSublayer(m_contentsLayer.get());
+ m_contentsClippingLayer->appendSublayer(*m_contentsLayer);
gainedOrLostClippingLayer = true;
}
@@ -2030,9 +2030,9 @@
return;
if (m_structuralLayer)
- m_structuralLayer->insertSublayer(replicaRoot.get(), 0);
+ m_structuralLayer->insertSublayer(*replicaRoot, 0);
else
- m_layer->insertSublayer(replicaRoot.get(), 0);
+ m_layer->insertSublayer(*replicaRoot, 0);
}
// For now, this assumes that layers only ever have one replica, so replicaIndices contains only 0 and 1.
@@ -2969,11 +2969,11 @@
m_usingTiledBacking = useTiledLayer;
- m_layer->adoptSublayers(oldLayer.get());
+ m_layer->adoptSublayers(*oldLayer);
#ifdef VISIBLE_TILE_WASH
if (m_visibleTileWashLayer)
- m_layer->appendSublayer(m_visibleTileWashLayer.get());
+ m_layer->appendSublayer(*m_visibleTileWashLayer;
#endif
if (isMaskLayer()) {
@@ -2985,7 +2985,7 @@
// Skip this step if we don't have a superlayer. This is probably a benign
// case that happens while restructuring the layer tree, and also occurs with
// WebKit2 page overlays, which can become tiled but are out-of-tree.
- oldLayer->superlayer()->replaceSublayer(oldLayer.get(), m_layer.get());
+ oldLayer->superlayer()->replaceSublayer(*oldLayer, *m_layer);
}
m_uncommittedChanges |= ChildrenChanged
@@ -3149,11 +3149,11 @@
return nullptr;
if (structuralLayer) {
- structuralLayer->insertSublayer(replicaRoot.get(), 0);
+ structuralLayer->insertSublayer(*replicaRoot, 0);
return structuralLayer;
}
- primaryLayer->insertSublayer(replicaRoot.get(), 0);
+ primaryLayer->insertSublayer(*replicaRoot, 0);
return primaryLayer;
}
@@ -3171,7 +3171,7 @@
if (contentsClippingLayer) {
ASSERT(contentsLayer);
- contentsClippingLayer->appendSublayer(contentsLayer.get());
+ contentsClippingLayer->appendSublayer(*contentsLayer);
}
if (replicaLayer || structuralLayer || contentsLayer || contentsClippingLayer || childLayers.size() > 0) {
@@ -3216,7 +3216,7 @@
// If we have a transform layer, then the contents layer is parented in the
// primary layer (which is itself a child of the transform layer).
primaryLayer->removeAllSublayers();
- primaryLayer->appendSublayer(contentsClippingLayer ? contentsClippingLayer.get() : contentsLayer.get());
+ primaryLayer->appendSublayer(contentsClippingLayer ? *contentsClippingLayer : *contentsLayer);
}
result = structuralLayer;
Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h (174656 => 174657)
--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h 2014-10-13 18:50:16 UTC (rev 174656)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h 2014-10-13 20:59:32 UTC (rev 174657)
@@ -34,6 +34,7 @@
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/RetainPtr.h>
+#include <wtf/TypeCasts.h>
#include <wtf/Vector.h>
#include <wtf/text/StringHash.h>
#include <wtf/text/WTFString.h>
@@ -115,16 +116,16 @@
virtual void removeFromSuperlayer() = 0;
virtual void setSublayers(const PlatformCALayerList&) = 0;
virtual void removeAllSublayers() = 0;
- virtual void appendSublayer(PlatformCALayer*) = 0;
- virtual void insertSublayer(PlatformCALayer*, size_t index) = 0;
- virtual void replaceSublayer(PlatformCALayer* reference, PlatformCALayer*) = 0;
+ virtual void appendSublayer(PlatformCALayer&) = 0;
+ virtual void insertSublayer(PlatformCALayer&, size_t index) = 0;
+ virtual void replaceSublayer(PlatformCALayer& reference, PlatformCALayer&) = 0;
// A list of sublayers that GraphicsLayerCA should maintain as the first sublayers.
virtual const PlatformCALayerList* customSublayers() const = 0;
// This method removes the sublayers from the source and reparents them to the current layer.
// Any sublayers previously in the current layer are removed.
- virtual void adoptSublayers(PlatformCALayer* source) = 0;
+ virtual void adoptSublayers(PlatformCALayer& source) = 0;
virtual void addAnimationForKey(const String& key, PlatformCAAnimation*) = 0;
virtual void removeAnimationForKey(const String& key) = 0;
@@ -182,7 +183,7 @@
virtual float opacity() const = 0;
virtual void setOpacity(float) = 0;
virtual void setFilters(const FilterOperations&) = 0;
- virtual void copyFiltersFrom(const PlatformCALayer*) = 0;
+ virtual void copyFiltersFrom(const PlatformCALayer&) = 0;
#if ENABLE(CSS_COMPOSITING)
virtual void setBlendMode(BlendMode) = 0;
@@ -259,9 +260,11 @@
PlatformCALayerClient* m_owner;
};
-#define PLATFORM_CALAYER_TYPE_CASTS(ToValueTypeName, predicate) \
- TYPE_CASTS_BASE(ToValueTypeName, WebCore::PlatformCALayer, object, object->predicate, object.predicate)
-
} // namespace WebCore
+#define SPECIALIZE_TYPE_TRAITS_PLATFORM_CALAYER(ToValueTypeName, predicate) \
+SPECIALIZE_TYPE_TRAITS_BEGIN(ToValueTypeName) \
+ static bool isType(const WebCore::PlatformCALayer& layer) { return layer.predicate; } \
+SPECIALIZE_TYPE_TRAITS_END()
+
#endif // PlatformCALayer_h
Modified: trunk/Source/WebCore/platform/graphics/ca/TileCoverageMap.cpp (174656 => 174657)
--- trunk/Source/WebCore/platform/graphics/ca/TileCoverageMap.cpp 2014-10-13 18:50:16 UTC (rev 174656)
+++ trunk/Source/WebCore/platform/graphics/ca/TileCoverageMap.cpp 2014-10-13 20:59:32 UTC (rev 174657)
@@ -48,7 +48,7 @@
m_visibleRectIndicatorLayer.get().setAnchorPoint(FloatPoint3D());
m_visibleRectIndicatorLayer.get().setBorderColor(Color(255, 0, 0));
- m_layer.get().appendSublayer(&m_visibleRectIndicatorLayer.get());
+ m_layer.get().appendSublayer(m_visibleRectIndicatorLayer.get());
update();
}
Modified: trunk/Source/WebCore/platform/graphics/ca/TileGrid.cpp (174656 => 174657)
--- trunk/Source/WebCore/platform/graphics/ca/TileGrid.cpp 2014-10-13 18:50:16 UTC (rev 174656)
+++ trunk/Source/WebCore/platform/graphics/ca/TileGrid.cpp 2014-10-13 20:59:32 UTC (rev 174657)
@@ -543,7 +543,7 @@
bool shouldParentTileLayer = (!m_controller.unparentsOffscreenTiles() || m_controller.isInWindow()) && !tileInfo.layer->superlayer();
if (shouldParentTileLayer)
- m_containerLayer.get().appendSublayer(tileInfo.layer.get());
+ m_containerLayer.get().appendSublayer(*tileInfo.layer);
}
}
Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h (174656 => 174657)
--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h 2014-10-13 18:50:16 UTC (rev 174656)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h 2014-10-13 20:59:32 UTC (rev 174657)
@@ -55,11 +55,11 @@
virtual void removeFromSuperlayer() override;
virtual void setSublayers(const PlatformCALayerList&) override;
virtual void removeAllSublayers() override;
- virtual void appendSublayer(PlatformCALayer*) override;
- virtual void insertSublayer(PlatformCALayer*, size_t index) override;
- virtual void replaceSublayer(PlatformCALayer* reference, PlatformCALayer*) override;
+ virtual void appendSublayer(PlatformCALayer&) override;
+ virtual void insertSublayer(PlatformCALayer&, size_t index) override;
+ virtual void replaceSublayer(PlatformCALayer& reference, PlatformCALayer&) override;
virtual const PlatformCALayerList* customSublayers() const override { return m_customSublayers.get(); }
- virtual void adoptSublayers(PlatformCALayer* source) override;
+ virtual void adoptSublayers(PlatformCALayer& source) override;
virtual void addAnimationForKey(const String& key, PlatformCAAnimation*) override;
virtual void removeAnimationForKey(const String& key) override;
@@ -119,7 +119,7 @@
virtual void setOpacity(float) override;
virtual void setFilters(const FilterOperations&) override;
WEBCORE_EXPORT static bool filtersCanBeComposited(const FilterOperations&);
- virtual void copyFiltersFrom(const PlatformCALayer*) override;
+ virtual void copyFiltersFrom(const PlatformCALayer&) override;
#if ENABLE(CSS_COMPOSITING)
virtual void setBlendMode(BlendMode) override;
@@ -166,8 +166,8 @@
GraphicsLayer::CustomBehavior m_customBehavior;
};
-PLATFORM_CALAYER_TYPE_CASTS(PlatformCALayerMac, isPlatformCALayerMac())
-
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_PLATFORM_CALAYER(WebCore::PlatformCALayerMac, isPlatformCALayerMac())
+
#endif // PlatformCALayerMac_h
Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm (174656 => 174657)
--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm 2014-10-13 18:50:16 UTC (rev 174656)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm 2014-10-13 20:59:32 UTC (rev 174657)
@@ -320,7 +320,7 @@
newLayer->setOpaque(isOpaque());
newLayer->setBackgroundColor(backgroundColor());
newLayer->setContentsScale(contentsScale());
- newLayer->copyFiltersFrom(this);
+ newLayer->copyFiltersFrom(*this);
newLayer->updateCustomAppearance(customAppearance());
if (type == LayerTypeAVPlayerLayer) {
@@ -422,34 +422,34 @@
END_BLOCK_OBJC_EXCEPTIONS
}
-void PlatformCALayerMac::appendSublayer(PlatformCALayer* layer)
+void PlatformCALayerMac::appendSublayer(PlatformCALayer& layer)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS
- ASSERT(m_layer != layer->m_layer);
- [m_layer.get() addSublayer:layer->m_layer.get()];
+ ASSERT(m_layer != layer.m_layer);
+ [m_layer.get() addSublayer:layer.m_layer.get()];
END_BLOCK_OBJC_EXCEPTIONS
}
-void PlatformCALayerMac::insertSublayer(PlatformCALayer* layer, size_t index)
+void PlatformCALayerMac::insertSublayer(PlatformCALayer& layer, size_t index)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS
- ASSERT(m_layer != layer->m_layer);
- [m_layer.get() insertSublayer:layer->m_layer.get() atIndex:index];
+ ASSERT(m_layer != layer.m_layer);
+ [m_layer.get() insertSublayer:layer.m_layer.get() atIndex:index];
END_BLOCK_OBJC_EXCEPTIONS
}
-void PlatformCALayerMac::replaceSublayer(PlatformCALayer* reference, PlatformCALayer* layer)
+void PlatformCALayerMac::replaceSublayer(PlatformCALayer& reference, PlatformCALayer& layer)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS
- ASSERT(m_layer != layer->m_layer);
- [m_layer.get() replaceSublayer:reference->m_layer.get() with:layer->m_layer.get()];
+ ASSERT(m_layer != layer.m_layer);
+ [m_layer.get() replaceSublayer:reference.m_layer.get() with:layer.m_layer.get()];
END_BLOCK_OBJC_EXCEPTIONS
}
-void PlatformCALayerMac::adoptSublayers(PlatformCALayer* source)
+void PlatformCALayerMac::adoptSublayers(PlatformCALayer& source)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS
- [m_layer.get() setSublayers:[source->m_layer.get() sublayers]];
+ [m_layer.get() setSublayers:[source.m_layer.get() sublayers]];
END_BLOCK_OBJC_EXCEPTIONS
}
@@ -713,10 +713,10 @@
PlatformCAFilters::setFiltersOnLayer(platformLayer(), filters);
}
-void PlatformCALayerMac::copyFiltersFrom(const PlatformCALayer* sourceLayer)
+void PlatformCALayerMac::copyFiltersFrom(const PlatformCALayer& sourceLayer)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS
- [m_layer.get() setFilters:[sourceLayer->platformLayer() filters]];
+ [m_layer.get() setFilters:[sourceLayer.platformLayer() filters]];
END_BLOCK_OBJC_EXCEPTIONS
}
Modified: trunk/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.cpp (174656 => 174657)
--- trunk/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.cpp 2014-10-13 18:50:16 UTC (rev 174656)
+++ trunk/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.cpp 2014-10-13 20:59:32 UTC (rev 174657)
@@ -205,7 +205,7 @@
m_rootLayer->removeAllSublayers();
m_rootChildLayer = layer;
if (m_rootChildLayer)
- m_rootLayer->appendSublayer(m_rootChildLayer.get());
+ m_rootLayer->appendSublayer(*m_rootChildLayer);
}
void CACFLayerTreeHost::layerTreeDidChange()
Modified: trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp (174656 => 174657)
--- trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp 2014-10-13 18:50:16 UTC (rev 174656)
+++ trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp 2014-10-13 20:59:32 UTC (rev 174657)
@@ -182,7 +182,7 @@
newLayer->setOpaque(isOpaque());
newLayer->setBackgroundColor(backgroundColor());
newLayer->setContentsScale(contentsScale());
- newLayer->copyFiltersFrom(this);
+ newLayer->copyFiltersFrom(*this);
return newLayer;
}
@@ -190,7 +190,7 @@
PlatformCALayer* PlatformCALayerWin::rootLayer() const
{
AbstractCACFLayerTreeHost* host = layerTreeHostForLayer(this);
- return host ? host->rootLayer() : 0;
+ return host ? host->rootLayer() : nullptr;
}
void PlatformCALayerWin::animationStarted(const String& animationKey, CFTimeInterval beginTime)
@@ -270,43 +270,40 @@
intern(this)->removeAllSublayers();
}
-void PlatformCALayerWin::appendSublayer(PlatformCALayer* layer)
+void PlatformCALayerWin::appendSublayer(PlatformCALayer& layer)
{
// This must be in terms of insertSublayer instead of a direct call so PlatformCALayerInternal can override.
insertSublayer(layer, intern(this)->sublayerCount());
}
-void PlatformCALayerWin::insertSublayer(PlatformCALayer* layer, size_t index)
+void PlatformCALayerWin::insertSublayer(PlatformCALayer& layer, size_t index)
{
intern(this)->insertSublayer(layer, index);
}
-void PlatformCALayerWin::replaceSublayer(PlatformCALayer* reference, PlatformCALayer* newLayer)
+void PlatformCALayerWin::replaceSublayer(PlatformCALayer& reference, PlatformCALayer& newLayer)
{
// This must not use direct calls to allow PlatformCALayerInternal to override.
- ASSERT_ARG(reference, reference);
- ASSERT_ARG(reference, reference->superlayer() == this);
+ ASSERT_ARG(reference, reference.superlayer() == this);
- if (reference == newLayer)
+ if (&reference == &newLayer)
return;
- int referenceIndex = intern(this)->indexOfSublayer(reference);
+ int referenceIndex = intern(this)->indexOfSublayer(&reference);
ASSERT(referenceIndex != -1);
if (referenceIndex == -1)
return;
- reference->removeFromSuperlayer();
+ reference.removeFromSuperlayer();
- if (newLayer) {
- newLayer->removeFromSuperlayer();
- insertSublayer(newLayer, referenceIndex);
- }
+ newLayer.removeFromSuperlayer();
+ insertSublayer(newLayer, referenceIndex);
}
-void PlatformCALayerWin::adoptSublayers(PlatformCALayer* source)
+void PlatformCALayerWin::adoptSublayers(PlatformCALayer& source)
{
PlatformCALayerList sublayers;
- intern(source)->getSublayers(sublayers);
+ intern(&source)->getSublayers(sublayers);
// Use setSublayers() because it properly nulls out the superlayer pointers.
setSublayers(sublayers);
@@ -547,7 +544,7 @@
{
}
-void PlatformCALayerWin::copyFiltersFrom(const PlatformCALayer*)
+void PlatformCALayerWin::copyFiltersFrom(const PlatformCALayer&)
{
}
Modified: trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h (174656 => 174657)
--- trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h 2014-10-13 18:50:16 UTC (rev 174656)
+++ trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h 2014-10-13 20:59:32 UTC (rev 174657)
@@ -46,11 +46,11 @@
virtual void removeFromSuperlayer() override;
virtual void setSublayers(const PlatformCALayerList&) override;
virtual void removeAllSublayers() override;
- virtual void appendSublayer(PlatformCALayer*) override;
- virtual void insertSublayer(PlatformCALayer*, size_t index) override;
- virtual void replaceSublayer(PlatformCALayer* reference, PlatformCALayer*) override;
+ virtual void appendSublayer(PlatformCALayer&) override;
+ virtual void insertSublayer(PlatformCALayer&, size_t index) override;
+ virtual void replaceSublayer(PlatformCALayer& reference, PlatformCALayer&) override;
virtual const PlatformCALayerList* customSublayers() const override { return m_customSublayers.get(); }
- virtual void adoptSublayers(PlatformCALayer* source) override;
+ virtual void adoptSublayers(PlatformCALayer& source) override;
virtual void addAnimationForKey(const String& key, PlatformCAAnimation*) override;
virtual void removeAnimationForKey(const String& key) override;
@@ -111,7 +111,7 @@
virtual void setFilters(const FilterOperations&) override;
static bool filtersCanBeComposited(const FilterOperations&) { return false; }
- virtual void copyFiltersFrom(const PlatformCALayer*) override;
+ virtual void copyFiltersFrom(const PlatformCALayer&) override;
virtual void setName(const String&) override;
Modified: trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp (174656 => 174657)
--- trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp 2014-10-13 18:50:16 UTC (rev 174656)
+++ trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp 2014-10-13 20:59:32 UTC (rev 174657)
@@ -258,16 +258,16 @@
}
}
-void PlatformCALayerWinInternal::insertSublayer(PlatformCALayer* layer, size_t index)
+void PlatformCALayerWinInternal::insertSublayer(PlatformCALayer& layer, size_t index)
{
index = min(index, sublayerCount());
if (layerTypeIsTiled(m_owner->layerType())) {
// Add 1 to account for the tile parent layer
- index++;
+ ++index;
}
- layer->removeFromSuperlayer();
- CACFLayerInsertSublayer(owner()->platformLayer(), layer->platformLayer(), index);
+ layer.removeFromSuperlayer();
+ CACFLayerInsertSublayer(owner()->platformLayer(), layer.platformLayer(), index);
owner()->setNeedsCommit();
}
Modified: trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.h (174656 => 174657)
--- trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.h 2014-10-13 18:50:16 UTC (rev 174656)
+++ trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.h 2014-10-13 20:59:32 UTC (rev 174657)
@@ -55,7 +55,7 @@
void setSublayers(const PlatformCALayerList&);
void getSublayers(PlatformCALayerList&) const;
void removeAllSublayers();
- void insertSublayer(PlatformCALayer*, size_t);
+ void insertSublayer(PlatformCALayer&, size_t);
size_t sublayerCount() const;
int indexOfSublayer(const PlatformCALayer* reference);
Modified: trunk/Source/WebKit/win/ChangeLog (174656 => 174657)
--- trunk/Source/WebKit/win/ChangeLog 2014-10-13 18:50:16 UTC (rev 174656)
+++ trunk/Source/WebKit/win/ChangeLog 2014-10-13 20:59:32 UTC (rev 174657)
@@ -1,3 +1,16 @@
+2014-10-13 Chris Dumez <[email protected]>
+
+ Use is<>() / downcast<>() for PlatformCALayer subclasses
+ https://bugs.webkit.org/show_bug.cgi?id=137661
+
+ Reviewed by Simon Fraser.
+
+ Use is<>() / downcast<>() for PlatformCALayer subclasses and clean up
+ the surrounding code.
+
+ * FullscreenVideoController.cpp:
+ (FullscreenVideoController::enterFullscreen):
+
2014-10-10 Chris Dumez <[email protected]>
Use is<>() / downcast<>() for RenderElement
Modified: trunk/Source/WebKit/win/FullscreenVideoController.cpp (174656 => 174657)
--- trunk/Source/WebKit/win/FullscreenVideoController.cpp 2014-10-13 18:50:16 UTC (rev 174656)
+++ trunk/Source/WebKit/win/FullscreenVideoController.cpp 2014-10-13 20:59:32 UTC (rev 174657)
@@ -282,7 +282,8 @@
m_fullscreenWindow->setRootChildLayer(m_rootChild);
PlatformCALayer* videoLayer = PlatformCALayer::platformCALayer(m_videoElement->platformLayer());
- m_rootChild->appendSublayer(videoLayer);
+ ASSERT(videoLayer);
+ m_rootChild->appendSublayer(*videoLayer);
m_rootChild->setNeedsLayout();
m_rootChild->setGeometryFlipped(1);
Modified: trunk/Source/WebKit2/ChangeLog (174656 => 174657)
--- trunk/Source/WebKit2/ChangeLog 2014-10-13 18:50:16 UTC (rev 174656)
+++ trunk/Source/WebKit2/ChangeLog 2014-10-13 20:59:32 UTC (rev 174657)
@@ -1,5 +1,31 @@
2014-10-13 Chris Dumez <[email protected]>
+ Use is<>() / downcast<>() for PlatformCALayer subclasses
+ https://bugs.webkit.org/show_bug.cgi?id=137661
+
+ Reviewed by Simon Fraser.
+
+ Use is<>() / downcast<>() for PlatformCALayer subclasses and clean up
+ the surrounding code.
+
+ * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
+ (WebKit::PlatformCALayerRemote::~PlatformCALayerRemote):
+ (WebKit::PlatformCALayerRemote::updateClonedLayerProperties):
+ (WebKit::PlatformCALayerRemote::recursiveBuildTransaction):
+ (WebKit::PlatformCALayerRemote::setSublayers):
+ (WebKit::PlatformCALayerRemote::appendSublayer):
+ (WebKit::PlatformCALayerRemote::insertSublayer):
+ (WebKit::PlatformCALayerRemote::replaceSublayer):
+ (WebKit::PlatformCALayerRemote::adoptSublayers):
+ (WebKit::PlatformCALayerRemote::setMask):
+ (WebKit::PlatformCALayerRemote::copyFiltersFrom):
+ * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
+ * WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.h:
+ * WebProcess/WebPage/mac/RemoteLayerTreeContext.mm:
+ (WebKit::RemoteLayerTreeContext::buildTransaction):
+
+2014-10-13 Chris Dumez <[email protected]>
+
Use is<>() / downcast<>() for Filter / FilterOperation subclasses
https://bugs.webkit.org/show_bug.cgi?id=137644
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp (174656 => 174657)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp 2014-10-13 18:50:16 UTC (rev 174656)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp 2014-10-13 20:59:32 UTC (rev 174657)
@@ -106,7 +106,7 @@
PlatformCALayerRemote::~PlatformCALayerRemote()
{
for (const auto& layer : m_children)
- toPlatformCALayerRemote(layer.get())->m_superlayer = nullptr;
+ downcast<PlatformCALayerRemote>(*layer).m_superlayer = nullptr;
if (m_context)
m_context->layerWillBeDestroyed(*this);
@@ -133,7 +133,7 @@
clone.setBackgroundColor(backgroundColor());
clone.setContentsScale(contentsScale());
if (m_properties.filters)
- clone.copyFiltersFrom(this);
+ clone.copyFiltersFrom(*this);
clone.updateCustomAppearance(customAppearance());
}
@@ -167,9 +167,9 @@
}
for (size_t i = 0; i < m_children.size(); ++i) {
- PlatformCALayerRemote* child = toPlatformCALayerRemote(m_children[i].get());
- ASSERT(child->superlayer() == this);
- child->recursiveBuildTransaction(context, transaction);
+ PlatformCALayerRemote& child = downcast<PlatformCALayerRemote>(*m_children[i]);
+ ASSERT(child.superlayer() == this);
+ child.recursiveBuildTransaction(context, transaction);
}
if (m_maskLayer)
@@ -255,7 +255,7 @@
for (const auto& layer : list) {
layer->removeFromSuperlayer();
- toPlatformCALayerRemote(layer.get())->m_superlayer = this;
+ downcast<PlatformCALayerRemote>(*layer).m_superlayer = this;
}
m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ChildrenChanged);
@@ -270,47 +270,47 @@
m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ChildrenChanged);
}
-void PlatformCALayerRemote::appendSublayer(PlatformCALayer* layer)
+void PlatformCALayerRemote::appendSublayer(PlatformCALayer& layer)
{
- RefPtr<PlatformCALayer> layerProtector(layer);
+ Ref<PlatformCALayer> layerProtector(layer);
- layer->removeFromSuperlayer();
- m_children.append(layer);
- toPlatformCALayerRemote(layer)->m_superlayer = this;
+ layer.removeFromSuperlayer();
+ m_children.append(&layer);
+ downcast<PlatformCALayerRemote>(layer).m_superlayer = this;
m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ChildrenChanged);
}
-void PlatformCALayerRemote::insertSublayer(PlatformCALayer* layer, size_t index)
+void PlatformCALayerRemote::insertSublayer(PlatformCALayer& layer, size_t index)
{
- RefPtr<PlatformCALayer> layerProtector(layer);
+ Ref<PlatformCALayer> layerProtector(layer);
- layer->removeFromSuperlayer();
- m_children.insert(index, layer);
- toPlatformCALayerRemote(layer)->m_superlayer = this;
+ layer.removeFromSuperlayer();
+ m_children.insert(index, &layer);
+ downcast<PlatformCALayerRemote>(layer).m_superlayer = this;
m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ChildrenChanged);
}
-void PlatformCALayerRemote::replaceSublayer(PlatformCALayer* reference, PlatformCALayer* layer)
+void PlatformCALayerRemote::replaceSublayer(PlatformCALayer& reference, PlatformCALayer& layer)
{
- ASSERT(reference->superlayer() == this);
- RefPtr<PlatformCALayer> layerProtector(layer);
+ ASSERT(reference.superlayer() == this);
+ Ref<PlatformCALayer> layerProtector(layer);
- layer->removeFromSuperlayer();
- size_t referenceIndex = m_children.find(reference);
+ layer.removeFromSuperlayer();
+ size_t referenceIndex = m_children.find(&reference);
if (referenceIndex != notFound) {
m_children[referenceIndex]->removeFromSuperlayer();
- m_children.insert(referenceIndex, layer);
- toPlatformCALayerRemote(layer)->m_superlayer = this;
+ m_children.insert(referenceIndex, &layer);
+ downcast<PlatformCALayerRemote>(layer).m_superlayer = this;
}
m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ChildrenChanged);
}
-void PlatformCALayerRemote::adoptSublayers(PlatformCALayer* source)
+void PlatformCALayerRemote::adoptSublayers(PlatformCALayer& source)
{
- PlatformCALayerList layersToMove = toPlatformCALayerRemote(source)->m_children;
+ PlatformCALayerList layersToMove = downcast<PlatformCALayerRemote>(source).m_children;
- if (const PlatformCALayerList* customLayers = source->customSublayers()) {
+ if (const PlatformCALayerList* customLayers = source.customSublayers()) {
for (const auto& layer : *customLayers) {
size_t layerIndex = layersToMove.find(layer);
if (layerIndex != notFound)
@@ -379,7 +379,7 @@
void PlatformCALayerRemote::setMask(PlatformCALayer* layer)
{
if (layer) {
- m_maskLayer = toPlatformCALayerRemote(layer);
+ m_maskLayer = downcast<PlatformCALayerRemote>(layer);
m_properties.maskLayerID = m_maskLayer->layerID();
} else {
m_maskLayer = nullptr;
@@ -602,9 +602,9 @@
m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::FiltersChanged);
}
-void PlatformCALayerRemote::copyFiltersFrom(const PlatformCALayer* sourceLayer)
+void PlatformCALayerRemote::copyFiltersFrom(const PlatformCALayer& sourceLayer)
{
- if (const FilterOperations* filters = toPlatformCALayerRemote(sourceLayer)->m_properties.filters.get())
+ if (const FilterOperations* filters = downcast<PlatformCALayerRemote>(sourceLayer).m_properties.filters.get())
setFilters(*filters);
else if (m_properties.filters)
m_properties.filters = nullptr;
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h (174656 => 174657)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h 2014-10-13 18:50:16 UTC (rev 174656)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h 2014-10-13 20:59:32 UTC (rev 174657)
@@ -60,11 +60,11 @@
virtual void removeFromSuperlayer() override;
virtual void setSublayers(const WebCore::PlatformCALayerList&) override;
virtual void removeAllSublayers() override;
- virtual void appendSublayer(WebCore::PlatformCALayer*) override;
- virtual void insertSublayer(WebCore::PlatformCALayer*, size_t index) override;
- virtual void replaceSublayer(WebCore::PlatformCALayer* reference, WebCore::PlatformCALayer*) override;
+ virtual void appendSublayer(WebCore::PlatformCALayer&) override;
+ virtual void insertSublayer(WebCore::PlatformCALayer&, size_t index) override;
+ virtual void replaceSublayer(WebCore::PlatformCALayer& reference, WebCore::PlatformCALayer&) override;
virtual const WebCore::PlatformCALayerList* customSublayers() const override { return nullptr; }
- virtual void adoptSublayers(WebCore::PlatformCALayer* source) override;
+ virtual void adoptSublayers(WebCore::PlatformCALayer& source) override;
virtual void addAnimationForKey(const String& key, WebCore::PlatformCAAnimation*) override;
virtual void removeAnimationForKey(const String& key) override;
@@ -124,7 +124,7 @@
virtual void setFilters(const WebCore::FilterOperations&) override;
static bool filtersCanBeComposited(const WebCore::FilterOperations&);
- virtual void copyFiltersFrom(const WebCore::PlatformCALayer*) override;
+ virtual void copyFiltersFrom(const WebCore::PlatformCALayer&) override;
#if ENABLE(CSS_COMPOSITING)
virtual void setBlendMode(WebCore::BlendMode) override;
@@ -193,8 +193,8 @@
RemoteLayerTreeContext* m_context;
};
-PLATFORM_CALAYER_TYPE_CASTS(PlatformCALayerRemote, isPlatformCALayerRemote())
-
} // namespace WebKit
+SPECIALIZE_TYPE_TRAITS_PLATFORM_CALAYER(WebKit::PlatformCALayerRemote, isPlatformCALayerRemote())
+
#endif // PlatformCALayerRemote_h
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.h (174656 => 174657)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.h 2014-10-13 18:50:16 UTC (rev 174656)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.h 2014-10-13 20:59:32 UTC (rev 174657)
@@ -62,8 +62,8 @@
bool m_providesContents;
};
-PLATFORM_CALAYER_TYPE_CASTS(PlatformCALayerRemoteCustom, isPlatformCALayerRemote())
-
} // namespace WebKit
+SPECIALIZE_TYPE_TRAITS_PLATFORM_CALAYER(WebKit::PlatformCALayerRemoteCustom, isPlatformCALayerRemote())
+
#endif // PlatformCALayerRemoteCustom_h
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm (174656 => 174657)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm 2014-10-13 18:50:16 UTC (rev 174656)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm 2014-10-13 20:59:32 UTC (rev 174657)
@@ -105,7 +105,7 @@
void RemoteLayerTreeContext::buildTransaction(RemoteLayerTreeTransaction& transaction, PlatformCALayer& rootLayer)
{
- PlatformCALayerRemote& rootLayerRemote = toPlatformCALayerRemote(rootLayer);
+ PlatformCALayerRemote& rootLayerRemote = downcast<PlatformCALayerRemote>(rootLayer);
transaction.setRootLayerID(rootLayerRemote.layerID());
m_currentTransaction = &transaction;