Chromium Code Reviews| 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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 402 } | 402 } |
| 403 | 403 |
| 404 Document::Document(const DocumentInit& initializer, | 404 Document::Document(const DocumentInit& initializer, |
| 405 DocumentClassFlags documentClasses) | 405 DocumentClassFlags documentClasses) |
| 406 : ContainerNode(0, CreateDocument), | 406 : ContainerNode(0, CreateDocument), |
| 407 TreeScope(*this), | 407 TreeScope(*this), |
| 408 m_hasNodesWithPlaceholderStyle(false), | 408 m_hasNodesWithPlaceholderStyle(false), |
| 409 m_evaluateMediaQueriesOnStyleRecalc(false), | 409 m_evaluateMediaQueriesOnStyleRecalc(false), |
| 410 m_pendingSheetLayout(NoLayoutWithPendingSheets), | 410 m_pendingSheetLayout(NoLayoutWithPendingSheets), |
| 411 m_frame(initializer.frame()), | 411 m_frame(initializer.frame()), |
| 412 m_domWindow(m_frame ? m_frame->localDOMWindow() : 0), | 412 // TODO(dcheng): Why does this need both a LocalFrame and LocalDOMWindow |
| 413 // pointer? | |
|
haraken
2016/12/12 09:54:59
I want to guarantee the following fact:
- When a
dcheng
2016/12/12 10:21:39
Yes, that's basically not possible today: because
dcheng
2016/12/12 10:32:23
ALso, in a followup CL, I want to explore removing
haraken
2016/12/13 07:22:22
You're right that e.g., frame()->domWindow() shoul
| |
| 414 m_domWindow(m_frame ? m_frame->domWindow() : nullptr), | |
| 413 m_importsController(this, initializer.importsController()), | 415 m_importsController(this, initializer.importsController()), |
| 414 m_contextFeatures(ContextFeatures::defaultSwitch()), | 416 m_contextFeatures(ContextFeatures::defaultSwitch()), |
| 415 m_wellFormed(false), | 417 m_wellFormed(false), |
| 416 m_implementation(this, nullptr), | 418 m_implementation(this, nullptr), |
| 417 m_printing(NotPrinting), | 419 m_printing(NotPrinting), |
| 418 m_paginatedForScreen(false), | 420 m_paginatedForScreen(false), |
| 419 m_compatibilityMode(NoQuirksMode), | 421 m_compatibilityMode(NoQuirksMode), |
| 420 m_compatibilityModeLocked(false), | 422 m_compatibilityModeLocked(false), |
| 421 m_hasAutofocused(false), | 423 m_hasAutofocused(false), |
| 422 m_clearFocusedElementTimer( | 424 m_clearFocusedElementTimer( |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 492 m_nodeCount(0), | 494 m_nodeCount(0), |
| 493 m_wouldLoadReason(Created), | 495 m_wouldLoadReason(Created), |
| 494 m_passwordCount(0) { | 496 m_passwordCount(0) { |
| 495 if (m_frame) { | 497 if (m_frame) { |
| 496 DCHECK(m_frame->page()); | 498 DCHECK(m_frame->page()); |
| 497 provideContextFeaturesToDocumentFrom(*this, *m_frame->page()); | 499 provideContextFeaturesToDocumentFrom(*this, *m_frame->page()); |
| 498 | 500 |
| 499 m_fetcher = m_frame->loader().documentLoader()->fetcher(); | 501 m_fetcher = m_frame->loader().documentLoader()->fetcher(); |
| 500 FrameFetchContext::provideDocumentToContext(m_fetcher->context(), this); | 502 FrameFetchContext::provideDocumentToContext(m_fetcher->context(), this); |
| 501 | 503 |
| 504 // TODO(dcheng): Why does this need to check that DOMWindow is non-null? | |
| 502 CustomElementRegistry* registry = | 505 CustomElementRegistry* registry = |
| 503 m_frame->localDOMWindow() | 506 m_frame->domWindow() ? m_frame->domWindow()->maybeCustomElements() |
| 504 ? m_frame->localDOMWindow()->maybeCustomElements() | 507 : nullptr; |
| 505 : nullptr; | |
| 506 if (registry && m_registrationContext) | 508 if (registry && m_registrationContext) |
| 507 registry->entangle(m_registrationContext); | 509 registry->entangle(m_registrationContext); |
| 508 } else if (m_importsController) { | 510 } else if (m_importsController) { |
| 509 m_fetcher = FrameFetchContext::createFetcherFromDocument(this); | 511 m_fetcher = FrameFetchContext::createFetcherFromDocument(this); |
| 510 } else { | 512 } else { |
| 511 m_fetcher = ResourceFetcher::create(nullptr); | 513 m_fetcher = ResourceFetcher::create(nullptr); |
| 512 } | 514 } |
| 513 DCHECK(m_fetcher); | 515 DCHECK(m_fetcher); |
| 514 | 516 |
| 515 m_rootScrollerController = RootScrollerController::create(*this); | 517 m_rootScrollerController = RootScrollerController::create(*this); |
| (...skipping 2505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3021 | 3023 |
| 3022 DocumentLoader* documentLoader = | 3024 DocumentLoader* documentLoader = |
| 3023 m_frame->loader().provisionalDocumentLoader(); | 3025 m_frame->loader().provisionalDocumentLoader(); |
| 3024 m_loadEventProgress = UnloadEventInProgress; | 3026 m_loadEventProgress = UnloadEventInProgress; |
| 3025 Event* unloadEvent(Event::create(EventTypeNames::unload)); | 3027 Event* unloadEvent(Event::create(EventTypeNames::unload)); |
| 3026 if (documentLoader && !documentLoader->timing().unloadEventStart() && | 3028 if (documentLoader && !documentLoader->timing().unloadEventStart() && |
| 3027 !documentLoader->timing().unloadEventEnd()) { | 3029 !documentLoader->timing().unloadEventEnd()) { |
| 3028 DocumentLoadTiming& timing = documentLoader->timing(); | 3030 DocumentLoadTiming& timing = documentLoader->timing(); |
| 3029 DCHECK(timing.navigationStart()); | 3031 DCHECK(timing.navigationStart()); |
| 3030 timing.markUnloadEventStart(); | 3032 timing.markUnloadEventStart(); |
| 3031 m_frame->localDOMWindow()->dispatchEvent(unloadEvent, this); | 3033 m_frame->domWindow()->dispatchEvent(unloadEvent, this); |
| 3032 timing.markUnloadEventEnd(); | 3034 timing.markUnloadEventEnd(); |
| 3033 } else { | 3035 } else { |
| 3034 m_frame->localDOMWindow()->dispatchEvent(unloadEvent, | 3036 m_frame->domWindow()->dispatchEvent(unloadEvent, m_frame->document()); |
| 3035 m_frame->document()); | |
| 3036 } | 3037 } |
| 3037 } | 3038 } |
| 3038 m_loadEventProgress = UnloadEventHandled; | 3039 m_loadEventProgress = UnloadEventHandled; |
| 3039 } | 3040 } |
| 3040 | 3041 |
| 3041 if (!m_frame) | 3042 if (!m_frame) |
| 3042 return; | 3043 return; |
| 3043 | 3044 |
| 3044 // Don't remove event listeners from a transitional empty document (see | 3045 // Don't remove event listeners from a transitional empty document (see |
| 3045 // https://bugs.webkit.org/show_bug.cgi?id=28716 for more information). | 3046 // https://bugs.webkit.org/show_bug.cgi?id=28716 for more information). |
| (...skipping 3542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6588 } | 6589 } |
| 6589 | 6590 |
| 6590 void showLiveDocumentInstances() { | 6591 void showLiveDocumentInstances() { |
| 6591 WeakDocumentSet& set = liveDocumentSet(); | 6592 WeakDocumentSet& set = liveDocumentSet(); |
| 6592 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6593 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 6593 for (Document* document : set) | 6594 for (Document* document : set) |
| 6594 fprintf(stderr, "- Document %p URL: %s\n", document, | 6595 fprintf(stderr, "- Document %p URL: %s\n", document, |
| 6595 document->url().getString().utf8().data()); | 6596 document->url().getString().utf8().data()); |
| 6596 } | 6597 } |
| 6597 #endif | 6598 #endif |
| OLD | NEW |