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

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: Merge with master and skip anonymous containing blocks for sticky container. Created 4 years, 10 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 BackgroundBleedClipLayer, 56 BackgroundBleedClipLayer,
57 }; 57 };
58 58
59 enum ContentChangeType { 59 enum ContentChangeType {
60 ImageChanged, 60 ImageChanged,
61 CanvasChanged, 61 CanvasChanged,
62 CanvasContextChanged 62 CanvasContextChanged
63 }; 63 };
64 64
65 class InlineFlowBox; 65 class InlineFlowBox;
66 class StickyPositionViewportConstraints;
66 67
67 // This class is the base class for all CSS objects. 68 // This class is the base class for all CSS objects.
68 // 69 //
69 // All CSS objects follow the box model object. See THE BOX MODEL section in 70 // All CSS objects follow the box model object. See THE BOX MODEL section in
70 // LayoutBox for more information. 71 // LayoutBox for more information.
71 // 72 //
72 // This class actually doesn't have the box model but it exposes some common 73 // This class actually doesn't have the box model but it exposes some common
73 // functions or concepts that sub-classes can extend upon. For example, there 74 // functions or concepts that sub-classes can extend upon. For example, there
74 // are accessors for margins, borders, paddings and borderBoundingBox(). 75 // are accessors for margins, borders, paddings and borderBoundingBox().
75 // 76 //
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 public: 135 public:
135 LayoutBoxModelObject(ContainerNode*); 136 LayoutBoxModelObject(ContainerNode*);
136 ~LayoutBoxModelObject() override; 137 ~LayoutBoxModelObject() override;
137 138
138 // This is the only way layers should ever be destroyed. 139 // This is the only way layers should ever be destroyed.
139 void destroyLayer(); 140 void destroyLayer();
140 141
141 LayoutSize relativePositionOffset() const; 142 LayoutSize relativePositionOffset() const;
142 LayoutSize relativePositionLogicalOffset() const { return style()->isHorizon talWritingMode() ? relativePositionOffset() : relativePositionOffset().transpose dSize(); } 143 LayoutSize relativePositionLogicalOffset() const { return style()->isHorizon talWritingMode() ? relativePositionOffset() : relativePositionOffset().transpose dSize(); }
143 144
145 // Populates StickyPositionConstraints, setting the sticky box rect, contain ing block rect and updating
146 // the constraint offsets according to the available space.
147 void computeStickyPositionConstraints(StickyPositionViewportConstraints&, co nst FloatRect& constrainingRect) const;
148 FloatRect computeStickyConstrainingRect() const;
149 LayoutSize stickyPositionOffset() const;
150
144 LayoutSize offsetForInFlowPosition() const; 151 LayoutSize offsetForInFlowPosition() const;
145 152
146 // IE extensions. Used to calculate offsetWidth/Height. Overridden by inlin es (LayoutFlow) 153 // IE extensions. Used to calculate offsetWidth/Height. Overridden by inlin es (LayoutFlow)
147 // to return the remaining width on a given line (and the height of a single line). 154 // to return the remaining width on a given line (and the height of a single line).
148 virtual LayoutUnit offsetLeft() const; 155 virtual LayoutUnit offsetLeft() const;
149 virtual LayoutUnit offsetTop() const; 156 virtual LayoutUnit offsetTop() const;
150 virtual LayoutUnit offsetWidth() const = 0; 157 virtual LayoutUnit offsetWidth() const = 0;
151 virtual LayoutUnit offsetHeight() const = 0; 158 virtual LayoutUnit offsetHeight() const = 0;
152 159
153 int pixelSnappedOffsetLeft() const { return roundToInt(offsetLeft()); } 160 int pixelSnappedOffsetLeft() const { return roundToInt(offsetLeft()); }
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 // The PaintLayer associated with this object. 373 // The PaintLayer associated with this object.
367 // |m_layer| can be nullptr depending on the return value of layerTypeRequir ed(). 374 // |m_layer| can be nullptr depending on the return value of layerTypeRequir ed().
368 OwnPtr<PaintLayer> m_layer; 375 OwnPtr<PaintLayer> m_layer;
369 }; 376 };
370 377
371 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBoxModelObject, isBoxModelObject()); 378 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBoxModelObject, isBoxModelObject());
372 379
373 } // namespace blink 380 } // namespace blink
374 381
375 #endif // LayoutBoxModelObject_h 382 #endif // LayoutBoxModelObject_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698