Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1160)

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h

Issue 1850703002: Revert "Adapt and reland old position sticky implementation from https://codereview.chromium.org/34… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
77 // PaintLayerScrollableArea represents the scrollable area of a LayoutBox. 66 // PaintLayerScrollableArea represents the scrollable area of a LayoutBox.
78 // 67 //
79 // To be scrollable, an element requires ‘overflow’ != visible. Note that this 68 // To be scrollable, an element requires ‘overflow’ != visible. Note that this
80 // doesn’t imply having scrollbars as you can always programmatically scroll 69 // doesn’t imply having scrollbars as you can always programmatically scroll
81 // when ‘overflow’ is hidden (using JavaScript's element.scrollTo or 70 // when ‘overflow’ is hidden (using JavaScript's element.scrollTo or
82 // scrollLeft). 71 // scrollLeft).
83 // 72 //
84 // The size and scroll origin of the scrollable area are based on layout 73 // The size and scroll origin of the scrollable area are based on layout
85 // dimensions. They are recomputed after layout in updateScrollDimensions. 74 // dimensions. They are recomputed after layout in updateScrollDimensions.
86 // 75 //
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 IntRect rectForVerticalScrollbar(const IntRect& borderBoxRect) const; 334 IntRect rectForVerticalScrollbar(const IntRect& borderBoxRect) const;
346 335
347 Widget* getWidget() override; 336 Widget* getWidget() override;
348 ScrollAnchor& scrollAnchor() { return m_scrollAnchor; } 337 ScrollAnchor& scrollAnchor() { return m_scrollAnchor; }
349 bool isPaintLayerScrollableArea() const override { return true; } 338 bool isPaintLayerScrollableArea() const override { return true; }
350 339
351 bool shouldRebuildHorizontalScrollbarLayer() const { return m_rebuildHorizon talScrollbarLayer; } 340 bool shouldRebuildHorizontalScrollbarLayer() const { return m_rebuildHorizon talScrollbarLayer; }
352 bool shouldRebuildVerticalScrollbarLayer() const { return m_rebuildVerticalS crollbarLayer; } 341 bool shouldRebuildVerticalScrollbarLayer() const { return m_rebuildVerticalS crollbarLayer; }
353 void resetRebuildScrollbarLayerFlags(); 342 void resetRebuildScrollbarLayerFlags();
354 343
355 StickyConstraintsMap& stickyConstraintsMap() { return ensureRareData().m_sti ckyConstraintsMap; }
356 void invalidateAllStickyConstraints();
357 void invalidateStickyConstraintsFor(PaintLayer*, bool needsCompositingUpdate = true);
358
359 DECLARE_VIRTUAL_TRACE(); 344 DECLARE_VIRTUAL_TRACE();
360 345
361 private: 346 private:
362 explicit PaintLayerScrollableArea(PaintLayer&); 347 explicit PaintLayerScrollableArea(PaintLayer&);
363 348
364 bool hasHorizontalOverflow() const; 349 bool hasHorizontalOverflow() const;
365 bool hasVerticalOverflow() const; 350 bool hasVerticalOverflow() const;
366 bool hasScrollableHorizontalOverflow() const; 351 bool hasScrollableHorizontalOverflow() const;
367 bool hasScrollableVerticalOverflow() const; 352 bool hasScrollableVerticalOverflow() const;
368 bool visualViewportSuppliesScrollbars() const; 353 bool visualViewportSuppliesScrollbars() const;
(...skipping 15 matching lines...) Expand all
384 369
385 // See comments on isPointInResizeControl. 370 // See comments on isPointInResizeControl.
386 void updateResizerAreaSet(); 371 void updateResizerAreaSet();
387 void updateResizerStyle(); 372 void updateResizerStyle();
388 373
389 374
390 void updateScrollableAreaSet(bool hasOverflow); 375 void updateScrollableAreaSet(bool hasOverflow);
391 376
392 void updateCompositingLayersAfterScroll(); 377 void updateCompositingLayersAfterScroll();
393 378
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
406 // PaintInvalidationCapableScrollableArea 379 // PaintInvalidationCapableScrollableArea
407 LayoutBox& boxForScrollControlPaintInvalidation() const { return box(); } 380 LayoutBox& boxForScrollControlPaintInvalidation() const { return box(); }
408 381
409 PaintLayer& m_layer; 382 PaintLayer& m_layer;
410 383
411 // Keeps track of whether the layer is currently resizing, so events can cau se resizing to start and stop. 384 // Keeps track of whether the layer is currently resizing, so events can cau se resizing to start and stop.
412 unsigned m_inResizeMode : 1; 385 unsigned m_inResizeMode : 1;
413 unsigned m_scrollsOverflow : 1; 386 unsigned m_scrollsOverflow : 1;
414 387
415 unsigned m_inOverflowRelayout : 1; 388 unsigned m_inOverflowRelayout : 1;
(...skipping 26 matching lines...) Expand all
442 IntPoint m_cachedOverlayScrollbarOffset; 415 IntPoint m_cachedOverlayScrollbarOffset;
443 416
444 // LayoutObject to hold our custom scroll corner. 417 // LayoutObject to hold our custom scroll corner.
445 LayoutScrollbarPart* m_scrollCorner; 418 LayoutScrollbarPart* m_scrollCorner;
446 419
447 // LayoutObject to hold our custom resizer. 420 // LayoutObject to hold our custom resizer.
448 LayoutScrollbarPart* m_resizer; 421 LayoutScrollbarPart* m_resizer;
449 422
450 ScrollAnchor m_scrollAnchor; 423 ScrollAnchor m_scrollAnchor;
451 424
452 OwnPtr<PaintLayerScrollableAreaRareData> m_rareData;
453
454 #if ENABLE(ASSERT) 425 #if ENABLE(ASSERT)
455 bool m_hasBeenDisposed; 426 bool m_hasBeenDisposed;
456 #endif 427 #endif
457 }; 428 };
458 429
459 DEFINE_TYPE_CASTS(PaintLayerScrollableArea, ScrollableArea, scrollableArea, 430 DEFINE_TYPE_CASTS(PaintLayerScrollableArea, ScrollableArea, scrollableArea,
460 scrollableArea->isPaintLayerScrollableArea(), 431 scrollableArea->isPaintLayerScrollableArea(),
461 scrollableArea.isPaintLayerScrollableArea()); 432 scrollableArea.isPaintLayerScrollableArea());
462 433
463 } // namespace blink 434 } // namespace blink
464 435
465 #endif // LayerScrollableArea_h 436 #endif // LayerScrollableArea_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayer.cpp ('k') | third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698