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

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

Issue 550363004: Factor painting code out of RenderBox into a new class called BoxPainter. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/RenderBox.cpp ('k') | Source/core/rendering/RenderBoxModelObject.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 30 matching lines...) Expand all
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 struct BorderEdge;
51 class RenderTextFragment; 52 class RenderTextFragment;
52 53
53 // This class is the base for all objects that adhere to the CSS box model as de scribed 54 // 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 55 // at http://www.w3.org/TR/CSS21/box.html
55 56
56 class RenderBoxModelObject : public RenderLayerModelObject { 57 class RenderBoxModelObject : public RenderLayerModelObject {
57 public: 58 public:
58 RenderBoxModelObject(ContainerNode*); 59 RenderBoxModelObject(ContainerNode*);
59 virtual ~RenderBoxModelObject(); 60 virtual ~RenderBoxModelObject();
60 61
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 virtual void mapAbsoluteToLocalPoint(MapCoordinatesFlags, TransformState&) c onst OVERRIDE; 169 virtual void mapAbsoluteToLocalPoint(MapCoordinatesFlags, TransformState&) c onst OVERRIDE;
169 virtual const RenderObject* pushMappingToContainer(const RenderLayerModelObj ect* ancestorToStopAt, RenderGeometryMap&) const OVERRIDE; 170 virtual const RenderObject* pushMappingToContainer(const RenderLayerModelObj ect* ancestorToStopAt, RenderGeometryMap&) const OVERRIDE;
170 171
171 virtual void setSelectionState(SelectionState) OVERRIDE; 172 virtual void setSelectionState(SelectionState) OVERRIDE;
172 173
173 void contentChanged(ContentChangeType); 174 void contentChanged(ContentChangeType);
174 bool hasAcceleratedCompositing() const; 175 bool hasAcceleratedCompositing() const;
175 176
176 virtual void computeLayerHitTestRects(LayerHitTestRects&) const OVERRIDE; 177 virtual void computeLayerHitTestRects(LayerHitTestRects&) const OVERRIDE;
177 178
179 // FIXME: Slimming Paint: make these two methods private again after moving paint code in this class to paint/
180 void paintRootBackgroundColor(const PaintInfo&, const LayoutRect&, const Col or&);
181 bool isDocumentElementWithOpaqueBackground() const;
182
178 protected: 183 protected:
179 virtual void willBeDestroyed() OVERRIDE; 184 virtual void willBeDestroyed() OVERRIDE;
180 185
181 class BackgroundImageGeometry { 186 class BackgroundImageGeometry {
182 public: 187 public:
183 BackgroundImageGeometry() 188 BackgroundImageGeometry()
184 : m_hasNonLocalGeometry(false) 189 : m_hasNonLocalGeometry(false)
185 { } 190 { }
186 191
187 IntPoint destOrigin() const { return m_destOrigin; } 192 IntPoint destOrigin() const { return m_destOrigin; }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 IntPoint m_phase; 243 IntPoint m_phase;
239 IntSize m_tileSize; 244 IntSize m_tileSize;
240 IntSize m_repeatSpacing; 245 IntSize m_repeatSpacing;
241 bool m_hasNonLocalGeometry; // Has background-attachment: fixed. Implies that we can't always cheaply compute destRect. 246 bool m_hasNonLocalGeometry; // Has background-attachment: fixed. Implies that we can't always cheaply compute destRect.
242 }; 247 };
243 248
244 LayoutPoint adjustedPositionRelativeToOffsetParent(const LayoutPoint&) const ; 249 LayoutPoint adjustedPositionRelativeToOffsetParent(const LayoutPoint&) const ;
245 250
246 bool calculateHasBoxDecorations() const; 251 bool calculateHasBoxDecorations() const;
247 void calculateBackgroundImageGeometry(const RenderLayerModelObject* paintCon tainer, const FillLayer&, const LayoutRect& paintRect, BackgroundImageGeometry&, RenderObject* = 0) const; 252 void calculateBackgroundImageGeometry(const RenderLayerModelObject* paintCon tainer, const FillLayer&, const LayoutRect& paintRect, BackgroundImageGeometry&, RenderObject* = 0) const;
248 void getBorderEdgeInfo(class BorderEdge[], const RenderStyle*, bool includeL ogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
249 bool borderObscuresBackgroundEdge(const FloatSize& contextScale) const;
250 bool borderObscuresBackground() const;
251 RoundedRect backgroundRoundedRectAdjustedForBleedAvoidance(GraphicsContext*, const LayoutRect&, BackgroundBleedAvoidance, InlineFlowBox*, const LayoutSize&, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const; 253 RoundedRect backgroundRoundedRectAdjustedForBleedAvoidance(GraphicsContext*, const LayoutRect&, BackgroundBleedAvoidance, InlineFlowBox*, const LayoutSize&, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const;
252 LayoutRect borderInnerRectAdjustedForBleedAvoidance(GraphicsContext*, const LayoutRect&, BackgroundBleedAvoidance) const; 254 LayoutRect borderInnerRectAdjustedForBleedAvoidance(GraphicsContext*, const LayoutRect&, BackgroundBleedAvoidance) const;
253 255
254 InterpolationQuality chooseInterpolationQuality(GraphicsContext*, Image*, co nst void*, const LayoutSize&); 256 InterpolationQuality chooseInterpolationQuality(GraphicsContext*, Image*, co nst void*, const LayoutSize&);
255 257
256 RenderBoxModelObject* continuation() const; 258 RenderBoxModelObject* continuation() const;
257 void setContinuation(RenderBoxModelObject*); 259 void setContinuation(RenderBoxModelObject*);
258 260
259 LayoutRect localCaretRectForEmptyElement(LayoutUnit width, LayoutUnit textIn dentOffset); 261 LayoutRect localCaretRectForEmptyElement(LayoutUnit width, LayoutUnit textIn dentOffset);
260 262
261 static void clipRoundedInnerRect(GraphicsContext*, const LayoutRect&, const RoundedRect& clipRect); 263 static void clipRoundedInnerRect(GraphicsContext*, const LayoutRect&, const RoundedRect& clipRect);
262 264
263 bool hasAutoHeightOrContainingBlockWithAutoHeight() const; 265 bool hasAutoHeightOrContainingBlockWithAutoHeight() const;
264 266
265 bool isDocumentElementWithOpaqueBackground() const;
266
267 void paintRootBackgroundColor(const PaintInfo&, const LayoutRect&, const Col or&);
268
269 public: 267 public:
270 static bool shouldAntialiasLines(GraphicsContext*); 268 static bool shouldAntialiasLines(GraphicsContext*);
271 269
272 // For RenderBlocks and RenderInlines with m_style->styleType() == FIRST_LET TER, this tracks their remaining text fragments 270 // For RenderBlocks and RenderInlines with m_style->styleType() == FIRST_LET TER, this tracks their remaining text fragments
273 RenderTextFragment* firstLetterRemainingText() const; 271 RenderTextFragment* firstLetterRemainingText() const;
274 void setFirstLetterRemainingText(RenderTextFragment*); 272 void setFirstLetterRemainingText(RenderTextFragment*);
275 273
276 // These functions are only used internally to manipulate the render tree st ructure via remove/insert/appendChildNode. 274 // These functions are only used internally to manipulate the render tree st ructure via remove/insert/appendChildNode.
277 // Since they are typically called only to move objects around within anonym ous blocks (which only have layers in 275 // Since they are typically called only to move objects around within anonym ous blocks (which only have layers in
278 // the case of column spans), the default for fullRemoveInsert is false rath er than true. 276 // the case of column spans), the default for fullRemoveInsert is false rath er than true.
(...skipping 27 matching lines...) Expand all
306 304
307 IntSize calculateFillTileSize(const FillLayer&, const IntSize& scaledPositio ningAreaSize) const; 305 IntSize calculateFillTileSize(const FillLayer&, const IntSize& scaledPositio ningAreaSize) const;
308 306
309 RoundedRect getBackgroundRoundedRect(const LayoutRect&, InlineFlowBox*, Layo utUnit inlineBoxWidth, LayoutUnit inlineBoxHeight, 307 RoundedRect getBackgroundRoundedRect(const LayoutRect&, InlineFlowBox*, Layo utUnit inlineBoxWidth, LayoutUnit inlineBoxHeight,
310 bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const; 308 bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const;
311 309
312 bool fixedBackgroundPaintsInLocalCoordinates() const; 310 bool fixedBackgroundPaintsInLocalCoordinates() const;
313 311
314 void clipBorderSidePolygon(GraphicsContext*, const RoundedRect& outerBorder, const RoundedRect& innerBorder, 312 void clipBorderSidePolygon(GraphicsContext*, const RoundedRect& outerBorder, const RoundedRect& innerBorder,
315 BoxSide, bool firstEdgeMatches, bool secondEdgeMa tches); 313 BoxSide, bool firstEdgeMatches, bool secondEdgeMa tches);
316 void clipBorderSideForComplexInnerPath(GraphicsContext*, const RoundedRect&, const RoundedRect&, BoxSide, const class BorderEdge[]); 314 void clipBorderSideForComplexInnerPath(GraphicsContext*, const RoundedRect&, const RoundedRect&, BoxSide, const BorderEdge[]);
317 void paintOneBorderSide(GraphicsContext*, const RenderStyle*, const RoundedR ect& outerBorder, const RoundedRect& innerBorder, 315 void paintOneBorderSide(GraphicsContext*, const RenderStyle*, const RoundedR ect& outerBorder, const RoundedRect& innerBorder,
318 const IntRect& sideRect, BoxSide, BoxSide adjace ntSide1, BoxSide adjacentSide2, const class BorderEdge[], 316 const IntRect& sideRect, BoxSide, BoxSide adjacentSide1, BoxSide adjacen tSide2, const BorderEdge[],
319 const Path*, BackgroundBleedAvoidance, bool incl udeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias, const Color* o verrideColor = 0); 317 const Path*, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias, const Color* overrideColor = 0);
320 void paintTranslucentBorderSides(GraphicsContext*, const RenderStyle*, const RoundedRect& outerBorder, const RoundedRect& innerBorder, const IntPoint& inner BorderAdjustment, 318 void paintTranslucentBorderSides(GraphicsContext*, const RenderStyle*, const RoundedRect& outerBorder, const RoundedRect& innerBorder, const IntPoint& inner BorderAdjustment,
321 const class BorderEdge[], BorderEdgeFlags, BackgroundBleedAvoidance, boo l includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias = false); 319 const BorderEdge[], BorderEdgeFlags, BackgroundBleedAvoidance, bool incl udeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias = false);
322 void paintBorderSides(GraphicsContext*, const RenderStyle*, const RoundedRec t& outerBorder, const RoundedRect& innerBorder, 320 void paintBorderSides(GraphicsContext*, const RenderStyle*, const RoundedRec t& outerBorder, const RoundedRect& innerBorder,
323 const IntPoint& innerBorderAdjustment, const class BorderEdge[], BorderE dgeFlags, BackgroundBleedAvoidance, 321 const IntPoint& innerBorderAdjustment, const BorderEdge[], BorderEdgeFla gs, BackgroundBleedAvoidance,
324 bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialia s = false, const Color* overrideColor = 0); 322 bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialia s = false, const Color* overrideColor = 0);
325 void drawBoxSideFromPath(GraphicsContext*, const LayoutRect&, const Path&, c onst class BorderEdge[], 323 void drawBoxSideFromPath(GraphicsContext*, const LayoutRect&, const Path&, c onst BorderEdge[],
326 float thickness, float drawThickness, BoxSide, const RenderStyle*, 324 float thickness, float drawThickness, BoxSide, const RenderStyle*,
327 Color, EBorderStyle, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge); 325 Color, EBorderStyle, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge);
328 }; 326 };
329 327
330 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBoxModelObject, isBoxModelObject()); 328 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBoxModelObject, isBoxModelObject());
331 329
332 } // namespace blink 330 } // namespace blink
333 331
334 #endif // RenderBoxModelObject_h 332 #endif // RenderBoxModelObject_h
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBox.cpp ('k') | Source/core/rendering/RenderBoxModelObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698