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

Side by Side Diff: Source/core/rendering/RenderBoxModelObject.h

Issue 385583005: For flex items, percent paddings should resolve against their respective dimension Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 int pixelSnappedOffsetTop() const { return roundToInt(offsetTop()); } 74 int pixelSnappedOffsetTop() const { return roundToInt(offsetTop()); }
75 virtual int pixelSnappedOffsetWidth() const; 75 virtual int pixelSnappedOffsetWidth() const;
76 virtual int pixelSnappedOffsetHeight() const; 76 virtual int pixelSnappedOffsetHeight() const;
77 77
78 virtual void updateFromStyle() OVERRIDE; 78 virtual void updateFromStyle() OVERRIDE;
79 79
80 // This will work on inlines to return the bounding box of all of the lines' border boxes. 80 // This will work on inlines to return the bounding box of all of the lines' border boxes.
81 virtual IntRect borderBoundingBox() const = 0; 81 virtual IntRect borderBoundingBox() const = 0;
82 82
83 // These return the CSS computed padding values. 83 // These return the CSS computed padding values.
84 LayoutUnit computedCSSPaddingTop() const { return computedCSSPadding(style() ->paddingTop()); } 84 LayoutUnit computedCSSPaddingTop() const { return computedCSSPadding(style() ->paddingTop(), true); }
tony 2014/07/10 17:10:06 This should be an enum, not a bool.
harpreet.sk 2014/07/14 08:38:07 Done.
85 LayoutUnit computedCSSPaddingBottom() const { return computedCSSPadding(styl e()->paddingBottom()); } 85 LayoutUnit computedCSSPaddingBottom() const { return computedCSSPadding(styl e()->paddingBottom(), true); }
86 LayoutUnit computedCSSPaddingLeft() const { return computedCSSPadding(style( )->paddingLeft()); } 86 LayoutUnit computedCSSPaddingLeft() const { return computedCSSPadding(style( )->paddingLeft()); }
87 LayoutUnit computedCSSPaddingRight() const { return computedCSSPadding(style ()->paddingRight()); } 87 LayoutUnit computedCSSPaddingRight() const { return computedCSSPadding(style ()->paddingRight()); }
88 LayoutUnit computedCSSPaddingBefore() const { return computedCSSPadding(styl e()->paddingBefore()); } 88 LayoutUnit computedCSSPaddingBefore() const { return computedCSSPadding(styl e()->paddingBefore(), true); }
89 LayoutUnit computedCSSPaddingAfter() const { return computedCSSPadding(style ()->paddingAfter()); } 89 LayoutUnit computedCSSPaddingAfter() const { return computedCSSPadding(style ()->paddingAfter(), true); }
90 LayoutUnit computedCSSPaddingStart() const { return computedCSSPadding(style ()->paddingStart()); } 90 LayoutUnit computedCSSPaddingStart() const { return computedCSSPadding(style ()->paddingStart()); }
91 LayoutUnit computedCSSPaddingEnd() const { return computedCSSPadding(style() ->paddingEnd()); } 91 LayoutUnit computedCSSPaddingEnd() const { return computedCSSPadding(style() ->paddingEnd()); }
92 92
93 // These functions are used during layout. Table cells 93 // These functions are used during layout. Table cells
94 // override them to include some extra intrinsic padding. 94 // override them to include some extra intrinsic padding.
95 virtual LayoutUnit paddingTop() const { return computedCSSPaddingTop(); } 95 virtual LayoutUnit paddingTop() const { return computedCSSPaddingTop(); }
96 virtual LayoutUnit paddingBottom() const { return computedCSSPaddingBottom() ; } 96 virtual LayoutUnit paddingBottom() const { return computedCSSPaddingBottom() ; }
97 virtual LayoutUnit paddingLeft() const { return computedCSSPaddingLeft(); } 97 virtual LayoutUnit paddingLeft() const { return computedCSSPaddingLeft(); }
98 virtual LayoutUnit paddingRight() const { return computedCSSPaddingRight(); } 98 virtual LayoutUnit paddingRight() const { return computedCSSPaddingRight(); }
99 virtual LayoutUnit paddingBefore() const { return computedCSSPaddingBefore() ; } 99 virtual LayoutUnit paddingBefore() const { return computedCSSPaddingBefore() ; }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 virtual LayoutUnit marginEnd(const RenderStyle* otherStyle = 0) const = 0; 144 virtual LayoutUnit marginEnd(const RenderStyle* otherStyle = 0) const = 0;
145 LayoutUnit marginHeight() const { return marginTop() + marginBottom(); } 145 LayoutUnit marginHeight() const { return marginTop() + marginBottom(); }
146 LayoutUnit marginWidth() const { return marginLeft() + marginRight(); } 146 LayoutUnit marginWidth() const { return marginLeft() + marginRight(); }
147 LayoutUnit marginLogicalHeight() const { return marginBefore() + marginAfter (); } 147 LayoutUnit marginLogicalHeight() const { return marginBefore() + marginAfter (); }
148 LayoutUnit marginLogicalWidth() const { return marginStart() + marginEnd(); } 148 LayoutUnit marginLogicalWidth() const { return marginStart() + marginEnd(); }
149 149
150 bool hasInlineDirectionBordersPaddingOrMargin() const { return hasInlineDire ctionBordersOrPadding() || marginStart()|| marginEnd(); } 150 bool hasInlineDirectionBordersPaddingOrMargin() const { return hasInlineDire ctionBordersOrPadding() || marginStart()|| marginEnd(); }
151 bool hasInlineDirectionBordersOrPadding() const { return borderStart() || bo rderEnd() || paddingStart()|| paddingEnd(); } 151 bool hasInlineDirectionBordersOrPadding() const { return borderStart() || bo rderEnd() || paddingStart()|| paddingEnd(); }
152 152
153 virtual LayoutUnit containingBlockLogicalWidthForContent() const; 153 virtual LayoutUnit containingBlockLogicalWidthForContent() const;
154 virtual LayoutUnit containingBlockLogicalHeightForContent() const;
154 155
155 virtual void childBecameNonInline(RenderObject* /*child*/) { } 156 virtual void childBecameNonInline(RenderObject* /*child*/) { }
156 157
157 void paintBorder(const PaintInfo&, const LayoutRect&, const RenderStyle*, Ba ckgroundBleedAvoidance = BackgroundBleedNone, bool includeLogicalLeftEdge = true , bool includeLogicalRightEdge = true); 158 void paintBorder(const PaintInfo&, const LayoutRect&, const RenderStyle*, Ba ckgroundBleedAvoidance = BackgroundBleedNone, bool includeLogicalLeftEdge = true , bool includeLogicalRightEdge = true);
158 bool paintNinePieceImage(GraphicsContext*, const LayoutRect&, const RenderSt yle*, const NinePieceImage&, CompositeOperator = CompositeSourceOver); 159 bool paintNinePieceImage(GraphicsContext*, const LayoutRect&, const RenderSt yle*, const NinePieceImage&, CompositeOperator = CompositeSourceOver);
159 void paintBoxShadow(const PaintInfo&, const LayoutRect&, const RenderStyle*, ShadowStyle, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true); 160 void paintBoxShadow(const PaintInfo&, const LayoutRect&, const RenderStyle*, ShadowStyle, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true);
160 void paintFillLayerExtended(const PaintInfo&, const Color&, const FillLayer* , const LayoutRect&, BackgroundBleedAvoidance, InlineFlowBox* = 0, const LayoutS ize& = LayoutSize(), CompositeOperator = CompositeSourceOver, RenderObject* back groundObject = 0); 161 void paintFillLayerExtended(const PaintInfo&, const Color&, const FillLayer* , const LayoutRect&, BackgroundBleedAvoidance, InlineFlowBox* = 0, const LayoutS ize& = LayoutSize(), CompositeOperator = CompositeSourceOver, RenderObject* back groundObject = 0);
161 162
162 virtual bool boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance, InlineFlowBox* = 0) const; 163 virtual bool boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance, InlineFlowBox* = 0) const;
163 164
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 void moveChildrenTo(RenderBoxModelObject* toBoxModelObject, RenderObject* st artChild, RenderObject* endChild, bool fullRemoveInsert = false) 291 void moveChildrenTo(RenderBoxModelObject* toBoxModelObject, RenderObject* st artChild, RenderObject* endChild, bool fullRemoveInsert = false)
291 { 292 {
292 moveChildrenTo(toBoxModelObject, startChild, endChild, 0, fullRemoveInse rt); 293 moveChildrenTo(toBoxModelObject, startChild, endChild, 0, fullRemoveInse rt);
293 } 294 }
294 void moveChildrenTo(RenderBoxModelObject* toBoxModelObject, RenderObject* st artChild, RenderObject* endChild, RenderObject* beforeChild, bool fullRemoveInse rt = false); 295 void moveChildrenTo(RenderBoxModelObject* toBoxModelObject, RenderObject* st artChild, RenderObject* endChild, RenderObject* beforeChild, bool fullRemoveInse rt = false);
295 296
296 enum ScaleByEffectiveZoomOrNot { ScaleByEffectiveZoom, DoNotScaleByEffective Zoom }; 297 enum ScaleByEffectiveZoomOrNot { ScaleByEffectiveZoom, DoNotScaleByEffective Zoom };
297 IntSize calculateImageIntrinsicDimensions(StyleImage*, const IntSize& scaled PositioningAreaSize, ScaleByEffectiveZoomOrNot) const; 298 IntSize calculateImageIntrinsicDimensions(StyleImage*, const IntSize& scaled PositioningAreaSize, ScaleByEffectiveZoomOrNot) const;
298 299
299 private: 300 private:
300 LayoutUnit computedCSSPadding(const Length&) const; 301 LayoutUnit computedCSSPadding(const Length&, bool isTopOrBottomOrAfterOrBefo rePadding = false) const;
301 virtual bool isBoxModelObject() const OVERRIDE FINAL { return true; } 302 virtual bool isBoxModelObject() const OVERRIDE FINAL { return true; }
302 303
303 IntSize calculateFillTileSize(const FillLayer*, const IntSize& scaledPositio ningAreaSize) const; 304 IntSize calculateFillTileSize(const FillLayer*, const IntSize& scaledPositio ningAreaSize) const;
304 305
305 RoundedRect getBackgroundRoundedRect(const LayoutRect&, InlineFlowBox*, Layo utUnit inlineBoxWidth, LayoutUnit inlineBoxHeight, 306 RoundedRect getBackgroundRoundedRect(const LayoutRect&, InlineFlowBox*, Layo utUnit inlineBoxWidth, LayoutUnit inlineBoxHeight,
306 bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const; 307 bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const;
307 308
308 bool fixedBackgroundPaintsInLocalCoordinates() const; 309 bool fixedBackgroundPaintsInLocalCoordinates() const;
309 310
310 void clipBorderSidePolygon(GraphicsContext*, const RoundedRect& outerBorder, const RoundedRect& innerBorder, 311 void clipBorderSidePolygon(GraphicsContext*, const RoundedRect& outerBorder, const RoundedRect& innerBorder,
(...skipping 10 matching lines...) Expand all
321 void drawBoxSideFromPath(GraphicsContext*, const LayoutRect&, const Path&, c onst class BorderEdge[], 322 void drawBoxSideFromPath(GraphicsContext*, const LayoutRect&, const Path&, c onst class BorderEdge[],
322 float thickness, float drawThickness, BoxSide, const RenderStyle*, 323 float thickness, float drawThickness, BoxSide, const RenderStyle*,
323 Color, EBorderStyle, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge); 324 Color, EBorderStyle, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge);
324 }; 325 };
325 326
326 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBoxModelObject, isBoxModelObject()); 327 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBoxModelObject, isBoxModelObject());
327 328
328 } // namespace WebCore 329 } // namespace WebCore
329 330
330 #endif // RenderBoxModelObject_h 331 #endif // RenderBoxModelObject_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698