| 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 #include "platform/EventDispatchForbiddenScope.h" | 196 #include "platform/EventDispatchForbiddenScope.h" |
| 197 #include "platform/Language.h" | 197 #include "platform/Language.h" |
| 198 #include "platform/LengthFunctions.h" | 198 #include "platform/LengthFunctions.h" |
| 199 #include "platform/Logging.h" | 199 #include "platform/Logging.h" |
| 200 #include "platform/PluginScriptForbiddenScope.h" | 200 #include "platform/PluginScriptForbiddenScope.h" |
| 201 #include "platform/RuntimeEnabledFeatures.h" | 201 #include "platform/RuntimeEnabledFeatures.h" |
| 202 #include "platform/ScriptForbiddenScope.h" | 202 #include "platform/ScriptForbiddenScope.h" |
| 203 #include "platform/TraceEvent.h" | 203 #include "platform/TraceEvent.h" |
| 204 #include "platform/network/ContentSecurityPolicyParsers.h" | 204 #include "platform/network/ContentSecurityPolicyParsers.h" |
| 205 #include "platform/network/HTTPParsers.h" | 205 #include "platform/network/HTTPParsers.h" |
| 206 #include "platform/scheduler/CancellableTaskFactory.h" |
| 206 #include "platform/scroll/ScrollbarTheme.h" | 207 #include "platform/scroll/ScrollbarTheme.h" |
| 207 #include "platform/text/PlatformLocale.h" | 208 #include "platform/text/PlatformLocale.h" |
| 208 #include "platform/text/SegmentedString.h" | 209 #include "platform/text/SegmentedString.h" |
| 209 #include "platform/weborigin/OriginAccessEntry.h" | 210 #include "platform/weborigin/OriginAccessEntry.h" |
| 210 #include "platform/weborigin/SchemeRegistry.h" | 211 #include "platform/weborigin/SchemeRegistry.h" |
| 211 #include "platform/weborigin/SecurityOrigin.h" | 212 #include "platform/weborigin/SecurityOrigin.h" |
| 212 #include "public/platform/Platform.h" | 213 #include "public/platform/Platform.h" |
| 213 #include "wtf/CurrentTime.h" | 214 #include "wtf/CurrentTime.h" |
| 214 #include "wtf/DateMath.h" | 215 #include "wtf/DateMath.h" |
| 215 #include "wtf/Functional.h" | 216 #include "wtf/Functional.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 void performTask(ExecutionContext* context) override | 360 void performTask(ExecutionContext* context) override |
| 360 { | 361 { |
| 361 Document* document = toDocument(context); | 362 Document* document = toDocument(context); |
| 362 if (RefPtrWillBeRawPtr<Element> element = document->autofocusElement())
{ | 363 if (RefPtrWillBeRawPtr<Element> element = document->autofocusElement())
{ |
| 363 document->setAutofocusElement(0); | 364 document->setAutofocusElement(0); |
| 364 element->focus(); | 365 element->focus(); |
| 365 } | 366 } |
| 366 } | 367 } |
| 367 }; | 368 }; |
| 368 | 369 |
| 369 } // namespace blink | |
| 370 | |
| 371 namespace WTF { | |
| 372 | |
| 373 #if ENABLE(OILPAN) | |
| 374 // NOTE this is to prevent Document::m_executeScriptsWaitingForResourcesTask fro
m leaking. | |
| 375 template<> | |
| 376 struct PointerParamStorageTraits<blink::Document*, true> { | |
| 377 using StorageType = blink::CrossThreadWeakPersistent<blink::Document>; | |
| 378 | |
| 379 static StorageType wrap(blink::Document* value) { return value; } | |
| 380 static blink::Document* unwrap(const StorageType& value) { return value.get(
); } | |
| 381 }; | |
| 382 #endif | |
| 383 | |
| 384 } // namespace WTF | |
| 385 | |
| 386 namespace blink { | |
| 387 | |
| 388 Document::Document(const DocumentInit& initializer, DocumentClassFlags documentC
lasses) | 370 Document::Document(const DocumentInit& initializer, DocumentClassFlags documentC
lasses) |
| 389 : ContainerNode(0, CreateDocument) | 371 : ContainerNode(0, CreateDocument) |
| 390 , TreeScope(*this) | 372 , TreeScope(*this) |
| 391 , m_hasNodesWithPlaceholderStyle(false) | 373 , m_hasNodesWithPlaceholderStyle(false) |
| 392 , m_evaluateMediaQueriesOnStyleRecalc(false) | 374 , m_evaluateMediaQueriesOnStyleRecalc(false) |
| 393 , m_pendingSheetLayout(NoLayoutWithPendingSheets) | 375 , m_pendingSheetLayout(NoLayoutWithPendingSheets) |
| 394 , m_frame(initializer.frame()) | 376 , m_frame(initializer.frame()) |
| 395 , m_domWindow(m_frame ? m_frame->localDOMWindow() : 0) | 377 , m_domWindow(m_frame ? m_frame->localDOMWindow() : 0) |
| 396 , m_importsController(initializer.importsController()) | 378 , m_importsController(initializer.importsController()) |
| 397 , m_activeParserCount(0) | 379 , m_activeParserCount(0) |
| 398 , m_contextFeatures(ContextFeatures::defaultSwitch()) | 380 , m_contextFeatures(ContextFeatures::defaultSwitch()) |
| 399 , m_wellFormed(false) | 381 , m_wellFormed(false) |
| 400 , m_printing(false) | 382 , m_printing(false) |
| 401 , m_paginatedForScreen(false) | 383 , m_paginatedForScreen(false) |
| 402 , m_compatibilityMode(NoQuirksMode) | 384 , m_compatibilityMode(NoQuirksMode) |
| 403 , m_compatibilityModeLocked(false) | 385 , m_compatibilityModeLocked(false) |
| 404 , m_executeScriptsWaitingForResourcesTask(WTF::bind(&Document::executeScript
sWaitingForResources, this)) | 386 , m_executeScriptsWaitingForResourcesTask(CancellableTaskFactory::create(thi
s, &Document::executeScriptsWaitingForResources)) |
| 405 , m_hasAutofocused(false) | 387 , m_hasAutofocused(false) |
| 406 , m_clearFocusedElementTimer(this, &Document::clearFocusedElementTimerFired) | 388 , m_clearFocusedElementTimer(this, &Document::clearFocusedElementTimerFired) |
| 407 , m_domTreeVersion(++s_globalTreeVersion) | 389 , m_domTreeVersion(++s_globalTreeVersion) |
| 408 , m_styleVersion(0) | 390 , m_styleVersion(0) |
| 409 , m_listenerTypes(0) | 391 , m_listenerTypes(0) |
| 410 , m_mutationObserverTypes(0) | 392 , m_mutationObserverTypes(0) |
| 411 , m_visitedLinkState(VisitedLinkState::create(*this)) | 393 , m_visitedLinkState(VisitedLinkState::create(*this)) |
| 412 , m_visuallyOrdered(false) | 394 , m_visuallyOrdered(false) |
| 413 , m_readyState(Complete) | 395 , m_readyState(Complete) |
| 414 , m_parsingState(FinishedParsing) | 396 , m_parsingState(FinishedParsing) |
| (...skipping 2560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2975 if (HTMLImportLoader* import = importLoader()) | 2957 if (HTMLImportLoader* import = importLoader()) |
| 2976 import->didRemoveAllPendingStylesheet(); | 2958 import->didRemoveAllPendingStylesheet(); |
| 2977 if (!haveImportsLoaded()) | 2959 if (!haveImportsLoaded()) |
| 2978 return; | 2960 return; |
| 2979 didLoadAllScriptBlockingResources(); | 2961 didLoadAllScriptBlockingResources(); |
| 2980 } | 2962 } |
| 2981 | 2963 |
| 2982 void Document::didLoadAllScriptBlockingResources() | 2964 void Document::didLoadAllScriptBlockingResources() |
| 2983 { | 2965 { |
| 2984 Platform::current()->currentThread()->scheduler()->loadingTaskRunner()->post
Task( | 2966 Platform::current()->currentThread()->scheduler()->loadingTaskRunner()->post
Task( |
| 2985 FROM_HERE, m_executeScriptsWaitingForResourcesTask.cancelAndCreate()); | 2967 FROM_HERE, m_executeScriptsWaitingForResourcesTask->cancelAndCreate()); |
| 2986 | 2968 |
| 2987 if (frame()) | 2969 if (frame()) |
| 2988 frame()->loader().client()->didRemoveAllPendingStylesheet(); | 2970 frame()->loader().client()->didRemoveAllPendingStylesheet(); |
| 2989 | 2971 |
| 2990 if (m_gotoAnchorNeededAfterStylesheetsLoad && view()) | 2972 if (m_gotoAnchorNeededAfterStylesheetsLoad && view()) |
| 2991 view()->processUrlFragment(m_url); | 2973 view()->processUrlFragment(m_url); |
| 2992 } | 2974 } |
| 2993 | 2975 |
| 2994 void Document::executeScriptsWaitingForResources() | 2976 void Document::executeScriptsWaitingForResources() |
| 2995 { | 2977 { |
| (...skipping 2745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5741 #ifndef NDEBUG | 5723 #ifndef NDEBUG |
| 5742 using namespace blink; | 5724 using namespace blink; |
| 5743 void showLiveDocumentInstances() | 5725 void showLiveDocumentInstances() |
| 5744 { | 5726 { |
| 5745 Document::WeakDocumentSet& set = Document::liveDocumentSet(); | 5727 Document::WeakDocumentSet& set = Document::liveDocumentSet(); |
| 5746 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5728 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 5747 for (Document* document : set) | 5729 for (Document* document : set) |
| 5748 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); | 5730 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); |
| 5749 } | 5731 } |
| 5750 #endif | 5732 #endif |
| OLD | NEW |