| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 #include "core/dom/ElementCreationOptions.h" | 81 #include "core/dom/ElementCreationOptions.h" |
| 82 #include "core/dom/ElementDataCache.h" | 82 #include "core/dom/ElementDataCache.h" |
| 83 #include "core/dom/ElementRegistrationOptions.h" | 83 #include "core/dom/ElementRegistrationOptions.h" |
| 84 #include "core/dom/ElementTraversal.h" | 84 #include "core/dom/ElementTraversal.h" |
| 85 #include "core/dom/ExceptionCode.h" | 85 #include "core/dom/ExceptionCode.h" |
| 86 #include "core/dom/ExecutionContextTask.h" | 86 #include "core/dom/ExecutionContextTask.h" |
| 87 #include "core/dom/FrameRequestCallback.h" | 87 #include "core/dom/FrameRequestCallback.h" |
| 88 #include "core/dom/IntersectionObserverController.h" | 88 #include "core/dom/IntersectionObserverController.h" |
| 89 #include "core/dom/LayoutTreeBuilderTraversal.h" | 89 #include "core/dom/LayoutTreeBuilderTraversal.h" |
| 90 #include "core/dom/LiveNodeList.h" | 90 #include "core/dom/LiveNodeList.h" |
| 91 #include "core/dom/MainThreadTaskRunner.h" | |
| 92 #include "core/dom/MutationObserver.h" | 91 #include "core/dom/MutationObserver.h" |
| 93 #include "core/dom/NodeChildRemovalTracker.h" | 92 #include "core/dom/NodeChildRemovalTracker.h" |
| 94 #include "core/dom/NodeComputedStyle.h" | 93 #include "core/dom/NodeComputedStyle.h" |
| 95 #include "core/dom/NodeFilter.h" | 94 #include "core/dom/NodeFilter.h" |
| 96 #include "core/dom/NodeIntersectionObserverData.h" | 95 #include "core/dom/NodeIntersectionObserverData.h" |
| 97 #include "core/dom/NodeIterator.h" | 96 #include "core/dom/NodeIterator.h" |
| 98 #include "core/dom/NodeRareData.h" | 97 #include "core/dom/NodeRareData.h" |
| 99 #include "core/dom/NodeTraversal.h" | 98 #include "core/dom/NodeTraversal.h" |
| 100 #include "core/dom/NodeWithIndex.h" | 99 #include "core/dom/NodeWithIndex.h" |
| 101 #include "core/dom/NthIndexCache.h" | 100 #include "core/dom/NthIndexCache.h" |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 m_loadEventDelayCount(0), | 466 m_loadEventDelayCount(0), |
| 468 m_loadEventDelayTimer(TaskRunnerHelper::get(TaskType::Networking, this), | 467 m_loadEventDelayTimer(TaskRunnerHelper::get(TaskType::Networking, this), |
| 469 this, | 468 this, |
| 470 &Document::loadEventDelayTimerFired), | 469 &Document::loadEventDelayTimerFired), |
| 471 m_pluginLoadingTimer(TaskRunnerHelper::get(TaskType::Internal, this), | 470 m_pluginLoadingTimer(TaskRunnerHelper::get(TaskType::Internal, this), |
| 472 this, | 471 this, |
| 473 &Document::pluginLoadingTimerFired), | 472 &Document::pluginLoadingTimerFired), |
| 474 m_documentTiming(*this), | 473 m_documentTiming(*this), |
| 475 m_writeRecursionIsTooDeep(false), | 474 m_writeRecursionIsTooDeep(false), |
| 476 m_writeRecursionDepth(0), | 475 m_writeRecursionDepth(0), |
| 477 m_taskRunner(MainThreadTaskRunner::create(this)), | |
| 478 m_registrationContext(initializer.registrationContext(this)), | 476 m_registrationContext(initializer.registrationContext(this)), |
| 479 m_elementDataCacheClearTimer( | 477 m_elementDataCacheClearTimer( |
| 480 TaskRunnerHelper::get(TaskType::Internal, this), | 478 TaskRunnerHelper::get(TaskType::Internal, this), |
| 481 this, | 479 this, |
| 482 &Document::elementDataCacheClearTimerFired), | 480 &Document::elementDataCacheClearTimerFired), |
| 483 m_timeline(DocumentTimeline::create(this)), | 481 m_timeline(DocumentTimeline::create(this)), |
| 484 m_compositorPendingAnimations(new CompositorPendingAnimations()), | 482 m_compositorPendingAnimations(new CompositorPendingAnimations()), |
| 485 m_templateDocumentHost(nullptr), | 483 m_templateDocumentHost(nullptr), |
| 486 m_didAssociateFormControlsTimer( | 484 m_didAssociateFormControlsTimer( |
| 487 TaskRunnerHelper::get(TaskType::Internal, this), | 485 TaskRunnerHelper::get(TaskType::Internal, this), |
| (...skipping 3869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4357 mojom::blink::SensitiveInputVisibilityServicePtr sensitiveInputServicePtr; | 4355 mojom::blink::SensitiveInputVisibilityServicePtr sensitiveInputServicePtr; |
| 4358 frame()->interfaceProvider()->getInterface( | 4356 frame()->interfaceProvider()->getInterface( |
| 4359 mojo::GetProxy(&sensitiveInputServicePtr)); | 4357 mojo::GetProxy(&sensitiveInputServicePtr)); |
| 4360 if (m_passwordCount > 0) { | 4358 if (m_passwordCount > 0) { |
| 4361 sensitiveInputServicePtr->PasswordFieldVisibleInInsecureContext(); | 4359 sensitiveInputServicePtr->PasswordFieldVisibleInInsecureContext(); |
| 4362 return; | 4360 return; |
| 4363 } | 4361 } |
| 4364 sensitiveInputServicePtr->AllPasswordFieldsInInsecureContextInvisible(); | 4362 sensitiveInputServicePtr->AllPasswordFieldsInInsecureContextInvisible(); |
| 4365 } | 4363 } |
| 4366 | 4364 |
| 4365 void Document::runExecutionContextTask( |
| 4366 std::unique_ptr<ExecutionContextTask> task, |
| 4367 bool isInstrumented) { |
| 4368 InspectorInstrumentation::AsyncTask asyncTask(this, task.get(), |
| 4369 isInstrumented); |
| 4370 task->performTask(this); |
| 4371 } |
| 4372 |
| 4367 void Document::registerEventFactory( | 4373 void Document::registerEventFactory( |
| 4368 std::unique_ptr<EventFactoryBase> eventFactory) { | 4374 std::unique_ptr<EventFactoryBase> eventFactory) { |
| 4369 DCHECK(!eventFactories().contains(eventFactory.get())); | 4375 DCHECK(!eventFactories().contains(eventFactory.get())); |
| 4370 eventFactories().add(std::move(eventFactory)); | 4376 eventFactories().add(std::move(eventFactory)); |
| 4371 } | 4377 } |
| 4372 | 4378 |
| 4373 Event* Document::createEvent(ExecutionContext* executionContext, | 4379 Event* Document::createEvent(ExecutionContext* executionContext, |
| 4374 const String& eventType, | 4380 const String& eventType, |
| 4375 ExceptionState& exceptionState) { | 4381 ExceptionState& exceptionState) { |
| 4376 Event* event = nullptr; | 4382 Event* event = nullptr; |
| (...skipping 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5714 | 5720 |
| 5715 static void runAddConsoleMessageTask(MessageSource source, | 5721 static void runAddConsoleMessageTask(MessageSource source, |
| 5716 MessageLevel level, | 5722 MessageLevel level, |
| 5717 const String& message, | 5723 const String& message, |
| 5718 ExecutionContext* context) { | 5724 ExecutionContext* context) { |
| 5719 context->addConsoleMessage(ConsoleMessage::create(source, level, message)); | 5725 context->addConsoleMessage(ConsoleMessage::create(source, level, message)); |
| 5720 } | 5726 } |
| 5721 | 5727 |
| 5722 void Document::addConsoleMessage(ConsoleMessage* consoleMessage) { | 5728 void Document::addConsoleMessage(ConsoleMessage* consoleMessage) { |
| 5723 if (!isContextThread()) { | 5729 if (!isContextThread()) { |
| 5724 m_taskRunner->postTask( | 5730 postTask(BLINK_FROM_HERE, createCrossThreadTask(&runAddConsoleMessageTask, |
| 5725 BLINK_FROM_HERE, | 5731 consoleMessage->source(), |
| 5726 createCrossThreadTask(&runAddConsoleMessageTask, | 5732 consoleMessage->level(), |
| 5727 consoleMessage->source(), consoleMessage->level(), | 5733 consoleMessage->message())); |
| 5728 consoleMessage->message())); | |
| 5729 return; | 5734 return; |
| 5730 } | 5735 } |
| 5731 | 5736 |
| 5732 if (!m_frame) | 5737 if (!m_frame) |
| 5733 return; | 5738 return; |
| 5734 | 5739 |
| 5735 if (consoleMessage->location()->isUnknown()) { | 5740 if (consoleMessage->location()->isUnknown()) { |
| 5736 // TODO(dgozman): capture correct location at call places instead. | 5741 // TODO(dgozman): capture correct location at call places instead. |
| 5737 unsigned lineNumber = 0; | 5742 unsigned lineNumber = 0; |
| 5738 if (!isInDocumentWrite() && scriptableDocumentParser()) { | 5743 if (!isInDocumentWrite() && scriptableDocumentParser()) { |
| 5739 ScriptableDocumentParser* parser = scriptableDocumentParser(); | 5744 ScriptableDocumentParser* parser = scriptableDocumentParser(); |
| 5740 if (parser->isParsingAtLineNumber()) | 5745 if (parser->isParsingAtLineNumber()) |
| 5741 lineNumber = parser->lineNumber().oneBasedInt(); | 5746 lineNumber = parser->lineNumber().oneBasedInt(); |
| 5742 } | 5747 } |
| 5743 consoleMessage = ConsoleMessage::create( | 5748 consoleMessage = ConsoleMessage::create( |
| 5744 consoleMessage->source(), consoleMessage->level(), | 5749 consoleMessage->source(), consoleMessage->level(), |
| 5745 consoleMessage->message(), | 5750 consoleMessage->message(), |
| 5746 SourceLocation::create(url().getString(), lineNumber, 0, nullptr)); | 5751 SourceLocation::create(url().getString(), lineNumber, 0, nullptr)); |
| 5747 } | 5752 } |
| 5748 m_frame->console().addMessage(consoleMessage); | 5753 m_frame->console().addMessage(consoleMessage); |
| 5749 } | 5754 } |
| 5750 | 5755 |
| 5751 void Document::postTask(TaskType, | 5756 void Document::postTask(TaskType taskType, |
| 5752 const WebTraceLocation& location, | 5757 const WebTraceLocation& location, |
| 5753 std::unique_ptr<ExecutionContextTask> task, | 5758 std::unique_ptr<ExecutionContextTask> task, |
| 5754 const String& taskNameForInstrumentation) { | 5759 const String& taskNameForInstrumentation) { |
| 5755 m_taskRunner->postTask(location, std::move(task), taskNameForInstrumentation); | 5760 if (!taskNameForInstrumentation.isEmpty()) { |
| 5761 InspectorInstrumentation::asyncTaskScheduled( |
| 5762 this, taskNameForInstrumentation, task.get()); |
| 5763 } |
| 5764 |
| 5765 TaskRunnerHelper::get(taskType, this) |
| 5766 ->postTask(location, |
| 5767 crossThreadBind(&Document::runExecutionContextTask, |
| 5768 wrapCrossThreadWeakPersistent(this), |
| 5769 WTF::passed(std::move(task)), |
| 5770 !taskNameForInstrumentation.isEmpty())); |
| 5756 } | 5771 } |
| 5757 | 5772 |
| 5758 void Document::tasksWereSuspended() { | 5773 void Document::tasksWereSuspended() { |
| 5759 scriptRunner()->suspend(); | 5774 scriptRunner()->suspend(); |
| 5760 | 5775 |
| 5761 if (m_parser) | 5776 if (m_parser) |
| 5762 m_parser->suspendScheduledTasks(); | 5777 m_parser->suspendScheduledTasks(); |
| 5763 if (m_scriptedAnimationController) | 5778 if (m_scriptedAnimationController) |
| 5764 m_scriptedAnimationController->suspend(); | 5779 m_scriptedAnimationController->suspend(); |
| 5765 } | 5780 } |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6279 void Document::setAutofocusElement(Element* element) { | 6294 void Document::setAutofocusElement(Element* element) { |
| 6280 if (!element) { | 6295 if (!element) { |
| 6281 m_autofocusElement = nullptr; | 6296 m_autofocusElement = nullptr; |
| 6282 return; | 6297 return; |
| 6283 } | 6298 } |
| 6284 if (m_hasAutofocused) | 6299 if (m_hasAutofocused) |
| 6285 return; | 6300 return; |
| 6286 m_hasAutofocused = true; | 6301 m_hasAutofocused = true; |
| 6287 DCHECK(!m_autofocusElement); | 6302 DCHECK(!m_autofocusElement); |
| 6288 m_autofocusElement = element; | 6303 m_autofocusElement = element; |
| 6289 m_taskRunner->postTask(BLINK_FROM_HERE, | 6304 postTask(BLINK_FROM_HERE, createSameThreadTask(&runAutofocusTask)); |
| 6290 createSameThreadTask(&runAutofocusTask)); | |
| 6291 } | 6305 } |
| 6292 | 6306 |
| 6293 Element* Document::activeElement() const { | 6307 Element* Document::activeElement() const { |
| 6294 if (Element* element = adjustedFocusedElement()) | 6308 if (Element* element = adjustedFocusedElement()) |
| 6295 return element; | 6309 return element; |
| 6296 return body(); | 6310 return body(); |
| 6297 } | 6311 } |
| 6298 | 6312 |
| 6299 bool Document::hasFocus() const { | 6313 bool Document::hasFocus() const { |
| 6300 return page() && page()->focusController().isDocumentFocused(*this); | 6314 return page() && page()->focusController().isDocumentFocused(*this); |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6563 } | 6577 } |
| 6564 | 6578 |
| 6565 void showLiveDocumentInstances() { | 6579 void showLiveDocumentInstances() { |
| 6566 WeakDocumentSet& set = liveDocumentSet(); | 6580 WeakDocumentSet& set = liveDocumentSet(); |
| 6567 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6581 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 6568 for (Document* document : set) | 6582 for (Document* document : set) |
| 6569 fprintf(stderr, "- Document %p URL: %s\n", document, | 6583 fprintf(stderr, "- Document %p URL: %s\n", document, |
| 6570 document->url().getString().utf8().data()); | 6584 document->url().getString().utf8().data()); |
| 6571 } | 6585 } |
| 6572 #endif | 6586 #endif |
| OLD | NEW |