| 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 "platform/graphics/Path.h" | 10 #include "platform/graphics/Path.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 void removePixels(const Path&); | 39 void removePixels(const Path&); |
| 40 void updateAccessibility(Element* canvas); | 40 void updateAccessibility(Element* canvas); |
| 41 | 41 |
| 42 bool contains(const LayoutPoint&) const; | 42 bool contains(const LayoutPoint&) const; |
| 43 | 43 |
| 44 const String& id() const { return m_id; } | 44 const String& id() const { return m_id; } |
| 45 const Path& path() const { return m_path; } | 45 const Path& path() const { return m_path; } |
| 46 Element* control() const { return m_control.get(); } | 46 Element* control() const { return m_control.get(); } |
| 47 WindRule fillRule() const { return m_fillRule; } | 47 WindRule fillRule() const { return m_fillRule; } |
| 48 | 48 |
| 49 void trace(Visitor*); | |
| 50 | |
| 51 private: | 49 private: |
| 52 explicit HitRegion(const HitRegionOptions&); | 50 explicit HitRegion(const HitRegionOptions&); |
| 53 | 51 |
| 54 String m_id; | 52 String m_id; |
| 55 RefPtr<Element> m_control; | 53 RefPtr<Element> m_control; |
| 56 Path m_path; | 54 Path m_path; |
| 57 WindRule m_fillRule; | 55 WindRule m_fillRule; |
| 58 }; | 56 }; |
| 59 | 57 |
| 60 class HitRegionManager final { | 58 class HitRegionManager final { |
| 61 WTF_MAKE_NONCOPYABLE(HitRegionManager); | 59 WTF_MAKE_NONCOPYABLE(HitRegionManager); |
| 62 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(HitRegionManager) | 60 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(HitRegionManager) |
| 63 public: | 61 public: |
| 64 static PassOwnPtr<HitRegionManager> create() { return adoptPtr(new HitRegion
Manager()); } | 62 static PassOwnPtr<HitRegionManager> create() { return adoptPtr(new HitRegion
Manager()); } |
| 65 | 63 |
| 66 void addHitRegion(PassRefPtr<HitRegion>); | 64 void addHitRegion(PassRefPtr<HitRegion>); |
| 67 | 65 |
| 68 void removeHitRegion(HitRegion*); | 66 void removeHitRegion(HitRegion*); |
| 69 void removeHitRegionById(const String& id); | 67 void removeHitRegionById(const String& id); |
| 70 void removeHitRegionByControl(Element*); | 68 void removeHitRegionByControl(Element*); |
| 71 void removeHitRegionsInRect(const FloatRect&, const AffineTransform&); | 69 void removeHitRegionsInRect(const FloatRect&, const AffineTransform&); |
| 72 void removeAllHitRegions(); | 70 void removeAllHitRegions(); |
| 73 | 71 |
| 74 HitRegion* getHitRegionById(const String& id) const; | 72 HitRegion* getHitRegionById(const String& id) const; |
| 75 HitRegion* getHitRegionByControl(Element*) const; | 73 HitRegion* getHitRegionByControl(Element*) const; |
| 76 HitRegion* getHitRegionAtPoint(const LayoutPoint&) const; | 74 HitRegion* getHitRegionAtPoint(const LayoutPoint&) const; |
| 77 | 75 |
| 78 unsigned getHitRegionsCount() const; | 76 unsigned getHitRegionsCount() const; |
| 79 | 77 |
| 80 void trace(Visitor*); | |
| 81 | |
| 82 private: | 78 private: |
| 83 HitRegionManager() { } | 79 HitRegionManager() { } |
| 84 | 80 |
| 85 typedef ListHashSet<RefPtr<HitRegion> > HitRegionList; | 81 typedef ListHashSet<RefPtr<HitRegion> > HitRegionList; |
| 86 typedef HitRegionList::const_reverse_iterator HitRegionIterator; | 82 typedef HitRegionList::const_reverse_iterator HitRegionIterator; |
| 87 typedef HashMap<String, RefPtr<HitRegion> > HitRegionIdMap; | 83 typedef HashMap<String, RefPtr<HitRegion> > HitRegionIdMap; |
| 88 typedef HashMap<RefPtr<Element>, RefPtr<HitRegion> > HitRegionControlMap; | 84 typedef HashMap<RefPtr<Element>, RefPtr<HitRegion> > HitRegionControlMap; |
| 89 | 85 |
| 90 HitRegionList m_hitRegionList; | 86 HitRegionList m_hitRegionList; |
| 91 HitRegionIdMap m_hitRegionIdMap; | 87 HitRegionIdMap m_hitRegionIdMap; |
| 92 HitRegionControlMap m_hitRegionControlMap; | 88 HitRegionControlMap m_hitRegionControlMap; |
| 93 }; | 89 }; |
| 94 | 90 |
| 95 } // namespace blink | 91 } // namespace blink |
| 96 | 92 |
| 97 #endif | 93 #endif |
| OLD | NEW |