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

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

Issue 112003003: [SVG] SVGLength{,List} migration to new SVG property impl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: revert aggressive svgAttributeChanged, add NeedsRebaseline Created 6 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 | Annotate | Revision Log
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 kerning *= m_font.size() / m_font.fontMetrics().unitsPerEm(); 75 kerning *= m_font.size() / m_font.fontMetrics().unitsPerEm();
76 return kerning; 76 return kerning;
77 #else 77 #else
78 return false; 78 return false;
79 #endif 79 #endif
80 } 80 }
81 81
82 float SVGTextLayoutEngineSpacing::calculateCSSKerningAndSpacing(const SVGRenderS tyle* style, SVGElement* contextElement, UChar currentCharacter) 82 float SVGTextLayoutEngineSpacing::calculateCSSKerningAndSpacing(const SVGRenderS tyle* style, SVGElement* contextElement, UChar currentCharacter)
83 { 83 {
84 float kerning = 0; 84 float kerning = 0;
85 SVGLength kerningLength = style->kerning(); 85 RefPtr<SVGLength> kerningLength = style->kerning();
86 if (kerningLength.unitType() == LengthTypePercentage) 86 if (kerningLength->unitType() == LengthTypePercentage)
87 kerning = kerningLength.valueAsPercentage() * m_font.pixelSize(); 87 kerning = kerningLength->valueAsPercentage() * m_font.pixelSize();
88 else { 88 else {
89 SVGLengthContext lengthContext(contextElement); 89 SVGLengthContext lengthContext(contextElement);
90 kerning = kerningLength.value(lengthContext); 90 kerning = kerningLength->value(lengthContext);
91 } 91 }
92 92
93 UChar lastCharacter = m_lastCharacter; 93 UChar lastCharacter = m_lastCharacter;
94 m_lastCharacter = currentCharacter; 94 m_lastCharacter = currentCharacter;
95 95
96 if (!kerning && !m_font.letterSpacing() && !m_font.wordSpacing()) 96 if (!kerning && !m_font.letterSpacing() && !m_font.wordSpacing())
97 return 0; 97 return 0;
98 98
99 float spacing = m_font.letterSpacing() + kerning; 99 float spacing = m_font.letterSpacing() + kerning;
100 if (currentCharacter && lastCharacter && m_font.wordSpacing()) { 100 if (currentCharacter && lastCharacter && m_font.wordSpacing()) {
101 if (Font::treatAsSpace(currentCharacter) && !Font::treatAsSpace(lastChar acter)) 101 if (Font::treatAsSpace(currentCharacter) && !Font::treatAsSpace(lastChar acter))
102 spacing += m_font.wordSpacing(); 102 spacing += m_font.wordSpacing();
103 } 103 }
104 104
105 return spacing; 105 return spacing;
106 } 106 }
107 107
108 } 108 }
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/SVGTextLayoutEngineBaseline.cpp ('k') | Source/core/svg/LinearGradientAttributes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698