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

Side by Side Diff: Source/WebCore/rendering/AutoTableLayout.cpp

Issue 10274014: Merge 114574 - REGRESSION(102040): Auto-table layout with percent width doesn't shrink-to-fit conte… (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1084/
Patch Set: Created 8 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
« no previous file with comments | « LayoutTests/fast/table/td-width-fifty-percent-regression-expected.html ('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) 2002 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2002 Lars Knoll (knoll@kde.org)
3 * (C) 2002 Dirk Mueller (mueller@kde.org) 3 * (C) 2002 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2003, 2006, 2008, 2010 Apple Inc. All rights reserved. 4 * Copyright (C) 2003, 2006, 2008, 2010 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License. 9 * version 2 of the License.
10 * 10 *
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 if (cellMinLogicalWidth > spanMinLogicalWidth) { 395 if (cellMinLogicalWidth > spanMinLogicalWidth) {
396 if (allColsAreFixed) { 396 if (allColsAreFixed) {
397 for (unsigned pos = effCol; fixedWidth > 0 && pos < lastCol; ++p os) { 397 for (unsigned pos = effCol; fixedWidth > 0 && pos < lastCol; ++p os) {
398 int cellLogicalWidth = max(m_layoutStruct[pos].effectiveMinL ogicalWidth, static_cast<int>(cellMinLogicalWidth * m_layoutStruct[pos].logicalW idth.value() / fixedWidth)); 398 int cellLogicalWidth = max(m_layoutStruct[pos].effectiveMinL ogicalWidth, static_cast<int>(cellMinLogicalWidth * m_layoutStruct[pos].logicalW idth.value() / fixedWidth));
399 fixedWidth -= m_layoutStruct[pos].logicalWidth.value(); 399 fixedWidth -= m_layoutStruct[pos].logicalWidth.value();
400 cellMinLogicalWidth -= cellLogicalWidth; 400 cellMinLogicalWidth -= cellLogicalWidth;
401 m_layoutStruct[pos].effectiveMinLogicalWidth = cellLogicalWi dth; 401 m_layoutStruct[pos].effectiveMinLogicalWidth = cellLogicalWi dth;
402 } 402 }
403 } else if (allColsArePercent) { 403 } else if (allColsArePercent) {
404 // In this case, we just split the colspan's min amd max widths following the percentage. 404 // In this case, we just split the colspan's min amd max widths following the percentage.
405 int allocatedMinLogicalWidth = 0;
406 float allocatedMaxLogicalWidth = 0;
405 for (unsigned pos = effCol; pos < lastCol; ++pos) { 407 for (unsigned pos = effCol; pos < lastCol; ++pos) {
406 ASSERT(m_layoutStruct[pos].logicalWidth.isPercent() || m_lay outStruct[pos].effectiveLogicalWidth.isPercent()); 408 ASSERT(m_layoutStruct[pos].logicalWidth.isPercent() || m_lay outStruct[pos].effectiveLogicalWidth.isPercent());
407 // |allColsArePercent| means that either the logicalWidth *o r* the effectiveLogicalWidth are percents, handle both of them here. 409 // |allColsArePercent| means that either the logicalWidth *o r* the effectiveLogicalWidth are percents, handle both of them here.
408 float percent = m_layoutStruct[pos].logicalWidth.isPercent() ? m_layoutStruct[pos].logicalWidth.percent() : m_layoutStruct[pos].effectiveLog icalWidth.percent(); 410 float percent = m_layoutStruct[pos].logicalWidth.isPercent() ? m_layoutStruct[pos].logicalWidth.percent() : m_layoutStruct[pos].effectiveLog icalWidth.percent();
409 m_layoutStruct[pos].effectiveMinLogicalWidth = max(m_layoutS truct[pos].effectiveMinLogicalWidth, static_cast<int>(percent * cellMinLogicalWi dth / totalPercent)); 411 int columnMinLogicalWidth = static_cast<int>(percent * cellM inLogicalWidth / totalPercent);
410 m_layoutStruct[pos].effectiveMaxLogicalWidth = percent * cel lMaxLogicalWidth / totalPercent; 412 float columnMaxLogicalWidth = percent * cellMaxLogicalWidth / totalPercent;
413 m_layoutStruct[pos].effectiveMinLogicalWidth = max(m_layoutS truct[pos].effectiveMinLogicalWidth, columnMinLogicalWidth);
414 m_layoutStruct[pos].effectiveMaxLogicalWidth = columnMaxLogi calWidth;
415 allocatedMinLogicalWidth += columnMinLogicalWidth;
416 allocatedMaxLogicalWidth += columnMaxLogicalWidth;
411 } 417 }
418 ASSERT(allocatedMinLogicalWidth <= cellMinLogicalWidth);
419 ASSERT(allocatedMaxLogicalWidth <= cellMaxLogicalWidth);
420 cellMinLogicalWidth -= allocatedMinLogicalWidth;
421 cellMaxLogicalWidth -= allocatedMaxLogicalWidth;
412 } else { 422 } else {
413 float remainingMaxLogicalWidth = spanMaxLogicalWidth; 423 float remainingMaxLogicalWidth = spanMaxLogicalWidth;
414 int remainingMinLogicalWidth = spanMinLogicalWidth; 424 int remainingMinLogicalWidth = spanMinLogicalWidth;
415 425
416 // Give min to variable first, to fixed second, and to others th ird. 426 // Give min to variable first, to fixed second, and to others th ird.
417 for (unsigned pos = effCol; remainingMaxLogicalWidth >= 0 && pos < lastCol; ++pos) { 427 for (unsigned pos = effCol; remainingMaxLogicalWidth >= 0 && pos < lastCol; ++pos) {
418 if (m_layoutStruct[pos].logicalWidth.isFixed() && haveAuto & & fixedWidth <= cellMinLogicalWidth) { 428 if (m_layoutStruct[pos].logicalWidth.isFixed() && haveAuto & & fixedWidth <= cellMinLogicalWidth) {
419 int colMinLogicalWidth = max<int>(m_layoutStruct[pos].ef fectiveMinLogicalWidth, m_layoutStruct[pos].logicalWidth.value()); 429 int colMinLogicalWidth = max<int>(m_layoutStruct[pos].ef fectiveMinLogicalWidth, m_layoutStruct[pos].logicalWidth.value());
420 fixedWidth -= m_layoutStruct[pos].logicalWidth.value(); 430 fixedWidth -= m_layoutStruct[pos].logicalWidth.value();
421 remainingMinLogicalWidth -= m_layoutStruct[pos].effectiv eMinLogicalWidth; 431 remainingMinLogicalWidth -= m_layoutStruct[pos].effectiv eMinLogicalWidth;
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 774
765 int pos = 0; 775 int pos = 0;
766 for (size_t i = 0; i < nEffCols; ++i) { 776 for (size_t i = 0; i < nEffCols; ++i) {
767 m_table->columnPositions()[i] = pos; 777 m_table->columnPositions()[i] = pos;
768 pos += m_layoutStruct[i].computedLogicalWidth + m_table->hBorderSpacing( ); 778 pos += m_layoutStruct[i].computedLogicalWidth + m_table->hBorderSpacing( );
769 } 779 }
770 m_table->columnPositions()[m_table->columnPositions().size() - 1] = pos; 780 m_table->columnPositions()[m_table->columnPositions().size() - 1] = pos;
771 } 781 }
772 782
773 } 783 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/table/td-width-fifty-percent-regression-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698