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(); |
} |
} |