| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 if (!layoutObject() || !layoutObject()->isLayoutPart()) | 146 if (!layoutObject() || !layoutObject()->isLayoutPart()) |
| 147 return nullptr; | 147 return nullptr; |
| 148 return toLayoutPart(layoutObject()); | 148 return toLayoutPart(layoutObject()); |
| 149 } | 149 } |
| 150 | 150 |
| 151 void HTMLFrameOwnerElement::setContentFrame(Frame& frame) | 151 void HTMLFrameOwnerElement::setContentFrame(Frame& frame) |
| 152 { | 152 { |
| 153 // Make sure we will not end up with two frames referencing the same owner e
lement. | 153 // Make sure we will not end up with two frames referencing the same owner e
lement. |
| 154 ASSERT(!m_contentFrame || m_contentFrame->owner() != this); | 154 ASSERT(!m_contentFrame || m_contentFrame->owner() != this); |
| 155 // Disconnected frames should not be allowed to load. | 155 // Disconnected frames should not be allowed to load. |
| 156 ASSERT(inDocument()); | 156 ASSERT(inActiveDocument()); |
| 157 |
| 157 m_contentFrame = &frame; | 158 m_contentFrame = &frame; |
| 158 | 159 document().subframeTracker().connectSubframe(*this); |
| 159 for (ContainerNode* node = this; node; node = node->parentOrShadowHostNode()
) | |
| 160 node->incrementConnectedSubframeCount(); | |
| 161 } | 160 } |
| 162 | 161 |
| 163 void HTMLFrameOwnerElement::clearContentFrame() | 162 void HTMLFrameOwnerElement::clearContentFrame() |
| 164 { | 163 { |
| 165 if (!m_contentFrame) | 164 if (!m_contentFrame) |
| 166 return; | 165 return; |
| 167 | 166 |
| 167 // If there's a connected content frame, the parent frame must be active. |
| 168 ASSERT(inActiveDocument()); |
| 168 m_contentFrame = nullptr; | 169 m_contentFrame = nullptr; |
| 169 | 170 document().subframeTracker().disconnectSubframe(*this); |
| 170 for (ContainerNode* node = this; node; node = node->parentOrShadowHostNode()
) | |
| 171 node->decrementConnectedSubframeCount(); | |
| 172 } | 171 } |
| 173 | 172 |
| 174 void HTMLFrameOwnerElement::disconnectContentFrame() | 173 void HTMLFrameOwnerElement::disconnectContentFrame() |
| 175 { | 174 { |
| 176 // FIXME: Currently we don't do this in removedFrom because this causes an | 175 // FIXME: Currently we don't do this in removedFrom because this causes an |
| 177 // unload event in the subframe which could execute script that could then | 176 // unload event in the subframe which could execute script that could then |
| 178 // reach up into this document and then attempt to look back down. We should | 177 // reach up into this document and then attempt to look back down. We should |
| 179 // see if this behavior is really needed as Gecko does not allow this. | 178 // see if this behavior is really needed as Gecko does not allow this. |
| 180 if (RefPtrWillBeRawPtr<Frame> frame = contentFrame()) { | 179 if (RefPtrWillBeRawPtr<Frame> frame = contentFrame()) { |
| 181 frame->detach(FrameDetachType::Remove); | 180 frame->detach(FrameDetachType::Remove); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 DEFINE_TRACE(HTMLFrameOwnerElement) | 305 DEFINE_TRACE(HTMLFrameOwnerElement) |
| 307 { | 306 { |
| 308 visitor->trace(m_contentFrame); | 307 visitor->trace(m_contentFrame); |
| 309 visitor->trace(m_widget); | 308 visitor->trace(m_widget); |
| 310 HTMLElement::trace(visitor); | 309 HTMLElement::trace(visitor); |
| 311 FrameOwner::trace(visitor); | 310 FrameOwner::trace(visitor); |
| 312 } | 311 } |
| 313 | 312 |
| 314 | 313 |
| 315 } // namespace blink | 314 } // namespace blink |
| OLD | NEW |