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

Unified Diff: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp

Issue 2774903003: Fix the compositing of placeholder canvas backgrounds (Closed)
Patch Set: un-dupe function Created 3 years, 9 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
Index: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
index a67d5daa6b6ed92a786f29761a9469fa43a62f88..969ce1d80c4b5c84e2f0066094e9faa5c8494df9 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
@@ -119,12 +119,10 @@ static inline bool isAcceleratedCanvas(const LayoutObject& layoutObject) {
return false;
}
-static inline bool isCanvasControlledByOffscreen(
- const LayoutObject& layoutObject) {
+static inline bool isPlaceholderCanvas(const LayoutObject& layoutObject) {
if (layoutObject.isCanvas()) {
HTMLCanvasElement* canvas = toHTMLCanvasElement(layoutObject.node());
- if (canvas->surfaceLayerBridge())
- return true;
+ return canvas->surfaceLayerBridge();
}
return false;
}
@@ -427,6 +425,10 @@ void CompositedLayerMapping::updateContentsOpaque() {
m_graphicsLayer->setContentsOpaque(false);
m_backgroundLayer->setContentsOpaque(
m_owningLayer.backgroundIsKnownToBeOpaqueInRect(compositedBounds()));
+ } else if (isPlaceholderCanvas(layoutObject())) {
+ // TODO(crbug.com/705019): Contents could be opaque, but that cannot be
+ // determined from the main thread. Or can it?
+ m_graphicsLayer->setContentsOpaque(false);
} else {
// For non-root layers, background is painted by the scrolling contents
// layer if all backgrounds are background attachment local, otherwise
@@ -754,7 +756,7 @@ bool CompositedLayerMapping::updateGraphicsLayerConfiguration() {
} else if (layoutObject.isVideo()) {
HTMLMediaElement* mediaElement = toHTMLMediaElement(layoutObject.node());
m_graphicsLayer->setContentsToPlatformLayer(mediaElement->platformLayer());
- } else if (isCanvasControlledByOffscreen(layoutObject)) {
+ } else if (isPlaceholderCanvas(layoutObject)) {
HTMLCanvasElement* canvas = toHTMLCanvasElement(layoutObject.node());
m_graphicsLayer->setContentsToPlatformLayer(
canvas->surfaceLayerBridge()->getWebLayer());

Powered by Google App Engine
This is Rietveld 408576698