| 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 1473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1484 } else { | 1484 } else { |
| 1485 for (RenderBox* box = firstChildBox(); box; box = box->nextSiblingBox())
{ | 1485 for (RenderBox* box = firstChildBox(); box; box = box->nextSiblingBox())
{ |
| 1486 if (!box->isOutOfFlowPositioned()) | 1486 if (!box->isOutOfFlowPositioned()) |
| 1487 box->layoutIfNeeded(); | 1487 box->layoutIfNeeded(); |
| 1488 } | 1488 } |
| 1489 } | 1489 } |
| 1490 } | 1490 } |
| 1491 | 1491 |
| 1492 bool RenderBlock::simplifiedLayout() | 1492 bool RenderBlock::simplifiedLayout() |
| 1493 { | 1493 { |
| 1494 if ((!posChildNeedsLayout() && !needsSimplifiedNormalFlowLayout()) || normal
ChildNeedsLayout() || selfNeedsLayout()) | 1494 // Check if we need to do a full layout. |
| 1495 if (normalChildNeedsLayout() || selfNeedsLayout()) |
| 1496 return false; |
| 1497 |
| 1498 // Check that we actually need to do a simplified layout. |
| 1499 if (!posChildNeedsLayout() && !(needsSimplifiedNormalFlowLayout() || needsPo
sitionedMovementLayout())) |
| 1495 return false; | 1500 return false; |
| 1496 | 1501 |
| 1497 | 1502 |
| 1498 { | 1503 { |
| 1499 // LayoutStateMaintainer needs this deliberate scope to pop before repai
nt | 1504 // LayoutStateMaintainer needs this deliberate scope to pop before repai
nt |
| 1500 LayoutStateMaintainer statePusher(*this, locationOffset()); | 1505 LayoutStateMaintainer statePusher(*this, locationOffset()); |
| 1501 | 1506 |
| 1502 if (needsPositionedMovementLayout() && !tryLayoutDoingPositionedMovement
Only()) | 1507 if (needsPositionedMovementLayout() && !tryLayoutDoingPositionedMovement
Only()) |
| 1503 return false; | 1508 return false; |
| 1504 | 1509 |
| 1505 FastTextAutosizer::LayoutScope fastTextAutosizerLayoutScope(this); | 1510 FastTextAutosizer::LayoutScope fastTextAutosizerLayoutScope(this); |
| 1506 | 1511 |
| 1507 // Lay out positioned descendants or objects that just need to recompute
overflow. | 1512 // Lay out positioned descendants or objects that just need to recompute
overflow. |
| 1508 if (needsSimplifiedNormalFlowLayout()) | 1513 if (needsSimplifiedNormalFlowLayout()) |
| 1509 simplifiedNormalFlowLayout(); | 1514 simplifiedNormalFlowLayout(); |
| 1510 | 1515 |
| 1511 // Make sure a forced break is applied after the content if we are a flo
w thread in a simplified layout. | 1516 // Make sure a forced break is applied after the content if we are a flo
w thread in a simplified layout. |
| 1512 // This ensures the size information is correctly computed for the last
auto-height region receiving content. | 1517 // This ensures the size information is correctly computed for the last
auto-height region receiving content. |
| 1513 if (isRenderFlowThread()) | 1518 if (isRenderFlowThread()) |
| 1514 toRenderFlowThread(this)->applyBreakAfterContent(clientLogicalBottom
()); | 1519 toRenderFlowThread(this)->applyBreakAfterContent(clientLogicalBottom
()); |
| 1515 | 1520 |
| 1516 // Lay out our positioned objects if our positioned child bit is set. | 1521 // Lay out our positioned objects if our positioned child bit is set. |
| 1517 // Also, if an absolute position element inside a relative positioned co
ntainer moves, and the absolute element has a fixed position | 1522 // Also, if an absolute position element inside a relative positioned co
ntainer moves, and the absolute element has a fixed position |
| 1518 // child, neither the fixed element nor its container learn of the movem
ent since posChildNeedsLayout() is only marked as far as the | 1523 // child, neither the fixed element nor its container learn of the movem
ent since posChildNeedsLayout() is only marked as far as the |
| 1519 // relative positioned container. So if we can have fixed pos objects in
our positioned objects list check if any of them | 1524 // relative positioned container. So if we can have fixed pos objects in
our positioned objects list check if any of them |
| 1520 // are statically positioned and thus need to move with their absolute a
ncestors. | 1525 // are statically positioned and thus need to move with their absolute a
ncestors. |
| 1521 bool canContainFixedPosObjects = canContainFixedPositionObjects(); | 1526 bool canContainFixedPosObjects = canContainFixedPositionObjects(); |
| 1522 if (posChildNeedsLayout() || canContainFixedPosObjects) | 1527 if (posChildNeedsLayout() || needsPositionedMovementLayout() || canConta
inFixedPosObjects) |
| 1523 layoutPositionedObjects(false, !posChildNeedsLayout() && canContainF
ixedPosObjects ? LayoutOnlyFixedPositionedObjects : DefaultLayout); | 1528 layoutPositionedObjects(false, needsPositionedMovementLayout() ? For
cedLayoutAfterContainingBlockMoved : (!posChildNeedsLayout() && canContainFixedP
osObjects ? LayoutOnlyFixedPositionedObjects : DefaultLayout)); |
| 1524 | 1529 |
| 1525 // Recompute our overflow information. | 1530 // Recompute our overflow information. |
| 1526 // FIXME: We could do better here by computing a temporary overflow obje
ct from layoutPositionedObjects and only | 1531 // FIXME: We could do better here by computing a temporary overflow obje
ct from layoutPositionedObjects and only |
| 1527 // updating our overflow if we either used to have overflow or if the ne
w temporary object has overflow. | 1532 // updating our overflow if we either used to have overflow or if the ne
w temporary object has overflow. |
| 1528 // For now just always recompute overflow. This is no worse performance-
wise than the old code that called rightmostPosition and | 1533 // For now just always recompute overflow. This is no worse performance-
wise than the old code that called rightmostPosition and |
| 1529 // lowestPosition on every relayout so it's not a regression. | 1534 // lowestPosition on every relayout so it's not a regression. |
| 1530 // computeOverflow expects the bottom edge before we clamp our height. S
ince this information isn't available during | 1535 // computeOverflow expects the bottom edge before we clamp our height. S
ince this information isn't available during |
| 1531 // simplifiedLayout, we cache the value in m_overflow. | 1536 // simplifiedLayout, we cache the value in m_overflow. |
| 1532 LayoutUnit oldClientAfterEdge = hasRenderOverflow() ? m_overflow->layout
ClientAfterEdge() : clientLogicalBottom(); | 1537 LayoutUnit oldClientAfterEdge = hasRenderOverflow() ? m_overflow->layout
ClientAfterEdge() : clientLogicalBottom(); |
| 1533 computeOverflow(oldClientAfterEdge, true); | 1538 computeOverflow(oldClientAfterEdge, true); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1621 if (relayoutChildren || (r->style()->hasStaticBlockPosition(isHorizontal
WritingMode()) && r->parent() != this)) | 1626 if (relayoutChildren || (r->style()->hasStaticBlockPosition(isHorizontal
WritingMode()) && r->parent() != this)) |
| 1622 layoutScope.setChildNeedsLayout(r); | 1627 layoutScope.setChildNeedsLayout(r); |
| 1623 | 1628 |
| 1624 // If relayoutChildren is set and the child has percentage padding or an
embedded content box, we also need to invalidate the childs pref widths. | 1629 // If relayoutChildren is set and the child has percentage padding or an
embedded content box, we also need to invalidate the childs pref widths. |
| 1625 if (relayoutChildren && r->needsPreferredWidthsRecalculation()) | 1630 if (relayoutChildren && r->needsPreferredWidthsRecalculation()) |
| 1626 r->setPreferredLogicalWidthsDirty(MarkOnlyThis); | 1631 r->setPreferredLogicalWidthsDirty(MarkOnlyThis); |
| 1627 | 1632 |
| 1628 if (!r->needsLayout()) | 1633 if (!r->needsLayout()) |
| 1629 r->markForPaginationRelayoutIfNeeded(layoutScope); | 1634 r->markForPaginationRelayoutIfNeeded(layoutScope); |
| 1630 | 1635 |
| 1631 // We don't have to do a full layout. We just have to update our positi
on. Try that first. If we have shrink-to-fit width | |
| 1632 // and we hit the available width constraint, the layoutIfNeeded() will
catch it and do a full layout. | |
| 1633 if (r->needsPositionedMovementLayoutOnly() && r->tryLayoutDoingPositione
dMovementOnly()) | |
| 1634 r->clearNeedsLayout(); | |
| 1635 | |
| 1636 // If we are paginated or in a line grid, go ahead and compute a vertica
l position for our object now. | 1636 // If we are paginated or in a line grid, go ahead and compute a vertica
l position for our object now. |
| 1637 // If it's wrong we'll lay out again. | 1637 // If it's wrong we'll lay out again. |
| 1638 LayoutUnit oldLogicalTop = 0; | 1638 LayoutUnit oldLogicalTop = 0; |
| 1639 bool needsBlockDirectionLocationSetBeforeLayout = r->needsLayout() && vi
ew()->layoutState()->needsBlockDirectionLocationSetBeforeLayout(); | 1639 bool needsBlockDirectionLocationSetBeforeLayout = r->needsLayout() && vi
ew()->layoutState()->needsBlockDirectionLocationSetBeforeLayout(); |
| 1640 if (needsBlockDirectionLocationSetBeforeLayout) { | 1640 if (needsBlockDirectionLocationSetBeforeLayout) { |
| 1641 if (isHorizontalWritingMode() == r->isHorizontalWritingMode()) | 1641 if (isHorizontalWritingMode() == r->isHorizontalWritingMode()) |
| 1642 r->updateLogicalHeight(); | 1642 r->updateLogicalHeight(); |
| 1643 else | 1643 else |
| 1644 r->updateLogicalWidth(); | 1644 r->updateLogicalWidth(); |
| 1645 oldLogicalTop = logicalTopForChild(r); | 1645 oldLogicalTop = logicalTopForChild(r); |
| (...skipping 3308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4954 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const | 4954 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const |
| 4955 { | 4955 { |
| 4956 showRenderObject(); | 4956 showRenderObject(); |
| 4957 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 4957 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
| 4958 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 4958 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
| 4959 } | 4959 } |
| 4960 | 4960 |
| 4961 #endif | 4961 #endif |
| 4962 | 4962 |
| 4963 } // namespace WebCore | 4963 } // namespace WebCore |
| OLD | NEW |