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

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: If text autosizing is enabled, only partial layout for the second of two layouts 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 (document()->view()->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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1588 LayoutUnit repaintLogicalTop = 0; 1591 LayoutUnit repaintLogicalTop = 0;
1589 LayoutUnit repaintLogicalBottom = 0; 1592 LayoutUnit repaintLogicalBottom = 0;
1590 LayoutUnit maxFloatLogicalBottom = 0; 1593 LayoutUnit maxFloatLogicalBottom = 0;
1591 if (!firstChild() && !isAnonymousBlock()) 1594 if (!firstChild() && !isAnonymousBlock())
1592 setChildrenInline(true); 1595 setChildrenInline(true);
1593 if (childrenInline()) 1596 if (childrenInline())
1594 layoutInlineChildren(relayoutChildren, repaintLogicalTop, repaintLogical Bottom); 1597 layoutInlineChildren(relayoutChildren, repaintLogicalTop, repaintLogical Bottom);
1595 else 1598 else
1596 layoutBlockChildren(relayoutChildren, maxFloatLogicalBottom); 1599 layoutBlockChildren(relayoutChildren, maxFloatLogicalBottom);
1597 1600
1601 // If layout was just for one of our children, stop early (before setting se tNeedsLayout=false!)
1602 if (document()->view()->shouldStopPartialLayout()) {
1603 statePusher.pop();
1604 return;
1605 }
1606
1598 // Expand our intrinsic height to encompass floats. 1607 // Expand our intrinsic height to encompass floats.
1599 LayoutUnit toAdd = borderAfter() + paddingAfter() + scrollbarLogicalHeight() ; 1608 LayoutUnit toAdd = borderAfter() + paddingAfter() + scrollbarLogicalHeight() ;
1600 if (lowestFloatLogicalBottom() > (logicalHeight() - toAdd) && expandsToEnclo seOverhangingFloats()) 1609 if (lowestFloatLogicalBottom() > (logicalHeight() - toAdd) && expandsToEnclo seOverhangingFloats())
1601 setLogicalHeight(lowestFloatLogicalBottom() + toAdd); 1610 setLogicalHeight(lowestFloatLogicalBottom() + toAdd);
1602 1611
1603 if (relayoutForPagination(hasSpecifiedPageLogicalHeight, pageLogicalHeight, statePusher)) 1612 if (relayoutForPagination(hasSpecifiedPageLogicalHeight, pageLogicalHeight, statePusher))
1604 return; 1613 return;
1605 1614
1606 // Calculate our new height. 1615 // Calculate our new height.
1607 LayoutUnit oldHeight = logicalHeight(); 1616 LayoutUnit oldHeight = logicalHeight();
(...skipping 27 matching lines...) Expand all
1635 1644
1636 updateRegionsAndShapesAfterChildLayout(flowThread, heightChanged); 1645 updateRegionsAndShapesAfterChildLayout(flowThread, heightChanged);
1637 1646
1638 // Add overflow from children (unless we're multi-column, since in that case all our child overflow is clipped anyway). 1647 // Add overflow from children (unless we're multi-column, since in that case all our child overflow is clipped anyway).
1639 computeOverflow(oldClientAfterEdge); 1648 computeOverflow(oldClientAfterEdge);
1640 1649
1641 statePusher.pop(); 1650 statePusher.pop();
1642 1651
1643 fitBorderToLinesIfNeeded(); 1652 fitBorderToLinesIfNeeded();
1644 1653
1654 if (document()->view()->shouldStopPartialLayout())
1655 return;
1656
1645 if (renderView->layoutState()->m_pageLogicalHeight) 1657 if (renderView->layoutState()->m_pageLogicalHeight)
1646 setPageLogicalOffset(renderView->layoutState()->pageLogicalOffset(this, logicalTop())); 1658 setPageLogicalOffset(renderView->layoutState()->pageLogicalOffset(this, logicalTop()));
1647 1659
1648 updateLayerTransform(); 1660 updateLayerTransform();
1649 1661
1650 // Update our scroll information if we're overflow:auto/scroll/hidden now th at we know if 1662 // Update our scroll information if we're overflow:auto/scroll/hidden now th at we know if
1651 // we overflow or not. 1663 // we overflow or not.
1652 updateScrollInfoAfterLayout(); 1664 updateScrollInfoAfterLayout();
1653 1665
1654 // FIXME: This repaint logic should be moved into a separate helper function ! 1666 // FIXME: This repaint logic should be moved into a separate helper function !
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
2507 continue; 2519 continue;
2508 } 2520 }
2509 if (child->isFloating()) { 2521 if (child->isFloating()) {
2510 insertFloatingObject(child); 2522 insertFloatingObject(child);
2511 adjustFloatingBlock(marginInfo); 2523 adjustFloatingBlock(marginInfo);
2512 continue; 2524 continue;
2513 } 2525 }
2514 2526
2515 // Lay out the child. 2527 // Lay out the child.
2516 layoutBlockChild(child, marginInfo, previousFloatLogicalBottom, maxFloat LogicalBottom); 2528 layoutBlockChild(child, marginInfo, previousFloatLogicalBottom, maxFloat LogicalBottom);
2529
2530 document()->view()->checkPartialLayoutComplete(child);
esprehn 2013/08/18 03:43:15 you should add frameView() to RenderObject if you
pdr. 2013/08/20 06:19:10 Done.
2531 if (document()->view()->shouldStopPartialLayout())
2532 break;
2517 } 2533 }
2518 2534
2519 // 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
2520 // determining the correct collapsed bottom margin information. 2536 // determining the correct collapsed bottom margin information.
2521 handleAfterSideOfBlock(beforeEdge, afterEdge, marginInfo); 2537 handleAfterSideOfBlock(beforeEdge, afterEdge, marginInfo);
2522 } 2538 }
2523 2539
2524 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)
2525 { 2541 {
2526 LayoutUnit oldPosMarginBefore = maxPositiveMarginBefore(); 2542 LayoutUnit oldPosMarginBefore = maxPositiveMarginBefore();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
2571 } 2587 }
2572 2588
2573 if (!child->needsLayout()) 2589 if (!child->needsLayout())
2574 child->markForPaginationRelayoutIfNeeded(); 2590 child->markForPaginationRelayoutIfNeeded();
2575 2591
2576 bool childHadLayout = child->everHadLayout(); 2592 bool childHadLayout = child->everHadLayout();
2577 bool childNeededLayout = child->needsLayout(); 2593 bool childNeededLayout = child->needsLayout();
2578 if (childNeededLayout) 2594 if (childNeededLayout)
2579 child->layout(); 2595 child->layout();
2580 2596
2597 if (document()->view()->shouldStopPartialLayout())
2598 return;
2599
2581 // Cache if we are at the top of the block right now. 2600 // Cache if we are at the top of the block right now.
2582 bool atBeforeSideOfBlock = marginInfo.atBeforeSideOfBlock(); 2601 bool atBeforeSideOfBlock = marginInfo.atBeforeSideOfBlock();
2583 2602
2584 // Now determine the correct ypos based off examination of collapsing margin 2603 // Now determine the correct ypos based off examination of collapsing margin
2585 // values. 2604 // values.
2586 LayoutUnit logicalTopBeforeClear = collapseMargins(child, marginInfo); 2605 LayoutUnit logicalTopBeforeClear = collapseMargins(child, marginInfo);
2587 2606
2588 // Now check for clear. 2607 // Now check for clear.
2589 LayoutUnit logicalTopAfterClear = clearFloatsIfNeeded(child, marginInfo, old PosMarginBefore, oldNegMarginBefore, logicalTopBeforeClear); 2608 LayoutUnit logicalTopAfterClear = clearFloatsIfNeeded(child, marginInfo, old PosMarginBefore, oldNegMarginBefore, logicalTopBeforeClear);
2590 2609
(...skipping 5379 matching lines...) Expand 10 before | Expand all | Expand 10 after
7970 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const 7989 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const
7971 { 7990 {
7972 showRenderObject(); 7991 showRenderObject();
7973 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 7992 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
7974 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 7993 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
7975 } 7994 }
7976 7995
7977 #endif 7996 #endif
7978 7997
7979 } // namespace WebCore 7998 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698