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.
All rights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
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 1645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1656 if (isRenderFlowThread()) | 1656 if (isRenderFlowThread()) |
1657 toRenderFlowThread(this)->applyBreakAfterContent(clientLogicalBottom()); | 1657 toRenderFlowThread(this)->applyBreakAfterContent(clientLogicalBottom()); |
1658 | 1658 |
1659 // Lay out our positioned objects if our positioned child bit is set. | 1659 // Lay out our positioned objects if our positioned child bit is set. |
1660 // Also, if an absolute position element inside a relative positioned contai
ner moves, and the absolute element has a fixed position | 1660 // Also, if an absolute position element inside a relative positioned contai
ner moves, and the absolute element has a fixed position |
1661 // child, neither the fixed element nor its container learn of the movement
since posChildNeedsLayout() is only marked as far as the | 1661 // child, neither the fixed element nor its container learn of the movement
since posChildNeedsLayout() is only marked as far as the |
1662 // relative positioned container. So if we can have fixed pos objects in our
positioned objects list check if any of them | 1662 // relative positioned container. So if we can have fixed pos objects in our
positioned objects list check if any of them |
1663 // are statically positioned and thus need to move with their absolute ances
tors. | 1663 // are statically positioned and thus need to move with their absolute ances
tors. |
1664 bool canContainFixedPosObjects = canContainFixedPositionObjects(); | 1664 bool canContainFixedPosObjects = canContainFixedPositionObjects(); |
1665 if (posChildNeedsLayout() || canContainFixedPosObjects) | 1665 if (posChildNeedsLayout() || canContainFixedPosObjects) |
1666 layoutPositionedObjects(false, !posChildNeedsLayout() && canContainFixed
PosObjects); | 1666 layoutPositionedObjects(false, !posChildNeedsLayout() && canContainFixed
PosObjects ? LayoutPositionedOnlyFixed : LayoutPositionedDefault); |
1667 | 1667 |
1668 // Recompute our overflow information. | 1668 // Recompute our overflow information. |
1669 // FIXME: We could do better here by computing a temporary overflow object f
rom layoutPositionedObjects and only | 1669 // FIXME: We could do better here by computing a temporary overflow object f
rom layoutPositionedObjects and only |
1670 // updating our overflow if we either used to have overflow or if the new te
mporary object has overflow. | 1670 // updating our overflow if we either used to have overflow or if the new te
mporary object has overflow. |
1671 // For now just always recompute overflow. This is no worse performance-wis
e than the old code that called rightmostPosition and | 1671 // For now just always recompute overflow. This is no worse performance-wis
e than the old code that called rightmostPosition and |
1672 // lowestPosition on every relayout so it's not a regression. | 1672 // lowestPosition on every relayout so it's not a regression. |
1673 // computeOverflow expects the bottom edge before we clamp our height. Since
this information isn't available during | 1673 // computeOverflow expects the bottom edge before we clamp our height. Since
this information isn't available during |
1674 // simplifiedLayout, we cache the value in m_overflow. | 1674 // simplifiedLayout, we cache the value in m_overflow. |
1675 LayoutUnit oldClientAfterEdge = hasRenderOverflow() ? m_overflow->layoutClie
ntAfterEdge() : clientLogicalBottom(); | 1675 LayoutUnit oldClientAfterEdge = hasRenderOverflow() ? m_overflow->layoutClie
ntAfterEdge() : clientLogicalBottom(); |
1676 computeOverflow(oldClientAfterEdge, true); | 1676 computeOverflow(oldClientAfterEdge, true); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1724 Length marginLeft = child->style()->marginStartUsing(style()); | 1724 Length marginLeft = child->style()->marginStartUsing(style()); |
1725 Length marginRight = child->style()->marginEndUsing(style()); | 1725 Length marginRight = child->style()->marginEndUsing(style()); |
1726 LayoutUnit margin = 0; | 1726 LayoutUnit margin = 0; |
1727 if (marginLeft.isFixed()) | 1727 if (marginLeft.isFixed()) |
1728 margin += marginLeft.value(); | 1728 margin += marginLeft.value(); |
1729 if (marginRight.isFixed()) | 1729 if (marginRight.isFixed()) |
1730 margin += marginRight.value(); | 1730 margin += marginRight.value(); |
1731 return margin; | 1731 return margin; |
1732 } | 1732 } |
1733 | 1733 |
1734 void RenderBlock::layoutPositionedObjects(bool relayoutChildren, bool fixedPosit
ionObjectsOnly) | 1734 void RenderBlock::layoutPositionedObjects(bool relayoutChildren, LayoutPositione
dInfo info) |
1735 { | 1735 { |
1736 TrackedRendererListHashSet* positionedDescendants = positionedObjects(); | 1736 TrackedRendererListHashSet* positionedDescendants = positionedObjects(); |
1737 if (!positionedDescendants) | 1737 if (!positionedDescendants) |
1738 return; | 1738 return; |
1739 | 1739 |
1740 if (hasColumns()) | 1740 if (hasColumns()) |
1741 view()->layoutState()->clearPaginationInformation(); // Positioned objec
ts are not part of the column flow, so they don't paginate with the columns. | 1741 view()->layoutState()->clearPaginationInformation(); // Positioned objec
ts are not part of the column flow, so they don't paginate with the columns. |
1742 | 1742 |
1743 RenderBox* r; | 1743 RenderBox* r; |
1744 TrackedRendererListHashSet::iterator end = positionedDescendants->end(); | 1744 TrackedRendererListHashSet::iterator end = positionedDescendants->end(); |
1745 for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin(
); it != end; ++it) { | 1745 for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin(
); it != end; ++it) { |
1746 r = *it; | 1746 r = *it; |
1747 | 1747 |
1748 SubtreeLayoutScope layoutScope(r); | 1748 SubtreeLayoutScope layoutScope(r); |
1749 // A fixed position element with an absolute positioned ancestor has no
way of knowing if the latter has changed position. So | 1749 // A fixed position element with an absolute positioned ancestor has no
way of knowing if the latter has changed position. So |
1750 // if this is a fixed position element, mark it for layout if it has an
abspos ancestor and needs to move with that ancestor, i.e. | 1750 // if this is a fixed position element, mark it for layout if it has an
abspos ancestor and needs to move with that ancestor, i.e. |
1751 // it has static position. | 1751 // it has static position. |
1752 markFixedPositionObjectForLayoutIfNeeded(r, layoutScope); | 1752 markFixedPositionObjectForLayoutIfNeeded(r, layoutScope); |
1753 if (fixedPositionObjectsOnly) { | 1753 if (info == LayoutPositionedOnlyFixed) { |
1754 r->layoutIfNeeded(); | 1754 r->layoutIfNeeded(); |
1755 continue; | 1755 continue; |
1756 } | 1756 } |
1757 | 1757 |
1758 // When a non-positioned block element moves, it may have positioned chi
ldren that are implicitly positioned relative to the | 1758 // When a non-positioned block element moves, it may have positioned chi
ldren that are implicitly positioned relative to the |
1759 // non-positioned block. Rather than trying to detect all of these move
ment cases, we just always lay out positioned | 1759 // non-positioned block. Rather than trying to detect all of these move
ment cases, we just always lay out positioned |
1760 // objects that are positioned implicitly like this. Such objects are r
are, and so in typical DHTML menu usage (where everything is | 1760 // objects that are positioned implicitly like this. Such objects are r
are, and so in typical DHTML menu usage (where everything is |
1761 // positioned explicitly) this should not incur a performance penalty. | 1761 // positioned explicitly) this should not incur a performance penalty. |
1762 if (relayoutChildren || (r->style()->hasStaticBlockPosition(isHorizontal
WritingMode()) && r->parent() != this)) | 1762 if (relayoutChildren || (r->style()->hasStaticBlockPosition(isHorizontal
WritingMode()) && r->parent() != this)) |
1763 layoutScope.setChildNeedsLayout(r); | 1763 layoutScope.setChildNeedsLayout(r); |
(...skipping 15 matching lines...) Expand all Loading... |
1779 LayoutUnit oldLogicalTop = 0; | 1779 LayoutUnit oldLogicalTop = 0; |
1780 bool needsBlockDirectionLocationSetBeforeLayout = r->needsLayout() && vi
ew()->layoutState()->needsBlockDirectionLocationSetBeforeLayout(); | 1780 bool needsBlockDirectionLocationSetBeforeLayout = r->needsLayout() && vi
ew()->layoutState()->needsBlockDirectionLocationSetBeforeLayout(); |
1781 if (needsBlockDirectionLocationSetBeforeLayout) { | 1781 if (needsBlockDirectionLocationSetBeforeLayout) { |
1782 if (isHorizontalWritingMode() == r->isHorizontalWritingMode()) | 1782 if (isHorizontalWritingMode() == r->isHorizontalWritingMode()) |
1783 r->updateLogicalHeight(); | 1783 r->updateLogicalHeight(); |
1784 else | 1784 else |
1785 r->updateLogicalWidth(); | 1785 r->updateLogicalWidth(); |
1786 oldLogicalTop = logicalTopForChild(r); | 1786 oldLogicalTop = logicalTopForChild(r); |
1787 } | 1787 } |
1788 | 1788 |
| 1789 if (info == LayoutPositionedContainingBlockMoved) |
| 1790 r->setNeedsLayout(); |
| 1791 |
1789 r->layoutIfNeeded(); | 1792 r->layoutIfNeeded(); |
1790 | 1793 |
1791 // Lay out again if our estimate was wrong. | 1794 // Lay out again if our estimate was wrong. |
1792 if (needsBlockDirectionLocationSetBeforeLayout && logicalTopForChild(r)
!= oldLogicalTop) | 1795 if (needsBlockDirectionLocationSetBeforeLayout && logicalTopForChild(r)
!= oldLogicalTop) |
1793 r->forceChildLayout(); | 1796 r->forceChildLayout(); |
1794 } | 1797 } |
1795 | 1798 |
1796 if (hasColumns()) | 1799 if (hasColumns()) |
1797 view()->layoutState()->m_columnInfo = columnInfo(); // FIXME: Kind of gr
oss. We just put this back into the layout state so that pop() will work. | 1800 view()->layoutState()->m_columnInfo = columnInfo(); // FIXME: Kind of gr
oss. We just put this back into the layout state so that pop() will work. |
1798 } | 1801 } |
(...skipping 3219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5018 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const | 5021 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const |
5019 { | 5022 { |
5020 showRenderObject(); | 5023 showRenderObject(); |
5021 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 5024 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
5022 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 5025 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
5023 } | 5026 } |
5024 | 5027 |
5025 #endif | 5028 #endif |
5026 | 5029 |
5027 } // namespace WebCore | 5030 } // namespace WebCore |
OLD | NEW |