WebNode WebElement::shadowRoot() const { ShadowRoot* shadowRoot = constUnwrap<Element>()->shadowRoot(); if (!shadowRoot) return WebNode(); return WebNode(shadowRoot->toNode()); }
void ChromeClientImpl::focusedNodeChanged(Node* fromNode, Node* toNode) { m_webView->client()->focusedNodeChanged(WebNode(fromNode), WebNode(toNode)); WebURL focusURL; if (toNode && toNode->isElementNode() && toElement(toNode)->isLiveLink() && toNode->shouldHaveFocusAppearance()) focusURL = toElement(toNode)->hrefURL(); m_webView->client()->setKeyboardFocusURL(focusURL); }
WebNode WebNodeCollection::nextItem() const { Node* node = m_private->item(m_current); if (node) m_current++; return WebNode(node); }
void ChromeClientImpl::showUnhandledTapUIIfNeeded( IntPoint tappedPositionInViewport, Node* tappedNode, bool pageChanged) { if (m_webView->client()) m_webView->client()->showUnhandledTapUIIfNeeded( WebPoint(tappedPositionInViewport), WebNode(tappedNode), pageChanged); }
void AutofillPopupMenuClient::popupDidHide() { WebViewImpl* webView = getWebView(); if (!webView) return; webView->autofillPopupDidHide(); webView->autofillClient()->didClearAutofillSelection(WebNode(getTextField())); }
void ChromeClientImpl::focusedNodeChanged(Node* node) { m_webView->client()->focusedNodeChanged(WebNode(node)); WebURL focusURL; if (node && node->isElementNode() && toElement(node)->isLiveLink()) focusURL = toElement(node)->hrefURL(); m_webView->client()->setKeyboardFocusURL(focusURL); }
bool EditorClientImpl::shouldInsertNode(Node* node, Range* range, EditorInsertAction action) { if (m_webView->client()) { return m_webView->client()->shouldInsertNode(WebNode(node), WebRange(range), static_cast<WebEditingAction>(action)); } return true; }
void ChromeClientImpl::formStateDidChange(const Node* node) { if (m_webView->client()) m_webView->client()->didChangeFormState(WebNode(const_cast<Node*>(node))); // The current history item is not updated yet. That happens lazily when // WebFrame::currentHistoryItem is requested. WebFrameImpl* webframe = WebFrameImpl::fromFrame(node->document()->frame()); if (webframe->client()) webframe->client()->didUpdateCurrentHistoryItem(webframe); }
void AutofillPopupMenuClient::selectionChanged(unsigned listIndex, bool fireEvents) { WebViewImpl* webView = getWebView(); if (!webView) return; ASSERT_WITH_SECURITY_IMPLICATION(listIndex < m_names.size()); webView->autofillClient()->didSelectAutofillSuggestion(WebNode(getTextField()), m_names[listIndex], m_labels[listIndex], m_itemIDs[listIndex]); }
static bool getNodeImpl(NPObject* object, WebNode* webNode) { if (!object || (object->_class != npScriptObjectClass)) return false; V8NPObject* v8NPObject = reinterpret_cast<V8NPObject*>(object); v8::Handle<v8::Object> v8Object(v8NPObject->v8Object); Node* native = V8Node::HasInstance(v8Object) ? V8Node::toNative(v8Object) : 0; if (!native) return false; *webNode = WebNode(native); return true; }
void AutofillPopupMenuClient::selectionChanged(unsigned listIndex, bool fireEvents) { WebViewImpl* webView = getWebView(); if (!webView) return; if (m_separatorIndex != -1 && listIndex > static_cast<unsigned>(m_separatorIndex)) --listIndex; ASSERT(listIndex < m_names.size()); webView->autofillClient()->didSelectAutofillSuggestion(WebNode(getTextField()), m_names[listIndex], m_labels[listIndex], m_uniqueIDs[listIndex]); }
void ChromeClientImpl::focusedNodeChanged(Node* node) { m_webView->client()->focusedNodeChanged(WebNode(node)); WebURL focusURL; if (node && node->isLink()) { // This HitTestResult hack is the easiest way to get a link URL out of a // WebCore::Node. HitTestResult hitTest(IntPoint(0, 0)); // This cast must be valid because of the isLink() check. hitTest.setURLElement(toElement(node)); if (hitTest.isLiveLink()) focusURL = hitTest.absoluteLinkURL(); } m_webView->client()->setKeyboardFocusURL(focusURL); }
void EditorClientImpl::doAutofill(Timer<EditorClientImpl>* timer) { OwnPtr<AutofillArgs> args(m_autofillArgs.release()); HTMLInputElement* inputElement = args->inputElement.get(); const String& value = inputElement->value(); // Enforce autofill_on_empty_value and caret_at_end. bool isCaretAtEnd = true; if (args->requireCaretAtEnd) isCaretAtEnd = inputElement->selectionStart() == inputElement->selectionEnd() && inputElement->selectionEnd() == static_cast<int>(value.length()); if ((!args->autofillOnEmptyValue && value.isEmpty()) || !isCaretAtEnd) { m_webView->hideAutoFillPopup(); return; } // First let's see if there is a password listener for that element. // We won't trigger form autofill in that case, as having both behavior on // a node would be confusing. WebFrameImpl* webframe = WebFrameImpl::fromFrame(inputElement->document()->frame()); if (!webframe) return; WebPasswordAutocompleteListener* listener = webframe->getPasswordListener(inputElement); if (listener) { if (args->autofillFormOnly) return; listener->performInlineAutocomplete(value, args->backspaceOrDeletePressed, true); return; } // Then trigger form autofill. WebString name = WebInputElement(inputElement).nameForAutofill(); ASSERT(static_cast<int>(name.length()) > 0); if (m_webView->client()) m_webView->client()->queryAutofillSuggestions(WebNode(inputElement), name, WebString(value)); }
static bool getNodeImpl(NPObject* object, WebNode* webNode, v8::Isolate* isolate) { if (!object) return false; V8NPObject* v8NPObject = npObjectToV8NPObject(object); if (!v8NPObject) return false; v8::HandleScope handleScope(isolate); v8::Local<v8::Object> v8Object = v8::Local<v8::Object>::New(isolate, v8NPObject->v8Object); if (v8Object.IsEmpty()) return false; Node* native = V8Node::hasInstance(v8Object, isolate) ? V8Node::toImpl(v8Object) : 0; if (!native) return false; *webNode = WebNode(native); return true; }
void ChromeClientImpl::focusedNodeChanged(Node* node) { m_webView->client()->focusedNodeChanged(WebNode(node)); WebURL focusURL; if (node && node->isLink()) { // This HitTestResult hack is the easiest way to get a link URL out of a // WebCore::Node. HitTestResult hitTest(IntPoint(0, 0)); // This cast must be valid because of the isLink() check. hitTest.setURLElement(static_cast<Element*>(node)); if (hitTest.isLiveLink()) focusURL = hitTest.absoluteLinkURL(); } m_webView->client()->setKeyboardFocusURL(focusURL); if (!node) return; // If accessibility is enabled, we should notify assistive technology that // the active AccessibilityObject changed. Document* document = node->document(); if (!document) { ASSERT_NOT_REACHED(); return; } if (document && document->axObjectCache()->accessibilityEnabled()) { // Retrieve the focused AccessibilityObject. AccessibilityObject* focusedAccObj = document->axObjectCache()->getOrCreate(node->renderer()); // Alert assistive technology that focus changed. if (focusedAccObj) m_webView->client()->focusAccessibilityObject(WebAccessibilityObject(focusedAccObj)); } }
void AutofillPopupMenuClient::valueChanged(unsigned listIndex, bool fireEvents) { WebViewImpl* webView = getWebView(); if (!webView) return; ASSERT_WITH_SECURITY_IMPLICATION(listIndex < m_names.size()); if (m_useLegacyBehavior) { for (size_t i = 0; i < m_itemIDs.size(); ++i) { if (m_itemIDs[i] == WebAutofillClient::MenuItemIDSeparator) { if (listIndex > i) listIndex--; break; } } } webView->autofillClient()->didAcceptAutofillSuggestion(WebNode(getTextField()), m_names[listIndex], m_labels[listIndex], m_itemIDs[listIndex], listIndex); }
WebNode WebNode::firstChild() const { return WebNode(m_private->firstChild()); }
WebNode WebEvent::currentTarget() const { ASSERT(m_private); return WebNode(m_private->currentTarget()->toNode()); }
void ChromeClientImpl::onMouseDown(Node* mouseDownNode) { if (m_webView->client()) m_webView->client()->onMouseDown(WebNode(mouseDownNode)); }
WebNode WebHitTestResult::node() const { return WebNode(m_private->innerNode()); }
void ChromeClientImpl::focusedNodeChanged(Node* node) { m_webView->client()->focusedNodeChanged(WebNode(node)); }
WebNode root() { return WebNode(document().documentElement()); }
WebNode WebDocument::focusedNode() const { return WebNode(constUnwrap<Document>()->focusedNode()); }
WebNode WebNode::nextSibling() const { return WebNode(m_private->nextSibling()); }
WebNode WebNode::lastChild() const { return WebNode(m_private->lastChild()); }
void AutofillPopupMenuClient::selectionCleared() { WebViewImpl* webView = getWebView(); if (webView) webView->autofillClient()->didClearAutofillSelection(WebNode(getTextField())); }
WebNode WebNode::previousSibling() const { return WebNode(m_private->previousSibling()); }
WebNode WebNodeList::item(size_t index) const { return WebNode(m_private->item(index)); }
WebNode WebNode::parentNode() const { return WebNode(const_cast<ContainerNode*>(m_private->parentNode())); }
void ChromeClientImpl::exitFullscreenForNode(WebCore::Node* node) { if (m_webView->client()) m_webView->client()->exitFullscreenForNode(WebNode(node)); }