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

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

Issue 241113004: Incorrect invalidation on Google Forum (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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 1505 matching lines...) Expand 10 before | Expand all | Expand 10 after
1516 } else { 1516 } else {
1517 for (RenderBox* box = firstChildBox(); box; box = box->nextSiblingBox()) { 1517 for (RenderBox* box = firstChildBox(); box; box = box->nextSiblingBox()) {
1518 if (!box->isOutOfFlowPositioned()) 1518 if (!box->isOutOfFlowPositioned())
1519 box->layoutIfNeeded(); 1519 box->layoutIfNeeded();
1520 } 1520 }
1521 } 1521 }
1522 } 1522 }
1523 1523
1524 bool RenderBlock::simplifiedLayout() 1524 bool RenderBlock::simplifiedLayout()
1525 { 1525 {
1526 if ((!posChildNeedsLayout() && !needsSimplifiedNormalFlowLayout()) || normal ChildNeedsLayout() || selfNeedsLayout()) 1526 if ((!posChildNeedsLayout() && !(needsSimplifiedNormalFlowLayout() || needsP ositionedMovementLayout())) || normalChildNeedsLayout() || selfNeedsLayout())
leviw_travelin_and_unemployed 2014/04/17 20:35:55 This conditional is really hard to work out. Could
Julien - ping for review 2014/04/18 18:20:31 Split the logic and added some comment to make mor
1527 return false; 1527 return false;
1528 1528
1529 1529
1530 { 1530 {
1531 // LayoutStateMaintainer needs this deliberate scope to pop before repai nt 1531 // LayoutStateMaintainer needs this deliberate scope to pop before repai nt
1532 LayoutStateMaintainer statePusher(*this, locationOffset()); 1532 LayoutStateMaintainer statePusher(*this, locationOffset());
1533 1533
1534 if (needsPositionedMovementLayout() && !tryLayoutDoingPositionedMovement Only()) 1534 if (needsPositionedMovementLayout() && !tryLayoutDoingPositionedMovement Only())
1535 return false; 1535 return false;
1536 1536
1537 FastTextAutosizer::LayoutScope fastTextAutosizerLayoutScope(this); 1537 FastTextAutosizer::LayoutScope fastTextAutosizerLayoutScope(this);
1538 1538
1539 // Lay out positioned descendants or objects that just need to recompute overflow. 1539 // Lay out positioned descendants or objects that just need to recompute overflow.
1540 if (needsSimplifiedNormalFlowLayout()) 1540 if (needsSimplifiedNormalFlowLayout())
1541 simplifiedNormalFlowLayout(); 1541 simplifiedNormalFlowLayout();
1542 1542
1543 // Make sure a forced break is applied after the content if we are a flo w thread in a simplified layout. 1543 // Make sure a forced break is applied after the content if we are a flo w thread in a simplified layout.
1544 // This ensures the size information is correctly computed for the last auto-height region receiving content. 1544 // This ensures the size information is correctly computed for the last auto-height region receiving content.
1545 if (isRenderFlowThread()) 1545 if (isRenderFlowThread())
1546 toRenderFlowThread(this)->applyBreakAfterContent(clientLogicalBottom ()); 1546 toRenderFlowThread(this)->applyBreakAfterContent(clientLogicalBottom ());
1547 1547
1548 // Lay out our positioned objects if our positioned child bit is set. 1548 // Lay out our positioned objects if our positioned child bit is set.
1549 // Also, if an absolute position element inside a relative positioned co ntainer moves, and the absolute element has a fixed position 1549 // Also, if an absolute position element inside a relative positioned co ntainer moves, and the absolute element has a fixed position
1550 // child, neither the fixed element nor its container learn of the movem ent since posChildNeedsLayout() is only marked as far as the 1550 // child, neither the fixed element nor its container learn of the movem ent since posChildNeedsLayout() is only marked as far as the
1551 // relative positioned container. So if we can have fixed pos objects in our positioned objects list check if any of them 1551 // relative positioned container. So if we can have fixed pos objects in our positioned objects list check if any of them
1552 // are statically positioned and thus need to move with their absolute a ncestors. 1552 // are statically positioned and thus need to move with their absolute a ncestors.
1553 bool canContainFixedPosObjects = canContainFixedPositionObjects(); 1553 bool canContainFixedPosObjects = canContainFixedPositionObjects();
1554 if (posChildNeedsLayout() || canContainFixedPosObjects) 1554 if (posChildNeedsLayout() || needsPositionedMovementLayout() || canConta inFixedPosObjects)
1555 layoutPositionedObjects(false, !posChildNeedsLayout() && canContainF ixedPosObjects ? LayoutOnlyFixedPositionedObjects : DefaultLayout); 1555 layoutPositionedObjects(false, needsPositionedMovementLayout() ? For cedLayoutAfterContainingBlockMoved : (!posChildNeedsLayout() && canContainFixedP osObjects ? LayoutOnlyFixedPositionedObjects : DefaultLayout));
1556 1556
1557 // Recompute our overflow information. 1557 // Recompute our overflow information.
1558 // FIXME: We could do better here by computing a temporary overflow obje ct from layoutPositionedObjects and only 1558 // FIXME: We could do better here by computing a temporary overflow obje ct from layoutPositionedObjects and only
1559 // updating our overflow if we either used to have overflow or if the ne w temporary object has overflow. 1559 // updating our overflow if we either used to have overflow or if the ne w temporary object has overflow.
1560 // For now just always recompute overflow. This is no worse performance- wise than the old code that called rightmostPosition and 1560 // For now just always recompute overflow. This is no worse performance- wise than the old code that called rightmostPosition and
1561 // lowestPosition on every relayout so it's not a regression. 1561 // lowestPosition on every relayout so it's not a regression.
1562 // computeOverflow expects the bottom edge before we clamp our height. S ince this information isn't available during 1562 // computeOverflow expects the bottom edge before we clamp our height. S ince this information isn't available during
1563 // simplifiedLayout, we cache the value in m_overflow. 1563 // simplifiedLayout, we cache the value in m_overflow.
1564 LayoutUnit oldClientAfterEdge = hasRenderOverflow() ? m_overflow->layout ClientAfterEdge() : clientLogicalBottom(); 1564 LayoutUnit oldClientAfterEdge = hasRenderOverflow() ? m_overflow->layout ClientAfterEdge() : clientLogicalBottom();
1565 computeOverflow(oldClientAfterEdge, true); 1565 computeOverflow(oldClientAfterEdge, true);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1653 if (relayoutChildren || (r->style()->hasStaticBlockPosition(isHorizontal WritingMode()) && r->parent() != this)) 1653 if (relayoutChildren || (r->style()->hasStaticBlockPosition(isHorizontal WritingMode()) && r->parent() != this))
1654 layoutScope.setChildNeedsLayout(r); 1654 layoutScope.setChildNeedsLayout(r);
1655 1655
1656 // If relayoutChildren is set and the child has percentage padding or an embedded content box, we also need to invalidate the childs pref widths. 1656 // If relayoutChildren is set and the child has percentage padding or an embedded content box, we also need to invalidate the childs pref widths.
1657 if (relayoutChildren && r->needsPreferredWidthsRecalculation()) 1657 if (relayoutChildren && r->needsPreferredWidthsRecalculation())
1658 r->setPreferredLogicalWidthsDirty(MarkOnlyThis); 1658 r->setPreferredLogicalWidthsDirty(MarkOnlyThis);
1659 1659
1660 if (!r->needsLayout()) 1660 if (!r->needsLayout())
1661 r->markForPaginationRelayoutIfNeeded(layoutScope); 1661 r->markForPaginationRelayoutIfNeeded(layoutScope);
1662 1662
1663 // 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
1664 // and we hit the available width constraint, the layoutIfNeeded() will catch it and do a full layout.
1665 if (r->needsPositionedMovementLayoutOnly() && r->tryLayoutDoingPositione dMovementOnly())
1666 r->clearNeedsLayout();
1667
1668 // If we are paginated or in a line grid, go ahead and compute a vertica l position for our object now. 1663 // If we are paginated or in a line grid, go ahead and compute a vertica l position for our object now.
1669 // If it's wrong we'll lay out again. 1664 // If it's wrong we'll lay out again.
1670 LayoutUnit oldLogicalTop = 0; 1665 LayoutUnit oldLogicalTop = 0;
1671 bool needsBlockDirectionLocationSetBeforeLayout = r->needsLayout() && vi ew()->layoutState()->needsBlockDirectionLocationSetBeforeLayout(); 1666 bool needsBlockDirectionLocationSetBeforeLayout = r->needsLayout() && vi ew()->layoutState()->needsBlockDirectionLocationSetBeforeLayout();
1672 if (needsBlockDirectionLocationSetBeforeLayout) { 1667 if (needsBlockDirectionLocationSetBeforeLayout) {
1673 if (isHorizontalWritingMode() == r->isHorizontalWritingMode()) 1668 if (isHorizontalWritingMode() == r->isHorizontalWritingMode())
1674 r->updateLogicalHeight(); 1669 r->updateLogicalHeight();
1675 else 1670 else
1676 r->updateLogicalWidth(); 1671 r->updateLogicalWidth();
1677 oldLogicalTop = logicalTopForChild(r); 1672 oldLogicalTop = logicalTopForChild(r);
(...skipping 3229 matching lines...) Expand 10 before | Expand all | Expand 10 after
4907 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const 4902 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const
4908 { 4903 {
4909 showRenderObject(); 4904 showRenderObject();
4910 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 4905 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
4911 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 4906 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
4912 } 4907 }
4913 4908
4914 #endif 4909 #endif
4915 4910
4916 } // namespace WebCore 4911 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/repaint/positioned-list-offset-change-repaint-expected.txt ('k') | Source/core/rendering/RenderObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698