OLD | NEW |
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 }; | 62 }; |
63 | 63 |
64 class InlineFlowBox; | 64 class InlineFlowBox; |
65 | 65 |
66 // This class is the base for all objects that adhere to the CSS box model as de
scribed | 66 // 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 | 67 // at http://www.w3.org/TR/CSS21/box.html |
68 | 68 |
69 class CORE_EXPORT LayoutBoxModelObject : public LayoutObject { | 69 class CORE_EXPORT LayoutBoxModelObject : public LayoutObject { |
70 public: | 70 public: |
71 LayoutBoxModelObject(ContainerNode*); | 71 LayoutBoxModelObject(ContainerNode*); |
72 virtual ~LayoutBoxModelObject(); | 72 ~LayoutBoxModelObject() override; |
73 | 73 |
74 // This is the only way layers should ever be destroyed. | 74 // This is the only way layers should ever be destroyed. |
75 void destroyLayer(); | 75 void destroyLayer(); |
76 | 76 |
77 LayoutSize relativePositionOffset() const; | 77 LayoutSize relativePositionOffset() const; |
78 LayoutSize relativePositionLogicalOffset() const { return style()->isHorizon
talWritingMode() ? relativePositionOffset() : relativePositionOffset().transpose
dSize(); } | 78 LayoutSize relativePositionLogicalOffset() const { return style()->isHorizon
talWritingMode() ? relativePositionOffset() : relativePositionOffset().transpose
dSize(); } |
79 | 79 |
80 LayoutSize offsetForInFlowPosition() const; | 80 LayoutSize offsetForInFlowPosition() const; |
81 | 81 |
82 // IE extensions. Used to calculate offsetWidth/Height. Overridden by inlin
es (LayoutFlow) | 82 // IE extensions. Used to calculate offsetWidth/Height. Overridden by inlin
es (LayoutFlow) |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 virtual LayoutUnit containingBlockLogicalWidthForContent() const; | 179 virtual LayoutUnit containingBlockLogicalWidthForContent() const; |
180 | 180 |
181 virtual void childBecameNonInline(LayoutObject* /*child*/) { } | 181 virtual void childBecameNonInline(LayoutObject* /*child*/) { } |
182 | 182 |
183 virtual bool boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance,
InlineFlowBox* = nullptr) const; | 183 virtual bool boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance,
InlineFlowBox* = nullptr) const; |
184 | 184 |
185 // Overridden by subclasses to determine line height and baseline position. | 185 // Overridden by subclasses to determine line height and baseline position. |
186 virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositio
nMode = PositionOnContainingLine) const = 0; | 186 virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositio
nMode = PositionOnContainingLine) const = 0; |
187 virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode
, LinePositionMode = PositionOnContainingLine) const = 0; | 187 virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode
, LinePositionMode = PositionOnContainingLine) const = 0; |
188 | 188 |
189 virtual void mapAbsoluteToLocalPoint(MapCoordinatesFlags, TransformState&) c
onst override; | 189 void mapAbsoluteToLocalPoint(MapCoordinatesFlags, TransformState&) const ove
rride; |
190 virtual const LayoutObject* pushMappingToContainer(const LayoutBoxModelObjec
t* ancestorToStopAt, LayoutGeometryMap&) const override; | 190 const LayoutObject* pushMappingToContainer(const LayoutBoxModelObject* ances
torToStopAt, LayoutGeometryMap&) const override; |
191 | 191 |
192 virtual void setSelectionState(SelectionState) override; | 192 void setSelectionState(SelectionState) override; |
193 | 193 |
194 void contentChanged(ContentChangeType); | 194 void contentChanged(ContentChangeType); |
195 bool hasAcceleratedCompositing() const; | 195 bool hasAcceleratedCompositing() const; |
196 | 196 |
197 virtual void computeLayerHitTestRects(LayerHitTestRects&) const override; | 197 void computeLayerHitTestRects(LayerHitTestRects&) const override; |
198 | 198 |
199 // Returns true if the background is painted opaque in the given rect. | 199 // Returns true if the background is painted opaque in the given rect. |
200 // The query rect is given in local coordinate system. | 200 // The query rect is given in local coordinate system. |
201 virtual bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const { re
turn false; } | 201 virtual bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const { re
turn false; } |
202 | 202 |
203 virtual void invalidateTreeIfNeeded(PaintInvalidationState&) override; | 203 void invalidateTreeIfNeeded(PaintInvalidationState&) override; |
204 | 204 |
205 // Indicate that the contents of this layoutObject need to be repainted. Onl
y has an effect if compositing is being used, | 205 // Indicate that the contents of this layoutObject need to be repainted. Onl
y has an effect if compositing is being used, |
206 void setBackingNeedsPaintInvalidationInRect(const LayoutRect&, PaintInvalida
tionReason) const; // r is in the coordinate space of this layout object | 206 void setBackingNeedsPaintInvalidationInRect(const LayoutRect&, PaintInvalida
tionReason) const; // r is in the coordinate space of this layout object |
207 | 207 |
208 void invalidateDisplayItemClientOnBacking(const DisplayItemClientWrapper&) c
onst; | 208 void invalidateDisplayItemClientOnBacking(const DisplayItemClientWrapper&) c
onst; |
209 | 209 |
210 // http://www.w3.org/TR/css3-background/#body-background | 210 // http://www.w3.org/TR/css3-background/#body-background |
211 // <html> root element with no background steals background from its first <
body> child. | 211 // <html> root element with no background steals background from its first <
body> child. |
212 // The used background for such body element should be the initial value. (i
.e. transparent) | 212 // The used background for such body element should be the initial value. (i
.e. transparent) |
213 bool backgroundStolenForBeingBody(const ComputedStyle* rootElementStyle = nu
llptr) const; | 213 bool backgroundStolenForBeingBody(const ComputedStyle* rootElementStyle = nu
llptr) const; |
214 | 214 |
215 protected: | 215 protected: |
216 virtual void willBeDestroyed() override; | 216 void willBeDestroyed() override; |
217 | 217 |
218 LayoutPoint adjustedPositionRelativeToOffsetParent(const LayoutPoint&) const
; | 218 LayoutPoint adjustedPositionRelativeToOffsetParent(const LayoutPoint&) const
; |
219 | 219 |
220 bool calculateHasBoxDecorations() const; | 220 bool calculateHasBoxDecorations() const; |
221 | 221 |
222 LayoutBoxModelObject* continuation() const; | 222 LayoutBoxModelObject* continuation() const; |
223 void setContinuation(LayoutBoxModelObject*); | 223 void setContinuation(LayoutBoxModelObject*); |
224 | 224 |
225 LayoutRect localCaretRectForEmptyElement(LayoutUnit width, LayoutUnit textIn
dentOffset); | 225 LayoutRect localCaretRectForEmptyElement(LayoutUnit width, LayoutUnit textIn
dentOffset); |
226 | 226 |
227 bool hasAutoHeightOrContainingBlockWithAutoHeight() const; | 227 bool hasAutoHeightOrContainingBlockWithAutoHeight() const; |
228 LayoutBlock* containingBlockForAutoHeightDetection(Length logicalHeight) con
st; | 228 LayoutBlock* containingBlockForAutoHeightDetection(Length logicalHeight) con
st; |
229 | 229 |
230 void addFocusRingRectsForNormalChildren(Vector<LayoutRect>&, const LayoutPoi
nt& additionalOffset) const; | 230 void addFocusRingRectsForNormalChildren(Vector<LayoutRect>&, const LayoutPoi
nt& additionalOffset) const; |
231 void addFocusRingRectsForDescendant(const LayoutObject& descendant, Vector<L
ayoutRect>&, const LayoutPoint& additionalOffset) const; | 231 void addFocusRingRectsForDescendant(const LayoutObject& descendant, Vector<L
ayoutRect>&, const LayoutPoint& additionalOffset) const; |
232 | 232 |
233 virtual void addLayerHitTestRects(LayerHitTestRects&, const DeprecatedPaintL
ayer*, const LayoutPoint&, const LayoutRect&) const override; | 233 void addLayerHitTestRects(LayerHitTestRects&, const DeprecatedPaintLayer*, c
onst LayoutPoint&, const LayoutRect&) const override; |
234 | 234 |
235 void styleWillChange(StyleDifference, const ComputedStyle& newStyle) overrid
e; | 235 void styleWillChange(StyleDifference, const ComputedStyle& newStyle) overrid
e; |
236 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override
; | 236 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override
; |
237 | 237 |
238 public: | 238 public: |
239 // These functions are only used internally to manipulate the layout tree st
ructure via remove/insert/appendChildNode. | 239 // These functions are only used internally to manipulate the layout tree st
ructure via remove/insert/appendChildNode. |
240 // Since they are typically called only to move objects around within anonym
ous blocks (which only have layers in | 240 // Since they are typically called only to move objects around within anonym
ous blocks (which only have layers in |
241 // the case of column spans), the default for fullRemoveInsert is false rath
er than true. | 241 // the case of column spans), the default for fullRemoveInsert is false rath
er than true. |
242 void moveChildTo(LayoutBoxModelObject* toBoxModelObject, LayoutObject* child
, LayoutObject* beforeChild, bool fullRemoveInsert = false); | 242 void moveChildTo(LayoutBoxModelObject* toBoxModelObject, LayoutObject* child
, LayoutObject* beforeChild, bool fullRemoveInsert = false); |
243 void moveChildTo(LayoutBoxModelObject* toBoxModelObject, LayoutObject* child
, bool fullRemoveInsert = false) | 243 void moveChildTo(LayoutBoxModelObject* toBoxModelObject, LayoutObject* child
, bool fullRemoveInsert = false) |
(...skipping 16 matching lines...) Expand all Loading... |
260 } | 260 } |
261 virtual void moveChildrenTo(LayoutBoxModelObject* toBoxModelObject, LayoutOb
ject* startChild, LayoutObject* endChild, LayoutObject* beforeChild, bool fullRe
moveInsert = false); | 261 virtual void moveChildrenTo(LayoutBoxModelObject* toBoxModelObject, LayoutOb
ject* startChild, LayoutObject* endChild, LayoutObject* beforeChild, bool fullRe
moveInsert = false); |
262 | 262 |
263 enum ScaleByEffectiveZoomOrNot { ScaleByEffectiveZoom, DoNotScaleByEffective
Zoom }; | 263 enum ScaleByEffectiveZoomOrNot { ScaleByEffectiveZoom, DoNotScaleByEffective
Zoom }; |
264 IntSize calculateImageIntrinsicDimensions(StyleImage*, const IntSize& scaled
PositioningAreaSize, ScaleByEffectiveZoomOrNot) const; | 264 IntSize calculateImageIntrinsicDimensions(StyleImage*, const IntSize& scaled
PositioningAreaSize, ScaleByEffectiveZoomOrNot) const; |
265 | 265 |
266 private: | 266 private: |
267 void createLayer(DeprecatedPaintLayerType); | 267 void createLayer(DeprecatedPaintLayerType); |
268 | 268 |
269 LayoutUnit computedCSSPadding(const Length&) const; | 269 LayoutUnit computedCSSPadding(const Length&) const; |
270 virtual bool isBoxModelObject() const override final { return true; } | 270 bool isBoxModelObject() const final { return true; } |
271 | 271 |
272 OwnPtr<DeprecatedPaintLayer> m_layer; | 272 OwnPtr<DeprecatedPaintLayer> m_layer; |
273 }; | 273 }; |
274 | 274 |
275 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBoxModelObject, isBoxModelObject()); | 275 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBoxModelObject, isBoxModelObject()); |
276 | 276 |
277 } // namespace blink | 277 } // namespace blink |
278 | 278 |
279 #endif // LayoutBoxModelObject_h | 279 #endif // LayoutBoxModelObject_h |
OLD | NEW |