summaryrefslogtreecommitdiff
path: root/Source/WebCore/html/HTMLFrameElementBase.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-05-07 11:21:11 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-05-07 11:21:11 +0200
commit2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47 (patch)
tree988e8c5b116dd0466244ae2fe5af8ee9be926d76 /Source/WebCore/html/HTMLFrameElementBase.cpp
parentdd91e772430dc294e3bf478c119ef8d43c0a3358 (diff)
downloadqtwebkit-2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47.tar.gz
Imported WebKit commit 7e538425aa020340619e927792f3d895061fb54b (http://svn.webkit.org/repository/webkit/trunk@116286)
Diffstat (limited to 'Source/WebCore/html/HTMLFrameElementBase.cpp')
-rw-r--r--Source/WebCore/html/HTMLFrameElementBase.cpp95
1 files changed, 13 insertions, 82 deletions
diff --git a/Source/WebCore/html/HTMLFrameElementBase.cpp b/Source/WebCore/html/HTMLFrameElementBase.cpp
index 0841230da..c34ddeb47 100644
--- a/Source/WebCore/html/HTMLFrameElementBase.cpp
+++ b/Source/WebCore/html/HTMLFrameElementBase.cpp
@@ -44,41 +44,12 @@ namespace WebCore {
using namespace HTMLNames;
-// Helper to check if the Frame's document contains elements that can instantiate plugins.
-// Does a recursive check for nested Frames too.
-static bool hasPluginElements(Frame* frame)
-{
- if (!frame)
- return false;
-
- // Search for a plugin element in this document.
- Document* document = frame->document();
- for (Node* node = document->firstChild(); node; node = node->traverseNextNode(document)) {
- if (!node->isElementNode())
- continue;
-
- Element* element = static_cast<Element*>(node);
- if (element->hasLocalName(embedTag) || element->hasLocalName(objectTag))
- return true;
- }
-
- // Do the same for the nested frames.
- for (Frame* child = frame->tree()->firstChild(); child; child = child->tree()->nextSibling()) {
- if (hasPluginElements(child))
- return true;
- }
-
- return false;
-}
-
HTMLFrameElementBase::HTMLFrameElementBase(const QualifiedName& tagName, Document* document)
: HTMLFrameOwnerElement(tagName, document)
, m_scrolling(ScrollbarAuto)
, m_marginWidth(-1)
, m_marginHeight(-1)
- , m_checkInDocumentTimer(this, &HTMLFrameElementBase::checkInDocumentTimerFired)
, m_viewSource(false)
- , m_remainsAliveOnRemovalFromTree(false)
{
}
@@ -133,7 +104,9 @@ void HTMLFrameElementBase::openURL(bool lockHistory, bool lockBackForwardList)
void HTMLFrameElementBase::parseAttribute(Attribute* attr)
{
- if (attr->name() == srcAttr)
+ if (attr->name() == srcdocAttr)
+ setLocation("about:srcdoc");
+ else if (attr->name() == srcAttr && !fastHasAttribute(srcdocAttr))
setLocation(stripLeadingAndTrailingHTMLSpaces(attr->value()));
else if (isIdAttributeName(attr->name())) {
// Important to call through to base for the id attribute so the hasID bit gets set.
@@ -180,23 +153,18 @@ void HTMLFrameElementBase::setNameAndOpenURL()
openURL();
}
-void HTMLFrameElementBase::updateOnReparenting()
+Node::InsertionNotificationRequest HTMLFrameElementBase::insertedInto(Node* insertionPoint)
{
- ASSERT(m_remainsAliveOnRemovalFromTree);
-
- if (Frame* frame = contentFrame())
- frame->transferChildFrameToNewDocument();
+ HTMLFrameOwnerElement::insertedInto(insertionPoint);
+ if (insertionPoint->inDocument())
+ return InsertionShouldCallDidNotifyDescendantInseretions;
+ return InsertionDone;
}
-void HTMLFrameElementBase::insertedIntoDocument()
+void HTMLFrameElementBase::didNotifyDescendantInseretions(Node* insertionPoint)
{
- HTMLFrameOwnerElement::insertedIntoDocument();
+ ASSERT_UNUSED(insertionPoint, insertionPoint->inDocument());
- if (m_remainsAliveOnRemovalFromTree) {
- updateOnReparenting();
- setRemainsAliveOnRemovalFromTree(false);
- return;
- }
// DocumentFragments don't kick of any loads.
if (!document()->frame())
return;
@@ -205,7 +173,7 @@ void HTMLFrameElementBase::insertedIntoDocument()
// during attribute parsing *before* the normal parser machinery would
// attach the element. To support this, we lazyAttach here, but only
// if we don't already have a renderer (if we're inserted
- // as part of a DocumentFragment, insertedIntoDocument from an earlier element
+ // as part of a DocumentFragment, insertedInto from an earlier element
// could have forced a style resolve and already attached us).
if (!renderer())
lazyAttach(DoNotSetAttached);
@@ -224,6 +192,8 @@ void HTMLFrameElementBase::attach()
KURL HTMLFrameElementBase::location() const
{
+ if (fastHasAttribute(srcdocAttr))
+ return KURL(ParsedURLString, "about:srcdoc");
return document()->completeURL(getAttribute(srcAttr));
}
@@ -276,45 +246,6 @@ int HTMLFrameElementBase::height()
return renderBox()->height();
}
-// Some types of content can restrict the ability to move the iframes between pages.
-// For example, the plugin infrastructure of an embedder may associate the plugin instances
-// with the top-level Frame for tracking various resources and failure to transfer those
-// resources correctly may lead to crashes and other ill effects (https://bugs.webkit.org/show_bug.cgi?id=68267)
-bool HTMLFrameElementBase::canRemainAliveOnRemovalFromTree()
-{
- return !hasPluginElements(contentFrame());
-}
-
-void HTMLFrameElementBase::setRemainsAliveOnRemovalFromTree(bool value)
-{
- ASSERT(!value || canRemainAliveOnRemovalFromTree());
- m_remainsAliveOnRemovalFromTree = value;
-
- // There is a possibility that JS will do document.adoptNode() on this element but will not insert it into the tree.
- // Start the async timer that is normally stopped by attach(). If it's not stopped and fires, it'll unload the frame.
- if (value)
- m_checkInDocumentTimer.startOneShot(0);
- else
- m_checkInDocumentTimer.stop();
-}
-
-void HTMLFrameElementBase::checkInDocumentTimerFired(Timer<HTMLFrameElementBase>*)
-{
- ASSERT(!attached());
- ASSERT(m_remainsAliveOnRemovalFromTree);
-
- m_remainsAliveOnRemovalFromTree = false;
- willRemove();
-}
-
-void HTMLFrameElementBase::willRemove()
-{
- if (m_remainsAliveOnRemovalFromTree)
- return;
-
- HTMLFrameOwnerElement::willRemove();
-}
-
#if ENABLE(FULLSCREEN_API)
bool HTMLFrameElementBase::allowFullScreen() const
{