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

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

Issue 63943006: Re-enable solid background color optimization for composited layers. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix build bot 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
Index: Source/core/platform/graphics/GraphicsLayer.cpp
diff --git a/Source/core/platform/graphics/GraphicsLayer.cpp b/Source/core/platform/graphics/GraphicsLayer.cpp
index deef6ca0709b3cce6fff7ee8f2e13ee21e598b5f..bc62696c389a96fa265fbb953da023ded0a6aa60 100644
--- a/Source/core/platform/graphics/GraphicsLayer.cpp
+++ b/Source/core/platform/graphics/GraphicsLayer.cpp
@@ -995,6 +995,27 @@ void GraphicsLayer::setContentsToNinePatch(Image* image, const IntRect& aperture
setContentsTo(m_ninePatchLayer ? m_ninePatchLayer->layer() : 0);
}
+void GraphicsLayer::setContentsToSolidColor(const Color& color)
+{
+ if (color == m_contentsSolidColor)
+ return;
+
+ m_contentsSolidColor = color;
+ if (color.isValid() && 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);

Powered by Google App Engine
This is Rietveld 408576698