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

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

Issue 14383002: Apply FINAL to the RenderObject hierarchy. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase, add OVERRIDEs. Created 7 years, 8 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/RenderBlock.h ('k') | Source/core/rendering/RenderBoxModelObject.h » ('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 Apple Inc. All rights reserved. 4 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 class RenderBox : public RenderBoxModelObject { 45 class RenderBox : public RenderBoxModelObject {
46 public: 46 public:
47 explicit RenderBox(ContainerNode*); 47 explicit RenderBox(ContainerNode*);
48 virtual ~RenderBox(); 48 virtual ~RenderBox();
49 49
50 // hasAutoZIndex only returns true if the element is positioned or a flex-it em since 50 // hasAutoZIndex only returns true if the element is positioned or a flex-it em since
51 // position:static elements that are not flex-items get their z-index coerce d to auto. 51 // position:static elements that are not flex-items get their z-index coerce d to auto.
52 virtual bool requiresLayer() const OVERRIDE { return isRoot() || isPositione d() || createsGroup() || hasClipPath() || hasOverflowClip() || hasTransform() || hasHiddenBackface() || hasReflection() || style()->specifiesColumns() || !style ()->hasAutoZIndex() || isFloatingWithShapeOutside(); } 52 virtual bool requiresLayer() const OVERRIDE { return isRoot() || isPositione d() || createsGroup() || hasClipPath() || hasOverflowClip() || hasTransform() || hasHiddenBackface() || hasReflection() || style()->specifiesColumns() || !style ()->hasAutoZIndex() || isFloatingWithShapeOutside(); }
53 53
54 virtual bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) const OVERRIDE; 54 virtual bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) const OVERRIDE FINAL;
55 55
56 // Use this with caution! No type checking is done! 56 // Use this with caution! No type checking is done!
57 RenderBox* firstChildBox() const; 57 RenderBox* firstChildBox() const;
58 RenderBox* lastChildBox() const; 58 RenderBox* lastChildBox() const;
59 59
60 LayoutUnit x() const { return m_frameRect.x(); } 60 LayoutUnit x() const { return m_frameRect.x(); }
61 LayoutUnit y() const { return m_frameRect.y(); } 61 LayoutUnit y() const { return m_frameRect.y(); }
62 LayoutUnit width() const { return m_frameRect.width(); } 62 LayoutUnit width() const { return m_frameRect.width(); }
63 LayoutUnit height() const { return m_frameRect.height(); } 63 LayoutUnit height() const { return m_frameRect.height(); }
64 64
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 void setSize(const LayoutSize& size) { m_frameRect.setSize(size); } 142 void setSize(const LayoutSize& size) { m_frameRect.setSize(size); }
143 void move(LayoutUnit dx, LayoutUnit dy) { m_frameRect.move(dx, dy); } 143 void move(LayoutUnit dx, LayoutUnit dy) { m_frameRect.move(dx, dy); }
144 144
145 LayoutRect frameRect() const { return m_frameRect; } 145 LayoutRect frameRect() const { return m_frameRect; }
146 IntRect pixelSnappedFrameRect() const { return pixelSnappedIntRect(m_frameRe ct); } 146 IntRect pixelSnappedFrameRect() const { return pixelSnappedIntRect(m_frameRe ct); }
147 void setFrameRect(const LayoutRect& rect) { m_frameRect = rect; } 147 void setFrameRect(const LayoutRect& rect) { m_frameRect = rect; }
148 148
149 LayoutRect borderBoxRect() const { return LayoutRect(LayoutPoint(), size()); } 149 LayoutRect borderBoxRect() const { return LayoutRect(LayoutPoint(), size()); }
150 LayoutRect paddingBoxRect() const { return LayoutRect(borderLeft(), borderTo p(), contentWidth() + paddingLeft() + paddingRight(), contentHeight() + paddingT op() + paddingBottom()); } 150 LayoutRect paddingBoxRect() const { return LayoutRect(borderLeft(), borderTo p(), contentWidth() + paddingLeft() + paddingRight(), contentHeight() + paddingT op() + paddingBottom()); }
151 IntRect pixelSnappedBorderBoxRect() const { return IntRect(IntPoint(), m_fra meRect.pixelSnappedSize()); } 151 IntRect pixelSnappedBorderBoxRect() const { return IntRect(IntPoint(), m_fra meRect.pixelSnappedSize()); }
152 virtual IntRect borderBoundingBox() const { return pixelSnappedBorderBoxRect (); } 152 virtual IntRect borderBoundingBox() const OVERRIDE FINAL { return pixelSnapp edBorderBoxRect(); }
153 153
154 // The content area of the box (excludes padding - and intrinsic padding for table cells, etc... - and border). 154 // The content area of the box (excludes padding - and intrinsic padding for table cells, etc... - and border).
155 LayoutRect contentBoxRect() const { return LayoutRect(borderLeft() + padding Left(), borderTop() + paddingTop(), contentWidth(), contentHeight()); } 155 LayoutRect contentBoxRect() const { return LayoutRect(borderLeft() + padding Left(), borderTop() + paddingTop(), contentWidth(), contentHeight()); }
156 // The content box in absolute coords. Ignores transforms. 156 // The content box in absolute coords. Ignores transforms.
157 IntRect absoluteContentBox() const; 157 IntRect absoluteContentBox() const;
158 // The content box converted to absolute coords (taking transforms into acco unt). 158 // The content box converted to absolute coords (taking transforms into acco unt).
159 FloatQuad absoluteContentQuad() const; 159 FloatQuad absoluteContentQuad() const;
160 160
161 // This returns the content area of the box (excluding padding and border). The only difference with contentBoxRect is that computedCSSContentBoxRect 161 // This returns the content area of the box (excluding padding and border). The only difference with contentBoxRect is that computedCSSContentBoxRect
162 // does include the intrinsic padding in the content box as this is what som e callers expect (like getComputedStyle). 162 // does include the intrinsic padding in the content box as this is what som e callers expect (like getComputedStyle).
163 LayoutRect computedCSSContentBoxRect() const { return LayoutRect(borderLeft( ) + computedCSSPaddingLeft(), borderTop() + computedCSSPaddingTop(), clientWidth () - computedCSSPaddingLeft() - computedCSSPaddingRight(), clientHeight() - comp utedCSSPaddingTop() - computedCSSPaddingBottom()); } 163 LayoutRect computedCSSContentBoxRect() const { return LayoutRect(borderLeft( ) + computedCSSPaddingLeft(), borderTop() + computedCSSPaddingTop(), clientWidth () - computedCSSPaddingLeft() - computedCSSPaddingRight(), clientHeight() - comp utedCSSPaddingTop() - computedCSSPaddingBottom()); }
164 164
165 // Bounds of the outline box in absolute coords. Respects transforms 165 // Bounds of the outline box in absolute coords. Respects transforms
166 virtual LayoutRect outlineBoundsForRepaint(const RenderLayerModelObject* /*r epaintContainer*/, const RenderGeometryMap*) const OVERRIDE; 166 virtual LayoutRect outlineBoundsForRepaint(const RenderLayerModelObject* /*r epaintContainer*/, const RenderGeometryMap*) const OVERRIDE FINAL;
167 virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& addition alOffset, const RenderLayerModelObject* paintContainer = 0) OVERRIDE; 167 virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& addition alOffset, const RenderLayerModelObject* paintContainer = 0) OVERRIDE;
168 168
169 // Use this with caution! No type checking is done! 169 // Use this with caution! No type checking is done!
170 RenderBox* previousSiblingBox() const; 170 RenderBox* previousSiblingBox() const;
171 RenderBox* nextSiblingBox() const; 171 RenderBox* nextSiblingBox() const;
172 RenderBox* parentBox() const; 172 RenderBox* parentBox() const;
173 173
174 // Visual and layout overflow are in the coordinate space of the box. This means that they aren't purely physical directions. 174 // Visual and layout overflow are in the coordinate space of the box. This means that they aren't purely physical directions.
175 // For horizontal-tb and vertical-lr they will match physical directions, bu t for horizontal-bt and vertical-rl, the top/bottom and left/right 175 // For horizontal-tb and vertical-lr they will match physical directions, bu t for horizontal-bt and vertical-rl, the top/bottom and left/right
176 // respectively are flipped when compared to their physical counterparts. F or example minX is on the left in vertical-lr, 176 // respectively are flipped when compared to their physical counterparts. F or example minX is on the left in vertical-lr,
(...skipping 23 matching lines...) Expand all
200 LayoutUnit contentWidth() const { return clientWidth() - paddingLeft() - pad dingRight(); } 200 LayoutUnit contentWidth() const { return clientWidth() - paddingLeft() - pad dingRight(); }
201 LayoutUnit contentHeight() const { return clientHeight() - paddingTop() - pa ddingBottom(); } 201 LayoutUnit contentHeight() const { return clientHeight() - paddingTop() - pa ddingBottom(); }
202 LayoutUnit contentLogicalWidth() const { return style()->isHorizontalWriting Mode() ? contentWidth() : contentHeight(); } 202 LayoutUnit contentLogicalWidth() const { return style()->isHorizontalWriting Mode() ? contentWidth() : contentHeight(); }
203 LayoutUnit contentLogicalHeight() const { return style()->isHorizontalWritin gMode() ? contentHeight() : contentWidth(); } 203 LayoutUnit contentLogicalHeight() const { return style()->isHorizontalWritin gMode() ? contentHeight() : contentWidth(); }
204 204
205 // IE extensions. Used to calculate offsetWidth/Height. Overridden by inlin es (RenderFlow) 205 // IE extensions. Used to calculate offsetWidth/Height. Overridden by inlin es (RenderFlow)
206 // to return the remaining width on a given line (and the height of a single line). 206 // to return the remaining width on a given line (and the height of a single line).
207 virtual LayoutUnit offsetWidth() const { return width(); } 207 virtual LayoutUnit offsetWidth() const { return width(); }
208 virtual LayoutUnit offsetHeight() const { return height(); } 208 virtual LayoutUnit offsetHeight() const { return height(); }
209 209
210 virtual int pixelSnappedOffsetWidth() const OVERRIDE; 210 virtual int pixelSnappedOffsetWidth() const OVERRIDE FINAL;
211 virtual int pixelSnappedOffsetHeight() const OVERRIDE; 211 virtual int pixelSnappedOffsetHeight() const OVERRIDE FINAL;
212 212
213 // More IE extensions. clientWidth and clientHeight represent the interior of an object 213 // More IE extensions. clientWidth and clientHeight represent the interior of an object
214 // excluding border and scrollbar. clientLeft/Top are just the borderLeftWi dth and borderTopWidth. 214 // excluding border and scrollbar. clientLeft/Top are just the borderLeftWi dth and borderTopWidth.
215 LayoutUnit clientLeft() const { return borderLeft(); } 215 LayoutUnit clientLeft() const { return borderLeft(); }
216 LayoutUnit clientTop() const { return borderTop(); } 216 LayoutUnit clientTop() const { return borderTop(); }
217 LayoutUnit clientWidth() const; 217 LayoutUnit clientWidth() const;
218 LayoutUnit clientHeight() const; 218 LayoutUnit clientHeight() const;
219 LayoutUnit clientLogicalWidth() const { return style()->isHorizontalWritingM ode() ? clientWidth() : clientHeight(); } 219 LayoutUnit clientLogicalWidth() const { return style()->isHorizontalWritingM ode() ? clientWidth() : clientHeight(); }
220 LayoutUnit clientLogicalHeight() const { return style()->isHorizontalWriting Mode() ? clientHeight() : clientWidth(); } 220 LayoutUnit clientLogicalHeight() const { return style()->isHorizontalWriting Mode() ? clientHeight() : clientWidth(); }
221 LayoutUnit clientLogicalBottom() const { return borderBefore() + clientLogic alHeight(); } 221 LayoutUnit clientLogicalBottom() const { return borderBefore() + clientLogic alHeight(); }
(...skipping 16 matching lines...) Expand all
238 238
239 virtual LayoutUnit marginTop() const OVERRIDE { return m_marginBox.top(); } 239 virtual LayoutUnit marginTop() const OVERRIDE { return m_marginBox.top(); }
240 virtual LayoutUnit marginBottom() const OVERRIDE { return m_marginBox.bottom (); } 240 virtual LayoutUnit marginBottom() const OVERRIDE { return m_marginBox.bottom (); }
241 virtual LayoutUnit marginLeft() const OVERRIDE { return m_marginBox.left(); } 241 virtual LayoutUnit marginLeft() const OVERRIDE { return m_marginBox.left(); }
242 virtual LayoutUnit marginRight() const OVERRIDE { return m_marginBox.right() ; } 242 virtual LayoutUnit marginRight() const OVERRIDE { return m_marginBox.right() ; }
243 void setMarginTop(LayoutUnit margin) { m_marginBox.setTop(margin); } 243 void setMarginTop(LayoutUnit margin) { m_marginBox.setTop(margin); }
244 void setMarginBottom(LayoutUnit margin) { m_marginBox.setBottom(margin); } 244 void setMarginBottom(LayoutUnit margin) { m_marginBox.setBottom(margin); }
245 void setMarginLeft(LayoutUnit margin) { m_marginBox.setLeft(margin); } 245 void setMarginLeft(LayoutUnit margin) { m_marginBox.setLeft(margin); }
246 void setMarginRight(LayoutUnit margin) { m_marginBox.setRight(margin); } 246 void setMarginRight(LayoutUnit margin) { m_marginBox.setRight(margin); }
247 247
248 virtual LayoutUnit marginLogicalLeft() const { return m_marginBox.logicalLef t(style()->writingMode()); } 248 LayoutUnit marginLogicalLeft() const { return m_marginBox.logicalLeft(style( )->writingMode()); }
249 virtual LayoutUnit marginLogicalRight() const { return m_marginBox.logicalRi ght(style()->writingMode()); } 249 LayoutUnit marginLogicalRight() const { return m_marginBox.logicalRight(styl e()->writingMode()); }
250 250
251 virtual LayoutUnit marginBefore(const RenderStyle* overrideStyle = 0) const OVERRIDE { return m_marginBox.before((overrideStyle ? overrideStyle : style())-> writingMode()); } 251 virtual LayoutUnit marginBefore(const RenderStyle* overrideStyle = 0) const OVERRIDE FINAL { return m_marginBox.before((overrideStyle ? overrideStyle : styl e())->writingMode()); }
252 virtual LayoutUnit marginAfter(const RenderStyle* overrideStyle = 0) const O VERRIDE { return m_marginBox.after((overrideStyle ? overrideStyle : style())->wr itingMode()); } 252 virtual LayoutUnit marginAfter(const RenderStyle* overrideStyle = 0) const O VERRIDE FINAL { return m_marginBox.after((overrideStyle ? overrideStyle : style( ))->writingMode()); }
253 virtual LayoutUnit marginStart(const RenderStyle* overrideStyle = 0) const O VERRIDE 253 virtual LayoutUnit marginStart(const RenderStyle* overrideStyle = 0) const O VERRIDE FINAL
254 { 254 {
255 const RenderStyle* styleToUse = overrideStyle ? overrideStyle : style(); 255 const RenderStyle* styleToUse = overrideStyle ? overrideStyle : style();
256 return m_marginBox.start(styleToUse->writingMode(), styleToUse->directio n()); 256 return m_marginBox.start(styleToUse->writingMode(), styleToUse->directio n());
257 } 257 }
258 virtual LayoutUnit marginEnd(const RenderStyle* overrideStyle = 0) const OVE RRIDE 258 virtual LayoutUnit marginEnd(const RenderStyle* overrideStyle = 0) const OVE RRIDE FINAL
259 { 259 {
260 const RenderStyle* styleToUse = overrideStyle ? overrideStyle : style(); 260 const RenderStyle* styleToUse = overrideStyle ? overrideStyle : style();
261 return m_marginBox.end(styleToUse->writingMode(), styleToUse->direction( )); 261 return m_marginBox.end(styleToUse->writingMode(), styleToUse->direction( ));
262 } 262 }
263 void setMarginBefore(LayoutUnit value, const RenderStyle* overrideStyle = 0) { m_marginBox.setBefore((overrideStyle ? overrideStyle : style())->writingMode( ), value); } 263 void setMarginBefore(LayoutUnit value, const RenderStyle* overrideStyle = 0) { m_marginBox.setBefore((overrideStyle ? overrideStyle : style())->writingMode( ), value); }
264 void setMarginAfter(LayoutUnit value, const RenderStyle* overrideStyle = 0) { m_marginBox.setAfter((overrideStyle ? overrideStyle : style())->writingMode(), value); } 264 void setMarginAfter(LayoutUnit value, const RenderStyle* overrideStyle = 0) { m_marginBox.setAfter((overrideStyle ? overrideStyle : style())->writingMode(), value); }
265 void setMarginStart(LayoutUnit value, const RenderStyle* overrideStyle = 0) 265 void setMarginStart(LayoutUnit value, const RenderStyle* overrideStyle = 0)
266 { 266 {
267 const RenderStyle* styleToUse = overrideStyle ? overrideStyle : style(); 267 const RenderStyle* styleToUse = overrideStyle ? overrideStyle : style();
268 m_marginBox.setStart(styleToUse->writingMode(), styleToUse->direction(), value); 268 m_marginBox.setStart(styleToUse->writingMode(), styleToUse->direction(), value);
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 537
538 virtual bool needsPreferredWidthsRecalculation() const; 538 virtual bool needsPreferredWidthsRecalculation() const;
539 virtual void computeIntrinsicRatioInformation(FloatSize& /* intrinsicSize */ , double& /* intrinsicRatio */, bool& /* isPercentageIntrinsicSize */) const { } 539 virtual void computeIntrinsicRatioInformation(FloatSize& /* intrinsicSize */ , double& /* intrinsicRatio */, bool& /* isPercentageIntrinsicSize */) const { }
540 540
541 IntSize scrolledContentOffset() const; 541 IntSize scrolledContentOffset() const;
542 LayoutSize cachedSizeForOverflowClip() const; 542 LayoutSize cachedSizeForOverflowClip() const;
543 void applyCachedClipAndScrollOffsetForRepaint(LayoutRect& paintRect) const; 543 void applyCachedClipAndScrollOffsetForRepaint(LayoutRect& paintRect) const;
544 544
545 virtual bool hasRelativeDimensions() const; 545 virtual bool hasRelativeDimensions() const;
546 virtual bool hasRelativeLogicalHeight() const; 546 virtual bool hasRelativeLogicalHeight() const;
547 virtual bool hasViewportPercentageLogicalHeight() const; 547 bool hasViewportPercentageLogicalHeight() const;
548 548
549 bool hasHorizontalLayoutOverflow() const 549 bool hasHorizontalLayoutOverflow() const
550 { 550 {
551 if (RenderOverflow* overflow = hasRenderOverflow()) { 551 if (RenderOverflow* overflow = hasRenderOverflow()) {
552 LayoutRect layoutOverflowRect = overflow->layoutOverflowRect(); 552 LayoutRect layoutOverflowRect = overflow->layoutOverflowRect();
553 flipForWritingMode(layoutOverflowRect); 553 flipForWritingMode(layoutOverflowRect);
554 return layoutOverflowRect.x() < x() || layoutOverflowRect.maxX() > x () + logicalWidth(); 554 return layoutOverflowRect.x() < x() || layoutOverflowRect.maxX() > x () + logicalWidth();
555 } 555 }
556 556
557 return false; 557 return false;
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 LayoutUnit fillAvailableMeasure(LayoutUnit availableLogicalWidth) const; 657 LayoutUnit fillAvailableMeasure(LayoutUnit availableLogicalWidth) const;
658 LayoutUnit fillAvailableMeasure(LayoutUnit availableLogicalWidth, LayoutUnit & marginStart, LayoutUnit& marginEnd) const; 658 LayoutUnit fillAvailableMeasure(LayoutUnit availableLogicalWidth, LayoutUnit & marginStart, LayoutUnit& marginEnd) const;
659 659
660 virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layo utUnit& maxLogicalWidth) const; 660 virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layo utUnit& maxLogicalWidth) const;
661 661
662 // This function calculates the minimum and maximum preferred widths for an object. 662 // This function calculates the minimum and maximum preferred widths for an object.
663 // These values are used in shrink-to-fit layout systems. 663 // These values are used in shrink-to-fit layout systems.
664 // These include tables, positioned objects, floats and flexible boxes. 664 // These include tables, positioned objects, floats and flexible boxes.
665 virtual void computePreferredLogicalWidths() { setPreferredLogicalWidthsDirt y(false); } 665 virtual void computePreferredLogicalWidths() { setPreferredLogicalWidthsDirt y(false); }
666 666
667 virtual LayoutRect frameRectForStickyPositioning() const OVERRIDE { return f rameRect(); } 667 virtual LayoutRect frameRectForStickyPositioning() const OVERRIDE FINAL { re turn frameRect(); }
668 668
669 private: 669 private:
670 // The width/height of the contents + borders + padding. The x/y location i s relative to our container (which is not always our parent). 670 // The width/height of the contents + borders + padding. The x/y location i s relative to our container (which is not always our parent).
671 LayoutRect m_frameRect; 671 LayoutRect m_frameRect;
672 672
673 protected: 673 protected:
674 LayoutBoxExtent m_marginBox; 674 LayoutBoxExtent m_marginBox;
675 675
676 // The preferred logical width of the element if it were to break its lines at every possible opportunity. 676 // The preferred logical width of the element if it were to break its lines at every possible opportunity.
677 LayoutUnit m_minPreferredLogicalWidth; 677 LayoutUnit m_minPreferredLogicalWidth;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 } 726 }
727 727
728 inline RenderBox* RenderBox::lastChildBox() const 728 inline RenderBox* RenderBox::lastChildBox() const
729 { 729 {
730 return toRenderBox(lastChild()); 730 return toRenderBox(lastChild());
731 } 731 }
732 732
733 } // namespace WebCore 733 } // namespace WebCore
734 734
735 #endif // RenderBox_h 735 #endif // RenderBox_h
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBlock.h ('k') | Source/core/rendering/RenderBoxModelObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698