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 30 matching lines...) Expand all Loading... |
41 BackgroundBleedClipBackground, | 41 BackgroundBleedClipBackground, |
42 BackgroundBleedBackgroundOverBorder | 42 BackgroundBleedBackgroundOverBorder |
43 }; | 43 }; |
44 | 44 |
45 enum ContentChangeType { | 45 enum ContentChangeType { |
46 ImageChanged, | 46 ImageChanged, |
47 CanvasChanged, | 47 CanvasChanged, |
48 CanvasContextChanged | 48 CanvasContextChanged |
49 }; | 49 }; |
50 | 50 |
| 51 enum PaddingType { |
| 52 TopPadding, |
| 53 RightPadding, |
| 54 BottomPadding, |
| 55 LeftPadding, |
| 56 BeforePadding, |
| 57 AfterPadding, |
| 58 StartPadding, |
| 59 EndPadding |
| 60 }; |
| 61 |
51 class RenderTextFragment; | 62 class RenderTextFragment; |
52 | 63 |
53 // This class is the base for all objects that adhere to the CSS box model as de
scribed | 64 // This class is the base for all objects that adhere to the CSS box model as de
scribed |
54 // at http://www.w3.org/TR/CSS21/box.html | 65 // at http://www.w3.org/TR/CSS21/box.html |
55 | 66 |
56 class RenderBoxModelObject : public RenderLayerModelObject { | 67 class RenderBoxModelObject : public RenderLayerModelObject { |
57 public: | 68 public: |
58 RenderBoxModelObject(ContainerNode*); | 69 RenderBoxModelObject(ContainerNode*); |
59 virtual ~RenderBoxModelObject(); | 70 virtual ~RenderBoxModelObject(); |
60 | 71 |
(...skipping 13 matching lines...) Expand all Loading... |
74 int pixelSnappedOffsetTop() const { return roundToInt(offsetTop()); } | 85 int pixelSnappedOffsetTop() const { return roundToInt(offsetTop()); } |
75 virtual int pixelSnappedOffsetWidth() const; | 86 virtual int pixelSnappedOffsetWidth() const; |
76 virtual int pixelSnappedOffsetHeight() const; | 87 virtual int pixelSnappedOffsetHeight() const; |
77 | 88 |
78 virtual void updateFromStyle() OVERRIDE; | 89 virtual void updateFromStyle() OVERRIDE; |
79 | 90 |
80 // This will work on inlines to return the bounding box of all of the lines'
border boxes. | 91 // This will work on inlines to return the bounding box of all of the lines'
border boxes. |
81 virtual IntRect borderBoundingBox() const = 0; | 92 virtual IntRect borderBoundingBox() const = 0; |
82 | 93 |
83 // These return the CSS computed padding values. | 94 // These return the CSS computed padding values. |
84 LayoutUnit computedCSSPaddingTop() const { return computedCSSPadding(style()
->paddingTop()); } | 95 LayoutUnit computedCSSPaddingTop() const { return computedCSSPadding(style()
->paddingTop(), TopPadding); } |
85 LayoutUnit computedCSSPaddingBottom() const { return computedCSSPadding(styl
e()->paddingBottom()); } | 96 LayoutUnit computedCSSPaddingBottom() const { return computedCSSPadding(styl
e()->paddingBottom(), BottomPadding); } |
86 LayoutUnit computedCSSPaddingLeft() const { return computedCSSPadding(style(
)->paddingLeft()); } | 97 LayoutUnit computedCSSPaddingLeft() const { return computedCSSPadding(style(
)->paddingLeft(), LeftPadding); } |
87 LayoutUnit computedCSSPaddingRight() const { return computedCSSPadding(style
()->paddingRight()); } | 98 LayoutUnit computedCSSPaddingRight() const { return computedCSSPadding(style
()->paddingRight(), RightPadding); } |
88 LayoutUnit computedCSSPaddingBefore() const { return computedCSSPadding(styl
e()->paddingBefore()); } | 99 LayoutUnit computedCSSPaddingBefore() const { return computedCSSPadding(styl
e()->paddingBefore(), BeforePadding); } |
89 LayoutUnit computedCSSPaddingAfter() const { return computedCSSPadding(style
()->paddingAfter()); } | 100 LayoutUnit computedCSSPaddingAfter() const { return computedCSSPadding(style
()->paddingAfter(), AfterPadding); } |
90 LayoutUnit computedCSSPaddingStart() const { return computedCSSPadding(style
()->paddingStart()); } | 101 LayoutUnit computedCSSPaddingStart() const { return computedCSSPadding(style
()->paddingStart(), StartPadding); } |
91 LayoutUnit computedCSSPaddingEnd() const { return computedCSSPadding(style()
->paddingEnd()); } | 102 LayoutUnit computedCSSPaddingEnd() const { return computedCSSPadding(style()
->paddingEnd(), EndPadding); } |
92 | 103 |
93 // These functions are used during layout. Table cells | 104 // These functions are used during layout. Table cells |
94 // override them to include some extra intrinsic padding. | 105 // override them to include some extra intrinsic padding. |
95 virtual LayoutUnit paddingTop() const { return computedCSSPaddingTop(); } | 106 virtual LayoutUnit paddingTop() const { return computedCSSPaddingTop(); } |
96 virtual LayoutUnit paddingBottom() const { return computedCSSPaddingBottom()
; } | 107 virtual LayoutUnit paddingBottom() const { return computedCSSPaddingBottom()
; } |
97 virtual LayoutUnit paddingLeft() const { return computedCSSPaddingLeft(); } | 108 virtual LayoutUnit paddingLeft() const { return computedCSSPaddingLeft(); } |
98 virtual LayoutUnit paddingRight() const { return computedCSSPaddingRight();
} | 109 virtual LayoutUnit paddingRight() const { return computedCSSPaddingRight();
} |
99 virtual LayoutUnit paddingBefore() const { return computedCSSPaddingBefore()
; } | 110 virtual LayoutUnit paddingBefore() const { return computedCSSPaddingBefore()
; } |
100 virtual LayoutUnit paddingAfter() const { return computedCSSPaddingAfter();
} | 111 virtual LayoutUnit paddingAfter() const { return computedCSSPaddingAfter();
} |
101 virtual LayoutUnit paddingStart() const { return computedCSSPaddingStart();
} | 112 virtual LayoutUnit paddingStart() const { return computedCSSPaddingStart();
} |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 void moveChildrenTo(RenderBoxModelObject* toBoxModelObject, RenderObject* st
artChild, RenderObject* endChild, bool fullRemoveInsert = false) | 301 void moveChildrenTo(RenderBoxModelObject* toBoxModelObject, RenderObject* st
artChild, RenderObject* endChild, bool fullRemoveInsert = false) |
291 { | 302 { |
292 moveChildrenTo(toBoxModelObject, startChild, endChild, 0, fullRemoveInse
rt); | 303 moveChildrenTo(toBoxModelObject, startChild, endChild, 0, fullRemoveInse
rt); |
293 } | 304 } |
294 void moveChildrenTo(RenderBoxModelObject* toBoxModelObject, RenderObject* st
artChild, RenderObject* endChild, RenderObject* beforeChild, bool fullRemoveInse
rt = false); | 305 void moveChildrenTo(RenderBoxModelObject* toBoxModelObject, RenderObject* st
artChild, RenderObject* endChild, RenderObject* beforeChild, bool fullRemoveInse
rt = false); |
295 | 306 |
296 enum ScaleByEffectiveZoomOrNot { ScaleByEffectiveZoom, DoNotScaleByEffective
Zoom }; | 307 enum ScaleByEffectiveZoomOrNot { ScaleByEffectiveZoom, DoNotScaleByEffective
Zoom }; |
297 IntSize calculateImageIntrinsicDimensions(StyleImage*, const IntSize& scaled
PositioningAreaSize, ScaleByEffectiveZoomOrNot) const; | 308 IntSize calculateImageIntrinsicDimensions(StyleImage*, const IntSize& scaled
PositioningAreaSize, ScaleByEffectiveZoomOrNot) const; |
298 | 309 |
299 private: | 310 private: |
300 LayoutUnit computedCSSPadding(const Length&) const; | 311 LayoutUnit computedCSSPadding(const Length&, PaddingType) const; |
301 virtual bool isBoxModelObject() const OVERRIDE FINAL { return true; } | 312 virtual bool isBoxModelObject() const OVERRIDE FINAL { return true; } |
302 | 313 |
303 IntSize calculateFillTileSize(const FillLayer*, const IntSize& scaledPositio
ningAreaSize) const; | 314 IntSize calculateFillTileSize(const FillLayer*, const IntSize& scaledPositio
ningAreaSize) const; |
304 | 315 |
| 316 LayoutUnit containingBlockLogicalHeightForContent() const; |
| 317 LayoutUnit computePercentLogicalHeight() const; |
| 318 |
305 RoundedRect getBackgroundRoundedRect(const LayoutRect&, InlineFlowBox*, Layo
utUnit inlineBoxWidth, LayoutUnit inlineBoxHeight, | 319 RoundedRect getBackgroundRoundedRect(const LayoutRect&, InlineFlowBox*, Layo
utUnit inlineBoxWidth, LayoutUnit inlineBoxHeight, |
306 bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const; | 320 bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const; |
307 | 321 |
308 bool fixedBackgroundPaintsInLocalCoordinates() const; | 322 bool fixedBackgroundPaintsInLocalCoordinates() const; |
309 | 323 |
310 void clipBorderSidePolygon(GraphicsContext*, const RoundedRect& outerBorder,
const RoundedRect& innerBorder, | 324 void clipBorderSidePolygon(GraphicsContext*, const RoundedRect& outerBorder,
const RoundedRect& innerBorder, |
311 BoxSide, bool firstEdgeMatches, bool secondEdgeMa
tches); | 325 BoxSide, bool firstEdgeMatches, bool secondEdgeMa
tches); |
312 void clipBorderSideForComplexInnerPath(GraphicsContext*, const RoundedRect&,
const RoundedRect&, BoxSide, const class BorderEdge[]); | 326 void clipBorderSideForComplexInnerPath(GraphicsContext*, const RoundedRect&,
const RoundedRect&, BoxSide, const class BorderEdge[]); |
313 void paintOneBorderSide(GraphicsContext*, const RenderStyle*, const RoundedR
ect& outerBorder, const RoundedRect& innerBorder, | 327 void paintOneBorderSide(GraphicsContext*, const RenderStyle*, const RoundedR
ect& outerBorder, const RoundedRect& innerBorder, |
314 const IntRect& sideRect, BoxSide, BoxSide adjace
ntSide1, BoxSide adjacentSide2, const class BorderEdge[], | 328 const IntRect& sideRect, BoxSide, BoxSide adjace
ntSide1, BoxSide adjacentSide2, const class BorderEdge[], |
315 const Path*, BackgroundBleedAvoidance, bool incl
udeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias, const Color* o
verrideColor = 0); | 329 const Path*, BackgroundBleedAvoidance, bool incl
udeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias, const Color* o
verrideColor = 0); |
316 void paintTranslucentBorderSides(GraphicsContext*, const RenderStyle*, const
RoundedRect& outerBorder, const RoundedRect& innerBorder, const IntPoint& inner
BorderAdjustment, | 330 void paintTranslucentBorderSides(GraphicsContext*, const RenderStyle*, const
RoundedRect& outerBorder, const RoundedRect& innerBorder, const IntPoint& inner
BorderAdjustment, |
317 const class BorderEdge[], BorderEdgeFlags, BackgroundBleedAvoidance, boo
l includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias = false); | 331 const class BorderEdge[], BorderEdgeFlags, BackgroundBleedAvoidance, boo
l includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias = false); |
318 void paintBorderSides(GraphicsContext*, const RenderStyle*, const RoundedRec
t& outerBorder, const RoundedRect& innerBorder, | 332 void paintBorderSides(GraphicsContext*, const RenderStyle*, const RoundedRec
t& outerBorder, const RoundedRect& innerBorder, |
319 const IntPoint& innerBorderAdjustment, const class BorderEdge[], BorderE
dgeFlags, BackgroundBleedAvoidance, | 333 const IntPoint& innerBorderAdjustment, const class BorderEdge[], BorderE
dgeFlags, BackgroundBleedAvoidance, |
320 bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialia
s = false, const Color* overrideColor = 0); | 334 bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialia
s = false, const Color* overrideColor = 0); |
321 void drawBoxSideFromPath(GraphicsContext*, const LayoutRect&, const Path&, c
onst class BorderEdge[], | 335 void drawBoxSideFromPath(GraphicsContext*, const LayoutRect&, const Path&, c
onst class BorderEdge[], |
322 float thickness, float drawThickness, BoxSide, const
RenderStyle*, | 336 float thickness, float drawThickness, BoxSide, const
RenderStyle*, |
323 Color, EBorderStyle, BackgroundBleedAvoidance, bool
includeLogicalLeftEdge, bool includeLogicalRightEdge); | 337 Color, EBorderStyle, BackgroundBleedAvoidance, bool
includeLogicalLeftEdge, bool includeLogicalRightEdge); |
324 }; | 338 }; |
325 | 339 |
326 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBoxModelObject, isBoxModelObject()); | 340 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBoxModelObject, isBoxModelObject()); |
327 | 341 |
328 } // namespace WebCore | 342 } // namespace WebCore |
329 | 343 |
330 #endif // RenderBoxModelObject_h | 344 #endif // RenderBoxModelObject_h |
OLD | NEW |