Index: third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp |
diff --git a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp |
index 8cf6c194b1d8705f3a361699351866cedf243c06..819b6ffdfdb27598838574573ba85da2bc71ba84 100644 |
--- a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp |
+++ b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp |
@@ -876,6 +876,13 @@ bool CanvasRenderingContext2D::draw(const DrawFunc& drawFunc, const ContainsFunc |
if (!state().isTransformInvertible()) |
return false; |
+ // Filter construction can depend on the bounding box of the canvas' layout object, |
+ // so we need layout to be up-to-date if filter construction is needed. However, |
+ // layout can trigger scripts that cause the canvas to be freed, so we need to |
+ // trigger layout before checking for the drawing canvas. |
+ if (state().needsToBuildFilter()) |
+ canvas()->document().updateLayoutIgnorePendingStylesheets(); |
Justin Novosad
2016/01/15 21:16:28
This is a big hammer that may affect performance i
ajuma
2016/01/18 14:34:15
Turns out that updateLayoutTreeForNodeIfNeeded isn
|
+ |
SkIRect clipBounds; |
if (!drawingCanvas() || !drawingCanvas()->getClipDeviceBounds(&clipBounds)) |
return false; |