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

Side by Side Diff: sky/engine/core/rendering/RenderBox.cpp

Issue 1070233002: Remove dead code around anonymous renderers. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 8 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 1576 matching lines...) Expand 10 before | Expand all | Expand 10 after
1587 return -1; // Intrinsic height isn't available. 1587 return -1; // Intrinsic height isn't available.
1588 return computeIntrinsicLogicalContentHeightUsing(height, intrinsicConten tHeight, borderAndPaddingLogicalHeight()); 1588 return computeIntrinsicLogicalContentHeightUsing(height, intrinsicConten tHeight, borderAndPaddingLogicalHeight());
1589 } 1589 }
1590 if (height.isFixed()) 1590 if (height.isFixed())
1591 return height.value(); 1591 return height.value();
1592 if (height.isPercent()) 1592 if (height.isPercent())
1593 return computePercentageLogicalHeight(height); 1593 return computePercentageLogicalHeight(height);
1594 return -1; 1594 return -1;
1595 } 1595 }
1596 1596
1597 // FIXME(sky): Remove
1597 bool RenderBox::skipContainingBlockForPercentHeightCalculation(const RenderBox* containingBlock) const 1598 bool RenderBox::skipContainingBlockForPercentHeightCalculation(const RenderBox* containingBlock) const
1598 { 1599 {
1599 if (!containingBlock->isAnonymousBlock()) 1600 return false;
1600 return false;
1601 return !containingBlock->isOutOfFlowPositioned() && containingBlock->style() ->logicalHeight().isAuto();
1602 } 1601 }
1603 1602
1604 LayoutUnit RenderBox::computePercentageLogicalHeight(const Length& height) const 1603 LayoutUnit RenderBox::computePercentageLogicalHeight(const Length& height) const
1605 { 1604 {
1606 LayoutUnit availableHeight = -1; 1605 LayoutUnit availableHeight = -1;
1607 1606
1608 bool skippedAutoHeightContainingBlock = false; 1607 bool skippedAutoHeightContainingBlock = false;
1609 RenderBlock* cb = containingBlock(); 1608 RenderBlock* cb = containingBlock();
1610 const RenderBox* containingBlockChild = this; 1609 const RenderBox* containingBlockChild = this;
1611 LayoutUnit rootMarginBorderPaddingHeight = 0; 1610 LayoutUnit rootMarginBorderPaddingHeight = 0;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1719 ASSERT(sizeType == MinSize || sizeType == MaxSize); 1718 ASSERT(sizeType == MinSize || sizeType == MaxSize);
1720 Length logicalHeight = sizeType == MinSize ? style()->logicalMinHeight() : s tyle()->logicalMaxHeight(); 1719 Length logicalHeight = sizeType == MinSize ? style()->logicalMinHeight() : s tyle()->logicalMaxHeight();
1721 Length initialLogicalHeight = sizeType == MinSize ? RenderStyle::initialMinS ize() : RenderStyle::initialMaxSize(); 1720 Length initialLogicalHeight = sizeType == MinSize ? RenderStyle::initialMinS ize() : RenderStyle::initialMaxSize();
1722 1721
1723 if (logicalHeight == initialLogicalHeight) 1722 if (logicalHeight == initialLogicalHeight)
1724 return true; 1723 return true;
1725 1724
1726 if (!logicalHeight.isPercent() || isOutOfFlowPositioned()) 1725 if (!logicalHeight.isPercent() || isOutOfFlowPositioned())
1727 return false; 1726 return false;
1728 1727
1729 // Anonymous block boxes are ignored when resolving percentage values that w ould refer to it: 1728 return containingBlock()->hasAutoHeightOrContainingBlockWithAutoHeight();
1730 // the closest non-anonymous ancestor box is used instead.
1731 RenderBlock* containingBlock = this->containingBlock();
1732 while (containingBlock->isAnonymous())
1733 containingBlock = containingBlock->containingBlock();
1734
1735 return containingBlock->hasAutoHeightOrContainingBlockWithAutoHeight();
1736 } 1729 }
1737 1730
1738 LayoutUnit RenderBox::computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutU nit logicalHeight) const 1731 LayoutUnit RenderBox::computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutU nit logicalHeight) const
1739 { 1732 {
1740 // If the height of the containing block is not specified explicitly (i.e., it depends on content height), and this element is not absolutely positioned, 1733 // If the height of the containing block is not specified explicitly (i.e., it depends on content height), and this element is not absolutely positioned,
1741 // the percentage value is treated as '0' (for 'min-height') or 'none' (for 'max-height'). 1734 // the percentage value is treated as '0' (for 'min-height') or 'none' (for 'max-height').
1742 LayoutUnit minLogicalHeight; 1735 LayoutUnit minLogicalHeight;
1743 if (!logicalHeightComputesAsNone(MinSize)) 1736 if (!logicalHeightComputesAsNone(MinSize))
1744 minLogicalHeight = computeReplacedLogicalHeightUsing(style()->logicalMin Height()); 1737 minLogicalHeight = computeReplacedLogicalHeightUsing(style()->logicalMin Height());
1745 LayoutUnit maxLogicalHeight = logicalHeight; 1738 LayoutUnit maxLogicalHeight = logicalHeight;
1746 if (!logicalHeightComputesAsNone(MaxSize)) 1739 if (!logicalHeightComputesAsNone(MaxSize))
1747 maxLogicalHeight = computeReplacedLogicalHeightUsing(style()->logicalMa xHeight()); 1740 maxLogicalHeight = computeReplacedLogicalHeightUsing(style()->logicalMa xHeight());
1748 return std::max(minLogicalHeight, std::min(logicalHeight, maxLogicalHeight)) ; 1741 return std::max(minLogicalHeight, std::min(logicalHeight, maxLogicalHeight)) ;
1749 } 1742 }
1750 1743
1751 LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(const Length& logicalHei ght) const 1744 LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(const Length& logicalHei ght) const
1752 { 1745 {
1753 switch (logicalHeight.type()) { 1746 switch (logicalHeight.type()) {
1754 case Fixed: 1747 case Fixed:
1755 return adjustContentBoxLogicalHeightForBoxSizing(logicalHeight.value ()); 1748 return adjustContentBoxLogicalHeightForBoxSizing(logicalHeight.value ());
1756 case Percent: 1749 case Percent:
1757 case Calculated: 1750 case Calculated:
1758 { 1751 {
1759 RenderObject* cb = isOutOfFlowPositioned() ? container() : containin gBlock(); 1752 RenderObject* cb = isOutOfFlowPositioned() ? container() : containin gBlock();
1760 while (cb->isAnonymous())
1761 cb = cb->containingBlock();
1762 if (cb->isRenderBlock()) 1753 if (cb->isRenderBlock())
1763 toRenderBlock(cb)->addPercentHeightDescendant(const_cast<RenderB ox*>(this)); 1754 toRenderBlock(cb)->addPercentHeightDescendant(const_cast<RenderB ox*>(this));
1764 1755
1765 // FIXME: This calculation is not patched for block-flow yet. 1756 // FIXME: This calculation is not patched for block-flow yet.
1766 // https://bugs.webkit.org/show_bug.cgi?id=46500 1757 // https://bugs.webkit.org/show_bug.cgi?id=46500
1767 if (cb->isOutOfFlowPositioned() && cb->style()->height().isAuto() && !(cb->style()->top().isAuto() || cb->style()->bottom().isAuto())) { 1758 if (cb->isOutOfFlowPositioned() && cb->style()->height().isAuto() && !(cb->style()->top().isAuto() || cb->style()->bottom().isAuto())) {
1768 ASSERT_WITH_SECURITY_IMPLICATION(cb->isRenderBlock()); 1759 ASSERT_WITH_SECURITY_IMPLICATION(cb->isRenderBlock());
1769 RenderBlock* block = toRenderBlock(cb); 1760 RenderBlock* block = toRenderBlock(cb);
1770 LogicalExtentComputedValues computedValues; 1761 LogicalExtentComputedValues computedValues;
1771 block->computeLogicalHeight(block->logicalHeight(), 0, computedV alues); 1762 block->computeLogicalHeight(block->logicalHeight(), 0, computedV alues);
(...skipping 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after
2972 if (!hasVisualOverflow() && contentsVisualOverflowRect().isEmpty()) { 2963 if (!hasVisualOverflow() && contentsVisualOverflowRect().isEmpty()) {
2973 clearAllOverflows(); 2964 clearAllOverflows();
2974 return; 2965 return;
2975 } 2966 }
2976 2967
2977 m_overflow->setLayoutOverflow(paddingBoxRect()); 2968 m_overflow->setLayoutOverflow(paddingBoxRect());
2978 } 2969 }
2979 2970
2980 bool RenderBox::percentageLogicalHeightIsResolvableFromBlock(const RenderBlock* containingBlock, bool isOutOfFlowPositioned) 2971 bool RenderBox::percentageLogicalHeightIsResolvableFromBlock(const RenderBlock* containingBlock, bool isOutOfFlowPositioned)
2981 { 2972 {
2982 // In quirks mode, blocks with auto height are skipped, and we keep looking for an enclosing
2983 // block that may have a specified height and then use it. In strict mode, t his violates the
2984 // specification, which states that percentage heights just revert to auto i f the containing
2985 // block has an auto height. We still skip anonymous containing blocks in bo th modes, though, and look
2986 // only at explicit containers.
2987 const RenderBlock* cb = containingBlock; 2973 const RenderBlock* cb = containingBlock;
2988 while (!cb->isRenderView() && !cb->isOutOfFlowPositioned() && cb->style()->l ogicalHeight().isAuto()) {
2989 if (!cb->isAnonymousBlock())
2990 break;
2991 cb = cb->containingBlock();
2992 }
2993 2974
2994 // A positioned element that specified both top/bottom or that specifies hei ght should be treated as though it has a height 2975 // A positioned element that specified both top/bottom or that specifies hei ght should be treated as though it has a height
2995 // explicitly specified that can be used for any percentage computations. 2976 // explicitly specified that can be used for any percentage computations.
2996 // FIXME: We can't just check top/bottom here. 2977 // FIXME: We can't just check top/bottom here.
2997 // https://bugs.webkit.org/show_bug.cgi?id=46500 2978 // https://bugs.webkit.org/show_bug.cgi?id=46500
2998 bool isOutOfFlowPositionedWithSpecifiedHeight = cb->isOutOfFlowPositioned() && (!cb->style()->logicalHeight().isAuto() || (!cb->style()->top().isAuto() && ! cb->style()->bottom().isAuto())); 2979 bool isOutOfFlowPositionedWithSpecifiedHeight = cb->isOutOfFlowPositioned() && (!cb->style()->logicalHeight().isAuto() || (!cb->style()->top().isAuto() && ! cb->style()->bottom().isAuto()));
2999 2980
3000 // Otherwise we only use our percentage height if our containing block had a specified 2981 // Otherwise we only use our percentage height if our containing block had a specified
3001 // height. 2982 // height.
3002 if (cb->style()->logicalHeight().isFixed()) 2983 if (cb->style()->logicalHeight().isFixed())
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
3074 3055
3075 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) 3056 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style)
3076 { 3057 {
3077 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor); 3058 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor);
3078 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); 3059 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage();
3079 ASSERT(hasBackground == style.hasBackground()); 3060 ASSERT(hasBackground == style.hasBackground());
3080 hasBorder = style.hasBorder(); 3061 hasBorder = style.hasBorder();
3081 } 3062 }
3082 3063
3083 } // namespace blink 3064 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderBox.h ('k') | sky/engine/core/rendering/RenderBoxModelObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698