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

Side by Side Diff: Source/core/html/canvas/CanvasRenderingContext2D.cpp

Issue 346003007: Add fillRule option for hit regions on canvas2d. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase 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 unified diff | Download patch
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 2376 matching lines...) Expand 10 before | Expand all | Expand 10 after
2387 2387
2388 if (context->isClipMode()) { 2388 if (context->isClipMode()) {
2389 // FIXME: The hit regions should take clipping region into account. 2389 // 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. 2390 // However, we have no way to get the region from canvas state stack by now.
2391 // See http://crbug.com/387057 2391 // See http://crbug.com/387057
2392 exceptionState.throwDOMException(NotSupportedError, "The specified path has no pixels."); 2392 exceptionState.throwDOMException(NotSupportedError, "The specified path has no pixels.");
2393 return; 2393 return;
2394 } 2394 }
2395 2395
2396 passOptions.path = specifiedPath; 2396 passOptions.path = specifiedPath;
2397
2398 String fillRuleString;
2399 options.getWithUndefinedOrNullCheck("fillRule", fillRuleString);
2400 if (fillRuleString.isEmpty() || fillRuleString != "evenodd")
2401 passOptions.fillRule = RULE_NONZERO;
2402 else
2403 passOptions.fillRule = RULE_EVENODD;
2404
2397 addHitRegionInternal(passOptions, exceptionState); 2405 addHitRegionInternal(passOptions, exceptionState);
2398 } 2406 }
2399 2407
2400 void CanvasRenderingContext2D::addHitRegionInternal(const HitRegionOptions& opti ons, ExceptionState& exceptionState) 2408 void CanvasRenderingContext2D::addHitRegionInternal(const HitRegionOptions& opti ons, ExceptionState& exceptionState)
2401 { 2409 {
2402 if (!m_hitRegionManager) 2410 if (!m_hitRegionManager)
2403 m_hitRegionManager = HitRegionManager::create(); 2411 m_hitRegionManager = HitRegionManager::create();
2404 2412
2405 // Remove previous region (with id or control) 2413 // Remove previous region (with id or control)
2406 m_hitRegionManager->removeHitRegionById(options.id); 2414 m_hitRegionManager->removeHitRegionById(options.id);
(...skipping 26 matching lines...) Expand all
2433 2441
2434 unsigned CanvasRenderingContext2D::hitRegionsCount() const 2442 unsigned CanvasRenderingContext2D::hitRegionsCount() const
2435 { 2443 {
2436 if (m_hitRegionManager) 2444 if (m_hitRegionManager)
2437 return m_hitRegionManager->getHitRegionsCount(); 2445 return m_hitRegionManager->getHitRegionsCount();
2438 2446
2439 return 0; 2447 return 0;
2440 } 2448 }
2441 2449
2442 } // namespace WebCore 2450 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/canvas/canvas-hit-regions-fill-rule-test-expected.txt ('k') | Source/core/html/canvas/HitRegion.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698