| OLD | NEW |
| 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/core/v8/Dictionary.h" | 8 #include "bindings/core/v8/Dictionary.h" |
| 9 #include "core/dom/Element.h" | 9 #include "core/dom/Element.h" |
| 10 #include "core/html/canvas/HitRegionOptions.h" | 10 #include "core/html/canvas/HitRegionOptions.h" |
| 11 #include "platform/graphics/Path.h" | 11 #include "platform/graphics/Path.h" |
| 12 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
| 13 #include "wtf/Noncopyable.h" | 13 #include "wtf/Noncopyable.h" |
| 14 #include "wtf/OwnPtr.h" | 14 #include "wtf/OwnPtr.h" |
| 15 #include "wtf/PassOwnPtr.h" | 15 #include "wtf/PassOwnPtr.h" |
| 16 #include "wtf/PassRefPtr.h" | 16 #include "wtf/PassRefPtr.h" |
| 17 #include "wtf/RefPtr.h" | 17 #include "wtf/RefPtr.h" |
| 18 | 18 |
| 19 namespace blink { | 19 namespace blink { |
| 20 | 20 |
| 21 class HitRegion FINAL : public RefCountedWillBeGarbageCollectedFinalized<HitRegi
on> { | 21 class HitRegion final : public RefCountedWillBeGarbageCollectedFinalized<HitRegi
on> { |
| 22 public: | 22 public: |
| 23 static PassRefPtrWillBeRawPtr<HitRegion> create(const Path& path, const HitR
egionOptions& options) | 23 static PassRefPtrWillBeRawPtr<HitRegion> create(const Path& path, const HitR
egionOptions& options) |
| 24 { | 24 { |
| 25 return adoptRefWillBeNoop(new HitRegion(path, options)); | 25 return adoptRefWillBeNoop(new HitRegion(path, options)); |
| 26 } | 26 } |
| 27 | 27 |
| 28 virtual ~HitRegion() { } | 28 virtual ~HitRegion() { } |
| 29 | 29 |
| 30 void removePixels(const Path&); | 30 void removePixels(const Path&); |
| 31 void updateAccessibility(Element* canvas); | 31 void updateAccessibility(Element* canvas); |
| 32 | 32 |
| 33 bool contains(const LayoutPoint&) const; | 33 bool contains(const LayoutPoint&) const; |
| 34 | 34 |
| 35 const String& id() const { return m_id; } | 35 const String& id() const { return m_id; } |
| 36 const Path& path() const { return m_path; } | 36 const Path& path() const { return m_path; } |
| 37 Element* control() const { return m_control.get(); } | 37 Element* control() const { return m_control.get(); } |
| 38 WindRule fillRule() const { return m_fillRule; } | 38 WindRule fillRule() const { return m_fillRule; } |
| 39 | 39 |
| 40 void trace(Visitor*); | 40 void trace(Visitor*); |
| 41 | 41 |
| 42 private: | 42 private: |
| 43 HitRegion(const Path&, const HitRegionOptions&); | 43 HitRegion(const Path&, const HitRegionOptions&); |
| 44 | 44 |
| 45 String m_id; | 45 String m_id; |
| 46 RefPtrWillBeMember<Element> m_control; | 46 RefPtrWillBeMember<Element> m_control; |
| 47 Path m_path; | 47 Path m_path; |
| 48 WindRule m_fillRule; | 48 WindRule m_fillRule; |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 class HitRegionManager FINAL : public NoBaseWillBeGarbageCollected<HitRegionMana
ger> { | 51 class HitRegionManager final : public NoBaseWillBeGarbageCollected<HitRegionMana
ger> { |
| 52 WTF_MAKE_NONCOPYABLE(HitRegionManager); | 52 WTF_MAKE_NONCOPYABLE(HitRegionManager); |
| 53 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(HitRegionManager) | 53 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(HitRegionManager) |
| 54 public: | 54 public: |
| 55 static PassOwnPtrWillBeRawPtr<HitRegionManager> create() { return adoptPtrWi
llBeNoop(new HitRegionManager()); } | 55 static PassOwnPtrWillBeRawPtr<HitRegionManager> create() { return adoptPtrWi
llBeNoop(new HitRegionManager()); } |
| 56 | 56 |
| 57 void addHitRegion(PassRefPtrWillBeRawPtr<HitRegion>); | 57 void addHitRegion(PassRefPtrWillBeRawPtr<HitRegion>); |
| 58 | 58 |
| 59 void removeHitRegion(HitRegion*); | 59 void removeHitRegion(HitRegion*); |
| 60 void removeHitRegionById(const String& id); | 60 void removeHitRegionById(const String& id); |
| 61 void removeHitRegionByControl(Element*); | 61 void removeHitRegionByControl(Element*); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 79 typedef WillBeHeapHashMap<RefPtrWillBeMember<Element>, RefPtrWillBeMember<Hi
tRegion> > HitRegionControlMap; | 79 typedef WillBeHeapHashMap<RefPtrWillBeMember<Element>, RefPtrWillBeMember<Hi
tRegion> > HitRegionControlMap; |
| 80 | 80 |
| 81 HitRegionList m_hitRegionList; | 81 HitRegionList m_hitRegionList; |
| 82 HitRegionIdMap m_hitRegionIdMap; | 82 HitRegionIdMap m_hitRegionIdMap; |
| 83 HitRegionControlMap m_hitRegionControlMap; | 83 HitRegionControlMap m_hitRegionControlMap; |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 } // namespace blink | 86 } // namespace blink |
| 87 | 87 |
| 88 #endif | 88 #endif |
| OLD | NEW |