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 28 matching lines...) Expand all Loading... |
39 * other provisions required by the MPL or the GPL, as the case may be. | 39 * other provisions required by the MPL or the GPL, as the case may be. |
40 * If you do not delete the provisions above, a recipient may use your | 40 * If you do not delete the provisions above, a recipient may use your |
41 * version of this file under any of the LGPL, the MPL or the GPL. | 41 * version of this file under any of the LGPL, the MPL or the GPL. |
42 */ | 42 */ |
43 | 43 |
44 #ifndef PaintLayerScrollableArea_h | 44 #ifndef PaintLayerScrollableArea_h |
45 #define PaintLayerScrollableArea_h | 45 #define PaintLayerScrollableArea_h |
46 | 46 |
47 #include "core/CoreExport.h" | 47 #include "core/CoreExport.h" |
48 #include "core/layout/LayoutBox.h" | 48 #include "core/layout/LayoutBox.h" |
49 #include "core/paint/PaintInvalidationCapableScrollableArea.h" | |
50 #include "core/paint/PaintLayerFragment.h" | 49 #include "core/paint/PaintLayerFragment.h" |
51 #include "platform/heap/Handle.h" | 50 #include "platform/heap/Handle.h" |
| 51 #include "platform/scroll/ScrollableArea.h" |
52 | 52 |
53 namespace blink { | 53 namespace blink { |
54 | 54 |
55 enum ResizerHitTestType { | 55 enum ResizerHitTestType { |
56 ResizerForPointer, | 56 ResizerForPointer, |
57 ResizerForTouch | 57 ResizerForTouch |
58 }; | 58 }; |
59 | 59 |
60 class PlatformEvent; | 60 class PlatformEvent; |
61 class LayoutBox; | 61 class LayoutBox; |
(...skipping 28 matching lines...) Expand all Loading... |
90 // | 90 // |
91 // | 91 // |
92 // ***** OVERLAY SCROLLBARS ***** | 92 // ***** OVERLAY SCROLLBARS ***** |
93 // Overlay scrollbars are painted on top of the box's content. As such they | 93 // Overlay scrollbars are painted on top of the box's content. As such they |
94 // don't use any space in the box. Software overlay scrollbars are painted by | 94 // don't use any space in the box. Software overlay scrollbars are painted by |
95 // PaintLayerPainter::paintOverlayScrollbars after all content as part of a | 95 // PaintLayerPainter::paintOverlayScrollbars after all content as part of a |
96 // separate tree traversal. The reason for this 2nd traversal is that they need | 96 // separate tree traversal. The reason for this 2nd traversal is that they need |
97 // to be painted on top of everything. Hardware accelerated overlay scrollbars | 97 // to be painted on top of everything. Hardware accelerated overlay scrollbars |
98 // are painted by their associated GraphicsLayer that sets the paint flag | 98 // are painted by their associated GraphicsLayer that sets the paint flag |
99 // PaintLayerPaintingOverlayScrollbars. | 99 // PaintLayerPaintingOverlayScrollbars. |
100 class CORE_EXPORT PaintLayerScrollableArea final : public NoBaseWillBeGarbageCol
lectedFinalized<PaintLayerScrollableArea>, public PaintInvalidationCapableScroll
ableArea { | 100 class CORE_EXPORT PaintLayerScrollableArea final : public NoBaseWillBeGarbageCol
lectedFinalized<PaintLayerScrollableArea>, public ScrollableArea { |
101 USING_FAST_MALLOC_WILL_BE_REMOVED(PaintLayerScrollableArea); | 101 USING_FAST_MALLOC_WILL_BE_REMOVED(PaintLayerScrollableArea); |
102 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PaintLayerScrollableArea); | 102 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PaintLayerScrollableArea); |
103 friend class Internals; | 103 friend class Internals; |
104 | 104 |
105 private: | 105 private: |
106 class ScrollbarManager { | 106 class ScrollbarManager { |
107 DISALLOW_NEW(); | 107 DISALLOW_NEW(); |
108 | 108 |
109 // 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 |
110 // (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 |
(...skipping 22 matching lines...) Expand all Loading... |
133 bool hasHorizontalScrollbar() const { return horizontalScrollbar(); } | 133 bool hasHorizontalScrollbar() const { return horizontalScrollbar(); } |
134 bool hasVerticalScrollbar() const { return verticalScrollbar(); } | 134 bool hasVerticalScrollbar() const { return verticalScrollbar(); } |
135 | 135 |
136 void setHasHorizontalScrollbar(bool hasScrollbar); | 136 void setHasHorizontalScrollbar(bool hasScrollbar); |
137 void setHasVerticalScrollbar(bool hasScrollbar); | 137 void setHasVerticalScrollbar(bool hasScrollbar); |
138 | 138 |
139 DECLARE_TRACE(); | 139 DECLARE_TRACE(); |
140 | 140 |
141 private: | 141 private: |
142 PassRefPtrWillBeRawPtr<Scrollbar> createScrollbar(ScrollbarOrientation); | 142 PassRefPtrWillBeRawPtr<Scrollbar> createScrollbar(ScrollbarOrientation); |
143 void destroyScrollbar(ScrollbarOrientation); | 143 void destroyScrollbar(ScrollbarOrientation, bool invalidate = false); |
144 | 144 |
145 private: | 145 private: |
146 RawPtrWillBeMember<PaintLayerScrollableArea> m_scrollableArea; | 146 RawPtrWillBeMember<PaintLayerScrollableArea> m_scrollableArea; |
147 | 147 |
148 // The scrollbars associated with m_scrollableArea. Both can nullptr. | 148 // The scrollbars associated with m_scrollableArea. Both can nullptr. |
149 RefPtrWillBeMember<Scrollbar> m_hBar; | 149 RefPtrWillBeMember<Scrollbar> m_hBar; |
150 RefPtrWillBeMember<Scrollbar> m_vBar; | 150 RefPtrWillBeMember<Scrollbar> m_vBar; |
151 | 151 |
152 unsigned m_canDetachScrollbars: 1; | 152 unsigned m_canDetachScrollbars: 1; |
153 unsigned m_hBarIsAttached: 1; | 153 unsigned m_hBarIsAttached: 1; |
(...skipping 27 matching lines...) Expand all Loading... |
181 GraphicsLayer* layerForScrolling() const override; | 181 GraphicsLayer* layerForScrolling() const override; |
182 | 182 |
183 // GraphicsLayers for the scrolling components. | 183 // GraphicsLayers for the scrolling components. |
184 // | 184 // |
185 // Any function can return nullptr if they are not accelerated. | 185 // Any function can return nullptr if they are not accelerated. |
186 GraphicsLayer* layerForHorizontalScrollbar() const override; | 186 GraphicsLayer* layerForHorizontalScrollbar() const override; |
187 GraphicsLayer* layerForVerticalScrollbar() const override; | 187 GraphicsLayer* layerForVerticalScrollbar() const override; |
188 GraphicsLayer* layerForScrollCorner() const override; | 188 GraphicsLayer* layerForScrollCorner() const override; |
189 | 189 |
190 bool usesCompositedScrolling() const override; | 190 bool usesCompositedScrolling() const override; |
191 void scrollControlWasSetNeedsPaintInvalidation() override; | 191 void invalidateScrollbarRect(Scrollbar*, const IntRect&) override; |
| 192 void invalidateScrollCornerRect(const IntRect&) override; |
192 bool shouldUseIntegerScrollOffset() const override; | 193 bool shouldUseIntegerScrollOffset() const override; |
193 bool isActive() const override; | 194 bool isActive() const override; |
194 bool isScrollCornerVisible() const override; | 195 bool isScrollCornerVisible() const override; |
195 IntRect scrollCornerRect() const override; | 196 IntRect scrollCornerRect() const override; |
196 IntRect convertFromScrollbarToContainingView(const Scrollbar*, const IntRect
&) const override; | 197 IntRect convertFromScrollbarToContainingView(const Scrollbar*, const IntRect
&) const override; |
197 IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect
&) const override; | 198 IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect
&) const override; |
198 IntPoint convertFromScrollbarToContainingView(const Scrollbar*, const IntPoi
nt&) const override; | 199 IntPoint convertFromScrollbarToContainingView(const Scrollbar*, const IntPoi
nt&) const override; |
199 IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, const IntPoi
nt&) const override; | 200 IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, const IntPoi
nt&) const override; |
200 int scrollSize(ScrollbarOrientation) const override; | 201 int scrollSize(ScrollbarOrientation) const override; |
201 IntPoint scrollPosition() const override; | 202 IntPoint scrollPosition() const override; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 void finalizeScrollDimensions(const DoubleSize& originalScrollOffset, bool a
utoHorizontalScrollBarChanged, bool autoVerticalScrollBarChanged); | 254 void finalizeScrollDimensions(const DoubleSize& originalScrollOffset, bool a
utoHorizontalScrollBarChanged, bool autoVerticalScrollBarChanged); |
254 | 255 |
255 void updateAfterLayout(); | 256 void updateAfterLayout(); |
256 void updateAfterStyleChange(const ComputedStyle*); | 257 void updateAfterStyleChange(const ComputedStyle*); |
257 void updateAfterOverflowRecalc(); | 258 void updateAfterOverflowRecalc(); |
258 | 259 |
259 bool updateAfterCompositingChange() override; | 260 bool updateAfterCompositingChange() override; |
260 | 261 |
261 bool hasScrollbar() const { return hasHorizontalScrollbar() || hasVerticalSc
rollbar(); } | 262 bool hasScrollbar() const { return hasHorizontalScrollbar() || hasVerticalSc
rollbar(); } |
262 | 263 |
263 LayoutScrollbarPart* scrollCorner() const override { return m_scrollCorner;
} | 264 LayoutScrollbarPart* scrollCorner() const { return m_scrollCorner; } |
264 | 265 |
265 void resize(const PlatformEvent&, const LayoutSize&); | 266 void resize(const PlatformEvent&, const LayoutSize&); |
266 IntSize offsetFromResizeCorner(const IntPoint& absolutePoint) const; | 267 IntSize offsetFromResizeCorner(const IntPoint& absolutePoint) const; |
267 | 268 |
268 bool inResizeMode() const { return m_inResizeMode; } | 269 bool inResizeMode() const { return m_inResizeMode; } |
269 void setInResizeMode(bool inResizeMode) { m_inResizeMode = inResizeMode; } | 270 void setInResizeMode(bool inResizeMode) { m_inResizeMode = inResizeMode; } |
270 | 271 |
271 IntRect touchResizerCornerRect(const IntRect& bounds) const | 272 IntRect touchResizerCornerRect(const IntRect& bounds) const |
272 { | 273 { |
273 return resizerCornerRect(bounds, ResizerForTouch); | 274 return resizerCornerRect(bounds, ResizerForTouch); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 // These are used during compositing updates to determine if the overflow | 314 // These are used during compositing updates to determine if the overflow |
314 // controls need to be repositioned in the GraphicsLayer tree. | 315 // controls need to be repositioned in the GraphicsLayer tree. |
315 void setTopmostScrollChild(PaintLayer*); | 316 void setTopmostScrollChild(PaintLayer*); |
316 PaintLayer* topmostScrollChild() const { ASSERT(!m_nextTopmostScrollChild);
return m_topmostScrollChild; } | 317 PaintLayer* topmostScrollChild() const { ASSERT(!m_nextTopmostScrollChild);
return m_topmostScrollChild; } |
317 | 318 |
318 IntRect resizerCornerRect(const IntRect&, ResizerHitTestType) const; | 319 IntRect resizerCornerRect(const IntRect&, ResizerHitTestType) const; |
319 | 320 |
320 LayoutBox& box() const; | 321 LayoutBox& box() const; |
321 PaintLayer* layer() const; | 322 PaintLayer* layer() const; |
322 | 323 |
323 LayoutScrollbarPart* resizer() const override { return m_resizer; } | 324 LayoutScrollbarPart* resizer() { return m_resizer; } |
324 | 325 |
325 const IntPoint& cachedOverlayScrollbarOffset() { return m_cachedOverlayScrol
lbarOffset; } | 326 const IntPoint& cachedOverlayScrollbarOffset() { return m_cachedOverlayScrol
lbarOffset; } |
326 void setCachedOverlayScrollbarOffset(const IntPoint& offset) { m_cachedOverl
ayScrollbarOffset = offset; } | 327 void setCachedOverlayScrollbarOffset(const IntPoint& offset) { m_cachedOverl
ayScrollbarOffset = offset; } |
327 | 328 |
328 IntRect rectForHorizontalScrollbar(const IntRect& borderBoxRect) const; | 329 IntRect rectForHorizontalScrollbar(const IntRect& borderBoxRect) const; |
329 IntRect rectForVerticalScrollbar(const IntRect& borderBoxRect) const; | 330 IntRect rectForVerticalScrollbar(const IntRect& borderBoxRect) const; |
330 | 331 |
331 DECLARE_VIRTUAL_TRACE(); | 332 DECLARE_VIRTUAL_TRACE(); |
332 | 333 |
333 private: | 334 private: |
(...skipping 23 matching lines...) Expand all Loading... |
357 | 358 |
358 // See comments on isPointInResizeControl. | 359 // See comments on isPointInResizeControl. |
359 void updateResizerAreaSet(); | 360 void updateResizerAreaSet(); |
360 void updateResizerStyle(); | 361 void updateResizerStyle(); |
361 | 362 |
362 | 363 |
363 void updateScrollableAreaSet(bool hasOverflow); | 364 void updateScrollableAreaSet(bool hasOverflow); |
364 | 365 |
365 void updateCompositingLayersAfterScroll(); | 366 void updateCompositingLayersAfterScroll(); |
366 | 367 |
367 // PaintInvalidationCapableScrollableArea | |
368 LayoutBox& boxForScrollControlPaintInvalidation() const { return box(); } | |
369 | |
370 PaintLayer& m_layer; | 368 PaintLayer& m_layer; |
371 | 369 |
372 // Keeps track of whether the layer is currently resizing, so events can cau
se resizing to start and stop. | 370 // Keeps track of whether the layer is currently resizing, so events can cau
se resizing to start and stop. |
373 unsigned m_inResizeMode : 1; | 371 unsigned m_inResizeMode : 1; |
374 unsigned m_scrollsOverflow : 1; | 372 unsigned m_scrollsOverflow : 1; |
375 | 373 |
376 unsigned m_inOverflowRelayout : 1; | 374 unsigned m_inOverflowRelayout : 1; |
377 | 375 |
378 PaintLayer* m_nextTopmostScrollChild; | 376 PaintLayer* m_nextTopmostScrollChild; |
379 PaintLayer* m_topmostScrollChild; | 377 PaintLayer* m_topmostScrollChild; |
(...skipping 23 matching lines...) Expand all Loading... |
403 LayoutScrollbarPart* m_resizer; | 401 LayoutScrollbarPart* m_resizer; |
404 | 402 |
405 #if ENABLE(ASSERT) | 403 #if ENABLE(ASSERT) |
406 bool m_hasBeenDisposed; | 404 bool m_hasBeenDisposed; |
407 #endif | 405 #endif |
408 }; | 406 }; |
409 | 407 |
410 } // namespace blink | 408 } // namespace blink |
411 | 409 |
412 #endif // LayerScrollableArea_h | 410 #endif // LayerScrollableArea_h |
OLD | NEW |