Changeset 159105 in webkit
- Timestamp:
- Nov 12, 2013, 6:44:37 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r159100 r159105 1 2013-11-12 Antti Koivisto <antti@apple.com> 2 3 Text on simple lines sometimes paints one pixel off 4 https://bugs.webkit.org/show_bug.cgi?id=124200 5 6 Reviewed by Andreas Kling. 7 8 * fast/text/line-runs-rounding-simple-lines-expected.html: Added. 9 * fast/text/line-runs-rounding-simple-lines.html: Added. 10 1 11 2013-11-12 Zan Dobersek <zdobersek@igalia.com> 2 12 -
trunk/Source/WebCore/ChangeLog
r159104 r159105 1 2013-11-12 Antti Koivisto <antti@apple.com> 2 3 Text on simple lines sometimes paints one pixel off 4 https://bugs.webkit.org/show_bug.cgi?id=124200 5 6 Reviewed by Andreas Kling. 7 8 Test: fast/text/line-runs-simple-lines.html 9 10 * rendering/SimpleLineLayout.cpp: 11 (WebCore::SimpleLineLayout::adjustRunOffsets): 12 13 Don't round on run construction time. 14 15 (WebCore::SimpleLineLayout::createTextRuns): 16 * rendering/SimpleLineLayoutResolver.h: 17 (WebCore::SimpleLineLayout::RunResolver::Run::rect): 18 19 Instead round when generating rects. 20 21 (WebCore::SimpleLineLayout::RunResolver::Run::baseline): 22 23 Provide the baseline (used by painting) as unrounded FloatPoint. 24 1 25 2013-11-11 Andreas Kling <akling@apple.com> 2 26 -
trunk/Source/WebCore/rendering/SimpleLineLayout.cpp
r159032 r159105 261 261 } 262 262 263 static void adjustRunOffsets(Vector<Run, 4>& lineRuns, ETextAlign textAlign, float lineWidth, float availableWidth) 264 { 265 float lineLeft = computeLineLeft(textAlign, availableWidth - lineWidth); 263 static void adjustRunOffsets(Vector<Run, 4>& lineRuns, float adjustment) 264 { 265 if (!adjustment) 266 return; 266 267 for (unsigned i = 0; i < lineRuns.size(); ++i) { 267 lineRuns[i].left = floor(lineLeft + lineRuns[i].left);268 lineRuns[i].right = ceil(lineLeft + lineRuns[i].right);268 lineRuns[i].left += adjustment; 269 lineRuns[i].right += adjustment; 269 270 } 270 271 } … … 382 383 lineRuns.last().isEndOfLine = true; 383 384 384 adjustRunOffsets(lineRuns, textAlign, lineWidth.committedWidth(), lineWidth.availableWidth()); 385 float lineLeft = computeLineLeft(textAlign, lineWidth.availableWidth() - lineWidth.committedWidth()); 386 adjustRunOffsets(lineRuns, lineLeft); 385 387 386 388 for (unsigned i = 0; i < lineRuns.size(); ++i) -
trunk/Source/WebCore/rendering/SimpleLineLayoutResolver.h
r159032 r159105 46 46 47 47 LayoutRect rect() const; 48 LayoutPoint baseline() const;48 FloatPoint baseline() const; 49 49 String text() const; 50 50 … … 131 131 auto& run = m_iterator.simpleRun(); 132 132 133 LayoutPoint linePosition( run.left, resolver.m_lineHeight * m_iterator.lineIndex() + resolver.m_baseline - resolver.m_ascent);134 LayoutSize lineSize( run.right - run.left, resolver.m_ascent + resolver.m_descent);133 LayoutPoint linePosition(floor(run.left), resolver.m_lineHeight * m_iterator.lineIndex() + resolver.m_baseline - resolver.m_ascent); 134 LayoutSize lineSize(ceil(run.right) - floor(run.left), resolver.m_ascent + resolver.m_descent); 135 135 return LayoutRect(linePosition + resolver.m_contentOffset, lineSize); 136 136 } 137 137 138 inline LayoutPoint RunResolver::Run::baseline() const138 inline FloatPoint RunResolver::Run::baseline() const 139 139 { 140 140 auto& resolver = m_iterator.resolver(); … … 142 142 143 143 float baselineY = resolver.m_lineHeight * m_iterator.lineIndex() + resolver.m_baseline; 144 return LayoutPoint(run.left, baselineY) + resolver.m_contentOffset;144 return FloatPoint(run.left, baselineY) + resolver.m_contentOffset; 145 145 } 146 146
Note:
See TracChangeset
for help on using the changeset viewer.