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

Side by Side Diff: sky/engine/web/WebNode.cpp

Issue 1210153009: Remove (almost all of) //sky/engine/web (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 months 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 | « sky/engine/web/WebLocalFrameImpl.cpp ('k') | sky/engine/web/WebRange.cpp » ('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 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31 #include "sky/engine/public/web/WebNode.h"
32
33 #include "sky/engine/bindings/exception_state.h"
34 #include "sky/engine/core/dom/Document.h"
35 #include "sky/engine/core/dom/Element.h"
36 #include "sky/engine/core/dom/Node.h"
37 #include "sky/engine/core/dom/NodeList.h"
38 #include "sky/engine/core/events/Event.h"
39 #include "sky/engine/core/html/HTMLElement.h"
40 #include "sky/engine/core/rendering/RenderObject.h"
41 #include "sky/engine/platform/Widget.h"
42 #include "sky/engine/public/platform/WebString.h"
43 #include "sky/engine/public/platform/WebVector.h"
44 #include "sky/engine/public/web/WebDocument.h"
45 #include "sky/engine/public/web/WebElement.h"
46 #include "sky/engine/web/FrameLoaderClientImpl.h"
47 #include "sky/engine/web/WebLocalFrameImpl.h"
48
49 namespace blink {
50
51 void WebNode::reset()
52 {
53 m_private.reset();
54 }
55
56 void WebNode::assign(const WebNode& other)
57 {
58 m_private = other.m_private;
59 }
60
61 bool WebNode::equals(const WebNode& n) const
62 {
63 return m_private.get() == n.m_private.get();
64 }
65
66 bool WebNode::lessThan(const WebNode& n) const
67 {
68 return m_private.get() < n.m_private.get();
69 }
70
71 WebNode::NodeType WebNode::nodeType() const
72 {
73 return static_cast<NodeType>(m_private->nodeType());
74 }
75
76 WebNode WebNode::parentNode() const
77 {
78 return WebNode(const_cast<ContainerNode*>(m_private->parentNode()));
79 }
80
81 WebString WebNode::nodeName() const
82 {
83 return m_private->nodeName();
84 }
85
86 WebDocument WebNode::document() const
87 {
88 return WebDocument(&m_private->document());
89 }
90
91 WebNode WebNode::firstChild() const
92 {
93 return WebNode(m_private->firstChild());
94 }
95
96 WebNode WebNode::lastChild() const
97 {
98 return WebNode(m_private->lastChild());
99 }
100
101 WebNode WebNode::previousSibling() const
102 {
103 return WebNode(m_private->previousSibling());
104 }
105
106 WebNode WebNode::nextSibling() const
107 {
108 return WebNode(m_private->nextSibling());
109 }
110
111 bool WebNode::hasChildNodes() const
112 {
113 return m_private->hasChildren();
114 }
115
116 bool WebNode::isLink() const
117 {
118 return m_private->isLink();
119 }
120
121 bool WebNode::isTextNode() const
122 {
123 return m_private->isTextNode();
124 }
125
126 bool WebNode::isFocusable() const
127 {
128 if (!m_private->isElementNode())
129 return false;
130 m_private->document().updateLayout();
131 return toElement(m_private.get())->isFocusable();
132 }
133
134 bool WebNode::isContentEditable() const
135 {
136 return m_private->isContentEditable();
137 }
138
139 bool WebNode::isElementNode() const
140 {
141 return m_private->isElementNode();
142 }
143
144 WebElement WebNode::querySelector(const WebString& tag, WebExceptionCode& ec) co nst
145 {
146 TrackExceptionState exceptionState;
147 WebElement element;
148 if (m_private->isContainerNode())
149 element = toContainerNode(m_private.get())->querySelector(tag, exception State);
150 ec = exceptionState.code();
151 return element;
152 }
153
154 WebElement WebNode::rootEditableElement() const
155 {
156 return WebElement(m_private->rootEditableElement());
157 }
158
159 bool WebNode::focused() const
160 {
161 return m_private->focused();
162 }
163
164 bool WebNode::remove()
165 {
166 TrackExceptionState exceptionState;
167 m_private->remove(exceptionState);
168 return !exceptionState.had_exception();
169 }
170
171 bool WebNode::containsIncludingShadowDOM(const WebNode& other) const
172 {
173 return m_private->containsIncludingShadowDOM(other.m_private.get());
174 }
175
176 WebElement WebNode::shadowHost() const
177 {
178 if (isNull())
179 return WebElement();
180 const Node* coreNode = constUnwrap<Node>();
181 return WebElement(coreNode->shadowHost());
182 }
183
184 WebNode::WebNode(const PassRefPtr<Node>& node)
185 : m_private(node)
186 {
187 }
188
189 WebNode& WebNode::operator=(const PassRefPtr<Node>& node)
190 {
191 m_private = node;
192 return *this;
193 }
194
195 WebNode::operator PassRefPtr<Node>() const
196 {
197 return m_private.get();
198 }
199
200 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/web/WebLocalFrameImpl.cpp ('k') | sky/engine/web/WebRange.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698