<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[161293] trunk/Source</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/161293">161293</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2014-01-03 16:15:12 -0800 (Fri, 03 Jan 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Give all PlatformCALayers a PlatformLayerID, not just remote ones
https://bugs.webkit.org/show_bug.cgi?id=126466
Reviewed by Tim Horton.
Source/WebCore:
The ScrollingStateTree has references to both GraphicsLayers and PlatformLayers
which is confusing, and is necessary because the underlying PlatformLayer
inside a GraphicsLayer can change. In order to hide some of this complexity,
expose GraphicsLayer::primaryLayerID() which is a PlatformLayerID that clients
can hold onto to test for underlying layer swapping.
Also constify LayerType m_layerType on PlatformCALayer, which required
cleaning up the construction of PlatformCALayerMac in the case where a
PlatformCALayerMac is wrapping an existing CALayer (which happens for video).
* WebCore.exp.in:
* platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::primaryLayerID):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::primaryLayerID):
* platform/graphics/ca/GraphicsLayerCA.h:
* platform/graphics/ca/PlatformCALayer.cpp:
(WebCore::generateLayerID):
(WebCore::PlatformCALayer::PlatformCALayer):
* platform/graphics/ca/PlatformCALayer.h:
(WebCore::PlatformCALayer::layerID):
* platform/graphics/ca/mac/PlatformCALayerMac.h:
* platform/graphics/ca/mac/PlatformCALayerMac.mm:
(PlatformCALayerMac::create):
(PlatformCALayerMac::PlatformCALayerMac):
(PlatformCALayerMac::commonInit):
Source/WebKit2:
The ScrollingStateTree has references to both GraphicsLayers and PlatformLayers
which is confusing, and is necessary because the underlying PlatformLayer
inside a GraphicsLayer can change. In order to hide some of this complexity,
expose GraphicsLayer::primaryLayerID() which is a PlatformLayerID that clients
can hold onto to test for underlying layer swapping.
GraphicsLayerCARemote and PlatformCALayerRemote can now just use the
primaryLayerID() function exposed via the base class.
* WebProcess/WebPage/mac/GraphicsLayerCARemote.cpp:
* WebProcess/WebPage/mac/GraphicsLayerCARemote.h:
* WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
(PlatformCALayerRemote::PlatformCALayerRemote):
(PlatformCALayerRemote::recursiveBuildTransaction):
* WebProcess/WebPage/mac/PlatformCALayerRemote.h:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsGraphicsLayerh">trunk/Source/WebCore/platform/graphics/GraphicsLayer.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscaGraphicsLayerCAcpp">trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscaGraphicsLayerCAh">trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscaPlatformCALayercpp">trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscaPlatformCALayerh">trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscamacPlatformCALayerMach">trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscamacPlatformCALayerMacmm">trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacGraphicsLayerCARemotecpp">trunk/Source/WebKit2/WebProcess/WebPage/mac/GraphicsLayerCARemote.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacGraphicsLayerCARemoteh">trunk/Source/WebKit2/WebProcess/WebPage/mac/GraphicsLayerCARemote.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacPlatformCALayerRemotecpp">trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacPlatformCALayerRemoteh">trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (161292 => 161293)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-01-04 00:04:36 UTC (rev 161292)
+++ trunk/Source/WebCore/ChangeLog        2014-01-04 00:15:12 UTC (rev 161293)
</span><span class="lines">@@ -1,3 +1,37 @@
</span><ins>+2014-01-03 Simon Fraser <simon.fraser@apple.com>
+
+ Give all PlatformCALayers a PlatformLayerID, not just remote ones
+ https://bugs.webkit.org/show_bug.cgi?id=126466
+
+ Reviewed by Tim Horton.
+
+ The ScrollingStateTree has references to both GraphicsLayers and PlatformLayers
+ which is confusing, and is necessary because the underlying PlatformLayer
+ inside a GraphicsLayer can change. In order to hide some of this complexity,
+ expose GraphicsLayer::primaryLayerID() which is a PlatformLayerID that clients
+ can hold onto to test for underlying layer swapping.
+
+ Also constify LayerType m_layerType on PlatformCALayer, which required
+ cleaning up the construction of PlatformCALayerMac in the case where a
+ PlatformCALayerMac is wrapping an existing CALayer (which happens for video).
+
+ * WebCore.exp.in:
+ * platform/graphics/GraphicsLayer.h:
+ (WebCore::GraphicsLayer::primaryLayerID):
+ * platform/graphics/ca/GraphicsLayerCA.cpp:
+ (WebCore::GraphicsLayerCA::primaryLayerID):
+ * platform/graphics/ca/GraphicsLayerCA.h:
+ * platform/graphics/ca/PlatformCALayer.cpp:
+ (WebCore::generateLayerID):
+ (WebCore::PlatformCALayer::PlatformCALayer):
+ * platform/graphics/ca/PlatformCALayer.h:
+ (WebCore::PlatformCALayer::layerID):
+ * platform/graphics/ca/mac/PlatformCALayerMac.h:
+ * platform/graphics/ca/mac/PlatformCALayerMac.mm:
+ (PlatformCALayerMac::create):
+ (PlatformCALayerMac::PlatformCALayerMac):
+ (PlatformCALayerMac::commonInit):
+
</ins><span class="cx"> 2014-01-03 Andreas Kling <akling@apple.com>
</span><span class="cx">
</span><span class="cx"> Add lineageOfType renderer iterator and start using it.
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (161292 => 161293)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-01-04 00:04:36 UTC (rev 161292)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-01-04 00:15:12 UTC (rev 161293)
</span><span class="lines">@@ -575,12 +575,14 @@
</span><span class="cx"> __ZN7WebCore15GraphicsLayerCAC2EPNS_19GraphicsLayerClientE
</span><span class="cx"> __ZN7WebCore15GraphicsLayerCAD2Ev
</span><span class="cx"> __ZN7WebCore15GraphicsLayerCA19setCustomAppearanceENS_13GraphicsLayer16CustomAppearanceE
</span><ins>+__ZNK7WebCore15GraphicsLayerCA14primaryLayerIDEv
</ins><span class="cx"> __ZN7WebCore15HitTestLocation12rectForPointERKNS_11LayoutPointEjjjj
</span><span class="cx"> __ZN7WebCore15HitTestLocationC1ERKNS_10FloatPointE
</span><span class="cx"> __ZN7WebCore15HitTestLocationD1Ev
</span><span class="cx"> __ZN7WebCore15JSDOMWindowBase8commonVMEv
</span><span class="cx"> __ZN7WebCore15PasteboardImageC1Ev
</span><span class="cx"> __ZN7WebCore15PasteboardImageD1Ev
</span><ins>+__ZN7WebCore15PlatformCALayerC2ENS0_9LayerTypeEPNS_21PlatformCALayerClientE
</ins><span class="cx"> __ZN7WebCore15PlatformCALayerD2Ev
</span><span class="cx"> __ZN7WebCore15ProtectionSpaceC1ERKN3WTF6StringEiNS_25ProtectionSpaceServerTypeES4_NS_35ProtectionSpaceAuthenticationSchemeE
</span><span class="cx"> __ZN7WebCore15ProtectionSpaceC1Ev
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGraphicsLayerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (161292 => 161293)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h        2014-01-04 00:04:36 UTC (rev 161292)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h        2014-01-04 00:15:12 UTC (rev 161293)
</span><span class="lines">@@ -226,12 +226,13 @@
</span><span class="cx"> public:
</span><span class="cx"> static std::unique_ptr<GraphicsLayer> create(GraphicsLayerFactory*, GraphicsLayerClient*);
</span><span class="cx">
</span><del>- typedef uint64_t PlatformLayerID;
-
</del><span class="cx"> virtual ~GraphicsLayer();
</span><span class="cx">
</span><span class="cx"> virtual void initialize() { }
</span><span class="cx">
</span><ins>+ typedef uint64_t PlatformLayerID;
+ virtual PlatformLayerID primaryLayerID() const { return 0; }
+
</ins><span class="cx"> GraphicsLayerClient* client() const { return m_client; }
</span><span class="cx">
</span><span class="cx"> // Layer name. Only used to identify layers in debug output
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscaGraphicsLayerCAcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (161292 => 161293)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp        2014-01-04 00:04:36 UTC (rev 161292)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp        2014-01-04 00:15:12 UTC (rev 161293)
</span><span class="lines">@@ -397,6 +397,11 @@
</span><span class="cx"> noteLayerPropertyChanged(NameChanged);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+GraphicsLayer::PlatformLayerID GraphicsLayerCA::primaryLayerID() const
+{
+ return primaryLayer()->layerID();
+}
+
</ins><span class="cx"> PlatformLayer* GraphicsLayerCA::platformLayer() const
</span><span class="cx"> {
</span><span class="cx"> return primaryLayer()->platformLayer();
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscaGraphicsLayerCAh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (161292 => 161293)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h        2014-01-04 00:04:36 UTC (rev 161292)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h        2014-01-04 00:15:12 UTC (rev 161293)
</span><span class="lines">@@ -60,6 +60,8 @@
</span><span class="cx">
</span><span class="cx"> virtual void setName(const String&);
</span><span class="cx">
</span><ins>+ virtual PlatformLayerID primaryLayerID() const OVERRIDE;
+
</ins><span class="cx"> virtual PlatformLayer* platformLayer() const;
</span><span class="cx"> virtual PlatformCALayer* platformCALayer() const { return primaryLayer(); }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscaPlatformCALayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp (161292 => 161293)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp        2014-01-04 00:04:36 UTC (rev 161292)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp        2014-01-04 00:15:12 UTC (rev 161293)
</span><span class="lines">@@ -30,6 +30,19 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><ins>+static GraphicsLayer::PlatformLayerID generateLayerID()
+{
+ static GraphicsLayer::PlatformLayerID layerID;
+ return ++layerID;
+}
+
+PlatformCALayer::PlatformCALayer(LayerType layerType, PlatformCALayerClient* owner)
+ : m_layerType(layerType)
+ , m_layerID(generateLayerID())
+ , m_owner(owner)
+{
+}
+
</ins><span class="cx"> PlatformCALayer::~PlatformCALayer()
</span><span class="cx"> {
</span><span class="cx"> // Clear the owner, which also clears it in the delegate to prevent attempts
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscaPlatformCALayerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h (161292 => 161293)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h        2014-01-04 00:04:36 UTC (rev 161292)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h        2014-01-04 00:15:12 UTC (rev 161293)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #if USE(ACCELERATED_COMPOSITING)
</span><span class="cx">
</span><span class="cx"> #include "GraphicsContext.h"
</span><ins>+#include "GraphicsLayer.h"
</ins><span class="cx"> #include "PlatformCAAnimation.h"
</span><span class="cx"> #include "PlatformCALayerClient.h"
</span><span class="cx"> #include <QuartzCore/CABase.h>
</span><span class="lines">@@ -80,6 +81,8 @@
</span><span class="cx">
</span><span class="cx"> virtual ~PlatformCALayer();
</span><span class="cx">
</span><ins>+ GraphicsLayer::PlatformLayerID layerID() const { return m_layerID; }
+
</ins><span class="cx"> virtual bool isPlatformCALayerMac() const { return false; }
</span><span class="cx"> virtual bool isPlatformCALayerRemote() const { return false; }
</span><span class="cx">
</span><span class="lines">@@ -210,12 +213,10 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> protected:
</span><del>- PlatformCALayer(LayerType layerType, PlatformCALayerClient* owner)
- : m_layerType(layerType)
- , m_owner(owner)
- { }
</del><ins>+ PlatformCALayer(LayerType, PlatformCALayerClient* owner);
</ins><span class="cx">
</span><del>- LayerType m_layerType;
</del><ins>+ const LayerType m_layerType;
+ const GraphicsLayer::PlatformLayerID m_layerID;
</ins><span class="cx"> RetainPtr<PlatformLayer> m_layer;
</span><span class="cx"> PlatformCALayerClient* m_owner;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscamacPlatformCALayerMach"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h (161292 => 161293)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h        2014-01-04 00:04:36 UTC (rev 161292)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h        2014-01-04 00:15:12 UTC (rev 161293)
</span><span class="lines">@@ -147,7 +147,11 @@
</span><span class="cx"> virtual void enumerateRectsBeingDrawn(CGContextRef, void (^block)(CGRect)) OVERRIDE;
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- PlatformCALayerMac(LayerType, PlatformLayer*, PlatformCALayerClient* owner);
</del><ins>+ PlatformCALayerMac(LayerType, PlatformCALayerClient* owner);
+ PlatformCALayerMac(PlatformLayer*, PlatformCALayerClient* owner);
+
+ void commonInit();
+
</ins><span class="cx"> virtual bool isPlatformCALayerMac() const OVERRIDE { return true; }
</span><span class="cx">
</span><span class="cx"> bool requiresCustomAppearanceUpdateOnBoundsChange() const;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscamacPlatformCALayerMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm (161292 => 161293)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm        2014-01-04 00:04:36 UTC (rev 161292)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm        2014-01-04 00:15:12 UTC (rev 161293)
</span><span class="lines">@@ -55,12 +55,12 @@
</span><span class="cx">
</span><span class="cx"> PassRefPtr<PlatformCALayer> PlatformCALayerMac::create(LayerType layerType, PlatformCALayerClient* owner)
</span><span class="cx"> {
</span><del>- return adoptRef(new PlatformCALayerMac(layerType, 0, owner));
</del><ins>+ return adoptRef(new PlatformCALayerMac(layerType, owner));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> PassRefPtr<PlatformCALayer> PlatformCALayerMac::create(void* platformLayer, PlatformCALayerClient* owner)
</span><span class="cx"> {
</span><del>- return adoptRef(new PlatformCALayerMac(LayerTypeCustom, static_cast<PlatformLayer*>(platformLayer), owner));
</del><ins>+ return adoptRef(new PlatformCALayerMac(static_cast<PlatformLayer*>(platformLayer), owner));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static NSString * const platformCALayerPointer = @"WKPlatformCALayer";
</span><span class="lines">@@ -177,50 +177,57 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-PlatformCALayerMac::PlatformCALayerMac(LayerType layerType, PlatformLayer* layer, PlatformCALayerClient* owner)
- : PlatformCALayer(layer ? LayerTypeCustom : layerType, owner)
</del><ins>+PlatformCALayerMac::PlatformCALayerMac(LayerType layerType, PlatformCALayerClient* owner)
+ : PlatformCALayer(layerType, owner)
</ins><span class="cx"> , m_customAppearance(GraphicsLayer::NoCustomAppearance)
</span><span class="cx"> {
</span><del>- BEGIN_BLOCK_OBJC_EXCEPTIONS
- if (layer) {
- if ([layer isKindOfClass:getAVPlayerLayerClass()])
- m_layerType = LayerTypeAVPlayerLayer;
- m_layer = layer;
- } else {
- Class layerClass = Nil;
- switch (layerType) {
- case LayerTypeLayer:
- case LayerTypeRootLayer:
- layerClass = [CALayer class];
- break;
- case LayerTypeWebLayer:
- layerClass = [WebLayer class];
- break;
- case LayerTypeSimpleLayer:
- case LayerTypeTiledBackingTileLayer:
- layerClass = [WebSimpleLayer class];
- break;
- case LayerTypeTransformLayer:
- layerClass = [CATransformLayer class];
- break;
- case LayerTypeWebTiledLayer:
- ASSERT_NOT_REACHED();
- break;
- case LayerTypeTiledBackingLayer:
- case LayerTypePageTiledBackingLayer:
- layerClass = [WebTiledBackingLayer class];
- break;
- case LayerTypeAVPlayerLayer:
- layerClass = getAVPlayerLayerClass();
- break;
- case LayerTypeCustom:
- break;
- }
</del><ins>+ Class layerClass = Nil;
+ switch (layerType) {
+ case LayerTypeLayer:
+ case LayerTypeRootLayer:
+ layerClass = [CALayer class];
+ break;
+ case LayerTypeWebLayer:
+ layerClass = [WebLayer class];
+ break;
+ case LayerTypeSimpleLayer:
+ case LayerTypeTiledBackingTileLayer:
+ layerClass = [WebSimpleLayer class];
+ break;
+ case LayerTypeTransformLayer:
+ layerClass = [CATransformLayer class];
+ break;
+ case LayerTypeWebTiledLayer:
+ ASSERT_NOT_REACHED();
+ break;
+ case LayerTypeTiledBackingLayer:
+ case LayerTypePageTiledBackingLayer:
+ layerClass = [WebTiledBackingLayer class];
+ break;
+ case LayerTypeAVPlayerLayer:
+ layerClass = getAVPlayerLayerClass();
+ break;
+ case LayerTypeCustom:
+ break;
+ }
</ins><span class="cx">
</span><del>- if (layerClass)
- m_layer = adoptNS([[layerClass alloc] init]);
- }
</del><ins>+ if (layerClass)
+ m_layer = adoptNS([[layerClass alloc] init]);
</ins><span class="cx">
</span><ins>+ commonInit();
+}
+
+PlatformCALayerMac::PlatformCALayerMac(PlatformLayer* layer, PlatformCALayerClient* owner)
+ : PlatformCALayer([layer isKindOfClass:getAVPlayerLayerClass()] ? LayerTypeAVPlayerLayer : LayerTypeCustom, owner)
+ , m_customAppearance(GraphicsLayer::NoCustomAppearance)
+{
+ m_layer = layer;
+ commonInit();
+}
+
+void PlatformCALayerMac::commonInit()
+{
+ BEGIN_BLOCK_OBJC_EXCEPTIONS
</ins><span class="cx"> // Save a pointer to 'this' in the CALayer
</span><span class="cx"> [m_layer.get() setValue:[NSValue valueWithPointer:this] forKey:platformCALayerPointer];
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (161292 => 161293)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-01-04 00:04:36 UTC (rev 161292)
+++ trunk/Source/WebKit2/ChangeLog        2014-01-04 00:15:12 UTC (rev 161293)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2014-01-03 Simon Fraser <simon.fraser@apple.com>
+
+ Give all PlatformCALayers a PlatformLayerID, not just remote ones
+ https://bugs.webkit.org/show_bug.cgi?id=126466
+
+ Reviewed by Tim Horton.
+
+ The ScrollingStateTree has references to both GraphicsLayers and PlatformLayers
+ which is confusing, and is necessary because the underlying PlatformLayer
+ inside a GraphicsLayer can change. In order to hide some of this complexity,
+ expose GraphicsLayer::primaryLayerID() which is a PlatformLayerID that clients
+ can hold onto to test for underlying layer swapping.
+
+ GraphicsLayerCARemote and PlatformCALayerRemote can now just use the
+ primaryLayerID() function exposed via the base class.
+
+ * WebProcess/WebPage/mac/GraphicsLayerCARemote.cpp:
+ * WebProcess/WebPage/mac/GraphicsLayerCARemote.h:
+ * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
+ (PlatformCALayerRemote::PlatformCALayerRemote):
+ (PlatformCALayerRemote::recursiveBuildTransaction):
+ * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
+
</ins><span class="cx"> 2014-01-03 Dan Bernstein <mitz@apple.com>
</span><span class="cx">
</span><span class="cx"> [Cocoa] Expose session state API
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacGraphicsLayerCARemotecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/GraphicsLayerCARemote.cpp (161292 => 161293)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/GraphicsLayerCARemote.cpp        2014-01-04 00:04:36 UTC (rev 161292)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/GraphicsLayerCARemote.cpp        2014-01-04 00:15:12 UTC (rev 161293)
</span><span class="lines">@@ -38,11 +38,6 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-GraphicsLayer::PlatformLayerID GraphicsLayerCARemote::primaryLayerID() const
-{
- return toPlatformCALayerRemote(platformCALayer())->layerID();
-}
-
</del><span class="cx"> #if ENABLE(CSS_FILTERS)
</span><span class="cx"> bool GraphicsLayerCARemote::filtersCanBeComposited(const FilterOperations& filters)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacGraphicsLayerCARemoteh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/GraphicsLayerCARemote.h (161292 => 161293)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/GraphicsLayerCARemote.h        2014-01-04 00:04:36 UTC (rev 161292)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/GraphicsLayerCARemote.h        2014-01-04 00:15:12 UTC (rev 161293)
</span><span class="lines">@@ -45,8 +45,6 @@
</span><span class="cx">
</span><span class="cx"> virtual ~GraphicsLayerCARemote();
</span><span class="cx">
</span><del>- PlatformLayerID primaryLayerID() const;
-
</del><span class="cx"> #if ENABLE(CSS_FILTERS)
</span><span class="cx"> virtual bool filtersCanBeComposited(const WebCore::FilterOperations& filters) OVERRIDE;
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacPlatformCALayerRemotecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp (161292 => 161293)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp        2014-01-04 00:04:36 UTC (rev 161292)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp        2014-01-04 00:15:12 UTC (rev 161293)
</span><span class="lines">@@ -47,12 +47,6 @@
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> using namespace WebKit;
</span><span class="cx">
</span><del>-static WebCore::GraphicsLayer::PlatformLayerID generateLayerID()
-{
- static WebCore::GraphicsLayer::PlatformLayerID layerID;
- return ++layerID;
-}
-
</del><span class="cx"> PassRefPtr<PlatformCALayerRemote> PlatformCALayerRemote::create(LayerType layerType, PlatformCALayerClient* owner, RemoteLayerTreeContext* context)
</span><span class="cx"> {
</span><span class="cx"> RefPtr<PlatformCALayerRemote> layer;
</span><span class="lines">@@ -78,7 +72,6 @@
</span><span class="cx">
</span><span class="cx"> PlatformCALayerRemote::PlatformCALayerRemote(LayerType layerType, PlatformCALayerClient* owner, RemoteLayerTreeContext* context)
</span><span class="cx"> : PlatformCALayer(layerType, owner)
</span><del>- , m_layerID(generateLayerID())
</del><span class="cx"> , m_superlayer(nullptr)
</span><span class="cx"> , m_maskLayer(nullptr)
</span><span class="cx"> , m_acceleratesDrawing(false)
</span><span class="lines">@@ -112,7 +105,7 @@
</span><span class="cx"> if (m_properties.changedProperties & RemoteLayerTreeTransaction::ChildrenChanged) {
</span><span class="cx"> m_properties.children.clear();
</span><span class="cx"> for (auto layer : m_children)
</span><del>- m_properties.children.append(toPlatformCALayerRemote(layer.get())->layerID());
</del><ins>+ m_properties.children.append(layer->layerID());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (m_layerType == LayerTypeCustom) {
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacPlatformCALayerRemoteh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h (161292 => 161293)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h        2014-01-04 00:04:36 UTC (rev 161292)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h        2014-01-04 00:15:12 UTC (rev 161293)
</span><span class="lines">@@ -44,8 +44,6 @@
</span><span class="cx">
</span><span class="cx"> virtual ~PlatformCALayerRemote();
</span><span class="cx">
</span><del>- WebCore::GraphicsLayer::PlatformLayerID layerID() { return m_layerID; }
-
</del><span class="cx"> virtual bool usesTiledBackingLayer() const OVERRIDE { return layerType() == LayerTypePageTiledBackingLayer || layerType() == LayerTypeTiledBackingLayer; }
</span><span class="cx">
</span><span class="cx"> virtual PlatformLayer* platformLayer() const OVERRIDE { return nullptr; }
</span><span class="lines">@@ -161,7 +159,6 @@
</span><span class="cx">
</span><span class="cx"> bool requiresCustomAppearanceUpdateOnBoundsChange() const;
</span><span class="cx">
</span><del>- const WebCore::GraphicsLayer::PlatformLayerID m_layerID;
</del><span class="cx"> RemoteLayerTreeTransaction::LayerProperties m_properties;
</span><span class="cx"> WebCore::PlatformCALayerList m_children;
</span><span class="cx"> PlatformCALayerRemote* m_superlayer;
</span></span></pre>
</div>
</div>
</body>
</html>