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 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. |
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
(...skipping 11 matching lines...) Expand all Loading... |
22 * You should have received a copy of the GNU Library General Public License | 22 * You should have received a copy of the GNU Library General Public License |
23 * along with this library; see the file COPYING.LIB. If not, write to | 23 * along with this library; see the file COPYING.LIB. If not, write to |
24 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 24 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
25 * Boston, MA 02110-1301, USA. | 25 * Boston, MA 02110-1301, USA. |
26 */ | 26 */ |
27 | 27 |
28 #include "config.h" | 28 #include "config.h" |
29 #include "core/dom/Document.h" | 29 #include "core/dom/Document.h" |
30 | 30 |
31 #include "bindings/core/v8/CustomElementConstructorBuilder.h" | 31 #include "bindings/core/v8/CustomElementConstructorBuilder.h" |
| 32 #include "bindings/core/v8/DOMDataStore.h" |
32 #include "bindings/core/v8/Dictionary.h" | 33 #include "bindings/core/v8/Dictionary.h" |
33 #include "bindings/core/v8/ExceptionMessages.h" | 34 #include "bindings/core/v8/ExceptionMessages.h" |
34 #include "bindings/core/v8/ExceptionState.h" | 35 #include "bindings/core/v8/ExceptionState.h" |
35 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 36 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
36 #include "bindings/core/v8/ScriptController.h" | 37 #include "bindings/core/v8/ScriptController.h" |
| 38 #include "bindings/core/v8/V8DOMWrapper.h" |
| 39 #include "bindings/core/v8/WindowProxy.h" |
37 #include "core/HTMLElementFactory.h" | 40 #include "core/HTMLElementFactory.h" |
38 #include "core/HTMLNames.h" | 41 #include "core/HTMLNames.h" |
39 #include "core/SVGElementFactory.h" | 42 #include "core/SVGElementFactory.h" |
40 #include "core/SVGNames.h" | 43 #include "core/SVGNames.h" |
41 #include "core/XMLNSNames.h" | 44 #include "core/XMLNSNames.h" |
42 #include "core/XMLNames.h" | 45 #include "core/XMLNames.h" |
43 #include "core/accessibility/AXObjectCache.h" | 46 #include "core/accessibility/AXObjectCache.h" |
44 #include "core/animation/AnimationTimeline.h" | 47 #include "core/animation/AnimationTimeline.h" |
45 #include "core/animation/DocumentAnimations.h" | 48 #include "core/animation/DocumentAnimations.h" |
46 #include "core/css/CSSFontSelector.h" | 49 #include "core/css/CSSFontSelector.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 #include "core/editing/markup.h" | 106 #include "core/editing/markup.h" |
104 #include "core/events/BeforeUnloadEvent.h" | 107 #include "core/events/BeforeUnloadEvent.h" |
105 #include "core/events/Event.h" | 108 #include "core/events/Event.h" |
106 #include "core/events/EventFactory.h" | 109 #include "core/events/EventFactory.h" |
107 #include "core/events/EventListener.h" | 110 #include "core/events/EventListener.h" |
108 #include "core/events/HashChangeEvent.h" | 111 #include "core/events/HashChangeEvent.h" |
109 #include "core/events/PageTransitionEvent.h" | 112 #include "core/events/PageTransitionEvent.h" |
110 #include "core/events/ScopedEventQueue.h" | 113 #include "core/events/ScopedEventQueue.h" |
111 #include "core/fetch/ResourceFetcher.h" | 114 #include "core/fetch/ResourceFetcher.h" |
112 #include "core/frame/EventHandlerRegistry.h" | 115 #include "core/frame/EventHandlerRegistry.h" |
113 #include "core/frame/LocalDOMWindow.h" | |
114 #include "core/frame/FrameConsole.h" | 116 #include "core/frame/FrameConsole.h" |
115 #include "core/frame/FrameHost.h" | 117 #include "core/frame/FrameHost.h" |
116 #include "core/frame/FrameView.h" | 118 #include "core/frame/FrameView.h" |
117 #include "core/frame/History.h" | 119 #include "core/frame/History.h" |
| 120 #include "core/frame/LocalDOMWindow.h" |
118 #include "core/frame/LocalFrame.h" | 121 #include "core/frame/LocalFrame.h" |
119 #include "core/frame/Settings.h" | 122 #include "core/frame/Settings.h" |
120 #include "core/frame/csp/ContentSecurityPolicy.h" | 123 #include "core/frame/csp/ContentSecurityPolicy.h" |
121 #include "core/html/DocumentNameCollection.h" | 124 #include "core/html/DocumentNameCollection.h" |
122 #include "core/html/HTMLAllCollection.h" | 125 #include "core/html/HTMLAllCollection.h" |
123 #include "core/html/HTMLAnchorElement.h" | 126 #include "core/html/HTMLAnchorElement.h" |
124 #include "core/html/HTMLBaseElement.h" | 127 #include "core/html/HTMLBaseElement.h" |
125 #include "core/html/HTMLCanvasElement.h" | 128 #include "core/html/HTMLCanvasElement.h" |
126 #include "core/html/HTMLCollection.h" | 129 #include "core/html/HTMLCollection.h" |
127 #include "core/html/HTMLDialogElement.h" | 130 #include "core/html/HTMLDialogElement.h" |
(...skipping 5620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5748 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<const LiveNodeListBase> >::con
st_iterator it = m_listsInvalidatedAtDocument.begin(); it != end; ++it) | 5751 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<const LiveNodeListBase> >::con
st_iterator it = m_listsInvalidatedAtDocument.begin(); it != end; ++it) |
5749 (*it)->invalidateCacheForAttribute(attrName); | 5752 (*it)->invalidateCacheForAttribute(attrName); |
5750 } | 5753 } |
5751 | 5754 |
5752 void Document::clearWeakMembers(Visitor* visitor) | 5755 void Document::clearWeakMembers(Visitor* visitor) |
5753 { | 5756 { |
5754 if (m_axObjectCache) | 5757 if (m_axObjectCache) |
5755 m_axObjectCache->clearWeakMembers(visitor); | 5758 m_axObjectCache->clearWeakMembers(visitor); |
5756 } | 5759 } |
5757 | 5760 |
| 5761 v8::Handle<v8::Object> Document::wrap(v8::Handle<v8::Object> creationContext, v8
::Isolate* isolate) |
| 5762 { |
| 5763 ASSERT(!DOMDataStore::containsWrapperNonTemplate(this, isolate)); |
| 5764 |
| 5765 const WrapperTypeInfo* wrapperType = wrapperTypeInfo(); |
| 5766 |
| 5767 if (frame() && frame()->script().initializeMainWorld()) { |
| 5768 // initializeMainWorld may have created a wrapper for the object, retry
from the start. |
| 5769 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperNonTemplate(thi
s, isolate); |
| 5770 if (!wrapper.IsEmpty()) |
| 5771 return wrapper; |
| 5772 } |
| 5773 |
| 5774 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, wrapperType, toInternalPointer(), isolate); |
| 5775 if (UNLIKELY(wrapper.IsEmpty())) |
| 5776 return wrapper; |
| 5777 |
| 5778 wrapperType->installConditionallyEnabledProperties(wrapper, isolate); |
| 5779 wrapperType->refObject(toInternalPointer()); |
| 5780 V8DOMWrapper::associateObjectWithWrapperNonTemplate(this, wrapperType, wrapp
er, isolate); |
| 5781 |
| 5782 DOMWrapperWorld& world = DOMWrapperWorld::current(isolate); |
| 5783 if (world.isMainWorld() && frame()) |
| 5784 frame()->script().windowProxy(world)->updateDocumentWrapper(wrapper); |
| 5785 |
| 5786 return wrapper; |
| 5787 } |
| 5788 |
5758 void Document::trace(Visitor* visitor) | 5789 void Document::trace(Visitor* visitor) |
5759 { | 5790 { |
5760 #if ENABLE(OILPAN) | 5791 #if ENABLE(OILPAN) |
5761 visitor->trace(m_importsController); | 5792 visitor->trace(m_importsController); |
5762 visitor->trace(m_docType); | 5793 visitor->trace(m_docType); |
5763 visitor->trace(m_implementation); | 5794 visitor->trace(m_implementation); |
5764 visitor->trace(m_autofocusElement); | 5795 visitor->trace(m_autofocusElement); |
5765 visitor->trace(m_focusedElement); | 5796 visitor->trace(m_focusedElement); |
5766 visitor->trace(m_hoverNode); | 5797 visitor->trace(m_hoverNode); |
5767 visitor->trace(m_activeHoverElement); | 5798 visitor->trace(m_activeHoverElement); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5820 using namespace blink; | 5851 using namespace blink; |
5821 void showLiveDocumentInstances() | 5852 void showLiveDocumentInstances() |
5822 { | 5853 { |
5823 WeakDocumentSet& set = liveDocumentSet(); | 5854 WeakDocumentSet& set = liveDocumentSet(); |
5824 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5855 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
5825 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it
) { | 5856 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it
) { |
5826 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut
f8().data()); | 5857 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut
f8().data()); |
5827 } | 5858 } |
5828 } | 5859 } |
5829 #endif | 5860 #endif |
OLD | NEW |