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

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. Add PartialLayoutState and PartialLayoutDisabler Created 7 years, 3 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()->partialLayout().shouldStop())
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()->partialLayout().shouldStop()) {
1604 statePusher.pop();
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()->partialLayout().shouldStop())
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 doing a partial layout and the child was the target renderer, earl y exit here.
2532 if (frameView()->partialLayout().checkPartialLayoutComplete(child))
2533 break;
2519 } 2534 }
2520 2535
2521 // Now do the handling of the bottom of the block, adding in our bottom bord er/padding and 2536 // 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. 2537 // determining the correct collapsed bottom margin information.
2523 handleAfterSideOfBlock(beforeEdge, afterEdge, marginInfo); 2538 handleAfterSideOfBlock(beforeEdge, afterEdge, marginInfo);
2524 } 2539 }
2525 2540
2526 void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, Lay outUnit& previousFloatLogicalBottom, LayoutUnit& maxFloatLogicalBottom) 2541 void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, Lay outUnit& previousFloatLogicalBottom, LayoutUnit& maxFloatLogicalBottom)
2527 { 2542 {
2528 LayoutUnit oldPosMarginBefore = maxPositiveMarginBefore(); 2543 LayoutUnit oldPosMarginBefore = maxPositiveMarginBefore();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
2574 2589
2575 SubtreeLayoutScope layoutScope(child); 2590 SubtreeLayoutScope layoutScope(child);
2576 if (!child->needsLayout()) 2591 if (!child->needsLayout())
2577 child->markForPaginationRelayoutIfNeeded(layoutScope); 2592 child->markForPaginationRelayoutIfNeeded(layoutScope);
2578 2593
2579 bool childHadLayout = child->everHadLayout(); 2594 bool childHadLayout = child->everHadLayout();
2580 bool childNeededLayout = child->needsLayout(); 2595 bool childNeededLayout = child->needsLayout();
2581 if (childNeededLayout) 2596 if (childNeededLayout)
2582 child->layout(); 2597 child->layout();
2583 2598
2599 if (frameView()->partialLayout().shouldStop())
2600 return;
2601
2584 // Cache if we are at the top of the block right now. 2602 // Cache if we are at the top of the block right now.
2585 bool atBeforeSideOfBlock = marginInfo.atBeforeSideOfBlock(); 2603 bool atBeforeSideOfBlock = marginInfo.atBeforeSideOfBlock();
2586 2604
2587 // Now determine the correct ypos based off examination of collapsing margin 2605 // Now determine the correct ypos based off examination of collapsing margin
2588 // values. 2606 // values.
2589 LayoutUnit logicalTopBeforeClear = collapseMargins(child, marginInfo); 2607 LayoutUnit logicalTopBeforeClear = collapseMargins(child, marginInfo);
2590 2608
2591 // Now check for clear. 2609 // Now check for clear.
2592 LayoutUnit logicalTopAfterClear = clearFloatsIfNeeded(child, marginInfo, old PosMarginBefore, oldNegMarginBefore, logicalTopBeforeClear); 2610 LayoutUnit logicalTopAfterClear = clearFloatsIfNeeded(child, marginInfo, old PosMarginBefore, oldNegMarginBefore, logicalTopBeforeClear);
2593 2611
(...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 7996 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const
7979 { 7997 {
7980 showRenderObject(); 7998 showRenderObject();
7981 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 7999 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
7982 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 8000 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
7983 } 8001 }
7984 8002
7985 #endif 8003 #endif
7986 8004
7987 } // namespace WebCore 8005 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698