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(RenderBox* /*repaintContainer*/) con
st; | 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); |
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 |
158 IntRect reflectionBox() const; | 162 IntRect reflectionBox() const; |
159 int reflectionOffset() const; | 163 int reflectionOffset() const; |
160 // Given a rect in the object's coordinate space, returns the corresponding
rect in the reflection. | 164 // Given a rect in the object's coordinate space, returns the corresponding
rect in the reflection. |
161 IntRect reflectedRect(const IntRect&) const; | 165 IntRect reflectedRect(const IntRect&) const; |
162 | 166 |
163 virtual void layout(); | 167 virtual void layout(); |
164 virtual void paint(PaintInfo&, int tx, int ty); | 168 virtual void paint(PaintInfo&, int tx, int ty); |
165 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y
, int tx, int ty, HitTestAction); | 169 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y
, int tx, int ty, HitTestAction); |
166 | 170 |
167 virtual void destroy(); | 171 virtual void destroy(); |
168 | 172 |
169 virtual int minPrefWidth() const; | 173 virtual int minPrefWidth() const; |
170 virtual int maxPrefWidth() const; | 174 virtual int maxPrefWidth() const; |
171 | 175 |
172 virtual int overrideSize() const; | 176 virtual int overrideSize() const; |
173 virtual int overrideWidth() const; | 177 virtual int overrideWidth() const; |
174 virtual int overrideHeight() const; | 178 virtual int overrideHeight() const; |
175 virtual void setOverrideSize(int); | 179 virtual void setOverrideSize(int); |
176 | 180 |
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 | |
180 virtual IntSize offsetFromContainer(RenderObject*) const; | 181 virtual IntSize offsetFromContainer(RenderObject*) const; |
181 | 182 |
182 int calcBorderBoxWidth(int width) const; | 183 int calcBorderBoxWidth(int width) const; |
183 int calcBorderBoxHeight(int height) const; | 184 int calcBorderBoxHeight(int height) const; |
184 int calcContentBoxWidth(int width) const; | 185 int calcContentBoxWidth(int width) const; |
185 int calcContentBoxHeight(int height) const; | 186 int calcContentBoxHeight(int height) const; |
186 | 187 |
187 virtual void borderFitAdjust(int& /*x*/, int& /*w*/) const { } // Shrink the
box in which the border paints if border-fit is set. | 188 virtual void borderFitAdjust(int& /*x*/, int& /*w*/) const { } // Shrink the
box in which the border paints if border-fit is set. |
188 | 189 |
189 // This method is now public so that centered objects like tables that are | 190 // This method is now public so that centered objects like tables that are |
(...skipping 10 matching lines...) Expand all Loading... |
200 // the replaced RenderObject to quickly determine what line it is contained
on and to easily | 201 // the replaced RenderObject to quickly determine what line it is contained
on and to easily |
201 // iterate over structures on the line. | 202 // iterate over structures on the line. |
202 virtual InlineBox* inlineBoxWrapper() const { return m_inlineBoxWrapper; } | 203 virtual InlineBox* inlineBoxWrapper() const { return m_inlineBoxWrapper; } |
203 virtual void setInlineBoxWrapper(InlineBox* boxWrapper) { m_inlineBoxWrapper
= boxWrapper; } | 204 virtual void setInlineBoxWrapper(InlineBox* boxWrapper) { m_inlineBoxWrapper
= boxWrapper; } |
204 virtual void deleteLineBoxWrapper(); | 205 virtual void deleteLineBoxWrapper(); |
205 | 206 |
206 virtual int lowestPosition(bool includeOverflowInterior = true, bool include
Self = true) const; | 207 virtual int lowestPosition(bool includeOverflowInterior = true, bool include
Self = true) const; |
207 virtual int rightmostPosition(bool includeOverflowInterior = true, bool incl
udeSelf = true) const; | 208 virtual int rightmostPosition(bool includeOverflowInterior = true, bool incl
udeSelf = true) const; |
208 virtual int leftmostPosition(bool includeOverflowInterior = true, bool inclu
deSelf = true) const; | 209 virtual int leftmostPosition(bool includeOverflowInterior = true, bool inclu
deSelf = true) const; |
209 | 210 |
210 virtual IntRect clippedOverflowRectForRepaint(RenderBox* repaintContainer); | 211 virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintC
ontainer); |
211 virtual void computeRectForRepaint(RenderBox* repaintContainer, IntRect&, bo
ol fixed = false); | 212 virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, I
ntRect&, bool 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 | |
257 virtual int verticalScrollbarWidth() const; | 250 virtual int verticalScrollbarWidth() const; |
258 int horizontalScrollbarHeight() const; | 251 int horizontalScrollbarHeight() const; |
259 virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1
.0f); | 252 virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1
.0f); |
260 virtual bool canBeProgramaticallyScrolled(bool) const; | 253 virtual bool canBeProgramaticallyScrolled(bool) const; |
261 virtual void autoscroll(); | 254 virtual void autoscroll(); |
262 virtual void stopAutoscroll() { } | 255 virtual void stopAutoscroll() { } |
263 virtual void panScroll(const IntPoint&); | 256 virtual void panScroll(const IntPoint&); |
264 bool hasAutoVerticalScrollbar() const { return hasOverflowClip() && (style()
->overflowY() == OAUTO || style()->overflowY() == OOVERLAY); } | 257 bool hasAutoVerticalScrollbar() const { return hasOverflowClip() && (style()
->overflowY() == OAUTO || style()->overflowY() == OOVERLAY); } |
265 bool hasAutoHorizontalScrollbar() const { return hasOverflowClip() && (style
()->overflowX() == OAUTO || style()->overflowX() == OOVERLAY); } | 258 bool hasAutoHorizontalScrollbar() const { return hasOverflowClip() && (style
()->overflowX() == OAUTO || style()->overflowX() == OOVERLAY); } |
266 bool scrollsOverflow() const { return scrollsOverflowX() || scrollsOverflowY
(); } | 259 bool scrollsOverflow() const { return scrollsOverflowX() || scrollsOverflowY
(); } |
267 bool scrollsOverflowX() const { return hasOverflowClip() && (style()->overfl
owX() == OSCROLL || hasAutoHorizontalScrollbar()); } | 260 bool scrollsOverflowX() const { return hasOverflowClip() && (style()->overfl
owX() == OSCROLL || hasAutoHorizontalScrollbar()); } |
268 bool scrollsOverflowY() const { return hasOverflowClip() && (style()->overfl
owY() == OSCROLL || hasAutoVerticalScrollbar()); } | 261 bool scrollsOverflowY() const { return hasOverflowClip() && (style()->overfl
owY() == OSCROLL || hasAutoVerticalScrollbar()); } |
269 | 262 |
270 virtual IntRect localCaretRect(InlineBox*, int caretOffset, int* extraWidthT
oEndOfLine = 0); | 263 virtual IntRect localCaretRect(InlineBox*, int caretOffset, int* extraWidthT
oEndOfLine = 0); |
271 | 264 |
272 virtual void paintFillLayerExtended(const PaintInfo&, const Color&, const Fi
llLayer*, int clipY, int clipHeight, | 265 virtual void paintFillLayerExtended(const PaintInfo&, const Color&, const Fi
llLayer*, int clipY, int clipHeight, |
273 int tx, int ty, int width, int height, I
nlineFlowBox* = 0, CompositeOperator = CompositeSourceOver); | 266 int tx, int ty, int width, int height, I
nlineFlowBox* = 0, CompositeOperator = CompositeSourceOver); |
274 IntSize calculateBackgroundSize(const FillLayer*, int scaledWidth, int scale
dHeight) const; | 267 IntSize calculateBackgroundSize(const FillLayer*, int scaledWidth, int scale
dHeight) const; |
275 | 268 |
276 virtual int staticX() const; | |
277 virtual int staticY() const; | |
278 virtual void setStaticX(int staticX); | |
279 virtual void setStaticY(int staticY); | |
280 | |
281 virtual IntRect getOverflowClipRect(int tx, int ty); | 269 virtual IntRect getOverflowClipRect(int tx, int ty); |
282 virtual IntRect getClipRect(int tx, int ty); | 270 virtual IntRect getClipRect(int tx, int ty); |
283 | 271 |
284 virtual void paintBoxDecorations(PaintInfo&, int tx, int ty); | 272 virtual void paintBoxDecorations(PaintInfo&, int tx, int ty); |
285 virtual void paintMask(PaintInfo& paintInfo, int tx, int ty); | 273 virtual void paintMask(PaintInfo& paintInfo, int tx, int ty); |
286 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0); | 274 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0); |
287 | 275 |
288 // Called when a positioned object moves but doesn't change size. A simplif
ied layout is done | 276 // Called when a positioned object moves but doesn't change size. A simplif
ied layout is done |
289 // that just updates the object's position. | 277 // that just updates the object's position. |
290 virtual void tryLayoutDoingPositionedMovementOnly() | 278 virtual void tryLayoutDoingPositionedMovementOnly() |
(...skipping 15 matching lines...) Expand all Loading... |
306 | 294 |
307 void removeFloatingOrPositionedChildFromBlockLists(); | 295 void removeFloatingOrPositionedChildFromBlockLists(); |
308 | 296 |
309 #if ENABLE(SVG) | 297 #if ENABLE(SVG) |
310 virtual TransformationMatrix localTransform() const; | 298 virtual TransformationMatrix localTransform() const; |
311 #endif | 299 #endif |
312 | 300 |
313 protected: | 301 protected: |
314 virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle); | 302 virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle); |
315 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); | 303 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); |
| 304 virtual void updateBoxModelInfoFromStyle(); |
316 | 305 |
317 void paintFillLayer(const PaintInfo&, const Color&, const FillLayer*, int cl
ipY, int clipHeight, int tx, int ty, int width, int height, CompositeOperator =
CompositeSourceOver); | 306 void paintFillLayer(const PaintInfo&, const Color&, const FillLayer*, int cl
ipY, 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); | 307 void paintFillLayers(const PaintInfo&, const Color&, const FillLayer*, int c
lipY, int clipHeight, int tx, int ty, int width, int height, CompositeOperator =
CompositeSourceOver); |
319 | 308 |
320 void paintMaskImages(const PaintInfo&, int clipY, int clipHeight, int tx, in
t ty, int width, int height); | 309 void paintMaskImages(const PaintInfo&, int clipY, int clipHeight, int tx, in
t ty, int width, int height); |
321 | 310 |
322 #if PLATFORM(MAC) | 311 #if PLATFORM(MAC) |
323 void paintCustomHighlight(int tx, int ty, const AtomicString& type, bool beh
indText); | 312 void paintCustomHighlight(int tx, int ty, const AtomicString& type, bool beh
indText); |
324 #endif | 313 #endif |
325 | 314 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 int m_marginRight; | 359 int m_marginRight; |
371 int m_marginTop; | 360 int m_marginTop; |
372 int m_marginBottom; | 361 int m_marginBottom; |
373 | 362 |
374 // The preferred width of the element if it were to break its lines at every
possible opportunity. | 363 // The preferred width of the element if it were to break its lines at every
possible opportunity. |
375 int m_minPrefWidth; | 364 int m_minPrefWidth; |
376 | 365 |
377 // The preferred width of the element if it never breaks any lines at all. | 366 // The preferred width of the element if it never breaks any lines at all. |
378 int m_maxPrefWidth; | 367 int m_maxPrefWidth; |
379 | 368 |
380 // A pointer to our layer if we have one. | |
381 RenderLayer* m_layer; | |
382 | |
383 // For inline replaced elements, the inline box that owns us. | 369 // For inline replaced elements, the inline box that owns us. |
384 InlineBox* m_inlineBoxWrapper; | 370 InlineBox* m_inlineBoxWrapper; |
385 | 371 |
386 private: | 372 private: |
387 // Used to store state between styleWillChange and styleDidChange | 373 // Used to store state between styleWillChange and styleDidChange |
388 static bool s_wasFloating; | |
389 static bool s_hadOverflowClip; | 374 static bool s_hadOverflowClip; |
390 }; | 375 }; |
391 | 376 |
392 inline RenderBox* toRenderBox(RenderObject* o) | 377 inline RenderBox* toRenderBox(RenderObject* o) |
393 { | 378 { |
394 ASSERT(!o || o->isBox()); | 379 ASSERT(!o || o->isBox()); |
395 return static_cast<RenderBox*>(o); | 380 return static_cast<RenderBox*>(o); |
396 } | 381 } |
397 | 382 |
398 inline const RenderBox* toRenderBox(const RenderObject* o) | 383 inline const RenderBox* toRenderBox(const RenderObject* o) |
(...skipping 26 matching lines...) Expand all Loading... |
425 } | 410 } |
426 | 411 |
427 inline RenderBox* RenderBox::lastChildBox() const | 412 inline RenderBox* RenderBox::lastChildBox() const |
428 { | 413 { |
429 return toRenderBox(lastChild()); | 414 return toRenderBox(lastChild()); |
430 } | 415 } |
431 | 416 |
432 } // namespace WebCore | 417 } // namespace WebCore |
433 | 418 |
434 #endif // RenderBox_h | 419 #endif // RenderBox_h |
OLD | NEW |