| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 if (!m_private->isContainerNode()) | 210 if (!m_private->isContainerNode()) |
| 211 return WebElement(); | 211 return WebElement(); |
| 212 return toContainerNode(m_private.get())->querySelector(selector, IGNORE_EXCE
PTION); | 212 return toContainerNode(m_private.get())->querySelector(selector, IGNORE_EXCE
PTION); |
| 213 } | 213 } |
| 214 | 214 |
| 215 bool WebNode::focused() const | 215 bool WebNode::focused() const |
| 216 { | 216 { |
| 217 return m_private->focused(); | 217 return m_private->focused(); |
| 218 } | 218 } |
| 219 | 219 |
| 220 WebPluginContainer* WebNode::pluginContainerFromNode(const Node* node) |
| 221 { |
| 222 if (!node) |
| 223 return nullptr; |
| 224 |
| 225 if (!isHTMLObjectElement(node) && !isHTMLEmbedElement(node)) |
| 226 return nullptr; |
| 227 |
| 228 LayoutObject* object = node->layoutObject(); |
| 229 if (object && object->isLayoutPart()) { |
| 230 Widget* widget = toLayoutPart(object)->widget(); |
| 231 if (widget && widget->isPluginContainer()) |
| 232 return toWebPluginContainerImpl(widget); |
| 233 } |
| 234 |
| 235 return nullptr; |
| 236 } |
| 237 |
| 220 WebPluginContainer* WebNode::pluginContainer() const | 238 WebPluginContainer* WebNode::pluginContainer() const |
| 221 { | 239 { |
| 222 if (isNull()) | 240 return pluginContainerFromNode(constUnwrap<Node>()); |
| 223 return 0; | |
| 224 const Node& coreNode = *constUnwrap<Node>(); | |
| 225 if (isHTMLObjectElement(coreNode) || isHTMLEmbedElement(coreNode)) { | |
| 226 LayoutObject* object = coreNode.layoutObject(); | |
| 227 if (object && object->isLayoutPart()) { | |
| 228 Widget* widget = toLayoutPart(object)->widget(); | |
| 229 if (widget && widget->isPluginContainer()) | |
| 230 return toWebPluginContainerImpl(widget); | |
| 231 } | |
| 232 } | |
| 233 return 0; | |
| 234 } | 241 } |
| 235 | 242 |
| 236 WebAXObject WebNode::accessibilityObject() | 243 WebAXObject WebNode::accessibilityObject() |
| 237 { | 244 { |
| 238 WebDocument webDocument = document(); | 245 WebDocument webDocument = document(); |
| 239 const Document* doc = document().constUnwrap<Document>(); | 246 const Document* doc = document().constUnwrap<Document>(); |
| 240 AXObjectCacheImpl* cache = toAXObjectCacheImpl(doc->existingAXObjectCache())
; | 247 AXObjectCacheImpl* cache = toAXObjectCacheImpl(doc->existingAXObjectCache())
; |
| 241 Node* node = unwrap<Node>(); | 248 Node* node = unwrap<Node>(); |
| 242 return cache ? WebAXObject(cache->get(node)) : WebAXObject(); | 249 return cache ? WebAXObject(cache->get(node)) : WebAXObject(); |
| 243 } | 250 } |
| 244 | 251 |
| 245 WebNode::WebNode(Node* node) | 252 WebNode::WebNode(Node* node) |
| 246 : m_private(node) | 253 : m_private(node) |
| 247 { | 254 { |
| 248 } | 255 } |
| 249 | 256 |
| 250 WebNode& WebNode::operator=(Node* node) | 257 WebNode& WebNode::operator=(Node* node) |
| 251 { | 258 { |
| 252 m_private = node; | 259 m_private = node; |
| 253 return *this; | 260 return *this; |
| 254 } | 261 } |
| 255 | 262 |
| 256 WebNode::operator Node*() const | 263 WebNode::operator Node*() const |
| 257 { | 264 { |
| 258 return m_private.get(); | 265 return m_private.get(); |
| 259 } | 266 } |
| 260 | 267 |
| 261 } // namespace blink | 268 } // namespace blink |
| OLD | NEW |