Index: sky/engine/core/html/HTMLViewElement.cpp |
diff --git a/sky/engine/core/html/HTMLViewElement.cpp b/sky/engine/core/html/HTMLViewElement.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5e8cec44aa47bef49a55651b93e84ab6fab11725 |
--- /dev/null |
+++ b/sky/engine/core/html/HTMLViewElement.cpp |
@@ -0,0 +1,123 @@ |
+/* |
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
+ * (C) 1999 Antti Koivisto (koivisto@kde.org) |
+ * (C) 2000 Simon Hausmann <hausmann@kde.org> |
+ * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. |
+ * (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
+ * |
+ * This library is free software; you can redistribute it and/or |
+ * modify it under the terms of the GNU Library General Public |
+ * License as published by the Free Software Foundation; either |
+ * version 2 of the License, or (at your option) any later version. |
esprehn
2014/11/06 22:40:28
ditto
Matt Perry
2014/11/06 23:38:50
Done.
|
+ * |
+ * This library is distributed in the hope that it will be useful, |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+ * Library General Public License for more details. |
+ * |
+ * You should have received a copy of the GNU Library General Public License |
+ * along with this library; see the file COPYING.LIB. If not, write to |
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
+ * Boston, MA 02110-1301, USA. |
+ */ |
+ |
+#include "config.h" |
+#include "core/html/HTMLViewElement.h" |
+ |
+#include "core/HTMLNames.h" |
+#include "core/dom/Attribute.h" |
+#include "core/editing/FrameSelection.h" |
+#include "core/events/KeyboardEvent.h" |
+#include "core/events/MouseEvent.h" |
+#include "core/frame/FrameHost.h" |
+#include "core/frame/LocalFrame.h" |
+#include "core/frame/Settings.h" |
+#include "core/frame/UseCounter.h" |
esprehn
2014/11/06 22:40:28
Lots of these aren't needed.
|
+#include "core/html/HTMLImageElement.h" |
+#include "core/html/parser/HTMLParserIdioms.h" |
+#include "core/loader/FrameLoaderClient.h" |
+#include "core/loader/FrameLoaderTypes.h" |
+#include "core/page/Chrome.h" |
+#include "core/page/ChromeClient.h" |
+#include "core/rendering/RenderRemote.h" |
+#include "platform/PlatformMouseEvent.h" |
+#include "platform/network/ResourceRequest.h" |
+#include "platform/weborigin/KnownPorts.h" |
+#include "platform/weborigin/SecurityPolicy.h" |
+#include "public/platform/Platform.h" |
+#include "public/platform/WebURL.h" |
+#include "public/platform/WebURLRequest.h" |
+#include "wtf/text/StringBuilder.h" |
+ |
+namespace blink { |
+ |
+PassRefPtr<HTMLViewElement> HTMLViewElement::create(Document& document) |
+{ |
+ return adoptRef(new HTMLViewElement(document)); |
+} |
+ |
+HTMLViewElement::HTMLViewElement(Document& document) |
+ : HTMLElement(HTMLNames::viewTag, document) |
+{ |
+ ScriptWrappable::init(this); |
abarth-chromium
2014/11/06 22:55:07
This isn't needed either, but we haven't bulk dele
Matt Perry
2014/11/06 23:38:50
Done.
|
+} |
+ |
+HTMLViewElement::~HTMLViewElement() |
+{ |
+} |
+ |
+void HTMLViewElement::parseAttribute(const QualifiedName& name, const AtomicString& value) |
+{ |
+ if (name == HTMLNames::srcAttr) |
+ setLocation(stripLeadingAndTrailingHTMLSpaces(value)); |
+} |
+ |
+Node::InsertionNotificationRequest HTMLViewElement::insertedInto(ContainerNode* insertionPoint) |
+{ |
+ HTMLElement::insertedInto(insertionPoint); |
+ return InsertionShouldCallDidNotifySubtreeInsertions; |
+} |
+ |
+void HTMLViewElement::didNotifySubtreeInsertionsToDocument() |
+{ |
+ if (!document().frame()) |
+ return; |
+ |
+ openURL(); |
esprehn
2014/11/06 22:40:28
You can just put this in ::insertedInto, we don't
Matt Perry
2014/11/06 23:38:50
Done.
|
+} |
+ |
+void HTMLViewElement::removedFrom(ContainerNode* insertionPoint) |
+{ |
+ HTMLElement::removedFrom(insertionPoint); |
+ if (insertionPoint->inDocument() && document().isHTMLDocument() && !insertionPoint->isInShadowTree()) { |
esprehn
2014/11/06 22:40:28
Remove isHTMLDocument() and isInShadowTree checks
Matt Perry
2014/11/06 23:38:50
Done.
|
+ // TODO(mpcomplete): Tear down the mojo View. |
+ } |
+} |
+ |
+RenderObject* HTMLViewElement::createRenderer(RenderStyle* style) |
+{ |
+ return new RenderRemote(this); |
+} |
+ |
+void HTMLViewElement::setLocation(const String& str) |
+{ |
+ m_URL = AtomicString(str); |
+ |
+ if (inDocument()) |
abarth-chromium
2014/11/06 22:55:07
Why do we check isDocument here but !document().fr
Matt Perry
2014/11/06 23:38:50
I'm not sure. I copied a lot of this from blink's
Matt Perry
2014/11/07 17:27:40
Nevermind, I was wrong. I must've had a bug somewh
|
+ openURL(); |
+} |
+ |
+void HTMLViewElement::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, this); |
+} |
+ |
+} |