Changeset 96139 in webkit
- Timestamp:
- Sep 27, 2011, 12:31:31 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r96138 r96139 1 2011-06-28 Robert Hogan <robert@webkit.org> 2 3 Reviewed by David Hyatt. 4 5 Replaced elements squeezed when width is specified as percentage inside a table with Auto layout 6 https://bugs.webkit.org/show_bug.cgi?id=29447 7 8 * fast/replaced/table-percent-width.html: Added. 9 * fast/replaced/table-percent-width-expected.txt: Added. 10 1 11 2011-09-27 Simon Fraser <simon.fraser@apple.com> 2 12 -
trunk/Source/WebCore/ChangeLog
r96138 r96139 1 2011-06-28 Robert Hogan <robert@webkit.org> 2 3 Reviewed by David Hyatt. 4 5 Replaced elements squeezed when width is specified as percentage inside a table with Auto layout 6 https://bugs.webkit.org/show_bug.cgi?id=29447 7 8 If inserting a 'replaced' element (e.g. image, plugin) in a table cell that is not descendant from 9 a block with fixed layout then do not squeeze the element, let it use its intrinsic width and height. 10 11 Test: fast/replaced/table-percent-width.html 12 13 * rendering/RenderBox.cpp: 14 (WebCore::avoidSqueezingWidth): 15 (WebCore::avoidSqueezingHeight): 16 (WebCore::RenderBox::containingBlockReplacedLogicalWidthForContent): 17 (WebCore::RenderBox::computeReplacedLogicalWidthUsing): 18 (WebCore::RenderBox::computeReplacedLogicalHeightUsing): 19 * rendering/RenderBox.h: 20 1 21 2011-09-27 Simon Fraser <simon.fraser@apple.com> 2 22 -
trunk/Source/WebCore/rendering/RenderBox.cpp
r95737 r96139 1217 1217 } 1218 1218 1219 static bool avoidSqueezingWidth(RenderBlock* cb) 1220 { 1221 while (cb && !cb->isRenderView()) { 1222 if (!cb->style()->logicalWidth().isAuto() && !cb->style()->logicalWidth().isPercent()) 1223 return false; 1224 cb = cb->containingBlock(); 1225 } 1226 return true; 1227 } 1228 1229 static bool avoidSqueezingHeight(RenderBlock* cb) 1230 { 1231 while (cb && !cb->isRenderView()) { 1232 if (!cb->style()->logicalHeight().isAuto() && !cb->style()->logicalHeight().isPercent()) 1233 return false; 1234 cb = cb->containingBlock(); 1235 } 1236 return true; 1237 } 1238 1239 int RenderBox::containingBlockReplacedLogicalWidthForContent() const 1240 { 1241 RenderBlock* cb = containingBlock(); 1242 // Don't let table cells squeeze percent-height replaced elements 1243 // <http://bugs.webkit.org/show_bug.cgi?id=29447> 1244 if (cb->isTableCell() && avoidSqueezingWidth(cb)) 1245 return max(shrinkToAvoidFloats() ? cb->availableLogicalWidthForLine(y(), false) : cb->availableLogicalWidth(), intrinsicLogicalWidth()); 1246 1247 return containingBlockLogicalWidthForContent(); 1248 } 1249 1219 1250 LayoutUnit RenderBox::containingBlockLogicalWidthForContent() const 1220 1251 { … … 2015 2046 // containing block's block-flow. 2016 2047 // https://bugs.webkit.org/show_bug.cgi?id=46496 2017 const LayoutUnit cw = isPositioned() ? containingBlockLogicalWidthForPositioned(toRenderBoxModelObject(container())) : containingBlock LogicalWidthForContent();2048 const LayoutUnit cw = isPositioned() ? containingBlockLogicalWidthForPositioned(toRenderBoxModelObject(container())) : containingBlockReplacedLogicalWidthForContent(); 2018 2049 if (cw > 0) 2019 2050 return computeContentBoxLogicalWidth(logicalWidth.calcMinValue(cw)); … … 2075 2106 // FIXME: This needs to be made block-flow-aware. If the cell and image are perpendicular block-flows, this isn't right. 2076 2107 // https://bugs.webkit.org/show_bug.cgi?id=46997 2077 while (cb && !cb->isRenderView() && (cb->style()->logicalHeight().isAuto() || cb->style()->logicalHeight().isPercent())) { 2078 if (cb->isTableCell()) { 2079 // Don't let table cells squeeze percent-height replaced elements 2080 // <http://bugs.webkit.org/show_bug.cgi?id=15359> 2081 availableHeight = max(availableHeight, intrinsicLogicalHeight()); 2082 return logicalHeight.calcValue(availableHeight - borderAndPaddingLogicalHeight()); 2083 } 2084 cb = cb->containingBlock(); 2108 if (cb->isTableCell() && avoidSqueezingHeight(toRenderBlock(cb))) { 2109 // Don't let table cells squeeze percent-height replaced elements 2110 // <http://bugs.webkit.org/show_bug.cgi?id=15359> 2111 availableHeight = max(availableHeight, intrinsicLogicalHeight()); 2112 return logicalHeight.calcValue(availableHeight - borderAndPaddingLogicalHeight()); 2085 2113 } 2086 2114 } -
trunk/Source/WebCore/rendering/RenderBox.h
r94912 r96139 286 286 virtual LayoutUnit containingBlockLogicalWidthForContent() const; 287 287 LayoutUnit perpendicularContainingBlockLogicalHeight() const; 288 int containingBlockReplacedLogicalWidthForContent() const; 288 289 289 290 virtual void computeLogicalWidth();
Note:
See TracChangeset
for help on using the changeset viewer.