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 1d8ccb0e17c17ee99e6be44c829f1ac2526f4f0e..a046f09ecf88b584f13acf9495fefc3b6c24c5a2 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutBox.h |
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.h |
@@ -57,6 +57,8 @@ enum ApplyOverflowClipFlag { |
ApplyNonScrollOverflowClip |
}; |
+using SnapAreaSet = HashSet<const LayoutBox*>; |
+ |
struct LayoutBoxRareData { |
WTF_MAKE_NONCOPYABLE(LayoutBoxRareData); USING_FAST_MALLOC(LayoutBoxRareData); |
public: |
@@ -66,6 +68,8 @@ public: |
, m_overrideLogicalContentWidth(-1) |
, m_previousBorderBoxSize(LayoutUnit(-1), LayoutUnit(-1)) |
, m_percentHeightContainer(nullptr) |
+ , m_snapContainer(nullptr) |
+ , m_snapAreas(nullptr) |
{ |
} |
@@ -85,6 +89,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. |
@@ -931,6 +948,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(); |
bool hitTestClippedOutByRoundedBorder(const HitTestLocation& locationInContainer, const LayoutPoint& borderBoxLocation) const; |
@@ -994,6 +1017,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; |
@@ -1079,6 +1105,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. |