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

Unified Diff: third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp

Issue 1583103007: Use an up-to-date canvas size when building canvas filters (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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/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;

Powered by Google App Engine
This is Rietveld 408576698