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

Side by Side Diff: third_party/WebKit/WebCore/rendering/RenderBox.h

Issue 21184: WebKit merge 40722:40785 (part 1) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 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 | Annotate | Revision Log
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 void setLocation(const IntPoint& location) { m_frameRect.setLocation(locatio n); } 55 void setLocation(const IntPoint& location) { m_frameRect.setLocation(locatio n); }
56 void setLocation(int x, int y) { setLocation(IntPoint(x, y)); } 56 void setLocation(int x, int y) { setLocation(IntPoint(x, y)); }
57 57
58 void setSize(const IntSize& size) { m_frameRect.setSize(size); } 58 void setSize(const IntSize& size) { m_frameRect.setSize(size); }
59 void move(int dx, int dy) { m_frameRect.move(dx, dy); } 59 void move(int dx, int dy) { m_frameRect.move(dx, dy); }
60 60
61 IntRect frameRect() const { ASSERT(!isRenderInline()); return m_frameRect; } 61 IntRect frameRect() const { ASSERT(!isRenderInline()); return m_frameRect; }
62 void setFrameRect(const IntRect& rect) { m_frameRect = rect; } 62 void setFrameRect(const IntRect& rect) { m_frameRect = rect; }
63 63
64 IntRect borderBoxRect() const { return IntRect(0, 0, width(), height()); } 64 IntRect borderBoxRect() const { return IntRect(0, 0, width(), height()); }
65 virtual IntRect borderBoundingBox() const { return borderBoxRect(); } // Thi s will work on inlines to return the bounding box of all of the lines' border bo xes. 65 virtual IntRect borderBoundingBox() const { return borderBoxRect(); }
66 66
67 // The content area of the box (excludes padding and border). 67 // The content area of the box (excludes padding and border).
68 IntRect contentBoxRect() const { return IntRect(borderLeft() + paddingLeft() , borderTop() + paddingTop(), contentWidth(), contentHeight()); } 68 IntRect contentBoxRect() const { return IntRect(borderLeft() + paddingLeft() , borderTop() + paddingTop(), contentWidth(), contentHeight()); }
69 // The content box in absolute coords. Ignores transforms. 69 // The content box in absolute coords. Ignores transforms.
70 IntRect absoluteContentBox() const; 70 IntRect absoluteContentBox() const;
71 // The content box converted to absolute coords (taking transforms into acco unt). 71 // The content box converted to absolute coords (taking transforms into acco unt).
72 FloatQuad absoluteContentQuad() const; 72 FloatQuad absoluteContentQuad() const;
73 73
74 // Bounds of the outline box in absolute coords. Respects transforms 74 // Bounds of the outline box in absolute coords. Respects transforms
75 virtual IntRect outlineBoundsForRepaint(RenderBoxModelObject* /*repaintConta iner*/) const; 75 virtual IntRect outlineBoundsForRepaint(RenderBoxModelObject* /*repaintConta iner*/) const;
76 virtual void addFocusRingRects(GraphicsContext*, int tx, int ty); 76 virtual void addFocusRingRects(GraphicsContext*, int tx, int ty);
(...skipping 14 matching lines...) Expand all
91 virtual int overflowTop(bool /*includeInterior*/ = true) const { return 0; } 91 virtual int overflowTop(bool /*includeInterior*/ = true) const { return 0; }
92 virtual IntRect overflowRect(bool /*includeInterior*/ = true) const { return borderBoxRect(); } 92 virtual IntRect overflowRect(bool /*includeInterior*/ = true) const { return borderBoxRect(); }
93 93
94 int contentWidth() const { return clientWidth() - paddingLeft() - paddingRig ht(); } 94 int contentWidth() const { return clientWidth() - paddingLeft() - paddingRig ht(); }
95 int contentHeight() const { return clientHeight() - paddingTop() - paddingBo ttom(); } 95 int contentHeight() const { return clientHeight() - paddingTop() - paddingBo ttom(); }
96 96
97 // IE extensions. Used to calculate offsetWidth/Height. Overridden by inlin es (RenderFlow) 97 // IE extensions. Used to calculate offsetWidth/Height. Overridden by inlin es (RenderFlow)
98 // to return the remaining width on a given line (and the height of a single line). 98 // to return the remaining width on a given line (and the height of a single line).
99 virtual int offsetWidth() const { return width(); } 99 virtual int offsetWidth() const { return width(); }
100 virtual int offsetHeight() const { return height(); } 100 virtual int offsetHeight() const { return height(); }
101 virtual int offsetLeft() const;
102 virtual int offsetTop() const;
103 virtual RenderBox* offsetParent() const;
104 101
105 // More IE extensions. clientWidth and clientHeight represent the interior of an object 102 // More IE extensions. clientWidth and clientHeight represent the interior of an object
106 // excluding border and scrollbar. clientLeft/Top are just the borderLeftWi dth and borderTopWidth. 103 // excluding border and scrollbar. clientLeft/Top are just the borderLeftWi dth and borderTopWidth.
107 int clientLeft() const { return borderLeft(); } 104 int clientLeft() const { return borderLeft(); }
108 int clientTop() const { return borderTop(); } 105 int clientTop() const { return borderTop(); }
109 int clientWidth() const; 106 int clientWidth() const;
110 int clientHeight() const; 107 int clientHeight() const;
111 108
112 // scrollWidth/scrollHeight will be the same as clientWidth/clientHeight unl ess the 109 // scrollWidth/scrollHeight will be the same as clientWidth/clientHeight unl ess the
113 // object has overflow:hidden/scroll/auto specified and also has overflow. 110 // object has overflow:hidden/scroll/auto specified and also has overflow.
114 // scrollLeft/Top return the current scroll position. These methods are vir tual so that objects like 111 // scrollLeft/Top return the current scroll position. These methods are vir tual so that objects like
115 // textareas can scroll shadow content (but pretend that they are the object s that are 112 // textareas can scroll shadow content (but pretend that they are the object s that are
116 // scrolling). 113 // scrolling).
117 virtual int scrollLeft() const; 114 virtual int scrollLeft() const;
118 virtual int scrollTop() const; 115 virtual int scrollTop() const;
119 virtual int scrollWidth() const; 116 virtual int scrollWidth() const;
120 virtual int scrollHeight() const; 117 virtual int scrollHeight() const;
121 virtual void setScrollLeft(int); 118 virtual void setScrollLeft(int);
122 virtual void setScrollTop(int); 119 virtual void setScrollTop(int);
123 120
124 bool hasHorizontalBordersPaddingOrMargin() const { return hasHorizontalBorde rsOrPadding() || marginLeft() != 0 || marginRight() != 0; } 121 virtual int marginTop() const { return m_marginTop; }
125 bool hasHorizontalBordersOrPadding() const { return borderLeft() != 0 || bor derRight() != 0 || paddingLeft() != 0 || paddingRight() != 0; } 122 virtual int marginBottom() const { return m_marginBottom; }
126 123 virtual int marginLeft() const { return m_marginLeft; }
127 int marginTop() const { return m_marginTop; } 124 virtual int marginRight() const { return m_marginRight; }
128 int marginBottom() const { return m_marginBottom; }
129 int marginLeft() const { return m_marginLeft; }
130 int marginRight() const { return m_marginRight; }
131
132 // Virtual since table cells override
133 virtual int paddingTop(bool includeIntrinsicPadding = true) const;
134 virtual int paddingBottom(bool includeIntrinsicPadding = true) const;
135 virtual int paddingLeft(bool includeIntrinsicPadding = true) const;
136 virtual int paddingRight(bool includeIntrinsicPadding = true) const;
137
138 virtual int borderTop() const { return style()->borderTopWidth(); }
139 virtual int borderBottom() const { return style()->borderBottomWidth(); }
140 virtual int borderLeft() const { return style()->borderLeftWidth(); }
141 virtual int borderRight() const { return style()->borderRightWidth(); }
142 125
143 // The following five functions are used to implement collapsing margins. 126 // The following five functions are used to implement collapsing margins.
144 // All objects know their maximal positive and negative margins. The 127 // All objects know their maximal positive and negative margins. The
145 // formula for computing a collapsed margin is |maxPosMargin| - |maxNegmargi n|. 128 // formula for computing a collapsed margin is |maxPosMargin| - |maxNegmargi n|.
146 // For a non-collapsing box, such as a leaf element, this formula will simpl y return 129 // For a non-collapsing box, such as a leaf element, this formula will simpl y return
147 // the margin of the element. Blocks override the maxTopMargin and maxBotto mMargin 130 // the margin of the element. Blocks override the maxTopMargin and maxBotto mMargin
148 // methods. 131 // methods.
149 virtual bool isSelfCollapsingBlock() const { return false; } 132 virtual bool isSelfCollapsingBlock() const { return false; }
150 int collapsedMarginTop() const { return maxTopMargin(true) - maxTopMargin(fa lse); } 133 int collapsedMarginTop() const { return maxTopMargin(true) - maxTopMargin(fa lse); }
151 int collapsedMarginBottom() const { return maxBottomMargin(true) - maxBottom Margin(false); } 134 int collapsedMarginBottom() const { return maxBottomMargin(true) - maxBottom Margin(false); }
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 virtual void stopAutoscroll() { } 238 virtual void stopAutoscroll() { }
256 virtual void panScroll(const IntPoint&); 239 virtual void panScroll(const IntPoint&);
257 bool hasAutoVerticalScrollbar() const { return hasOverflowClip() && (style() ->overflowY() == OAUTO || style()->overflowY() == OOVERLAY); } 240 bool hasAutoVerticalScrollbar() const { return hasOverflowClip() && (style() ->overflowY() == OAUTO || style()->overflowY() == OOVERLAY); }
258 bool hasAutoHorizontalScrollbar() const { return hasOverflowClip() && (style ()->overflowX() == OAUTO || style()->overflowX() == OOVERLAY); } 241 bool hasAutoHorizontalScrollbar() const { return hasOverflowClip() && (style ()->overflowX() == OAUTO || style()->overflowX() == OOVERLAY); }
259 bool scrollsOverflow() const { return scrollsOverflowX() || scrollsOverflowY (); } 242 bool scrollsOverflow() const { return scrollsOverflowX() || scrollsOverflowY (); }
260 bool scrollsOverflowX() const { return hasOverflowClip() && (style()->overfl owX() == OSCROLL || hasAutoHorizontalScrollbar()); } 243 bool scrollsOverflowX() const { return hasOverflowClip() && (style()->overfl owX() == OSCROLL || hasAutoHorizontalScrollbar()); }
261 bool scrollsOverflowY() const { return hasOverflowClip() && (style()->overfl owY() == OSCROLL || hasAutoVerticalScrollbar()); } 244 bool scrollsOverflowY() const { return hasOverflowClip() && (style()->overfl owY() == OSCROLL || hasAutoVerticalScrollbar()); }
262 245
263 virtual IntRect localCaretRect(InlineBox*, int caretOffset, int* extraWidthT oEndOfLine = 0); 246 virtual IntRect localCaretRect(InlineBox*, int caretOffset, int* extraWidthT oEndOfLine = 0);
264 247
265 virtual void paintFillLayerExtended(const PaintInfo&, const Color&, const Fi llLayer*, int clipY, int clipHeight,
266 int tx, int ty, int width, int height, I nlineFlowBox* = 0, CompositeOperator = CompositeSourceOver);
267 IntSize calculateBackgroundSize(const FillLayer*, int scaledWidth, int scale dHeight) const;
268
269 virtual IntRect getOverflowClipRect(int tx, int ty); 248 virtual IntRect getOverflowClipRect(int tx, int ty);
270 virtual IntRect getClipRect(int tx, int ty); 249 virtual IntRect getClipRect(int tx, int ty);
271 250
272 virtual void paintBoxDecorations(PaintInfo&, int tx, int ty); 251 virtual void paintBoxDecorations(PaintInfo&, int tx, int ty);
273 virtual void paintMask(PaintInfo& paintInfo, int tx, int ty); 252 virtual void paintMask(PaintInfo& paintInfo, int tx, int ty);
274 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0); 253 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0);
275 254
276 // Called when a positioned object moves but doesn't change size. A simplif ied layout is done 255 // Called when a positioned object moves but doesn't change size. A simplif ied layout is done
277 // that just updates the object's position. 256 // that just updates the object's position.
278 virtual void tryLayoutDoingPositionedMovementOnly() 257 virtual void tryLayoutDoingPositionedMovementOnly()
279 { 258 {
280 int oldWidth = width(); 259 int oldWidth = width();
281 calcWidth(); 260 calcWidth();
282 // If we shrink to fit our width may have changed, so we still need full layout. 261 // If we shrink to fit our width may have changed, so we still need full layout.
283 if (oldWidth != width()) 262 if (oldWidth != width())
284 return; 263 return;
285 calcHeight(); 264 calcHeight();
286 setNeedsLayout(false); 265 setNeedsLayout(false);
287 } 266 }
288 267
289 IntRect maskClipRect(); 268 IntRect maskClipRect();
290 269
291 virtual void childBecameNonInline(RenderObject* /*child*/) { }
292
293 virtual VisiblePosition positionForCoordinates(int x, int y); 270 virtual VisiblePosition positionForCoordinates(int x, int y);
294 271
295 void removeFloatingOrPositionedChildFromBlockLists(); 272 void removeFloatingOrPositionedChildFromBlockLists();
296 273
297 #if ENABLE(SVG) 274 #if ENABLE(SVG)
298 virtual TransformationMatrix localTransform() const; 275 virtual TransformationMatrix localTransform() const;
299 #endif 276 #endif
300 277
301 protected: 278 protected:
302 virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle); 279 virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle);
(...skipping 13 matching lines...) Expand all
316 293
317 virtual bool shouldCalculateSizeAsReplaced() const { return isReplaced() && !isInlineBlockOrInlineTable(); } 294 virtual bool shouldCalculateSizeAsReplaced() const { return isReplaced() && !isInlineBlockOrInlineTable(); }
318 295
319 private: 296 private:
320 bool includeVerticalScrollbarSize() const { return hasOverflowClip() && (sty le()->overflowY() == OSCROLL || style()->overflowY() == OAUTO); } 297 bool includeVerticalScrollbarSize() const { return hasOverflowClip() && (sty le()->overflowY() == OSCROLL || style()->overflowY() == OAUTO); }
321 bool includeHorizontalScrollbarSize() const { return hasOverflowClip() && (s tyle()->overflowX() == OSCROLL || style()->overflowX() == OAUTO); } 298 bool includeHorizontalScrollbarSize() const { return hasOverflowClip() && (s tyle()->overflowX() == OSCROLL || style()->overflowX() == OAUTO); }
322 299
323 void paintRootBoxDecorations(PaintInfo&, int tx, int ty); 300 void paintRootBoxDecorations(PaintInfo&, int tx, int ty);
324 // Returns true if we did a full repaint 301 // Returns true if we did a full repaint
325 bool repaintLayerRectsForImage(WrappedImagePtr image, const FillLayer* layer s, bool drawingBackground); 302 bool repaintLayerRectsForImage(WrappedImagePtr image, const FillLayer* layer s, bool drawingBackground);
326 303
327 void calculateBackgroundImageGeometry(const FillLayer*, int tx, int ty, int w, int h, IntRect& destRect, IntPoint& phase, IntSize& tileSize); 304 int containingBlockWidthForPositioned(const RenderBoxModelObject* containing Block) const;
328 305 int containingBlockHeightForPositioned(const RenderBoxModelObject* containin gBlock) const;
329 int containingBlockWidthForPositioned(const RenderObject* containingBlock) c onst;
330 int containingBlockHeightForPositioned(const RenderObject* containingBlock) const;
331 306
332 void calcAbsoluteVertical(); 307 void calcAbsoluteVertical();
333 void calcAbsoluteHorizontalValues(Length width, const RenderBox* cb, TextDir ection containerDirection, 308 void calcAbsoluteHorizontalValues(Length width, const RenderBoxModelObject* cb, TextDirection containerDirection,
334 int containerWidth, int bordersPlusPadding , 309 int containerWidth, int bordersPlusPadding ,
335 Length left, Length right, Length marginLe ft, Length marginRight, 310 Length left, Length right, Length marginLe ft, Length marginRight,
336 int& widthValue, int& marginLeftValue, int & marginRightValue, int& xPos); 311 int& widthValue, int& marginLeftValue, int & marginRightValue, int& xPos);
337 void calcAbsoluteVerticalValues(Length height, const RenderBox* cb, 312 void calcAbsoluteVerticalValues(Length height, const RenderBoxModelObject* c b,
338 int containerHeight, int bordersPlusPadding, 313 int containerHeight, int bordersPlusPadding,
339 Length top, Length bottom, Length marginTop, Length marginBottom, 314 Length top, Length bottom, Length marginTop, Length marginBottom,
340 int& heightValue, int& marginTopValue, int& marginBottomValue, int& yPos); 315 int& heightValue, int& marginTopValue, int& marginBottomValue, int& yPos);
341 316
342 void calcAbsoluteVerticalReplaced(); 317 void calcAbsoluteVerticalReplaced();
343 void calcAbsoluteHorizontalReplaced(); 318 void calcAbsoluteHorizontalReplaced();
344 319
345 // This function calculates the minimum and maximum preferred widths for an object. 320 // This function calculates the minimum and maximum preferred widths for an object.
346 // These values are used in shrink-to-fit layout systems. 321 // These values are used in shrink-to-fit layout systems.
347 // These include tables, positioned objects, floats and flexible boxes. 322 // These include tables, positioned objects, floats and flexible boxes.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 } 385 }
411 386
412 inline RenderBox* RenderBox::lastChildBox() const 387 inline RenderBox* RenderBox::lastChildBox() const
413 { 388 {
414 return toRenderBox(lastChild()); 389 return toRenderBox(lastChild());
415 } 390 }
416 391
417 } // namespace WebCore 392 } // namespace WebCore
418 393
419 #endif // RenderBox_h 394 #endif // RenderBox_h
OLDNEW
« no previous file with comments | « third_party/WebKit/WebCore/rendering/RenderBlock.cpp ('k') | third_party/WebKit/WebCore/rendering/RenderBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698