OLD | NEW |
1 /* | 1 /* |
2 * This file is part of the render object implementation for KHTML. | 2 * This file is part of the render object implementation for KHTML. |
3 * | 3 * |
4 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 4 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
5 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 5 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
6 * Copyright (C) 2003 Apple Computer, Inc. | 6 * Copyright (C) 2003 Apple Computer, Inc. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 | 217 |
218 setHeight(0); | 218 setHeight(0); |
219 m_overflowHeight = 0; | 219 m_overflowHeight = 0; |
220 m_flexingChildren = m_stretchingChildren = false; | 220 m_flexingChildren = m_stretchingChildren = false; |
221 | 221 |
222 initMaxMarginValues(); | 222 initMaxMarginValues(); |
223 | 223 |
224 // For overflow:scroll blocks, ensure we have both scrollbars in place alway
s. | 224 // For overflow:scroll blocks, ensure we have both scrollbars in place alway
s. |
225 if (scrollsOverflow()) { | 225 if (scrollsOverflow()) { |
226 if (style()->overflowX() == OSCROLL) | 226 if (style()->overflowX() == OSCROLL) |
227 layer()->setHasHorizontalScrollbar(true); | 227 m_layer->setHasHorizontalScrollbar(true); |
228 if (style()->overflowY() == OSCROLL) | 228 if (style()->overflowY() == OSCROLL) |
229 layer()->setHasVerticalScrollbar(true); | 229 m_layer->setHasVerticalScrollbar(true); |
230 } | 230 } |
231 | 231 |
232 if (isHorizontal()) | 232 if (isHorizontal()) |
233 layoutHorizontalBox(relayoutChildren); | 233 layoutHorizontalBox(relayoutChildren); |
234 else | 234 else |
235 layoutVerticalBox(relayoutChildren); | 235 layoutVerticalBox(relayoutChildren); |
236 | 236 |
237 int oldHeight = height(); | 237 int oldHeight = height(); |
238 calcHeight(); | 238 calcHeight(); |
239 if (oldHeight != height()) { | 239 if (oldHeight != height()) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 m_overflowLeft = min(m_overflowLeft, reflection.x()); | 285 m_overflowLeft = min(m_overflowLeft, reflection.x()); |
286 m_overflowHeight = max(m_overflowWidth, reflection.right()); | 286 m_overflowHeight = max(m_overflowWidth, reflection.right()); |
287 } | 287 } |
288 } | 288 } |
289 | 289 |
290 statePusher.pop(); | 290 statePusher.pop(); |
291 | 291 |
292 // Update our scrollbars if we're overflow:auto/scroll/hidden now that we kn
ow if | 292 // Update our scrollbars if we're overflow:auto/scroll/hidden now that we kn
ow if |
293 // we overflow or not. | 293 // we overflow or not. |
294 if (hasOverflowClip()) | 294 if (hasOverflowClip()) |
295 layer()->updateScrollInfoAfterLayout(); | 295 m_layer->updateScrollInfoAfterLayout(); |
296 | 296 |
297 // Repaint with our new bounds if they are different from our old bounds. | 297 // Repaint with our new bounds if they are different from our old bounds. |
298 repainter.repaintAfterLayout(); | 298 repainter.repaintAfterLayout(); |
299 | 299 |
300 setNeedsLayout(false); | 300 setNeedsLayout(false); |
301 } | 301 } |
302 | 302 |
303 void RenderFlexibleBox::layoutHorizontalBox(bool relayoutChildren) | 303 void RenderFlexibleBox::layoutHorizontalBox(bool relayoutChildren) |
304 { | 304 { |
305 int toAdd = borderBottom() + paddingBottom() + horizontalScrollbarHeight(); | 305 int toAdd = borderBottom() + paddingBottom() + horizontalScrollbarHeight(); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 relayoutChildren = false; | 403 relayoutChildren = false; |
404 if (oldHeight != height()) | 404 if (oldHeight != height()) |
405 heightSpecified = true; | 405 heightSpecified = true; |
406 | 406 |
407 // Now that our height is actually known, we can place our boxes. | 407 // Now that our height is actually known, we can place our boxes. |
408 m_stretchingChildren = (style()->boxAlign() == BSTRETCH); | 408 m_stretchingChildren = (style()->boxAlign() == BSTRETCH); |
409 child = iterator.first(); | 409 child = iterator.first(); |
410 while (child) { | 410 while (child) { |
411 if (child->isPositioned()) { | 411 if (child->isPositioned()) { |
412 child->containingBlock()->insertPositionedObject(child); | 412 child->containingBlock()->insertPositionedObject(child); |
413 if (child->style()->hasStaticX()) { | 413 if (child->hasStaticX()) { |
414 if (style()->direction() == LTR) | 414 if (style()->direction() == LTR) |
415 child->layer()->setStaticX(xPos); | 415 child->setStaticX(xPos); |
416 else child->layer()->setStaticX(width() - xPos); | 416 else child->setStaticX(width() - xPos); |
417 } | 417 } |
418 if (child->style()->hasStaticY()) | 418 if (child->hasStaticY()) |
419 child->layer()->setStaticY(yPos); | 419 child->setStaticY(yPos); |
420 child = iterator.next(); | 420 child = iterator.next(); |
421 continue; | 421 continue; |
422 } | 422 } |
423 | 423 |
424 // We need to see if this child's height has changed, since we make
block elements | 424 // We need to see if this child's height has changed, since we make
block elements |
425 // fill the height of a containing box by default. | 425 // fill the height of a containing box by default. |
426 // Now do a layout. | 426 // Now do a layout. |
427 int oldChildHeight = child->height(); | 427 int oldChildHeight = child->height(); |
428 child->calcHeight(); | 428 child->calcHeight(); |
429 if (oldChildHeight != child->height()) | 429 if (oldChildHeight != child->height()) |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 | 794 |
795 child = iterator.first(); | 795 child = iterator.first(); |
796 while (child) { | 796 while (child) { |
797 // make sure we relayout children if we need it. | 797 // make sure we relayout children if we need it. |
798 if (!haveLineClamp && (relayoutChildren || (child->isReplaced() && (
child->style()->width().isPercent() || child->style()->height().isPercent())))) | 798 if (!haveLineClamp && (relayoutChildren || (child->isReplaced() && (
child->style()->width().isPercent() || child->style()->height().isPercent())))) |
799 child->setChildNeedsLayout(true, false); | 799 child->setChildNeedsLayout(true, false); |
800 | 800 |
801 if (child->isPositioned()) | 801 if (child->isPositioned()) |
802 { | 802 { |
803 child->containingBlock()->insertPositionedObject(child); | 803 child->containingBlock()->insertPositionedObject(child); |
804 if (child->style()->hasStaticX()) { | 804 if (child->hasStaticX()) { |
805 if (style()->direction() == LTR) | 805 if (style()->direction() == LTR) |
806 child->layer()->setStaticX(borderLeft()+paddingLeft()); | 806 child->setStaticX(borderLeft()+paddingLeft()); |
807 else | 807 else |
808 child->layer()->setStaticX(borderRight()+paddingRight())
; | 808 child->setStaticX(borderRight()+paddingRight()); |
809 } | 809 } |
810 if (child->style()->hasStaticY()) | 810 if (child->hasStaticY()) |
811 child->layer()->setStaticY(height()); | 811 child->setStaticY(height()); |
812 child = iterator.next(); | 812 child = iterator.next(); |
813 continue; | 813 continue; |
814 } | 814 } |
815 | 815 |
816 // Compute the child's vertical margins. | 816 // Compute the child's vertical margins. |
817 child->calcVerticalMargins(); | 817 child->calcVerticalMargins(); |
818 | 818 |
819 // Add in the child's marginTop to our height. | 819 // Add in the child's marginTop to our height. |
820 setHeight(height() + child->marginTop()); | 820 setHeight(height() + child->marginTop()); |
821 | 821 |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1129 return "RenderFlexibleBox (floating)"; | 1129 return "RenderFlexibleBox (floating)"; |
1130 if (isPositioned()) | 1130 if (isPositioned()) |
1131 return "RenderFlexibleBox (positioned)"; | 1131 return "RenderFlexibleBox (positioned)"; |
1132 if (isRelPositioned()) | 1132 if (isRelPositioned()) |
1133 return "RenderFlexibleBox (relative positioned)"; | 1133 return "RenderFlexibleBox (relative positioned)"; |
1134 return "RenderFlexibleBox"; | 1134 return "RenderFlexibleBox"; |
1135 } | 1135 } |
1136 | 1136 |
1137 } // namespace WebCore | 1137 } // namespace WebCore |
1138 | 1138 |
OLD | NEW |