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

Side by Side Diff: sky/engine/core/html/HTMLIFrameElement.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: more review comments 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 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "core/html/HTMLIFrameElement.h"
7
8 #include "core/HTMLNames.h"
9 #include "core/frame/LocalFrame.h"
10 #include "core/html/parser/HTMLParserIdioms.h"
11 #include "core/loader/FrameLoaderClient.h"
12 #include "core/rendering/RenderRemote.h"
13
14 namespace blink {
15
16 PassRefPtr<HTMLIFrameElement> HTMLIFrameElement::create(Document& document)
17 {
18 return adoptRef(new HTMLIFrameElement(document));
19 }
20
21 HTMLIFrameElement::HTMLIFrameElement(Document& document)
22 : HTMLElement(HTMLNames::iframeTag, document)
23 {
24 }
25
26 HTMLIFrameElement::~HTMLIFrameElement()
27 {
28 }
29
30 void HTMLIFrameElement::parseAttribute(const QualifiedName& name, const AtomicSt ring& value)
31 {
32 if (name == HTMLNames::srcAttr)
33 setLocation(stripLeadingAndTrailingHTMLSpaces(value));
34 }
35
36 Node::InsertionNotificationRequest HTMLIFrameElement::insertedInto(ContainerNode * insertionPoint)
37 {
38 InsertionNotificationRequest result = HTMLElement::insertedInto(insertionPoi nt);
39 if (insertionPoint->inDocument())
40 openURL();
Matt Perry 2014/11/07 19:14:11 Re: storing m_URL. If insertedInto is called after
41 return result;
42 }
43
44 void HTMLIFrameElement::removedFrom(ContainerNode* insertionPoint)
45 {
46 HTMLElement::removedFrom(insertionPoint);
47 if (insertionPoint->inDocument()) {
48 // TODO(mpcomplete): Tear down the mojo View.
49 }
50 }
51
52 RenderObject* HTMLIFrameElement::createRenderer(RenderStyle* style)
53 {
54 return new RenderRemote(this);
55 }
56
57 void HTMLIFrameElement::setLocation(const String& str)
58 {
59 m_URL = AtomicString(str);
60 openURL();
61 }
62
63 void HTMLIFrameElement::openURL()
64 {
65 if (m_URL.isEmpty())
66 m_URL = AtomicString(blankURL().string());
67
68 LocalFrame* parentFrame = document().frame();
69 if (!parentFrame)
70 return;
71
72 KURL url = document().completeURL(m_URL);
73 parentFrame->loaderClient()->createView(url);
74 }
75
76 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698