| 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 20 matching lines...) Expand all Loading... |
| 31 #include "core/layout/LayoutPart.h" | 31 #include "core/layout/LayoutPart.h" |
| 32 #include "core/loader/FrameLoadRequest.h" | 32 #include "core/loader/FrameLoadRequest.h" |
| 33 #include "core/loader/FrameLoader.h" | 33 #include "core/loader/FrameLoader.h" |
| 34 #include "core/loader/FrameLoaderClient.h" | 34 #include "core/loader/FrameLoaderClient.h" |
| 35 #include "core/plugins/PluginView.h" | 35 #include "core/plugins/PluginView.h" |
| 36 #include "platform/RuntimeEnabledFeatures.h" | 36 #include "platform/RuntimeEnabledFeatures.h" |
| 37 #include "platform/weborigin/SecurityOrigin.h" | 37 #include "platform/weborigin/SecurityOrigin.h" |
| 38 | 38 |
| 39 namespace blink { | 39 namespace blink { |
| 40 | 40 |
| 41 typedef WillBeHeapHashMap<RefPtrWillBeMember<Widget>, RawPtrWillBeMember<FrameVi
ew>> WidgetToParentMap; | 41 typedef HeapHashMap<Member<Widget>, Member<FrameView>> WidgetToParentMap; |
| 42 static WidgetToParentMap& widgetNewParentMap() | 42 static WidgetToParentMap& widgetNewParentMap() |
| 43 { | 43 { |
| 44 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<WidgetToParentMap>, map, (adoptPt
rWillBeNoop(new WidgetToParentMap()))); | 44 DEFINE_STATIC_LOCAL(Persistent<WidgetToParentMap>, map, ((new WidgetToParent
Map()))); |
| 45 return *map; | 45 return *map; |
| 46 } | 46 } |
| 47 | 47 |
| 48 typedef WillBeHeapHashSet<RefPtrWillBeMember<Widget>> WidgetSet; | 48 typedef HeapHashSet<Member<Widget>> WidgetSet; |
| 49 static WidgetSet& widgetsPendingTemporaryRemovalFromParent() | 49 static WidgetSet& widgetsPendingTemporaryRemovalFromParent() |
| 50 { | 50 { |
| 51 // Widgets in this set will not leak because it will be cleared in | 51 // Widgets in this set will not leak because it will be cleared in |
| 52 // HTMLFrameOwnerElement::UpdateSuspendScope::performDeferredWidgetTreeOpera
tions. | 52 // HTMLFrameOwnerElement::UpdateSuspendScope::performDeferredWidgetTreeOpera
tions. |
| 53 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<WidgetSet>, set, (adoptPtrWillBeN
oop(new WidgetSet()))); | 53 DEFINE_STATIC_LOCAL(Persistent<WidgetSet>, set, ((new WidgetSet()))); |
| 54 return *set; | 54 return *set; |
| 55 } | 55 } |
| 56 | 56 |
| 57 WillBeHeapHashCountedSet<RawPtrWillBeMember<Node>>& SubframeLoadingDisabler::dis
abledSubtreeRoots() | 57 HeapHashCountedSet<Member<Node>>& SubframeLoadingDisabler::disabledSubtreeRoots(
) |
| 58 { | 58 { |
| 59 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<WillBeHeapHashCountedSet<RawPtrWi
llBeMember<Node>>>, nodes, (adoptPtrWillBeNoop(new WillBeHeapHashCountedSet<RawP
trWillBeMember<Node>>()))); | 59 DEFINE_STATIC_LOCAL(Persistent<HeapHashCountedSet<Member<Node>>>, nodes, ((n
ew HeapHashCountedSet<Member<Node>>()))); |
| 60 return *nodes; | 60 return *nodes; |
| 61 } | 61 } |
| 62 | 62 |
| 63 static unsigned s_updateSuspendCount = 0; | 63 static unsigned s_updateSuspendCount = 0; |
| 64 | 64 |
| 65 HTMLFrameOwnerElement::UpdateSuspendScope::UpdateSuspendScope() | 65 HTMLFrameOwnerElement::UpdateSuspendScope::UpdateSuspendScope() |
| 66 { | 66 { |
| 67 ++s_updateSuspendCount; | 67 ++s_updateSuspendCount; |
| 68 } | 68 } |
| 69 | 69 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 for (ContainerNode* node = this; node; node = node->parentOrShadowHostNode()
) | 170 for (ContainerNode* node = this; node; node = node->parentOrShadowHostNode()
) |
| 171 node->decrementConnectedSubframeCount(); | 171 node->decrementConnectedSubframeCount(); |
| 172 } | 172 } |
| 173 | 173 |
| 174 void HTMLFrameOwnerElement::disconnectContentFrame() | 174 void HTMLFrameOwnerElement::disconnectContentFrame() |
| 175 { | 175 { |
| 176 // FIXME: Currently we don't do this in removedFrom because this causes an | 176 // 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 | 177 // 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 | 178 // 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. | 179 // see if this behavior is really needed as Gecko does not allow this. |
| 180 if (RefPtrWillBeRawPtr<Frame> frame = contentFrame()) { | 180 if (RawPtr<Frame> frame = contentFrame()) { |
| 181 frame->detach(FrameDetachType::Remove); | 181 frame->detach(FrameDetachType::Remove); |
| 182 } | 182 } |
| 183 } | 183 } |
| 184 | 184 |
| 185 HTMLFrameOwnerElement::~HTMLFrameOwnerElement() | 185 HTMLFrameOwnerElement::~HTMLFrameOwnerElement() |
| 186 { | 186 { |
| 187 // An owner must by now have been informed of detachment | 187 // An owner must by now have been informed of detachment |
| 188 // when the frame was closed. | 188 // when the frame was closed. |
| 189 ASSERT(!m_contentFrame); | 189 ASSERT(!m_contentFrame); |
| 190 } | 190 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 219 } | 219 } |
| 220 | 220 |
| 221 Document* HTMLFrameOwnerElement::getSVGDocument(ExceptionState& exceptionState)
const | 221 Document* HTMLFrameOwnerElement::getSVGDocument(ExceptionState& exceptionState)
const |
| 222 { | 222 { |
| 223 Document* doc = contentDocument(); | 223 Document* doc = contentDocument(); |
| 224 if (doc && doc->isSVGDocument()) | 224 if (doc && doc->isSVGDocument()) |
| 225 return doc; | 225 return doc; |
| 226 return nullptr; | 226 return nullptr; |
| 227 } | 227 } |
| 228 | 228 |
| 229 void HTMLFrameOwnerElement::setWidget(PassRefPtrWillBeRawPtr<Widget> widget) | 229 void HTMLFrameOwnerElement::setWidget(RawPtr<Widget> widget) |
| 230 { | 230 { |
| 231 if (widget == m_widget) | 231 if (widget == m_widget) |
| 232 return; | 232 return; |
| 233 | 233 |
| 234 if (m_widget) { | 234 if (m_widget) { |
| 235 if (m_widget->parent()) | 235 if (m_widget->parent()) |
| 236 moveWidgetToParentSoon(m_widget.get(), 0); | 236 moveWidgetToParentSoon(m_widget.get(), 0); |
| 237 m_widget = nullptr; | 237 m_widget = nullptr; |
| 238 } | 238 } |
| 239 | 239 |
| 240 m_widget = widget; | 240 m_widget = widget; |
| 241 | 241 |
| 242 LayoutPart* layoutPart = toLayoutPart(layoutObject()); | 242 LayoutPart* layoutPart = toLayoutPart(layoutObject()); |
| 243 if (!layoutPart) | 243 if (!layoutPart) |
| 244 return; | 244 return; |
| 245 | 245 |
| 246 if (m_widget) { | 246 if (m_widget) { |
| 247 layoutPart->updateOnWidgetChange(); | 247 layoutPart->updateOnWidgetChange(); |
| 248 | 248 |
| 249 ASSERT(document().view() == layoutPart->frameView()); | 249 ASSERT(document().view() == layoutPart->frameView()); |
| 250 ASSERT(layoutPart->frameView()); | 250 ASSERT(layoutPart->frameView()); |
| 251 moveWidgetToParentSoon(m_widget.get(), layoutPart->frameView()); | 251 moveWidgetToParentSoon(m_widget.get(), layoutPart->frameView()); |
| 252 } | 252 } |
| 253 | 253 |
| 254 if (AXObjectCache* cache = document().existingAXObjectCache()) | 254 if (AXObjectCache* cache = document().existingAXObjectCache()) |
| 255 cache->childrenChanged(layoutPart); | 255 cache->childrenChanged(layoutPart); |
| 256 } | 256 } |
| 257 | 257 |
| 258 PassRefPtrWillBeRawPtr<Widget> HTMLFrameOwnerElement::releaseWidget() | 258 RawPtr<Widget> HTMLFrameOwnerElement::releaseWidget() |
| 259 { | 259 { |
| 260 if (!m_widget) | 260 if (!m_widget) |
| 261 return nullptr; | 261 return nullptr; |
| 262 if (m_widget->parent()) | 262 if (m_widget->parent()) |
| 263 temporarilyRemoveWidgetFromParentSoon(m_widget.get()); | 263 temporarilyRemoveWidgetFromParentSoon(m_widget.get()); |
| 264 LayoutPart* layoutPart = toLayoutPart(layoutObject()); | 264 LayoutPart* layoutPart = toLayoutPart(layoutObject()); |
| 265 if (layoutPart) { | 265 if (layoutPart) { |
| 266 if (AXObjectCache* cache = document().existingAXObjectCache()) | 266 if (AXObjectCache* cache = document().existingAXObjectCache()) |
| 267 cache->childrenChanged(layoutPart); | 267 cache->childrenChanged(layoutPart); |
| 268 } | 268 } |
| 269 return m_widget.release(); | 269 return m_widget.release(); |
| 270 } | 270 } |
| 271 | 271 |
| 272 Widget* HTMLFrameOwnerElement::ownedWidget() const | 272 Widget* HTMLFrameOwnerElement::ownedWidget() const |
| 273 { | 273 { |
| 274 return m_widget.get(); | 274 return m_widget.get(); |
| 275 } | 275 } |
| 276 | 276 |
| 277 bool HTMLFrameOwnerElement::loadOrRedirectSubframe(const KURL& url, const Atomic
String& frameName, bool replaceCurrentItem) | 277 bool HTMLFrameOwnerElement::loadOrRedirectSubframe(const KURL& url, const Atomic
String& frameName, bool replaceCurrentItem) |
| 278 { | 278 { |
| 279 RefPtrWillBeRawPtr<LocalFrame> parentFrame = document().frame(); | 279 RawPtr<LocalFrame> parentFrame = document().frame(); |
| 280 if (contentFrame()) { | 280 if (contentFrame()) { |
| 281 contentFrame()->navigate(document(), url, replaceCurrentItem, UserGestur
eStatus::None); | 281 contentFrame()->navigate(document(), url, replaceCurrentItem, UserGestur
eStatus::None); |
| 282 return true; | 282 return true; |
| 283 } | 283 } |
| 284 | 284 |
| 285 if (!document().securityOrigin()->canDisplay(url)) { | 285 if (!document().securityOrigin()->canDisplay(url)) { |
| 286 FrameLoader::reportLocalLoadFailed(parentFrame.get(), url.string()); | 286 FrameLoader::reportLocalLoadFailed(parentFrame.get(), url.string()); |
| 287 return false; | 287 return false; |
| 288 } | 288 } |
| 289 | 289 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 307 DEFINE_TRACE(HTMLFrameOwnerElement) | 307 DEFINE_TRACE(HTMLFrameOwnerElement) |
| 308 { | 308 { |
| 309 visitor->trace(m_contentFrame); | 309 visitor->trace(m_contentFrame); |
| 310 visitor->trace(m_widget); | 310 visitor->trace(m_widget); |
| 311 HTMLElement::trace(visitor); | 311 HTMLElement::trace(visitor); |
| 312 FrameOwner::trace(visitor); | 312 FrameOwner::trace(visitor); |
| 313 } | 313 } |
| 314 | 314 |
| 315 | 315 |
| 316 } // namespace blink | 316 } // namespace blink |
| OLD | NEW |