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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 IntRect rectForVerticalScrollbar(const IntRect& borderBoxRect) const; | 345 IntRect rectForVerticalScrollbar(const IntRect& borderBoxRect) const; |
335 | 346 |
336 Widget* getWidget() override; | 347 Widget* getWidget() override; |
337 ScrollAnchor& scrollAnchor() { return m_scrollAnchor; } | 348 ScrollAnchor& scrollAnchor() { return m_scrollAnchor; } |
338 bool isPaintLayerScrollableArea() const override { return true; } | 349 bool isPaintLayerScrollableArea() const override { return true; } |
339 | 350 |
340 bool shouldRebuildHorizontalScrollbarLayer() const { return m_rebuildHorizon
talScrollbarLayer; } | 351 bool shouldRebuildHorizontalScrollbarLayer() const { return m_rebuildHorizon
talScrollbarLayer; } |
341 bool shouldRebuildVerticalScrollbarLayer() const { return m_rebuildVerticalS
crollbarLayer; } | 352 bool shouldRebuildVerticalScrollbarLayer() const { return m_rebuildVerticalS
crollbarLayer; } |
342 void resetRebuildScrollbarLayerFlags(); | 353 void resetRebuildScrollbarLayerFlags(); |
343 | 354 |
| 355 StickyConstraintsMap& stickyConstraintsMap() { return ensureRareData().m_sti
ckyConstraintsMap; } |
| 356 void invalidateAllStickyConstraints(); |
| 357 void invalidateStickyConstraintsFor(PaintLayer*, bool needsCompositingUpdate
= true); |
| 358 |
344 DECLARE_VIRTUAL_TRACE(); | 359 DECLARE_VIRTUAL_TRACE(); |
345 | 360 |
346 private: | 361 private: |
347 explicit PaintLayerScrollableArea(PaintLayer&); | 362 explicit PaintLayerScrollableArea(PaintLayer&); |
348 | 363 |
349 bool hasHorizontalOverflow() const; | 364 bool hasHorizontalOverflow() const; |
350 bool hasVerticalOverflow() const; | 365 bool hasVerticalOverflow() const; |
351 bool hasScrollableHorizontalOverflow() const; | 366 bool hasScrollableHorizontalOverflow() const; |
352 bool hasScrollableVerticalOverflow() const; | 367 bool hasScrollableVerticalOverflow() const; |
353 bool visualViewportSuppliesScrollbars() const; | 368 bool visualViewportSuppliesScrollbars() const; |
(...skipping 15 matching lines...) Expand all Loading... |
369 | 384 |
370 // See comments on isPointInResizeControl. | 385 // See comments on isPointInResizeControl. |
371 void updateResizerAreaSet(); | 386 void updateResizerAreaSet(); |
372 void updateResizerStyle(); | 387 void updateResizerStyle(); |
373 | 388 |
374 | 389 |
375 void updateScrollableAreaSet(bool hasOverflow); | 390 void updateScrollableAreaSet(bool hasOverflow); |
376 | 391 |
377 void updateCompositingLayersAfterScroll(); | 392 void updateCompositingLayersAfterScroll(); |
378 | 393 |
| 394 PaintLayerScrollableAreaRareData* rareData() |
| 395 { |
| 396 return m_rareData.get(); |
| 397 } |
| 398 |
| 399 PaintLayerScrollableAreaRareData& ensureRareData() |
| 400 { |
| 401 if (!m_rareData) |
| 402 m_rareData = adoptPtr(new PaintLayerScrollableAreaRareData()); |
| 403 return *m_rareData.get(); |
| 404 } |
| 405 |
379 // PaintInvalidationCapableScrollableArea | 406 // PaintInvalidationCapableScrollableArea |
380 LayoutBox& boxForScrollControlPaintInvalidation() const { return box(); } | 407 LayoutBox& boxForScrollControlPaintInvalidation() const { return box(); } |
381 | 408 |
382 PaintLayer& m_layer; | 409 PaintLayer& m_layer; |
383 | 410 |
384 // Keeps track of whether the layer is currently resizing, so events can cau
se resizing to start and stop. | 411 // Keeps track of whether the layer is currently resizing, so events can cau
se resizing to start and stop. |
385 unsigned m_inResizeMode : 1; | 412 unsigned m_inResizeMode : 1; |
386 unsigned m_scrollsOverflow : 1; | 413 unsigned m_scrollsOverflow : 1; |
387 | 414 |
388 unsigned m_inOverflowRelayout : 1; | 415 unsigned m_inOverflowRelayout : 1; |
(...skipping 26 matching lines...) Expand all Loading... |
415 IntPoint m_cachedOverlayScrollbarOffset; | 442 IntPoint m_cachedOverlayScrollbarOffset; |
416 | 443 |
417 // LayoutObject to hold our custom scroll corner. | 444 // LayoutObject to hold our custom scroll corner. |
418 LayoutScrollbarPart* m_scrollCorner; | 445 LayoutScrollbarPart* m_scrollCorner; |
419 | 446 |
420 // LayoutObject to hold our custom resizer. | 447 // LayoutObject to hold our custom resizer. |
421 LayoutScrollbarPart* m_resizer; | 448 LayoutScrollbarPart* m_resizer; |
422 | 449 |
423 ScrollAnchor m_scrollAnchor; | 450 ScrollAnchor m_scrollAnchor; |
424 | 451 |
| 452 OwnPtr<PaintLayerScrollableAreaRareData> m_rareData; |
| 453 |
425 #if ENABLE(ASSERT) | 454 #if ENABLE(ASSERT) |
426 bool m_hasBeenDisposed; | 455 bool m_hasBeenDisposed; |
427 #endif | 456 #endif |
428 }; | 457 }; |
429 | 458 |
430 DEFINE_TYPE_CASTS(PaintLayerScrollableArea, ScrollableArea, scrollableArea, | 459 DEFINE_TYPE_CASTS(PaintLayerScrollableArea, ScrollableArea, scrollableArea, |
431 scrollableArea->isPaintLayerScrollableArea(), | 460 scrollableArea->isPaintLayerScrollableArea(), |
432 scrollableArea.isPaintLayerScrollableArea()); | 461 scrollableArea.isPaintLayerScrollableArea()); |
433 | 462 |
434 } // namespace blink | 463 } // namespace blink |
435 | 464 |
436 #endif // LayerScrollableArea_h | 465 #endif // LayerScrollableArea_h |
OLD | NEW |