OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef OrderIterator_h | 31 #ifndef OrderIterator_h |
32 #define OrderIterator_h | 32 #define OrderIterator_h |
33 | 33 |
| 34 #include "wtf/Allocator.h" |
34 #include "wtf/Noncopyable.h" | 35 #include "wtf/Noncopyable.h" |
35 | 36 |
36 #include <set> | 37 #include <set> |
37 | 38 |
38 namespace blink { | 39 namespace blink { |
39 | 40 |
40 class LayoutBox; | 41 class LayoutBox; |
41 | 42 |
42 class OrderIterator { | 43 class OrderIterator { |
| 44 DISALLOW_ALLOCATION(); |
43 WTF_MAKE_NONCOPYABLE(OrderIterator); | 45 WTF_MAKE_NONCOPYABLE(OrderIterator); |
44 public: | 46 public: |
45 friend class OrderIteratorPopulator; | 47 friend class OrderIteratorPopulator; |
46 | 48 |
47 OrderIterator(const LayoutBox*); | 49 OrderIterator(const LayoutBox*); |
48 | 50 |
49 LayoutBox* currentChild() const { return m_currentChild; } | 51 LayoutBox* currentChild() const { return m_currentChild; } |
50 LayoutBox* first(); | 52 LayoutBox* first(); |
51 LayoutBox* next(); | 53 LayoutBox* next(); |
52 void reset(); | 54 void reset(); |
53 | 55 |
54 private: | 56 private: |
55 const LayoutBox* m_containerBox; | 57 const LayoutBox* m_containerBox; |
56 | 58 |
57 LayoutBox* m_currentChild; | 59 LayoutBox* m_currentChild; |
58 | 60 |
59 typedef std::set<int> OrderValues; | 61 typedef std::set<int> OrderValues; |
60 OrderValues m_orderValues; | 62 OrderValues m_orderValues; |
61 OrderValues::const_iterator m_orderValuesIterator; | 63 OrderValues::const_iterator m_orderValuesIterator; |
62 bool m_isReset; | 64 bool m_isReset; |
63 }; | 65 }; |
64 | 66 |
65 class OrderIteratorPopulator { | 67 class OrderIteratorPopulator { |
| 68 STACK_ALLOCATED(); |
66 public: | 69 public: |
67 explicit OrderIteratorPopulator(OrderIterator& iterator) | 70 explicit OrderIteratorPopulator(OrderIterator& iterator) |
68 : m_iterator(iterator) | 71 : m_iterator(iterator) |
69 { | 72 { |
70 m_iterator.m_orderValues.clear(); | 73 m_iterator.m_orderValues.clear(); |
71 } | 74 } |
72 | 75 |
73 ~OrderIteratorPopulator(); | 76 ~OrderIteratorPopulator(); |
74 | 77 |
75 void collectChild(const LayoutBox*); | 78 void collectChild(const LayoutBox*); |
76 | 79 |
77 private: | 80 private: |
78 OrderIterator& m_iterator; | 81 OrderIterator& m_iterator; |
79 }; | 82 }; |
80 | 83 |
81 } // namespace blink | 84 } // namespace blink |
82 | 85 |
83 #endif // OrderIterator_h | 86 #endif // OrderIterator_h |
OLD | NEW |