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

Side by Side Diff: 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: Fix style errors and remaining layout tests. Created 5 years, 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2003, 2006, 2007, 2009 Apple Inc. All rights reserved. 4 * Copyright (C) 2003, 2006, 2007, 2009 Apple Inc. All rights reserved.
5 * Copyright (C) 2010 Google Inc. All rights reserved. 5 * Copyright (C) 2010 Google Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 BackgroundBleedClipLayer, 55 BackgroundBleedClipLayer,
56 }; 56 };
57 57
58 enum ContentChangeType { 58 enum ContentChangeType {
59 ImageChanged, 59 ImageChanged,
60 CanvasChanged, 60 CanvasChanged,
61 CanvasContextChanged 61 CanvasContextChanged
62 }; 62 };
63 63
64 class InlineFlowBox; 64 class InlineFlowBox;
65 class StickyPositionViewportConstraints;
65 66
66 // This class is the base for all objects that adhere to the CSS box model as de scribed 67 // This class is the base for all objects that adhere to the CSS box model as de scribed
67 // at http://www.w3.org/TR/CSS21/box.html 68 // at http://www.w3.org/TR/CSS21/box.html
68 69
69 class CORE_EXPORT LayoutBoxModelObject : public LayoutObject { 70 class CORE_EXPORT LayoutBoxModelObject : public LayoutObject {
70 public: 71 public:
71 LayoutBoxModelObject(ContainerNode*); 72 LayoutBoxModelObject(ContainerNode*);
72 ~LayoutBoxModelObject() override; 73 ~LayoutBoxModelObject() override;
73 74
74 // This is the only way layers should ever be destroyed. 75 // This is the only way layers should ever be destroyed.
75 void destroyLayer(); 76 void destroyLayer();
76 77
77 LayoutSize relativePositionOffset() const; 78 LayoutSize relativePositionOffset() const;
78 LayoutSize relativePositionLogicalOffset() const { return style()->isHorizon talWritingMode() ? relativePositionOffset() : relativePositionOffset().transpose dSize(); } 79 LayoutSize relativePositionLogicalOffset() const { return style()->isHorizon talWritingMode() ? relativePositionOffset() : relativePositionOffset().transpose dSize(); }
79 80
81 void computeStickyPositionConstraints(StickyPositionViewportConstraints&, co nst LayoutRect& constrainingRect) const;
chrishtr 2015/09/17 01:18:56 What are the return values from this? What space i
flackr 2015/10/07 20:38:11 Added a comment.
82 LayoutRect computeStickyConstrainingRect() const;
83 LayoutSize stickyPositionOffset() const;
84
80 LayoutSize offsetForInFlowPosition() const; 85 LayoutSize offsetForInFlowPosition() const;
81 86
82 // IE extensions. Used to calculate offsetWidth/Height. Overridden by inlin es (LayoutFlow) 87 // IE extensions. Used to calculate offsetWidth/Height. Overridden by inlin es (LayoutFlow)
83 // to return the remaining width on a given line (and the height of a single line). 88 // to return the remaining width on a given line (and the height of a single line).
84 virtual LayoutUnit offsetLeft() const; 89 virtual LayoutUnit offsetLeft() const;
85 virtual LayoutUnit offsetTop() const; 90 virtual LayoutUnit offsetTop() const;
86 virtual LayoutUnit offsetWidth() const = 0; 91 virtual LayoutUnit offsetWidth() const = 0;
87 virtual LayoutUnit offsetHeight() const = 0; 92 virtual LayoutUnit offsetHeight() const = 0;
88 93
89 int pixelSnappedOffsetLeft() const { return roundToInt(offsetLeft()); } 94 int pixelSnappedOffsetLeft() const { return roundToInt(offsetLeft()); }
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 268
264 enum ScaleByEffectiveZoomOrNot { ScaleByEffectiveZoom, DoNotScaleByEffective Zoom }; 269 enum ScaleByEffectiveZoomOrNot { ScaleByEffectiveZoom, DoNotScaleByEffective Zoom };
265 IntSize calculateImageIntrinsicDimensions(StyleImage*, const IntSize& scaled PositioningAreaSize, ScaleByEffectiveZoomOrNot) const; 270 IntSize calculateImageIntrinsicDimensions(StyleImage*, const IntSize& scaled PositioningAreaSize, ScaleByEffectiveZoomOrNot) const;
266 271
267 private: 272 private:
268 void createLayer(DeprecatedPaintLayerType); 273 void createLayer(DeprecatedPaintLayerType);
269 274
270 LayoutUnit computedCSSPadding(const Length&) const; 275 LayoutUnit computedCSSPadding(const Length&) const;
271 bool isBoxModelObject() const final { return true; } 276 bool isBoxModelObject() const final { return true; }
272 277
278 virtual LayoutRect frameRectForStickyPositioning() const = 0;
skobes 2015/09/16 00:07:57 Can you add a comment explaining what this is and
flackr 2015/10/07 20:38:11 Done.
279
273 OwnPtr<DeprecatedPaintLayer> m_layer; 280 OwnPtr<DeprecatedPaintLayer> m_layer;
274 }; 281 };
275 282
276 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBoxModelObject, isBoxModelObject()); 283 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBoxModelObject, isBoxModelObject());
277 284
278 } // namespace blink 285 } // namespace blink
279 286
280 #endif // LayoutBoxModelObject_h 287 #endif // LayoutBoxModelObject_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698