| Index: third_party/WebKit/Source/core/layout/ScrollAnchor.h
|
| diff --git a/third_party/WebKit/Source/core/layout/ScrollAnchor.h b/third_party/WebKit/Source/core/layout/ScrollAnchor.h
|
| index d3333ba947d2db528fd8910cf7b20f40e8c60a4d..16398731cc7c7ca16e388324f5e6e12160041c3f 100644
|
| --- a/third_party/WebKit/Source/core/layout/ScrollAnchor.h
|
| +++ b/third_party/WebKit/Source/core/layout/ScrollAnchor.h
|
| @@ -31,25 +31,24 @@ class CORE_EXPORT ScrollAnchor final {
|
| bool hasScroller() const { return m_scroller; }
|
|
|
| // The LayoutObject we are currently anchored to. Lazily computed during
|
| - // save() and cached until the next call to clear().
|
| + // notifyBeforeLayout() and cached until the next call to clear().
|
| LayoutObject* anchorObject() const { return m_anchorObject; }
|
|
|
| - // Indicates that the next save() should compute a new anchor for the
|
| - // containing scroller and all ancestor scrollers.
|
| + // Indicates that this ScrollAnchor, and all ancestor ScrollAnchors, should
|
| + // compute new anchor nodes on their next notifyBeforeLayout().
|
| void clear();
|
|
|
| - // Indicates that the next save() should compute a new anchor for the
|
| - // containing scroller.
|
| + // Indicates that this ScrollAnchor should compute a new anchor node on the
|
| + // next call to notifyBeforeLayout().
|
| void clearSelf();
|
|
|
| // Records the anchor's location in relation to the scroller. Should be
|
| // called when the scroller is about to be laid out.
|
| - void save();
|
| + void notifyBeforeLayout();
|
|
|
| - // Scrolls to compensate for any change in the anchor's relative location
|
| - // since the most recent call to save(). Should be called immediately after
|
| - // the scroller has been laid out.
|
| - void restore();
|
| + // Scrolls to compensate for any change in the anchor's relative location.
|
| + // Should be called at the end of the animation frame.
|
| + void adjust();
|
|
|
| enum class Corner {
|
| TopLeft = 0,
|
| @@ -91,7 +90,9 @@ class CORE_EXPORT ScrollAnchor final {
|
|
|
| IntSize computeAdjustment() const;
|
|
|
| - // The scroller that owns and is adjusted by this ScrollAnchor.
|
| + // The scroller to be adjusted by this ScrollAnchor. This is also the scroller
|
| + // that owns us, unless it is the RootFrameViewport in which case we are owned
|
| + // by the layout viewport.
|
| Member<ScrollableArea> m_scroller;
|
|
|
| // The LayoutObject we should anchor to.
|
| @@ -100,22 +101,20 @@ class CORE_EXPORT ScrollAnchor final {
|
| // Which corner of m_anchorObject's bounding box to anchor to.
|
| Corner m_corner;
|
|
|
| - // Location of m_layoutObject relative to scroller at time of save().
|
| + // Location of m_layoutObject relative to scroller at time of
|
| + // notifyBeforeLayout().
|
| LayoutPoint m_savedRelativeOffset;
|
|
|
| // We suppress scroll anchoring after a style change on the anchor node or
|
| // one of its ancestors, if that change might have caused the node to move.
|
| // This bit tracks whether we have had a scroll-anchor-disabling style
|
| - // change since the last layout. It is recomputed in save(), and used to
|
| - // suppress the adjustment in restore(). More at http://bit.ly/sanaclap.
|
| + // change since the last layout. It is recomputed in notifyBeforeLayout(),
|
| + // and used to suppress adjustment in adjust(). See http://bit.ly/sanaclap.
|
| bool m_scrollAnchorDisablingStyleChanged;
|
|
|
| - // True iff save has been called, and restore has not been called since
|
| - // the call to save. In this state, additional calls to save are ignored,
|
| - // to make things easier for multi-pass layout modes such as flexbox.
|
| - // TODO(skobes): explore anchoring at frame boundaries instead of layouts,
|
| - // which would allow this field to be removed.
|
| - bool m_saved;
|
| + // True iff an adjustment check has been queued with the FrameView but not yet
|
| + // performed.
|
| + bool m_queued;
|
| };
|
|
|
| } // namespace blink
|
|
|