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

Unified Diff: third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp

Issue 2588053003: Make OffscreenCanvas resizable (Closed)
Patch Set: Created 4 years 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 | « no previous file | third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp b/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp
index 0c58ec665a9bc86ec78c5b9e086ec11525119270..afeead46903af7074eceb5bfc6e7e31e10685c66 100644
--- a/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp
+++ b/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp
@@ -88,14 +88,13 @@ void CanvasSurfaceLayerBridge::OnSurfaceCreated(const cc::SurfaceId& surfaceId,
int32_t width,
int32_t height,
float deviceScaleFactor) {
- if (!m_currentSurfaceId.is_valid() && surfaceId.is_valid()) {
+ if (surfaceId.is_valid() && !m_currentSurfaceId.is_valid()) {
m_currentSurfaceId = surfaceId;
GraphicsLayer::unregisterContentsLayer(m_webLayer.get());
m_webLayer->removeFromParent();
scoped_refptr<cc::SurfaceLayer> surfaceLayer =
cc::SurfaceLayer::Create(m_refFactory);
- // TODO(xlai): Update this on resize.
cc::SurfaceInfo info(surfaceId, deviceScaleFactor,
gfx::Size(width, height));
surfaceLayer->SetSurfaceInfo(
@@ -108,6 +107,15 @@ void CanvasSurfaceLayerBridge::OnSurfaceCreated(const cc::SurfaceId& surfaceId,
GraphicsLayer::registerContentsLayer(m_webLayer.get());
m_observer->OnWebLayerReplaced();
+ } else if (m_currentSurfaceId != surfaceId) {
+ m_currentSurfaceId = surfaceId;
+ cc::SurfaceInfo info(m_currentSurfaceId, deviceScaleFactor,
+ gfx::Size(width, height));
+ cc::SurfaceLayer* surfaceLayer =
+ static_cast<cc::SurfaceLayer*>(m_CCLayer.get());
+ surfaceLayer->SetSurfaceInfo(info, true);
Fady Samuel 2016/12/19 20:12:40 I think you also need to update the layer bounds?
xlai (Olivia) 2016/12/19 22:30:15 Although there is no visible effect seen at the mo
+
+ m_observer->OnWebLayerReplaced();
}
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698