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

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: 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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // 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 = hasStretchedLogicalWidth()
302 ? availableContentLogicalWidth
mstensho (USE GERRIT) 2016/11/28 12:54:31 Skipping maxPreferredLogicalWidth() here seems wro
jfernandez 2016/11/29 16:03:33 Done.
303 : maxPreferredLogicalWidth();
302 // scaledWidthFromPercentColumns depends on m_layoutStruct in 304 // scaledWidthFromPercentColumns depends on m_layoutStruct in
303 // TableLayoutAlgorithmAuto, which maxPreferredLogicalWidth fills in. So 305 // TableLayoutAlgorithmAuto, which maxPreferredLogicalWidth fills in. So
304 // scaledWidthFromPercentColumns has to be called after 306 // scaledWidthFromPercentColumns has to be called after
305 // maxPreferredLogicalWidth. 307 // maxPreferredLogicalWidth.
306 LayoutUnit scaledWidth = m_tableLayout->scaledWidthFromPercentColumns() + 308 LayoutUnit scaledWidth = m_tableLayout->scaledWidthFromPercentColumns() +
307 bordersPaddingAndSpacingInRowDirection(); 309 bordersPaddingAndSpacingInRowDirection();
308 maxWidth = std::max(scaledWidth, maxWidth); 310 maxWidth = std::max(scaledWidth, maxWidth);
309 setLogicalWidth( 311 setLogicalWidth(
310 LayoutUnit(std::min(availableContentLogicalWidth, maxWidth).floor())); 312 LayoutUnit(std::min(availableContentLogicalWidth, maxWidth).floor()));
311 } 313 }
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 section.layoutIfNeeded(); 456 section.layoutIfNeeded();
455 int sectionLogicalHeight = section.calcRowLogicalHeight(); 457 int sectionLogicalHeight = section.calcRowLogicalHeight();
456 section.setLogicalHeight(LayoutUnit(sectionLogicalHeight)); 458 section.setLogicalHeight(LayoutUnit(sectionLogicalHeight));
457 if (view()->layoutState()->isPaginated()) 459 if (view()->layoutState()->isPaginated())
458 updateFragmentationInfoForChild(section); 460 updateFragmentationInfoForChild(section);
459 setLogicalHeight(logicalHeight() + sectionLogicalHeight); 461 setLogicalHeight(logicalHeight() + sectionLogicalHeight);
460 } 462 }
461 463
462 LayoutUnit LayoutTable::logicalHeightFromStyle() const { 464 LayoutUnit LayoutTable::logicalHeightFromStyle() const {
463 LayoutUnit computedLogicalHeight; 465 LayoutUnit computedLogicalHeight;
464 Length logicalHeightLength = style()->logicalHeight(); 466 if (hasOverrideLogicalContentHeight()) {
465 if (logicalHeightLength.isIntrinsic() || 467 computedLogicalHeight = overrideLogicalContentHeight();
466 (logicalHeightLength.isSpecified() && logicalHeightLength.isPositive())) { 468 } else {
467 computedLogicalHeight = 469 Length logicalHeightLength = style()->logicalHeight();
468 convertStyleLogicalHeightToComputedHeight(logicalHeightLength); 470 if (logicalHeightLength.isIntrinsic() ||
471 (logicalHeightLength.isSpecified() &&
472 logicalHeightLength.isPositive())) {
473 computedLogicalHeight =
474 convertStyleLogicalHeightToComputedHeight(logicalHeightLength);
475 }
469 } 476 }
470 477
471 Length logicalMaxHeightLength = style()->logicalMaxHeight(); 478 Length logicalMaxHeightLength = style()->logicalMaxHeight();
472 if (logicalMaxHeightLength.isIntrinsic() || 479 if (logicalMaxHeightLength.isIntrinsic() ||
473 (logicalMaxHeightLength.isSpecified() && 480 (logicalMaxHeightLength.isSpecified() &&
474 !logicalMaxHeightLength.isNegative())) { 481 !logicalMaxHeightLength.isNegative())) {
475 LayoutUnit computedMaxLogicalHeight = 482 LayoutUnit computedMaxLogicalHeight =
476 convertStyleLogicalHeightToComputedHeight(logicalMaxHeightLength); 483 convertStyleLogicalHeightToComputedHeight(logicalMaxHeightLength);
477 computedLogicalHeight = 484 computedLogicalHeight =
478 std::min(computedLogicalHeight, computedMaxLogicalHeight); 485 std::min(computedLogicalHeight, computedMaxLogicalHeight);
(...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after
1696 } 1703 }
1697 1704
1698 LayoutUnit LayoutTable::paddingRight() const { 1705 LayoutUnit LayoutTable::paddingRight() const {
1699 if (collapseBorders()) 1706 if (collapseBorders())
1700 return LayoutUnit(); 1707 return LayoutUnit();
1701 1708
1702 return LayoutBlock::paddingRight(); 1709 return LayoutBlock::paddingRight();
1703 } 1710 }
1704 1711
1705 } // namespace blink 1712 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698