Chromium Code Reviews| 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 1490c6f7ef7f06e3afa93356ba1684003f07b758..df56ba448f155b966c4e850b834de617232ba894 100644 |
| --- a/third_party/WebKit/Source/core/layout/ScrollAnchor.h |
| +++ b/third_party/WebKit/Source/core/layout/ScrollAnchor.h |
| @@ -31,21 +31,20 @@ 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(); |
| // 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, |
| @@ -64,8 +63,8 @@ class CORE_EXPORT ScrollAnchor final { |
| DEFINE_INLINE_TRACE() { visitor->trace(m_scroller); } |
| private: |
| - // 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(bool unconditionally = false); |
| void findAnchor(); |
| @@ -87,7 +86,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 main frame's FrameView. |
|
ymalik
2016/10/13 13:05:40
s/owned by the main frame's FrameView/owned by Roo
bokan
2016/10/13 14:23:57
Right, if we swapped the layout viewport using doc
skobes
2016/10/13 17:21:37
Done.
skobes
2016/10/13 17:21:37
Acknowledged.
|
| Member<ScrollableArea> m_scroller; |
| // The LayoutObject we should anchor to. |
| @@ -96,22 +97,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 |