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

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: 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 2378 matching lines...) Expand 10 before | Expand all | Expand 10 after
2389 specifiedPath.transform(state().m_transform); 2389 specifiedPath.transform(state().m_transform);
2390 2390
2391 if (context->isClipMode()) { 2391 if (context->isClipMode()) {
2392 // FIXME: The hit regions should take clipping region into account. 2392 // FIXME: The hit regions should take clipping region into account.
2393 // 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.
2394 // See http://crbug.com/387057 2394 // See http://crbug.com/387057
2395 exceptionState.throwDOMException(NotSupportedError, "The specified path has no pixels."); 2395 exceptionState.throwDOMException(NotSupportedError, "The specified path has no pixels.");
2396 } 2396 }
2397 2397
2398 passOptions.path = specifiedPath; 2398 passOptions.path = specifiedPath;
2399
2400 String fillRuleString;
2401 options.getWithUndefinedOrNullCheck("fillRule", fillRuleString);
2402 if (fillRuleString.isEmpty() || fillRuleString != "evenodd")
2403 passOptions.fillRule = RULE_NONZERO;
2404 else
2405 passOptions.fillRule = RULE_EVENODD;
2406
2399 addHitRegionInternal(passOptions, exceptionState); 2407 addHitRegionInternal(passOptions, exceptionState);
2400 } 2408 }
2401 2409
2402 void CanvasRenderingContext2D::addHitRegionInternal(const HitRegionOptions& opti ons, ExceptionState& exceptionState) 2410 void CanvasRenderingContext2D::addHitRegionInternal(const HitRegionOptions& opti ons, ExceptionState& exceptionState)
2403 { 2411 {
2404 if (!m_hitRegionManager) 2412 if (!m_hitRegionManager)
2405 m_hitRegionManager = HitRegionManager::create(); 2413 m_hitRegionManager = HitRegionManager::create();
2406 2414
2407 // Remove previous region (with id or control) 2415 // Remove previous region (with id or control)
2408 m_hitRegionManager->removeHitRegionById(options.id); 2416 m_hitRegionManager->removeHitRegionById(options.id);
(...skipping 26 matching lines...) Expand all
2435 2443
2436 unsigned CanvasRenderingContext2D::hitRegionsCount() const 2444 unsigned CanvasRenderingContext2D::hitRegionsCount() const
2437 { 2445 {
2438 if (m_hitRegionManager) 2446 if (m_hitRegionManager)
2439 return m_hitRegionManager->getHitRegionsCount(); 2447 return m_hitRegionManager->getHitRegionsCount();
2440 2448
2441 return 0; 2449 return 0;
2442 } 2450 }
2443 2451
2444 } // namespace WebCore 2452 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698