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

Side by Side Diff: Source/core/svg/SVGScriptElement.h

Issue 18676002: Refactoring: Decouple ScriptElement from HTMLScriptElement and SVGScriptElement. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed a crash Created 7 years, 5 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2007 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,
(...skipping 13 matching lines...) Expand all
24 #include "SVGNames.h" 24 #include "SVGNames.h"
25 #include "core/dom/ScriptElement.h" 25 #include "core/dom/ScriptElement.h"
26 #include "core/svg/SVGAnimatedBoolean.h" 26 #include "core/svg/SVGAnimatedBoolean.h"
27 #include "core/svg/SVGAnimatedString.h" 27 #include "core/svg/SVGAnimatedString.h"
28 #include "core/svg/SVGElement.h" 28 #include "core/svg/SVGElement.h"
29 #include "core/svg/SVGExternalResourcesRequired.h" 29 #include "core/svg/SVGExternalResourcesRequired.h"
30 #include "core/svg/SVGURIReference.h" 30 #include "core/svg/SVGURIReference.h"
31 31
32 namespace WebCore { 32 namespace WebCore {
33 33
34 class SVGScriptElement FINAL : public SVGElement 34 class SVGScriptElement FINAL
35 , public SVGURIReference 35 : public SVGElement
36 , public SVGExternalResourcesRequired 36 , public SVGURIReference
37 , public ScriptElement { 37 , public SVGExternalResourcesRequired
38 , public ScriptElementClient {
38 public: 39 public:
39 static PassRefPtr<SVGScriptElement> create(const QualifiedName&, Document*, bool wasInsertedByParser); 40 static PassRefPtr<SVGScriptElement> create(const QualifiedName&, Document*, bool wasInsertedByParser);
40 41
41 String type() const; 42 String type() const;
42 void setType(const String&); 43 void setType(const String&);
43 44
45 ScriptElement* scriptElement() const { return m_scriptElement.get(); }
46
44 private: 47 private:
45 SVGScriptElement(const QualifiedName&, Document*, bool wasInsertedByParser, bool alreadyStarted); 48 SVGScriptElement(const QualifiedName&, Document*, bool wasInsertedByParser, bool alreadyStarted);
46 49
47 bool isSupportedAttribute(const QualifiedName&); 50 bool isSupportedAttribute(const QualifiedName&);
48 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR IDE; 51 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR IDE;
49 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; 52 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
50 virtual void childrenChanged(bool changedByParser = false, Node* beforeChang e = 0, Node* afterChange = 0, int childCountDelta = 0); 53 virtual void childrenChanged(bool changedByParser = false, Node* beforeChang e = 0, Node* afterChange = 0, int childCountDelta = 0);
51 54
52 virtual void svgAttributeChanged(const QualifiedName&); 55 virtual void svgAttributeChanged(const QualifiedName&);
53 virtual bool isURLAttribute(const Attribute&) const OVERRIDE; 56 virtual bool isURLAttribute(const Attribute&) const OVERRIDE;
(...skipping 11 matching lines...) Expand all
65 virtual String eventAttributeValue() const; 68 virtual String eventAttributeValue() const;
66 virtual bool asyncAttributeValue() const; 69 virtual bool asyncAttributeValue() const;
67 virtual bool deferAttributeValue() const; 70 virtual bool deferAttributeValue() const;
68 virtual bool hasSourceAttribute() const; 71 virtual bool hasSourceAttribute() const;
69 72
70 virtual void dispatchLoadEvent() { SVGExternalResourcesRequired::dispatchLoa dEvent(this); } 73 virtual void dispatchLoadEvent() { SVGExternalResourcesRequired::dispatchLoa dEvent(this); }
71 74
72 virtual PassRefPtr<Element> cloneElementWithoutAttributesAndChildren(); 75 virtual PassRefPtr<Element> cloneElementWithoutAttributesAndChildren();
73 76
74 // SVGExternalResourcesRequired 77 // SVGExternalResourcesRequired
75 virtual void setHaveFiredLoadEvent(bool haveFiredLoadEvent) { ScriptElement: :setHaveFiredLoadEvent(haveFiredLoadEvent); } 78 virtual void setHaveFiredLoadEvent(bool haveFiredLoadEvent) { m_scriptElemen t->setHaveFiredLoadEvent(haveFiredLoadEvent); }
76 virtual bool isParserInserted() const { return ScriptElement::isParserInsert ed(); } 79 virtual bool isParserInserted() const { return m_scriptElement->isParserInse rted(); }
77 virtual bool haveFiredLoadEvent() const { return ScriptElement::haveFiredLoa dEvent(); } 80 virtual bool haveFiredLoadEvent() const { return m_scriptElement->haveFiredL oadEvent(); }
abarth-chromium 2013/07/08 18:47:12 I would move these into the CPP file.
78 virtual Timer<SVGElement>* svgLoadEventTimer() OVERRIDE { return &m_svgLoadE ventTimer; } 81 virtual Timer<SVGElement>* svgLoadEventTimer() OVERRIDE { return &m_svgLoadE ventTimer; }
79 82
80 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGScriptElement) 83 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGScriptElement)
81 DECLARE_ANIMATED_STRING(Href, href) 84 DECLARE_ANIMATED_STRING(Href, href)
82 DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesReq uired) 85 DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesReq uired)
83 END_DECLARE_ANIMATED_PROPERTIES 86 END_DECLARE_ANIMATED_PROPERTIES
84 87
85 String m_type; 88 String m_type;
86 Timer<SVGElement> m_svgLoadEventTimer; 89 Timer<SVGElement> m_svgLoadEventTimer;
90 OwnPtr<ScriptElement> m_scriptElement;
87 }; 91 };
88 92
89 inline SVGScriptElement* toSVGScriptElement(Node* node) 93 inline SVGScriptElement* toSVGScriptElement(Node* node)
90 { 94 {
91 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::scriptT ag)); 95 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::scriptT ag));
92 return static_cast<SVGScriptElement*>(node); 96 return static_cast<SVGScriptElement*>(node);
93 } 97 }
94 98
95 } // namespace WebCore 99 } // namespace WebCore
96 100
97 #endif 101 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698