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

Side by Side Diff: headless/lib/web_node.cc

Issue 1430673002: Headless demo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Better javascript Created 5 years 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
« no previous file with comments | « headless/lib/web_frame_impl.cc ('k') | headless/public/headless_browser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 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 "headless/public/web_node.h"
6
7 #include "headless/public/web_document.h"
8 #include "headless/public/web_element.h"
9 #include "third_party/WebKit/public/web/WebDocument.h"
10 #include "third_party/WebKit/public/web/WebElement.h"
11
12 namespace headless {
13
14 WebNode::WebNode(const blink::WebNode& web_node) : web_node_(web_node) {}
15
16 bool WebNode::IsDocument() const {
17 return web_node_.isDocumentNode();
18 }
19
20 bool WebNode::IsElement() const {
21 return web_node_.isElementNode();
22 }
23
24 WebDocument WebNode::AsDocument() const {
25 return WebDocument(static_cast<const blink::WebDocument&>(web_node_));
26 }
27
28 WebElement WebNode::AsElement() const {
29 return WebElement(static_cast<const blink::WebElement&>(web_node_));
30 }
31
32 std::string WebNode::Value() const {
33 return web_node_.nodeValue().utf8();
34 }
35
36 WebNode WebNode::Parent() const {
37 return WebNode(web_node_.parentNode());
38 }
39
40 WebNode WebNode::FirstChild() const {
41 return WebNode(web_node_.firstChild());
42 }
43
44 WebNode WebNode::LastChild() const {
45 return WebNode(web_node_.lastChild());
46 }
47
48 WebNode WebNode::NextSibling() const {
49 return WebNode(web_node_.nextSibling());
50 }
51
52 WebNode WebNode::PreviousSibling() const {
53 return WebNode(web_node_.previousSibling());
54 }
55
56 bool WebNode::HasChildNodes() const {
57 return web_node_.hasChildNodes();
58 }
59
60 blink::WebNode& WebNode::web_node() {
61 return web_node_;
62 }
63
64 const blink::WebNode& WebNode::web_node() const {
65 return web_node_;
66 }
67
68 } // namespace headless
OLDNEW
« no previous file with comments | « headless/lib/web_frame_impl.cc ('k') | headless/public/headless_browser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698