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

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: Fix release compile, minor cleanups 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 1394 matching lines...) Expand 10 before | Expand all | Expand 10 after
1405 StackStats::LayoutCheckPoint layoutCheckPoint; 1405 StackStats::LayoutCheckPoint layoutCheckPoint;
1406 OverflowEventDispatcher dispatcher(this); 1406 OverflowEventDispatcher dispatcher(this);
1407 1407
1408 // Update our first letter info now. 1408 // Update our first letter info now.
1409 updateFirstLetter(); 1409 updateFirstLetter();
1410 1410
1411 // Table cells call layoutBlock directly, so don't add any logic here. Put code into 1411 // Table cells call layoutBlock directly, so don't add any logic here. Put code into
1412 // layoutBlock(). 1412 // layoutBlock().
1413 layoutBlock(false); 1413 layoutBlock(false);
1414 1414
1415 if (document()->view()->shouldStopPartialLayout())
1416 return;
1417
1415 // It's safe to check for control clip here, since controls can never be tab le cells. 1418 // It's safe to check for control clip here, since controls can never be tab le cells.
1416 // If we have a lightweight clip, there can never be any overflow from child ren. 1419 // If we have a lightweight clip, there can never be any overflow from child ren.
1417 if (hasControlClip() && m_overflow) 1420 if (hasControlClip() && m_overflow)
1418 clearLayoutOverflow(); 1421 clearLayoutOverflow();
1419 1422
1420 invalidateBackgroundObscurationStatus(); 1423 invalidateBackgroundObscurationStatus();
1421 } 1424 }
1422 1425
1423 void RenderBlock::imageChanged(WrappedImagePtr image, const IntRect*) 1426 void RenderBlock::imageChanged(WrappedImagePtr image, const IntRect*)
1424 { 1427 {
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1613 LayoutUnit repaintLogicalTop = 0; 1616 LayoutUnit repaintLogicalTop = 0;
1614 LayoutUnit repaintLogicalBottom = 0; 1617 LayoutUnit repaintLogicalBottom = 0;
1615 LayoutUnit maxFloatLogicalBottom = 0; 1618 LayoutUnit maxFloatLogicalBottom = 0;
1616 if (!firstChild() && !isAnonymousBlock()) 1619 if (!firstChild() && !isAnonymousBlock())
1617 setChildrenInline(true); 1620 setChildrenInline(true);
1618 if (childrenInline()) 1621 if (childrenInline())
1619 layoutInlineChildren(relayoutChildren, repaintLogicalTop, repaintLogical Bottom); 1622 layoutInlineChildren(relayoutChildren, repaintLogicalTop, repaintLogical Bottom);
1620 else 1623 else
1621 layoutBlockChildren(relayoutChildren, maxFloatLogicalBottom); 1624 layoutBlockChildren(relayoutChildren, maxFloatLogicalBottom);
1622 1625
1626 // If layout was just for one of our children, stop early (before setting se tNeedsLayout=false!)
1627 if (document()->view()->shouldStopPartialLayout()) {
1628 statePusher.pop();
1629 return;
1630 }
1631
1623 // Expand our intrinsic height to encompass floats. 1632 // Expand our intrinsic height to encompass floats.
1624 LayoutUnit toAdd = borderAfter() + paddingAfter() + scrollbarLogicalHeight() ; 1633 LayoutUnit toAdd = borderAfter() + paddingAfter() + scrollbarLogicalHeight() ;
1625 if (lowestFloatLogicalBottom() > (logicalHeight() - toAdd) && expandsToEnclo seOverhangingFloats()) 1634 if (lowestFloatLogicalBottom() > (logicalHeight() - toAdd) && expandsToEnclo seOverhangingFloats())
1626 setLogicalHeight(lowestFloatLogicalBottom() + toAdd); 1635 setLogicalHeight(lowestFloatLogicalBottom() + toAdd);
1627 1636
1628 if (relayoutForPagination(hasSpecifiedPageLogicalHeight, pageLogicalHeight, statePusher)) 1637 if (relayoutForPagination(hasSpecifiedPageLogicalHeight, pageLogicalHeight, statePusher))
1629 return; 1638 return;
1630 1639
1631 // Calculate our new height. 1640 // Calculate our new height.
1632 LayoutUnit oldHeight = logicalHeight(); 1641 LayoutUnit oldHeight = logicalHeight();
(...skipping 27 matching lines...) Expand all
1660 1669
1661 updateRegionsAndShapesAfterChildLayout(flowThread, heightChanged); 1670 updateRegionsAndShapesAfterChildLayout(flowThread, heightChanged);
1662 1671
1663 // Add overflow from children (unless we're multi-column, since in that case all our child overflow is clipped anyway). 1672 // Add overflow from children (unless we're multi-column, since in that case all our child overflow is clipped anyway).
1664 computeOverflow(oldClientAfterEdge); 1673 computeOverflow(oldClientAfterEdge);
1665 1674
1666 statePusher.pop(); 1675 statePusher.pop();
1667 1676
1668 fitBorderToLinesIfNeeded(); 1677 fitBorderToLinesIfNeeded();
1669 1678
1679 if (document()->view()->shouldStopPartialLayout())
1680 return;
1681
1670 if (renderView->layoutState()->m_pageLogicalHeight) 1682 if (renderView->layoutState()->m_pageLogicalHeight)
1671 setPageLogicalOffset(renderView->layoutState()->pageLogicalOffset(this, logicalTop())); 1683 setPageLogicalOffset(renderView->layoutState()->pageLogicalOffset(this, logicalTop()));
1672 1684
1673 updateLayerTransform(); 1685 updateLayerTransform();
1674 1686
1675 // Update our scroll information if we're overflow:auto/scroll/hidden now th at we know if 1687 // Update our scroll information if we're overflow:auto/scroll/hidden now th at we know if
1676 // we overflow or not. 1688 // we overflow or not.
1677 updateScrollInfoAfterLayout(); 1689 updateScrollInfoAfterLayout();
1678 1690
1679 // FIXME: This repaint logic should be moved into a separate helper function ! 1691 // FIXME: This repaint logic should be moved into a separate helper function !
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
2532 continue; 2544 continue;
2533 } 2545 }
2534 if (child->isFloating()) { 2546 if (child->isFloating()) {
2535 insertFloatingObject(child); 2547 insertFloatingObject(child);
2536 adjustFloatingBlock(marginInfo); 2548 adjustFloatingBlock(marginInfo);
2537 continue; 2549 continue;
2538 } 2550 }
2539 2551
2540 // Lay out the child. 2552 // Lay out the child.
2541 layoutBlockChild(child, marginInfo, previousFloatLogicalBottom, maxFloat LogicalBottom); 2553 layoutBlockChild(child, marginInfo, previousFloatLogicalBottom, maxFloat LogicalBottom);
2554
2555 document()->view()->checkPartialLayoutComplete(child);
2556 if (document()->view()->shouldStopPartialLayout())
2557 break;
2542 } 2558 }
2543 2559
2544 // Now do the handling of the bottom of the block, adding in our bottom bord er/padding and 2560 // Now do the handling of the bottom of the block, adding in our bottom bord er/padding and
2545 // determining the correct collapsed bottom margin information. 2561 // determining the correct collapsed bottom margin information.
2546 handleAfterSideOfBlock(beforeEdge, afterEdge, marginInfo); 2562 handleAfterSideOfBlock(beforeEdge, afterEdge, marginInfo);
2547 } 2563 }
2548 2564
2549 void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, Lay outUnit& previousFloatLogicalBottom, LayoutUnit& maxFloatLogicalBottom) 2565 void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, Lay outUnit& previousFloatLogicalBottom, LayoutUnit& maxFloatLogicalBottom)
2550 { 2566 {
2551 LayoutUnit oldPosMarginBefore = maxPositiveMarginBefore(); 2567 LayoutUnit oldPosMarginBefore = maxPositiveMarginBefore();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
2596 } 2612 }
2597 2613
2598 if (!child->needsLayout()) 2614 if (!child->needsLayout())
2599 child->markForPaginationRelayoutIfNeeded(); 2615 child->markForPaginationRelayoutIfNeeded();
2600 2616
2601 bool childHadLayout = child->everHadLayout(); 2617 bool childHadLayout = child->everHadLayout();
2602 bool childNeededLayout = child->needsLayout(); 2618 bool childNeededLayout = child->needsLayout();
2603 if (childNeededLayout) 2619 if (childNeededLayout)
2604 child->layout(); 2620 child->layout();
2605 2621
2622 if (document()->view()->shouldStopPartialLayout())
2623 return;
2624
2606 // Cache if we are at the top of the block right now. 2625 // Cache if we are at the top of the block right now.
2607 bool atBeforeSideOfBlock = marginInfo.atBeforeSideOfBlock(); 2626 bool atBeforeSideOfBlock = marginInfo.atBeforeSideOfBlock();
2608 2627
2609 // Now determine the correct ypos based off examination of collapsing margin 2628 // Now determine the correct ypos based off examination of collapsing margin
2610 // values. 2629 // values.
2611 LayoutUnit logicalTopBeforeClear = collapseMargins(child, marginInfo); 2630 LayoutUnit logicalTopBeforeClear = collapseMargins(child, marginInfo);
2612 2631
2613 // Now check for clear. 2632 // Now check for clear.
2614 LayoutUnit logicalTopAfterClear = clearFloatsIfNeeded(child, marginInfo, old PosMarginBefore, oldNegMarginBefore, logicalTopBeforeClear); 2633 LayoutUnit logicalTopAfterClear = clearFloatsIfNeeded(child, marginInfo, old PosMarginBefore, oldNegMarginBefore, logicalTopBeforeClear);
2615 2634
(...skipping 5585 matching lines...) Expand 10 before | Expand all | Expand 10 after
8201 8220
8202 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl oatingObject* floatingObject) 8221 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl oatingObject* floatingObject)
8203 { 8222 {
8204 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->fr ameRect().pixelSnappedX(), floatingObject->frameRect().pixelSnappedY(), floating Object->frameRect().pixelSnappedMaxX(), floatingObject->frameRect().pixelSnapped MaxY()); 8223 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->fr ameRect().pixelSnappedX(), floatingObject->frameRect().pixelSnappedY(), floating Object->frameRect().pixelSnappedMaxX(), floatingObject->frameRect().pixelSnapped MaxY());
8205 } 8224 }
8206 8225
8207 8226
8208 #endif 8227 #endif
8209 8228
8210 } // namespace WebCore 8229 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698