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

Side by Side Diff: Source/core/rendering/RenderTable.cpp

Issue 185723005: Use correct container width as base for percentage margins. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added requested table test. Created 6 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 | « Source/core/rendering/RenderBox.cpp ('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 Apple Inc. All r ights reserved. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All r ights 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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 Length styleMinLogicalWidth = style()->logicalMinWidth(); 298 Length styleMinLogicalWidth = style()->logicalMinWidth();
299 if ((styleMinLogicalWidth.isSpecified() && !styleMinLogicalWidth.isNegative( )) || styleMinLogicalWidth.isIntrinsic()) { 299 if ((styleMinLogicalWidth.isSpecified() && !styleMinLogicalWidth.isNegative( )) || styleMinLogicalWidth.isIntrinsic()) {
300 LayoutUnit computedMinLogicalWidth = convertStyleLogicalWidthToComputedW idth(styleMinLogicalWidth, availableLogicalWidth); 300 LayoutUnit computedMinLogicalWidth = convertStyleLogicalWidthToComputedW idth(styleMinLogicalWidth, availableLogicalWidth);
301 setLogicalWidth(max<int>(logicalWidth(), computedMinLogicalWidth)); 301 setLogicalWidth(max<int>(logicalWidth(), computedMinLogicalWidth));
302 } 302 }
303 303
304 // Finally, with our true width determined, compute our margins for real. 304 // Finally, with our true width determined, compute our margins for real.
305 setMarginStart(0); 305 setMarginStart(0);
306 setMarginEnd(0); 306 setMarginEnd(0);
307 if (!hasPerpendicularContainingBlock) { 307 if (!hasPerpendicularContainingBlock) {
308 LayoutUnit containerLogicalWidthForAutoMargins = availableLogicalWidth;
309 if (avoidsFloats() && cb->containsFloats())
310 containerLogicalWidthForAutoMargins = containingBlockAvailableLineWi dth();
311 ComputedMarginValues marginValues; 308 ComputedMarginValues marginValues;
312 bool hasInvertedDirection = cb->style()->isLeftToRightDirection() == st yle()->isLeftToRightDirection(); 309 bool hasInvertedDirection = cb->style()->isLeftToRightDirection() == st yle()->isLeftToRightDirection();
313 computeInlineDirectionMargins(cb, containerLogicalWidthForAutoMargins, l ogicalWidth(), 310 computeInlineDirectionMargins(cb, availableLogicalWidth, logicalWidth(),
314 hasInvertedDirection ? marginValues.m_start : marginValues.m_end, 311 hasInvertedDirection ? marginValues.m_start : marginValues.m_end,
315 hasInvertedDirection ? marginValues.m_end : marginValues.m_start); 312 hasInvertedDirection ? marginValues.m_end : marginValues.m_start);
316 setMarginStart(marginValues.m_start); 313 setMarginStart(marginValues.m_start);
317 setMarginEnd(marginValues.m_end); 314 setMarginEnd(marginValues.m_end);
318 } else { 315 } else {
319 setMarginStart(minimumValueForLength(style()->marginStart(), availableLo gicalWidth)); 316 setMarginStart(minimumValueForLength(style()->marginStart(), availableLo gicalWidth));
320 setMarginEnd(minimumValueForLength(style()->marginEnd(), availableLogica lWidth)); 317 setMarginEnd(minimumValueForLength(style()->marginEnd(), availableLogica lWidth));
321 } 318 }
322 319
323 // We should NEVER shrink the table below the min-content logical width, or else the table can't accomodate 320 // We should NEVER shrink the table below the min-content logical width, or else the table can't accomodate
(...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1458 const BorderValue& RenderTable::tableEndBorderAdjoiningCell(const RenderTableCel l* cell) const 1455 const BorderValue& RenderTable::tableEndBorderAdjoiningCell(const RenderTableCel l* cell) const
1459 { 1456 {
1460 ASSERT(cell->isFirstOrLastCellInRow()); 1457 ASSERT(cell->isFirstOrLastCellInRow());
1461 if (hasSameDirectionAs(cell->row())) 1458 if (hasSameDirectionAs(cell->row()))
1462 return style()->borderEnd(); 1459 return style()->borderEnd();
1463 1460
1464 return style()->borderStart(); 1461 return style()->borderStart();
1465 } 1462 }
1466 1463
1467 } 1464 }
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBox.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698