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, 2010, 2012 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 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) 2010 Nokia Corporation and/or its subsidiary(-ies) | 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
9 * Copyright (C) 2013 Google Inc. All rights reserved. | 9 * Copyright (C) 2013 Google Inc. All rights reserved. |
10 * | 10 * |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 static Document* parentDocument(LocalFrame* frame) | 42 static Document* parentDocument(LocalFrame* frame) |
43 { | 43 { |
44 if (!frame) | 44 if (!frame) |
45 return 0; | 45 return 0; |
46 Element* ownerElement = frame->deprecatedLocalOwner(); | 46 Element* ownerElement = frame->deprecatedLocalOwner(); |
47 if (!ownerElement) | 47 if (!ownerElement) |
48 return 0; | 48 return 0; |
49 return &ownerElement->document(); | 49 return &ownerElement->document(); |
50 } | 50 } |
51 | 51 |
52 | 52 DocumentInit::DocumentInit(const KURL& url, LocalFrame* frame, WeakPtrWillBeRawP
tr<Document> contextDocument, HTMLImportsController* importsController) |
53 static Document* ownerDocument(LocalFrame* frame) | 53 : DocumentInit(nullptr, url, frame, contextDocument, importsController) |
54 { | 54 { |
55 if (!frame) | |
56 return 0; | |
57 | |
58 Frame* ownerFrame = frame->tree().parent(); | |
59 if (!ownerFrame) | |
60 ownerFrame = frame->loader().opener(); | |
61 if (!ownerFrame || !ownerFrame->isLocalFrame()) | |
62 return 0; | |
63 return toLocalFrame(ownerFrame)->document(); | |
64 } | 55 } |
65 | 56 |
66 DocumentInit::DocumentInit(const KURL& url, LocalFrame* frame, WeakPtrWillBeRawP
tr<Document> contextDocument, HTMLImportsController* importsController) | 57 DocumentInit::DocumentInit(PassRefPtrWillBeRawPtr<Document> ownerDocument, const
KURL& url, LocalFrame* frame, WeakPtrWillBeRawPtr<Document> contextDocument, HT
MLImportsController* importsController) |
67 : m_url(url) | 58 : m_url(url) |
68 , m_frame(frame) | 59 , m_frame(frame) |
69 , m_parent(parentDocument(frame)) | 60 , m_parent(parentDocument(frame)) |
70 , m_owner(ownerDocument(frame)) | 61 , m_owner(ownerDocument) |
71 , m_contextDocument(contextDocument) | 62 , m_contextDocument(contextDocument) |
72 , m_importsController(importsController) | 63 , m_importsController(importsController) |
73 , m_createNewRegistrationContext(false) | 64 , m_createNewRegistrationContext(false) |
74 , m_shouldReuseDefaultView(frame && frame->shouldReuseDefaultView(url)) | 65 , m_shouldReuseDefaultView(frame && frame->shouldReuseDefaultView(url)) |
75 { | 66 { |
76 } | 67 } |
77 | 68 |
78 DocumentInit::DocumentInit(const DocumentInit&) = default; | 69 DocumentInit::DocumentInit(const DocumentInit&) = default; |
79 | 70 |
80 DocumentInit::~DocumentInit() | 71 DocumentInit::~DocumentInit() |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 return m_contextDocument; | 168 return m_contextDocument; |
178 } | 169 } |
179 | 170 |
180 DocumentInit DocumentInit::fromContext(WeakPtrWillBeRawPtr<Document> contextDocu
ment, const KURL& url) | 171 DocumentInit DocumentInit::fromContext(WeakPtrWillBeRawPtr<Document> contextDocu
ment, const KURL& url) |
181 { | 172 { |
182 return DocumentInit(url, 0, contextDocument, 0); | 173 return DocumentInit(url, 0, contextDocument, 0); |
183 } | 174 } |
184 | 175 |
185 } // namespace blink | 176 } // namespace blink |
186 | 177 |
OLD | NEW |