| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> | 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
| 3 * 1999 Lars Knoll <knoll@kde.org> | 3 * 1999 Lars Knoll <knoll@kde.org> |
| 4 * 1999 Antti Koivisto <koivisto@kde.org> | 4 * 1999 Antti Koivisto <koivisto@kde.org> |
| 5 * 2000 Simon Hausmann <hausmann@kde.org> | 5 * 2000 Simon Hausmann <hausmann@kde.org> |
| 6 * 2000 Stefan Schimanski <1Stein@gmx.de> | 6 * 2000 Stefan Schimanski <1Stein@gmx.de> |
| 7 * 2001 George Staikos <staikos@kde.org> | 7 * 2001 George Staikos <staikos@kde.org> |
| 8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All | 8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All |
| 9 * rights reserved. | 9 * rights reserved. |
| 10 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> | 10 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 using namespace HTMLNames; | 57 using namespace HTMLNames; |
| 58 | 58 |
| 59 Frame::~Frame() { | 59 Frame::~Frame() { |
| 60 InstanceCounters::decrementCounter(InstanceCounters::FrameCounter); | 60 InstanceCounters::decrementCounter(InstanceCounters::FrameCounter); |
| 61 ASSERT(!m_owner); | 61 ASSERT(!m_owner); |
| 62 } | 62 } |
| 63 | 63 |
| 64 DEFINE_TRACE(Frame) { | 64 DEFINE_TRACE(Frame) { |
| 65 visitor->trace(m_treeNode); | 65 visitor->trace(m_treeNode); |
| 66 visitor->trace(m_host); | 66 visitor->trace(m_page); |
| 67 visitor->trace(m_owner); | 67 visitor->trace(m_owner); |
| 68 visitor->trace(m_windowProxyManager); | 68 visitor->trace(m_windowProxyManager); |
| 69 visitor->trace(m_domWindow); | 69 visitor->trace(m_domWindow); |
| 70 visitor->trace(m_client); | 70 visitor->trace(m_client); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void Frame::detach(FrameDetachType type) { | 73 void Frame::detach(FrameDetachType type) { |
| 74 ASSERT(m_client); | 74 ASSERT(m_client); |
| 75 m_client->setOpener(0); | 75 m_client->setOpener(0); |
| 76 disconnectOwnerElement(); | 76 disconnectOwnerElement(); |
| 77 // After this, we must no longer talk to the client since this clears | 77 // After this, we must no longer talk to the client since this clears |
| 78 // its owning reference back to our owning LocalFrame. | 78 // its owning reference back to our owning LocalFrame. |
| 79 m_client->detached(type); | 79 m_client->detached(type); |
| 80 m_client = nullptr; | 80 m_client = nullptr; |
| 81 m_host = nullptr; | 81 m_page = nullptr; |
| 82 } | 82 } |
| 83 | 83 |
| 84 void Frame::disconnectOwnerElement() { | 84 void Frame::disconnectOwnerElement() { |
| 85 if (m_owner) { | 85 if (m_owner) { |
| 86 // Ocassionally, provisional frames need to be detached, but it shouldn't | 86 // Ocassionally, provisional frames need to be detached, but it shouldn't |
| 87 // affect the frame tree structure. Make sure the frame owner's content | 87 // affect the frame tree structure. Make sure the frame owner's content |
| 88 // frame actually refers to this frame before clearing it. | 88 // frame actually refers to this frame before clearing it. |
| 89 // TODO(dcheng): https://crbug.com/578349 tracks the cleanup for this once | 89 // TODO(dcheng): https://crbug.com/578349 tracks the cleanup for this once |
| 90 // it's no longer needed. | 90 // it's no longer needed. |
| 91 if (m_owner->contentFrame() == this) | 91 if (m_owner->contentFrame() == this) |
| 92 m_owner->clearContentFrame(); | 92 m_owner->clearContentFrame(); |
| 93 m_owner = nullptr; | 93 m_owner = nullptr; |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 | 96 |
| 97 Page* Frame::page() const { | 97 Page* Frame::page() const { |
| 98 if (m_host) | 98 return m_page; |
| 99 return &m_host->page(); | 99 } |
| 100 |
| 101 FrameHost* Frame::host() const { |
| 102 if (m_page) |
| 103 return &m_page->frameHost(); |
| 100 return nullptr; | 104 return nullptr; |
| 101 } | 105 } |
| 102 | 106 |
| 103 FrameHost* Frame::host() const { | |
| 104 return m_host; | |
| 105 } | |
| 106 | |
| 107 bool Frame::isMainFrame() const { | 107 bool Frame::isMainFrame() const { |
| 108 return !tree().parent(); | 108 return !tree().parent(); |
| 109 } | 109 } |
| 110 | 110 |
| 111 bool Frame::isLocalRoot() const { | 111 bool Frame::isLocalRoot() const { |
| 112 if (isRemoteFrame()) | 112 if (isRemoteFrame()) |
| 113 return false; | 113 return false; |
| 114 | 114 |
| 115 if (!tree().parent()) | 115 if (!tree().parent()) |
| 116 return true; | 116 return true; |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 WebFeaturePolicy* featurePolicy = securityContext()->getFeaturePolicy(); | 412 WebFeaturePolicy* featurePolicy = securityContext()->getFeaturePolicy(); |
| 413 // The policy should always be initialized before checking it to ensure we | 413 // The policy should always be initialized before checking it to ensure we |
| 414 // properly inherit the parent policy. | 414 // properly inherit the parent policy. |
| 415 DCHECK(featurePolicy); | 415 DCHECK(featurePolicy); |
| 416 | 416 |
| 417 // Otherwise, check policy. | 417 // Otherwise, check policy. |
| 418 return featurePolicy->IsFeatureEnabled(feature); | 418 return featurePolicy->IsFeatureEnabled(feature); |
| 419 } | 419 } |
| 420 | 420 |
| 421 Frame::Frame(FrameClient* client, | 421 Frame::Frame(FrameClient* client, |
| 422 FrameHost* host, | 422 Page* page, |
| 423 FrameOwner* owner, | 423 FrameOwner* owner, |
| 424 WindowProxyManager* windowProxyManager) | 424 WindowProxyManager* windowProxyManager) |
| 425 : m_treeNode(this), | 425 : m_treeNode(this), |
| 426 m_host(host), | 426 m_page(page), |
| 427 m_owner(owner), | 427 m_owner(owner), |
| 428 m_client(client), | 428 m_client(client), |
| 429 m_windowProxyManager(windowProxyManager), | 429 m_windowProxyManager(windowProxyManager), |
| 430 m_isLoading(false) { | 430 m_isLoading(false) { |
| 431 InstanceCounters::incrementCounter(InstanceCounters::FrameCounter); | 431 InstanceCounters::incrementCounter(InstanceCounters::FrameCounter); |
| 432 | 432 |
| 433 ASSERT(page()); | 433 DCHECK(m_page); |
| 434 | 434 |
| 435 if (m_owner) | 435 if (m_owner) |
| 436 m_owner->setContentFrame(*this); | 436 m_owner->setContentFrame(*this); |
| 437 else | 437 else |
| 438 page()->setMainFrame(this); | 438 m_page->setMainFrame(this); |
| 439 } | 439 } |
| 440 | 440 |
| 441 } // namespace blink | 441 } // namespace blink |
| OLD | NEW |