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

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

Issue 2816313002: Treat cells with percent height as auto if their container depends on content height (Closed)
Patch Set: bug 687551 Created 3 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) 1997 Martin Jones (mjones@kde.org) 2 * Copyright (C) 1997 Martin Jones (mjones@kde.org)
3 * (C) 1997 Torben Weis (weis@kde.org) 3 * (C) 1997 Torben Weis (weis@kde.org)
4 * (C) 1998 Waldo Bastian (bastian@kde.org) 4 * (C) 1998 Waldo Bastian (bastian@kde.org)
5 * (C) 1999 Lars Knoll (knoll@kde.org) 5 * (C) 1999 Lars Knoll (knoll@kde.org)
6 * (C) 1999 Antti Koivisto (koivisto@kde.org) 6 * (C) 1999 Antti Koivisto (koivisto@kde.org)
7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2013 Apple Inc. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2013 Apple Inc.
8 * All rights reserved. 8 * All rights reserved.
9 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) 9 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
10 * 10 *
(...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 1107
1108 int remaining_extra_logical_height = extra_logical_height; 1108 int remaining_extra_logical_height = extra_logical_height;
1109 DistributeExtraLogicalHeightToPercentRows(remaining_extra_logical_height, 1109 DistributeExtraLogicalHeightToPercentRows(remaining_extra_logical_height,
1110 total_percent); 1110 total_percent);
1111 DistributeExtraLogicalHeightToAutoRows(remaining_extra_logical_height, 1111 DistributeExtraLogicalHeightToAutoRows(remaining_extra_logical_height,
1112 auto_rows_count); 1112 auto_rows_count);
1113 DistributeRemainingExtraLogicalHeight(remaining_extra_logical_height); 1113 DistributeRemainingExtraLogicalHeight(remaining_extra_logical_height);
1114 return extra_logical_height - remaining_extra_logical_height; 1114 return extra_logical_height - remaining_extra_logical_height;
1115 } 1115 }
1116 1116
1117 bool CellHasExplicitlySpecifiedHeight(const LayoutTableCell& cell) {
1118 if (cell.Style()->LogicalHeight().IsFixed())
1119 return true;
1120 LayoutBlock* cb = cell.ContainingBlock();
1121 if (cb->AvailableLogicalHeightForPercentageComputation() == -1)
1122 return false;
1123 return true;
1124 }
1125
1117 static bool ShouldFlexCellChild(const LayoutTableCell& cell, 1126 static bool ShouldFlexCellChild(const LayoutTableCell& cell,
1118 LayoutObject* cell_descendant) { 1127 LayoutObject* cell_descendant) {
1119 if (!cell.Style()->LogicalHeight().IsSpecified()) 1128 if (!CellHasExplicitlySpecifiedHeight(cell))
1120 return false; 1129 return false;
1121 if (cell_descendant->Style()->OverflowY() == EOverflow::kVisible || 1130 if (cell_descendant->Style()->OverflowY() == EOverflow::kVisible ||
1122 cell_descendant->Style()->OverflowY() == EOverflow::kHidden) 1131 cell_descendant->Style()->OverflowY() == EOverflow::kHidden)
1123 return true; 1132 return true;
1124 return cell_descendant->IsBox() && 1133 return cell_descendant->IsBox() &&
1125 ToLayoutBox(cell_descendant)->ShouldBeConsideredAsReplaced(); 1134 ToLayoutBox(cell_descendant)->ShouldBeConsideredAsReplaced();
1126 } 1135 }
1127 1136
1128 void LayoutTableSection::LayoutRows() { 1137 void LayoutTableSection::LayoutRows() {
1129 #if DCHECK_IS_ON() 1138 #if DCHECK_IS_ON()
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
1954 // do, but it will clip the cells that spill out of the table section. 1963 // do, but it will clip the cells that spill out of the table section.
1955 // strict mode, Mozilla and WinIE both regrow the table to accommodate the 1964 // strict mode, Mozilla and WinIE both regrow the table to accommodate the
1956 // new height of the cell (thus letting the percentages cause growth one 1965 // new height of the cell (thus letting the percentages cause growth one
1957 // time only). We may also not be handling row-spanning cells correctly. 1966 // time only). We may also not be handling row-spanning cells correctly.
1958 // 1967 //
1959 // Note also the oddity where replaced elements always flex, and yet blocks/ 1968 // Note also the oddity where replaced elements always flex, and yet blocks/
1960 // tables do not necessarily flex. WinIE is crazy and inconsistent, and we 1969 // tables do not necessarily flex. WinIE is crazy and inconsistent, and we
1961 // can't hope to match the behavior perfectly, but we'll continue to refine it 1970 // can't hope to match the behavior perfectly, but we'll continue to refine it
1962 // as we discover new bugs. :) 1971 // as we discover new bugs. :)
1963 bool cell_children_flex = false; 1972 bool cell_children_flex = false;
1964 bool flex_all_children = cell.Style()->LogicalHeight().IsSpecified() || 1973 bool flex_all_children = CellHasExplicitlySpecifiedHeight(cell) ||
1965 (!Table()->Style()->LogicalHeight().IsAuto() && 1974 (!Table()->Style()->LogicalHeight().IsAuto() &&
1966 row_height != cell.LogicalHeight()); 1975 row_height != cell.LogicalHeight());
1967 1976
1968 for (LayoutObject* child = cell.FirstChild(); child; 1977 for (LayoutObject* child = cell.FirstChild(); child;
1969 child = child->NextSibling()) { 1978 child = child->NextSibling()) {
1970 if (!child->IsText() && child->Style()->LogicalHeight().IsPercentOrCalc() && 1979 if (!child->IsText() && child->Style()->LogicalHeight().IsPercentOrCalc() &&
1971 (flex_all_children || ShouldFlexCellChild(cell, child)) && 1980 (flex_all_children || ShouldFlexCellChild(cell, child)) &&
1972 (!child->IsTable() || ToLayoutTable(child)->HasSections())) { 1981 (!child->IsTable() || ToLayoutTable(child)->HasSections())) {
1973 cell_children_flex = true; 1982 cell_children_flex = true;
1974 break; 1983 break;
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
2158 bool LayoutTableSection::PaintedOutputOfObjectHasNoEffectRegardlessOfSize() 2167 bool LayoutTableSection::PaintedOutputOfObjectHasNoEffectRegardlessOfSize()
2159 const { 2168 const {
2160 // LayoutTableSection paints background from columns. 2169 // LayoutTableSection paints background from columns.
2161 if (Table()->HasColElements()) 2170 if (Table()->HasColElements())
2162 return false; 2171 return false;
2163 return LayoutTableBoxComponent:: 2172 return LayoutTableBoxComponent::
2164 PaintedOutputOfObjectHasNoEffectRegardlessOfSize(); 2173 PaintedOutputOfObjectHasNoEffectRegardlessOfSize();
2165 } 2174 }
2166 2175
2167 } // namespace blink 2176 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/platform/win/tables/mozilla_expected_failures/bugs/bug32205-4-expected.png ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698