OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Peter Kelly (pmk@post.com) | 4 * (C) 2001 Peter Kelly (pmk@post.com) |
5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
6 * (C) 2007 David Smith (catfish.man@gmail.com) | 6 * (C) 2007 David Smith (catfish.man@gmail.com) |
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
All rights reserved. | 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
All rights reserved. |
8 * (C) 2007 Eric Seidel (eric@webkit.org) | 8 * (C) 2007 Eric Seidel (eric@webkit.org) |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
11 * modify it under the terms of the GNU Library General Public | 11 * modify it under the terms of the GNU Library General Public |
12 * License as published by the Free Software Foundation; either | 12 * License as published by the Free Software Foundation; either |
13 * version 2 of the License, or (at your option) any later version. | 13 * version 2 of the License, or (at your option) any later version. |
14 * | 14 * |
15 * This library is distributed in the hope that it will be useful, | 15 * This library is distributed in the hope that it will be useful, |
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
18 * Library General Public License for more details. | 18 * Library General Public License for more details. |
19 * | 19 * |
20 * You should have received a copy of the GNU Library General Public License | 20 * You should have received a copy of the GNU Library General Public License |
21 * along with this library; see the file COPYING.LIB. If not, write to | 21 * along with this library; see the file COPYING.LIB. If not, write to |
22 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 22 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
23 * Boston, MA 02110-1301, USA. | 23 * Boston, MA 02110-1301, USA. |
24 */ | 24 */ |
25 | 25 |
26 #include "config.h" | 26 #include "config.h" |
27 #include "core/dom/Element.h" | 27 #include "core/dom/Element.h" |
28 | 28 |
| 29 #include "bindings/core/v8/DOMDataStore.h" |
29 #include "bindings/core/v8/Dictionary.h" | 30 #include "bindings/core/v8/Dictionary.h" |
30 #include "bindings/core/v8/ExceptionMessages.h" | 31 #include "bindings/core/v8/ExceptionMessages.h" |
31 #include "bindings/core/v8/ExceptionState.h" | 32 #include "bindings/core/v8/ExceptionState.h" |
| 33 #include "bindings/core/v8/V8DOMWrapper.h" |
| 34 #include "bindings/core/v8/V8PerContextData.h" |
32 #include "core/CSSValueKeywords.h" | 35 #include "core/CSSValueKeywords.h" |
33 #include "core/SVGNames.h" | 36 #include "core/SVGNames.h" |
34 #include "core/XLinkNames.h" | 37 #include "core/XLinkNames.h" |
35 #include "core/XMLNames.h" | 38 #include "core/XMLNames.h" |
36 #include "core/accessibility/AXObjectCache.h" | 39 #include "core/accessibility/AXObjectCache.h" |
37 #include "core/animation/AnimationTimeline.h" | 40 #include "core/animation/AnimationTimeline.h" |
38 #include "core/animation/css/CSSAnimations.h" | 41 #include "core/animation/css/CSSAnimations.h" |
39 #include "core/css/CSSImageValue.h" | 42 #include "core/css/CSSImageValue.h" |
40 #include "core/css/CSSStyleSheet.h" | 43 #include "core/css/CSSStyleSheet.h" |
41 #include "core/css/CSSValuePool.h" | 44 #include "core/css/CSSValuePool.h" |
(...skipping 3219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3261 void Element::trace(Visitor* visitor) | 3264 void Element::trace(Visitor* visitor) |
3262 { | 3265 { |
3263 #if ENABLE(OILPAN) | 3266 #if ENABLE(OILPAN) |
3264 if (hasRareData()) | 3267 if (hasRareData()) |
3265 visitor->trace(elementRareData()); | 3268 visitor->trace(elementRareData()); |
3266 visitor->trace(m_elementData); | 3269 visitor->trace(m_elementData); |
3267 #endif | 3270 #endif |
3268 ContainerNode::trace(visitor); | 3271 ContainerNode::trace(visitor); |
3269 } | 3272 } |
3270 | 3273 |
| 3274 v8::Handle<v8::Object> Element::wrap(v8::Handle<v8::Object> creationContext, v8:
:Isolate* isolate) |
| 3275 { |
| 3276 if (isCustomElement()) |
| 3277 return wrapCustomElement(creationContext, isolate); |
| 3278 return ContainerNode::wrap(creationContext, isolate); |
| 3279 } |
| 3280 |
| 3281 v8::Handle<v8::Object> Element::wrapCustomElement(v8::Handle<v8::Object> creatio
nContext, v8::Isolate* isolate) |
| 3282 { |
| 3283 ASSERT(!DOMDataStore::containsWrapperNonTemplate(this, isolate)); |
| 3284 |
| 3285 ASSERT(!creationContext.IsEmpty()); |
| 3286 v8::Handle<v8::Context> context = creationContext->CreationContext(); |
| 3287 |
| 3288 if (!isUpgradedCustomElement() || DOMWrapperWorld::world(context).isIsolated
World()) |
| 3289 return ContainerNode::wrap(creationContext, isolate); |
| 3290 |
| 3291 V8PerContextData* perContextData = V8PerContextData::from(context); |
| 3292 if (!perContextData) |
| 3293 return v8::Handle<v8::Object>(); |
| 3294 |
| 3295 CustomElementBinding* binding = perContextData->customElementBinding(customE
lementDefinition()); |
| 3296 const WrapperTypeInfo* wrapperType = wrapperTypeInfo(); |
| 3297 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, wrapperType, toInternalPointer(), isolate); |
| 3298 if (wrapper.IsEmpty()) |
| 3299 return v8::Handle<v8::Object>(); |
| 3300 |
| 3301 wrapper->SetPrototype(binding->prototype()); |
| 3302 |
| 3303 wrapperType->refObject(toInternalPointer()); |
| 3304 V8DOMWrapper::associateObjectWithWrapperNonTemplate(this, wrapperType, wrapp
er, isolate); |
| 3305 return wrapper; |
| 3306 } |
| 3307 |
3271 } // namespace blink | 3308 } // namespace blink |
OLD | NEW |