https://bugs.webkit.org/show_bug.cgi?id=126346
Source/WebCore:
Reviewed by Tim Horton.
Remote scrolling tree code is soon going to use RemoteLayerTreeTransaction::LayerID,
so it makes more sense to put this layerID type on GraphicsLayer as
GraphicsLayer::PlatformLayerID.
Also add some type cast macros for PlatformCALayer and subclasses, and use them
where appropriate.
* platform/graphics/GraphicsLayer.h:
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::setName):
* platform/graphics/ca/PlatformCALayer.h:
(WebCore::PlatformCALayer::isPlatformCALayerMac):
(WebCore::PlatformCALayer::isPlatformCALayerRemote):
(WebCore::PlatformCALayer::PlatformCALayer):
* platform/graphics/ca/mac/PlatformCALayerMac.h:
Source/WebKit2:
Reviewed by Tim Horton.
Remote scrolling tree code is soon going to use RemoteLayerTreeTransaction::LayerID,
so it makes more sense to put this layerID type on GraphicsLayer as
GraphicsLayer::PlatformLayerID.
Also add some type cast macros for PlatformCALayer and subclasses, and use them
where appropriate.
* Shared/mac/RemoteLayerTreePropertyApplier.h:
* Shared/mac/RemoteLayerTreeTransaction.h:
(WebKit::RemoteLayerTreeTransaction::rootLayerID):
(WebKit::RemoteLayerTreeTransaction::changedLayers):
(WebKit::RemoteLayerTreeTransaction::destroyedLayers):
* Shared/mac/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::decode):
(WebKit::RemoteLayerTreeTransaction::setRootLayerID):
(WebKit::RemoteLayerTreeTransaction::setDestroyedLayerIDs):
(WebKit::RemoteLayerTreeTextStream::operator<<):
(WebKit::dumpChangedLayers):
(WebKit::RemoteLayerTreeTransaction::description):
* UIProcess/mac/RemoteLayerTreeHost.h:
* UIProcess/mac/RemoteLayerTreeHost.mm:
(WebKit::RemoteLayerTreeHost::commit):
(WebKit::RemoteLayerTreeHost::getLayer):
* WebProcess/WebPage/mac/GraphicsLayerCARemote.cpp:
(WebKit::GraphicsLayerCARemote::primaryLayerID):
* WebProcess/WebPage/mac/GraphicsLayerCARemote.h:
* WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
(generateLayerID):
* WebProcess/WebPage/mac/PlatformCALayerRemote.h:
(WebKit::PlatformCALayerRemote::layerID):
* WebProcess/WebPage/mac/RemoteLayerTreeContext.h:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@161192
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2014-01-01 Simon Fraser <simon.fraser@apple.com>
+
+ Add a typedef for PlatformLayerID on GraphicsLayer, and migrate RemoteLayerTreeTransaction to use it
+ https://bugs.webkit.org/show_bug.cgi?id=126346
+
+ Reviewed by Tim Horton.
+
+ Remote scrolling tree code is soon going to use RemoteLayerTreeTransaction::LayerID,
+ so it makes more sense to put this layerID type on GraphicsLayer as
+ GraphicsLayer::PlatformLayerID.
+
+ Also add some type cast macros for PlatformCALayer and subclasses, and use them
+ where appropriate.
+
+ * platform/graphics/GraphicsLayer.h:
+ * platform/graphics/ca/GraphicsLayerCA.cpp:
+ (WebCore::GraphicsLayerCA::setName):
+ * platform/graphics/ca/PlatformCALayer.h:
+ (WebCore::PlatformCALayer::isPlatformCALayerMac):
+ (WebCore::PlatformCALayer::isPlatformCALayerRemote):
+ (WebCore::PlatformCALayer::PlatformCALayer):
+ * platform/graphics/ca/mac/PlatformCALayerMac.h:
+
2013-12-31 Simon Fraser <simon.fraser@apple.com>
ScrollingStateNodes should have a reference to the ScrollingStateTree
public:
static std::unique_ptr<GraphicsLayer> create(GraphicsLayerFactory*, GraphicsLayerClient*);
+ typedef uint64_t PlatformLayerID;
+
virtual ~GraphicsLayer();
virtual void initialize() { }
{
String caLayerDescription;
- if (!m_layer->isRemote())
+ if (!m_layer->isPlatformCALayerRemote())
caLayerDescription = String::format("CALayer(%p) ", m_layer->platformLayer());
String longName = caLayerDescription + String::format("GraphicsLayer(%p) ", this) + name;
virtual ~PlatformCALayer();
+ virtual bool isPlatformCALayerMac() const { return false; }
+ virtual bool isPlatformCALayerRemote() const { return false; }
+
// This function passes the layer as a void* rather than a PlatformLayer because PlatformLayer
// is defined differently for Obj C and C++. This allows callers from both languages.
static PlatformCALayer* platformCALayer(void* platformLayer);
virtual void setContentsChanged() = 0;
LayerType layerType() const { return m_layerType; }
- virtual bool isRemote() const { return false; }
virtual PlatformCALayer* superlayer() const = 0;
virtual void removeFromSuperlayer() = 0;
PlatformCALayer(LayerType layerType, PlatformCALayerClient* owner)
: m_layerType(layerType)
, m_owner(owner)
- {
-
- }
+ { }
LayerType m_layerType;
RetainPtr<PlatformLayer> m_layer;
PlatformCALayerClient* m_owner;
};
-}
+#define PLATFORM_CALAYER_TYPE_CASTS(ToValueTypeName, predicate) \
+ TYPE_CASTS_BASE(ToValueTypeName, WebCore::PlatformCALayer, object, object->predicate, object.predicate)
+
+} // namespace WebCore
#endif // USE(ACCELERATED_COMPOSITING)
private:
PlatformCALayerMac(LayerType, PlatformLayer*, PlatformCALayerClient* owner);
+ virtual bool isPlatformCALayerMac() const OVERRIDE { return true; }
bool requiresCustomAppearanceUpdateOnBoundsChange() const;
GraphicsLayer::CustomAppearance m_customAppearance;
};
+PLATFORM_CALAYER_TYPE_CASTS(PlatformCALayerMac, isPlatformCALayerMac())
+
} // namespace WebCore
#endif // USE(ACCELERATED_COMPOSITING)
+2014-01-01 Simon Fraser <simon.fraser@apple.com>
+
+ Add a typedef for PlatformLayerID on GraphicsLayer, and migrate RemoteLayerTreeTransaction to use it
+ https://bugs.webkit.org/show_bug.cgi?id=126346
+
+ Reviewed by Tim Horton.
+
+ Remote scrolling tree code is soon going to use RemoteLayerTreeTransaction::LayerID,
+ so it makes more sense to put this layerID type on GraphicsLayer as
+ GraphicsLayer::PlatformLayerID.
+
+ Also add some type cast macros for PlatformCALayer and subclasses, and use them
+ where appropriate.
+
+ * Shared/mac/RemoteLayerTreePropertyApplier.h:
+ * Shared/mac/RemoteLayerTreeTransaction.h:
+ (WebKit::RemoteLayerTreeTransaction::rootLayerID):
+ (WebKit::RemoteLayerTreeTransaction::changedLayers):
+ (WebKit::RemoteLayerTreeTransaction::destroyedLayers):
+ * Shared/mac/RemoteLayerTreeTransaction.mm:
+ (WebKit::RemoteLayerTreeTransaction::decode):
+ (WebKit::RemoteLayerTreeTransaction::setRootLayerID):
+ (WebKit::RemoteLayerTreeTransaction::setDestroyedLayerIDs):
+ (WebKit::RemoteLayerTreeTextStream::operator<<):
+ (WebKit::dumpChangedLayers):
+ (WebKit::RemoteLayerTreeTransaction::description):
+ * UIProcess/mac/RemoteLayerTreeHost.h:
+ * UIProcess/mac/RemoteLayerTreeHost.mm:
+ (WebKit::RemoteLayerTreeHost::commit):
+ (WebKit::RemoteLayerTreeHost::getLayer):
+ * WebProcess/WebPage/mac/GraphicsLayerCARemote.cpp:
+ (WebKit::GraphicsLayerCARemote::primaryLayerID):
+ * WebProcess/WebPage/mac/GraphicsLayerCARemote.h:
+ * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
+ (generateLayerID):
+ * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
+ (WebKit::PlatformCALayerRemote::layerID):
+ * WebProcess/WebPage/mac/RemoteLayerTreeContext.h:
+
2014-01-01 Martin Robinson <mrobinson@igalia.com>
[GTK] [CMake] Fix the WEBKIT_SRC_DIR define when building the WebKit2 GObject API unit tests
class RemoteLayerTreePropertyApplier {
public:
- typedef HashMap<RemoteLayerTreeTransaction::LayerID, CALayer *> RelatedLayerMap;
+ typedef HashMap<WebCore::GraphicsLayer::PlatformLayerID, CALayer *> RelatedLayerMap;
static void applyPropertiesToLayer(CALayer *, RemoteLayerTreeTransaction::LayerProperties, RelatedLayerMap);
static void disableActionsForLayer(CALayer *);
};
class RemoteLayerTreeTransaction {
public:
- typedef uint64_t LayerID;
-
enum LayerChange {
NoChange = 0,
NameChanged = 1 << 1,
void encode(IPC::ArgumentEncoder&) const;
static bool decode(IPC::ArgumentDecoder&, LayerCreationProperties&);
- LayerID layerID;
+ WebCore::GraphicsLayer::PlatformLayerID layerID;
WebCore::PlatformCALayer::LayerType type;
uint32_t hostingContextID;
LayerChange everChangedProperties;
String name;
- Vector<LayerID> children;
+ Vector<WebCore::GraphicsLayer::PlatformLayerID> children;
WebCore::FloatPoint3D position;
WebCore::FloatSize size;
WebCore::Color backgroundColor;
bool doubleSided;
bool masksToBounds;
bool opaque;
- LayerID maskLayerID;
+ WebCore::GraphicsLayer::PlatformLayerID maskLayerID;
WebCore::FloatRect contentsRect;
float contentsScale;
WebCore::PlatformCALayer::FilterType minificationFilter;
void encode(IPC::ArgumentEncoder&) const;
static bool decode(IPC::ArgumentDecoder&, RemoteLayerTreeTransaction&);
- LayerID rootLayerID() const { return m_rootLayerID; }
- void setRootLayerID(LayerID rootLayerID);
+ WebCore::GraphicsLayer::PlatformLayerID rootLayerID() const { return m_rootLayerID; }
+ void setRootLayerID(WebCore::GraphicsLayer::PlatformLayerID);
void layerPropertiesChanged(PlatformCALayerRemote*, LayerProperties&);
void setCreatedLayers(Vector<LayerCreationProperties>);
- void setDestroyedLayerIDs(Vector<LayerID>);
+ void setDestroyedLayerIDs(Vector<WebCore::GraphicsLayer::PlatformLayerID>);
#if !defined(NDEBUG) || !LOG_DISABLED
WTF::CString description() const;
#endif
Vector<LayerCreationProperties> createdLayers() const { return m_createdLayers; }
- HashMap<LayerID, LayerProperties> changedLayers() const { return m_changedLayerProperties; }
- Vector<LayerID> destroyedLayers() const { return m_destroyedLayerIDs; }
+ HashMap<WebCore::GraphicsLayer::PlatformLayerID, LayerProperties> changedLayers() const { return m_changedLayerProperties; }
+ Vector<WebCore::GraphicsLayer::PlatformLayerID> destroyedLayers() const { return m_destroyedLayerIDs; }
private:
- LayerID m_rootLayerID;
- HashMap<LayerID, LayerProperties> m_changedLayerProperties;
+ WebCore::GraphicsLayer::PlatformLayerID m_rootLayerID;
+ HashMap<WebCore::GraphicsLayer::PlatformLayerID, LayerProperties> m_changedLayerProperties;
Vector<LayerCreationProperties> m_createdLayers;
- Vector<LayerID> m_destroyedLayerIDs;
+ Vector<WebCore::GraphicsLayer::PlatformLayerID> m_destroyedLayerIDs;
};
} // namespace WebKit
if (!decoder.decode(result.m_destroyedLayerIDs))
return false;
- for (LayerID layerID : result.m_destroyedLayerIDs) {
+
+ for (auto layerID : result.m_destroyedLayerIDs) {
if (!layerID)
return false;
}
return true;
}
-void RemoteLayerTreeTransaction::setRootLayerID(LayerID rootLayerID)
+void RemoteLayerTreeTransaction::setRootLayerID(GraphicsLayer::PlatformLayerID rootLayerID)
{
ASSERT_ARG(rootLayerID, rootLayerID);
m_createdLayers = std::move(createdLayers);
}
-void RemoteLayerTreeTransaction::setDestroyedLayerIDs(Vector<LayerID> destroyedLayerIDs)
+void RemoteLayerTreeTransaction::setDestroyedLayerIDs(Vector<GraphicsLayer::PlatformLayerID> destroyedLayerIDs)
{
m_destroyedLayerIDs = std::move(destroyedLayerIDs);
}
RemoteLayerTreeTextStream& operator<<(FloatPoint3D);
RemoteLayerTreeTextStream& operator<<(Color);
RemoteLayerTreeTextStream& operator<<(FloatRect);
- RemoteLayerTreeTextStream& operator<<(const Vector<RemoteLayerTreeTransaction::LayerID>& layers);
+ RemoteLayerTreeTextStream& operator<<(const Vector<WebCore::GraphicsLayer::PlatformLayerID>& layers);
RemoteLayerTreeTextStream& operator<<(const FilterOperations&);
void increaseIndent() { ++m_indent; }
return ts;
}
-RemoteLayerTreeTextStream& RemoteLayerTreeTextStream::operator<<(const Vector<RemoteLayerTreeTransaction::LayerID>& layers)
+RemoteLayerTreeTextStream& RemoteLayerTreeTextStream::operator<<(const Vector<GraphicsLayer::PlatformLayerID>& layers)
{
RemoteLayerTreeTextStream& ts = *this;
ts.decreaseIndent();
}
-static void dumpChangedLayers(RemoteLayerTreeTextStream& ts, const HashMap<RemoteLayerTreeTransaction::LayerID, RemoteLayerTreeTransaction::LayerProperties>& changedLayerProperties)
+static void dumpChangedLayers(RemoteLayerTreeTextStream& ts, const HashMap<GraphicsLayer::PlatformLayerID, RemoteLayerTreeTransaction::LayerProperties>& changedLayerProperties)
{
if (changedLayerProperties.isEmpty())
return;
ts << "(changed-layers";
// Dump the layer properties sorted by layer ID.
- Vector<RemoteLayerTreeTransaction::LayerID> layerIDs;
+ Vector<GraphicsLayer::PlatformLayerID> layerIDs;
copyKeysToVector(changedLayerProperties, layerIDs);
std::sort(layerIDs.begin(), layerIDs.end());
dumpProperty<String>(ts, "name", layerProperties.name);
if (layerProperties.changedProperties & RemoteLayerTreeTransaction::ChildrenChanged)
- dumpProperty<Vector<RemoteLayerTreeTransaction::LayerID>>(ts, "children", layerProperties.children);
+ dumpProperty<Vector<GraphicsLayer::PlatformLayerID>>(ts, "children", layerProperties.children);
if (layerProperties.changedProperties & RemoteLayerTreeTransaction::PositionChanged)
dumpProperty<FloatPoint3D>(ts, "position", layerProperties.position);
dumpProperty<bool>(ts, "opaque", layerProperties.opaque);
if (layerProperties.changedProperties & RemoteLayerTreeTransaction::MaskLayerChanged)
- dumpProperty<RemoteLayerTreeTransaction::LayerID>(ts, "maskLayer", layerProperties.maskLayerID);
+ dumpProperty<GraphicsLayer::PlatformLayerID>(ts, "maskLayer", layerProperties.maskLayerID);
if (layerProperties.changedProperties & RemoteLayerTreeTransaction::ContentsRectChanged)
dumpProperty<FloatRect>(ts, "contentsRect", layerProperties.contentsRect);
dumpChangedLayers(ts, m_changedLayerProperties);
if (!m_destroyedLayerIDs.isEmpty())
- dumpProperty<Vector<RemoteLayerTreeTransaction::LayerID>>(ts, "destroyed-layers", m_destroyedLayerIDs);
+ dumpProperty<Vector<GraphicsLayer::PlatformLayerID>>(ts, "destroyed-layers", m_destroyedLayerIDs);
ts << ")\n";
// Message handlers.
void commit(const RemoteLayerTreeTransaction&);
- CALayer *getLayer(RemoteLayerTreeTransaction::LayerID);
+ CALayer *getLayer(WebCore::GraphicsLayer::PlatformLayerID) const;
CALayer *createLayer(RemoteLayerTreeTransaction::LayerCreationProperties);
WebPageProxy* m_webPageProxy;
CALayer *m_rootLayer;
- HashMap<RemoteLayerTreeTransaction::LayerID, RetainPtr<CALayer>> m_layers;
+ HashMap<WebCore::GraphicsLayer::PlatformLayerID, RetainPtr<CALayer>> m_layers;
};
} // namespace WebKit
}
for (auto changedLayer : transaction.changedLayers()) {
- RemoteLayerTreeTransaction::LayerID layerID = changedLayer.key;
+ auto layerID = changedLayer.key;
const auto& properties = changedLayer.value;
CALayer *layer = getLayer(layerID);
m_layers.remove(destroyedLayer);
}
-CALayer *RemoteLayerTreeHost::getLayer(RemoteLayerTreeTransaction::LayerID layerID)
+CALayer *RemoteLayerTreeHost::getLayer(GraphicsLayer::PlatformLayerID layerID) const
{
return m_layers.get(layerID).get();
}
{
}
+GraphicsLayer::PlatformLayerID GraphicsLayerCARemote::primaryLayerID() const
+{
+ return toPlatformCALayerRemote(platformCALayer())->layerID();
+}
+
#if ENABLE(CSS_FILTERS)
bool GraphicsLayerCARemote::filtersCanBeComposited(const FilterOperations& filters)
{
}
virtual ~GraphicsLayerCARemote();
+
+ PlatformLayerID primaryLayerID() const;
#if ENABLE(CSS_FILTERS)
virtual bool filtersCanBeComposited(const WebCore::FilterOperations& filters) OVERRIDE;
using namespace WebCore;
using namespace WebKit;
-static RemoteLayerTreeTransaction::LayerID generateLayerID()
+static WebCore::GraphicsLayer::PlatformLayerID generateLayerID()
{
- static RemoteLayerTreeTransaction::LayerID layerID;
+ static WebCore::GraphicsLayer::PlatformLayerID layerID;
return ++layerID;
}
-static PlatformCALayerRemote* toPlatformCALayerRemote(PlatformCALayer* layer)
-{
- ASSERT_WITH_SECURITY_IMPLICATION(!layer || layer->isRemote());
- return static_cast<PlatformCALayerRemote*>(layer);
-}
-
PassRefPtr<PlatformCALayerRemote> PlatformCALayerRemote::create(LayerType layerType, PlatformCALayerClient* owner, RemoteLayerTreeContext* context)
{
RefPtr<PlatformCALayerRemote> layer;
virtual ~PlatformCALayerRemote();
- RemoteLayerTreeTransaction::LayerID layerID() { return m_layerID; }
-
- virtual bool isRemote() const OVERRIDE { return true; }
+ WebCore::GraphicsLayer::PlatformLayerID layerID() { return m_layerID; }
virtual bool usesTiledBackingLayer() const OVERRIDE { return layerType() == LayerTypePageTiledBackingLayer || layerType() == LayerTypeTiledBackingLayer; }
PlatformCALayerRemote(WebCore::PlatformCALayer::LayerType, WebCore::PlatformCALayerClient* owner, RemoteLayerTreeContext* context);
private:
+ virtual bool isPlatformCALayerRemote() const OVERRIDE { return false; }
void ensureBackingStore();
void removeSublayer(PlatformCALayerRemote*);
bool requiresCustomAppearanceUpdateOnBoundsChange() const;
- RemoteLayerTreeTransaction::LayerID m_layerID;
+ const WebCore::GraphicsLayer::PlatformLayerID m_layerID;
RemoteLayerTreeTransaction::LayerProperties m_properties;
WebCore::PlatformCALayerList m_children;
PlatformCALayerRemote* m_superlayer;
RemoteLayerTreeContext* m_context;
};
+PLATFORM_CALAYER_TYPE_CASTS(PlatformCALayerRemote, isPlatformCALayerRemote())
+
} // namespace WebKit
#endif // USE(ACCELERATED_COMPOSITING)
Vector<WebCore::GraphicsLayer*> m_outOfTreeLayers;
Vector<RemoteLayerTreeTransaction::LayerCreationProperties> m_createdLayers;
- Vector<RemoteLayerTreeTransaction::LayerID> m_destroyedLayers;
+ Vector<WebCore::GraphicsLayer::PlatformLayerID> m_destroyedLayers;
bool m_isFlushingSuspended;
bool m_hasDeferredFlush;