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

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

Issue 1308273010: Adapt and reland old position sticky implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Make sticky vertical ref tests expectations not dependent on font size. Created 4 years, 9 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 8609f9b8a1421185ab7c0c486e1c8db92fc9829b..f686b6257209764313e33d507a606c471448acd0 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)
@@ -328,6 +344,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
@@ -359,9 +377,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