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

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

Issue 99663004: Avoid layout/full-repaint on view height change if possible (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: quicks mode; dialogs Created 7 years 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) 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 2850 matching lines...) Expand 10 before | Expand all | Expand 10 after
2861 bool skippedAutoHeightContainingBlock = false; 2861 bool skippedAutoHeightContainingBlock = false;
2862 RenderBlock* cb = containingBlock(); 2862 RenderBlock* cb = containingBlock();
2863 const RenderBox* containingBlockChild = this; 2863 const RenderBox* containingBlockChild = this;
2864 LayoutUnit rootMarginBorderPaddingHeight = 0; 2864 LayoutUnit rootMarginBorderPaddingHeight = 0;
2865 while (!cb->isRenderView() && skipContainingBlockForPercentHeightCalculation (cb)) { 2865 while (!cb->isRenderView() && skipContainingBlockForPercentHeightCalculation (cb)) {
2866 if (cb->isBody() || cb->isRoot()) 2866 if (cb->isBody() || cb->isRoot())
2867 rootMarginBorderPaddingHeight += cb->marginBefore() + cb->marginAfte r() + cb->borderAndPaddingLogicalHeight(); 2867 rootMarginBorderPaddingHeight += cb->marginBefore() + cb->marginAfte r() + cb->borderAndPaddingLogicalHeight();
2868 skippedAutoHeightContainingBlock = true; 2868 skippedAutoHeightContainingBlock = true;
2869 containingBlockChild = cb; 2869 containingBlockChild = cb;
2870 cb = cb->containingBlock(); 2870 cb = cb->containingBlock();
2871 cb->addPercentHeightDescendant(const_cast<RenderBox*>(this));
2872 } 2871 }
2872 cb->addPercentHeightDescendant(const_cast<RenderBox*>(this));
ojan 2014/01/03 02:04:26 I'm still not sure this is correct. For example, t
Xianzhu 2014/01/03 20:46:24 Actually percentHeightDescendants set doesn't incl
2873 2873
2874 RenderStyle* cbstyle = cb->style(); 2874 RenderStyle* cbstyle = cb->style();
2875 2875
2876 // A positioned element that specified both top/bottom or that specifies hei ght should be treated as though it has a height 2876 // A positioned element that specified both top/bottom or that specifies hei ght should be treated as though it has a height
2877 // explicitly specified that can be used for any percentage computations. 2877 // explicitly specified that can be used for any percentage computations.
2878 bool isOutOfFlowPositionedWithSpecifiedHeight = cb->isOutOfFlowPositioned() && (!cbstyle->logicalHeight().isAuto() || (!cbstyle->logicalTop().isAuto() && !c bstyle->logicalBottom().isAuto())); 2878 bool isOutOfFlowPositionedWithSpecifiedHeight = cb->isOutOfFlowPositioned() && (!cbstyle->logicalHeight().isAuto() || (!cbstyle->logicalTop().isAuto() && !c bstyle->logicalBottom().isAuto()));
2879 2879
2880 bool includeBorderPadding = isTable(); 2880 bool includeBorderPadding = isTable();
2881 2881
2882 if (isHorizontalWritingMode() != cb->isHorizontalWritingMode()) 2882 if (isHorizontalWritingMode() != cb->isHorizontalWritingMode())
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
3027 3027
3028 LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(Length logicalHeight) co nst 3028 LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(Length logicalHeight) co nst
3029 { 3029 {
3030 switch (logicalHeight.type()) { 3030 switch (logicalHeight.type()) {
3031 case Fixed: 3031 case Fixed:
3032 return adjustContentBoxLogicalHeightForBoxSizing(logicalHeight.value ()); 3032 return adjustContentBoxLogicalHeightForBoxSizing(logicalHeight.value ());
3033 case Percent: 3033 case Percent:
3034 case Calculated: 3034 case Calculated:
3035 { 3035 {
3036 RenderObject* cb = isOutOfFlowPositioned() ? container() : containin gBlock(); 3036 RenderObject* cb = isOutOfFlowPositioned() ? container() : containin gBlock();
3037 while (cb->isAnonymous()) { 3037 while (cb->isAnonymous())
3038 cb = cb->containingBlock(); 3038 cb = cb->containingBlock();
3039 if (cb->isRenderBlock())
3039 toRenderBlock(cb)->addPercentHeightDescendant(const_cast<RenderB ox*>(this)); 3040 toRenderBlock(cb)->addPercentHeightDescendant(const_cast<RenderB ox*>(this));
3040 }
3041 3041
3042 // FIXME: This calculation is not patched for block-flow yet. 3042 // FIXME: This calculation is not patched for block-flow yet.
3043 // https://bugs.webkit.org/show_bug.cgi?id=46500 3043 // https://bugs.webkit.org/show_bug.cgi?id=46500
3044 if (cb->isOutOfFlowPositioned() && cb->style()->height().isAuto() && !(cb->style()->top().isAuto() || cb->style()->bottom().isAuto())) { 3044 if (cb->isOutOfFlowPositioned() && cb->style()->height().isAuto() && !(cb->style()->top().isAuto() || cb->style()->bottom().isAuto())) {
3045 ASSERT_WITH_SECURITY_IMPLICATION(cb->isRenderBlock()); 3045 ASSERT_WITH_SECURITY_IMPLICATION(cb->isRenderBlock());
3046 RenderBlock* block = toRenderBlock(cb); 3046 RenderBlock* block = toRenderBlock(cb);
3047 LogicalExtentComputedValues computedValues; 3047 LogicalExtentComputedValues computedValues;
3048 block->computeLogicalHeight(block->logicalHeight(), 0, computedV alues); 3048 block->computeLogicalHeight(block->logicalHeight(), 0, computedV alues);
3049 LayoutUnit newContentHeight = computedValues.m_extent - block->b orderAndPaddingLogicalHeight() - block->scrollbarLogicalHeight(); 3049 LayoutUnit newContentHeight = computedValues.m_extent - block->b orderAndPaddingLogicalHeight() - block->scrollbarLogicalHeight();
3050 LayoutUnit newHeight = block->adjustContentBoxLogicalHeightForBo xSizing(newContentHeight); 3050 LayoutUnit newHeight = block->adjustContentBoxLogicalHeightForBo xSizing(newContentHeight);
(...skipping 1904 matching lines...) Expand 10 before | Expand all | Expand 10 after
4955 return 0; 4955 return 0;
4956 4956
4957 if (!layoutState && !flowThreadContainingBlock()) 4957 if (!layoutState && !flowThreadContainingBlock())
4958 return 0; 4958 return 0;
4959 4959
4960 RenderBlock* containerBlock = containingBlock(); 4960 RenderBlock* containerBlock = containingBlock();
4961 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); 4961 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop();
4962 } 4962 }
4963 4963
4964 } // namespace WebCore 4964 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698