OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2006, 2010 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2010 Rob Buis <buis@kde.org> |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
14 * | 14 * |
15 * You should have received a copy of the GNU Library General Public License | 15 * You should have received a copy of the GNU Library General Public License |
16 * along with this library; see the file COPYING.LIB. If not, write to | 16 * along with this library; see the file COPYING.LIB. If not, write to |
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
19 */ | 19 */ |
20 | 20 |
21 #include "config.h" | 21 #include "config.h" |
22 | 22 |
23 #include "core/svg/SVGTSpanElement.h" | 23 #include "core/svg/SVGTSpanElement.h" |
24 | 24 |
25 #include "SVGNames.h" | 25 #include "SVGNames.h" |
26 #include "core/dom/NodeRenderingContext.h" | |
27 #include "core/rendering/svg/RenderSVGTSpan.h" | 26 #include "core/rendering/svg/RenderSVGTSpan.h" |
28 | 27 |
29 namespace WebCore { | 28 namespace WebCore { |
30 | 29 |
31 inline SVGTSpanElement::SVGTSpanElement(const QualifiedName& tagName, Document&
document) | 30 inline SVGTSpanElement::SVGTSpanElement(const QualifiedName& tagName, Document&
document) |
32 : SVGTextPositioningElement(tagName, document) | 31 : SVGTextPositioningElement(tagName, document) |
33 { | 32 { |
34 ASSERT(hasTagName(SVGNames::tspanTag)); | 33 ASSERT(hasTagName(SVGNames::tspanTag)); |
35 ScriptWrappable::init(this); | 34 ScriptWrappable::init(this); |
36 } | 35 } |
37 | 36 |
38 PassRefPtr<SVGTSpanElement> SVGTSpanElement::create(const QualifiedName& tagName
, Document& document) | 37 PassRefPtr<SVGTSpanElement> SVGTSpanElement::create(const QualifiedName& tagName
, Document& document) |
39 { | 38 { |
40 return adoptRef(new SVGTSpanElement(tagName, document)); | 39 return adoptRef(new SVGTSpanElement(tagName, document)); |
41 } | 40 } |
42 | 41 |
43 RenderObject* SVGTSpanElement::createRenderer(RenderStyle*) | 42 RenderObject* SVGTSpanElement::createRenderer(RenderStyle*) |
44 { | 43 { |
45 return new RenderSVGTSpan(this); | 44 return new RenderSVGTSpan(this); |
46 } | 45 } |
47 | 46 |
48 bool SVGTSpanElement::childShouldCreateRenderer(const NodeRenderingContext& chil
dContext) const | 47 bool SVGTSpanElement::childShouldCreateRenderer(const Node& child) const |
49 { | 48 { |
50 if (childContext.node()->isTextNode() | 49 if (child.isTextNode() |
51 || childContext.node()->hasTagName(SVGNames::aTag) | 50 || child.hasTagName(SVGNames::aTag) |
52 #if ENABLE(SVG_FONTS) | 51 #if ENABLE(SVG_FONTS) |
53 || childContext.node()->hasTagName(SVGNames::altGlyphTag) | 52 || child.hasTagName(SVGNames::altGlyphTag) |
54 #endif | 53 #endif |
55 || childContext.node()->hasTagName(SVGNames::trefTag) | 54 || child.hasTagName(SVGNames::trefTag) |
56 || childContext.node()->hasTagName(SVGNames::tspanTag)) | 55 || child.hasTagName(SVGNames::tspanTag)) |
57 return true; | 56 return true; |
58 | 57 |
59 return false; | 58 return false; |
60 } | 59 } |
61 | 60 |
62 bool SVGTSpanElement::rendererIsNeeded(const NodeRenderingContext& context) | 61 bool SVGTSpanElement::rendererIsNeeded(const RenderStyle& style) |
63 { | 62 { |
64 if (parentNode() | 63 if (parentNode() |
65 && (parentNode()->hasTagName(SVGNames::aTag) | 64 && (parentNode()->hasTagName(SVGNames::aTag) |
66 #if ENABLE(SVG_FONTS) | 65 #if ENABLE(SVG_FONTS) |
67 || parentNode()->hasTagName(SVGNames::altGlyphTag) | 66 || parentNode()->hasTagName(SVGNames::altGlyphTag) |
68 #endif | 67 #endif |
69 || parentNode()->hasTagName(SVGNames::textTag) | 68 || parentNode()->hasTagName(SVGNames::textTag) |
70 || parentNode()->hasTagName(SVGNames::textPathTag) | 69 || parentNode()->hasTagName(SVGNames::textPathTag) |
71 || parentNode()->hasTagName(SVGNames::tspanTag))) | 70 || parentNode()->hasTagName(SVGNames::tspanTag))) |
72 return Element::rendererIsNeeded(context); | 71 return Element::rendererIsNeeded(style); |
73 | 72 |
74 return false; | 73 return false; |
75 } | 74 } |
76 | 75 |
77 } | 76 } |
OLD | NEW |