Index: sky/engine/core/html/HTMLIFrameElement.cpp |
diff --git a/sky/engine/core/html/HTMLIFrameElement.cpp b/sky/engine/core/html/HTMLIFrameElement.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..582fb5c1bc7f7bf9803abf39d42ccf8f37faf5d4 |
--- /dev/null |
+++ b/sky/engine/core/html/HTMLIFrameElement.cpp |
@@ -0,0 +1,76 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "config.h" |
+#include "core/html/HTMLIFrameElement.h" |
+ |
+#include "core/HTMLNames.h" |
+#include "core/frame/LocalFrame.h" |
+#include "core/html/parser/HTMLParserIdioms.h" |
+#include "core/loader/FrameLoaderClient.h" |
+#include "core/rendering/RenderRemote.h" |
+ |
+namespace blink { |
+ |
+PassRefPtr<HTMLIFrameElement> HTMLIFrameElement::create(Document& document) |
+{ |
+ return adoptRef(new HTMLIFrameElement(document)); |
+} |
+ |
+HTMLIFrameElement::HTMLIFrameElement(Document& document) |
+ : HTMLElement(HTMLNames::iframeTag, document) |
+{ |
+} |
+ |
+HTMLIFrameElement::~HTMLIFrameElement() |
+{ |
+} |
+ |
+void HTMLIFrameElement::parseAttribute(const QualifiedName& name, const AtomicString& value) |
+{ |
+ if (name == HTMLNames::srcAttr) |
+ setLocation(stripLeadingAndTrailingHTMLSpaces(value)); |
+} |
+ |
+Node::InsertionNotificationRequest HTMLIFrameElement::insertedInto(ContainerNode* insertionPoint) |
+{ |
+ InsertionNotificationRequest result = HTMLElement::insertedInto(insertionPoint); |
+ if (insertionPoint->inDocument()) |
+ openURL(); |
Matt Perry
2014/11/07 19:14:11
Re: storing m_URL. If insertedInto is called after
|
+ return result; |
+} |
+ |
+void HTMLIFrameElement::removedFrom(ContainerNode* insertionPoint) |
+{ |
+ HTMLElement::removedFrom(insertionPoint); |
+ if (insertionPoint->inDocument()) { |
+ // TODO(mpcomplete): Tear down the mojo View. |
+ } |
+} |
+ |
+RenderObject* HTMLIFrameElement::createRenderer(RenderStyle* style) |
+{ |
+ return new RenderRemote(this); |
+} |
+ |
+void HTMLIFrameElement::setLocation(const String& str) |
+{ |
+ m_URL = AtomicString(str); |
+ openURL(); |
+} |
+ |
+void HTMLIFrameElement::openURL() |
+{ |
+ if (m_URL.isEmpty()) |
+ m_URL = AtomicString(blankURL().string()); |
+ |
+ LocalFrame* parentFrame = document().frame(); |
+ if (!parentFrame) |
+ return; |
+ |
+ KURL url = document().completeURL(m_URL); |
+ parentFrame->loaderClient()->createView(url); |
+} |
+ |
+} |