| OLD | NEW |
| 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 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 PassRefPtr<SVGVKernElement> SVGVKernElement::create(Document& document) | 35 PassRefPtr<SVGVKernElement> SVGVKernElement::create(Document& document) |
| 36 { | 36 { |
| 37 return adoptRef(new SVGVKernElement(document)); | 37 return adoptRef(new SVGVKernElement(document)); |
| 38 } | 38 } |
| 39 | 39 |
| 40 Node::InsertionNotificationRequest SVGVKernElement::insertedInto(ContainerNode*
rootParent) | 40 Node::InsertionNotificationRequest SVGVKernElement::insertedInto(ContainerNode*
rootParent) |
| 41 { | 41 { |
| 42 if (rootParent->inDocument()) { | 42 if (rootParent->inDocument()) { |
| 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 | 47 |
| 48 return SVGElement::insertedInto(rootParent); | 48 return SVGElement::insertedInto(rootParent); |
| 49 } | 49 } |
| 50 | 50 |
| 51 void SVGVKernElement::removedFrom(ContainerNode* rootParent) | 51 void SVGVKernElement::removedFrom(ContainerNode* rootParent) |
| 52 { | 52 { |
| 53 ContainerNode* fontNode = parentNode(); | 53 ContainerNode* fontNode = parentNode(); |
| 54 if (fontNode && fontNode->hasTagName(SVGNames::fontTag)) | 54 if (isSVGFontElement(fontNode)) |
| 55 toSVGFontElement(fontNode)->invalidateGlyphCache(); | 55 toSVGFontElement(*fontNode).invalidateGlyphCache(); |
| 56 | 56 |
| 57 SVGElement::removedFrom(rootParent); | 57 SVGElement::removedFrom(rootParent); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void SVGVKernElement::buildVerticalKerningPair(KerningPairVector& kerningPairs) | 60 void SVGVKernElement::buildVerticalKerningPair(KerningPairVector& kerningPairs) |
| 61 { | 61 { |
| 62 String u1 = fastGetAttribute(SVGNames::u1Attr); | 62 String u1 = fastGetAttribute(SVGNames::u1Attr); |
| 63 String g1 = fastGetAttribute(SVGNames::g1Attr); | 63 String g1 = fastGetAttribute(SVGNames::g1Attr); |
| 64 String u2 = fastGetAttribute(SVGNames::u2Attr); | 64 String u2 = fastGetAttribute(SVGNames::u2Attr); |
| 65 String g2 = fastGetAttribute(SVGNames::g2Attr); | 65 String g2 = fastGetAttribute(SVGNames::g2Attr); |
| 66 if ((u1.isEmpty() && g1.isEmpty()) || (u2.isEmpty() && g2.isEmpty())) | 66 if ((u1.isEmpty() && g1.isEmpty()) || (u2.isEmpty() && g2.isEmpty())) |
| 67 return; | 67 return; |
| 68 | 68 |
| 69 SVGKerningPair kerningPair; | 69 SVGKerningPair kerningPair; |
| 70 if (parseGlyphName(g1, kerningPair.glyphName1) | 70 if (parseGlyphName(g1, kerningPair.glyphName1) |
| 71 && parseGlyphName(g2, kerningPair.glyphName2) | 71 && parseGlyphName(g2, kerningPair.glyphName2) |
| 72 && parseKerningUnicodeString(u1, kerningPair.unicodeRange1, kerningPair.
unicodeName1) | 72 && parseKerningUnicodeString(u1, kerningPair.unicodeRange1, kerningPair.
unicodeName1) |
| 73 && parseKerningUnicodeString(u2, kerningPair.unicodeRange2, kerningPair.
unicodeName2)) { | 73 && parseKerningUnicodeString(u2, kerningPair.unicodeRange2, kerningPair.
unicodeName2)) { |
| 74 kerningPair.kerning = fastGetAttribute(SVGNames::kAttr).string().toFloat
(); | 74 kerningPair.kerning = fastGetAttribute(SVGNames::kAttr).string().toFloat
(); |
| 75 kerningPairs.append(kerningPair); | 75 kerningPairs.append(kerningPair); |
| 76 } | 76 } |
| 77 } | 77 } |
| 78 | 78 |
| 79 } | 79 } |
| 80 | 80 |
| 81 #endif // ENABLE(SVG_FONTS) | 81 #endif // ENABLE(SVG_FONTS) |
| OLD | NEW |