Changeset 125229 in webkit
- Timestamp:
- Aug 9, 2012 6:05:56 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r125215 r125229 1 2012-08-09 Julien Chaffraix <jchaffraix@webkit.org> 2 3 REGRESSION(r117339): cell in block-level table in inline-block are aligned with their last line box 4 https://bugs.webkit.org/show_bug.cgi?id=91137 5 6 Reviewed by Tony Chang. 7 8 * fast/table/anonymous-table-no-baseline-align-expected.html: Added. 9 * fast/table/anonymous-table-no-baseline-align.html: Added. 10 * fast/table/inline-table-in-inline-block-last-baseline-align-expected.html: Added. 11 * fast/table/inline-table-in-inline-block-last-baseline-align.html: Added. 12 1 13 2012-08-09 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r125222 r125229 1 2012-08-09 Julien Chaffraix <jchaffraix@webkit.org> 2 3 REGRESSION(r117339): cell in block-level table in inline-block are aligned with their last line box 4 https://bugs.webkit.org/show_bug.cgi?id=91137 5 6 Reviewed by Tony Chang. 7 8 Fixed the code to properly ignore any inline-table's baseline for the purpose of 'inline-block' baseline computation. 9 See http://lists.w3.org/Archives/Public/www-style/2012Jul/0721.html about the discussion. 10 11 While touching the code, properly fixed the table baseline logic that was wrong because it wrongly piggy-backed 12 on the inline-block baseline logic. 13 14 Tests: fast/table/anonymous-table-no-baseline-align.html 15 fast/table/inline-table-in-inline-block-last-baseline-align.html 16 17 * rendering/RenderTable.cpp: 18 (WebCore::RenderTable::baselinePosition): 19 Overrode this function: this is needed as RenderBlock assumes that isReplaced() == true 20 means it is handling an inline-block, not a table. 21 22 (WebCore::RenderTable::lastLineBoxBaseline): 23 Table are ignored for the purpose of inline-block baseline determination. 24 25 (WebCore::RenderTable::firstLineBoxBaseline): 26 Inlined the code from getLineBoxBaseline. Added some comments to explain 27 why this code works as expected in the 'table' case. 28 29 * rendering/RenderTable.h: 30 Added baselinePosition. 31 1 32 2012-08-09 Adam Barth <abarth@webkit.org> 2 33 -
trunk/Source/WebCore/rendering/RenderTable.cpp
r123779 r125229 1207 1207 } 1208 1208 1209 enum LineBox { FirstLineBox, LastLineBox }; 1210 1211 static LayoutUnit getLineBoxBaseline(const RenderTable* table, LineBox lineBox) 1212 { 1213 if (table->isWritingModeRoot()) 1209 LayoutUnit RenderTable::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const 1210 { 1211 LayoutUnit baseline = firstLineBoxBaseline(); 1212 if (baseline != -1) 1213 return baseline; 1214 1215 return RenderBox::baselinePosition(baselineType, firstLine, direction, linePositionMode); 1216 } 1217 1218 LayoutUnit RenderTable::lastLineBoxBaseline() const 1219 { 1220 // Tables don't contribute their baseline towards the computation of an inline-block's baseline. 1221 return -1; 1222 } 1223 1224 LayoutUnit RenderTable::firstLineBoxBaseline() const 1225 { 1226 // The baseline of a 'table' is the same as the 'inline-table' baseline per CSS 3 Flexbox (CSS 2.1 1227 // doesn't define the baseline of a 'table' only an 'inline-table'). 1228 // This is also needed to properly determine the baseline of a cell if it has a table child. 1229 1230 if (isWritingModeRoot()) 1214 1231 return -1; 1215 1232 1216 table->recalcSectionsIfNeeded();1217 1218 const RenderTableSection* topNonEmptySection = t able->topNonEmptySection();1233 recalcSectionsIfNeeded(); 1234 1235 const RenderTableSection* topNonEmptySection = this->topNonEmptySection(); 1219 1236 if (!topNonEmptySection) 1220 1237 return -1; … … 1224 1241 return topNonEmptySection->logicalTop() + baseline; 1225 1242 1226 // The 'first' linebox baseline in a table in the absence of any text in the first section 1227 // is the top of the table. 1228 if (lineBox == FirstLineBox) 1229 return topNonEmptySection->logicalTop(); 1230 1231 // The 'last' linebox baseline in a table is the baseline of text in the first 1232 // cell in the first row/section, so if there is no text do not return a baseline. 1243 // FIXME: A table row always has a baseline per CSS 2.1. Will this return the right value? 1233 1244 return -1; 1234 }1235 1236 LayoutUnit RenderTable::lastLineBoxBaseline() const1237 {1238 return getLineBoxBaseline(this, LastLineBox);1239 }1240 1241 LayoutUnit RenderTable::firstLineBoxBaseline() const1242 {1243 return getLineBoxBaseline(this, FirstLineBox);1244 1245 } 1245 1246 -
trunk/Source/WebCore/rendering/RenderTable.h
r123062 r125229 252 252 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestPoint& pointInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) OVERRIDE; 253 253 254 virtual LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const OVERRIDE; 254 255 virtual LayoutUnit firstLineBoxBaseline() const OVERRIDE; 255 256 virtual LayoutUnit lastLineBoxBaseline() const OVERRIDE;
Note: See TracChangeset
for help on using the changeset viewer.