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

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

Issue 1921973005: [css tables] Don't pass table width increase due to % columns to parents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge ToT Created 4 years, 7 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, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights reserved. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights reserved.
8 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 LayoutUnit marginStart = minimumValueForLength(style()->marginStart(), a vailableLogicalWidth); 275 LayoutUnit marginStart = minimumValueForLength(style()->marginStart(), a vailableLogicalWidth);
276 LayoutUnit marginEnd = minimumValueForLength(style()->marginEnd(), avail ableLogicalWidth); 276 LayoutUnit marginEnd = minimumValueForLength(style()->marginEnd(), avail ableLogicalWidth);
277 LayoutUnit marginTotal = marginStart + marginEnd; 277 LayoutUnit marginTotal = marginStart + marginEnd;
278 278
279 // Subtract out our margins to get the available content width. 279 // Subtract out our margins to get the available content width.
280 LayoutUnit availableContentLogicalWidth = (containerWidthInInlineDirecti on - marginTotal).clampNegativeToZero(); 280 LayoutUnit availableContentLogicalWidth = (containerWidthInInlineDirecti on - marginTotal).clampNegativeToZero();
281 if (shrinkToAvoidFloats() && cb->isLayoutBlockFlow() && toLayoutBlockFlo w(cb)->containsFloats() && !hasPerpendicularContainingBlock) 281 if (shrinkToAvoidFloats() && cb->isLayoutBlockFlow() && toLayoutBlockFlo w(cb)->containsFloats() && !hasPerpendicularContainingBlock)
282 availableContentLogicalWidth = shrinkLogicalWidthToAvoidFloats(margi nStart, marginEnd, toLayoutBlockFlow(cb)); 282 availableContentLogicalWidth = shrinkLogicalWidthToAvoidFloats(margi nStart, marginEnd, toLayoutBlockFlow(cb));
283 283
284 // Ensure we aren't bigger than our available width. 284 // Ensure we aren't bigger than our available width.
285 setLogicalWidth(LayoutUnit(std::min(availableContentLogicalWidth, maxPre ferredLogicalWidth()).floor())); 285 LayoutUnit maxWidth = maxPreferredLogicalWidth();
286 // scaledWidthFromPercentColumns depends on m_layoutStruct in TableLayou tAlgorithmAuto, which
287 // maxPreferredLogicalWidth fills in. So scaledWidthFromPercentColumns h as to be called after
288 // maxPreferredLogicalWidth.
289 LayoutUnit scaledWidth = m_tableLayout->scaledWidthFromPercentColumns() + bordersPaddingAndSpacingInRowDirection();
290 maxWidth = std::max(scaledWidth, maxWidth);
291 setLogicalWidth(LayoutUnit(std::min(availableContentLogicalWidth, maxWid th).floor()));
286 } 292 }
287 293
288 // Ensure we aren't bigger than our max-width style. 294 // Ensure we aren't bigger than our max-width style.
289 Length styleMaxLogicalWidth = style()->logicalMaxWidth(); 295 Length styleMaxLogicalWidth = style()->logicalMaxWidth();
290 if ((styleMaxLogicalWidth.isSpecified() && !styleMaxLogicalWidth.isNegative( )) || styleMaxLogicalWidth.isIntrinsic()) { 296 if ((styleMaxLogicalWidth.isSpecified() && !styleMaxLogicalWidth.isNegative( )) || styleMaxLogicalWidth.isIntrinsic()) {
291 LayoutUnit computedMaxLogicalWidth = convertStyleLogicalWidthToComputedW idth(styleMaxLogicalWidth, availableLogicalWidth); 297 LayoutUnit computedMaxLogicalWidth = convertStyleLogicalWidthToComputedW idth(styleMaxLogicalWidth, availableLogicalWidth);
292 setLogicalWidth(LayoutUnit(std::min(logicalWidth(), computedMaxLogicalWi dth).floor())); 298 setLogicalWidth(LayoutUnit(std::min(logicalWidth(), computedMaxLogicalWi dth).floor()));
293 } 299 }
294 300
295 // Ensure we aren't smaller than our min preferred width. This MUST be done after 'max-width' as 301 // Ensure we aren't smaller than our min preferred width. This MUST be done after 'max-width' as
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after
1490 1496
1491 LayoutUnit LayoutTable::paddingRight() const 1497 LayoutUnit LayoutTable::paddingRight() const
1492 { 1498 {
1493 if (collapseBorders()) 1499 if (collapseBorders())
1494 return LayoutUnit(); 1500 return LayoutUnit();
1495 1501
1496 return LayoutBlock::paddingRight(); 1502 return LayoutBlock::paddingRight();
1497 } 1503 }
1498 1504
1499 } // namespace blink 1505 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698