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

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: add test for transform 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
« no previous file with comments | « Source/bindings/v8/Dictionary.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/canvas/CanvasRenderingContext2D.cpp
diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.cpp b/Source/core/html/canvas/CanvasRenderingContext2D.cpp
index 933275c0f1bb0eb8ece6ccc861e0124b756fc810..c42d58574469c8e8921db970bc9babba6f76aa00 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;
+
c.shu 2014/07/01 02:03:28 The above can be simplified as Path specifiedPath
zino 2014/07/01 05:37:28 Done.
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.");
Rik 2014/06/30 16:42:00 I know this isn't part of this CL but we really sh
zino 2014/07/01 05:37:28 I'm not sure but, According to the spec, if the sp
return;
}
- Path specifiedPath = m_path;
specifiedPath.transform(state().m_transform);
if (context->isClipMode()) {
« no previous file with comments | « Source/bindings/v8/Dictionary.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698