OLD | NEW |
1 /* | 1 /* |
2 * This file is part of the layout object implementation for KHTML. | 2 * This file is part of the layout 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 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 SubtreeLayoutScope layoutScope(*child); | 445 SubtreeLayoutScope layoutScope(*child); |
446 // TODO(jchaffraix): It seems incorrect to check isAtomicInlineLevel
in this file. | 446 // TODO(jchaffraix): It seems incorrect to check isAtomicInlineLevel
in this file. |
447 // We probably want to check if the element is replaced. | 447 // We probably want to check if the element is replaced. |
448 if (relayoutChildren || (child->isAtomicInlineLevel() && (child->sty
le()->width().isPercentOrCalc() || child->style()->height().isPercentOrCalc()))) | 448 if (relayoutChildren || (child->isAtomicInlineLevel() && (child->sty
le()->width().isPercentOrCalc() || child->style()->height().isPercentOrCalc()))) |
449 layoutScope.setChildNeedsLayout(child); | 449 layoutScope.setChildNeedsLayout(child); |
450 | 450 |
451 // Compute the child's vertical margins. | 451 // Compute the child's vertical margins. |
452 child->computeAndSetBlockDirectionMargins(this); | 452 child->computeAndSetBlockDirectionMargins(this); |
453 | 453 |
454 if (!child->needsLayout()) | 454 if (!child->needsLayout()) |
455 child->markForPaginationRelayoutIfNeeded(layoutScope); | 455 markChildForPaginationRelayoutIfNeeded(*child, layoutScope); |
456 | 456 |
457 // Now do the layout. | 457 // Now do the layout. |
458 child->layoutIfNeeded(); | 458 child->layoutIfNeeded(); |
459 | 459 |
460 // Update our height and overflow height. | 460 // Update our height and overflow height. |
461 if (style()->boxAlign() == BBASELINE) { | 461 if (style()->boxAlign() == BBASELINE) { |
462 LayoutUnit ascent(child->firstLineBoxBaseline()); | 462 LayoutUnit ascent(child->firstLineBoxBaseline()); |
463 if (ascent == -1) | 463 if (ascent == -1) |
464 ascent = child->size().height() + child->marginBottom(); | 464 ascent = child->size().height() + child->marginBottom(); |
465 ascent += child->marginTop(); | 465 ascent += child->marginTop(); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 // here, though. Need to do that from within layout, or we won't be
able to detect the | 519 // here, though. Need to do that from within layout, or we won't be
able to detect the |
520 // change and duly notify any positioned descendants that are affect
ed by it. | 520 // change and duly notify any positioned descendants that are affect
ed by it. |
521 LayoutUnit oldChildHeight = child->logicalHeight(); | 521 LayoutUnit oldChildHeight = child->logicalHeight(); |
522 LogicalExtentComputedValues computedValues; | 522 LogicalExtentComputedValues computedValues; |
523 child->computeLogicalHeight(child->logicalHeight(), child->logicalTo
p(), computedValues); | 523 child->computeLogicalHeight(child->logicalHeight(), child->logicalTo
p(), computedValues); |
524 LayoutUnit newChildHeight = computedValues.m_extent; | 524 LayoutUnit newChildHeight = computedValues.m_extent; |
525 if (oldChildHeight != newChildHeight) | 525 if (oldChildHeight != newChildHeight) |
526 layoutScope.setChildNeedsLayout(child); | 526 layoutScope.setChildNeedsLayout(child); |
527 | 527 |
528 if (!child->needsLayout()) | 528 if (!child->needsLayout()) |
529 child->markForPaginationRelayoutIfNeeded(layoutScope); | 529 markChildForPaginationRelayoutIfNeeded(*child, layoutScope); |
530 | 530 |
531 child->layoutIfNeeded(); | 531 child->layoutIfNeeded(); |
532 | 532 |
533 // We can place the child now, using our value of box-align. | 533 // We can place the child now, using our value of box-align. |
534 xPos += child->marginLeft(); | 534 xPos += child->marginLeft(); |
535 LayoutUnit childY = yPos; | 535 LayoutUnit childY = yPos; |
536 switch (style()->boxAlign()) { | 536 switch (style()->boxAlign()) { |
537 case BCENTER: | 537 case BCENTER: |
538 childY += child->marginTop() + ((contentHeight() - (child->size(
).height() + child->marginHeight())) / 2).clampNegativeToZero(); | 538 childY += child->marginTop() + ((contentHeight() - (child->size(
).height() + child->marginHeight())) / 2).clampNegativeToZero(); |
539 break; | 539 break; |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 continue; | 755 continue; |
756 } | 756 } |
757 | 757 |
758 // Compute the child's vertical margins. | 758 // Compute the child's vertical margins. |
759 child->computeAndSetBlockDirectionMargins(this); | 759 child->computeAndSetBlockDirectionMargins(this); |
760 | 760 |
761 // Add in the child's marginTop to our height. | 761 // Add in the child's marginTop to our height. |
762 setHeight(size().height() + child->marginTop()); | 762 setHeight(size().height() + child->marginTop()); |
763 | 763 |
764 if (!child->needsLayout()) | 764 if (!child->needsLayout()) |
765 child->markForPaginationRelayoutIfNeeded(layoutScope); | 765 markChildForPaginationRelayoutIfNeeded(*child, layoutScope); |
766 | 766 |
767 // Now do a layout. | 767 // Now do a layout. |
768 child->layoutIfNeeded(); | 768 child->layoutIfNeeded(); |
769 | 769 |
770 // We can place the child now, using our value of box-align. | 770 // We can place the child now, using our value of box-align. |
771 LayoutUnit childX = borderLeft() + paddingLeft(); | 771 LayoutUnit childX = borderLeft() + paddingLeft(); |
772 switch (style()->boxAlign()) { | 772 switch (style()->boxAlign()) { |
773 case BCENTER: | 773 case BCENTER: |
774 case BBASELINE: // Baseline just maps to center for vertical boxes | 774 case BBASELINE: // Baseline just maps to center for vertical boxes |
775 childX += child->marginLeft() + ((contentWidth() - (child->size(
).width() + child->marginWidth())) / 2).clampNegativeToZero(); | 775 childX += child->marginLeft() + ((contentWidth() - (child->size(
).width() + child->marginWidth())) / 2).clampNegativeToZero(); |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1108 if (minHeight.isFixed() || minHeight.isAuto()) { | 1108 if (minHeight.isFixed() || minHeight.isAuto()) { |
1109 LayoutUnit minHeight(child->style()->minHeight().value()); | 1109 LayoutUnit minHeight(child->style()->minHeight().value()); |
1110 LayoutUnit height = contentHeightForChild(child); | 1110 LayoutUnit height = contentHeightForChild(child); |
1111 LayoutUnit allowedShrinkage = (minHeight - height).clampPositiveToZero()
; | 1111 LayoutUnit allowedShrinkage = (minHeight - height).clampPositiveToZero()
; |
1112 return allowedShrinkage; | 1112 return allowedShrinkage; |
1113 } | 1113 } |
1114 return LayoutUnit(); | 1114 return LayoutUnit(); |
1115 } | 1115 } |
1116 | 1116 |
1117 } // namespace blink | 1117 } // namespace blink |
OLD | NEW |