Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: Source/core/rendering/svg/SVGTextMetrics.cpp

Issue 669633002: Revert of TextRun::length() should return an unsigned (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Source/core/rendering/svg/SVGTextMetricsBuilder.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) Research In Motion Limited 2010-2012. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2010-2012. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 } 43 }
44 44
45 SVGTextMetrics::SVGTextMetrics(RenderSVGInlineText* textRenderer, const TextRun& run) 45 SVGTextMetrics::SVGTextMetrics(RenderSVGInlineText* textRenderer, const TextRun& run)
46 { 46 {
47 ASSERT(textRenderer); 47 ASSERT(textRenderer);
48 48
49 float scalingFactor = textRenderer->scalingFactor(); 49 float scalingFactor = textRenderer->scalingFactor();
50 ASSERT(scalingFactor); 50 ASSERT(scalingFactor);
51 51
52 const Font& scaledFont = textRenderer->scaledFont(); 52 const Font& scaledFont = textRenderer->scaledFont();
53 m_length = 0; 53 int length = 0;
54 54
55 // Calculate width/height using the scaled font, divide this result by the s calingFactor afterwards. 55 // Calculate width/height using the scaled font, divide this result by the s calingFactor afterwards.
56 m_width = scaledFont.width(run, m_length, m_glyph) / scalingFactor; 56 m_width = scaledFont.width(run, length, m_glyph) / scalingFactor;
57 m_height = scaledFont.fontMetrics().floatHeight() / scalingFactor; 57 m_height = scaledFont.fontMetrics().floatHeight() / scalingFactor;
58
59 ASSERT(length >= 0);
60 m_length = static_cast<unsigned>(length);
58 } 61 }
59 62
60 TextRun SVGTextMetrics::constructTextRun(RenderSVGInlineText* text, unsigned pos ition, unsigned length) 63 TextRun SVGTextMetrics::constructTextRun(RenderSVGInlineText* text, unsigned pos ition, unsigned length)
61 { 64 {
62 ASSERT(text->style()); 65 ASSERT(text->style());
63 return constructTextRun(text, position, length, text->style()->direction()); 66 return constructTextRun(text, position, length, text->style()->direction());
64 } 67 }
65 68
66 TextRun SVGTextMetrics::constructTextRun(RenderSVGInlineText* text, unsigned pos ition, unsigned length, TextDirection textDirection) 69 TextRun SVGTextMetrics::constructTextRun(RenderSVGInlineText* text, unsigned pos ition, unsigned length, TextDirection textDirection)
67 { 70 {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 ASSERT(scalingFactor); 119 ASSERT(scalingFactor);
117 120
118 m_width = width / scalingFactor; 121 m_width = width / scalingFactor;
119 m_height = text->scaledFont().fontMetrics().floatHeight() / scalingFactor; 122 m_height = text->scaledFont().fontMetrics().floatHeight() / scalingFactor;
120 m_glyph = needsContext ? glyphNameGlyphId : 0; 123 m_glyph = needsContext ? glyphNameGlyphId : 0;
121 124
122 m_length = length; 125 m_length = length;
123 } 126 }
124 127
125 } 128 }
OLDNEW
« no previous file with comments | « no previous file | Source/core/rendering/svg/SVGTextMetricsBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698