OLD | NEW |
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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 CreateSVGWrapperFunction m_svg; | 81 CreateSVGWrapperFunction m_svg; |
82 CreateHTMLWrapperFunction m_html; | 82 CreateHTMLWrapperFunction m_html; |
83 }; | 83 }; |
84 | 84 |
85 // You can just use toV8(Node*) to get correct wrapper objects, | 85 // You can just use toV8(Node*) to get correct wrapper objects, |
86 // even for custom elements. Then generated | 86 // even for custom elements. Then generated |
87 // ElementWrapperFactories call V8CustomElement::wrap() with | 87 // ElementWrapperFactories call V8CustomElement::wrap() with |
88 // proper prototype instances accordingly. | 88 // proper prototype instances accordingly. |
89 static v8::Handle<v8::Object> wrap(Element*, v8::Handle<v8::Object> creation
Context, v8::Isolate*, const CreateWrapperFunction& createTypeExtensionUpgradeCa
ndidateWrapper); | 89 static v8::Handle<v8::Object> wrap(Element*, v8::Handle<v8::Object> creation
Context, v8::Isolate*, const CreateWrapperFunction& createTypeExtensionUpgradeCa
ndidateWrapper); |
90 | 90 |
91 static bool isCustomElement(Element*); | |
92 | |
93 private: | 91 private: |
94 static void invokeReadyCallbackIfNeeded(Element*, v8::Handle<v8::Context>); | 92 static void invokeReadyCallbackIfNeeded(Element*, v8::Handle<v8::Context>); |
95 static v8::Handle<v8::Object> createWrapper(PassRefPtr<Element>, v8::Handle<
v8::Object>, v8::Isolate*, const CreateWrapperFunction& createTypeExtensionUpgra
deCandidateWrapper); | 93 static v8::Handle<v8::Object> createWrapper(PassRefPtr<Element>, v8::Handle<
v8::Object>, v8::Isolate*, const CreateWrapperFunction& createTypeExtensionUpgra
deCandidateWrapper); |
96 static v8::Handle<v8::Object> createUpgradeCandidateWrapper(PassRefPtr<Eleme
nt>, v8::Handle<v8::Object> creationContext, v8::Isolate*, const CreateWrapperFu
nction& createTypeExtensionUpgradeCandidateWrapper); | 94 static v8::Handle<v8::Object> createUpgradeCandidateWrapper(PassRefPtr<Eleme
nt>, v8::Handle<v8::Object> creationContext, v8::Isolate*, const CreateWrapperFu
nction& createTypeExtensionUpgradeCandidateWrapper); |
97 }; | 95 }; |
98 | 96 |
99 inline v8::Handle<v8::Object> CustomElementHelpers::wrap(Element* impl, v8::Hand
le<v8::Object> creationContext, v8::Isolate* isolate, const CreateWrapperFunctio
n& createWrapper) | 97 inline v8::Handle<v8::Object> CustomElementHelpers::wrap(Element* impl, v8::Hand
le<v8::Object> creationContext, v8::Isolate* isolate, const CreateWrapperFunctio
n& createWrapper) |
100 { | 98 { |
101 ASSERT(impl); | 99 ASSERT(impl); |
102 ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty()); | 100 ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty()); |
103 return CustomElementHelpers::createWrapper(impl, creationContext, isolate, c
reateWrapper); | 101 return CustomElementHelpers::createWrapper(impl, creationContext, isolate, c
reateWrapper); |
104 } | 102 } |
105 | 103 |
106 inline bool CustomElementHelpers::isValidPrototypeParameter(const ScriptValue& v
alue, ScriptState* state) | 104 inline bool CustomElementHelpers::isValidPrototypeParameter(const ScriptValue& v
alue, ScriptState* state) |
107 { | 105 { |
108 AtomicString namespaceURI; | 106 AtomicString namespaceURI; |
109 return isValidPrototypeParameter(value, state, namespaceURI); | 107 return isValidPrototypeParameter(value, state, namespaceURI); |
110 } | 108 } |
111 | 109 |
112 } // namespace WebCore | 110 } // namespace WebCore |
113 | 111 |
114 #endif // CustomElementHelpers_h | 112 #endif // CustomElementHelpers_h |
OLD | NEW |