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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 enum ResizerHitTestType { | 56 enum ResizerHitTestType { |
57 ResizerForPointer, | 57 ResizerForPointer, |
58 ResizerForTouch | 58 ResizerForTouch |
59 }; | 59 }; |
60 | 60 |
61 class PlatformEvent; | 61 class PlatformEvent; |
62 class LayoutBox; | 62 class LayoutBox; |
63 class PaintLayer; | 63 class PaintLayer; |
64 class LayoutScrollbarPart; | 64 class LayoutScrollbarPart; |
65 | 65 |
| 66 typedef WTF::HashMap<PaintLayer*, StickyPositionScrollingConstraints> StickyCons
traintsMap; |
| 67 |
| 68 struct PaintLayerScrollableAreaRareData { |
| 69 WTF_MAKE_NONCOPYABLE(PaintLayerScrollableAreaRareData); |
| 70 USING_FAST_MALLOC(PaintLayerScrollableAreaRareData); |
| 71 public: |
| 72 PaintLayerScrollableAreaRareData() {} |
| 73 |
| 74 StickyConstraintsMap m_stickyConstraintsMap; |
| 75 }; |
| 76 |
66 // PaintLayerScrollableArea represents the scrollable area of a LayoutBox. | 77 // PaintLayerScrollableArea represents the scrollable area of a LayoutBox. |
67 // | 78 // |
68 // To be scrollable, an element requires ‘overflow’ != visible. Note that this | 79 // To be scrollable, an element requires ‘overflow’ != visible. Note that this |
69 // doesn’t imply having scrollbars as you can always programmatically scroll | 80 // doesn’t imply having scrollbars as you can always programmatically scroll |
70 // when ‘overflow’ is hidden (using JavaScript's element.scrollTo or | 81 // when ‘overflow’ is hidden (using JavaScript's element.scrollTo or |
71 // scrollLeft). | 82 // scrollLeft). |
72 // | 83 // |
73 // The size and scroll origin of the scrollable area are based on layout | 84 // The size and scroll origin of the scrollable area are based on layout |
74 // dimensions. They are recomputed after layout in updateScrollDimensions. | 85 // dimensions. They are recomputed after layout in updateScrollDimensions. |
75 // | 86 // |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 IntRect rectForVerticalScrollbar(const IntRect& borderBoxRect) const; | 344 IntRect rectForVerticalScrollbar(const IntRect& borderBoxRect) const; |
334 | 345 |
335 Widget* getWidget() override; | 346 Widget* getWidget() override; |
336 ScrollAnchor& scrollAnchor() { return m_scrollAnchor; } | 347 ScrollAnchor& scrollAnchor() { return m_scrollAnchor; } |
337 bool isPaintLayerScrollableArea() const override { return true; } | 348 bool isPaintLayerScrollableArea() const override { return true; } |
338 | 349 |
339 bool shouldRebuildHorizontalScrollbarLayer() const { return m_rebuildHorizon
talScrollbarLayer; } | 350 bool shouldRebuildHorizontalScrollbarLayer() const { return m_rebuildHorizon
talScrollbarLayer; } |
340 bool shouldRebuildVerticalScrollbarLayer() const { return m_rebuildVerticalS
crollbarLayer; } | 351 bool shouldRebuildVerticalScrollbarLayer() const { return m_rebuildVerticalS
crollbarLayer; } |
341 void resetRebuildScrollbarLayerFlags(); | 352 void resetRebuildScrollbarLayerFlags(); |
342 | 353 |
| 354 StickyConstraintsMap& stickyConstraintsMap() { return ensureRareData().m_sti
ckyConstraintsMap; } |
| 355 void invalidateAllStickyConstraints(); |
| 356 void invalidateStickyConstraintsFor(PaintLayer*, bool needsCompositingUpdate
= true); |
| 357 |
343 DECLARE_VIRTUAL_TRACE(); | 358 DECLARE_VIRTUAL_TRACE(); |
344 | 359 |
345 private: | 360 private: |
346 explicit PaintLayerScrollableArea(PaintLayer&); | 361 explicit PaintLayerScrollableArea(PaintLayer&); |
347 | 362 |
348 bool hasHorizontalOverflow() const; | 363 bool hasHorizontalOverflow() const; |
349 bool hasVerticalOverflow() const; | 364 bool hasVerticalOverflow() const; |
350 bool hasScrollableHorizontalOverflow() const; | 365 bool hasScrollableHorizontalOverflow() const; |
351 bool hasScrollableVerticalOverflow() const; | 366 bool hasScrollableVerticalOverflow() const; |
352 bool visualViewportSuppliesScrollbars() const; | 367 bool visualViewportSuppliesScrollbars() const; |
(...skipping 15 matching lines...) Expand all Loading... |
368 | 383 |
369 // See comments on isPointInResizeControl. | 384 // See comments on isPointInResizeControl. |
370 void updateResizerAreaSet(); | 385 void updateResizerAreaSet(); |
371 void updateResizerStyle(); | 386 void updateResizerStyle(); |
372 | 387 |
373 | 388 |
374 void updateScrollableAreaSet(bool hasOverflow); | 389 void updateScrollableAreaSet(bool hasOverflow); |
375 | 390 |
376 void updateCompositingLayersAfterScroll(); | 391 void updateCompositingLayersAfterScroll(); |
377 | 392 |
| 393 PaintLayerScrollableAreaRareData* rareData() |
| 394 { |
| 395 return m_rareData.get(); |
| 396 } |
| 397 |
| 398 PaintLayerScrollableAreaRareData& ensureRareData() |
| 399 { |
| 400 if (!m_rareData) |
| 401 m_rareData = adoptPtr(new PaintLayerScrollableAreaRareData()); |
| 402 return *m_rareData.get(); |
| 403 } |
| 404 |
378 // PaintInvalidationCapableScrollableArea | 405 // PaintInvalidationCapableScrollableArea |
379 LayoutBox& boxForScrollControlPaintInvalidation() const { return box(); } | 406 LayoutBox& boxForScrollControlPaintInvalidation() const { return box(); } |
380 | 407 |
381 PaintLayer& m_layer; | 408 PaintLayer& m_layer; |
382 | 409 |
383 // Keeps track of whether the layer is currently resizing, so events can cau
se resizing to start and stop. | 410 // Keeps track of whether the layer is currently resizing, so events can cau
se resizing to start and stop. |
384 unsigned m_inResizeMode : 1; | 411 unsigned m_inResizeMode : 1; |
385 unsigned m_scrollsOverflow : 1; | 412 unsigned m_scrollsOverflow : 1; |
386 | 413 |
387 unsigned m_inOverflowRelayout : 1; | 414 unsigned m_inOverflowRelayout : 1; |
(...skipping 26 matching lines...) Expand all Loading... |
414 IntPoint m_cachedOverlayScrollbarOffset; | 441 IntPoint m_cachedOverlayScrollbarOffset; |
415 | 442 |
416 // LayoutObject to hold our custom scroll corner. | 443 // LayoutObject to hold our custom scroll corner. |
417 LayoutScrollbarPart* m_scrollCorner; | 444 LayoutScrollbarPart* m_scrollCorner; |
418 | 445 |
419 // LayoutObject to hold our custom resizer. | 446 // LayoutObject to hold our custom resizer. |
420 LayoutScrollbarPart* m_resizer; | 447 LayoutScrollbarPart* m_resizer; |
421 | 448 |
422 ScrollAnchor m_scrollAnchor; | 449 ScrollAnchor m_scrollAnchor; |
423 | 450 |
| 451 OwnPtr<PaintLayerScrollableAreaRareData> m_rareData; |
| 452 |
424 #if ENABLE(ASSERT) | 453 #if ENABLE(ASSERT) |
425 bool m_hasBeenDisposed; | 454 bool m_hasBeenDisposed; |
426 #endif | 455 #endif |
427 }; | 456 }; |
428 | 457 |
429 DEFINE_TYPE_CASTS(PaintLayerScrollableArea, ScrollableArea, scrollableArea, | 458 DEFINE_TYPE_CASTS(PaintLayerScrollableArea, ScrollableArea, scrollableArea, |
430 scrollableArea->isPaintLayerScrollableArea(), | 459 scrollableArea->isPaintLayerScrollableArea(), |
431 scrollableArea.isPaintLayerScrollableArea()); | 460 scrollableArea.isPaintLayerScrollableArea()); |
432 | 461 |
433 } // namespace blink | 462 } // namespace blink |
434 | 463 |
435 #endif // LayerScrollableArea_h | 464 #endif // LayerScrollableArea_h |
OLD | NEW |