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

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

Issue 18601002: Add infrastructure for partial layouts (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address reviewer comments Created 7 years, 4 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 1369 matching lines...) Expand 10 before | Expand all | Expand 10 after
1380 StackStats::LayoutCheckPoint layoutCheckPoint; 1380 StackStats::LayoutCheckPoint layoutCheckPoint;
1381 OverflowEventDispatcher dispatcher(this); 1381 OverflowEventDispatcher dispatcher(this);
1382 1382
1383 // Update our first letter info now. 1383 // Update our first letter info now.
1384 updateFirstLetter(); 1384 updateFirstLetter();
1385 1385
1386 // Table cells call layoutBlock directly, so don't add any logic here. Put code into 1386 // Table cells call layoutBlock directly, so don't add any logic here. Put code into
1387 // layoutBlock(). 1387 // layoutBlock().
1388 layoutBlock(false); 1388 layoutBlock(false);
1389 1389
1390 if (frameView()->shouldStopPartialLayout())
1391 return;
1392
1390 // It's safe to check for control clip here, since controls can never be tab le cells. 1393 // It's safe to check for control clip here, since controls can never be tab le cells.
1391 // If we have a lightweight clip, there can never be any overflow from child ren. 1394 // If we have a lightweight clip, there can never be any overflow from child ren.
1392 if (hasControlClip() && m_overflow) 1395 if (hasControlClip() && m_overflow)
1393 clearLayoutOverflow(); 1396 clearLayoutOverflow();
1394 1397
1395 invalidateBackgroundObscurationStatus(); 1398 invalidateBackgroundObscurationStatus();
1396 } 1399 }
1397 1400
1398 void RenderBlock::imageChanged(WrappedImagePtr image, const IntRect*) 1401 void RenderBlock::imageChanged(WrappedImagePtr image, const IntRect*)
1399 { 1402 {
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1590 LayoutUnit repaintLogicalTop = 0; 1593 LayoutUnit repaintLogicalTop = 0;
1591 LayoutUnit repaintLogicalBottom = 0; 1594 LayoutUnit repaintLogicalBottom = 0;
1592 LayoutUnit maxFloatLogicalBottom = 0; 1595 LayoutUnit maxFloatLogicalBottom = 0;
1593 if (!firstChild() && !isAnonymousBlock()) 1596 if (!firstChild() && !isAnonymousBlock())
1594 setChildrenInline(true); 1597 setChildrenInline(true);
1595 if (childrenInline()) 1598 if (childrenInline())
1596 layoutInlineChildren(relayoutChildren, repaintLogicalTop, repaintLogical Bottom); 1599 layoutInlineChildren(relayoutChildren, repaintLogicalTop, repaintLogical Bottom);
1597 else 1600 else
1598 layoutBlockChildren(relayoutChildren, maxFloatLogicalBottom, layoutScope ); 1601 layoutBlockChildren(relayoutChildren, maxFloatLogicalBottom, layoutScope );
1599 1602
1603 if (frameView()->shouldStopPartialLayout()) {
1604 statePusher.pop();
eseidel 2013/08/20 21:00:39 gnarly.
esprehn 2013/08/23 20:47:27 It's really weird that LayoutStateMaintainer doesn
1605 return;
1606 }
1607
1600 // Expand our intrinsic height to encompass floats. 1608 // Expand our intrinsic height to encompass floats.
1601 LayoutUnit toAdd = borderAfter() + paddingAfter() + scrollbarLogicalHeight() ; 1609 LayoutUnit toAdd = borderAfter() + paddingAfter() + scrollbarLogicalHeight() ;
1602 if (lowestFloatLogicalBottom() > (logicalHeight() - toAdd) && expandsToEnclo seOverhangingFloats()) 1610 if (lowestFloatLogicalBottom() > (logicalHeight() - toAdd) && expandsToEnclo seOverhangingFloats())
1603 setLogicalHeight(lowestFloatLogicalBottom() + toAdd); 1611 setLogicalHeight(lowestFloatLogicalBottom() + toAdd);
1604 1612
1605 if (relayoutForPagination(hasSpecifiedPageLogicalHeight, pageLogicalHeight, statePusher)) 1613 if (relayoutForPagination(hasSpecifiedPageLogicalHeight, pageLogicalHeight, statePusher))
1606 return; 1614 return;
1607 1615
1608 // Calculate our new height. 1616 // Calculate our new height.
1609 LayoutUnit oldHeight = logicalHeight(); 1617 LayoutUnit oldHeight = logicalHeight();
(...skipping 27 matching lines...) Expand all
1637 1645
1638 updateRegionsAndShapesAfterChildLayout(flowThread, heightChanged); 1646 updateRegionsAndShapesAfterChildLayout(flowThread, heightChanged);
1639 1647
1640 // Add overflow from children (unless we're multi-column, since in that case all our child overflow is clipped anyway). 1648 // Add overflow from children (unless we're multi-column, since in that case all our child overflow is clipped anyway).
1641 computeOverflow(oldClientAfterEdge); 1649 computeOverflow(oldClientAfterEdge);
1642 1650
1643 statePusher.pop(); 1651 statePusher.pop();
1644 1652
1645 fitBorderToLinesIfNeeded(); 1653 fitBorderToLinesIfNeeded();
1646 1654
1655 if (frameView()->shouldStopPartialLayout())
1656 return;
1657
1647 if (renderView->layoutState()->m_pageLogicalHeight) 1658 if (renderView->layoutState()->m_pageLogicalHeight)
1648 setPageLogicalOffset(renderView->layoutState()->pageLogicalOffset(this, logicalTop())); 1659 setPageLogicalOffset(renderView->layoutState()->pageLogicalOffset(this, logicalTop()));
1649 1660
1650 updateLayerTransform(); 1661 updateLayerTransform();
1651 1662
1652 // Update our scroll information if we're overflow:auto/scroll/hidden now th at we know if 1663 // Update our scroll information if we're overflow:auto/scroll/hidden now th at we know if
1653 // we overflow or not. 1664 // we overflow or not.
1654 updateScrollInfoAfterLayout(); 1665 updateScrollInfoAfterLayout();
1655 1666
1656 // FIXME: This repaint logic should be moved into a separate helper function ! 1667 // FIXME: This repaint logic should be moved into a separate helper function !
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
2509 continue; 2520 continue;
2510 } 2521 }
2511 if (child->isFloating()) { 2522 if (child->isFloating()) {
2512 insertFloatingObject(child); 2523 insertFloatingObject(child);
2513 adjustFloatingBlock(marginInfo); 2524 adjustFloatingBlock(marginInfo);
2514 continue; 2525 continue;
2515 } 2526 }
2516 2527
2517 // Lay out the child. 2528 // Lay out the child.
2518 layoutBlockChild(child, marginInfo, previousFloatLogicalBottom, maxFloat LogicalBottom); 2529 layoutBlockChild(child, marginInfo, previousFloatLogicalBottom, maxFloat LogicalBottom);
2530
2531 if (frameView()->checkPartialLayoutComplete(child))
eseidel 2013/08/20 21:00:39 You should add a comment as to why.
pdr. 2013/08/26 05:50:40 Done.
2532 break;
2519 } 2533 }
2520 2534
2521 // Now do the handling of the bottom of the block, adding in our bottom bord er/padding and 2535 // Now do the handling of the bottom of the block, adding in our bottom bord er/padding and
2522 // determining the correct collapsed bottom margin information. 2536 // determining the correct collapsed bottom margin information.
2523 handleAfterSideOfBlock(beforeEdge, afterEdge, marginInfo); 2537 handleAfterSideOfBlock(beforeEdge, afterEdge, marginInfo);
2524 } 2538 }
2525 2539
2526 void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, Lay outUnit& previousFloatLogicalBottom, LayoutUnit& maxFloatLogicalBottom) 2540 void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, Lay outUnit& previousFloatLogicalBottom, LayoutUnit& maxFloatLogicalBottom)
2527 { 2541 {
2528 LayoutUnit oldPosMarginBefore = maxPositiveMarginBefore(); 2542 LayoutUnit oldPosMarginBefore = maxPositiveMarginBefore();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
2574 2588
2575 SubtreeLayoutScope layoutScope(child); 2589 SubtreeLayoutScope layoutScope(child);
2576 if (!child->needsLayout()) 2590 if (!child->needsLayout())
2577 child->markForPaginationRelayoutIfNeeded(layoutScope); 2591 child->markForPaginationRelayoutIfNeeded(layoutScope);
2578 2592
2579 bool childHadLayout = child->everHadLayout(); 2593 bool childHadLayout = child->everHadLayout();
2580 bool childNeededLayout = child->needsLayout(); 2594 bool childNeededLayout = child->needsLayout();
2581 if (childNeededLayout) 2595 if (childNeededLayout)
2582 child->layout(); 2596 child->layout();
2583 2597
2598 if (document()->view()->shouldStopPartialLayout())
esprehn 2013/08/23 20:47:27 frameView()
pdr. 2013/08/26 05:50:40 Done.
2599 return;
2600
2584 // Cache if we are at the top of the block right now. 2601 // Cache if we are at the top of the block right now.
2585 bool atBeforeSideOfBlock = marginInfo.atBeforeSideOfBlock(); 2602 bool atBeforeSideOfBlock = marginInfo.atBeforeSideOfBlock();
2586 2603
2587 // Now determine the correct ypos based off examination of collapsing margin 2604 // Now determine the correct ypos based off examination of collapsing margin
2588 // values. 2605 // values.
2589 LayoutUnit logicalTopBeforeClear = collapseMargins(child, marginInfo); 2606 LayoutUnit logicalTopBeforeClear = collapseMargins(child, marginInfo);
2590 2607
2591 // Now check for clear. 2608 // Now check for clear.
2592 LayoutUnit logicalTopAfterClear = clearFloatsIfNeeded(child, marginInfo, old PosMarginBefore, oldNegMarginBefore, logicalTopBeforeClear); 2609 LayoutUnit logicalTopAfterClear = clearFloatsIfNeeded(child, marginInfo, old PosMarginBefore, oldNegMarginBefore, logicalTopBeforeClear);
2593 2610
(...skipping 5384 matching lines...) Expand 10 before | Expand all | Expand 10 after
7978 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const 7995 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const
7979 { 7996 {
7980 showRenderObject(); 7997 showRenderObject();
7981 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 7998 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
7982 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 7999 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
7983 } 8000 }
7984 8001
7985 #endif 8002 #endif
7986 8003
7987 } // namespace WebCore 8004 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698