| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007-2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2007-2009 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 10 matching lines...) Expand all Loading... |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 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 #include "config.h" | 31 #include "sky/engine/config.h" |
| 32 #include "bindings/core/v8/V8Node.h" | 32 #include "bindings/core/v8/V8Node.h" |
| 33 | 33 |
| 34 #include "bindings/core/v8/ExceptionState.h" | |
| 35 #include "bindings/core/v8/V8AbstractEventListener.h" | |
| 36 #include "bindings/core/v8/V8Attr.h" | 34 #include "bindings/core/v8/V8Attr.h" |
| 37 #include "bindings/core/v8/V8Binding.h" | |
| 38 #include "bindings/core/v8/V8Document.h" | 35 #include "bindings/core/v8/V8Document.h" |
| 39 #include "bindings/core/v8/V8DocumentFragment.h" | 36 #include "bindings/core/v8/V8DocumentFragment.h" |
| 40 #include "bindings/core/v8/V8Element.h" | 37 #include "bindings/core/v8/V8Element.h" |
| 41 #include "bindings/core/v8/V8EventListener.h" | |
| 42 #include "bindings/core/v8/V8HTMLElement.h" | 38 #include "bindings/core/v8/V8HTMLElement.h" |
| 43 #include "bindings/core/v8/V8ShadowRoot.h" | 39 #include "bindings/core/v8/V8ShadowRoot.h" |
| 44 #include "bindings/core/v8/V8Text.h" | 40 #include "bindings/core/v8/V8Text.h" |
| 45 #include "core/dom/Document.h" | 41 #include "sky/engine/bindings/core/v8/ExceptionState.h" |
| 46 #include "core/dom/shadow/ShadowRoot.h" | 42 #include "sky/engine/bindings/core/v8/V8AbstractEventListener.h" |
| 47 #include "core/events/EventListener.h" | 43 #include "sky/engine/bindings/core/v8/V8Binding.h" |
| 48 #include "wtf/RefPtr.h" | 44 #include "sky/engine/bindings/core/v8/V8EventListener.h" |
| 45 #include "sky/engine/core/dom/Document.h" |
| 46 #include "sky/engine/core/dom/shadow/ShadowRoot.h" |
| 47 #include "sky/engine/core/events/EventListener.h" |
| 48 #include "sky/engine/wtf/RefPtr.h" |
| 49 | 49 |
| 50 namespace blink { | 50 namespace blink { |
| 51 | 51 |
| 52 // These functions are custom to prevent a wrapper lookup of the return value wh
ich is always | 52 // These functions are custom to prevent a wrapper lookup of the return value wh
ich is always |
| 53 // part of the arguments. | 53 // part of the arguments. |
| 54 v8::Handle<v8::Object> wrap(Node* impl, v8::Handle<v8::Object> creationContext,
v8::Isolate* isolate) | 54 v8::Handle<v8::Object> wrap(Node* impl, v8::Handle<v8::Object> creationContext,
v8::Isolate* isolate) |
| 55 { | 55 { |
| 56 ASSERT(impl); | 56 ASSERT(impl); |
| 57 switch (impl->nodeType()) { | 57 switch (impl->nodeType()) { |
| 58 case Node::ELEMENT_NODE: | 58 case Node::ELEMENT_NODE: |
| 59 // For performance reasons, this is inlined from V8Element::wrap and mus
t remain in sync. | 59 // For performance reasons, this is inlined from V8Element::wrap and mus
t remain in sync. |
| 60 if (impl->isHTMLElement()) | 60 if (impl->isHTMLElement()) |
| 61 return wrap(toHTMLElement(impl), creationContext, isolate); | 61 return wrap(toHTMLElement(impl), creationContext, isolate); |
| 62 return V8Element::createWrapper(toElement(impl), creationContext, isolat
e); | 62 return V8Element::createWrapper(toElement(impl), creationContext, isolat
e); |
| 63 case Node::TEXT_NODE: | 63 case Node::TEXT_NODE: |
| 64 return wrap(toText(impl), creationContext, isolate); | 64 return wrap(toText(impl), creationContext, isolate); |
| 65 case Node::DOCUMENT_NODE: | 65 case Node::DOCUMENT_NODE: |
| 66 return wrap(toDocument(impl), creationContext, isolate); | 66 return wrap(toDocument(impl), creationContext, isolate); |
| 67 case Node::DOCUMENT_FRAGMENT_NODE: | 67 case Node::DOCUMENT_FRAGMENT_NODE: |
| 68 if (impl->isShadowRoot()) | 68 if (impl->isShadowRoot()) |
| 69 return wrap(toShadowRoot(impl), creationContext, isolate); | 69 return wrap(toShadowRoot(impl), creationContext, isolate); |
| 70 return wrap(toDocumentFragment(impl), creationContext, isolate); | 70 return wrap(toDocumentFragment(impl), creationContext, isolate); |
| 71 } | 71 } |
| 72 ASSERT_NOT_REACHED(); | 72 ASSERT_NOT_REACHED(); |
| 73 return V8Node::createWrapper(impl, creationContext, isolate); | 73 return V8Node::createWrapper(impl, creationContext, isolate); |
| 74 } | 74 } |
| 75 } // namespace blink | 75 } // namespace blink |
| OLD | NEW |