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

Side by Side Diff: sky/engine/core/rendering/RenderBoxModelObject.h

Issue 953673002: Delete RenderLayerModelObject. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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.
11 * 11 *
12 * This library is distributed in the hope that it will be useful, 12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details. 15 * Library General Public License for more details.
16 * 16 *
17 * You should have received a copy of the GNU Library General Public License 17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB. If not, write to 18 * along with this library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA. 20 * Boston, MA 02110-1301, USA.
21 * 21 *
22 */ 22 */
23 23
24 #ifndef SKY_ENGINE_CORE_RENDERING_RENDERBOXMODELOBJECT_H_ 24 #ifndef SKY_ENGINE_CORE_RENDERING_RENDERBOXMODELOBJECT_H_
25 #define SKY_ENGINE_CORE_RENDERING_RENDERBOXMODELOBJECT_H_ 25 #define SKY_ENGINE_CORE_RENDERING_RENDERBOXMODELOBJECT_H_
26 26
27 #include "sky/engine/core/rendering/RenderLayerModelObject.h" 27 #include "sky/engine/core/rendering/RenderObject.h"
28 #include "sky/engine/core/rendering/style/ShadowData.h" 28 #include "sky/engine/core/rendering/style/ShadowData.h"
29 #include "sky/engine/platform/geometry/LayoutRect.h" 29 #include "sky/engine/platform/geometry/LayoutRect.h"
30 30
31 namespace blink { 31 namespace blink {
32 32
33 // Modes for some of the line-related functions. 33 // Modes for some of the line-related functions.
34 enum LinePositionMode { PositionOnContainingLine, PositionOfInteriorLineBoxes }; 34 enum LinePositionMode { PositionOnContainingLine, PositionOfInteriorLineBoxes };
35 // FIXME(sky): Remove this enum 35 // FIXME(sky): Remove this enum
36 enum LineDirectionMode { HorizontalLine }; 36 enum LineDirectionMode { HorizontalLine };
37 typedef unsigned BorderEdgeFlags; 37 typedef unsigned BorderEdgeFlags;
38 38
39 enum BackgroundBleedAvoidance { 39 enum BackgroundBleedAvoidance {
40 BackgroundBleedNone, 40 BackgroundBleedNone,
41 BackgroundBleedShrinkBackground, 41 BackgroundBleedShrinkBackground,
42 BackgroundBleedClipBackground, 42 BackgroundBleedClipBackground,
43 BackgroundBleedBackgroundOverBorder 43 BackgroundBleedBackgroundOverBorder
44 }; 44 };
45 45
46 enum ContentChangeType { 46 enum ContentChangeType {
47 CanvasChanged, 47 CanvasChanged,
48 CanvasContextChanged 48 CanvasContextChanged
49 }; 49 };
50 50
51 // This class is the base for all objects that adhere to the CSS box model as de scribed 51 // This class is the base for all objects that adhere to the CSS box model as de scribed
52 // at http://www.w3.org/TR/CSS21/box.html 52 // at http://www.w3.org/TR/CSS21/box.html
53 53
54 class RenderBoxModelObject : public RenderLayerModelObject { 54 class RenderBoxModelObject : public RenderObject {
55 public: 55 public:
56 RenderBoxModelObject(ContainerNode*); 56 RenderBoxModelObject(ContainerNode*);
57 virtual ~RenderBoxModelObject(); 57 virtual ~RenderBoxModelObject();
58 58
59 LayoutSize relativePositionOffset() const; 59 LayoutSize relativePositionOffset() const;
60 LayoutSize relativePositionLogicalOffset() const { return relativePositionOf fset(); } 60 LayoutSize relativePositionLogicalOffset() const { return relativePositionOf fset(); }
61 61
62 // IE extensions. Used to calculate offsetWidth/Height. Overridden by inlin es (RenderFlow) 62 // IE extensions. Used to calculate offsetWidth/Height. Overridden by inlin es (RenderFlow)
63 // to return the remaining width on a given line (and the height of a single line). 63 // to return the remaining width on a given line (and the height of a single line).
64 virtual LayoutUnit offsetLeft() const; 64 virtual LayoutUnit offsetLeft() const;
65 virtual LayoutUnit offsetTop() const; 65 virtual LayoutUnit offsetTop() const;
66 virtual LayoutUnit offsetWidth() const = 0; 66 virtual LayoutUnit offsetWidth() const = 0;
67 virtual LayoutUnit offsetHeight() const = 0; 67 virtual LayoutUnit offsetHeight() const = 0;
68 68
69 int pixelSnappedOffsetLeft() const { return roundToInt(offsetLeft()); } 69 int pixelSnappedOffsetLeft() const { return roundToInt(offsetLeft()); }
70 int pixelSnappedOffsetTop() const { return roundToInt(offsetTop()); } 70 int pixelSnappedOffsetTop() const { return roundToInt(offsetTop()); }
71 virtual int pixelSnappedOffsetWidth() const; 71 virtual int pixelSnappedOffsetWidth() const;
72 virtual int pixelSnappedOffsetHeight() const; 72 virtual int pixelSnappedOffsetHeight() const;
73 73
74 virtual void updateFromStyle() override;
75
76 // This will work on inlines to return the bounding box of all of the lines' border boxes. 74 // This will work on inlines to return the bounding box of all of the lines' border boxes.
77 virtual IntRect borderBoundingBox() const = 0; 75 virtual IntRect borderBoundingBox() const = 0;
78 76
79 // These return the CSS computed padding values. 77 // These return the CSS computed padding values.
80 LayoutUnit computedCSSPaddingTop() const { return computedCSSPadding(style() ->paddingTop()); } 78 LayoutUnit computedCSSPaddingTop() const { return computedCSSPadding(style() ->paddingTop()); }
81 LayoutUnit computedCSSPaddingBottom() const { return computedCSSPadding(styl e()->paddingBottom()); } 79 LayoutUnit computedCSSPaddingBottom() const { return computedCSSPadding(styl e()->paddingBottom()); }
82 LayoutUnit computedCSSPaddingLeft() const { return computedCSSPadding(style( )->paddingLeft()); } 80 LayoutUnit computedCSSPaddingLeft() const { return computedCSSPadding(style( )->paddingLeft()); }
83 LayoutUnit computedCSSPaddingRight() const { return computedCSSPadding(style ()->paddingRight()); } 81 LayoutUnit computedCSSPaddingRight() const { return computedCSSPadding(style ()->paddingRight()); }
84 LayoutUnit computedCSSPaddingBefore() const { return computedCSSPadding(styl e()->paddingBefore()); } 82 LayoutUnit computedCSSPaddingBefore() const { return computedCSSPadding(styl e()->paddingBefore()); }
85 LayoutUnit computedCSSPaddingAfter() const { return computedCSSPadding(style ()->paddingAfter()); } 83 LayoutUnit computedCSSPaddingAfter() const { return computedCSSPadding(style ()->paddingAfter()); }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 void paintBoxShadow(const PaintInfo&, const LayoutRect&, const RenderStyle*, ShadowStyle, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true); 151 void paintBoxShadow(const PaintInfo&, const LayoutRect&, const RenderStyle*, ShadowStyle, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true);
154 void paintFillLayerExtended(const PaintInfo&, const Color&, const FillLayer& , const LayoutRect&, BackgroundBleedAvoidance, InlineFlowBox* = 0, const LayoutS ize& = LayoutSize(), RenderObject* backgroundObject = 0, bool skipBaseColor = fa lse); 152 void paintFillLayerExtended(const PaintInfo&, const Color&, const FillLayer& , const LayoutRect&, BackgroundBleedAvoidance, InlineFlowBox* = 0, const LayoutS ize& = LayoutSize(), RenderObject* backgroundObject = 0, bool skipBaseColor = fa lse);
155 153
156 bool boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance, InlineFl owBox* = 0) const; 154 bool boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance, InlineFl owBox* = 0) const;
157 155
158 // Overridden by subclasses to determine line height and baseline position. 156 // Overridden by subclasses to determine line height and baseline position.
159 virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositio nMode = PositionOnContainingLine) const = 0; 157 virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositio nMode = PositionOnContainingLine) const = 0;
160 virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode , LinePositionMode = PositionOnContainingLine) const = 0; 158 virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode , LinePositionMode = PositionOnContainingLine) const = 0;
161 159
162 virtual void mapAbsoluteToLocalPoint(MapCoordinatesFlags, TransformState&) c onst override; 160 virtual void mapAbsoluteToLocalPoint(MapCoordinatesFlags, TransformState&) c onst override;
163 virtual const RenderObject* pushMappingToContainer(const RenderLayerModelObj ect* ancestorToStopAt, RenderGeometryMap&) const override; 161 virtual const RenderObject* pushMappingToContainer(const RenderBox* ancestor ToStopAt, RenderGeometryMap&) const override;
162
163 void collectSelfPaintingLayers(Vector<RenderBox*>& layers);
164 164
165 virtual void setSelectionState(SelectionState) override; 165 virtual void setSelectionState(SelectionState) override;
166 166
167 protected: 167 protected:
168 class BackgroundImageGeometry { 168 class BackgroundImageGeometry {
169 public: 169 public:
170 BackgroundImageGeometry() 170 BackgroundImageGeometry()
171 : m_hasNonLocalGeometry(false) 171 : m_hasNonLocalGeometry(false)
172 { } 172 { }
173 173
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 IntRect m_destRect; 223 IntRect m_destRect;
224 IntPoint m_destOrigin; 224 IntPoint m_destOrigin;
225 IntPoint m_phase; 225 IntPoint m_phase;
226 IntSize m_tileSize; 226 IntSize m_tileSize;
227 IntSize m_repeatSpacing; 227 IntSize m_repeatSpacing;
228 bool m_hasNonLocalGeometry; // Has background-attachment: fixed. Implies that we can't always cheaply compute destRect. 228 bool m_hasNonLocalGeometry; // Has background-attachment: fixed. Implies that we can't always cheaply compute destRect.
229 }; 229 };
230 230
231 LayoutPoint adjustedPositionRelativeToOffsetParent(const LayoutPoint&) const ; 231 LayoutPoint adjustedPositionRelativeToOffsetParent(const LayoutPoint&) const ;
232 232
233 bool calculateHasBoxDecorations() const; 233 void calculateBackgroundImageGeometry(const RenderBox* paintContainer, const FillLayer&, const LayoutRect& paintRect, BackgroundImageGeometry&, RenderObject * = 0) const;
234 void calculateBackgroundImageGeometry(const RenderLayerModelObject* paintCon tainer, const FillLayer&, const LayoutRect& paintRect, BackgroundImageGeometry&, RenderObject* = 0) const;
235 void getBorderEdgeInfo(class BorderEdge[], const RenderStyle*, bool includeL ogicalLeftEdge = true, bool includeLogicalRightEdge = true) const; 234 void getBorderEdgeInfo(class BorderEdge[], const RenderStyle*, bool includeL ogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
236 bool borderObscuresBackgroundEdge(const FloatSize& contextScale) const; 235 bool borderObscuresBackgroundEdge(const FloatSize& contextScale) const;
237 bool borderObscuresBackground() const; 236 bool borderObscuresBackground() const;
238 RoundedRect backgroundRoundedRectAdjustedForBleedAvoidance(GraphicsContext*, const LayoutRect&, BackgroundBleedAvoidance, InlineFlowBox*, const LayoutSize&, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const; 237 RoundedRect backgroundRoundedRectAdjustedForBleedAvoidance(GraphicsContext*, const LayoutRect&, BackgroundBleedAvoidance, InlineFlowBox*, const LayoutSize&, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const;
239 LayoutRect borderInnerRectAdjustedForBleedAvoidance(GraphicsContext*, const LayoutRect&, BackgroundBleedAvoidance) const; 238 LayoutRect borderInnerRectAdjustedForBleedAvoidance(GraphicsContext*, const LayoutRect&, BackgroundBleedAvoidance) const;
240 239
241 LayoutRect localCaretRectForEmptyElement(LayoutUnit width, LayoutUnit textIn dentOffset); 240 LayoutRect localCaretRectForEmptyElement(LayoutUnit width, LayoutUnit textIn dentOffset);
242 241
243 static void clipRoundedInnerRect(GraphicsContext*, const LayoutRect&, const RoundedRect& clipRect); 242 static void clipRoundedInnerRect(GraphicsContext*, const LayoutRect&, const RoundedRect& clipRect);
244 243
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 void drawBoxSideFromPath(GraphicsContext*, const LayoutRect&, const Path&, c onst class BorderEdge[], 277 void drawBoxSideFromPath(GraphicsContext*, const LayoutRect&, const Path&, c onst class BorderEdge[],
279 float thickness, float drawThickness, BoxSide, const RenderStyle*, 278 float thickness, float drawThickness, BoxSide, const RenderStyle*,
280 Color, EBorderStyle, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge); 279 Color, EBorderStyle, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge);
281 }; 280 };
282 281
283 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBoxModelObject, isBoxModelObject()); 282 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBoxModelObject, isBoxModelObject());
284 283
285 } // namespace blink 284 } // namespace blink
286 285
287 #endif // SKY_ENGINE_CORE_RENDERING_RENDERBOXMODELOBJECT_H_ 286 #endif // SKY_ENGINE_CORE_RENDERING_RENDERBOXMODELOBJECT_H_
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderBox.cpp ('k') | sky/engine/core/rendering/RenderBoxModelObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698