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

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

Powered by Google App Engine
This is Rietveld 408576698