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

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

Issue 2535173006: Percent height border-box content should get correct height in percent height cells (Closed)
Patch Set: bug 669867 Created 4 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
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 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 1104
1105 int remainingExtraLogicalHeight = extraLogicalHeight; 1105 int remainingExtraLogicalHeight = extraLogicalHeight;
1106 distributeExtraLogicalHeightToPercentRows(remainingExtraLogicalHeight, 1106 distributeExtraLogicalHeightToPercentRows(remainingExtraLogicalHeight,
1107 totalPercent); 1107 totalPercent);
1108 distributeExtraLogicalHeightToAutoRows(remainingExtraLogicalHeight, 1108 distributeExtraLogicalHeightToAutoRows(remainingExtraLogicalHeight,
1109 autoRowsCount); 1109 autoRowsCount);
1110 distributeRemainingExtraLogicalHeight(remainingExtraLogicalHeight); 1110 distributeRemainingExtraLogicalHeight(remainingExtraLogicalHeight);
1111 return extraLogicalHeight - remainingExtraLogicalHeight; 1111 return extraLogicalHeight - remainingExtraLogicalHeight;
1112 } 1112 }
1113 1113
1114 static bool shouldFlexCellChild(LayoutObject* cellDescendant) { 1114 static bool shouldFlexCellChild(const LayoutTableCell& cell,
1115 return cellDescendant->isAtomicInlineLevel() || 1115 LayoutObject* cellDescendant) {
1116 (cellDescendant->isBox() && 1116 if (!cell.style()->logicalHeight().isSpecified())
1117 toLayoutBox(cellDescendant)->style()->overflowY() != 1117 return false;
1118 OverflowVisible && 1118 if (cellDescendant->isAtomicInlineLevel())
1119 toLayoutBox(cellDescendant)->style()->overflowY() != OverflowHidden); 1119 return true;
1120 if (cellDescendant->style()->overflowY() == OverflowVisible ||
1121 cellDescendant->style()->overflowY() == OverflowHidden)
1122 return true;
1123 Node* node = cellDescendant->node();
1124 return node && node->isElementNode() &&
1125 (toElement(node)->isFormControlElement() ||
1126 isHTMLImageElement(toElement(node)));
1120 } 1127 }
1121 1128
1122 void LayoutTableSection::layoutRows() { 1129 void LayoutTableSection::layoutRows() {
1123 #if DCHECK_IS_ON() 1130 #if DCHECK_IS_ON()
1124 SetLayoutNeededForbiddenScope layoutForbiddenScope(*this); 1131 SetLayoutNeededForbiddenScope layoutForbiddenScope(*this);
1125 #endif 1132 #endif
1126 1133
1127 ASSERT(!needsLayout()); 1134 ASSERT(!needsLayout());
1128 1135
1129 LayoutAnalyzer::Scope analyzer(*this); 1136 LayoutAnalyzer::Scope analyzer(*this);
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after
1895 // can't hope to match the behavior perfectly, but we'll continue to refine it 1902 // can't hope to match the behavior perfectly, but we'll continue to refine it
1896 // as we discover new bugs. :) 1903 // as we discover new bugs. :)
1897 bool cellChildrenFlex = false; 1904 bool cellChildrenFlex = false;
1898 bool flexAllChildren = cell.style()->logicalHeight().isSpecified() || 1905 bool flexAllChildren = cell.style()->logicalHeight().isSpecified() ||
1899 (!table()->style()->logicalHeight().isAuto() && 1906 (!table()->style()->logicalHeight().isAuto() &&
1900 rowHeight != cell.logicalHeight()); 1907 rowHeight != cell.logicalHeight());
1901 1908
1902 for (LayoutObject* child = cell.firstChild(); child; 1909 for (LayoutObject* child = cell.firstChild(); child;
1903 child = child->nextSibling()) { 1910 child = child->nextSibling()) {
1904 if (!child->isText() && child->style()->logicalHeight().isPercentOrCalc() && 1911 if (!child->isText() && child->style()->logicalHeight().isPercentOrCalc() &&
1905 (flexAllChildren || shouldFlexCellChild(child)) && 1912 (flexAllChildren || shouldFlexCellChild(cell, child)) &&
1906 (!child->isTable() || toLayoutTable(child)->hasSections())) { 1913 (!child->isTable() || toLayoutTable(child)->hasSections())) {
1907 cellChildrenFlex = true; 1914 cellChildrenFlex = true;
1908 break; 1915 break;
1909 } 1916 }
1910 } 1917 }
1911 1918
1912 if (!cellChildrenFlex) { 1919 if (!cellChildrenFlex) {
1913 if (TrackedLayoutBoxListHashSet* percentHeightDescendants = 1920 if (TrackedLayoutBoxListHashSet* percentHeightDescendants =
1914 cell.percentHeightDescendants()) { 1921 cell.percentHeightDescendants()) {
1915 for (auto* descendant : *percentHeightDescendants) { 1922 for (auto* descendant : *percentHeightDescendants) {
1916 if (flexAllChildren || shouldFlexCellChild(descendant)) { 1923 if (flexAllChildren || shouldFlexCellChild(cell, descendant)) {
1917 cellChildrenFlex = true; 1924 cellChildrenFlex = true;
1918 break; 1925 break;
1919 } 1926 }
1920 } 1927 }
1921 } 1928 }
1922 } 1929 }
1923 1930
1924 if (!cellChildrenFlex) 1931 if (!cellChildrenFlex)
1925 return; 1932 return;
1926 1933
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
2082 // the header in all columns. 2089 // the header in all columns.
2083 // Note that this is in flow thread coordinates, not visual coordinates. The 2090 // Note that this is in flow thread coordinates, not visual coordinates. The
2084 // enclosing LayoutFlowThread will convert to visual coordinates. 2091 // enclosing LayoutFlowThread will convert to visual coordinates.
2085 if (table()->header() == this && isRepeatingHeaderGroup()) 2092 if (table()->header() == this && isRepeatingHeaderGroup())
2086 rect.setHeight(table()->logicalHeight()); 2093 rect.setHeight(table()->logicalHeight());
2087 return LayoutTableBoxComponent::mapToVisualRectInAncestorSpace(ancestor, rect, 2094 return LayoutTableBoxComponent::mapToVisualRectInAncestorSpace(ancestor, rect,
2088 flags); 2095 flags);
2089 } 2096 }
2090 2097
2091 } // namespace blink 2098 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698