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

Unified Diff: Source/core/html/canvas/CanvasRenderingContext2D.cpp

Issue 354333002: Add path option(path2d) for hit regions on canvas2d. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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: Source/core/html/canvas/CanvasRenderingContext2D.cpp
diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.cpp b/Source/core/html/canvas/CanvasRenderingContext2D.cpp
index 106c93fae5d436049d583a4aae50282c7165b75e..b91681c998d2fa85dd0f37079a14caf2af10ab1f 100644
--- a/Source/core/html/canvas/CanvasRenderingContext2D.cpp
+++ b/Source/core/html/canvas/CanvasRenderingContext2D.cpp
@@ -2373,16 +2373,24 @@ void CanvasRenderingContext2D::addHitRegion(const Dictionary& options, Exception
return;
}
+ RefPtr<Path2D> path2d;
+ options.getWithUndefinedOrNullCheck("path", path2d);
+
+ Path specifiedPath;
+ if (path2d)
+ specifiedPath = path2d->path();
+ else
+ specifiedPath = m_path;
Rik 2014/06/29 03:22:22 Will the current CTM be applied to the path that y
zino 2014/06/29 04:07:18 Yes, you can see here. 2394 specifiedPath.tran
+
FloatRect clipBounds;
GraphicsContext* context = drawingContext();
- if (m_path.isEmpty() || !context || !state().m_invertibleCTM
+ if (specifiedPath.isEmpty() || !context || !state().m_invertibleCTM
|| !context->getTransformedClipBounds(&clipBounds)) {
exceptionState.throwDOMException(NotSupportedError, "The specified path has no pixels.");
return;
}
- Path specifiedPath = m_path;
specifiedPath.transform(state().m_transform);
if (context->isClipMode()) {

Powered by Google App Engine
This is Rietveld 408576698