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

Side by Side Diff: Source/core/svg/SVGHKernElement.cpp

Issue 18045006: Use toSVGFontElement() instead of static_cast<SVGFontElement*> (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed svg layout test Created 7 years, 5 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) 2007 Eric Seidel <eric@webkit.org> 2 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
3 * Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 * Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
4 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 27 matching lines...) Expand all
38 38
39 PassRefPtr<SVGHKernElement> SVGHKernElement::create(const QualifiedName& tagName , Document* document) 39 PassRefPtr<SVGHKernElement> SVGHKernElement::create(const QualifiedName& tagName , Document* document)
40 { 40 {
41 return adoptRef(new SVGHKernElement(tagName, document)); 41 return adoptRef(new SVGHKernElement(tagName, document));
42 } 42 }
43 43
44 Node::InsertionNotificationRequest SVGHKernElement::insertedInto(ContainerNode* rootParent) 44 Node::InsertionNotificationRequest SVGHKernElement::insertedInto(ContainerNode* rootParent)
45 { 45 {
46 ContainerNode* fontNode = parentNode(); 46 ContainerNode* fontNode = parentNode();
47 if (fontNode && fontNode->hasTagName(SVGNames::fontTag)) { 47 if (fontNode && fontNode->hasTagName(SVGNames::fontTag)) {
48 if (SVGFontElement* element = static_cast<SVGFontElement*>(fontNode)) 48 if (SVGFontElement* element = toSVGFontElement(fontNode))
tkent 2013/07/06 06:14:37 Ditto.
49 element->invalidateGlyphCache(); 49 element->invalidateGlyphCache();
50 } 50 }
51 51
52 return SVGElement::insertedInto(rootParent); 52 return SVGElement::insertedInto(rootParent);
53 } 53 }
54 54
55 void SVGHKernElement::removedFrom(ContainerNode* rootParent) 55 void SVGHKernElement::removedFrom(ContainerNode* rootParent)
56 { 56 {
57 ContainerNode* fontNode = parentNode(); 57 ContainerNode* fontNode = parentNode();
58 if (fontNode && fontNode->hasTagName(SVGNames::fontTag)) { 58 if (fontNode && fontNode->hasTagName(SVGNames::fontTag)) {
59 if (SVGFontElement* element = static_cast<SVGFontElement*>(fontNode)) 59 if (SVGFontElement* element = toSVGFontElement(fontNode))
tkent 2013/07/06 06:14:37 Ditto.
60 element->invalidateGlyphCache(); 60 element->invalidateGlyphCache();
61 } 61 }
62 62
63 SVGElement::removedFrom(rootParent); 63 SVGElement::removedFrom(rootParent);
64 } 64 }
65 65
66 void SVGHKernElement::buildHorizontalKerningPair(KerningPairVector& kerningPairs ) 66 void SVGHKernElement::buildHorizontalKerningPair(KerningPairVector& kerningPairs )
67 { 67 {
68 String u1 = fastGetAttribute(SVGNames::u1Attr); 68 String u1 = fastGetAttribute(SVGNames::u1Attr);
69 String g1 = fastGetAttribute(SVGNames::g1Attr); 69 String g1 = fastGetAttribute(SVGNames::g1Attr);
70 String u2 = fastGetAttribute(SVGNames::u2Attr); 70 String u2 = fastGetAttribute(SVGNames::u2Attr);
71 String g2 = fastGetAttribute(SVGNames::g2Attr); 71 String g2 = fastGetAttribute(SVGNames::g2Attr);
72 if ((u1.isEmpty() && g1.isEmpty()) || (u2.isEmpty() && g2.isEmpty())) 72 if ((u1.isEmpty() && g1.isEmpty()) || (u2.isEmpty() && g2.isEmpty()))
73 return; 73 return;
74 74
75 SVGKerningPair kerningPair; 75 SVGKerningPair kerningPair;
76 if (parseGlyphName(g1, kerningPair.glyphName1) 76 if (parseGlyphName(g1, kerningPair.glyphName1)
77 && parseGlyphName(g2, kerningPair.glyphName2) 77 && parseGlyphName(g2, kerningPair.glyphName2)
78 && parseKerningUnicodeString(u1, kerningPair.unicodeRange1, kerningPair. unicodeName1) 78 && parseKerningUnicodeString(u1, kerningPair.unicodeRange1, kerningPair. unicodeName1)
79 && parseKerningUnicodeString(u2, kerningPair.unicodeRange2, kerningPair. unicodeName2)) { 79 && parseKerningUnicodeString(u2, kerningPair.unicodeRange2, kerningPair. unicodeName2)) {
80 kerningPair.kerning = fastGetAttribute(SVGNames::kAttr).string().toFloat (); 80 kerningPair.kerning = fastGetAttribute(SVGNames::kAttr).string().toFloat ();
81 kerningPairs.append(kerningPair); 81 kerningPairs.append(kerningPair);
82 } 82 }
83 } 83 }
84 84
85 } 85 }
86 86
87 #endif // ENABLE(SVG_FONTS) 87 #endif // ENABLE(SVG_FONTS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698