Index: third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp |
diff --git a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp |
index 68d1351e64a3af40a74ff91a8bf00eac10f2c91e..628206e6d0a8aa1df4ce28ef3614eace4521f04d 100644 |
--- a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp |
+++ b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp |
@@ -38,6 +38,7 @@ |
#include "core/dom/ExceptionCode.h" |
#include "core/dom/TaskRunnerHelper.h" |
#include "core/fileapi/File.h" |
+#include "core/frame/FrameHost.h" |
#include "core/frame/ImageBitmap.h" |
#include "core/frame/LocalFrame.h" |
#include "core/frame/Settings.h" |
@@ -56,6 +57,7 @@ |
#include "core/layout/LayoutHTMLCanvas.h" |
#include "core/layout/api/LayoutViewItem.h" |
#include "core/layout/compositing/PaintLayerCompositor.h" |
+#include "core/page/ChromeClient.h" |
#include "core/paint/PaintLayer.h" |
#include "core/paint/PaintTiming.h" |
#include "platform/Histogram.h" |
@@ -1423,7 +1425,17 @@ String HTMLCanvasElement::getIdFromControl(const Element* element) { |
void HTMLCanvasElement::createLayer() { |
DCHECK(!m_surfaceLayerBridge); |
- m_surfaceLayerBridge = WTF::wrapUnique(new CanvasSurfaceLayerBridge(this)); |
+ LocalFrame* frame = document().frame(); |
+ WebLayerTreeView* layerTreeView = nullptr; |
+ // TODO(xlai): Ensure OffscreenCanvas commit() is still functional when a |
+ // frame-less HTML canvas's document is reparenting under another frame. |
+ // See crbug.com/683172. |
+ if (frame) { |
+ layerTreeView = frame->host()->chromeClient().getWebLayerTreeView(); |
dcheng
2017/01/23 21:53:32
Sorry, one more dumb question: why do we call crea
xlai (Olivia)
2017/01/24 20:54:12
You are right, it doesn't make sense to have a lay
|
+ } |
+ |
+ m_surfaceLayerBridge = |
+ WTF::wrapUnique(new CanvasSurfaceLayerBridge(this, layerTreeView)); |
// Creates a placeholder layer first before Surface is created. |
m_surfaceLayerBridge->createSolidColorLayer(); |
} |