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

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: Updated to ToT 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 1617 matching lines...) Expand 10 before | Expand all | Expand 10 after
1628 box->layoutIfNeeded(); 1628 box->layoutIfNeeded();
1629 } 1629 }
1630 } 1630 }
1631 } 1631 }
1632 1632
1633 bool RenderBlock::simplifiedLayout() 1633 bool RenderBlock::simplifiedLayout()
1634 { 1634 {
1635 if ((!posChildNeedsLayout() && !needsSimplifiedNormalFlowLayout()) || normal ChildNeedsLayout() || selfNeedsLayout()) 1635 if ((!posChildNeedsLayout() && !needsSimplifiedNormalFlowLayout()) || normal ChildNeedsLayout() || selfNeedsLayout())
1636 return false; 1636 return false;
1637 1637
1638 LayoutStateMaintainer statePusher(*this, locationOffset());
1639 1638
1640 if (needsPositionedMovementLayout() && !tryLayoutDoingPositionedMovementOnly ()) 1639 {
1641 return false; 1640 // LayoutStateMaintainer needs this deliberate scope to pop before repai nt
1641 LayoutStateMaintainer statePusher(*this, locationOffset());
1642 1642
1643 FastTextAutosizer::LayoutScope fastTextAutosizerLayoutScope(this); 1643 if (needsPositionedMovementLayout() && !tryLayoutDoingPositionedMovement Only())
1644 return false;
1644 1645
1645 // Lay out positioned descendants or objects that just need to recompute ove rflow. 1646 FastTextAutosizer::LayoutScope fastTextAutosizerLayoutScope(this);
1646 if (needsSimplifiedNormalFlowLayout())
1647 simplifiedNormalFlowLayout();
1648 1647
1649 // Make sure a forced break is applied after the content if we are a flow th read in a simplified layout. 1648 // Lay out positioned descendants or objects that just need to recompute overflow.
1650 // This ensures the size information is correctly computed for the last auto -height region receiving content. 1649 if (needsSimplifiedNormalFlowLayout())
1651 if (isRenderFlowThread()) 1650 simplifiedNormalFlowLayout();
1652 toRenderFlowThread(this)->applyBreakAfterContent(clientLogicalBottom());
1653 1651
1654 // Lay out our positioned objects if our positioned child bit is set. 1652 // Make sure a forced break is applied after the content if we are a flo w thread in a simplified layout.
1655 // Also, if an absolute position element inside a relative positioned contai ner moves, and the absolute element has a fixed position 1653 // This ensures the size information is correctly computed for the last auto-height region receiving content.
1656 // child, neither the fixed element nor its container learn of the movement since posChildNeedsLayout() is only marked as far as the 1654 if (isRenderFlowThread())
1657 // relative positioned container. So if we can have fixed pos objects in our positioned objects list check if any of them 1655 toRenderFlowThread(this)->applyBreakAfterContent(clientLogicalBottom ());
1658 // are statically positioned and thus need to move with their absolute ances tors.
1659 bool canContainFixedPosObjects = canContainFixedPositionObjects();
1660 if (posChildNeedsLayout() || canContainFixedPosObjects)
1661 layoutPositionedObjects(false, !posChildNeedsLayout() && canContainFixed PosObjects ? LayoutOnlyFixedPositionedObjects : DefaultLayout);
1662 1656
1663 // Recompute our overflow information. 1657 // Lay out our positioned objects if our positioned child bit is set.
1664 // FIXME: We could do better here by computing a temporary overflow object f rom layoutPositionedObjects and only 1658 // Also, if an absolute position element inside a relative positioned co ntainer moves, and the absolute element has a fixed position
1665 // updating our overflow if we either used to have overflow or if the new te mporary object has overflow. 1659 // child, neither the fixed element nor its container learn of the movem ent since posChildNeedsLayout() is only marked as far as the
1666 // For now just always recompute overflow. This is no worse performance-wis e than the old code that called rightmostPosition and 1660 // relative positioned container. So if we can have fixed pos objects in our positioned objects list check if any of them
1667 // lowestPosition on every relayout so it's not a regression. 1661 // are statically positioned and thus need to move with their absolute a ncestors.
1668 // computeOverflow expects the bottom edge before we clamp our height. Since this information isn't available during 1662 bool canContainFixedPosObjects = canContainFixedPositionObjects();
1669 // simplifiedLayout, we cache the value in m_overflow. 1663 if (posChildNeedsLayout() || canContainFixedPosObjects)
1670 LayoutUnit oldClientAfterEdge = hasRenderOverflow() ? m_overflow->layoutClie ntAfterEdge() : clientLogicalBottom(); 1664 layoutPositionedObjects(false, !posChildNeedsLayout() && canContainF ixedPosObjects ? LayoutOnlyFixedPositionedObjects : DefaultLayout);
1671 computeOverflow(oldClientAfterEdge, true);
1672 1665
1673 statePusher.pop(); 1666 // Recompute our overflow information.
1667 // FIXME: We could do better here by computing a temporary overflow obje ct from layoutPositionedObjects and only
1668 // updating our overflow if we either used to have overflow or if the ne w temporary object has overflow.
1669 // For now just always recompute overflow. This is no worse performance- wise than the old code that called rightmostPosition and
1670 // lowestPosition on every relayout so it's not a regression.
1671 // computeOverflow expects the bottom edge before we clamp our height. S ince this information isn't available during
1672 // simplifiedLayout, we cache the value in m_overflow.
1673 LayoutUnit oldClientAfterEdge = hasRenderOverflow() ? m_overflow->layout ClientAfterEdge() : clientLogicalBottom();
1674 computeOverflow(oldClientAfterEdge, true);
1675 }
1674 1676
1675 updateLayerTransform(); 1677 updateLayerTransform();
1676 1678
1677 updateScrollInfoAfterLayout(); 1679 updateScrollInfoAfterLayout();
1678 1680
1679 clearNeedsLayout(); 1681 clearNeedsLayout();
1680 return true; 1682 return true;
1681 } 1683 }
1682 1684
1683 void RenderBlock::markFixedPositionObjectForLayoutIfNeeded(RenderObject* child, SubtreeLayoutScope& layoutScope) 1685 void RenderBlock::markFixedPositionObjectForLayoutIfNeeded(RenderObject* child, SubtreeLayoutScope& layoutScope)
(...skipping 3337 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