| 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/layout/api/LayoutPartItem.h" | 32 #include "core/layout/api/LayoutPartItem.h" |
| 33 #include "core/loader/FrameLoadRequest.h" | 33 #include "core/loader/FrameLoadRequest.h" |
| 34 #include "core/loader/FrameLoader.h" | 34 #include "core/loader/FrameLoader.h" |
| 35 #include "core/loader/FrameLoaderClient.h" | 35 #include "core/loader/FrameLoaderClient.h" |
| 36 #include "core/plugins/PluginView.h" | 36 #include "core/plugins/PluginView.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 WidgetToParentM
ap())); |
| 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, (ne
w 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 for (ContainerNode* node = this; node; node = node->parentOrShadowHostNode()
) | 171 for (ContainerNode* node = this; node; node = node->parentOrShadowHostNode()
) |
| 172 node->decrementConnectedSubframeCount(); | 172 node->decrementConnectedSubframeCount(); |
| 173 } | 173 } |
| 174 | 174 |
| 175 void HTMLFrameOwnerElement::disconnectContentFrame() | 175 void HTMLFrameOwnerElement::disconnectContentFrame() |
| 176 { | 176 { |
| 177 // FIXME: Currently we don't do this in removedFrom because this causes an | 177 // FIXME: Currently we don't do this in removedFrom because this causes an |
| 178 // unload event in the subframe which could execute script that could then | 178 // unload event in the subframe which could execute script that could then |
| 179 // reach up into this document and then attempt to look back down. We should | 179 // reach up into this document and then attempt to look back down. We should |
| 180 // see if this behavior is really needed as Gecko does not allow this. | 180 // see if this behavior is really needed as Gecko does not allow this. |
| 181 if (RefPtrWillBeRawPtr<Frame> frame = contentFrame()) { | 181 if (RawPtr<Frame> frame = contentFrame()) { |
| 182 frame->detach(FrameDetachType::Remove); | 182 frame->detach(FrameDetachType::Remove); |
| 183 } | 183 } |
| 184 } | 184 } |
| 185 | 185 |
| 186 HTMLFrameOwnerElement::~HTMLFrameOwnerElement() | 186 HTMLFrameOwnerElement::~HTMLFrameOwnerElement() |
| 187 { | 187 { |
| 188 // An owner must by now have been informed of detachment | 188 // An owner must by now have been informed of detachment |
| 189 // when the frame was closed. | 189 // when the frame was closed. |
| 190 ASSERT(!m_contentFrame); | 190 ASSERT(!m_contentFrame); |
| 191 } | 191 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 220 } | 220 } |
| 221 | 221 |
| 222 Document* HTMLFrameOwnerElement::getSVGDocument(ExceptionState& exceptionState)
const | 222 Document* HTMLFrameOwnerElement::getSVGDocument(ExceptionState& exceptionState)
const |
| 223 { | 223 { |
| 224 Document* doc = contentDocument(); | 224 Document* doc = contentDocument(); |
| 225 if (doc && doc->isSVGDocument()) | 225 if (doc && doc->isSVGDocument()) |
| 226 return doc; | 226 return doc; |
| 227 return nullptr; | 227 return nullptr; |
| 228 } | 228 } |
| 229 | 229 |
| 230 void HTMLFrameOwnerElement::setWidget(PassRefPtrWillBeRawPtr<Widget> widget) | 230 void HTMLFrameOwnerElement::setWidget(RawPtr<Widget> widget) |
| 231 { | 231 { |
| 232 if (widget == m_widget) | 232 if (widget == m_widget) |
| 233 return; | 233 return; |
| 234 | 234 |
| 235 if (m_widget) { | 235 if (m_widget) { |
| 236 if (m_widget->parent()) | 236 if (m_widget->parent()) |
| 237 moveWidgetToParentSoon(m_widget.get(), 0); | 237 moveWidgetToParentSoon(m_widget.get(), 0); |
| 238 m_widget = nullptr; | 238 m_widget = nullptr; |
| 239 } | 239 } |
| 240 | 240 |
| 241 m_widget = widget; | 241 m_widget = widget; |
| 242 | 242 |
| 243 LayoutPart* layoutPart = toLayoutPart(layoutObject()); | 243 LayoutPart* layoutPart = toLayoutPart(layoutObject()); |
| 244 LayoutPartItem layoutPartItem = LayoutPartItem(layoutPart); | 244 LayoutPartItem layoutPartItem = LayoutPartItem(layoutPart); |
| 245 if (layoutPartItem.isNull()) | 245 if (layoutPartItem.isNull()) |
| 246 return; | 246 return; |
| 247 | 247 |
| 248 if (m_widget) { | 248 if (m_widget) { |
| 249 layoutPartItem.updateOnWidgetChange(); | 249 layoutPartItem.updateOnWidgetChange(); |
| 250 | 250 |
| 251 ASSERT(document().view() == layoutPartItem.frameView()); | 251 ASSERT(document().view() == layoutPartItem.frameView()); |
| 252 ASSERT(layoutPartItem.frameView()); | 252 ASSERT(layoutPartItem.frameView()); |
| 253 moveWidgetToParentSoon(m_widget.get(), layoutPartItem.frameView()); | 253 moveWidgetToParentSoon(m_widget.get(), layoutPartItem.frameView()); |
| 254 } | 254 } |
| 255 | 255 |
| 256 if (AXObjectCache* cache = document().existingAXObjectCache()) | 256 if (AXObjectCache* cache = document().existingAXObjectCache()) |
| 257 cache->childrenChanged(layoutPart); | 257 cache->childrenChanged(layoutPart); |
| 258 } | 258 } |
| 259 | 259 |
| 260 PassRefPtrWillBeRawPtr<Widget> HTMLFrameOwnerElement::releaseWidget() | 260 RawPtr<Widget> HTMLFrameOwnerElement::releaseWidget() |
| 261 { | 261 { |
| 262 if (!m_widget) | 262 if (!m_widget) |
| 263 return nullptr; | 263 return nullptr; |
| 264 if (m_widget->parent()) | 264 if (m_widget->parent()) |
| 265 temporarilyRemoveWidgetFromParentSoon(m_widget.get()); | 265 temporarilyRemoveWidgetFromParentSoon(m_widget.get()); |
| 266 LayoutPart* layoutPart = toLayoutPart(layoutObject()); | 266 LayoutPart* layoutPart = toLayoutPart(layoutObject()); |
| 267 if (layoutPart) { | 267 if (layoutPart) { |
| 268 if (AXObjectCache* cache = document().existingAXObjectCache()) | 268 if (AXObjectCache* cache = document().existingAXObjectCache()) |
| 269 cache->childrenChanged(layoutPart); | 269 cache->childrenChanged(layoutPart); |
| 270 } | 270 } |
| 271 return m_widget.release(); | 271 return m_widget.release(); |
| 272 } | 272 } |
| 273 | 273 |
| 274 Widget* HTMLFrameOwnerElement::ownedWidget() const | 274 Widget* HTMLFrameOwnerElement::ownedWidget() const |
| 275 { | 275 { |
| 276 return m_widget.get(); | 276 return m_widget.get(); |
| 277 } | 277 } |
| 278 | 278 |
| 279 bool HTMLFrameOwnerElement::loadOrRedirectSubframe(const KURL& url, const Atomic
String& frameName, bool replaceCurrentItem) | 279 bool HTMLFrameOwnerElement::loadOrRedirectSubframe(const KURL& url, const Atomic
String& frameName, bool replaceCurrentItem) |
| 280 { | 280 { |
| 281 RefPtrWillBeRawPtr<LocalFrame> parentFrame = document().frame(); | 281 RawPtr<LocalFrame> parentFrame = document().frame(); |
| 282 if (contentFrame()) { | 282 if (contentFrame()) { |
| 283 contentFrame()->navigate(document(), url, replaceCurrentItem, UserGestur
eStatus::None); | 283 contentFrame()->navigate(document(), url, replaceCurrentItem, UserGestur
eStatus::None); |
| 284 return true; | 284 return true; |
| 285 } | 285 } |
| 286 | 286 |
| 287 if (!document().getSecurityOrigin()->canDisplay(url)) { | 287 if (!document().getSecurityOrigin()->canDisplay(url)) { |
| 288 FrameLoader::reportLocalLoadFailed(parentFrame.get(), url.getString()); | 288 FrameLoader::reportLocalLoadFailed(parentFrame.get(), url.getString()); |
| 289 return false; | 289 return false; |
| 290 } | 290 } |
| 291 | 291 |
| (...skipping 15 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 |