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" |
49 #include "core/paint/PaintLayerFragment.h" | 50 #include "core/paint/PaintLayerFragment.h" |
50 #include "platform/heap/Handle.h" | 51 #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 ScrollableArea { | 100 class CORE_EXPORT PaintLayerScrollableArea final : public NoBaseWillBeGarbageCol
lectedFinalized<PaintLayerScrollableArea>, public PaintInvalidationCapableScroll
ableArea { |
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, bool invalidate = false); | 143 void destroyScrollbar(ScrollbarOrientation); |
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 invalidateScrollbarRect(Scrollbar*, const IntRect&) override; | 191 void scrollControlWasSetNeedsPaintInvalidation() override; |
192 void invalidateScrollCornerRect(const IntRect&) override; | |
193 bool shouldUseIntegerScrollOffset() const override; | 192 bool shouldUseIntegerScrollOffset() const override; |
194 bool isActive() const override; | 193 bool isActive() const override; |
195 bool isScrollCornerVisible() const override; | 194 bool isScrollCornerVisible() const override; |
196 IntRect scrollCornerRect() const override; | 195 IntRect scrollCornerRect() const override; |
197 IntRect convertFromScrollbarToContainingView(const Scrollbar*, const IntRect
&) const override; | 196 IntRect convertFromScrollbarToContainingView(const Scrollbar*, const IntRect
&) const override; |
198 IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect
&) const override; | 197 IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect
&) const override; |
199 IntPoint convertFromScrollbarToContainingView(const Scrollbar*, const IntPoi
nt&) const override; | 198 IntPoint convertFromScrollbarToContainingView(const Scrollbar*, const IntPoi
nt&) const override; |
200 IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, const IntPoi
nt&) const override; | 199 IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, const IntPoi
nt&) const override; |
201 int scrollSize(ScrollbarOrientation) const override; | 200 int scrollSize(ScrollbarOrientation) const override; |
202 IntPoint scrollPosition() const override; | 201 IntPoint scrollPosition() const override; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 void finalizeScrollDimensions(const DoubleSize& originalScrollOffset, bool a
utoHorizontalScrollBarChanged, bool autoVerticalScrollBarChanged); | 253 void finalizeScrollDimensions(const DoubleSize& originalScrollOffset, bool a
utoHorizontalScrollBarChanged, bool autoVerticalScrollBarChanged); |
255 | 254 |
256 void updateAfterLayout(); | 255 void updateAfterLayout(); |
257 void updateAfterStyleChange(const ComputedStyle*); | 256 void updateAfterStyleChange(const ComputedStyle*); |
258 void updateAfterOverflowRecalc(); | 257 void updateAfterOverflowRecalc(); |
259 | 258 |
260 bool updateAfterCompositingChange() override; | 259 bool updateAfterCompositingChange() override; |
261 | 260 |
262 bool hasScrollbar() const { return hasHorizontalScrollbar() || hasVerticalSc
rollbar(); } | 261 bool hasScrollbar() const { return hasHorizontalScrollbar() || hasVerticalSc
rollbar(); } |
263 | 262 |
264 LayoutScrollbarPart* scrollCorner() const { return m_scrollCorner; } | 263 LayoutScrollbarPart* scrollCorner() const override { return m_scrollCorner;
} |
265 | 264 |
266 void resize(const PlatformEvent&, const LayoutSize&); | 265 void resize(const PlatformEvent&, const LayoutSize&); |
267 IntSize offsetFromResizeCorner(const IntPoint& absolutePoint) const; | 266 IntSize offsetFromResizeCorner(const IntPoint& absolutePoint) const; |
268 | 267 |
269 bool inResizeMode() const { return m_inResizeMode; } | 268 bool inResizeMode() const { return m_inResizeMode; } |
270 void setInResizeMode(bool inResizeMode) { m_inResizeMode = inResizeMode; } | 269 void setInResizeMode(bool inResizeMode) { m_inResizeMode = inResizeMode; } |
271 | 270 |
272 IntRect touchResizerCornerRect(const IntRect& bounds) const | 271 IntRect touchResizerCornerRect(const IntRect& bounds) const |
273 { | 272 { |
274 return resizerCornerRect(bounds, ResizerForTouch); | 273 return resizerCornerRect(bounds, ResizerForTouch); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 // These are used during compositing updates to determine if the overflow | 313 // These are used during compositing updates to determine if the overflow |
315 // controls need to be repositioned in the GraphicsLayer tree. | 314 // controls need to be repositioned in the GraphicsLayer tree. |
316 void setTopmostScrollChild(PaintLayer*); | 315 void setTopmostScrollChild(PaintLayer*); |
317 PaintLayer* topmostScrollChild() const { ASSERT(!m_nextTopmostScrollChild);
return m_topmostScrollChild; } | 316 PaintLayer* topmostScrollChild() const { ASSERT(!m_nextTopmostScrollChild);
return m_topmostScrollChild; } |
318 | 317 |
319 IntRect resizerCornerRect(const IntRect&, ResizerHitTestType) const; | 318 IntRect resizerCornerRect(const IntRect&, ResizerHitTestType) const; |
320 | 319 |
321 LayoutBox& box() const; | 320 LayoutBox& box() const; |
322 PaintLayer* layer() const; | 321 PaintLayer* layer() const; |
323 | 322 |
324 LayoutScrollbarPart* resizer() { return m_resizer; } | 323 LayoutScrollbarPart* resizer() const override { return m_resizer; } |
325 | 324 |
326 const IntPoint& cachedOverlayScrollbarOffset() { return m_cachedOverlayScrol
lbarOffset; } | 325 const IntPoint& cachedOverlayScrollbarOffset() { return m_cachedOverlayScrol
lbarOffset; } |
327 void setCachedOverlayScrollbarOffset(const IntPoint& offset) { m_cachedOverl
ayScrollbarOffset = offset; } | 326 void setCachedOverlayScrollbarOffset(const IntPoint& offset) { m_cachedOverl
ayScrollbarOffset = offset; } |
328 | 327 |
329 IntRect rectForHorizontalScrollbar(const IntRect& borderBoxRect) const; | 328 IntRect rectForHorizontalScrollbar(const IntRect& borderBoxRect) const; |
330 IntRect rectForVerticalScrollbar(const IntRect& borderBoxRect) const; | 329 IntRect rectForVerticalScrollbar(const IntRect& borderBoxRect) const; |
331 | 330 |
332 DECLARE_VIRTUAL_TRACE(); | 331 DECLARE_VIRTUAL_TRACE(); |
333 | 332 |
334 private: | 333 private: |
(...skipping 23 matching lines...) Expand all Loading... |
358 | 357 |
359 // See comments on isPointInResizeControl. | 358 // See comments on isPointInResizeControl. |
360 void updateResizerAreaSet(); | 359 void updateResizerAreaSet(); |
361 void updateResizerStyle(); | 360 void updateResizerStyle(); |
362 | 361 |
363 | 362 |
364 void updateScrollableAreaSet(bool hasOverflow); | 363 void updateScrollableAreaSet(bool hasOverflow); |
365 | 364 |
366 void updateCompositingLayersAfterScroll(); | 365 void updateCompositingLayersAfterScroll(); |
367 | 366 |
| 367 // PaintInvalidationCapableScrollableArea |
| 368 LayoutBox& boxForScrollControlPaintInvalidation() const { return box(); } |
| 369 |
368 PaintLayer& m_layer; | 370 PaintLayer& m_layer; |
369 | 371 |
370 // Keeps track of whether the layer is currently resizing, so events can cau
se resizing to start and stop. | 372 // Keeps track of whether the layer is currently resizing, so events can cau
se resizing to start and stop. |
371 unsigned m_inResizeMode : 1; | 373 unsigned m_inResizeMode : 1; |
372 unsigned m_scrollsOverflow : 1; | 374 unsigned m_scrollsOverflow : 1; |
373 | 375 |
374 unsigned m_inOverflowRelayout : 1; | 376 unsigned m_inOverflowRelayout : 1; |
375 | 377 |
376 PaintLayer* m_nextTopmostScrollChild; | 378 PaintLayer* m_nextTopmostScrollChild; |
377 PaintLayer* m_topmostScrollChild; | 379 PaintLayer* m_topmostScrollChild; |
(...skipping 23 matching lines...) Expand all Loading... |
401 LayoutScrollbarPart* m_resizer; | 403 LayoutScrollbarPart* m_resizer; |
402 | 404 |
403 #if ENABLE(ASSERT) | 405 #if ENABLE(ASSERT) |
404 bool m_hasBeenDisposed; | 406 bool m_hasBeenDisposed; |
405 #endif | 407 #endif |
406 }; | 408 }; |
407 | 409 |
408 } // namespace blink | 410 } // namespace blink |
409 | 411 |
410 #endif // LayerScrollableArea_h | 412 #endif // LayerScrollableArea_h |
OLD | NEW |