Changeset 213008 in webkit
- Timestamp:
- Feb 25, 2017, 2:18:23 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/text/fast-run-width-vs-slow-run-width-expected.html (added)
-
LayoutTests/fast/text/fast-run-width-vs-slow-run-width.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/platform/graphics/FontCascade.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r213006 r213008 1 2017-02-25 Zalan Bujtas <zalan@apple.com> 2 3 Text might wrap when its preferred logical width is used for sizing the containing block. 4 https://bugs.webkit.org/show_bug.cgi?id=168864 5 <rdar://problem/30690734> 6 7 Reviewed by Antti Koivisto. 8 9 * fast/text/fast-run-width-vs-slow-run-width-expected.html: Added. 10 * fast/text/fast-run-width-vs-slow-run-width.html: Added. 11 1 12 2017-02-25 Michael Catanzaro <mcatanzaro@igalia.com> 2 13 -
trunk/Source/WebCore/ChangeLog
r213007 r213008 1 2017-02-25 Zalan Bujtas <zalan@apple.com> 2 3 Text might wrap when its preferred logical width is used for sizing the containing block. 4 https://bugs.webkit.org/show_bug.cgi?id=168864 5 <rdar://problem/30690734> 6 7 Reviewed by Antti Koivisto. 8 9 In certain cases we end up measuring a text run in 2 different ways. 10 1. preferred width computation -> slow path FontCascade::width() 11 2. line breaking logic -> fast path FontCascade::widthForSimpleText() 12 13 FontCascade::width() and ::widthForSimpleText() might return different results for the same run even when 14 the individual glyph widths are measured to be the same. It's because they run diffrent set of 15 arithmetics on the float values and for certain values these arithmetics produce different results due to the floating point 16 precision. 17 Since RenderText::computePreferredLogicalWidths() currently forces us to use the slow path 18 (to retrieve fontfallback and glyph overflow information) the only alternative solution is to turn off the fast path 19 for all runs that have been already measured using the slow path (which would be just wasteful). 20 21 Test: fast/text/fast-run-width-vs-slow-run-width.html 22 23 * platform/graphics/FontCascade.cpp: 24 (WebCore::FontCascade::widthForSimpleText): Mimics WidthIterator::applyFontTransforms. Use the same set of arithmetics here. 25 1 26 2017-02-24 Simon Fraser <simon.fraser@apple.com> 2 27 -
trunk/Source/WebCore/platform/graphics/FontCascade.cpp
r212274 r213008 383 383 float FontCascade::widthForSimpleText(StringView text) const 384 384 { 385 if (text.isNull() || text.isEmpty()) 386 return 0; 385 387 ASSERT(codePath(TextRun(text)) != FontCascade::Complex); 386 388 float* cacheEntry = m_fonts->widthCache().add(text, std::numeric_limits<float>::quiet_NaN()); … … 410 412 if (hasKerningOrLigatures) { 411 413 font.applyTransforms(&glyphs[0], &advances[0], glyphs.size(), enableKerning(), requiresShaping()); 412 runWidth = 0; 414 // This is needed only to match the result of the slow path. Same glyph widths but different floating point arithmentics can 415 // produce different run width. 416 float runWidthDifferenceWithTransformApplied = -runWidth; 413 417 for (auto& advance : advances) 414 runWidth += advance.width(); 418 runWidthDifferenceWithTransformApplied += advance.width(); 419 runWidth += runWidthDifferenceWithTransformApplied; 415 420 } 416 421
Note:
See TracChangeset
for help on using the changeset viewer.