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 06ccf0bd6c38fe1c9c4bb7ce0a14c61aa18f2ae0..1fa4611aa6fe8662b797a03b8b8d8f37551b7c09 100644 |
| --- a/third_party/WebKit/Source/core/layout/ScrollAnchor.h |
| +++ b/third_party/WebKit/Source/core/layout/ScrollAnchor.h |
| @@ -32,7 +32,7 @@ public: |
| // The LayoutObject we are currently anchored to. Lazily computed during |
| // save() and cached until the next call to clear(). |
| - LayoutObject* anchorObject() const { return m_current.m_anchorObject; } |
| + LayoutObject* anchorObject() const { return m_anchorObject; } |
| // Indicates that the next save() should compute a new anchor. (In certain |
| // cases the previous anchor will be reused; see comments in restore.) |
| @@ -53,7 +53,7 @@ public: |
| }; |
| // Which corner of the anchor object we are currently anchored to. |
| // Only meaningful if anchorObject() is non-null. |
| - Corner corner() const { return m_current.m_corner; } |
| + Corner corner() const { return m_corner; } |
| // Checks if we hold any references to the specified object. |
| bool refersTo(const LayoutObject*) const; |
| @@ -65,6 +65,7 @@ public: |
| private: |
| void findAnchor(); |
| + bool computeScrollAnchorDisablingStyleChanged(); |
| enum WalkStatus { |
| Skip = 0, |
| @@ -89,49 +90,25 @@ private: |
| }; |
| ExamineResult examine(const LayoutObject*) const; |
| - struct AnchorPoint { |
| - AnchorPoint() |
| - : m_anchorObject(nullptr) |
| - , m_corner(Corner::TopLeft) {} |
| - |
| - AnchorPoint(LayoutObject* anchorObject, Corner corner) |
| - : m_anchorObject(anchorObject) |
| - , m_corner(corner) {} |
| - |
| - explicit operator bool() const { return m_anchorObject; } |
| - |
| - void clear(); |
| - |
| - // The LayoutObject we should anchor to. |
| - LayoutObject* m_anchorObject; |
| - |
| - // 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(). |
| - LayoutPoint m_savedRelativeOffset; |
| - }; |
| - IntSize computeAdjustment(const AnchorPoint&) const; |
| - void adjust(IntSize); |
| + IntSize computeAdjustment() const; |
| // The scroller that owns and is adjusted by this ScrollAnchor. |
| Member<ScrollableArea> m_scroller; |
| - // The current anchor point. Lazily computed. |
| - AnchorPoint m_current; |
| - |
| - // The anchor point that was used for the most recent non-zero adjustment. |
| - AnchorPoint m_lastAdjusted; |
| + // The LayoutObject we should anchor to. |
| + LayoutObject* m_anchorObject; |
| - // The size of the most recent non-zero adjustment. |
| - IntSize m_lastAdjustment; |
| + // Which corner of m_anchorObject's bounding box to anchor to. |
| + Corner m_corner; |
| - // True iff the last adjustment was the exact opposite of the one before it. |
| - // A bounce suggests a circular interaction with a scroll event handler. |
| - bool m_hasBounced; |
| + // Location of m_layoutObject relative to scroller at time of save(). |
| + LayoutPoint m_savedRelativeOffset; |
| - // Number of adjustments made since the last clear(). |
| - int m_adjustmentCount; |
| + // Whether the anchor node or an ancestor (up to and including the scroller) |
| + // has had a scroll-anchor-disabling style changed since the last layout. |
|
ojan
2016/08/18 18:39:48
Nit: Might want to add a bit more to this so peopl
skobes
2016/08/18 21:43:42
Done.
|
| + // This field is recomputed in save() and used to suppress the adjustment. |
| + // See http://bit.ly/sanaclap for more info. |
| + bool m_scrollAnchorDisablingStyleChanged; |
| }; |
| } // namespace blink |