Changeset 163165 in webkit
- Timestamp:
- Jan 31, 2014 12:09:07 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r163140 r163165 1 2014-01-31 László Langó <lango@inf.u-szeged.hu> 2 3 Fix table sizing when 'max-width' is used. 4 https://bugs.webkit.org/show_bug.cgi?id=115156 5 6 Reviewed by Andreas Kling. 7 8 * fast/table/css-table-max-width-expected.txt: 9 * fast/table/css-table-max-width.html: 10 * fast/table/html-table-width-max-width-constrained-expected.txt: Added. 11 * fast/table/html-table-width-max-width-constrained.html: Added. 12 1 13 2014-01-28 Timothy Hatcher <timothy@apple.com> 2 14 -
trunk/LayoutTests/fast/table/css-table-max-width-expected.txt
r130774 r163165 11 11 PASS minGreatThanMaxWidthAutoLayout.getBoundingClientRect().width is 202 12 12 PASS onlyMaxWidthAutoLayout.getBoundingClientRect().width is 202 13 PASS maxWidthZeroAutoLayout.getBoundingClientRect().width is 013 PASS maxWidthZeroAutoLayout.getBoundingClientRect().width is 182 14 14 PASS maxGreatThanMinWidthFixedLayout.getBoundingClientRect().width is 202 15 15 PASS minGreatThanMaxWidthFixedLayout.getBoundingClientRect().width is 202 16 16 PASS onlyMaxWidthFixedLayout.getBoundingClientRect().width is 202 17 PASS maxWidthZeroFixedLayout.getBoundingClientRect().width is 017 PASS maxWidthZeroFixedLayout.getBoundingClientRect().width is 2 18 18 PASS successfullyParsed is true 19 19 -
trunk/LayoutTests/fast/table/css-table-max-width.html
r155272 r163165 43 43 qui officia deserunt mollit anim id est laborum. 44 44 </div> 45 <div id="maxWidthZeroAutoLayout" class="child" style="display:table; max-width:0; width:100%; ">45 <div id="maxWidthZeroAutoLayout" class="child" style="display:table; max-width:0; width:100%; font: 10px/1 Ahem;"> 46 46 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod 47 47 tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, … … 98 98 shouldBe("onlyMaxWidthAutoLayout.getBoundingClientRect().width","202"); 99 99 maxWidthZeroAutoLayout = document.getElementById("maxWidthZeroAutoLayout"); 100 shouldBe("maxWidthZeroAutoLayout.getBoundingClientRect().width"," 0");100 shouldBe("maxWidthZeroAutoLayout.getBoundingClientRect().width","182"); 101 101 maxGreatThanMinWidthFixedLayout = document.getElementById("maxGreatThanMinWidthFixedLayout"); 102 102 shouldBe("maxGreatThanMinWidthFixedLayout.getBoundingClientRect().width","202"); … … 106 106 shouldBe("onlyMaxWidthFixedLayout.getBoundingClientRect().width","202"); 107 107 maxWidthZeroFixedLayout = document.getElementById("maxWidthZeroFixedLayout"); 108 shouldBe("maxWidthZeroFixedLayout.getBoundingClientRect().width"," 0");108 shouldBe("maxWidthZeroFixedLayout.getBoundingClientRect().width","2"); 109 109 110 110 document.body.removeChild(document.getElementById('container')); -
trunk/Source/WebCore/ChangeLog
r163160 r163165 1 2014-01-31 László Langó <lango@inf.u-szeged.hu> 2 3 Fix table sizing when 'max-width' is used. 4 https://bugs.webkit.org/show_bug.cgi?id=115156 5 6 Reviewed by Andreas Kling. 7 8 r143534 make <table> abide by 'max-width' all the time which is wrong. 9 Per the CSS specification, a table should be wide enough to fit its 10 content, regardless of 'max-width'. 11 12 r140479 fixed part of the regression from that change but made the 13 same fatal mistake by constraining min-content to fit 'max-width'. 14 15 The fix is to avoid constraining min-content and ensure that the table 16 logical width is at least its min-content size. 17 18 Backported from Blink: 19 https://chromium.googlesource.com/chromium/blink/+/0bca0dec4895aeeb2054ba36316e984e4ebed06f 20 21 Test: fast/table/html-table-width-max-width-constrained.html 22 23 * rendering/RenderTable.cpp: 24 (WebCore::RenderTable::updateLogicalWidth): 25 (WebCore::RenderTable::computePreferredLogicalWidths): 26 1 27 2014-01-30 Simon Fraser <simon.fraser@apple.com> 2 28 -
trunk/Source/WebCore/rendering/RenderTable.cpp
r163152 r163165 293 293 } 294 294 295 // Ensure we aren't smaller than our min preferred width.296 setLogicalWidth(std::max<int>(logicalWidth(), minPreferredLogicalWidth()));297 298 299 295 // Ensure we aren't bigger than our max-width style. 300 296 Length styleMaxLogicalWidth = style().logicalMaxWidth(); … … 303 299 setLogicalWidth(std::min<int>(logicalWidth(), computedMaxLogicalWidth)); 304 300 } 301 302 // Ensure we aren't smaller than our min preferred width. This MUST be done after 'max-width' as 303 // we ignore it if it means we wouldn't accomodate our content. 304 setLogicalWidth(std::max<int>(logicalWidth(), minPreferredLogicalWidth())); 305 305 306 306 // Ensure we aren't smaller than our min-width style. … … 329 329 setMarginEnd(minimumValueForLength(style().marginEnd(), availableLogicalWidth)); 330 330 } 331 332 // We should NEVER shrink the table below the min-content logical width, or else the table can't accomodate 333 // its own content which doesn't match CSS nor what authors expect. 334 ASSERT(logicalWidth() >= minPreferredLogicalWidth()); 331 335 } 332 336 … … 779 783 // FIXME: This should probably be checking for isSpecified since you should be able to use percentage, calc or viewport relative values for maxWidth. 780 784 if (styleToUse.logicalMaxWidth().isFixed()) { 785 // We don't constrain m_minPreferredLogicalWidth as the table should be at least the size of its min-content, regardless of 'max-width'. 781 786 m_maxPreferredLogicalWidth = std::min(m_maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMaxWidth().value())); 782 m_minPreferredLogicalWidth = std::m in(m_minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMaxWidth().value()));787 m_minPreferredLogicalWidth = std::max(m_minPreferredLogicalWidth, m_maxPreferredLogicalWidth); 783 788 } 784 789
Note: See TracChangeset
for help on using the changeset viewer.