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 5296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5307 | 5307 |
5308 HTMLCollection* Document::WindowNamedItems(const AtomicString& name) { | 5308 HTMLCollection* Document::WindowNamedItems(const AtomicString& name) { |
5309 return EnsureCachedCollection<WindowNameCollection>(kWindowNamedItems, name); | 5309 return EnsureCachedCollection<WindowNameCollection>(kWindowNamedItems, name); |
5310 } | 5310 } |
5311 | 5311 |
5312 DocumentNameCollection* Document::DocumentNamedItems(const AtomicString& name) { | 5312 DocumentNameCollection* Document::DocumentNamedItems(const AtomicString& name) { |
5313 return EnsureCachedCollection<DocumentNameCollection>(kDocumentNamedItems, | 5313 return EnsureCachedCollection<DocumentNameCollection>(kDocumentNamedItems, |
5314 name); | 5314 name); |
5315 } | 5315 } |
5316 | 5316 |
| 5317 LocalDOMWindow* Document::defaultView() const { |
| 5318 // The HTML spec requires to return null if the document is detached from the |
| 5319 // DOM. However, |dom_window_| is not cleared on the detachment. So, we need |
| 5320 // to check |frame_| to tell whether the document is attached or not. |
| 5321 return frame_ ? dom_window_ : nullptr; |
| 5322 } |
| 5323 |
5317 void Document::FinishedParsing() { | 5324 void Document::FinishedParsing() { |
5318 DCHECK(!GetScriptableDocumentParser() || !parser_->IsParsing()); | 5325 DCHECK(!GetScriptableDocumentParser() || !parser_->IsParsing()); |
5319 DCHECK(!GetScriptableDocumentParser() || ready_state_ != kLoading); | 5326 DCHECK(!GetScriptableDocumentParser() || ready_state_ != kLoading); |
5320 SetParsingState(kInDOMContentLoaded); | 5327 SetParsingState(kInDOMContentLoaded); |
5321 DocumentParserTiming::From(*this).MarkParserStop(); | 5328 DocumentParserTiming::From(*this).MarkParserStop(); |
5322 | 5329 |
5323 // FIXME: DOMContentLoaded is dispatched synchronously, but this should be | 5330 // FIXME: DOMContentLoaded is dispatched synchronously, but this should be |
5324 // dispatched in a queued task, see https://crbug.com/425790 | 5331 // dispatched in a queued task, see https://crbug.com/425790 |
5325 if (!document_timing_.DomContentLoadedEventStart()) | 5332 if (!document_timing_.DomContentLoadedEventStart()) |
5326 document_timing_.MarkDomContentLoadedEventStart(); | 5333 document_timing_.MarkDomContentLoadedEventStart(); |
(...skipping 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6645 } | 6652 } |
6646 | 6653 |
6647 void showLiveDocumentInstances() { | 6654 void showLiveDocumentInstances() { |
6648 WeakDocumentSet& set = liveDocumentSet(); | 6655 WeakDocumentSet& set = liveDocumentSet(); |
6649 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6656 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
6650 for (blink::Document* document : set) | 6657 for (blink::Document* document : set) |
6651 fprintf(stderr, "- Document %p URL: %s\n", document, | 6658 fprintf(stderr, "- Document %p URL: %s\n", document, |
6652 document->Url().GetString().Utf8().Data()); | 6659 document->Url().GetString().Utf8().Data()); |
6653 } | 6660 } |
6654 #endif | 6661 #endif |
OLD | NEW |