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

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

Issue 190973007: Reland "Avoid layout/full-repaint on view height change if possible" (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: New CL Created 6 years, 9 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
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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 2690 matching lines...) Expand 10 before | Expand all | Expand 10 after
2701 bool skippedAutoHeightContainingBlock = false; 2701 bool skippedAutoHeightContainingBlock = false;
2702 RenderBlock* cb = containingBlock(); 2702 RenderBlock* cb = containingBlock();
2703 const RenderBox* containingBlockChild = this; 2703 const RenderBox* containingBlockChild = this;
2704 LayoutUnit rootMarginBorderPaddingHeight = 0; 2704 LayoutUnit rootMarginBorderPaddingHeight = 0;
2705 while (!cb->isRenderView() && skipContainingBlockForPercentHeightCalculation (cb)) { 2705 while (!cb->isRenderView() && skipContainingBlockForPercentHeightCalculation (cb)) {
2706 if (cb->isBody() || cb->isRoot()) 2706 if (cb->isBody() || cb->isRoot())
2707 rootMarginBorderPaddingHeight += cb->marginBefore() + cb->marginAfte r() + cb->borderAndPaddingLogicalHeight(); 2707 rootMarginBorderPaddingHeight += cb->marginBefore() + cb->marginAfte r() + cb->borderAndPaddingLogicalHeight();
2708 skippedAutoHeightContainingBlock = true; 2708 skippedAutoHeightContainingBlock = true;
2709 containingBlockChild = cb; 2709 containingBlockChild = cb;
2710 cb = cb->containingBlock(); 2710 cb = cb->containingBlock();
2711 cb->addPercentHeightDescendant(const_cast<RenderBox*>(this));
2712 } 2711 }
2712 cb->addPercentHeightDescendant(const_cast<RenderBox*>(this));
esprehn 2014/03/10 21:32:30 Same, why is it okay to skip adding percentage hei
Xianzhu 2014/03/11 00:55:13 In existing code, percentHeightDescendants is used
2713 2713
2714 RenderStyle* cbstyle = cb->style(); 2714 RenderStyle* cbstyle = cb->style();
2715 2715
2716 // A positioned element that specified both top/bottom or that specifies hei ght should be treated as though it has a height 2716 // A positioned element that specified both top/bottom or that specifies hei ght should be treated as though it has a height
2717 // explicitly specified that can be used for any percentage computations. 2717 // explicitly specified that can be used for any percentage computations.
2718 bool isOutOfFlowPositionedWithSpecifiedHeight = cb->isOutOfFlowPositioned() && (!cbstyle->logicalHeight().isAuto() || (!cbstyle->logicalTop().isAuto() && !c bstyle->logicalBottom().isAuto())); 2718 bool isOutOfFlowPositionedWithSpecifiedHeight = cb->isOutOfFlowPositioned() && (!cbstyle->logicalHeight().isAuto() || (!cbstyle->logicalTop().isAuto() && !c bstyle->logicalBottom().isAuto()));
2719 2719
2720 bool includeBorderPadding = isTable(); 2720 bool includeBorderPadding = isTable();
2721 2721
2722 if (isHorizontalWritingMode() != cb->isHorizontalWritingMode()) 2722 if (isHorizontalWritingMode() != cb->isHorizontalWritingMode())
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
2854 2854
2855 LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(Length logicalHeight) co nst 2855 LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(Length logicalHeight) co nst
2856 { 2856 {
2857 switch (logicalHeight.type()) { 2857 switch (logicalHeight.type()) {
2858 case Fixed: 2858 case Fixed:
2859 return adjustContentBoxLogicalHeightForBoxSizing(logicalHeight.value ()); 2859 return adjustContentBoxLogicalHeightForBoxSizing(logicalHeight.value ());
2860 case Percent: 2860 case Percent:
2861 case Calculated: 2861 case Calculated:
2862 { 2862 {
2863 RenderObject* cb = isOutOfFlowPositioned() ? container() : containin gBlock(); 2863 RenderObject* cb = isOutOfFlowPositioned() ? container() : containin gBlock();
2864 while (cb->isAnonymous()) { 2864 while (cb->isAnonymous())
2865 cb = cb->containingBlock(); 2865 cb = cb->containingBlock();
2866 if (cb->isRenderBlock())
esprehn 2014/03/10 21:32:30 This skips adding anonymous percentage height desc
Xianzhu 2014/03/11 00:55:13 Actually this skips adding this object into percen
2866 toRenderBlock(cb)->addPercentHeightDescendant(const_cast<RenderB ox*>(this)); 2867 toRenderBlock(cb)->addPercentHeightDescendant(const_cast<RenderB ox*>(this));
2867 }
2868 2868
2869 // FIXME: This calculation is not patched for block-flow yet. 2869 // FIXME: This calculation is not patched for block-flow yet.
2870 // https://bugs.webkit.org/show_bug.cgi?id=46500 2870 // https://bugs.webkit.org/show_bug.cgi?id=46500
2871 if (cb->isOutOfFlowPositioned() && cb->style()->height().isAuto() && !(cb->style()->top().isAuto() || cb->style()->bottom().isAuto())) { 2871 if (cb->isOutOfFlowPositioned() && cb->style()->height().isAuto() && !(cb->style()->top().isAuto() || cb->style()->bottom().isAuto())) {
2872 ASSERT_WITH_SECURITY_IMPLICATION(cb->isRenderBlock()); 2872 ASSERT_WITH_SECURITY_IMPLICATION(cb->isRenderBlock());
2873 RenderBlock* block = toRenderBlock(cb); 2873 RenderBlock* block = toRenderBlock(cb);
2874 LogicalExtentComputedValues computedValues; 2874 LogicalExtentComputedValues computedValues;
2875 block->computeLogicalHeight(block->logicalHeight(), 0, computedV alues); 2875 block->computeLogicalHeight(block->logicalHeight(), 0, computedV alues);
2876 LayoutUnit newContentHeight = computedValues.m_extent - block->b orderAndPaddingLogicalHeight() - block->scrollbarLogicalHeight(); 2876 LayoutUnit newContentHeight = computedValues.m_extent - block->b orderAndPaddingLogicalHeight() - block->scrollbarLogicalHeight();
2877 LayoutUnit newHeight = block->adjustContentBoxLogicalHeightForBo xSizing(newContentHeight); 2877 LayoutUnit newHeight = block->adjustContentBoxLogicalHeightForBo xSizing(newContentHeight);
(...skipping 1808 matching lines...) Expand 10 before | Expand all | Expand 10 after
4686 return 0; 4686 return 0;
4687 4687
4688 if (!layoutState && !flowThreadContainingBlock()) 4688 if (!layoutState && !flowThreadContainingBlock())
4689 return 0; 4689 return 0;
4690 4690
4691 RenderBlock* containerBlock = containingBlock(); 4691 RenderBlock* containerBlock = containingBlock();
4692 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); 4692 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop();
4693 } 4693 }
4694 4694
4695 } // namespace WebCore 4695 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698