Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(308)

Side by Side Diff: Source/core/rendering/RenderBlock.cpp

Issue 196533012: Make LayoutState always be RAII (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: It's the ToT as you can see Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1622 matching lines...) Expand 10 before | Expand all | Expand 10 after
1633 box->layoutIfNeeded(); 1633 box->layoutIfNeeded();
1634 } 1634 }
1635 } 1635 }
1636 } 1636 }
1637 1637
1638 bool RenderBlock::simplifiedLayout() 1638 bool RenderBlock::simplifiedLayout()
1639 { 1639 {
1640 if ((!posChildNeedsLayout() && !needsSimplifiedNormalFlowLayout()) || normal ChildNeedsLayout() || selfNeedsLayout()) 1640 if ((!posChildNeedsLayout() && !needsSimplifiedNormalFlowLayout()) || normal ChildNeedsLayout() || selfNeedsLayout())
1641 return false; 1641 return false;
1642 1642
1643 LayoutStateMaintainer statePusher(*this, locationOffset());
1644 1643
1645 if (needsPositionedMovementLayout() && !tryLayoutDoingPositionedMovementOnly ()) 1644 {
1646 return false; 1645 // LayoutStateMaintainer needs this deliberate scope to pop before repai nt
1646 LayoutStateMaintainer statePusher(*this, locationOffset());
1647 1647
1648 FastTextAutosizer::LayoutScope fastTextAutosizerLayoutScope(this); 1648 if (needsPositionedMovementLayout() && !tryLayoutDoingPositionedMovement Only())
1649 return false;
1649 1650
1650 // Lay out positioned descendants or objects that just need to recompute ove rflow. 1651 FastTextAutosizer::LayoutScope fastTextAutosizerLayoutScope(this);
1651 if (needsSimplifiedNormalFlowLayout())
1652 simplifiedNormalFlowLayout();
1653 1652
1654 // Make sure a forced break is applied after the content if we are a flow th read in a simplified layout. 1653 // Lay out positioned descendants or objects that just need to recompute overflow.
1655 // This ensures the size information is correctly computed for the last auto -height region receiving content. 1654 if (needsSimplifiedNormalFlowLayout())
1656 if (isRenderFlowThread()) 1655 simplifiedNormalFlowLayout();
1657 toRenderFlowThread(this)->applyBreakAfterContent(clientLogicalBottom());
1658 1656
1659 // Lay out our positioned objects if our positioned child bit is set. 1657 // Make sure a forced break is applied after the content if we are a flo w thread in a simplified layout.
1660 // Also, if an absolute position element inside a relative positioned contai ner moves, and the absolute element has a fixed position 1658 // This ensures the size information is correctly computed for the last auto-height region receiving content.
1661 // child, neither the fixed element nor its container learn of the movement since posChildNeedsLayout() is only marked as far as the 1659 if (isRenderFlowThread())
1662 // relative positioned container. So if we can have fixed pos objects in our positioned objects list check if any of them 1660 toRenderFlowThread(this)->applyBreakAfterContent(clientLogicalBottom ());
1663 // are statically positioned and thus need to move with their absolute ances tors.
1664 bool canContainFixedPosObjects = canContainFixedPositionObjects();
1665 if (posChildNeedsLayout() || canContainFixedPosObjects)
1666 layoutPositionedObjects(false, !posChildNeedsLayout() && canContainFixed PosObjects ? LayoutOnlyFixedPositionedObjects : DefaultLayout);
1667 1661
1668 // Recompute our overflow information. 1662 // Lay out our positioned objects if our positioned child bit is set.
1669 // FIXME: We could do better here by computing a temporary overflow object f rom layoutPositionedObjects and only 1663 // Also, if an absolute position element inside a relative positioned co ntainer moves, and the absolute element has a fixed position
1670 // updating our overflow if we either used to have overflow or if the new te mporary object has overflow. 1664 // child, neither the fixed element nor its container learn of the movem ent since posChildNeedsLayout() is only marked as far as the
1671 // For now just always recompute overflow. This is no worse performance-wis e than the old code that called rightmostPosition and 1665 // relative positioned container. So if we can have fixed pos objects in our positioned objects list check if any of them
1672 // lowestPosition on every relayout so it's not a regression. 1666 // are statically positioned and thus need to move with their absolute a ncestors.
1673 // computeOverflow expects the bottom edge before we clamp our height. Since this information isn't available during 1667 bool canContainFixedPosObjects = canContainFixedPositionObjects();
1674 // simplifiedLayout, we cache the value in m_overflow. 1668 if (posChildNeedsLayout() || canContainFixedPosObjects)
1675 LayoutUnit oldClientAfterEdge = hasRenderOverflow() ? m_overflow->layoutClie ntAfterEdge() : clientLogicalBottom(); 1669 layoutPositionedObjects(false, !posChildNeedsLayout() && canContainF ixedPosObjects ? LayoutOnlyFixedPositionedObjects : DefaultLayout);
1676 computeOverflow(oldClientAfterEdge, true);
1677 1670
1678 statePusher.pop(); 1671 // Recompute our overflow information.
1672 // FIXME: We could do better here by computing a temporary overflow obje ct from layoutPositionedObjects and only
1673 // updating our overflow if we either used to have overflow or if the ne w temporary object has overflow.
1674 // For now just always recompute overflow. This is no worse performance- wise than the old code that called rightmostPosition and
1675 // lowestPosition on every relayout so it's not a regression.
1676 // computeOverflow expects the bottom edge before we clamp our height. S ince this information isn't available during
1677 // simplifiedLayout, we cache the value in m_overflow.
1678 LayoutUnit oldClientAfterEdge = hasRenderOverflow() ? m_overflow->layout ClientAfterEdge() : clientLogicalBottom();
1679 computeOverflow(oldClientAfterEdge, true);
1680 }
1679 1681
1680 updateLayerTransform(); 1682 updateLayerTransform();
1681 1683
1682 updateScrollInfoAfterLayout(); 1684 updateScrollInfoAfterLayout();
1683 1685
1684 clearNeedsLayout(); 1686 clearNeedsLayout();
1685 return true; 1687 return true;
1686 } 1688 }
1687 1689
1688 void RenderBlock::markFixedPositionObjectForLayoutIfNeeded(RenderObject* child, SubtreeLayoutScope& layoutScope) 1690 void RenderBlock::markFixedPositionObjectForLayoutIfNeeded(RenderObject* child, SubtreeLayoutScope& layoutScope)
(...skipping 3335 matching lines...) Expand 10 before | Expand all | Expand 10 after
5024 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const 5026 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const
5025 { 5027 {
5026 showRenderObject(); 5028 showRenderObject();
5027 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 5029 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
5028 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 5030 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
5029 } 5031 }
5030 5032
5031 #endif 5033 #endif
5032 5034
5033 } // namespace WebCore 5035 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/rendering/RenderBlockFlow.cpp » ('j') | Source/core/rendering/RenderDeprecatedFlexibleBox.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698