Chromium Code Reviews| 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 19 matching lines...) Expand all Loading... | |
| 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/ScriptValue.h" | 35 #include "bindings/v8/ScriptValue.h" |
| 36 #include "core/dom/CustomElementDefinition.h" | 36 #include "core/dom/CustomElementDefinition.h" |
| 37 #include "core/dom/CustomElementRegistry.h" | 37 #include "core/dom/CustomElementRegistry.h" |
| 38 #include "core/dom/Element.h" | 38 #include "core/dom/Element.h" |
| 39 #include <wtf/Forward.h> | 39 #include <wtf/Forward.h> |
| 40 #include <wtf/HashSet.h> | |
|
dglazkov
2013/05/03 16:09:39
Might as well change all these to "wtf/Foo.h"
| |
| 40 #include <wtf/PassRefPtr.h> | 41 #include <wtf/PassRefPtr.h> |
| 41 | 42 |
| 42 namespace WebCore { | 43 namespace WebCore { |
| 43 | 44 |
| 44 class CustomElementConstructor; | 45 class CustomElementConstructor; |
| 45 class CustomElementInvocation; | 46 class CustomElementInvocation; |
| 46 class HTMLElement; | 47 class HTMLElement; |
| 47 class QualifiedName; | 48 class QualifiedName; |
| 48 class SVGElement; | 49 class SVGElement; |
| 49 class ScriptState; | 50 class ScriptState; |
| 50 | 51 |
| 51 class CustomElementHelpers { | 52 class CustomElementHelpers { |
| 52 public: | 53 public: |
| 53 static bool initializeConstructorWrapper(CustomElementConstructor*, const Sc riptValue& prototype, ScriptState*); | 54 static bool initializeConstructorWrapper(CustomElementConstructor*, const Sc riptValue& prototype, ScriptState*); |
| 54 static bool isValidPrototypeParameter(const ScriptValue&, ScriptState*, Atom icString& namespaceURI); | 55 static bool isValidPrototypeParameter(const ScriptValue&, ScriptState*, Atom icString& namespaceURI); |
| 55 static bool isValidPrototypeParameter(const ScriptValue&, ScriptState*); | 56 static bool isValidPrototypeParameter(const ScriptValue&, ScriptState*); |
| 56 static bool isFeatureAllowed(ScriptState*); | 57 static bool isFeatureAllowed(ScriptState*); |
| 57 static const QualifiedName* findLocalName(const ScriptValue& prototype); | 58 static const QualifiedName* findLocalName(const ScriptValue& prototype); |
| 58 | 59 |
| 59 static bool isFeatureAllowed(v8::Handle<v8::Context>); | 60 static bool isFeatureAllowed(v8::Handle<v8::Context>); |
| 60 static WrapperTypeInfo* findWrapperType(v8::Handle<v8::Value> chain); | 61 static WrapperTypeInfo* findWrapperType(v8::Handle<v8::Value> chain); |
| 61 static const QualifiedName* findLocalName(v8::Handle<v8::Object> chain); | 62 static const QualifiedName* findLocalName(v8::Handle<v8::Object> chain); |
| 62 | 63 |
| 64 static void upgradeWrappers(ScriptExecutionContext*, const HashSet<Element*> &, const ScriptValue& prototype); | |
| 63 static void invokeReadyCallbacksIfNeeded(ScriptExecutionContext*, const Vect or<CustomElementInvocation>&); | 65 static void invokeReadyCallbacksIfNeeded(ScriptExecutionContext*, const Vect or<CustomElementInvocation>&); |
| 64 | 66 |
| 65 typedef v8::Handle<v8::Object> (*CreateSVGWrapperFunction)(SVGElement*, v8:: Handle<v8::Object> creationContext, v8::Isolate*); | 67 typedef v8::Handle<v8::Object> (*CreateSVGWrapperFunction)(SVGElement*, v8:: Handle<v8::Object> creationContext, v8::Isolate*); |
| 66 typedef v8::Handle<v8::Object> (*CreateHTMLWrapperFunction)(HTMLElement*, v8 ::Handle<v8::Object> creationContext, v8::Isolate*); | 68 typedef v8::Handle<v8::Object> (*CreateHTMLWrapperFunction)(HTMLElement*, v8 ::Handle<v8::Object> creationContext, v8::Isolate*); |
| 67 | 69 |
| 68 // CustomElementHelpers::wrap is a factory for both HTMLElement | 70 // CustomElementHelpers::wrap is a factory for both HTMLElement |
| 69 // and SVGElement wrappers. CreateWrapperFunction is a type safe | 71 // and SVGElement wrappers. CreateWrapperFunction is a type safe |
| 70 // way of passing a wrapping function for specific elements of | 72 // way of passing a wrapping function for specific elements of |
| 71 // either type; it's used as a fallback when creating wrappers for | 73 // either type; it's used as a fallback when creating wrappers for |
| 72 // type extensions. | 74 // type extensions. |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 103 | 105 |
| 104 inline bool CustomElementHelpers::isValidPrototypeParameter(const ScriptValue& v alue, ScriptState* state) | 106 inline bool CustomElementHelpers::isValidPrototypeParameter(const ScriptValue& v alue, ScriptState* state) |
| 105 { | 107 { |
| 106 AtomicString namespaceURI; | 108 AtomicString namespaceURI; |
| 107 return isValidPrototypeParameter(value, state, namespaceURI); | 109 return isValidPrototypeParameter(value, state, namespaceURI); |
| 108 } | 110 } |
| 109 | 111 |
| 110 } // namespace WebCore | 112 } // namespace WebCore |
| 111 | 113 |
| 112 #endif // CustomElementHelpers_h | 114 #endif // CustomElementHelpers_h |
| OLD | NEW |