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 | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All |
7 * rights reserved. | 7 * rights reserved. |
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
(...skipping 17 matching lines...) Expand all Loading... |
28 */ | 28 */ |
29 | 29 |
30 #include "core/dom/Document.h" | 30 #include "core/dom/Document.h" |
31 | 31 |
32 #include "bindings/core/v8/DOMDataStore.h" | 32 #include "bindings/core/v8/DOMDataStore.h" |
33 #include "bindings/core/v8/ExceptionMessages.h" | 33 #include "bindings/core/v8/ExceptionMessages.h" |
34 #include "bindings/core/v8/ExceptionState.h" | 34 #include "bindings/core/v8/ExceptionState.h" |
35 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 35 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
36 #include "bindings/core/v8/HTMLScriptElementOrSVGScriptElement.h" | 36 #include "bindings/core/v8/HTMLScriptElementOrSVGScriptElement.h" |
37 #include "bindings/core/v8/Microtask.h" | 37 #include "bindings/core/v8/Microtask.h" |
| 38 #include "bindings/core/v8/ModuleController.h" |
38 #include "bindings/core/v8/ScriptController.h" | 39 #include "bindings/core/v8/ScriptController.h" |
39 #include "bindings/core/v8/SourceLocation.h" | 40 #include "bindings/core/v8/SourceLocation.h" |
40 #include "bindings/core/v8/StringOrDictionary.h" | 41 #include "bindings/core/v8/StringOrDictionary.h" |
41 #include "bindings/core/v8/V0CustomElementConstructorBuilder.h" | 42 #include "bindings/core/v8/V0CustomElementConstructorBuilder.h" |
42 #include "bindings/core/v8/V8DOMWrapper.h" | 43 #include "bindings/core/v8/V8DOMWrapper.h" |
43 #include "bindings/core/v8/V8ElementCreationOptions.h" | 44 #include "bindings/core/v8/V8ElementCreationOptions.h" |
44 #include "bindings/core/v8/V8PerIsolateData.h" | 45 #include "bindings/core/v8/V8PerIsolateData.h" |
45 #include "bindings/core/v8/WindowProxy.h" | 46 #include "bindings/core/v8/WindowProxy.h" |
46 #include "core/HTMLElementFactory.h" | 47 #include "core/HTMLElementFactory.h" |
47 #include "core/HTMLElementTypeHelpers.h" | 48 #include "core/HTMLElementTypeHelpers.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 #include "core/dom/ElementCreationOptions.h" | 83 #include "core/dom/ElementCreationOptions.h" |
83 #include "core/dom/ElementDataCache.h" | 84 #include "core/dom/ElementDataCache.h" |
84 #include "core/dom/ElementRegistrationOptions.h" | 85 #include "core/dom/ElementRegistrationOptions.h" |
85 #include "core/dom/ElementTraversal.h" | 86 #include "core/dom/ElementTraversal.h" |
86 #include "core/dom/ExceptionCode.h" | 87 #include "core/dom/ExceptionCode.h" |
87 #include "core/dom/ExecutionContextTask.h" | 88 #include "core/dom/ExecutionContextTask.h" |
88 #include "core/dom/FrameRequestCallback.h" | 89 #include "core/dom/FrameRequestCallback.h" |
89 #include "core/dom/IntersectionObserverController.h" | 90 #include "core/dom/IntersectionObserverController.h" |
90 #include "core/dom/LayoutTreeBuilderTraversal.h" | 91 #include "core/dom/LayoutTreeBuilderTraversal.h" |
91 #include "core/dom/LiveNodeList.h" | 92 #include "core/dom/LiveNodeList.h" |
| 93 #include "core/dom/ModulatorImpl.h" |
92 #include "core/dom/MutationObserver.h" | 94 #include "core/dom/MutationObserver.h" |
93 #include "core/dom/NodeChildRemovalTracker.h" | 95 #include "core/dom/NodeChildRemovalTracker.h" |
94 #include "core/dom/NodeComputedStyle.h" | 96 #include "core/dom/NodeComputedStyle.h" |
95 #include "core/dom/NodeFilter.h" | 97 #include "core/dom/NodeFilter.h" |
96 #include "core/dom/NodeIterator.h" | 98 #include "core/dom/NodeIterator.h" |
97 #include "core/dom/NodeRareData.h" | 99 #include "core/dom/NodeRareData.h" |
98 #include "core/dom/NodeTraversal.h" | 100 #include "core/dom/NodeTraversal.h" |
99 #include "core/dom/NodeWithIndex.h" | 101 #include "core/dom/NodeWithIndex.h" |
100 #include "core/dom/NthIndexCache.h" | 102 #include "core/dom/NthIndexCache.h" |
101 #include "core/dom/ProcessingInstruction.h" | 103 #include "core/dom/ProcessingInstruction.h" |
(...skipping 6336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6438 return LayoutViewItem(m_layoutView); | 6440 return LayoutViewItem(m_layoutView); |
6439 } | 6441 } |
6440 | 6442 |
6441 PropertyRegistry* Document::propertyRegistry() { | 6443 PropertyRegistry* Document::propertyRegistry() { |
6442 // TODO(timloh): When the flag is removed, return a reference instead. | 6444 // TODO(timloh): When the flag is removed, return a reference instead. |
6443 if (!m_propertyRegistry && RuntimeEnabledFeatures::cssVariables2Enabled()) | 6445 if (!m_propertyRegistry && RuntimeEnabledFeatures::cssVariables2Enabled()) |
6444 m_propertyRegistry = PropertyRegistry::create(); | 6446 m_propertyRegistry = PropertyRegistry::create(); |
6445 return m_propertyRegistry; | 6447 return m_propertyRegistry; |
6446 } | 6448 } |
6447 | 6449 |
| 6450 Modulator* Document::ensureModulator() { |
| 6451 if (!RuntimeEnabledFeatures::moduleScriptsEnabled()) |
| 6452 return nullptr; |
| 6453 |
| 6454 if (!m_modulator && frame()) { |
| 6455 m_modulator = ModulatorImpl::create( |
| 6456 this, ModuleController::create(ScriptState::forMainWorld(frame())), |
| 6457 fetcher()); |
| 6458 } |
| 6459 |
| 6460 return m_modulator; |
| 6461 } |
| 6462 |
6448 const PropertyRegistry* Document::propertyRegistry() const { | 6463 const PropertyRegistry* Document::propertyRegistry() const { |
6449 return const_cast<Document*>(this)->propertyRegistry(); | 6464 return const_cast<Document*>(this)->propertyRegistry(); |
6450 } | 6465 } |
6451 | 6466 |
6452 void Document::incrementPasswordCount() { | 6467 void Document::incrementPasswordCount() { |
6453 ++m_passwordCount; | 6468 ++m_passwordCount; |
6454 if (isSecureContext() || m_passwordCount != 1) { | 6469 if (isSecureContext() || m_passwordCount != 1) { |
6455 // The browser process only cares about passwords on pages where the | 6470 // The browser process only cares about passwords on pages where the |
6456 // top-level URL is not secure. Secure contexts must have a top-level | 6471 // top-level URL is not secure. Secure contexts must have a top-level |
6457 // URL that is secure, so there is no need to send notifications for | 6472 // URL that is secure, so there is no need to send notifications for |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6522 visitor->trace(m_svgExtensions); | 6537 visitor->trace(m_svgExtensions); |
6523 visitor->trace(m_timeline); | 6538 visitor->trace(m_timeline); |
6524 visitor->trace(m_compositorPendingAnimations); | 6539 visitor->trace(m_compositorPendingAnimations); |
6525 visitor->trace(m_contextDocument); | 6540 visitor->trace(m_contextDocument); |
6526 visitor->trace(m_canvasFontCache); | 6541 visitor->trace(m_canvasFontCache); |
6527 visitor->trace(m_intersectionObserverController); | 6542 visitor->trace(m_intersectionObserverController); |
6528 visitor->trace(m_snapCoordinator); | 6543 visitor->trace(m_snapCoordinator); |
6529 visitor->trace(m_resizeObserverController); | 6544 visitor->trace(m_resizeObserverController); |
6530 visitor->trace(m_propertyRegistry); | 6545 visitor->trace(m_propertyRegistry); |
6531 visitor->trace(m_styleReattachDataMap); | 6546 visitor->trace(m_styleReattachDataMap); |
| 6547 visitor->trace(m_modulator); |
6532 Supplementable<Document>::trace(visitor); | 6548 Supplementable<Document>::trace(visitor); |
6533 TreeScope::trace(visitor); | 6549 TreeScope::trace(visitor); |
6534 ContainerNode::trace(visitor); | 6550 ContainerNode::trace(visitor); |
6535 ExecutionContext::trace(visitor); | 6551 ExecutionContext::trace(visitor); |
6536 SecurityContext::trace(visitor); | 6552 SecurityContext::trace(visitor); |
6537 SynchronousMutationNotifier::trace(visitor); | 6553 SynchronousMutationNotifier::trace(visitor); |
6538 } | 6554 } |
6539 | 6555 |
6540 void Document::maybeRecordLoadReason(WouldLoadReason reason) { | 6556 void Document::maybeRecordLoadReason(WouldLoadReason reason) { |
6541 DCHECK(m_wouldLoadReason == Created || reason != Created); | 6557 DCHECK(m_wouldLoadReason == Created || reason != Created); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6584 } | 6600 } |
6585 | 6601 |
6586 void showLiveDocumentInstances() { | 6602 void showLiveDocumentInstances() { |
6587 WeakDocumentSet& set = liveDocumentSet(); | 6603 WeakDocumentSet& set = liveDocumentSet(); |
6588 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6604 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
6589 for (Document* document : set) | 6605 for (Document* document : set) |
6590 fprintf(stderr, "- Document %p URL: %s\n", document, | 6606 fprintf(stderr, "- Document %p URL: %s\n", document, |
6591 document->url().getString().utf8().data()); | 6607 document->url().getString().utf8().data()); |
6592 } | 6608 } |
6593 #endif | 6609 #endif |
OLD | NEW |