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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 2309903002: Revert "Percent height content should respect the fixed height of its containing cell" (Closed)
Patch Set: Created 4 years, 3 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 2727 matching lines...) Expand 10 before | Expand all | Expand 10 after
2738 stretchedFlexHeight = toLayoutFlexibleBox(cb->parent())->childLogicalHei ghtForPercentageResolution(*cb); 2738 stretchedFlexHeight = toLayoutFlexibleBox(cb->parent())->childLogicalHei ghtForPercentageResolution(*cb);
2739 2739
2740 if (isHorizontalWritingMode() != cb->isHorizontalWritingMode()) { 2740 if (isHorizontalWritingMode() != cb->isHorizontalWritingMode()) {
2741 availableHeight = containingBlockChild->containingBlockLogicalWidthForCo ntent(); 2741 availableHeight = containingBlockChild->containingBlockLogicalWidthForCo ntent();
2742 } else if (stretchedFlexHeight != LayoutUnit(-1)) { 2742 } else if (stretchedFlexHeight != LayoutUnit(-1)) {
2743 availableHeight = stretchedFlexHeight; 2743 availableHeight = stretchedFlexHeight;
2744 } else if (hasOverrideContainingBlockLogicalHeight() && !isOutOfFlowPosition edWithSpecifiedHeight) { 2744 } else if (hasOverrideContainingBlockLogicalHeight() && !isOutOfFlowPosition edWithSpecifiedHeight) {
2745 availableHeight = overrideContainingBlockContentLogicalHeight(); 2745 availableHeight = overrideContainingBlockContentLogicalHeight();
2746 } else if (cb->isGridItem() && cb->hasOverrideLogicalContentHeight()) { 2746 } else if (cb->isGridItem() && cb->hasOverrideLogicalContentHeight()) {
2747 availableHeight = cb->overrideLogicalContentHeight(); 2747 availableHeight = cb->overrideLogicalContentHeight();
2748 } else if (cbstyle.logicalHeight().isFixed()) {
2749 LayoutUnit contentBoxHeight = cb->adjustContentBoxLogicalHeightForBoxSiz ing(cbstyle.logicalHeight().value());
2750 availableHeight = cb->constrainContentBoxLogicalHeightByMinMax(
2751 contentBoxHeight - cb->scrollbarLogicalHeight(), LayoutUnit(-1)).cla mpNegativeToZero();
2752 if (cb->isTableCell())
2753 includeBorderPadding = true;
2754 } else if (cb->isTableCell()) { 2748 } else if (cb->isTableCell()) {
2755 if (!skippedAutoHeightContainingBlock) { 2749 if (!skippedAutoHeightContainingBlock) {
2756 // Table cells violate what the CSS spec says to do with heights. Ba sically we 2750 // Table cells violate what the CSS spec says to do with heights. Ba sically we
2757 // don't care if the cell specified a height or not. We just always make ourselves 2751 // don't care if the cell specified a height or not. We just always make ourselves
2758 // be a percentage of the cell's current content height. 2752 // be a percentage of the cell's current content height.
2759 if (!cb->hasOverrideLogicalContentHeight()) { 2753 if (!cb->hasOverrideLogicalContentHeight()) {
2760 // Normally we would let the cell size intrinsically, but scroll ing overflow has to be 2754 // Normally we would let the cell size intrinsically, but scroll ing overflow has to be
2761 // treated differently, since WinIE lets scrolled overflow regio ns shrink as needed. 2755 // treated differently, since WinIE lets scrolled overflow regio ns shrink as needed.
2762 // While we can't get all cases right, we can at least detect wh en the cell has a specified 2756 // While we can't get all cases right, we can at least detect wh en the cell has a specified
2763 // height or when the table has a specified height. In these cas es we want to initially have 2757 // height or when the table has a specified height. In these cas es we want to initially have
2764 // no size and allow the flexing of the table or the cell to its specified height to cause us 2758 // no size and allow the flexing of the table or the cell to its specified height to cause us
2765 // to grow to fill the space. This could end up being wrong in s ome cases, but it is 2759 // to grow to fill the space. This could end up being wrong in s ome cases, but it is
2766 // preferable to the alternative (sizing intrinsically and makin g the row end up too big). 2760 // preferable to the alternative (sizing intrinsically and makin g the row end up too big).
2767 LayoutTableCell* cell = toLayoutTableCell(cb); 2761 LayoutTableCell* cell = toLayoutTableCell(cb);
2768 if (scrollsOverflowY() && (!cell->style()->logicalHeight().isAut o() || !cell->table()->style()->logicalHeight().isAuto())) 2762 if (scrollsOverflowY() && (!cell->style()->logicalHeight().isAut o() || !cell->table()->style()->logicalHeight().isAuto()))
2769 return LayoutUnit(); 2763 return LayoutUnit();
2770 return LayoutUnit(-1); 2764 return LayoutUnit(-1);
2771 } 2765 }
2772 availableHeight = cb->overrideLogicalContentHeight(); 2766 availableHeight = cb->overrideLogicalContentHeight();
2773 includeBorderPadding = true; 2767 includeBorderPadding = true;
2774 } 2768 }
2769 } else if (cbstyle.logicalHeight().isFixed()) {
2770 LayoutUnit contentBoxHeight = cb->adjustContentBoxLogicalHeightForBoxSiz ing(LayoutUnit(cbstyle.logicalHeight().value()));
2771 availableHeight = std::max(LayoutUnit(), cb->constrainContentBoxLogicalH eightByMinMax(contentBoxHeight - cb->scrollbarLogicalHeight(), LayoutUnit(-1)));
2775 } else if (cbstyle.logicalHeight().hasPercent() && !isOutOfFlowPositionedWit hSpecifiedHeight) { 2772 } else if (cbstyle.logicalHeight().hasPercent() && !isOutOfFlowPositionedWit hSpecifiedHeight) {
2776 // We need to recur and compute the percentage height for our containing block. 2773 // We need to recur and compute the percentage height for our containing block.
2777 LayoutUnit heightWithScrollbar = cb->computePercentageLogicalHeight(cbst yle.logicalHeight()); 2774 LayoutUnit heightWithScrollbar = cb->computePercentageLogicalHeight(cbst yle.logicalHeight());
2778 if (heightWithScrollbar != -1) { 2775 if (heightWithScrollbar != -1) {
2779 LayoutUnit contentBoxHeightWithScrollbar = cb->adjustContentBoxLogic alHeightForBoxSizing(heightWithScrollbar); 2776 LayoutUnit contentBoxHeightWithScrollbar = cb->adjustContentBoxLogic alHeightForBoxSizing(heightWithScrollbar);
2780 // We need to adjust for min/max height because this method does not 2777 // We need to adjust for min/max height because this method does not
2781 // handle the min/max of the current block, its caller does. So the 2778 // handle the min/max of the current block, its caller does. So the
2782 // return value from the recursive call will not have been adjusted 2779 // return value from the recursive call will not have been adjusted
2783 // yet. 2780 // yet.
2784 LayoutUnit contentBoxHeight = cb->constrainContentBoxLogicalHeightBy MinMax(contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight(), LayoutUnit( -1)); 2781 LayoutUnit contentBoxHeight = cb->constrainContentBoxLogicalHeightBy MinMax(contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight(), LayoutUnit( -1));
(...skipping 12 matching lines...) Expand all
2797 if (availableHeight == -1) 2794 if (availableHeight == -1)
2798 return availableHeight; 2795 return availableHeight;
2799 2796
2800 availableHeight -= rootMarginBorderPaddingHeight; 2797 availableHeight -= rootMarginBorderPaddingHeight;
2801 2798
2802 if (isTable() && isOutOfFlowPositioned()) 2799 if (isTable() && isOutOfFlowPositioned())
2803 availableHeight += cb->paddingLogicalHeight(); 2800 availableHeight += cb->paddingLogicalHeight();
2804 2801
2805 LayoutUnit result = valueForLength(height, availableHeight); 2802 LayoutUnit result = valueForLength(height, availableHeight);
2806 if (includeBorderPadding) { 2803 if (includeBorderPadding) {
2807 // TODO(rhogan) crbug.com/467378: Doing this for content inside tables c ells is wrong, it should fill 2804 // FIXME: Table cells should default to box-sizing: border-box so we can avoid this hack.
2808 // whatever height the cell makes available. 2805 // It is necessary to use the border-box to match WinIE's broken
2806 // box model. This is essential for sizing inside
2807 // table cells using percentage heights.
2809 result -= borderAndPaddingLogicalHeight(); 2808 result -= borderAndPaddingLogicalHeight();
2810 return std::max(LayoutUnit(), result); 2809 return std::max(LayoutUnit(), result);
2811 } 2810 }
2812 return result; 2811 return result;
2813 } 2812 }
2814 2813
2815 LayoutUnit LayoutBox::computeReplacedLogicalWidth(ShouldComputePreferred shouldC omputePreferred) const 2814 LayoutUnit LayoutBox::computeReplacedLogicalWidth(ShouldComputePreferred shouldC omputePreferred) const
2816 { 2815 {
2817 return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedLogic alWidthUsing(MainOrPreferredSize, style()->logicalWidth()), shouldComputePreferr ed); 2816 return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedLogic alWidthUsing(MainOrPreferredSize, style()->logicalWidth()), shouldComputePreferr ed);
2818 } 2817 }
(...skipping 2116 matching lines...) Expand 10 before | Expand all | Expand 10 after
4935 m_rareData->m_snapAreas->remove(&snapArea); 4934 m_rareData->m_snapAreas->remove(&snapArea);
4936 } 4935 }
4937 } 4936 }
4938 4937
4939 SnapAreaSet* LayoutBox::snapAreas() const 4938 SnapAreaSet* LayoutBox::snapAreas() const
4940 { 4939 {
4941 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr; 4940 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr;
4942 } 4941 }
4943 4942
4944 } // namespace blink 4943 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/platform/linux/tables/mozilla_expected_failures/bugs/bug32205-1-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698