Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBoxModelObject.h

Issue 1870663002: Reland main thread position sticky implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Only descend into children which have an ancestor overflow layer. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/LayoutBoxModelObject.h
diff --git a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.h b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.h
index bd836e914f05ad4b710539c501345579d49f948c..39f95eb3411d27686daa28630d0ae5515bccf7eb 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.h
+++ b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.h
@@ -26,6 +26,7 @@
#include "core/CoreExport.h"
#include "core/layout/LayoutObject.h"
+#include "core/page/scrolling/StickyPositionScrollingConstraints.h"
#include "core/style/ShadowData.h"
#include "platform/geometry/LayoutRect.h"
@@ -64,6 +65,15 @@ enum ContentChangeType {
class InlineFlowBox;
+struct LayoutBoxModelObjectRareData {
+ WTF_MAKE_NONCOPYABLE(LayoutBoxModelObjectRareData);
+ USING_FAST_MALLOC(LayoutBoxModelObjectRareData);
+public:
+ LayoutBoxModelObjectRareData() {}
+
+ StickyPositionScrollingConstraints m_stickyPositionScrollingConstraints;
+};
+
// This class is the base class for all CSS objects.
//
// All CSS objects follow the box model object. See THE BOX MODEL section in
@@ -141,6 +151,12 @@ public:
LayoutSize relativePositionOffset() const;
LayoutSize relativePositionLogicalOffset() const { return style()->isHorizontalWritingMode() ? relativePositionOffset() : relativePositionOffset().transposedSize(); }
+ // Populates StickyPositionConstraints, setting the sticky box rect, containing block rect and updating
+ // the constraint offsets according to the available space.
+ FloatRect computeStickyConstrainingRect() const;
+ void updateStickyPositionConstraints() const;
+ LayoutSize stickyPositionOffset() const;
+
LayoutSize offsetForInFlowPosition() const;
// IE extensions. Used to calculate offsetWidth/Height. Overridden by inlines (LayoutFlow)
@@ -330,6 +346,8 @@ protected:
void styleWillChange(StyleDifference, const ComputedStyle& newStyle) override;
void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override;
+ void invalidateStickyConstraints();
+
public:
// These functions are only used internally to manipulate the layout tree structure via remove/insert/appendChildNode.
// Since they are typically called only to move objects around within anonymous blocks (which only have layers in
@@ -361,9 +379,18 @@ private:
LayoutUnit computedCSSPadding(const Length&) const;
bool isBoxModelObject() const final { return true; }
+ LayoutBoxModelObjectRareData& ensureRareData()
+ {
+ if (!m_rareData)
+ m_rareData = adoptPtr(new LayoutBoxModelObjectRareData());
+ return *m_rareData.get();
+ }
+
// The PaintLayer associated with this object.
// |m_layer| can be nullptr depending on the return value of layerTypeRequired().
OwnPtr<PaintLayer> m_layer;
+
+ OwnPtr<LayoutBoxModelObjectRareData> m_rareData;
};
DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBoxModelObject, isBoxModelObject());

Powered by Google App Engine
This is Rietveld 408576698