| Index: third_party/WebKit/Source/core/layout/LayoutBox.h
|
| diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.h b/third_party/WebKit/Source/core/layout/LayoutBox.h
|
| index 8f347d259b9eba887c8c4116496b848a8287be9b..a6ca9d312f195f69986845dd7f0372d3d1f9d93e 100644
|
| --- a/third_party/WebKit/Source/core/layout/LayoutBox.h
|
| +++ b/third_party/WebKit/Source/core/layout/LayoutBox.h
|
| @@ -49,6 +49,8 @@ enum ScrollOffsetClamping {
|
| ScrollOffsetClamped
|
| };
|
|
|
| +using SnapAreaSet = HashSet<const LayoutBox*>;
|
| +
|
| struct LayoutBoxRareData {
|
| WTF_MAKE_NONCOPYABLE(LayoutBoxRareData); USING_FAST_MALLOC(LayoutBoxRareData);
|
| public:
|
| @@ -58,6 +60,8 @@ public:
|
| , m_overrideLogicalContentWidth(-1)
|
| , m_previousBorderBoxSize(LayoutUnit(-1), LayoutUnit(-1))
|
| , m_percentHeightContainer(nullptr)
|
| + , m_snapContainer(nullptr)
|
| + , m_snapAreas(nullptr)
|
| {
|
| }
|
|
|
| @@ -77,6 +81,19 @@ public:
|
| LayoutUnit m_paginationStrut;
|
|
|
| LayoutBlock* m_percentHeightContainer;
|
| + // For snap area, the owning snap container.
|
| + LayoutBox* m_snapContainer;
|
| + // For snap container, the descendant snap areas that contribute snap
|
| + // points.
|
| + OwnPtr<SnapAreaSet> m_snapAreas;
|
| +
|
| + SnapAreaSet& ensureSnapAreas()
|
| + {
|
| + if (!m_snapAreas)
|
| + m_snapAreas = adoptPtr(new SnapAreaSet);
|
| +
|
| + return *m_snapAreas;
|
| + }
|
| };
|
|
|
| // LayoutBox implements the full CSS box model.
|
| @@ -895,6 +912,12 @@ public:
|
| void setPercentHeightContainer(LayoutBlock*);
|
| void removeFromPercentHeightContainer();
|
| void clearPercentHeightDescendants();
|
| + // For snap areas, returns the snap container that owns us.
|
| + LayoutBox* snapContainer() const;
|
| + void setSnapContainer(LayoutBox*);
|
| + // For snap containers, returns all associated snap areas.
|
| + SnapAreaSet* snapAreas() const;
|
| + void clearSnapAreas();
|
|
|
| protected:
|
| void willBeDestroyed() override;
|
| @@ -956,6 +979,9 @@ private:
|
|
|
| void updateShapeOutsideInfoAfterStyleChange(const ComputedStyle&, const ComputedStyle* oldStyle);
|
| void updateGridPositionAfterStyleChange(const ComputedStyle*);
|
| + void updateScrollSnapMappingAfterStyleChange(const ComputedStyle*, const ComputedStyle* oldStyle);
|
| + void clearScrollSnapMapping();
|
| + void addScrollSnapMapping();
|
|
|
| bool autoWidthShouldFitContent() const;
|
| LayoutUnit shrinkToFitLogicalWidth(LayoutUnit availableLogicalWidth, LayoutUnit bordersPlusPadding) const;
|
| @@ -1040,6 +1066,9 @@ private:
|
|
|
| LayoutRectOutsets m_marginBoxOutsets;
|
|
|
| + void addSnapArea(const LayoutBox&);
|
| + void removeSnapArea(const LayoutBox&);
|
| +
|
| protected:
|
| // The logical width of the element if it were to break its lines at every
|
| // possible opportunity.
|
|
|