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