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

Side by Side 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: Move compositor plumbing into a separate review. Created 5 years, 2 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 class for all CSS objects. 67 // This class is the base class for all CSS objects.
67 // 68 //
68 // All CSS objects follow the box model object: 69 // All CSS objects follow the box model object:
69 // http://www.w3.org/TR/CSS21/box.html 70 // http://www.w3.org/TR/CSS21/box.html
70 // 71 //
71 // This class actually doesn't have the box model but it exposes some common 72 // This class actually doesn't have the box model but it exposes some common
72 // functions or concepts that sub-classes can extend upon. For example, there 73 // functions or concepts that sub-classes can extend upon. For example, there
73 // are accessors for margins, borders, paddings and borderBoundingBox(). 74 // are accessors for margins, borders, paddings and borderBoundingBox().
74 // 75 //
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 public: 131 public:
131 LayoutBoxModelObject(ContainerNode*); 132 LayoutBoxModelObject(ContainerNode*);
132 ~LayoutBoxModelObject() override; 133 ~LayoutBoxModelObject() override;
133 134
134 // This is the only way layers should ever be destroyed. 135 // This is the only way layers should ever be destroyed.
135 void destroyLayer(); 136 void destroyLayer();
136 137
137 LayoutSize relativePositionOffset() const; 138 LayoutSize relativePositionOffset() const;
138 LayoutSize relativePositionLogicalOffset() const { return style()->isHorizon talWritingMode() ? relativePositionOffset() : relativePositionOffset().transpose dSize(); } 139 LayoutSize relativePositionLogicalOffset() const { return style()->isHorizon talWritingMode() ? relativePositionOffset() : relativePositionOffset().transpose dSize(); }
139 140
141 void computeStickyPositionConstraints(StickyPositionViewportConstraints&, co nst LayoutRect& constrainingRect) const;
142 LayoutRect computeStickyConstrainingRect() const;
143 LayoutSize stickyPositionOffset() const;
144
140 LayoutSize offsetForInFlowPosition() const; 145 LayoutSize offsetForInFlowPosition() const;
141 146
142 // IE extensions. Used to calculate offsetWidth/Height. Overridden by inlin es (LayoutFlow) 147 // IE extensions. Used to calculate offsetWidth/Height. Overridden by inlin es (LayoutFlow)
143 // to return the remaining width on a given line (and the height of a single line). 148 // to return the remaining width on a given line (and the height of a single line).
144 virtual LayoutUnit offsetLeft() const; 149 virtual LayoutUnit offsetLeft() const;
145 virtual LayoutUnit offsetTop() const; 150 virtual LayoutUnit offsetTop() const;
146 virtual LayoutUnit offsetWidth() const = 0; 151 virtual LayoutUnit offsetWidth() const = 0;
147 virtual LayoutUnit offsetHeight() const = 0; 152 virtual LayoutUnit offsetHeight() const = 0;
148 153
149 int pixelSnappedOffsetLeft() const { return roundToInt(offsetLeft()); } 154 int pixelSnappedOffsetLeft() const { return roundToInt(offsetLeft()); }
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 333
329 enum ScaleByEffectiveZoomOrNot { ScaleByEffectiveZoom, DoNotScaleByEffective Zoom }; 334 enum ScaleByEffectiveZoomOrNot { ScaleByEffectiveZoom, DoNotScaleByEffective Zoom };
330 IntSize calculateImageIntrinsicDimensions(StyleImage*, const IntSize& scaled PositioningAreaSize, ScaleByEffectiveZoomOrNot) const; 335 IntSize calculateImageIntrinsicDimensions(StyleImage*, const IntSize& scaled PositioningAreaSize, ScaleByEffectiveZoomOrNot) const;
331 336
332 private: 337 private:
333 void createLayer(DeprecatedPaintLayerType); 338 void createLayer(DeprecatedPaintLayerType);
334 339
335 LayoutUnit computedCSSPadding(const Length&) const; 340 LayoutUnit computedCSSPadding(const Length&) const;
336 bool isBoxModelObject() const final { return true; } 341 bool isBoxModelObject() const final { return true; }
337 342
343 // Returns the bounding rectangle to be used when determining sticky positio ning offset. This is the frame rect
344 // for box objects and the lines bounding box for inline objects.
345 virtual LayoutRect frameRectForStickyPositioning() const = 0;
346
338 // The DeprecatedPaintLayer associated with this object. 347 // The DeprecatedPaintLayer associated with this object.
339 // |m_layer| can be nullptr depending on the return value of layerTypeRequir ed(). 348 // |m_layer| can be nullptr depending on the return value of layerTypeRequir ed().
340 OwnPtr<DeprecatedPaintLayer> m_layer; 349 OwnPtr<DeprecatedPaintLayer> m_layer;
341 }; 350 };
342 351
343 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBoxModelObject, isBoxModelObject()); 352 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBoxModelObject, isBoxModelObject());
344 353
345 } // namespace blink 354 } // namespace blink
346 355
347 #endif // LayoutBoxModelObject_h 356 #endif // LayoutBoxModelObject_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698