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

Side by Side Diff: Source/bindings/v8/CustomElementHelpers.h

Issue 16708002: Simplify Custom Element constructors to be functions, not wrappers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address morrita1's first round of feedback Created 7 years, 6 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 14 matching lines...) Expand all
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef CustomElementHelpers_h 31 #ifndef CustomElementHelpers_h
32 #define CustomElementHelpers_h 32 #define CustomElementHelpers_h
33 33
34 #include "bindings/v8/DOMDataStore.h" 34 #include "bindings/v8/DOMDataStore.h"
35 #include "bindings/v8/ScriptState.h"
haraken 2013/06/10 09:11:03 Nit: forward declaration will be enough.
35 #include "bindings/v8/ScriptValue.h" 36 #include "bindings/v8/ScriptValue.h"
36 #include "core/dom/CustomElementDefinition.h" 37 #include "core/dom/CustomElementDefinition.h"
37 #include "core/dom/CustomElementRegistry.h" 38 #include "core/dom/CustomElementRegistry.h"
38 #include "core/dom/Element.h" 39 #include "core/dom/Element.h"
39 #include "wtf/Forward.h" 40 #include "wtf/Forward.h"
40 #include "wtf/HashSet.h" 41 #include "wtf/HashSet.h"
41 #include "wtf/PassRefPtr.h" 42 #include "wtf/PassRefPtr.h"
43 #include "wtf/text/AtomicString.h"
42 44
43 namespace WebCore { 45 namespace WebCore {
44 46
45 class CustomElementConstructor;
46 class CustomElementInvocation; 47 class CustomElementInvocation;
48 class Document;
47 class HTMLElement; 49 class HTMLElement;
48 class QualifiedName; 50 class QualifiedName;
49 class SVGElement; 51 class SVGElement;
50 class ScriptState; 52 class ScriptState;
51 53
52 class CustomElementHelpers { 54 class CustomElementHelpers {
53 public: 55 public:
54 static bool initializeConstructorWrapper(CustomElementConstructor*, const Sc riptValue& prototype, ScriptState*); 56 static ScriptValue createConstructor(ScriptState*, const ScriptValue& protot ype, Document*, const AtomicString& namespaceURI, const AtomicString& name, cons t AtomicString& type);
57
55 static bool isValidPrototypeParameter(const ScriptValue&, ScriptState*, Atom icString& namespaceURI); 58 static bool isValidPrototypeParameter(const ScriptValue&, ScriptState*, Atom icString& namespaceURI);
56 static bool isValidPrototypeParameter(const ScriptValue&, ScriptState*); 59 static bool isValidPrototypeParameter(const ScriptValue&, ScriptState*);
57 static bool isFeatureAllowed(ScriptState*); 60 static bool isFeatureAllowed(ScriptState*);
58 static const QualifiedName* findLocalName(const ScriptValue& prototype); 61 static const QualifiedName* findLocalName(const ScriptValue& prototype);
59 62
60 static bool isFeatureAllowed(v8::Handle<v8::Context>); 63 static bool isFeatureAllowed(v8::Handle<v8::Context>);
61 static WrapperTypeInfo* findWrapperType(v8::Handle<v8::Value> chain); 64 static WrapperTypeInfo* findWrapperType(v8::Handle<v8::Value> chain);
62 static const QualifiedName* findLocalName(v8::Handle<v8::Object> chain); 65 static const QualifiedName* findLocalName(v8::Handle<v8::Object> chain);
63 66
64 static void upgradeWrappers(ScriptExecutionContext*, const HashSet<Element*> &, const ScriptValue& prototype); 67 static void upgradeWrappers(ScriptExecutionContext*, const HashSet<Element*> &, const ScriptValue& prototype);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 108
106 inline bool CustomElementHelpers::isValidPrototypeParameter(const ScriptValue& v alue, ScriptState* state) 109 inline bool CustomElementHelpers::isValidPrototypeParameter(const ScriptValue& v alue, ScriptState* state)
107 { 110 {
108 AtomicString namespaceURI; 111 AtomicString namespaceURI;
109 return isValidPrototypeParameter(value, state, namespaceURI); 112 return isValidPrototypeParameter(value, state, namespaceURI);
110 } 113 }
111 114
112 } // namespace WebCore 115 } // namespace WebCore
113 116
114 #endif // CustomElementHelpers_h 117 #endif // CustomElementHelpers_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698