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

Side by Side 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, 5 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 unified diff | Download patch
« no previous file with comments | « Source/bindings/v8/Dictionary.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> 6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org>
7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved. 8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved.
9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
10 * 10 *
(...skipping 2355 matching lines...) Expand 10 before | Expand all | Expand 10 after
2366 { 2366 {
2367 HitRegionOptions passOptions; 2367 HitRegionOptions passOptions;
2368 2368
2369 options.getWithUndefinedOrNullCheck("id", passOptions.id); 2369 options.getWithUndefinedOrNullCheck("id", passOptions.id);
2370 options.getWithUndefinedOrNullCheck("control", passOptions.control); 2370 options.getWithUndefinedOrNullCheck("control", passOptions.control);
2371 if (passOptions.id.isEmpty() && !passOptions.control) { 2371 if (passOptions.id.isEmpty() && !passOptions.control) {
2372 exceptionState.throwDOMException(NotSupportedError, "Both id and control are null."); 2372 exceptionState.throwDOMException(NotSupportedError, "Both id and control are null.");
2373 return; 2373 return;
2374 } 2374 }
2375 2375
2376 RefPtr<Path2D> path2d;
2377 options.getWithUndefinedOrNullCheck("path", path2d);
2378 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.
2379
2376 FloatRect clipBounds; 2380 FloatRect clipBounds;
2377 GraphicsContext* context = drawingContext(); 2381 GraphicsContext* context = drawingContext();
2378 2382
2379 if (m_path.isEmpty() || !context || !state().m_invertibleCTM 2383 if (specifiedPath.isEmpty() || !context || !state().m_invertibleCTM
2380 || !context->getTransformedClipBounds(&clipBounds)) { 2384 || !context->getTransformedClipBounds(&clipBounds)) {
2381 exceptionState.throwDOMException(NotSupportedError, "The specified path has no pixels."); 2385 exceptionState.throwDOMException(NotSupportedError, "The specified path has no pixels.");
2382 return; 2386 return;
2383 } 2387 }
2384 2388
2385 Path specifiedPath = m_path;
2386 specifiedPath.transform(state().m_transform); 2389 specifiedPath.transform(state().m_transform);
2387 2390
2388 if (context->isClipMode()) { 2391 if (context->isClipMode()) {
2389 // FIXME: The hit regions should take clipping region into account. 2392 // FIXME: The hit regions should take clipping region into account.
2390 // However, we have no way to get the region from canvas state stack by now. 2393 // However, we have no way to get the region from canvas state stack by now.
2391 // See http://crbug.com/387057 2394 // See http://crbug.com/387057
2392 exceptionState.throwDOMException(NotSupportedError, "The specified path has no pixels."); 2395 exceptionState.throwDOMException(NotSupportedError, "The specified path has no pixels.");
2393 return; 2396 return;
2394 } 2397 }
2395 2398
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
2441 2444
2442 unsigned CanvasRenderingContext2D::hitRegionsCount() const 2445 unsigned CanvasRenderingContext2D::hitRegionsCount() const
2443 { 2446 {
2444 if (m_hitRegionManager) 2447 if (m_hitRegionManager)
2445 return m_hitRegionManager->getHitRegionsCount(); 2448 return m_hitRegionManager->getHitRegionsCount();
2446 2449
2447 return 0; 2450 return 0;
2448 } 2451 }
2449 2452
2450 } // namespace WebCore 2453 } // namespace WebCore
OLDNEW
« 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