OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
5 * | 5 * |
6 * Other contributors: | 6 * Other contributors: |
7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // | 91 // |
92 // | 92 // |
93 // ***** OVERLAY SCROLLBARS ***** | 93 // ***** OVERLAY SCROLLBARS ***** |
94 // Overlay scrollbars are painted on top of the box's content. As such they | 94 // Overlay scrollbars are painted on top of the box's content. As such they |
95 // don't use any space in the box. Software overlay scrollbars are painted by | 95 // don't use any space in the box. Software overlay scrollbars are painted by |
96 // PaintLayerPainter::paintOverlayScrollbars after all content as part of a | 96 // PaintLayerPainter::paintOverlayScrollbars after all content as part of a |
97 // separate tree traversal. The reason for this 2nd traversal is that they need | 97 // separate tree traversal. The reason for this 2nd traversal is that they need |
98 // to be painted on top of everything. Hardware accelerated overlay scrollbars | 98 // to be painted on top of everything. Hardware accelerated overlay scrollbars |
99 // are painted by their associated GraphicsLayer that sets the paint flag | 99 // are painted by their associated GraphicsLayer that sets the paint flag |
100 // PaintLayerPaintingOverlayScrollbars. | 100 // PaintLayerPaintingOverlayScrollbars. |
101 class CORE_EXPORT PaintLayerScrollableArea final : public NoBaseWillBeGarbageCol
lectedFinalized<PaintLayerScrollableArea>, public PaintInvalidationCapableScroll
ableArea { | 101 class CORE_EXPORT PaintLayerScrollableArea final : public GarbageCollectedFinali
zed<PaintLayerScrollableArea>, public PaintInvalidationCapableScrollableArea { |
102 USING_FAST_MALLOC_WILL_BE_REMOVED(PaintLayerScrollableArea); | 102 USING_GARBAGE_COLLECTED_MIXIN(PaintLayerScrollableArea); |
103 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PaintLayerScrollableArea); | |
104 friend class Internals; | 103 friend class Internals; |
105 | 104 |
106 private: | 105 private: |
107 class ScrollbarManager { | 106 class ScrollbarManager { |
108 DISALLOW_NEW(); | 107 DISALLOW_NEW(); |
109 | 108 |
110 // Helper class to manage the life cycle of Scrollbar objects. Some lay
out containers | 109 // Helper class to manage the life cycle of Scrollbar objects. Some lay
out containers |
111 // (e.g., flexbox, table) run multi-pass layout on their children, apply
ing different | 110 // (e.g., flexbox, table) run multi-pass layout on their children, apply
ing different |
112 // constraints. If a child has overflow:auto, it may gain and lose scro
llbars multiple | 111 // constraints. If a child has overflow:auto, it may gain and lose scro
llbars multiple |
113 // times during multi-pass layout, causing pointless allocation/dealloca
tion thrashing, | 112 // times during multi-pass layout, causing pointless allocation/dealloca
tion thrashing, |
(...skipping 19 matching lines...) Expand all Loading... |
133 Scrollbar* verticalScrollbar() const { return m_vBarIsAttached ? m_vBar.
get() : nullptr; } | 132 Scrollbar* verticalScrollbar() const { return m_vBarIsAttached ? m_vBar.
get() : nullptr; } |
134 bool hasHorizontalScrollbar() const { return horizontalScrollbar(); } | 133 bool hasHorizontalScrollbar() const { return horizontalScrollbar(); } |
135 bool hasVerticalScrollbar() const { return verticalScrollbar(); } | 134 bool hasVerticalScrollbar() const { return verticalScrollbar(); } |
136 | 135 |
137 void setHasHorizontalScrollbar(bool hasScrollbar); | 136 void setHasHorizontalScrollbar(bool hasScrollbar); |
138 void setHasVerticalScrollbar(bool hasScrollbar); | 137 void setHasVerticalScrollbar(bool hasScrollbar); |
139 | 138 |
140 DECLARE_TRACE(); | 139 DECLARE_TRACE(); |
141 | 140 |
142 private: | 141 private: |
143 PassRefPtrWillBeRawPtr<Scrollbar> createScrollbar(ScrollbarOrientation); | 142 RawPtr<Scrollbar> createScrollbar(ScrollbarOrientation); |
144 void destroyScrollbar(ScrollbarOrientation); | 143 void destroyScrollbar(ScrollbarOrientation); |
145 | 144 |
146 private: | 145 private: |
147 RawPtrWillBeMember<PaintLayerScrollableArea> m_scrollableArea; | 146 Member<PaintLayerScrollableArea> m_scrollableArea; |
148 | 147 |
149 // The scrollbars associated with m_scrollableArea. Both can nullptr. | 148 // The scrollbars associated with m_scrollableArea. Both can nullptr. |
150 RefPtrWillBeMember<Scrollbar> m_hBar; | 149 Member<Scrollbar> m_hBar; |
151 RefPtrWillBeMember<Scrollbar> m_vBar; | 150 Member<Scrollbar> m_vBar; |
152 | 151 |
153 unsigned m_canDetachScrollbars: 1; | 152 unsigned m_canDetachScrollbars: 1; |
154 unsigned m_hBarIsAttached: 1; | 153 unsigned m_hBarIsAttached: 1; |
155 unsigned m_vBarIsAttached: 1; | 154 unsigned m_vBarIsAttached: 1; |
156 }; | 155 }; |
157 | 156 |
158 public: | 157 public: |
159 // FIXME: We should pass in the LayoutBox but this opens a window | 158 // FIXME: We should pass in the LayoutBox but this opens a window |
160 // for crashers during PaintLayer setup (see crbug.com/368062). | 159 // for crashers during PaintLayer setup (see crbug.com/368062). |
161 static PassOwnPtrWillBeRawPtr<PaintLayerScrollableArea> create(PaintLayer& l
ayer) | 160 static RawPtr<PaintLayerScrollableArea> create(PaintLayer& layer) |
162 { | 161 { |
163 return adoptPtrWillBeNoop(new PaintLayerScrollableArea(layer)); | 162 return new PaintLayerScrollableArea(layer); |
164 } | 163 } |
165 | 164 |
166 ~PaintLayerScrollableArea() override; | 165 ~PaintLayerScrollableArea() override; |
167 void dispose(); | 166 void dispose(); |
168 | 167 |
169 bool hasHorizontalScrollbar() const { return horizontalScrollbar(); } | 168 bool hasHorizontalScrollbar() const { return horizontalScrollbar(); } |
170 bool hasVerticalScrollbar() const { return verticalScrollbar(); } | 169 bool hasVerticalScrollbar() const { return verticalScrollbar(); } |
171 | 170 |
172 Scrollbar* horizontalScrollbar() const override { return m_scrollbarManager.
horizontalScrollbar(); } | 171 Scrollbar* horizontalScrollbar() const override { return m_scrollbarManager.
horizontalScrollbar(); } |
173 Scrollbar* verticalScrollbar() const override { return m_scrollbarManager.ve
rticalScrollbar(); } | 172 Scrollbar* verticalScrollbar() const override { return m_scrollbarManager.ve
rticalScrollbar(); } |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 #endif | 426 #endif |
428 }; | 427 }; |
429 | 428 |
430 DEFINE_TYPE_CASTS(PaintLayerScrollableArea, ScrollableArea, scrollableArea, | 429 DEFINE_TYPE_CASTS(PaintLayerScrollableArea, ScrollableArea, scrollableArea, |
431 scrollableArea->isPaintLayerScrollableArea(), | 430 scrollableArea->isPaintLayerScrollableArea(), |
432 scrollableArea.isPaintLayerScrollableArea()); | 431 scrollableArea.isPaintLayerScrollableArea()); |
433 | 432 |
434 } // namespace blink | 433 } // namespace blink |
435 | 434 |
436 #endif // LayerScrollableArea_h | 435 #endif // LayerScrollableArea_h |
OLD | NEW |