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

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

Issue 18045006: Use toSVGFontElement() instead of static_cast<SVGFontElement*> (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
« no previous file with comments | « Source/core/svg/SVGHKernElement.cpp ('k') | no next file » | 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. 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 26 matching lines...) Expand all
37 37
38 PassRefPtr<SVGVKernElement> SVGVKernElement::create(const QualifiedName& tagName , Document* document) 38 PassRefPtr<SVGVKernElement> SVGVKernElement::create(const QualifiedName& tagName , Document* document)
39 { 39 {
40 return adoptRef(new SVGVKernElement(tagName, document)); 40 return adoptRef(new SVGVKernElement(tagName, document));
41 } 41 }
42 42
43 Node::InsertionNotificationRequest SVGVKernElement::insertedInto(ContainerNode* rootParent) 43 Node::InsertionNotificationRequest SVGVKernElement::insertedInto(ContainerNode* rootParent)
44 { 44 {
45 if (rootParent->inDocument()) { 45 if (rootParent->inDocument()) {
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 toSVGFontElement(fontNode)->invalidateGlyphCache();
49 element->invalidateGlyphCache();
50 }
51 } 49 }
52 50
53 return SVGElement::insertedInto(rootParent); 51 return SVGElement::insertedInto(rootParent);
54 } 52 }
55 53
56 void SVGVKernElement::removedFrom(ContainerNode* rootParent) 54 void SVGVKernElement::removedFrom(ContainerNode* rootParent)
57 { 55 {
58 ContainerNode* fontNode = parentNode(); 56 ContainerNode* fontNode = parentNode();
59 if (fontNode && fontNode->hasTagName(SVGNames::fontTag)) { 57 if (fontNode && fontNode->hasTagName(SVGNames::fontTag))
60 if (SVGFontElement* element = static_cast<SVGFontElement*>(fontNode)) 58 toSVGFontElement(fontNode)->invalidateGlyphCache();
61 element->invalidateGlyphCache(); 59
62 }
63 SVGElement::removedFrom(rootParent); 60 SVGElement::removedFrom(rootParent);
64 } 61 }
65 62
66 void SVGVKernElement::buildVerticalKerningPair(KerningPairVector& kerningPairs) 63 void SVGVKernElement::buildVerticalKerningPair(KerningPairVector& kerningPairs)
67 { 64 {
68 String u1 = fastGetAttribute(SVGNames::u1Attr); 65 String u1 = fastGetAttribute(SVGNames::u1Attr);
69 String g1 = fastGetAttribute(SVGNames::g1Attr); 66 String g1 = fastGetAttribute(SVGNames::g1Attr);
70 String u2 = fastGetAttribute(SVGNames::u2Attr); 67 String u2 = fastGetAttribute(SVGNames::u2Attr);
71 String g2 = fastGetAttribute(SVGNames::g2Attr); 68 String g2 = fastGetAttribute(SVGNames::g2Attr);
72 if ((u1.isEmpty() && g1.isEmpty()) || (u2.isEmpty() && g2.isEmpty())) 69 if ((u1.isEmpty() && g1.isEmpty()) || (u2.isEmpty() && g2.isEmpty()))
73 return; 70 return;
74 71
75 SVGKerningPair kerningPair; 72 SVGKerningPair kerningPair;
76 if (parseGlyphName(g1, kerningPair.glyphName1) 73 if (parseGlyphName(g1, kerningPair.glyphName1)
77 && parseGlyphName(g2, kerningPair.glyphName2) 74 && parseGlyphName(g2, kerningPair.glyphName2)
78 && parseKerningUnicodeString(u1, kerningPair.unicodeRange1, kerningPair. unicodeName1) 75 && parseKerningUnicodeString(u1, kerningPair.unicodeRange1, kerningPair. unicodeName1)
79 && parseKerningUnicodeString(u2, kerningPair.unicodeRange2, kerningPair. unicodeName2)) { 76 && parseKerningUnicodeString(u2, kerningPair.unicodeRange2, kerningPair. unicodeName2)) {
80 kerningPair.kerning = fastGetAttribute(SVGNames::kAttr).string().toFloat (); 77 kerningPair.kerning = fastGetAttribute(SVGNames::kAttr).string().toFloat ();
81 kerningPairs.append(kerningPair); 78 kerningPairs.append(kerningPair);
82 } 79 }
83 } 80 }
84 81
85 } 82 }
86 83
87 #endif // ENABLE(SVG_FONTS) 84 #endif // ENABLE(SVG_FONTS)
OLDNEW
« no previous file with comments | « Source/core/svg/SVGHKernElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698