| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Leo Yang <leoyang@webkit.org> | 2 * Copyright (C) 2011 Leo Yang <leoyang@webkit.org> |
| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 87 |
| 88 // These 2 variables are used to determine content model. | 88 // These 2 variables are used to determine content model. |
| 89 bool fountFirstGlyphRef = false; | 89 bool fountFirstGlyphRef = false; |
| 90 bool foundFirstAltGlyphItem = false; | 90 bool foundFirstAltGlyphItem = false; |
| 91 | 91 |
| 92 for (Node* child = firstChild(); child; child = child->nextSibling()) { | 92 for (Node* child = firstChild(); child; child = child->nextSibling()) { |
| 93 if (!foundFirstAltGlyphItem && child->hasTagName(SVGNames::glyphRefTag))
{ | 93 if (!foundFirstAltGlyphItem && child->hasTagName(SVGNames::glyphRefTag))
{ |
| 94 fountFirstGlyphRef = true; | 94 fountFirstGlyphRef = true; |
| 95 String referredGlyphName; | 95 String referredGlyphName; |
| 96 | 96 |
| 97 if (static_cast<SVGGlyphRefElement*>(child)->hasValidGlyphElement(re
ferredGlyphName)) | 97 if (toSVGGlyphRefElement(child)->hasValidGlyphElement(referredGlyphN
ame)) |
| 98 glyphNames.append(referredGlyphName); | 98 glyphNames.append(referredGlyphName); |
| 99 else { | 99 else { |
| 100 // As the spec says "If any of the referenced glyphs are unavail
able, | 100 // As the spec says "If any of the referenced glyphs are unavail
able, |
| 101 // then the character(s) that are inside of the 'altGlyph' eleme
nt are | 101 // then the character(s) that are inside of the 'altGlyph' eleme
nt are |
| 102 // rendered as if there were not an 'altGlyph' element surroundi
ng | 102 // rendered as if there were not an 'altGlyph' element surroundi
ng |
| 103 // those characters.". | 103 // those characters.". |
| 104 glyphNames.clear(); | 104 glyphNames.clear(); |
| 105 return false; | 105 return false; |
| 106 } | 106 } |
| 107 } else if (!fountFirstGlyphRef && child->hasTagName(SVGNames::altGlyphIt
emTag)) { | 107 } else if (!fountFirstGlyphRef && child->hasTagName(SVGNames::altGlyphIt
emTag)) { |
| 108 foundFirstAltGlyphItem = true; | 108 foundFirstAltGlyphItem = true; |
| 109 Vector<String> referredGlyphNames; | 109 Vector<String> referredGlyphNames; |
| 110 | 110 |
| 111 // As the spec says "The first 'altGlyphItem' in which all reference
d glyphs | 111 // As the spec says "The first 'altGlyphItem' in which all reference
d glyphs |
| 112 // are available is chosen." | 112 // are available is chosen." |
| 113 if (static_cast<SVGAltGlyphItemElement*>(child)->hasValidGlyphElemen
ts(glyphNames) && !glyphNames.isEmpty()) | 113 if (static_cast<SVGAltGlyphItemElement*>(child)->hasValidGlyphElemen
ts(glyphNames) && !glyphNames.isEmpty()) |
| 114 return true; | 114 return true; |
| 115 } | 115 } |
| 116 } | 116 } |
| 117 return !glyphNames.isEmpty(); | 117 return !glyphNames.isEmpty(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 } | 120 } |
| 121 | 121 |
| 122 #endif | 122 #endif |
| OLD | NEW |