Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1512)

Unified Diff: Source/core/platform/graphics/GraphicsLayer.cpp

Issue 75113003: Refactor GraphicsLayer::setContentsToImage(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/platform/graphics/GraphicsLayer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/platform/graphics/GraphicsLayer.cpp
diff --git a/Source/core/platform/graphics/GraphicsLayer.cpp b/Source/core/platform/graphics/GraphicsLayer.cpp
index 3bc07878ce0649659383cd807e30f8696f69238c..cd9bf84934110dc20754a1819f046a4353dae0da 100644
--- a/Source/core/platform/graphics/GraphicsLayer.cpp
+++ b/Source/core/platform/graphics/GraphicsLayer.cpp
@@ -101,7 +101,6 @@ GraphicsLayer::GraphicsLayer(GraphicsLayerClient* client)
, m_paintCount(0)
, m_contentsLayer(0)
, m_contentsLayerId(0)
- , m_contentsLayerPurpose(NoContentsLayer)
, m_scrollableArea(0)
, m_compositingReasons(blink::CompositingReasonUnknown)
{
@@ -449,7 +448,7 @@ void GraphicsLayer::unregisterContentsLayer(WebLayer* layer)
s_registeredLayerSet->remove(layer->id());
}
-void GraphicsLayer::setContentsTo(ContentsLayerPurpose purpose, WebLayer* layer)
+void GraphicsLayer::setContentsTo(WebLayer* layer)
{
bool childrenChanged = false;
if (layer) {
@@ -458,7 +457,6 @@ void GraphicsLayer::setContentsTo(ContentsLayerPurpose purpose, WebLayer* layer)
CRASH();
if (m_contentsLayerId != layer->id()) {
setupContentsLayer(layer);
- m_contentsLayerPurpose = purpose;
childrenChanged = true;
}
updateContentsRect();
@@ -972,33 +970,23 @@ void GraphicsLayer::setContentsRect(const IntRect& rect)
void GraphicsLayer::setContentsToImage(Image* image)
{
- bool childrenChanged = false;
RefPtr<NativeImageSkia> nativeImage = image ? image->nativeImageForCurrentFrame() : 0;
if (nativeImage) {
- if (m_contentsLayerPurpose != ContentsLayerForImage) {
+ if (!m_imageLayer) {
m_imageLayer = adoptPtr(Platform::current()->compositorSupport()->createImageLayer());
registerContentsLayer(m_imageLayer->layer());
-
- setupContentsLayer(m_imageLayer->layer());
- m_contentsLayerPurpose = ContentsLayerForImage;
- childrenChanged = true;
}
m_imageLayer->setBitmap(nativeImage->bitmap());
m_imageLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque());
updateContentsRect();
} else {
if (m_imageLayer) {
- childrenChanged = true;
-
unregisterContentsLayer(m_imageLayer->layer());
m_imageLayer.clear();
}
- // The old contents layer will be removed via updateChildList.
- m_contentsLayer = 0;
}
- if (childrenChanged)
- updateChildList();
+ setContentsTo(m_imageLayer ? m_imageLayer->layer() : 0);
}
void GraphicsLayer::setContentsToNinePatch(Image* image, const IntRect& aperture)
@@ -1014,17 +1002,17 @@ void GraphicsLayer::setContentsToNinePatch(Image* image, const IntRect& aperture
m_ninePatchLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque());
registerContentsLayer(m_ninePatchLayer->layer());
}
- setContentsTo(ContentsLayerForNinePatch, m_ninePatchLayer ? m_ninePatchLayer->layer() : 0);
+ setContentsTo(m_ninePatchLayer ? m_ninePatchLayer->layer() : 0);
}
void GraphicsLayer::setContentsToCanvas(WebLayer* layer)
jamesr 2013/11/21 20:46:02 i assume you'll remove these functions in a follow
{
- setContentsTo(ContentsLayerForCanvas, layer);
+ setContentsTo(layer);
}
void GraphicsLayer::setContentsToMedia(WebLayer* layer)
{
- setContentsTo(ContentsLayerForVideo, layer);
+ setContentsTo(layer);
}
bool GraphicsLayer::addAnimation(PassOwnPtr<WebAnimation> popAnimation)
« no previous file with comments | « Source/core/platform/graphics/GraphicsLayer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698