OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2009 Apple Inc. All rights reserved. | 4 * Copyright (C) 2009, 2014 Apple Inc. All rights reserved. |
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 * |
11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
15 * | 15 * |
16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
20 */ | 20 */ |
21 | 21 |
22 #ifndef SVGElement_h | 22 #ifndef SVGElement_h |
23 #define SVGElement_h | 23 #define SVGElement_h |
24 | 24 |
25 #include "core/SVGElementTypeHelpers.h" | 25 #include "core/SVGNames.h" |
26 #include "core/dom/Element.h" | 26 #include "core/dom/Element.h" |
27 #include "core/svg/SVGAnimatedString.h" | 27 #include "core/svg/SVGAnimatedString.h" |
28 #include "core/svg/SVGParsingError.h" | 28 #include "core/svg/SVGParsingError.h" |
29 #include "core/svg/properties/SVGPropertyInfo.h" | 29 #include "core/svg/properties/SVGPropertyInfo.h" |
30 #include "platform/Timer.h" | 30 #include "platform/Timer.h" |
31 #include "wtf/HashMap.h" | 31 #include "wtf/HashMap.h" |
32 #include "wtf/OwnPtr.h" | 32 #include "wtf/OwnPtr.h" |
33 | 33 |
34 namespace blink { | 34 namespace blink { |
35 | 35 |
36 class AffineTransform; | 36 class AffineTransform; |
37 class CSSCursorImageValue; | 37 class CSSCursorImageValue; |
38 class Document; | 38 class Document; |
39 class SVGAnimatedPropertyBase; | 39 class SVGAnimatedPropertyBase; |
40 class SubtreeLayoutScope; | 40 class SubtreeLayoutScope; |
41 class SVGCursorElement; | 41 class SVGCursorElement; |
42 class SVGDocumentExtensions; | 42 class SVGDocumentExtensions; |
43 class SVGElement; | 43 class SVGElement; |
44 class SVGElementRareData; | 44 class SVGElementRareData; |
45 class SVGFitToViewBox; | 45 class SVGFitToViewBox; |
46 class SVGSVGElement; | 46 class SVGSVGElement; |
| 47 class SVGUseElement; |
47 | 48 |
48 void mapAttributeToCSSProperty(HashMap<StringImpl*, CSSPropertyID>* propertyName
ToIdMap, const QualifiedName& attrName); | 49 void mapAttributeToCSSProperty(HashMap<StringImpl*, CSSPropertyID>* propertyName
ToIdMap, const QualifiedName& attrName); |
49 | 50 |
50 typedef WillBeHeapHashSet<RawPtrWillBeMember<SVGElement> > SVGElementSet; | 51 typedef WillBeHeapHashSet<RawPtrWillBeMember<SVGElement> > SVGElementSet; |
51 | 52 |
52 class SVGElement : public Element { | 53 class SVGElement : public Element { |
53 public: | 54 public: |
54 virtual ~SVGElement(); | 55 virtual ~SVGElement(); |
55 virtual void attach(const AttachContext&) OVERRIDE; | 56 virtual void attach(const AttachContext&) OVERRIDE; |
56 virtual void detach(const AttachContext&) OVERRIDE; | 57 virtual void detach(const AttachContext&) OVERRIDE; |
57 | 58 |
58 virtual short tabIndex() const OVERRIDE; | 59 virtual short tabIndex() const OVERRIDE; |
59 virtual bool supportsFocus() const OVERRIDE { return false; } | 60 virtual bool supportsFocus() const OVERRIDE { return false; } |
60 | 61 |
61 bool isOutermostSVGSVGElement() const; | 62 bool isOutermostSVGSVGElement() const; |
62 | 63 |
| 64 bool hasTagName(const SVGQualifiedName& name) const { return hasLocalName(na
me.localName()); } |
| 65 |
63 virtual String title() const OVERRIDE; | 66 virtual String title() const OVERRIDE; |
64 bool hasRelativeLengths() const { return !m_elementsWithRelativeLengths.isEm
pty(); } | 67 bool hasRelativeLengths() const { return !m_elementsWithRelativeLengths.isEm
pty(); } |
65 static bool isAnimatableCSSProperty(const QualifiedName&); | 68 static bool isAnimatableCSSProperty(const QualifiedName&); |
66 enum CTMScope { | 69 enum CTMScope { |
67 NearestViewportScope, // Used by SVGGraphicsElement::getCTM() | 70 NearestViewportScope, // Used by SVGGraphicsElement::getCTM() |
68 ScreenScope, // Used by SVGGraphicsElement::getScreenCTM() | 71 ScreenScope, // Used by SVGGraphicsElement::getScreenCTM() |
69 AncestorScope // Used by SVGSVGElement::get{Enclosure|Intersection}List(
) | 72 AncestorScope // Used by SVGSVGElement::get{Enclosure|Intersection}List(
) |
70 }; | 73 }; |
71 virtual AffineTransform localCoordinateSpaceTransform(CTMScope) const; | 74 virtual AffineTransform localCoordinateSpaceTransform(CTMScope) const; |
72 virtual bool needsPendingResourceHandling() const { return true; } | 75 virtual bool needsPendingResourceHandling() const { return true; } |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 QualifiedNameComponents components = { nullAtom.impl(), key.localNam
e().impl(), key.namespaceURI().impl() }; | 256 QualifiedNameComponents components = { nullAtom.impl(), key.localNam
e().impl(), key.namespaceURI().impl() }; |
254 return hashComponents(components); | 257 return hashComponents(components); |
255 } | 258 } |
256 return DefaultHash<QualifiedName>::Hash::hash(key); | 259 return DefaultHash<QualifiedName>::Hash::hash(key); |
257 } | 260 } |
258 static bool equal(const QualifiedName& a, const QualifiedName& b) { return a
.matches(b); } | 261 static bool equal(const QualifiedName& a, const QualifiedName& b) { return a
.matches(b); } |
259 }; | 262 }; |
260 | 263 |
261 DEFINE_ELEMENT_TYPE_CASTS(SVGElement, isSVGElement()); | 264 DEFINE_ELEMENT_TYPE_CASTS(SVGElement, isSVGElement()); |
262 | 265 |
263 template <> inline bool isElementOfType<const SVGElement>(const Node& node) { re
turn node.isSVGElement(); } | 266 template <typename T> bool isElementOfType(const SVGElement&); |
| 267 template <> inline bool isElementOfType<const SVGElement>(const SVGElement&) { r
eturn true; } |
| 268 |
| 269 inline bool Node::hasTagName(const SVGQualifiedName& name) const |
| 270 { |
| 271 return isSVGElement() && toSVGElement(*this).hasTagName(name); |
| 272 } |
264 | 273 |
265 } | 274 } |
266 | 275 |
| 276 #include "core/SVGElementTypeHelpers.h" |
| 277 |
267 #endif | 278 #endif |
OLD | NEW |