Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2617733004: binding: Changes the association among global-proxy/global/window-instance. (Closed)
Patch Set: Fixed Document.defaultView Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 5190 matching lines...) Expand 10 before | Expand all | Expand 10 after
5201 5201
5202 HTMLCollection* Document::windowNamedItems(const AtomicString& name) { 5202 HTMLCollection* Document::windowNamedItems(const AtomicString& name) {
5203 return ensureCachedCollection<WindowNameCollection>(WindowNamedItems, name); 5203 return ensureCachedCollection<WindowNameCollection>(WindowNamedItems, name);
5204 } 5204 }
5205 5205
5206 DocumentNameCollection* Document::documentNamedItems(const AtomicString& name) { 5206 DocumentNameCollection* Document::documentNamedItems(const AtomicString& name) {
5207 return ensureCachedCollection<DocumentNameCollection>(DocumentNamedItems, 5207 return ensureCachedCollection<DocumentNameCollection>(DocumentNamedItems,
5208 name); 5208 name);
5209 } 5209 }
5210 5210
5211 LocalDOMWindow* Document::defaultView() const {
5212 return m_frame ? m_domWindow : nullptr;
haraken 2017/02/09 12:46:40 Would you help me understand why we need to check
Yuki 2017/02/10 07:47:21 https://html.spec.whatwg.org/multipage/browsers.ht
haraken 2017/02/10 07:59:40 I'm wondering why this cannot be 'return m_domWind
Yuki 2017/02/10 08:18:19 I read code a little, and found that - m_domWindow
haraken 2017/02/10 09:15:31 Makes sense. Can you add a comment about it?
Yuki 2017/02/10 11:22:47 Done.
5213 }
5214
5211 void Document::finishedParsing() { 5215 void Document::finishedParsing() {
5212 DCHECK(!scriptableDocumentParser() || !m_parser->isParsing()); 5216 DCHECK(!scriptableDocumentParser() || !m_parser->isParsing());
5213 DCHECK(!scriptableDocumentParser() || m_readyState != Loading); 5217 DCHECK(!scriptableDocumentParser() || m_readyState != Loading);
5214 setParsingState(InDOMContentLoaded); 5218 setParsingState(InDOMContentLoaded);
5215 DocumentParserTiming::from(*this).markParserStop(); 5219 DocumentParserTiming::from(*this).markParserStop();
5216 5220
5217 // FIXME: DOMContentLoaded is dispatched synchronously, but this should be 5221 // FIXME: DOMContentLoaded is dispatched synchronously, but this should be
5218 // dispatched in a queued task, see https://crbug.com/425790 5222 // dispatched in a queued task, see https://crbug.com/425790
5219 if (!m_documentTiming.domContentLoadedEventStart()) 5223 if (!m_documentTiming.domContentLoadedEventStart())
5220 m_documentTiming.markDomContentLoadedEventStart(); 5224 m_documentTiming.markDomContentLoadedEventStart();
(...skipping 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after
6571 } 6575 }
6572 6576
6573 void showLiveDocumentInstances() { 6577 void showLiveDocumentInstances() {
6574 WeakDocumentSet& set = liveDocumentSet(); 6578 WeakDocumentSet& set = liveDocumentSet();
6575 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6579 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6576 for (Document* document : set) 6580 for (Document* document : set)
6577 fprintf(stderr, "- Document %p URL: %s\n", document, 6581 fprintf(stderr, "- Document %p URL: %s\n", document,
6578 document->url().getString().utf8().data()); 6582 document->url().getString().utf8().data());
6579 } 6583 }
6580 #endif 6584 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698