• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
2 // reserved. Use of this source code is governed by a BSD-style license that
3 // can be found in the LICENSE file.
4 
5 #ifndef CEF_LIBCEF_DOM_NODE_IMPL_H_
6 #define CEF_LIBCEF_DOM_NODE_IMPL_H_
7 #pragma once
8 
9 #include "include/cef_dom.h"
10 #include "third_party/blink/public/web/web_node.h"
11 
12 class CefDOMDocumentImpl;
13 
14 class CefDOMNodeImpl : public CefDOMNode {
15  public:
16   CefDOMNodeImpl(CefRefPtr<CefDOMDocumentImpl> document,
17                  const blink::WebNode& node);
18   ~CefDOMNodeImpl() override;
19 
20   // CefDOMNode methods.
21   Type GetType() override;
22   bool IsText() override;
23   bool IsElement() override;
24   bool IsEditable() override;
25   bool IsFormControlElement() override;
26   CefString GetFormControlElementType() override;
27   bool IsSame(CefRefPtr<CefDOMNode> that) override;
28   CefString GetName() override;
29   CefString GetValue() override;
30   bool SetValue(const CefString& value) override;
31   CefString GetAsMarkup() override;
32   CefRefPtr<CefDOMDocument> GetDocument() override;
33   CefRefPtr<CefDOMNode> GetParent() override;
34   CefRefPtr<CefDOMNode> GetPreviousSibling() override;
35   CefRefPtr<CefDOMNode> GetNextSibling() override;
36   bool HasChildren() override;
37   CefRefPtr<CefDOMNode> GetFirstChild() override;
38   CefRefPtr<CefDOMNode> GetLastChild() override;
39   CefString GetElementTagName() override;
40   bool HasElementAttributes() override;
41   bool HasElementAttribute(const CefString& attrName) override;
42   CefString GetElementAttribute(const CefString& attrName) override;
43   void GetElementAttributes(AttributeMap& attrMap) override;
44   bool SetElementAttribute(const CefString& attrName,
45                            const CefString& value) override;
46   CefString GetElementInnerText() override;
47   CefRect GetElementBounds() override;
48 
49   // Will be called from CefDOMDocumentImpl::Detach().
50   void Detach();
51 
52   // Verify that the object exists and is being accessed on the UI thread.
53   bool VerifyContext();
54 
55  protected:
56   CefRefPtr<CefDOMDocumentImpl> document_;
57   blink::WebNode node_;
58 
59   IMPLEMENT_REFCOUNTING(CefDOMNodeImpl);
60 };
61 
62 #endif  // CEF_LIBCEF_DOM_NODE_IMPL_H_
63