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

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: simplify 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 f06b7c6a5c8343a301221eb517d696ba5e7d3e84..a34a5332a8c1b1092859479e47387d46e7d98de7 100644
--- a/Source/core/html/canvas/CanvasRenderingContext2D.cpp
+++ b/Source/core/html/canvas/CanvasRenderingContext2D.cpp
@@ -2373,16 +2373,19 @@ void CanvasRenderingContext2D::addHitRegion(const Dictionary& options, Exception
return;
}
+ RefPtr<Path2D> path2d;
+ options.getWithUndefinedOrNullCheck("path", path2d);
+ Path specifiedPath = path2d ? path2d->path() : m_path;
Justin Novosad 2014/07/04 15:02:44 specififiedPath is not necessarily a "specified pa
zino 2014/07/05 03:01:22 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.");
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