Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1158)

Side by Side Diff: sky/engine/core/html/HTMLViewElement.cpp

Issue 708903002: Initial work on a new <view> element backed by a mojo::View. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Simon Hausmann <hausmann@kde.org>
5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
6 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * 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.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
17 *
18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22 */
23
24 #include "config.h"
25 #include "core/html/HTMLViewElement.h"
26
27 #include "core/HTMLNames.h"
28 #include "core/dom/Attribute.h"
29 #include "core/editing/FrameSelection.h"
30 #include "core/events/KeyboardEvent.h"
31 #include "core/events/MouseEvent.h"
32 #include "core/frame/FrameHost.h"
33 #include "core/frame/LocalFrame.h"
34 #include "core/frame/Settings.h"
35 #include "core/frame/UseCounter.h"
esprehn 2014/11/06 22:40:28 Lots of these aren't needed.
36 #include "core/html/HTMLImageElement.h"
37 #include "core/html/parser/HTMLParserIdioms.h"
38 #include "core/loader/FrameLoaderClient.h"
39 #include "core/loader/FrameLoaderTypes.h"
40 #include "core/page/Chrome.h"
41 #include "core/page/ChromeClient.h"
42 #include "core/rendering/RenderRemote.h"
43 #include "platform/PlatformMouseEvent.h"
44 #include "platform/network/ResourceRequest.h"
45 #include "platform/weborigin/KnownPorts.h"
46 #include "platform/weborigin/SecurityPolicy.h"
47 #include "public/platform/Platform.h"
48 #include "public/platform/WebURL.h"
49 #include "public/platform/WebURLRequest.h"
50 #include "wtf/text/StringBuilder.h"
51
52 namespace blink {
53
54 PassRefPtr<HTMLViewElement> HTMLViewElement::create(Document& document)
55 {
56 return adoptRef(new HTMLViewElement(document));
57 }
58
59 HTMLViewElement::HTMLViewElement(Document& document)
60 : HTMLElement(HTMLNames::viewTag, document)
61 {
62 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.
63 }
64
65 HTMLViewElement::~HTMLViewElement()
66 {
67 }
68
69 void HTMLViewElement::parseAttribute(const QualifiedName& name, const AtomicStri ng& value)
70 {
71 if (name == HTMLNames::srcAttr)
72 setLocation(stripLeadingAndTrailingHTMLSpaces(value));
73 }
74
75 Node::InsertionNotificationRequest HTMLViewElement::insertedInto(ContainerNode* insertionPoint)
76 {
77 HTMLElement::insertedInto(insertionPoint);
78 return InsertionShouldCallDidNotifySubtreeInsertions;
79 }
80
81 void HTMLViewElement::didNotifySubtreeInsertionsToDocument()
82 {
83 if (!document().frame())
84 return;
85
86 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.
87 }
88
89 void HTMLViewElement::removedFrom(ContainerNode* insertionPoint)
90 {
91 HTMLElement::removedFrom(insertionPoint);
92 if (insertionPoint->inDocument() && document().isHTMLDocument() && !insertio nPoint->isInShadowTree()) {
esprehn 2014/11/06 22:40:28 Remove isHTMLDocument() and isInShadowTree checks
Matt Perry 2014/11/06 23:38:50 Done.
93 // TODO(mpcomplete): Tear down the mojo View.
94 }
95 }
96
97 RenderObject* HTMLViewElement::createRenderer(RenderStyle* style)
98 {
99 return new RenderRemote(this);
100 }
101
102 void HTMLViewElement::setLocation(const String& str)
103 {
104 m_URL = AtomicString(str);
105
106 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
107 openURL();
108 }
109
110 void HTMLViewElement::openURL()
111 {
112 if (m_URL.isEmpty())
113 m_URL = AtomicString(blankURL().string());
114
115 LocalFrame* parentFrame = document().frame();
116 if (!parentFrame)
117 return;
118
119 KURL url = document().completeURL(m_URL);
120 parentFrame->loaderClient()->createView(url, this);
121 }
122
123 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698