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

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

Issue 861213003: Fix problems with flakes in SVG LayoutTests by reordering arithmetic. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rephrased comment. Created 5 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2010. 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 22 matching lines...) Expand all
33 SVGTextLayoutEngineBaseline::SVGTextLayoutEngineBaseline(const Font& font) 33 SVGTextLayoutEngineBaseline::SVGTextLayoutEngineBaseline(const Font& font)
34 : m_font(font) 34 : m_font(font)
35 { 35 {
36 } 36 }
37 37
38 float SVGTextLayoutEngineBaseline::calculateBaselineShift(const SVGRenderStyle& style, SVGElement* contextElement) const 38 float SVGTextLayoutEngineBaseline::calculateBaselineShift(const SVGRenderStyle& style, SVGElement* contextElement) const
39 { 39 {
40 if (style.baselineShift() == BS_LENGTH) { 40 if (style.baselineShift() == BS_LENGTH) {
41 RefPtrWillBeRawPtr<SVGLength> baselineShiftValueLength = style.baselineS hiftValue(); 41 RefPtrWillBeRawPtr<SVGLength> baselineShiftValueLength = style.baselineS hiftValue();
42 if (baselineShiftValueLength->unitType() == LengthTypePercentage) 42 if (baselineShiftValueLength->unitType() == LengthTypePercentage)
43 return baselineShiftValueLength->valueAsPercentage() * m_font.fontDe scription().computedPixelSize(); 43 return baselineShiftValueLength->scaleByPercentage(m_font.fontDescri ption().computedPixelSize());
44 44
45 SVGLengthContext lengthContext(contextElement); 45 SVGLengthContext lengthContext(contextElement);
46 return baselineShiftValueLength->value(lengthContext); 46 return baselineShiftValueLength->value(lengthContext);
47 } 47 }
48 48
49 switch (style.baselineShift()) { 49 switch (style.baselineShift()) {
50 case BS_BASELINE: 50 case BS_BASELINE:
51 return 0; 51 return 0;
52 case BS_SUB: 52 case BS_SUB:
53 return -m_font.fontMetrics().floatHeight() / 2; 53 return -m_font.fontMetrics().floatHeight() / 2;
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 xOrientationShift = metrics.width(); 222 xOrientationShift = metrics.width();
223 223
224 // Horizontal advance calculation. 224 // Horizontal advance calculation.
225 if (angle && !orientationIsMultiplyOf180Degrees) 225 if (angle && !orientationIsMultiplyOf180Degrees)
226 return metrics.height(); 226 return metrics.height();
227 227
228 return metrics.width(); 228 return metrics.width();
229 } 229 }
230 230
231 } 231 }
OLDNEW
« no previous file with comments | « LayoutTests/svg/filters/parent-children-with-same-filter-expected.txt ('k') | Source/core/svg/SVGLength.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698