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

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

Issue 192143002: Use isSVG*Element() helpers more in SVG code (Part 2) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 9 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
« no previous file with comments | « Source/core/svg/SVGGlyphElement.cpp ('k') | Source/core/svg/SVGMPathElement.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) 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 23 matching lines...) Expand all
34 } 34 }
35 35
36 PassRefPtr<SVGHKernElement> SVGHKernElement::create(Document& document) 36 PassRefPtr<SVGHKernElement> SVGHKernElement::create(Document& document)
37 { 37 {
38 return adoptRef(new SVGHKernElement(document)); 38 return adoptRef(new SVGHKernElement(document));
39 } 39 }
40 40
41 Node::InsertionNotificationRequest SVGHKernElement::insertedInto(ContainerNode* rootParent) 41 Node::InsertionNotificationRequest SVGHKernElement::insertedInto(ContainerNode* rootParent)
42 { 42 {
43 ContainerNode* fontNode = parentNode(); 43 ContainerNode* fontNode = parentNode();
44 if (fontNode && fontNode->hasTagName(SVGNames::fontTag)) 44 if (isSVGFontElement(fontNode))
45 toSVGFontElement(fontNode)->invalidateGlyphCache(); 45 toSVGFontElement(*fontNode).invalidateGlyphCache();
46 46
47 return SVGElement::insertedInto(rootParent); 47 return SVGElement::insertedInto(rootParent);
48 } 48 }
49 49
50 void SVGHKernElement::removedFrom(ContainerNode* rootParent) 50 void SVGHKernElement::removedFrom(ContainerNode* rootParent)
51 { 51 {
52 ContainerNode* fontNode = parentNode(); 52 ContainerNode* fontNode = parentNode();
53 if (fontNode && fontNode->hasTagName(SVGNames::fontTag)) 53 if (isSVGFontElement(fontNode))
54 toSVGFontElement(fontNode)->invalidateGlyphCache(); 54 toSVGFontElement(*fontNode).invalidateGlyphCache();
55 55
56 SVGElement::removedFrom(rootParent); 56 SVGElement::removedFrom(rootParent);
57 } 57 }
58 58
59 void SVGHKernElement::buildHorizontalKerningPair(KerningPairVector& kerningPairs ) 59 void SVGHKernElement::buildHorizontalKerningPair(KerningPairVector& kerningPairs )
60 { 60 {
61 String u1 = fastGetAttribute(SVGNames::u1Attr); 61 String u1 = fastGetAttribute(SVGNames::u1Attr);
62 String g1 = fastGetAttribute(SVGNames::g1Attr); 62 String g1 = fastGetAttribute(SVGNames::g1Attr);
63 String u2 = fastGetAttribute(SVGNames::u2Attr); 63 String u2 = fastGetAttribute(SVGNames::u2Attr);
64 String g2 = fastGetAttribute(SVGNames::g2Attr); 64 String g2 = fastGetAttribute(SVGNames::g2Attr);
65 if ((u1.isEmpty() && g1.isEmpty()) || (u2.isEmpty() && g2.isEmpty())) 65 if ((u1.isEmpty() && g1.isEmpty()) || (u2.isEmpty() && g2.isEmpty()))
66 return; 66 return;
67 67
68 SVGKerningPair kerningPair; 68 SVGKerningPair kerningPair;
69 if (parseGlyphName(g1, kerningPair.glyphName1) 69 if (parseGlyphName(g1, kerningPair.glyphName1)
70 && parseGlyphName(g2, kerningPair.glyphName2) 70 && parseGlyphName(g2, kerningPair.glyphName2)
71 && parseKerningUnicodeString(u1, kerningPair.unicodeRange1, kerningPair. unicodeName1) 71 && parseKerningUnicodeString(u1, kerningPair.unicodeRange1, kerningPair. unicodeName1)
72 && parseKerningUnicodeString(u2, kerningPair.unicodeRange2, kerningPair. unicodeName2)) { 72 && parseKerningUnicodeString(u2, kerningPair.unicodeRange2, kerningPair. unicodeName2)) {
73 kerningPair.kerning = fastGetAttribute(SVGNames::kAttr).string().toFloat (); 73 kerningPair.kerning = fastGetAttribute(SVGNames::kAttr).string().toFloat ();
74 kerningPairs.append(kerningPair); 74 kerningPairs.append(kerningPair);
75 } 75 }
76 } 76 }
77 77
78 } 78 }
79 79
80 #endif // ENABLE(SVG_FONTS) 80 #endif // ENABLE(SVG_FONTS)
OLDNEW
« no previous file with comments | « Source/core/svg/SVGGlyphElement.cpp ('k') | Source/core/svg/SVGMPathElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698