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 1927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1938 } | 1938 } |
1939 | 1939 |
1940 void Document::setNeedsFocusedElementCheck() | 1940 void Document::setNeedsFocusedElementCheck() |
1941 { | 1941 { |
1942 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::createWit
hExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Focus)); | 1942 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::createWit
hExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Focus)); |
1943 } | 1943 } |
1944 | 1944 |
1945 void Document::clearFocusedElementSoon() | 1945 void Document::clearFocusedElementSoon() |
1946 { | 1946 { |
1947 if (!m_clearFocusedElementTimer.isActive()) | 1947 if (!m_clearFocusedElementTimer.isActive()) |
1948 m_clearFocusedElementTimer.startOneShot(0, FROM_HERE); | 1948 m_clearFocusedElementTimer.startOneShot(0, BLINK_FROM_HERE); |
1949 } | 1949 } |
1950 | 1950 |
1951 void Document::clearFocusedElementTimerFired(Timer<Document>*) | 1951 void Document::clearFocusedElementTimerFired(Timer<Document>*) |
1952 { | 1952 { |
1953 updateLayoutTreeIfNeeded(); | 1953 updateLayoutTreeIfNeeded(); |
1954 m_clearFocusedElementTimer.stop(); | 1954 m_clearFocusedElementTimer.stop(); |
1955 | 1955 |
1956 if (m_focusedElement && !m_focusedElement->isFocusable()) | 1956 if (m_focusedElement && !m_focusedElement->isFocusable()) |
1957 m_focusedElement->blur(); | 1957 m_focusedElement->blur(); |
1958 } | 1958 } |
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2992 if (HTMLImportLoader* import = importLoader()) | 2992 if (HTMLImportLoader* import = importLoader()) |
2993 import->didRemoveAllPendingStylesheet(); | 2993 import->didRemoveAllPendingStylesheet(); |
2994 if (!haveImportsLoaded()) | 2994 if (!haveImportsLoaded()) |
2995 return; | 2995 return; |
2996 didLoadAllScriptBlockingResources(); | 2996 didLoadAllScriptBlockingResources(); |
2997 } | 2997 } |
2998 | 2998 |
2999 void Document::didLoadAllScriptBlockingResources() | 2999 void Document::didLoadAllScriptBlockingResources() |
3000 { | 3000 { |
3001 Platform::current()->currentThread()->scheduler()->loadingTaskRunner()->post
Task( | 3001 Platform::current()->currentThread()->scheduler()->loadingTaskRunner()->post
Task( |
3002 FROM_HERE, m_executeScriptsWaitingForResourcesTask->cancelAndCreate()); | 3002 BLINK_FROM_HERE, m_executeScriptsWaitingForResourcesTask->cancelAndCreat
e()); |
3003 | 3003 |
3004 if (frame()) | 3004 if (frame()) |
3005 frame()->loader().client()->didRemoveAllPendingStylesheet(); | 3005 frame()->loader().client()->didRemoveAllPendingStylesheet(); |
3006 | 3006 |
3007 if (m_gotoAnchorNeededAfterStylesheetsLoad && view()) | 3007 if (m_gotoAnchorNeededAfterStylesheetsLoad && view()) |
3008 view()->processUrlFragment(m_url); | 3008 view()->processUrlFragment(m_url); |
3009 } | 3009 } |
3010 | 3010 |
3011 void Document::executeScriptsWaitingForResources() | 3011 void Document::executeScriptsWaitingForResources() |
3012 { | 3012 { |
(...skipping 1585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4598 frame->loader().finishedParsing(); | 4598 frame->loader().finishedParsing(); |
4599 | 4599 |
4600 TRACE_EVENT_INSTANT1("devtools.timeline", "MarkDOMContent", TRACE_EVENT_
SCOPE_THREAD, "data", InspectorMarkLoadEvent::data(frame.get())); | 4600 TRACE_EVENT_INSTANT1("devtools.timeline", "MarkDOMContent", TRACE_EVENT_
SCOPE_THREAD, "data", InspectorMarkLoadEvent::data(frame.get())); |
4601 InspectorInstrumentation::domContentLoadedEventFired(frame.get()); | 4601 InspectorInstrumentation::domContentLoadedEventFired(frame.get()); |
4602 } | 4602 } |
4603 | 4603 |
4604 // Schedule dropping of the ElementDataCache. We keep it alive for a while a
fter parsing finishes | 4604 // Schedule dropping of the ElementDataCache. We keep it alive for a while a
fter parsing finishes |
4605 // so that dynamically inserted content can also benefit from sharing optimi
zations. | 4605 // so that dynamically inserted content can also benefit from sharing optimi
zations. |
4606 // Note that we don't refresh the timer on cache access since that could lea
d to huge caches being kept | 4606 // Note that we don't refresh the timer on cache access since that could lea
d to huge caches being kept |
4607 // alive indefinitely by something innocuous like JS setting .innerHTML repe
atedly on a timer. | 4607 // alive indefinitely by something innocuous like JS setting .innerHTML repe
atedly on a timer. |
4608 m_elementDataCacheClearTimer.startOneShot(10, FROM_HERE); | 4608 m_elementDataCacheClearTimer.startOneShot(10, BLINK_FROM_HERE); |
4609 | 4609 |
4610 // Parser should have picked up all preloads by now | 4610 // Parser should have picked up all preloads by now |
4611 m_fetcher->clearPreloads(); | 4611 m_fetcher->clearPreloads(); |
4612 } | 4612 } |
4613 | 4613 |
4614 void Document::elementDataCacheClearTimerFired(Timer<Document>*) | 4614 void Document::elementDataCacheClearTimerFired(Timer<Document>*) |
4615 { | 4615 { |
4616 m_elementDataCache.clear(); | 4616 m_elementDataCache.clear(); |
4617 } | 4617 } |
4618 | 4618 |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4867 | 4867 |
4868 bool Document::isContextThread() const | 4868 bool Document::isContextThread() const |
4869 { | 4869 { |
4870 return isMainThread(); | 4870 return isMainThread(); |
4871 } | 4871 } |
4872 | 4872 |
4873 void Document::updateFocusAppearanceSoon(bool restorePreviousSelection) | 4873 void Document::updateFocusAppearanceSoon(bool restorePreviousSelection) |
4874 { | 4874 { |
4875 m_updateFocusAppearanceRestoresSelection = restorePreviousSelection; | 4875 m_updateFocusAppearanceRestoresSelection = restorePreviousSelection; |
4876 if (!m_updateFocusAppearanceTimer.isActive()) | 4876 if (!m_updateFocusAppearanceTimer.isActive()) |
4877 m_updateFocusAppearanceTimer.startOneShot(0, FROM_HERE); | 4877 m_updateFocusAppearanceTimer.startOneShot(0, BLINK_FROM_HERE); |
4878 } | 4878 } |
4879 | 4879 |
4880 void Document::cancelFocusAppearanceUpdate() | 4880 void Document::cancelFocusAppearanceUpdate() |
4881 { | 4881 { |
4882 m_updateFocusAppearanceTimer.stop(); | 4882 m_updateFocusAppearanceTimer.stop(); |
4883 } | 4883 } |
4884 | 4884 |
4885 void Document::updateFocusAppearanceTimerFired(Timer<Document>*) | 4885 void Document::updateFocusAppearanceTimerFired(Timer<Document>*) |
4886 { | 4886 { |
4887 Element* element = focusedElement(); | 4887 Element* element = focusedElement(); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4953 } | 4953 } |
4954 | 4954 |
4955 void Document::reportBlockedScriptExecutionToInspector(const String& directiveTe
xt) | 4955 void Document::reportBlockedScriptExecutionToInspector(const String& directiveTe
xt) |
4956 { | 4956 { |
4957 InspectorInstrumentation::scriptExecutionBlockedByCSP(this, directiveText); | 4957 InspectorInstrumentation::scriptExecutionBlockedByCSP(this, directiveText); |
4958 } | 4958 } |
4959 | 4959 |
4960 void Document::addConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage> consoleM
essage) | 4960 void Document::addConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage> consoleM
essage) |
4961 { | 4961 { |
4962 if (!isContextThread()) { | 4962 if (!isContextThread()) { |
4963 m_taskRunner->postTask(FROM_HERE, AddConsoleMessageTask::create(consoleM
essage->source(), consoleMessage->level(), consoleMessage->message())); | 4963 m_taskRunner->postTask(BLINK_FROM_HERE, AddConsoleMessageTask::create(co
nsoleMessage->source(), consoleMessage->level(), consoleMessage->message())); |
4964 return; | 4964 return; |
4965 } | 4965 } |
4966 | 4966 |
4967 if (!m_frame) | 4967 if (!m_frame) |
4968 return; | 4968 return; |
4969 | 4969 |
4970 if (!consoleMessage->scriptState() && consoleMessage->url().isNull() && !con
soleMessage->lineNumber()) { | 4970 if (!consoleMessage->scriptState() && consoleMessage->url().isNull() && !con
soleMessage->lineNumber()) { |
4971 consoleMessage->setURL(url().string()); | 4971 consoleMessage->setURL(url().string()); |
4972 if (!isInDocumentWrite() && scriptableDocumentParser()) { | 4972 if (!isInDocumentWrite() && scriptableDocumentParser()) { |
4973 ScriptableDocumentParser* parser = scriptableDocumentParser(); | 4973 ScriptableDocumentParser* parser = scriptableDocumentParser(); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5102 ASSERT(m_loadEventDelayCount); | 5102 ASSERT(m_loadEventDelayCount); |
5103 --m_loadEventDelayCount; | 5103 --m_loadEventDelayCount; |
5104 | 5104 |
5105 if (!m_loadEventDelayCount) | 5105 if (!m_loadEventDelayCount) |
5106 checkLoadEventSoon(); | 5106 checkLoadEventSoon(); |
5107 } | 5107 } |
5108 | 5108 |
5109 void Document::checkLoadEventSoon() | 5109 void Document::checkLoadEventSoon() |
5110 { | 5110 { |
5111 if (frame() && !m_loadEventDelayTimer.isActive()) | 5111 if (frame() && !m_loadEventDelayTimer.isActive()) |
5112 m_loadEventDelayTimer.startOneShot(0, FROM_HERE); | 5112 m_loadEventDelayTimer.startOneShot(0, BLINK_FROM_HERE); |
5113 } | 5113 } |
5114 | 5114 |
5115 bool Document::isDelayingLoadEvent() | 5115 bool Document::isDelayingLoadEvent() |
5116 { | 5116 { |
5117 #if ENABLE(OILPAN) | 5117 #if ENABLE(OILPAN) |
5118 // Always delay load events until after garbage collection. | 5118 // Always delay load events until after garbage collection. |
5119 // This way we don't have to explicitly delay load events via | 5119 // This way we don't have to explicitly delay load events via |
5120 // incrementLoadEventDelayCount and decrementLoadEventDelayCount in | 5120 // incrementLoadEventDelayCount and decrementLoadEventDelayCount in |
5121 // Node destructors. | 5121 // Node destructors. |
5122 if (ThreadState::current()->sweepForbidden()) { | 5122 if (ThreadState::current()->sweepForbidden()) { |
5123 if (!m_loadEventDelayCount) | 5123 if (!m_loadEventDelayCount) |
5124 checkLoadEventSoon(); | 5124 checkLoadEventSoon(); |
5125 return true; | 5125 return true; |
5126 } | 5126 } |
5127 #endif | 5127 #endif |
5128 return m_loadEventDelayCount; | 5128 return m_loadEventDelayCount; |
5129 } | 5129 } |
5130 | 5130 |
5131 | 5131 |
5132 void Document::loadEventDelayTimerFired(Timer<Document>*) | 5132 void Document::loadEventDelayTimerFired(Timer<Document>*) |
5133 { | 5133 { |
5134 if (frame()) | 5134 if (frame()) |
5135 frame()->loader().checkCompleted(); | 5135 frame()->loader().checkCompleted(); |
5136 } | 5136 } |
5137 | 5137 |
5138 void Document::loadPluginsSoon() | 5138 void Document::loadPluginsSoon() |
5139 { | 5139 { |
5140 // FIXME: Remove this timer once we don't need to compute layout to load plu
gins. | 5140 // FIXME: Remove this timer once we don't need to compute layout to load plu
gins. |
5141 if (!m_pluginLoadingTimer.isActive()) | 5141 if (!m_pluginLoadingTimer.isActive()) |
5142 m_pluginLoadingTimer.startOneShot(0, FROM_HERE); | 5142 m_pluginLoadingTimer.startOneShot(0, BLINK_FROM_HERE); |
5143 } | 5143 } |
5144 | 5144 |
5145 void Document::pluginLoadingTimerFired(Timer<Document>*) | 5145 void Document::pluginLoadingTimerFired(Timer<Document>*) |
5146 { | 5146 { |
5147 updateLayout(); | 5147 updateLayout(); |
5148 } | 5148 } |
5149 | 5149 |
5150 ScriptedAnimationController& Document::ensureScriptedAnimationController() | 5150 ScriptedAnimationController& Document::ensureScriptedAnimationController() |
5151 { | 5151 { |
5152 if (!m_scriptedAnimationController) { | 5152 if (!m_scriptedAnimationController) { |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5466 | 5466 |
5467 return *m_templateDocument.get(); | 5467 return *m_templateDocument.get(); |
5468 } | 5468 } |
5469 | 5469 |
5470 void Document::didAssociateFormControl(Element* element) | 5470 void Document::didAssociateFormControl(Element* element) |
5471 { | 5471 { |
5472 if (!frame() || !frame()->page()) | 5472 if (!frame() || !frame()->page()) |
5473 return; | 5473 return; |
5474 m_associatedFormControls.add(element); | 5474 m_associatedFormControls.add(element); |
5475 if (!m_didAssociateFormControlsTimer.isActive()) | 5475 if (!m_didAssociateFormControlsTimer.isActive()) |
5476 m_didAssociateFormControlsTimer.startOneShot(0, FROM_HERE); | 5476 m_didAssociateFormControlsTimer.startOneShot(0, BLINK_FROM_HERE); |
5477 } | 5477 } |
5478 | 5478 |
5479 void Document::removeFormAssociation(Element* element) | 5479 void Document::removeFormAssociation(Element* element) |
5480 { | 5480 { |
5481 auto it = m_associatedFormControls.find(element); | 5481 auto it = m_associatedFormControls.find(element); |
5482 if (it == m_associatedFormControls.end()) | 5482 if (it == m_associatedFormControls.end()) |
5483 return; | 5483 return; |
5484 m_associatedFormControls.remove(it); | 5484 m_associatedFormControls.remove(it); |
5485 if (m_associatedFormControls.isEmpty()) | 5485 if (m_associatedFormControls.isEmpty()) |
5486 m_didAssociateFormControlsTimer.stop(); | 5486 m_didAssociateFormControlsTimer.stop(); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5535 { | 5535 { |
5536 if (!element) { | 5536 if (!element) { |
5537 m_autofocusElement = nullptr; | 5537 m_autofocusElement = nullptr; |
5538 return; | 5538 return; |
5539 } | 5539 } |
5540 if (m_hasAutofocused) | 5540 if (m_hasAutofocused) |
5541 return; | 5541 return; |
5542 m_hasAutofocused = true; | 5542 m_hasAutofocused = true; |
5543 ASSERT(!m_autofocusElement); | 5543 ASSERT(!m_autofocusElement); |
5544 m_autofocusElement = element; | 5544 m_autofocusElement = element; |
5545 m_taskRunner->postTask(FROM_HERE, AutofocusTask::create()); | 5545 m_taskRunner->postTask(BLINK_FROM_HERE, AutofocusTask::create()); |
5546 } | 5546 } |
5547 | 5547 |
5548 Element* Document::activeElement() const | 5548 Element* Document::activeElement() const |
5549 { | 5549 { |
5550 if (Element* element = adjustedFocusedElement()) | 5550 if (Element* element = adjustedFocusedElement()) |
5551 return element; | 5551 return element; |
5552 return body(); | 5552 return body(); |
5553 } | 5553 } |
5554 | 5554 |
5555 bool Document::hasFocus() const | 5555 bool Document::hasFocus() const |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5778 #ifndef NDEBUG | 5778 #ifndef NDEBUG |
5779 using namespace blink; | 5779 using namespace blink; |
5780 void showLiveDocumentInstances() | 5780 void showLiveDocumentInstances() |
5781 { | 5781 { |
5782 Document::WeakDocumentSet& set = Document::liveDocumentSet(); | 5782 Document::WeakDocumentSet& set = Document::liveDocumentSet(); |
5783 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5783 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
5784 for (Document* document : set) | 5784 for (Document* document : set) |
5785 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); | 5785 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); |
5786 } | 5786 } |
5787 #endif | 5787 #endif |
OLD | NEW |