- Revision
- 124841
- Author
- [email protected]
- Date
- 2012-08-06 20:37:24 -0700 (Mon, 06 Aug 2012)
Log Message
[chromium] Remove lingering unwrap<>() calls in GraphicsLayerChromium.cpp
https://bugs.webkit.org/show_bug.cgi?id=93319
Patch by James Robinson <[email protected]> on 2012-08-06
Reviewed by Adrienne Walker.
Source/Platform:
Adds a few more entry points to WebLayer that are being used by GraphicsLayerChromium.
* chromium/public/WebLayer.h:
(WebLayer):
Source/WebCore:
Gets rid of all (but one) of the remaining unwrap<LayerChromium>() calls in GraphicsLayer chromium to avoid
punching through the WebLayer API. Covered by many layout tests, mostly in compositing/
* platform/graphics/chromium/GraphicsLayerChromium.cpp:
(WebCore::GraphicsLayerChromium::willBeDestroyed):
(WebCore::GraphicsLayerChromium::setName):
(WebCore::GraphicsLayerChromium::updateNames):
(WebCore::GraphicsLayerChromium::setMaskLayer):
(WebCore::GraphicsLayerChromium::setReplicatedByLayer):
(WebCore::GraphicsLayerChromium::setContentsToImage):
(WebCore::GraphicsLayerChromium::setContentsToCanvas):
(WebCore::GraphicsLayerChromium::setContentsToMedia):
(WebCore::GraphicsLayerChromium::updateChildList):
(WebCore::GraphicsLayerChromium::setupContentsLayer):
* platform/graphics/chromium/GraphicsLayerChromium.h:
(GraphicsLayerChromium):
Source/WebKit/chromium:
* src/WebLayer.cpp:
(WebKit::WebLayer::setChildren):
(WebKit):
(WebKit::WebLayer::setReplicaLayer):
(WebKit::WebLayer::setDebugName):
(WebKit::WebLayer::clearRenderSurface):
Modified Paths
Diff
Modified: trunk/Source/Platform/ChangeLog (124840 => 124841)
--- trunk/Source/Platform/ChangeLog 2012-08-07 03:18:39 UTC (rev 124840)
+++ trunk/Source/Platform/ChangeLog 2012-08-07 03:37:24 UTC (rev 124841)
@@ -1,3 +1,15 @@
+2012-08-06 James Robinson <[email protected]>
+
+ [chromium] Remove lingering unwrap<>() calls in GraphicsLayerChromium.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=93319
+
+ Reviewed by Adrienne Walker.
+
+ Adds a few more entry points to WebLayer that are being used by GraphicsLayerChromium.
+
+ * chromium/public/WebLayer.h:
+ (WebLayer):
+
2012-08-06 Antoine Labour <[email protected]>
[chromium] add sync points and GL_CHROMIUM_texture_mailbox entrypoints to WebGraphicsContext3D
Modified: trunk/Source/Platform/chromium/public/WebLayer.h (124840 => 124841)
--- trunk/Source/Platform/chromium/public/WebLayer.h 2012-08-07 03:18:39 UTC (rev 124840)
+++ trunk/Source/Platform/chromium/public/WebLayer.h 2012-08-07 03:37:24 UTC (rev 124841)
@@ -30,6 +30,8 @@
#include "WebColor.h"
#include "WebCommon.h"
#include "WebPrivatePtr.h"
+#include "WebString.h"
+#include "WebVector.h"
class SkMatrix44;
namespace WebCore { class LayerChromium; }
@@ -73,6 +75,7 @@
WEBKIT_EXPORT void addChild(const WebLayer&);
WEBKIT_EXPORT void insertChild(const WebLayer&, size_t index);
WEBKIT_EXPORT void replaceChild(const WebLayer& reference, const WebLayer& newLayer);
+ WEBKIT_EXPORT void setChildren(const WebVector<WebLayer>&);
WEBKIT_EXPORT void removeFromParent();
WEBKIT_EXPORT void removeAllChildren();
@@ -91,6 +94,8 @@
WEBKIT_EXPORT void setMaskLayer(const WebLayer&);
WEBKIT_EXPORT WebLayer maskLayer() const;
+ WEBKIT_EXPORT void setReplicaLayer(const WebLayer&);
+
WEBKIT_EXPORT void setOpacity(float);
WEBKIT_EXPORT float opacity() const;
@@ -138,6 +143,7 @@
WEBKIT_EXPORT void setDebugBorderColor(const WebColor&);
WEBKIT_EXPORT void setDebugBorderWidth(float);
+ WEBKIT_EXPORT void setDebugName(WebString);
// An animation delegate is notified when animations are started and
// stopped. The WebLayer does not take ownership of the delegate, and it is
@@ -174,6 +180,10 @@
// so, but this is to facilitate benchmarks and tests.
WEBKIT_EXPORT void setForceRenderSurface(bool);
+ // Drops this layer's render surface, if it has one. Used to break cycles in some
+ // cases - if you aren't sure, you don't need to call this.
+ WEBKIT_EXPORT void clearRenderSurface();
+
template<typename T> T to()
{
T res;
Modified: trunk/Source/WebCore/ChangeLog (124840 => 124841)
--- trunk/Source/WebCore/ChangeLog 2012-08-07 03:18:39 UTC (rev 124840)
+++ trunk/Source/WebCore/ChangeLog 2012-08-07 03:37:24 UTC (rev 124841)
@@ -1,3 +1,27 @@
+2012-08-06 James Robinson <[email protected]>
+
+ [chromium] Remove lingering unwrap<>() calls in GraphicsLayerChromium.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=93319
+
+ Reviewed by Adrienne Walker.
+
+ Gets rid of all (but one) of the remaining unwrap<LayerChromium>() calls in GraphicsLayer chromium to avoid
+ punching through the WebLayer API. Covered by many layout tests, mostly in compositing/
+
+ * platform/graphics/chromium/GraphicsLayerChromium.cpp:
+ (WebCore::GraphicsLayerChromium::willBeDestroyed):
+ (WebCore::GraphicsLayerChromium::setName):
+ (WebCore::GraphicsLayerChromium::updateNames):
+ (WebCore::GraphicsLayerChromium::setMaskLayer):
+ (WebCore::GraphicsLayerChromium::setReplicatedByLayer):
+ (WebCore::GraphicsLayerChromium::setContentsToImage):
+ (WebCore::GraphicsLayerChromium::setContentsToCanvas):
+ (WebCore::GraphicsLayerChromium::setContentsToMedia):
+ (WebCore::GraphicsLayerChromium::updateChildList):
+ (WebCore::GraphicsLayerChromium::setupContentsLayer):
+ * platform/graphics/chromium/GraphicsLayerChromium.h:
+ (GraphicsLayerChromium):
+
2012-08-06 Adrienne Walker <[email protected]>
[chromium] Convert WebScrollbarThemeGeometry from a concrete class to an interface
Modified: trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp (124840 => 124841)
--- trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp 2012-08-07 03:18:39 UTC (rev 124840)
+++ trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp 2012-08-07 03:37:24 UTC (rev 124841)
@@ -107,17 +107,17 @@
{
if (!m_layer.isNull()) {
m_layer.clearClient();
- m_layer.unwrap<LayerChromium>()->clearRenderSurface();
+ m_layer.clearRenderSurface();
m_layer.setAnimationDelegate(0);
}
if (!m_contentsLayer.isNull()) {
- m_contentsLayer.unwrap<LayerChromium>()->clearRenderSurface();
+ m_contentsLayer.clearRenderSurface();
m_contentsLayer.setAnimationDelegate(0);
}
if (!m_transformLayer.isNull()) {
- m_transformLayer.unwrap<LayerChromium>()->clearRenderSurface();
+ m_transformLayer.clearRenderSurface();
m_transformLayer.setAnimationDelegate(0);
}
@@ -130,21 +130,29 @@
void GraphicsLayerChromium::setName(const String& inName)
{
m_nameBase = inName;
- String name = String::format("GraphicsLayerChromium(%p) GraphicsLayer(%p) ", m_layer.unwrap<LayerChromium>(), this) + inName;
+ String name = String::format("GraphicsLayer(%p) ", this) + inName;
GraphicsLayer::setName(name);
updateNames();
}
void GraphicsLayerChromium::updateNames()
{
- if (!m_layer.isNull())
- m_layer.unwrap<LayerChromium>()->setDebugName("Layer for " + m_nameBase);
- if (!m_transformLayer.isNull())
- m_transformLayer.unwrap<LayerChromium>()->setDebugName("TransformLayer for " + m_nameBase);
- if (!m_contentsLayer.isNull())
- m_contentsLayer.unwrap<LayerChromium>()->setDebugName("ContentsLayer for " + m_nameBase);
- if (m_linkHighlight)
- m_linkHighlight->contentLayer()->setDebugName("LinkHighlight for " + m_nameBase);
+ if (!m_layer.isNull()) {
+ String debugName = "Layer for " + m_nameBase;
+ m_layer.setDebugName(debugName);
+ }
+ if (!m_transformLayer.isNull()) {
+ String debugName = "TransformLayer for " + m_nameBase;
+ m_transformLayer.setDebugName(debugName);
+ }
+ if (!m_contentsLayer.isNull()) {
+ String debugName = "ContentsLayer for " + m_nameBase;
+ m_contentsLayer.setDebugName(debugName);
+ }
+ if (m_linkHighlight) {
+ String debugName = "LinkHighlight for " + m_nameBase;
+ m_linkHighlight->contentLayer()->setDebugName(debugName);
+ }
}
bool GraphicsLayerChromium::setChildren(const Vector<GraphicsLayer*>& children)
@@ -402,8 +410,8 @@
GraphicsLayer::setMaskLayer(maskLayer);
- LayerChromium* maskLayerChromium = m_maskLayer ? m_maskLayer->platformLayer() : 0;
- m_layer.unwrap<LayerChromium>()->setMaskLayer(maskLayerChromium);
+ WebLayer maskWebLayer(m_maskLayer ? m_maskLayer->platformLayer() : 0);
+ m_layer.setMaskLayer(maskWebLayer);
}
void GraphicsLayerChromium::setBackfaceVisibility(bool visible)
@@ -423,8 +431,11 @@
{
GraphicsLayerChromium* layerChromium = static_cast<GraphicsLayerChromium*>(layer);
GraphicsLayer::setReplicatedByLayer(layer);
- LayerChromium* replicaLayer = layerChromium ? layerChromium->primaryLayer().unwrap<LayerChromium>() : 0;
- primaryLayer().unwrap<LayerChromium>()->setReplicaLayer(replicaLayer);
+
+ WebLayer webReplicaLayer;
+ if (layerChromium)
+ webReplicaLayer = layerChromium->primaryLayer();
+ primaryLayer().setReplicaLayer(webReplicaLayer);
}
@@ -461,7 +472,7 @@
if (image) {
if (m_contentsLayer.isNull() || m_contentsLayerPurpose != ContentsLayerForImage) {
WebKit::WebImageLayer imageLayer = WebKit::WebImageLayer::create();
- setupContentsLayer(imageLayer.unwrap<LayerChromium>());
+ setupContentsLayer(imageLayer);
m_contentsLayerPurpose = ContentsLayerForImage;
childrenChanged = true;
}
@@ -487,8 +498,8 @@
{
bool childrenChanged = false;
if (platformLayer) {
- if (m_contentsLayer.unwrap<LayerChromium>() != platformLayer) {
- setupContentsLayer(platformLayer);
+ if (m_contentsLayer != WebLayer(platformLayer)) {
+ setupContentsLayer(WebLayer(platformLayer));
m_contentsLayerPurpose = ContentsLayerForCanvas;
childrenChanged = true;
}
@@ -566,7 +577,7 @@
bool childrenChanged = false;
if (layer) {
if (m_contentsLayer.isNull() || m_contentsLayerPurpose != ContentsLayerForVideo) {
- setupContentsLayer(layer);
+ setupContentsLayer(WebLayer(layer));
m_contentsLayerPurpose = ContentsLayerForVideo;
childrenChanged = true;
}
@@ -620,16 +631,16 @@
void GraphicsLayerChromium::updateChildList()
{
- Vector<RefPtr<LayerChromium> > newChildren;
+ Vector<WebLayer> newChildren;
if (!m_transformLayer.isNull()) {
// Add the primary layer first. Even if we have negative z-order children, the primary layer always comes behind.
- newChildren.append(m_layer.unwrap<LayerChromium>());
+ newChildren.append(m_layer);
} else if (!m_contentsLayer.isNull()) {
// FIXME: add the contents layer in the correct order with negative z-order children.
// This does not cause visible rendering issues because currently contents layers are only used
// for replaced elements that don't have children.
- newChildren.append(m_contentsLayer.unwrap<LayerChromium>());
+ newChildren.append(m_contentsLayer);
}
const Vector<GraphicsLayer*>& childLayers = children();
@@ -637,18 +648,20 @@
for (size_t i = 0; i < numChildren; ++i) {
GraphicsLayerChromium* curChild = static_cast<GraphicsLayerChromium*>(childLayers[i]);
- LayerChromium* childLayer = curChild->layerForParent().unwrap<LayerChromium>();
- newChildren.append(childLayer);
+ newChildren.append(curChild->layerForParent());
}
if (m_linkHighlight)
newChildren.append(m_linkHighlight->contentLayer());
for (size_t i = 0; i < newChildren.size(); ++i)
- newChildren[i]->removeFromParent();
+ newChildren[i].removeFromParent();
+ WebVector<WebLayer> newWebChildren;
+ newWebChildren.assign(newChildren.data(), newChildren.size());
+
if (!m_transformLayer.isNull()) {
- m_transformLayer.unwrap<LayerChromium>()->setChildren(newChildren);
+ m_transformLayer.setChildren(newWebChildren);
if (!m_contentsLayer.isNull()) {
// If we have a transform layer, then the contents layer is parented in the
@@ -657,7 +670,7 @@
m_layer.addChild(m_contentsLayer);
}
} else
- m_layer.unwrap<LayerChromium>()->setChildren(newChildren);
+ m_layer.setChildren(newWebChildren);
}
void GraphicsLayerChromium::updateLayerPosition()
@@ -812,9 +825,9 @@
m_layer.setContentsScale(contentsScale());
}
-void GraphicsLayerChromium::setupContentsLayer(LayerChromium* contentsLayer)
+void GraphicsLayerChromium::setupContentsLayer(WebLayer contentsLayer)
{
- if (contentsLayer == m_contentsLayer.unwrap<LayerChromium>())
+ if (contentsLayer == m_contentsLayer)
return;
if (!m_contentsLayer.isNull()) {
@@ -823,9 +836,9 @@
m_contentsLayer.reset();
}
- if (contentsLayer) {
- m_contentsLayer = WebLayer(contentsLayer);
+ m_contentsLayer = contentsLayer;
+ if (!m_contentsLayer.isNull()) {
m_contentsLayer.setAnchorPoint(FloatPoint(0, 0));
m_contentsLayer.setUseParentBackfaceVisibility(true);
Modified: trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.h (124840 => 124841)
--- trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.h 2012-08-07 03:18:39 UTC (rev 124840)
+++ trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.h 2012-08-07 03:37:24 UTC (rev 124841)
@@ -152,7 +152,7 @@
void updateContentsRect();
void updateContentsScale();
- void setupContentsLayer(LayerChromium*);
+ void setupContentsLayer(WebKit::WebLayer);
float contentsScale() const;
int mapAnimationNameToId(const String& animationName);
Modified: trunk/Source/WebKit/chromium/ChangeLog (124840 => 124841)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-08-07 03:18:39 UTC (rev 124840)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-08-07 03:37:24 UTC (rev 124841)
@@ -1,3 +1,17 @@
+2012-08-06 James Robinson <[email protected]>
+
+ [chromium] Remove lingering unwrap<>() calls in GraphicsLayerChromium.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=93319
+
+ Reviewed by Adrienne Walker.
+
+ * src/WebLayer.cpp:
+ (WebKit::WebLayer::setChildren):
+ (WebKit):
+ (WebKit::WebLayer::setReplicaLayer):
+ (WebKit::WebLayer::setDebugName):
+ (WebKit::WebLayer::clearRenderSurface):
+
2012-08-06 Adrienne Walker <[email protected]>
[chromium] Convert WebScrollbarThemeGeometry from a concrete class to an interface
Modified: trunk/Source/WebKit/chromium/src/WebLayer.cpp (124840 => 124841)
--- trunk/Source/WebKit/chromium/src/WebLayer.cpp 2012-08-07 03:18:39 UTC (rev 124840)
+++ trunk/Source/WebKit/chromium/src/WebLayer.cpp 2012-08-07 03:37:24 UTC (rev 124841)
@@ -144,6 +144,14 @@
m_private->replaceChild(ref.unwrap<LayerChromium>(), newLayer);
}
+void WebLayer::setChildren(const WebVector<WebLayer>& webChildren)
+{
+ Vector<RefPtr<LayerChromium> > children(webChildren.size());
+ for (size_t i = 0; i < webChildren.size(); ++i)
+ children[i] = webChildren[i].unwrap<LayerChromium>();
+ m_private->setChildren(children);
+}
+
void WebLayer::removeFromParent()
{
m_private->removeFromParent();
@@ -205,6 +213,12 @@
return WebLayer(m_private->maskLayer());
}
+void WebLayer::setReplicaLayer(const WebLayer& replicaLayer)
+{
+ WebLayer ref = replicaLayer;
+ m_private->setReplicaLayer(ref.unwrap<LayerChromium>());
+}
+
void WebLayer::setOpacity(float opacity)
{
m_private->setOpacity(opacity);
@@ -310,6 +324,11 @@
m_private->setDebugBorderWidth(width);
}
+void WebLayer::setDebugName(WebString name)
+{
+ m_private->setDebugName(name);
+}
+
void WebLayer::setAnimationDelegate(WebAnimationDelegate* delegate)
{
m_private->setLayerAnimationDelegate(delegate);
@@ -362,6 +381,11 @@
m_private->setForceRenderSurface(forceRenderSurface);
}
+void WebLayer::clearRenderSurface()
+{
+ m_private->clearRenderSurface();
+}
+
WebLayer::WebLayer(const PassRefPtr<LayerChromium>& node)
: m_private(node)
{