OLD | NEW |
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(); } // Thi
s will work on inlines to return the bounding box of all of the lines' border bo
xes. |
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(RenderBox* /*repaintContainer*/) con
st; |
76 virtual void addFocusRingRects(GraphicsContext*, int tx, int ty); | 76 virtual void addFocusRingRects(GraphicsContext*, int tx, int ty); |
77 | 77 |
78 // Use this with caution! No type checking is done! | 78 // Use this with caution! No type checking is done! |
79 RenderBox* previousSiblingBox() const; | 79 RenderBox* previousSiblingBox() const; |
80 RenderBox* nextSiblingBox() const; | 80 RenderBox* nextSiblingBox() const; |
81 RenderBox* parentBox() const; | 81 RenderBox* parentBox() const; |
82 | 82 |
83 // The height of a block when you include normal flow overflow spillage out
of the bottom | 83 // The height of a block when you include normal flow overflow spillage out
of the bottom |
84 // of the block (e.g., a <div style="height:25px"> that has a 100px tall ima
ge inside | 84 // of the block (e.g., a <div style="height:25px"> that has a 100px tall ima
ge inside |
85 // it would have an overflow height of borderTop() + paddingTop() + 100px. | 85 // it would have an overflow height of borderTop() + paddingTop() + 100px. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 // methods. | 148 // methods. |
149 virtual bool isSelfCollapsingBlock() const { return false; } | 149 virtual bool isSelfCollapsingBlock() const { return false; } |
150 int collapsedMarginTop() const { return maxTopMargin(true) - maxTopMargin(fa
lse); } | 150 int collapsedMarginTop() const { return maxTopMargin(true) - maxTopMargin(fa
lse); } |
151 int collapsedMarginBottom() const { return maxBottomMargin(true) - maxBottom
Margin(false); } | 151 int collapsedMarginBottom() const { return maxBottomMargin(true) - maxBottom
Margin(false); } |
152 virtual int maxTopMargin(bool positive) const { return positive ? std::max(0
, marginTop()) : -std::min(0, marginTop()); } | 152 virtual int maxTopMargin(bool positive) const { return positive ? std::max(0
, marginTop()) : -std::min(0, marginTop()); } |
153 virtual int maxBottomMargin(bool positive) const { return positive ? std::ma
x(0, marginBottom()) : -std::min(0, marginBottom()); } | 153 virtual int maxBottomMargin(bool positive) const { return positive ? std::ma
x(0, marginBottom()) : -std::min(0, marginBottom()); } |
154 | 154 |
155 virtual void absoluteRects(Vector<IntRect>&, int tx, int ty, bool topLevel =
true); | 155 virtual void absoluteRects(Vector<IntRect>&, int tx, int ty, bool topLevel =
true); |
156 virtual void absoluteQuads(Vector<FloatQuad>&, bool topLevel = true); | 156 virtual void absoluteQuads(Vector<FloatQuad>&, bool topLevel = true); |
157 | 157 |
158 virtual FloatPoint localToAbsolute(FloatPoint localPoint = FloatPoint(), boo
l fixed = false, bool useTransforms = false) const; | |
159 virtual FloatPoint absoluteToLocal(FloatPoint containerPoint, bool fixed = f
alse, bool useTransforms = false) const; | |
160 virtual FloatQuad localToContainerQuad(const FloatQuad&, RenderBoxModelObjec
t* repaintContainer, bool fixed = false) const; | |
161 | |
162 IntRect reflectionBox() const; | 158 IntRect reflectionBox() const; |
163 int reflectionOffset() const; | 159 int reflectionOffset() const; |
164 // Given a rect in the object's coordinate space, returns the corresponding
rect in the reflection. | 160 // Given a rect in the object's coordinate space, returns the corresponding
rect in the reflection. |
165 IntRect reflectedRect(const IntRect&) const; | 161 IntRect reflectedRect(const IntRect&) const; |
166 | 162 |
167 virtual void layout(); | 163 virtual void layout(); |
168 virtual void paint(PaintInfo&, int tx, int ty); | 164 virtual void paint(PaintInfo&, int tx, int ty); |
169 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y
, int tx, int ty, HitTestAction); | 165 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y
, int tx, int ty, HitTestAction); |
170 | 166 |
171 virtual void destroy(); | 167 virtual void destroy(); |
172 | 168 |
173 virtual int minPrefWidth() const; | 169 virtual int minPrefWidth() const; |
174 virtual int maxPrefWidth() const; | 170 virtual int maxPrefWidth() const; |
175 | 171 |
176 virtual int overrideSize() const; | 172 virtual int overrideSize() const; |
177 virtual int overrideWidth() const; | 173 virtual int overrideWidth() const; |
178 virtual int overrideHeight() const; | 174 virtual int overrideHeight() const; |
179 virtual void setOverrideSize(int); | 175 virtual void setOverrideSize(int); |
180 | 176 |
| 177 virtual FloatPoint localToAbsolute(FloatPoint localPoint = FloatPoint(), boo
l fixed = false, bool useTransforms = false) const; |
| 178 virtual FloatPoint absoluteToLocal(FloatPoint containerPoint, bool fixed = f
alse, bool useTransforms = false) const; |
| 179 |
181 virtual IntSize offsetFromContainer(RenderObject*) const; | 180 virtual IntSize offsetFromContainer(RenderObject*) const; |
182 | 181 |
183 int calcBorderBoxWidth(int width) const; | 182 int calcBorderBoxWidth(int width) const; |
184 int calcBorderBoxHeight(int height) const; | 183 int calcBorderBoxHeight(int height) const; |
185 int calcContentBoxWidth(int width) const; | 184 int calcContentBoxWidth(int width) const; |
186 int calcContentBoxHeight(int height) const; | 185 int calcContentBoxHeight(int height) const; |
187 | 186 |
188 virtual void borderFitAdjust(int& /*x*/, int& /*w*/) const { } // Shrink the
box in which the border paints if border-fit is set. | 187 virtual void borderFitAdjust(int& /*x*/, int& /*w*/) const { } // Shrink the
box in which the border paints if border-fit is set. |
189 | 188 |
190 // This method is now public so that centered objects like tables that are | 189 // This method is now public so that centered objects like tables that are |
(...skipping 10 matching lines...) Expand all Loading... |
201 // the replaced RenderObject to quickly determine what line it is contained
on and to easily | 200 // the replaced RenderObject to quickly determine what line it is contained
on and to easily |
202 // iterate over structures on the line. | 201 // iterate over structures on the line. |
203 virtual InlineBox* inlineBoxWrapper() const { return m_inlineBoxWrapper; } | 202 virtual InlineBox* inlineBoxWrapper() const { return m_inlineBoxWrapper; } |
204 virtual void setInlineBoxWrapper(InlineBox* boxWrapper) { m_inlineBoxWrapper
= boxWrapper; } | 203 virtual void setInlineBoxWrapper(InlineBox* boxWrapper) { m_inlineBoxWrapper
= boxWrapper; } |
205 virtual void deleteLineBoxWrapper(); | 204 virtual void deleteLineBoxWrapper(); |
206 | 205 |
207 virtual int lowestPosition(bool includeOverflowInterior = true, bool include
Self = true) const; | 206 virtual int lowestPosition(bool includeOverflowInterior = true, bool include
Self = true) const; |
208 virtual int rightmostPosition(bool includeOverflowInterior = true, bool incl
udeSelf = true) const; | 207 virtual int rightmostPosition(bool includeOverflowInterior = true, bool incl
udeSelf = true) const; |
209 virtual int leftmostPosition(bool includeOverflowInterior = true, bool inclu
deSelf = true) const; | 208 virtual int leftmostPosition(bool includeOverflowInterior = true, bool inclu
deSelf = true) const; |
210 | 209 |
211 virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintC
ontainer); | 210 virtual IntRect clippedOverflowRectForRepaint(RenderBox* repaintContainer); |
212 virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, I
ntRect&, bool fixed = false); | 211 virtual void computeRectForRepaint(RenderBox* repaintContainer, IntRect&, bo
ol fixed = false); |
| 212 virtual FloatQuad localToContainerQuad(const FloatQuad&, RenderBox* repaintC
ontainer, bool fixed = false) const; |
213 | 213 |
214 virtual void repaintDuringLayoutIfMoved(const IntRect&); | 214 virtual void repaintDuringLayoutIfMoved(const IntRect&); |
215 | 215 |
216 virtual int containingBlockWidth() const; | 216 virtual int containingBlockWidth() const; |
217 | 217 |
218 virtual void calcWidth(); | 218 virtual void calcWidth(); |
219 virtual void calcHeight(); | 219 virtual void calcHeight(); |
220 | 220 |
221 bool stretchesToViewHeight() const | 221 bool stretchesToViewHeight() const |
222 { | 222 { |
(...skipping 17 matching lines...) Expand all Loading... |
240 | 240 |
241 int calcPercentageHeight(const Length& height); | 241 int calcPercentageHeight(const Length& height); |
242 | 242 |
243 // Block flows subclass availableWidth to handle multi column layout (shrink
ing the width available to children when laying out.) | 243 // Block flows subclass availableWidth to handle multi column layout (shrink
ing the width available to children when laying out.) |
244 virtual int availableWidth() const { return contentWidth(); } | 244 virtual int availableWidth() const { return contentWidth(); } |
245 virtual int availableHeight() const; | 245 virtual int availableHeight() const; |
246 int availableHeightUsing(const Length&) const; | 246 int availableHeightUsing(const Length&) const; |
247 | 247 |
248 void calcVerticalMargins(); | 248 void calcVerticalMargins(); |
249 | 249 |
| 250 int relativePositionOffsetX() const; |
| 251 int relativePositionOffsetY() const; |
| 252 IntSize relativePositionOffset() const { return IntSize(relativePositionOffs
etX(), relativePositionOffsetY()); } |
| 253 |
| 254 RenderLayer* layer() const { return m_layer; } |
| 255 virtual bool requiresLayer() const { return isRoot() || isPositioned() || is
RelPositioned() || isTransparent() || hasOverflowClip() || hasTransform() || has
Mask() || hasReflection(); } |
| 256 |
250 virtual int verticalScrollbarWidth() const; | 257 virtual int verticalScrollbarWidth() const; |
251 int horizontalScrollbarHeight() const; | 258 int horizontalScrollbarHeight() const; |
252 virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1
.0f); | 259 virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1
.0f); |
253 virtual bool canBeProgramaticallyScrolled(bool) const; | 260 virtual bool canBeProgramaticallyScrolled(bool) const; |
254 virtual void autoscroll(); | 261 virtual void autoscroll(); |
255 virtual void stopAutoscroll() { } | 262 virtual void stopAutoscroll() { } |
256 virtual void panScroll(const IntPoint&); | 263 virtual void panScroll(const IntPoint&); |
257 bool hasAutoVerticalScrollbar() const { return hasOverflowClip() && (style()
->overflowY() == OAUTO || style()->overflowY() == OOVERLAY); } | 264 bool hasAutoVerticalScrollbar() const { return hasOverflowClip() && (style()
->overflowY() == OAUTO || style()->overflowY() == OOVERLAY); } |
258 bool hasAutoHorizontalScrollbar() const { return hasOverflowClip() && (style
()->overflowX() == OAUTO || style()->overflowX() == OOVERLAY); } | 265 bool hasAutoHorizontalScrollbar() const { return hasOverflowClip() && (style
()->overflowX() == OAUTO || style()->overflowX() == OOVERLAY); } |
259 bool scrollsOverflow() const { return scrollsOverflowX() || scrollsOverflowY
(); } | 266 bool scrollsOverflow() const { return scrollsOverflowX() || scrollsOverflowY
(); } |
260 bool scrollsOverflowX() const { return hasOverflowClip() && (style()->overfl
owX() == OSCROLL || hasAutoHorizontalScrollbar()); } | 267 bool scrollsOverflowX() const { return hasOverflowClip() && (style()->overfl
owX() == OSCROLL || hasAutoHorizontalScrollbar()); } |
261 bool scrollsOverflowY() const { return hasOverflowClip() && (style()->overfl
owY() == OSCROLL || hasAutoVerticalScrollbar()); } | 268 bool scrollsOverflowY() const { return hasOverflowClip() && (style()->overfl
owY() == OSCROLL || hasAutoVerticalScrollbar()); } |
262 | 269 |
263 virtual IntRect localCaretRect(InlineBox*, int caretOffset, int* extraWidthT
oEndOfLine = 0); | 270 virtual IntRect localCaretRect(InlineBox*, int caretOffset, int* extraWidthT
oEndOfLine = 0); |
264 | 271 |
265 virtual void paintFillLayerExtended(const PaintInfo&, const Color&, const Fi
llLayer*, int clipY, int clipHeight, | 272 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); | 273 int tx, int ty, int width, int height, I
nlineFlowBox* = 0, CompositeOperator = CompositeSourceOver); |
267 IntSize calculateBackgroundSize(const FillLayer*, int scaledWidth, int scale
dHeight) const; | 274 IntSize calculateBackgroundSize(const FillLayer*, int scaledWidth, int scale
dHeight) const; |
268 | 275 |
| 276 virtual int staticX() const; |
| 277 virtual int staticY() const; |
| 278 virtual void setStaticX(int staticX); |
| 279 virtual void setStaticY(int staticY); |
| 280 |
269 virtual IntRect getOverflowClipRect(int tx, int ty); | 281 virtual IntRect getOverflowClipRect(int tx, int ty); |
270 virtual IntRect getClipRect(int tx, int ty); | 282 virtual IntRect getClipRect(int tx, int ty); |
271 | 283 |
272 virtual void paintBoxDecorations(PaintInfo&, int tx, int ty); | 284 virtual void paintBoxDecorations(PaintInfo&, int tx, int ty); |
273 virtual void paintMask(PaintInfo& paintInfo, int tx, int ty); | 285 virtual void paintMask(PaintInfo& paintInfo, int tx, int ty); |
274 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0); | 286 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0); |
275 | 287 |
276 // Called when a positioned object moves but doesn't change size. A simplif
ied layout is done | 288 // 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. | 289 // that just updates the object's position. |
278 virtual void tryLayoutDoingPositionedMovementOnly() | 290 virtual void tryLayoutDoingPositionedMovementOnly() |
(...skipping 15 matching lines...) Expand all Loading... |
294 | 306 |
295 void removeFloatingOrPositionedChildFromBlockLists(); | 307 void removeFloatingOrPositionedChildFromBlockLists(); |
296 | 308 |
297 #if ENABLE(SVG) | 309 #if ENABLE(SVG) |
298 virtual TransformationMatrix localTransform() const; | 310 virtual TransformationMatrix localTransform() const; |
299 #endif | 311 #endif |
300 | 312 |
301 protected: | 313 protected: |
302 virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle); | 314 virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle); |
303 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); | 315 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); |
304 virtual void updateBoxModelInfoFromStyle(); | |
305 | 316 |
306 void paintFillLayer(const PaintInfo&, const Color&, const FillLayer*, int cl
ipY, int clipHeight, int tx, int ty, int width, int height, CompositeOperator =
CompositeSourceOver); | 317 void paintFillLayer(const PaintInfo&, const Color&, const FillLayer*, int cl
ipY, int clipHeight, int tx, int ty, int width, int height, CompositeOperator =
CompositeSourceOver); |
307 void paintFillLayers(const PaintInfo&, const Color&, const FillLayer*, int c
lipY, int clipHeight, int tx, int ty, int width, int height, CompositeOperator =
CompositeSourceOver); | 318 void paintFillLayers(const PaintInfo&, const Color&, const FillLayer*, int c
lipY, int clipHeight, int tx, int ty, int width, int height, CompositeOperator =
CompositeSourceOver); |
308 | 319 |
309 void paintMaskImages(const PaintInfo&, int clipY, int clipHeight, int tx, in
t ty, int width, int height); | 320 void paintMaskImages(const PaintInfo&, int clipY, int clipHeight, int tx, in
t ty, int width, int height); |
310 | 321 |
311 #if PLATFORM(MAC) | 322 #if PLATFORM(MAC) |
312 void paintCustomHighlight(int tx, int ty, const AtomicString& type, bool beh
indText); | 323 void paintCustomHighlight(int tx, int ty, const AtomicString& type, bool beh
indText); |
313 #endif | 324 #endif |
314 | 325 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 int m_marginRight; | 370 int m_marginRight; |
360 int m_marginTop; | 371 int m_marginTop; |
361 int m_marginBottom; | 372 int m_marginBottom; |
362 | 373 |
363 // The preferred width of the element if it were to break its lines at every
possible opportunity. | 374 // The preferred width of the element if it were to break its lines at every
possible opportunity. |
364 int m_minPrefWidth; | 375 int m_minPrefWidth; |
365 | 376 |
366 // The preferred width of the element if it never breaks any lines at all. | 377 // The preferred width of the element if it never breaks any lines at all. |
367 int m_maxPrefWidth; | 378 int m_maxPrefWidth; |
368 | 379 |
| 380 // A pointer to our layer if we have one. |
| 381 RenderLayer* m_layer; |
| 382 |
369 // For inline replaced elements, the inline box that owns us. | 383 // For inline replaced elements, the inline box that owns us. |
370 InlineBox* m_inlineBoxWrapper; | 384 InlineBox* m_inlineBoxWrapper; |
371 | 385 |
372 private: | 386 private: |
373 // Used to store state between styleWillChange and styleDidChange | 387 // Used to store state between styleWillChange and styleDidChange |
| 388 static bool s_wasFloating; |
374 static bool s_hadOverflowClip; | 389 static bool s_hadOverflowClip; |
375 }; | 390 }; |
376 | 391 |
377 inline RenderBox* toRenderBox(RenderObject* o) | 392 inline RenderBox* toRenderBox(RenderObject* o) |
378 { | 393 { |
379 ASSERT(!o || o->isBox()); | 394 ASSERT(!o || o->isBox()); |
380 return static_cast<RenderBox*>(o); | 395 return static_cast<RenderBox*>(o); |
381 } | 396 } |
382 | 397 |
383 inline const RenderBox* toRenderBox(const RenderObject* o) | 398 inline const RenderBox* toRenderBox(const RenderObject* o) |
(...skipping 26 matching lines...) Expand all Loading... |
410 } | 425 } |
411 | 426 |
412 inline RenderBox* RenderBox::lastChildBox() const | 427 inline RenderBox* RenderBox::lastChildBox() const |
413 { | 428 { |
414 return toRenderBox(lastChild()); | 429 return toRenderBox(lastChild()); |
415 } | 430 } |
416 | 431 |
417 } // namespace WebCore | 432 } // namespace WebCore |
418 | 433 |
419 #endif // RenderBox_h | 434 #endif // RenderBox_h |
OLD | NEW |