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

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

Issue 2740063003: Revert of [table] Stretching tables when needed due to self-alignment properties (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutFullScreen.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 290
291 // Subtract out our margins to get the available content width. 291 // Subtract out our margins to get the available content width.
292 LayoutUnit availableContentLogicalWidth = 292 LayoutUnit availableContentLogicalWidth =
293 (containerWidthInInlineDirection - marginTotal).clampNegativeToZero(); 293 (containerWidthInInlineDirection - marginTotal).clampNegativeToZero();
294 if (shrinkToAvoidFloats() && cb->isLayoutBlockFlow() && 294 if (shrinkToAvoidFloats() && cb->isLayoutBlockFlow() &&
295 toLayoutBlockFlow(cb)->containsFloats() && 295 toLayoutBlockFlow(cb)->containsFloats() &&
296 !hasPerpendicularContainingBlock) 296 !hasPerpendicularContainingBlock)
297 availableContentLogicalWidth = shrinkLogicalWidthToAvoidFloats( 297 availableContentLogicalWidth = shrinkLogicalWidthToAvoidFloats(
298 marginStart, marginEnd, toLayoutBlockFlow(cb)); 298 marginStart, marginEnd, toLayoutBlockFlow(cb));
299 299
300 if (hasStretchedLogicalWidth()) { 300 // Ensure we aren't bigger than our available width.
301 setLogicalWidth(availableContentLogicalWidth); 301 LayoutUnit maxWidth = maxPreferredLogicalWidth();
302 } else { 302 // scaledWidthFromPercentColumns depends on m_layoutStruct in
303 // Ensure we aren't bigger than our available width. 303 // TableLayoutAlgorithmAuto, which maxPreferredLogicalWidth fills in. So
304 LayoutUnit maxWidth = maxPreferredLogicalWidth(); 304 // scaledWidthFromPercentColumns has to be called after
305 // scaledWidthFromPercentColumns depends on m_layoutStruct in 305 // maxPreferredLogicalWidth.
306 // TableLayoutAlgorithmAuto, which maxPreferredLogicalWidth fills in. So 306 LayoutUnit scaledWidth = m_tableLayout->scaledWidthFromPercentColumns() +
307 // scaledWidthFromPercentColumns has to be called after 307 bordersPaddingAndSpacingInRowDirection();
308 // maxPreferredLogicalWidth. 308 maxWidth = std::max(scaledWidth, maxWidth);
309 LayoutUnit scaledWidth = m_tableLayout->scaledWidthFromPercentColumns() + 309 setLogicalWidth(
310 bordersPaddingAndSpacingInRowDirection(); 310 LayoutUnit(std::min(availableContentLogicalWidth, maxWidth).floor()));
311 maxWidth = std::max(scaledWidth, maxWidth);
312 setLogicalWidth(
313 LayoutUnit(std::min(availableContentLogicalWidth, maxWidth).floor()));
314 }
315 } 311 }
316 312
317 // Ensure we aren't bigger than our max-width style. 313 // Ensure we aren't bigger than our max-width style.
318 Length styleMaxLogicalWidth = style()->logicalMaxWidth(); 314 Length styleMaxLogicalWidth = style()->logicalMaxWidth();
319 if ((styleMaxLogicalWidth.isSpecified() && 315 if ((styleMaxLogicalWidth.isSpecified() &&
320 !styleMaxLogicalWidth.isNegative()) || 316 !styleMaxLogicalWidth.isNegative()) ||
321 styleMaxLogicalWidth.isIntrinsic()) { 317 styleMaxLogicalWidth.isIntrinsic()) {
322 LayoutUnit computedMaxLogicalWidth = 318 LayoutUnit computedMaxLogicalWidth =
323 convertStyleLogicalWidthToComputedWidth(styleMaxLogicalWidth, 319 convertStyleLogicalWidthToComputedWidth(styleMaxLogicalWidth,
324 availableLogicalWidth); 320 availableLogicalWidth);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 if (neededLayout || tableHeightChanging == TableHeightChanging) 458 if (neededLayout || tableHeightChanging == TableHeightChanging)
463 section.setLogicalHeight(LayoutUnit(section.calcRowLogicalHeight())); 459 section.setLogicalHeight(LayoutUnit(section.calcRowLogicalHeight()));
464 460
465 if (view()->layoutState()->isPaginated()) 461 if (view()->layoutState()->isPaginated())
466 updateFragmentationInfoForChild(section); 462 updateFragmentationInfoForChild(section);
467 setLogicalHeight(logicalHeight() + section.logicalHeight()); 463 setLogicalHeight(logicalHeight() + section.logicalHeight());
468 } 464 }
469 465
470 LayoutUnit LayoutTable::logicalHeightFromStyle() const { 466 LayoutUnit LayoutTable::logicalHeightFromStyle() const {
471 LayoutUnit computedLogicalHeight; 467 LayoutUnit computedLogicalHeight;
472 if (hasOverrideLogicalContentHeight()) { 468 Length logicalHeightLength = style()->logicalHeight();
473 computedLogicalHeight = overrideLogicalContentHeight(); 469 if (logicalHeightLength.isIntrinsic() ||
474 } else { 470 (logicalHeightLength.isSpecified() && logicalHeightLength.isPositive())) {
475 Length logicalHeightLength = style()->logicalHeight(); 471 computedLogicalHeight =
476 if (logicalHeightLength.isIntrinsic() || 472 convertStyleLogicalHeightToComputedHeight(logicalHeightLength);
477 (logicalHeightLength.isSpecified() &&
478 logicalHeightLength.isPositive())) {
479 computedLogicalHeight =
480 convertStyleLogicalHeightToComputedHeight(logicalHeightLength);
481 }
482 } 473 }
483 474
484 Length logicalMaxHeightLength = style()->logicalMaxHeight(); 475 Length logicalMaxHeightLength = style()->logicalMaxHeight();
485 if (logicalMaxHeightLength.isIntrinsic() || 476 if (logicalMaxHeightLength.isIntrinsic() ||
486 (logicalMaxHeightLength.isSpecified() && 477 (logicalMaxHeightLength.isSpecified() &&
487 !logicalMaxHeightLength.isNegative())) { 478 !logicalMaxHeightLength.isNegative())) {
488 LayoutUnit computedMaxLogicalHeight = 479 LayoutUnit computedMaxLogicalHeight =
489 convertStyleLogicalHeightToComputedHeight(logicalMaxHeightLength); 480 convertStyleLogicalHeightToComputedHeight(logicalMaxHeightLength);
490 computedLogicalHeight = 481 computedLogicalHeight =
491 std::min(computedLogicalHeight, computedMaxLogicalHeight); 482 std::min(computedLogicalHeight, computedMaxLogicalHeight);
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1720 } 1711 }
1721 1712
1722 LayoutUnit LayoutTable::paddingRight() const { 1713 LayoutUnit LayoutTable::paddingRight() const {
1723 if (collapseBorders()) 1714 if (collapseBorders())
1724 return LayoutUnit(); 1715 return LayoutUnit();
1725 1716
1726 return LayoutBlock::paddingRight(); 1717 return LayoutBlock::paddingRight();
1727 } 1718 }
1728 1719
1729 } // namespace blink 1720 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutFullScreen.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698