/// <summary> /// Returns the document element with the specified ID value. /// </summary> public CefDomNode GetElementById(string id) { fixed(char *id_str = id) { var n_id = new cef_string_t(id_str, id.Length); return(CefDomNode.FromNativeOrNull( cef_domdocument_t.get_element_by_id(_self, &n_id) )); } }
private void on_focused_node_changed(cef_render_process_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_domnode_t *node) { CheckSelf(self); var m_browser = CefBrowser.FromNative(browser); var m_frame = CefFrame.FromNative(frame); var m_node = CefDomNode.FromNativeOrNull(node); OnFocusedNodeChanged(m_browser, m_frame, m_node); if (m_node != null) { m_node.Dispose(); } }
/// <summary> /// Returns true if this object is pointing to the same handle as |that| /// object. /// </summary> public bool IsSame(CefDomNode that) { return(cef_domnode_t.is_same(_self, that.ToNative()) != 0); }
public void AttachEventHandler(CefDomNode parentNode, string indexPath, RSEventListener listener) { if (parentNode.HasChildren) { CefDomNode node = parentNode.FirstChild; if (node == null) return; int index = 0; string indexPath1 = indexPath + "." + index.ToString(); if (indexPath1 == _item.id) { node.AddEventListener(_item.eventName, listener, true); return; } AttachEventHandler(node, indexPath1, listener); node = node.NextSibling; while (node != null) { index++; indexPath1 = indexPath + "." + index.ToString(); if (indexPath1 == _item.id) { node.AddEventListener(_item.eventName, listener, true); return; } AttachEventHandler(node, indexPath1, listener); node = node.NextSibling; System.Windows.Forms.Application.DoEvents(); } } }
private CwbElement CreateElement(CefDomNode node) { string id = string.Empty; if (node.HasAttribute("id")) { id = node.GetAttribute("id"); } CwbElement retValue = new CwbElement(browser,id, node.ElementTagName,node.GetAttribute("value"), node.IsElement,node.IsEditable, node.HasChildren,node.InnerText, node.HasAttributes ); foreach (KeyValuePair<string, string> item in node.GetAttributes()) { retValue.Attributes.Add(item); } return retValue; }
public void AppendAllChildElement(CefDomNode parentNode,CwbElement parentElement, string indePath) { if (parentNode.HasChildren) { CefDomNode node = parentNode.FirstChild; if (node == null) return; int index = 0; CwbElement childElement = CreateElement(node); childElement.IndexPath = indePath + "."+index.ToString(); parentElement.ChildElements.Add(childElement); AppendAllChildElement(node, childElement, childElement.IndexPath); node = node.NextSibling; while (node != null) { childElement = CreateElement(node); index++; childElement.IndexPath = indePath + "." + index.ToString(); parentElement.ChildElements.Add(childElement); AppendAllChildElement(node, childElement, childElement.IndexPath); node = node.NextSibling; System.Windows.Forms.Application.DoEvents(); } } }
/// <summary> /// Returns true if this object is pointing to the same handle as |that| /// object. /// </summary> public bool IsSame(CefDomNode that) { return cef_domnode_t.is_same(_self, that.ToNative()) != 0; }
/// <summary> /// Called when a new node in the the browser gets focus. The |node| value may /// be empty if no specific node has gained focus. The node object passed to /// this method represents a snapshot of the DOM at the time this method is /// executed. DOM objects are only valid for the scope of this method. Do not /// keep references to or attempt to access any DOM objects outside the scope /// of this method. /// </summary> protected virtual void OnFocusedNodeChanged(CefBrowser browser, CefFrame frame, CefDomNode node) { }