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

Side by Side Diff: Source/core/html/canvas/HitRegion.h

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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef HitRegion_h 5 #ifndef HitRegion_h
6 #define HitRegion_h 6 #define HitRegion_h
7 7
8 #include "bindings/v8/Dictionary.h" 8 #include "bindings/v8/Dictionary.h"
9 #include "core/dom/Element.h" 9 #include "core/dom/Element.h"
10 #include "platform/graphics/Path.h" 10 #include "platform/graphics/Path.h"
11 #include "platform/heap/Handle.h" 11 #include "platform/heap/Handle.h"
12 #include "wtf/Noncopyable.h" 12 #include "wtf/Noncopyable.h"
13 #include "wtf/OwnPtr.h" 13 #include "wtf/OwnPtr.h"
14 #include "wtf/PassOwnPtr.h" 14 #include "wtf/PassOwnPtr.h"
15 #include "wtf/PassRefPtr.h" 15 #include "wtf/PassRefPtr.h"
16 #include "wtf/RefPtr.h" 16 #include "wtf/RefPtr.h"
17 17
18 namespace WebCore { 18 namespace WebCore {
19 19
20 struct HitRegionOptions { 20 struct HitRegionOptions {
21 STACK_ALLOCATED(); 21 STACK_ALLOCATED();
22 22
23 public: 23 public:
24 String id; 24 String id;
25 RefPtrWillBeMember<Element> control; 25 RefPtrWillBeMember<Element> control;
26 Path path; 26 Path path;
27 WindRule fillRule;
27 }; 28 };
28 29
29 class HitRegion FINAL : public RefCountedWillBeGarbageCollectedFinalized<HitRegi on> { 30 class HitRegion FINAL : public RefCountedWillBeGarbageCollectedFinalized<HitRegi on> {
30 public: 31 public:
31 static PassRefPtrWillBeRawPtr<HitRegion> create(const HitRegionOptions& opti ons) 32 static PassRefPtrWillBeRawPtr<HitRegion> create(const HitRegionOptions& opti ons)
32 { 33 {
33 return adoptRefWillBeNoop(new HitRegion(options)); 34 return adoptRefWillBeNoop(new HitRegion(options));
34 } 35 }
35 36
36 virtual ~HitRegion() { } 37 virtual ~HitRegion() { }
37 38
38 void removePixels(const Path&); 39 void removePixels(const Path&);
39 void updateAccessibility(Element* canvas); 40 void updateAccessibility(Element* canvas);
40 41
41 bool contains(const LayoutPoint&) const; 42 bool contains(const LayoutPoint&) const;
42 43
43 const String& id() const { return m_id; } 44 const String& id() const { return m_id; }
44 const Path& path() const { return m_path; } 45 const Path& path() const { return m_path; }
45 Element* control() const { return m_control.get(); } 46 Element* control() const { return m_control.get(); }
47 WindRule fillRule() const { return m_fillRule; }
46 48
47 void trace(Visitor*); 49 void trace(Visitor*);
48 50
49 private: 51 private:
50 explicit HitRegion(const HitRegionOptions&); 52 explicit HitRegion(const HitRegionOptions&);
51 53
52 String m_id; 54 String m_id;
53 RefPtrWillBeMember<Element> m_control; 55 RefPtrWillBeMember<Element> m_control;
54 Path m_path; 56 Path m_path;
57 WindRule m_fillRule;
55 }; 58 };
56 59
57 class HitRegionManager FINAL : public NoBaseWillBeGarbageCollected<HitRegionMana ger> { 60 class HitRegionManager FINAL : public NoBaseWillBeGarbageCollected<HitRegionMana ger> {
58 WTF_MAKE_NONCOPYABLE(HitRegionManager); 61 WTF_MAKE_NONCOPYABLE(HitRegionManager);
59 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(HitRegionManager) 62 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(HitRegionManager)
60 public: 63 public:
61 static PassOwnPtrWillBeRawPtr<HitRegionManager> create() { return adoptPtrWi llBeNoop(new HitRegionManager()); } 64 static PassOwnPtrWillBeRawPtr<HitRegionManager> create() { return adoptPtrWi llBeNoop(new HitRegionManager()); }
62 65
63 void addHitRegion(PassRefPtrWillBeRawPtr<HitRegion>); 66 void addHitRegion(PassRefPtrWillBeRawPtr<HitRegion>);
64 67
(...skipping 20 matching lines...) Expand all
85 typedef WillBeHeapHashMap<RefPtrWillBeMember<Element>, RefPtrWillBeMember<Hi tRegion> > HitRegionControlMap; 88 typedef WillBeHeapHashMap<RefPtrWillBeMember<Element>, RefPtrWillBeMember<Hi tRegion> > HitRegionControlMap;
86 89
87 HitRegionList m_hitRegionList; 90 HitRegionList m_hitRegionList;
88 HitRegionIdMap m_hitRegionIdMap; 91 HitRegionIdMap m_hitRegionIdMap;
89 HitRegionControlMap m_hitRegionControlMap; 92 HitRegionControlMap m_hitRegionControlMap;
90 }; 93 };
91 94
92 } // namespace WebCore 95 } // namespace WebCore
93 96
94 #endif 97 #endif
OLDNEW
« no previous file with comments | « Source/core/html/canvas/CanvasRenderingContext2D.cpp ('k') | Source/core/html/canvas/HitRegion.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698