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

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

Issue 14834002: Set a bit on Custom Elements on creation to simplify wrapping (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 7 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
« no previous file with comments | « no previous file | Source/bindings/v8/CustomElementHelpers.cpp » ('j') | Source/core/dom/Element.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 CreateSVGWrapperFunction m_svg; 82 CreateSVGWrapperFunction m_svg;
83 CreateHTMLWrapperFunction m_html; 83 CreateHTMLWrapperFunction m_html;
84 }; 84 };
85 85
86 // You can just use toV8(Node*) to get correct wrapper objects, 86 // You can just use toV8(Node*) to get correct wrapper objects,
87 // even for custom elements. Then generated 87 // even for custom elements. Then generated
88 // ElementWrapperFactories call V8CustomElement::wrap() with 88 // ElementWrapperFactories call V8CustomElement::wrap() with
89 // proper prototype instances accordingly. 89 // proper prototype instances accordingly.
90 static v8::Handle<v8::Object> wrap(Element*, v8::Handle<v8::Object> creation Context, v8::Isolate*, const CreateWrapperFunction& createTypeExtensionUpgradeCa ndidateWrapper); 90 static v8::Handle<v8::Object> wrap(Element*, v8::Handle<v8::Object> creation Context, v8::Isolate*, const CreateWrapperFunction& createTypeExtensionUpgradeCa ndidateWrapper);
91 91
92 static bool isCustomElement(Element*);
93
94 private: 92 private:
95 static void invokeReadyCallbackIfNeeded(Element*, v8::Handle<v8::Context>); 93 static void invokeReadyCallbackIfNeeded(Element*, v8::Handle<v8::Context>);
96 static v8::Handle<v8::Object> createWrapper(PassRefPtr<Element>, v8::Handle< v8::Object>, v8::Isolate*, const CreateWrapperFunction& createTypeExtensionUpgra deCandidateWrapper); 94 static v8::Handle<v8::Object> createWrapper(PassRefPtr<Element>, v8::Handle< v8::Object>, v8::Isolate*, const CreateWrapperFunction& createTypeExtensionUpgra deCandidateWrapper);
97 static v8::Handle<v8::Object> createUpgradeCandidateWrapper(PassRefPtr<Eleme nt>, v8::Handle<v8::Object> creationContext, v8::Isolate*, const CreateWrapperFu nction& createTypeExtensionUpgradeCandidateWrapper); 95 static v8::Handle<v8::Object> createUpgradeCandidateWrapper(PassRefPtr<Eleme nt>, v8::Handle<v8::Object> creationContext, v8::Isolate*, const CreateWrapperFu nction& createTypeExtensionUpgradeCandidateWrapper);
98 }; 96 };
99 97
100 inline v8::Handle<v8::Object> CustomElementHelpers::wrap(Element* impl, v8::Hand le<v8::Object> creationContext, v8::Isolate* isolate, const CreateWrapperFunctio n& createWrapper) 98 inline v8::Handle<v8::Object> CustomElementHelpers::wrap(Element* impl, v8::Hand le<v8::Object> creationContext, v8::Isolate* isolate, const CreateWrapperFunctio n& createWrapper)
101 { 99 {
102 ASSERT(impl); 100 ASSERT(impl);
103 ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty()); 101 ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty());
104 return CustomElementHelpers::createWrapper(impl, creationContext, isolate, c reateWrapper); 102 return CustomElementHelpers::createWrapper(impl, creationContext, isolate, c reateWrapper);
105 } 103 }
106 104
107 inline bool CustomElementHelpers::isValidPrototypeParameter(const ScriptValue& v alue, ScriptState* state) 105 inline bool CustomElementHelpers::isValidPrototypeParameter(const ScriptValue& v alue, ScriptState* state)
108 { 106 {
109 AtomicString namespaceURI; 107 AtomicString namespaceURI;
110 return isValidPrototypeParameter(value, state, namespaceURI); 108 return isValidPrototypeParameter(value, state, namespaceURI);
111 } 109 }
112 110
113 } // namespace WebCore 111 } // namespace WebCore
114 112
115 #endif // CustomElementHelpers_h 113 #endif // CustomElementHelpers_h
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/v8/CustomElementHelpers.cpp » ('j') | Source/core/dom/Element.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698