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

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

Issue 2528253003: [table] Stretching tables when needed due to self-alignment properties (Closed)
Patch Set: Applied suggested changes. 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, 2007, 2008, 2009, 2010, 2013 Apple Inc. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 299
300 // Ensure we aren't bigger than our available width. 300 // Ensure we aren't bigger than our available width.
301 LayoutUnit maxWidth = maxPreferredLogicalWidth(); 301 LayoutUnit maxWidth = maxPreferredLogicalWidth();
302 // scaledWidthFromPercentColumns depends on m_layoutStruct in 302 // scaledWidthFromPercentColumns depends on m_layoutStruct in
303 // TableLayoutAlgorithmAuto, which maxPreferredLogicalWidth fills in. So 303 // TableLayoutAlgorithmAuto, which maxPreferredLogicalWidth fills in. So
304 // scaledWidthFromPercentColumns has to be called after 304 // scaledWidthFromPercentColumns has to be called after
305 // maxPreferredLogicalWidth. 305 // maxPreferredLogicalWidth.
306 LayoutUnit scaledWidth = m_tableLayout->scaledWidthFromPercentColumns() + 306 LayoutUnit scaledWidth = m_tableLayout->scaledWidthFromPercentColumns() +
307 bordersPaddingAndSpacingInRowDirection(); 307 bordersPaddingAndSpacingInRowDirection();
308 maxWidth = std::max(scaledWidth, maxWidth); 308 maxWidth = std::max(scaledWidth, maxWidth);
309 setLogicalWidth( 309 if (hasStretchedLogicalWidth()) {
dgrogan 2016/11/30 01:03:22 I don't know if this is the right behavior or not.
310 LayoutUnit(std::min(availableContentLogicalWidth, maxWidth).floor())); 310 setLogicalWidth(availableContentLogicalWidth);
311 } else {
312 setLogicalWidth(
313 LayoutUnit(std::min(availableContentLogicalWidth, maxWidth).floor()));
314 }
311 } 315 }
312 316
313 // Ensure we aren't bigger than our max-width style. 317 // Ensure we aren't bigger than our max-width style.
314 Length styleMaxLogicalWidth = style()->logicalMaxWidth(); 318 Length styleMaxLogicalWidth = style()->logicalMaxWidth();
315 if ((styleMaxLogicalWidth.isSpecified() && 319 if ((styleMaxLogicalWidth.isSpecified() &&
316 !styleMaxLogicalWidth.isNegative()) || 320 !styleMaxLogicalWidth.isNegative()) ||
317 styleMaxLogicalWidth.isIntrinsic()) { 321 styleMaxLogicalWidth.isIntrinsic()) {
318 LayoutUnit computedMaxLogicalWidth = 322 LayoutUnit computedMaxLogicalWidth =
319 convertStyleLogicalWidthToComputedWidth(styleMaxLogicalWidth, 323 convertStyleLogicalWidthToComputedWidth(styleMaxLogicalWidth,
320 availableLogicalWidth); 324 availableLogicalWidth);
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 section.layoutIfNeeded(); 458 section.layoutIfNeeded();
455 int sectionLogicalHeight = section.calcRowLogicalHeight(); 459 int sectionLogicalHeight = section.calcRowLogicalHeight();
456 section.setLogicalHeight(LayoutUnit(sectionLogicalHeight)); 460 section.setLogicalHeight(LayoutUnit(sectionLogicalHeight));
457 if (view()->layoutState()->isPaginated()) 461 if (view()->layoutState()->isPaginated())
458 updateFragmentationInfoForChild(section); 462 updateFragmentationInfoForChild(section);
459 setLogicalHeight(logicalHeight() + sectionLogicalHeight); 463 setLogicalHeight(logicalHeight() + sectionLogicalHeight);
460 } 464 }
461 465
462 LayoutUnit LayoutTable::logicalHeightFromStyle() const { 466 LayoutUnit LayoutTable::logicalHeightFromStyle() const {
463 LayoutUnit computedLogicalHeight; 467 LayoutUnit computedLogicalHeight;
464 Length logicalHeightLength = style()->logicalHeight(); 468 if (hasOverrideLogicalContentHeight()) {
465 if (logicalHeightLength.isIntrinsic() || 469 computedLogicalHeight = overrideLogicalContentHeight();
466 (logicalHeightLength.isSpecified() && logicalHeightLength.isPositive())) { 470 } else {
467 computedLogicalHeight = 471 Length logicalHeightLength = style()->logicalHeight();
468 convertStyleLogicalHeightToComputedHeight(logicalHeightLength); 472 if (logicalHeightLength.isIntrinsic() ||
473 (logicalHeightLength.isSpecified() &&
474 logicalHeightLength.isPositive())) {
475 computedLogicalHeight =
476 convertStyleLogicalHeightToComputedHeight(logicalHeightLength);
477 }
469 } 478 }
470 479
471 Length logicalMaxHeightLength = style()->logicalMaxHeight(); 480 Length logicalMaxHeightLength = style()->logicalMaxHeight();
472 if (logicalMaxHeightLength.isIntrinsic() || 481 if (logicalMaxHeightLength.isIntrinsic() ||
473 (logicalMaxHeightLength.isSpecified() && 482 (logicalMaxHeightLength.isSpecified() &&
474 !logicalMaxHeightLength.isNegative())) { 483 !logicalMaxHeightLength.isNegative())) {
475 LayoutUnit computedMaxLogicalHeight = 484 LayoutUnit computedMaxLogicalHeight =
476 convertStyleLogicalHeightToComputedHeight(logicalMaxHeightLength); 485 convertStyleLogicalHeightToComputedHeight(logicalMaxHeightLength);
477 computedLogicalHeight = 486 computedLogicalHeight =
478 std::min(computedLogicalHeight, computedMaxLogicalHeight); 487 std::min(computedLogicalHeight, computedMaxLogicalHeight);
(...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after
1696 } 1705 }
1697 1706
1698 LayoutUnit LayoutTable::paddingRight() const { 1707 LayoutUnit LayoutTable::paddingRight() const {
1699 if (collapseBorders()) 1708 if (collapseBorders())
1700 return LayoutUnit(); 1709 return LayoutUnit();
1701 1710
1702 return LayoutBlock::paddingRight(); 1711 return LayoutBlock::paddingRight();
1703 } 1712 }
1704 1713
1705 } // namespace blink 1714 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698