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

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

Issue 298563002: Simplify Writing-Mode Related Calculation of Margins (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 6 years, 6 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 | Annotate | Revision Log
« 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, 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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 setLogicalWidth(max<int>(logicalWidth(), minPreferredLogicalWidth())); 295 setLogicalWidth(max<int>(logicalWidth(), minPreferredLogicalWidth()));
296 296
297 // Ensure we aren't smaller than our min-width style. 297 // Ensure we aren't smaller than our min-width style.
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 ComputedMarginValues marginValues;
306 setMarginEnd(0); 306 computeMarginsForDirection(InlineDirection, cb, availableLogicalWidth, logic alWidth(), marginValues.m_start, marginValues.m_end, style()->marginStart(), sty le()->marginEnd());
307 if (!hasPerpendicularContainingBlock) { 307 setMarginStart(marginValues.m_start);
308 ComputedMarginValues marginValues; 308 setMarginEnd(marginValues.m_end);
309 bool hasInvertedDirection = cb->style()->isLeftToRightDirection() == st yle()->isLeftToRightDirection();
310 computeInlineDirectionMargins(cb, availableLogicalWidth, logicalWidth(),
311 hasInvertedDirection ? marginValues.m_start : marginValues.m_end,
312 hasInvertedDirection ? marginValues.m_end : marginValues.m_start);
313 setMarginStart(marginValues.m_start);
314 setMarginEnd(marginValues.m_end);
315 } else {
316 setMarginStart(minimumValueForLength(style()->marginStart(), availableLo gicalWidth));
317 setMarginEnd(minimumValueForLength(style()->marginEnd(), availableLogica lWidth));
318 }
319 309
320 // We should NEVER shrink the table below the min-content logical width, or else the table can't accomodate 310 // We should NEVER shrink the table below the min-content logical width, or else the table can't accomodate
321 // its own content which doesn't match CSS nor what authors expect. 311 // its own content which doesn't match CSS nor what authors expect.
322 // FIXME: When we convert to sub-pixel layout for tables we can remove the i nt conversion 312 // FIXME: When we convert to sub-pixel layout for tables we can remove the i nt conversion
323 // https://code.google.com/p/chromium/issues/detail?id=241198 313 // https://code.google.com/p/chromium/issues/detail?id=241198
324 ASSERT(logicalWidth().toInt() >= minPreferredLogicalWidth().toInt()); 314 ASSERT(logicalWidth().toInt() >= minPreferredLogicalWidth().toInt());
325 } 315 }
326 316
327 // This method takes a RenderStyle's logical width, min-width, or max-width leng th and computes its actual value. 317 // This method takes a RenderStyle's logical width, min-width, or max-width leng th and computes its actual value.
328 LayoutUnit RenderTable::convertStyleLogicalWidthToComputedWidth(const Length& st yleLogicalWidth, LayoutUnit availableWidth) 318 LayoutUnit RenderTable::convertStyleLogicalWidthToComputedWidth(const Length& st yleLogicalWidth, LayoutUnit availableWidth)
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1453 const BorderValue& RenderTable::tableEndBorderAdjoiningCell(const RenderTableCel l* cell) const 1443 const BorderValue& RenderTable::tableEndBorderAdjoiningCell(const RenderTableCel l* cell) const
1454 { 1444 {
1455 ASSERT(cell->isFirstOrLastCellInRow()); 1445 ASSERT(cell->isFirstOrLastCellInRow());
1456 if (hasSameDirectionAs(cell->row())) 1446 if (hasSameDirectionAs(cell->row()))
1457 return style()->borderEnd(); 1447 return style()->borderEnd();
1458 1448
1459 return style()->borderStart(); 1449 return style()->borderStart();
1460 } 1450 }
1461 1451
1462 } 1452 }
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