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 * (C) 2007 David Smith (catfish.man@gmail.com) | 4 * (C) 2007 David Smith (catfish.man@gmail.com) |
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. |
6 * All rights reserved. | 6 * All rights reserved. |
7 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 7 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 bool hasStaticBlockPosition = | 683 bool hasStaticBlockPosition = |
684 child->style()->hasStaticBlockPosition(isHorizontalWritingMode()); | 684 child->style()->hasStaticBlockPosition(isHorizontalWritingMode()); |
685 bool hasStaticInlinePosition = | 685 bool hasStaticInlinePosition = |
686 child->style()->hasStaticInlinePosition(isHorizontalWritingMode()); | 686 child->style()->hasStaticInlinePosition(isHorizontalWritingMode()); |
687 if (!hasStaticBlockPosition && !hasStaticInlinePosition) | 687 if (!hasStaticBlockPosition && !hasStaticInlinePosition) |
688 return; | 688 return; |
689 | 689 |
690 LayoutObject* o = child->parent(); | 690 LayoutObject* o = child->parent(); |
691 while (o && !o->isLayoutView() && o->style()->position() != AbsolutePosition) | 691 while (o && !o->isLayoutView() && o->style()->position() != AbsolutePosition) |
692 o = o->parent(); | 692 o = o->parent(); |
693 if (o->style()->position() != AbsolutePosition) | 693 // The LayoutView is absolute-positioned, but does not move. |
| 694 if (o->isLayoutView()) |
694 return; | 695 return; |
695 | 696 |
| 697 // We must compute child's width and height, but not update them now. |
| 698 // The child will update its width and height when it gets laid out, and needs |
| 699 // to see them change there. |
696 LayoutBox* box = toLayoutBox(child); | 700 LayoutBox* box = toLayoutBox(child); |
697 if (hasStaticInlinePosition) { | 701 if (hasStaticInlinePosition) { |
698 LogicalExtentComputedValues computedValues; | 702 LogicalExtentComputedValues computedValues; |
699 box->computeLogicalWidth(computedValues); | 703 box->computeLogicalWidth(computedValues); |
700 LayoutUnit newLeft = computedValues.m_position; | 704 LayoutUnit newLeft = computedValues.m_position; |
701 if (newLeft != box->logicalLeft()) | 705 if (newLeft != box->logicalLeft()) |
702 layoutScope.setChildNeedsLayout(child); | 706 layoutScope.setChildNeedsLayout(child); |
703 } else if (hasStaticBlockPosition) { | 707 } else if (hasStaticBlockPosition) { |
704 LayoutUnit oldTop = box->logicalTop(); | 708 LogicalExtentComputedValues computedValues; |
705 box->updateLogicalHeight(); | 709 box->computeLogicalHeight(computedValues); |
706 if (box->logicalTop() != oldTop) | 710 LayoutUnit newTop = computedValues.m_position; |
| 711 if (newTop != box->logicalTop()) |
707 layoutScope.setChildNeedsLayout(child); | 712 layoutScope.setChildNeedsLayout(child); |
708 } | 713 } |
709 } | 714 } |
710 | 715 |
711 LayoutUnit LayoutBlock::marginIntrinsicLogicalWidthForChild( | 716 LayoutUnit LayoutBlock::marginIntrinsicLogicalWidthForChild( |
712 const LayoutBox& child) const { | 717 const LayoutBox& child) const { |
713 // A margin has three types: fixed, percentage, and auto (variable). | 718 // A margin has three types: fixed, percentage, and auto (variable). |
714 // Auto and percentage margins become 0 when computing min/max width. | 719 // Auto and percentage margins become 0 when computing min/max width. |
715 // Fixed margins can be added in as is. | 720 // Fixed margins can be added in as is. |
716 Length marginLeft = child.style()->marginStartUsing(style()); | 721 Length marginLeft = child.style()->marginStartUsing(style()); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 TrackedLayoutBoxListHashSet* positionedDescendants = positionedObjects(); | 760 TrackedLayoutBoxListHashSet* positionedDescendants = positionedObjects(); |
756 if (!positionedDescendants) | 761 if (!positionedDescendants) |
757 return; | 762 return; |
758 | 763 |
759 bool isPaginated = view()->layoutState()->isPaginated(); | 764 bool isPaginated = view()->layoutState()->isPaginated(); |
760 | 765 |
761 for (auto* positionedObject : *positionedDescendants) { | 766 for (auto* positionedObject : *positionedDescendants) { |
762 positionedObject->setMayNeedPaintInvalidation(); | 767 positionedObject->setMayNeedPaintInvalidation(); |
763 | 768 |
764 SubtreeLayoutScope layoutScope(*positionedObject); | 769 SubtreeLayoutScope layoutScope(*positionedObject); |
765 // A fixed position element with an absolute positioned ancestor has no way | 770 // If positionedObject is fixed-positioned and moves with an absolute- |
766 // of knowing if the latter has changed position. So if this is a fixed | 771 // positioned ancestor (other than the LayoutView, which cannot move), |
767 // position element, mark it for layout if it has an abspos ancestor and | 772 // mark it for layout now. |
768 // needs to move with that ancestor, i.e. it has static position. | |
769 markFixedPositionObjectForLayoutIfNeeded(positionedObject, layoutScope); | 773 markFixedPositionObjectForLayoutIfNeeded(positionedObject, layoutScope); |
770 if (info == LayoutOnlyFixedPositionedObjects) { | 774 if (info == LayoutOnlyFixedPositionedObjects) { |
771 positionedObject->layoutIfNeeded(); | 775 positionedObject->layoutIfNeeded(); |
772 continue; | 776 continue; |
773 } | 777 } |
774 | 778 |
775 if (!positionedObject->normalChildNeedsLayout() && | 779 if (!positionedObject->normalChildNeedsLayout() && |
776 (relayoutChildren || m_heightAvailableToChildrenChanged || | 780 (relayoutChildren || m_heightAvailableToChildrenChanged || |
777 needsLayoutDueToStaticPosition(positionedObject))) | 781 needsLayoutDueToStaticPosition(positionedObject))) |
778 layoutScope.setChildNeedsLayout(positionedObject); | 782 layoutScope.setChildNeedsLayout(positionedObject); |
(...skipping 1429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2208 } | 2212 } |
2209 | 2213 |
2210 return availableHeight; | 2214 return availableHeight; |
2211 } | 2215 } |
2212 | 2216 |
2213 bool LayoutBlock::hasDefiniteLogicalHeight() const { | 2217 bool LayoutBlock::hasDefiniteLogicalHeight() const { |
2214 return availableLogicalHeightForPercentageComputation() != LayoutUnit(-1); | 2218 return availableLogicalHeightForPercentageComputation() != LayoutUnit(-1); |
2215 } | 2219 } |
2216 | 2220 |
2217 } // namespace blink | 2221 } // namespace blink |
OLD | NEW |