| 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) 2000 Simon Hausmann (hausmann@kde.org) | 4 * (C) 2000 Simon Hausmann (hausmann@kde.org) |
| 5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 6 * Copyright (C) 2004, 2006, 2008, 2009 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2006, 2008, 2009 Apple Inc. All rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 #include "Page.h" | 37 #include "Page.h" |
| 38 #include "RenderPart.h" | 38 #include "RenderPart.h" |
| 39 #include "ScriptController.h" | 39 #include "ScriptController.h" |
| 40 #include "ScriptEventListener.h" | 40 #include "ScriptEventListener.h" |
| 41 #include "Settings.h" | 41 #include "Settings.h" |
| 42 | 42 |
| 43 namespace WebCore { | 43 namespace WebCore { |
| 44 | 44 |
| 45 using namespace HTMLNames; | 45 using namespace HTMLNames; |
| 46 | 46 |
| 47 // Helper to check if the Frame's document contains elements that can instantiat
e plugins. |
| 48 // Does a recursive check for nested Frames too. |
| 49 static bool hasPluginElements(Frame* frame) |
| 50 { |
| 51 if (!frame) |
| 52 return false; |
| 53 |
| 54 // Search for a plugin element in this document. |
| 55 Document* document = frame->document(); |
| 56 for (Node* node = document->firstChild(); node; node = node->traverseNextNod
e(document)) { |
| 57 if (!node->isElementNode()) |
| 58 continue; |
| 59 |
| 60 Element* element = static_cast<Element*>(node); |
| 61 if (element->hasLocalName(embedTag) || element->hasLocalName(objectTag)) |
| 62 return true; |
| 63 } |
| 64 |
| 65 // Do the same for the nested frames. |
| 66 for (Frame* child = frame->tree()->firstChild(); child; child = child->tree(
)->nextSibling()) { |
| 67 if (hasPluginElements(child)) |
| 68 return true; |
| 69 } |
| 70 |
| 71 return false; |
| 72 } |
| 73 |
| 47 HTMLFrameElementBase::HTMLFrameElementBase(const QualifiedName& tagName, Documen
t* document) | 74 HTMLFrameElementBase::HTMLFrameElementBase(const QualifiedName& tagName, Documen
t* document) |
| 48 : HTMLFrameOwnerElement(tagName, document) | 75 : HTMLFrameOwnerElement(tagName, document) |
| 49 , m_scrolling(ScrollbarAuto) | 76 , m_scrolling(ScrollbarAuto) |
| 50 , m_marginWidth(-1) | 77 , m_marginWidth(-1) |
| 51 , m_marginHeight(-1) | 78 , m_marginHeight(-1) |
| 52 , m_checkInDocumentTimer(this, &HTMLFrameElementBase::checkInDocumentTimerFi
red) | 79 , m_checkInDocumentTimer(this, &HTMLFrameElementBase::checkInDocumentTimerFi
red) |
| 53 , m_viewSource(false) | 80 , m_viewSource(false) |
| 54 , m_remainsAliveOnRemovalFromTree(false) | 81 , m_remainsAliveOnRemovalFromTree(false) |
| 55 { | 82 { |
| 56 } | 83 } |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 } | 271 } |
| 245 | 272 |
| 246 int HTMLFrameElementBase::height() | 273 int HTMLFrameElementBase::height() |
| 247 { | 274 { |
| 248 document()->updateLayoutIgnorePendingStylesheets(); | 275 document()->updateLayoutIgnorePendingStylesheets(); |
| 249 if (!renderBox()) | 276 if (!renderBox()) |
| 250 return 0; | 277 return 0; |
| 251 return renderBox()->height(); | 278 return renderBox()->height(); |
| 252 } | 279 } |
| 253 | 280 |
| 281 // Some types of content can restrict the ability to move the iframes between pa
ges. |
| 282 // For example, the plugin infrastructure of an embedder may associate the plugi
n instances |
| 283 // with the top-level Frame for tracking various resources and failure to transf
er those |
| 284 // resources correctly may lead to crashes and other ill effects (https://bugs.w
ebkit.org/show_bug.cgi?id=68267) |
| 285 bool HTMLFrameElementBase::canRemainAliveOnRemovalFromTree() |
| 286 { |
| 287 return !hasPluginElements(contentFrame()); |
| 288 } |
| 289 |
| 254 void HTMLFrameElementBase::setRemainsAliveOnRemovalFromTree(bool value) | 290 void HTMLFrameElementBase::setRemainsAliveOnRemovalFromTree(bool value) |
| 255 { | 291 { |
| 292 ASSERT(!value || canRemainAliveOnRemovalFromTree()); |
| 256 m_remainsAliveOnRemovalFromTree = value; | 293 m_remainsAliveOnRemovalFromTree = value; |
| 257 | 294 |
| 258 // There is a possibility that JS will do document.adoptNode() on this eleme
nt but will not insert it into the tree. | 295 // There is a possibility that JS will do document.adoptNode() on this eleme
nt but will not insert it into the tree. |
| 259 // Start the async timer that is normally stopped by attach(). If it's not s
topped and fires, it'll unload the frame. | 296 // Start the async timer that is normally stopped by attach(). If it's not s
topped and fires, it'll unload the frame. |
| 260 if (value) | 297 if (value) |
| 261 m_checkInDocumentTimer.startOneShot(0); | 298 m_checkInDocumentTimer.startOneShot(0); |
| 262 else | 299 else |
| 263 m_checkInDocumentTimer.stop(); | 300 m_checkInDocumentTimer.stop(); |
| 264 } | 301 } |
| 265 | 302 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 281 } | 318 } |
| 282 | 319 |
| 283 #if ENABLE(FULLSCREEN_API) | 320 #if ENABLE(FULLSCREEN_API) |
| 284 bool HTMLFrameElementBase::allowFullScreen() const | 321 bool HTMLFrameElementBase::allowFullScreen() const |
| 285 { | 322 { |
| 286 return hasAttribute(webkitallowfullscreenAttr); | 323 return hasAttribute(webkitallowfullscreenAttr); |
| 287 } | 324 } |
| 288 #endif | 325 #endif |
| 289 | 326 |
| 290 } // namespace WebCore | 327 } // namespace WebCore |
| OLD | NEW |