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

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

Issue 183763024: Revert 168245 "Drop background color optimization for composited..." (Closed) Base URL: svn://svn.chromium.org/blink/
Patch Set: Created 6 years, 10 months 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 | « trunk/Source/platform/graphics/GraphicsLayer.h ('k') | trunk/Source/web/tests/GraphicsLayerTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/Source/platform/graphics/GraphicsLayer.cpp
===================================================================
--- trunk/Source/platform/graphics/GraphicsLayer.cpp (revision 168316)
+++ trunk/Source/platform/graphics/GraphicsLayer.cpp (working copy)
@@ -99,6 +99,7 @@
, m_replicaLayer(0)
, m_replicatedLayer(0)
, m_paintCount(0)
+ , m_contentsSolidColor(Color::transparent)
, m_contentsLayer(0)
, m_contentsLayerId(0)
, m_scrollableArea(0)
@@ -1018,6 +1019,27 @@
setContentsTo(m_ninePatchLayer ? m_ninePatchLayer->layer() : 0);
}
+void GraphicsLayer::setContentsToSolidColor(const Color& color)
+{
+ if (color == m_contentsSolidColor)
+ return;
+
+ m_contentsSolidColor = color;
+ if (color.alpha()) {
+ if (!m_solidColorLayer) {
+ m_solidColorLayer = adoptPtr(Platform::current()->compositorSupport()->createSolidColorLayer());
+ registerContentsLayer(m_solidColorLayer->layer());
+ }
+ m_solidColorLayer->setBackgroundColor(color.rgb());
+ } else {
+ if (!m_solidColorLayer)
+ return;
+ unregisterContentsLayer(m_solidColorLayer->layer());
+ m_solidColorLayer.clear();
+ }
+ setContentsTo(m_solidColorLayer ? m_solidColorLayer->layer() : 0);
+}
+
bool GraphicsLayer::addAnimation(PassOwnPtr<WebAnimation> popAnimation)
{
OwnPtr<WebAnimation> animation(popAnimation);
« no previous file with comments | « trunk/Source/platform/graphics/GraphicsLayer.h ('k') | trunk/Source/web/tests/GraphicsLayerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698