Ejemplo n.º 1
0
WebNode WebElement::shadowRoot() const
{
    ShadowRoot* shadowRoot = constUnwrap<Element>()->shadowRoot();
    if (!shadowRoot)
        return WebNode();
    return WebNode(shadowRoot->toNode());
}
Ejemplo n.º 2
0
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);
}
Ejemplo n.º 4
0
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()));
}
Ejemplo n.º 6
0
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);
}
Ejemplo n.º 7
0
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;
}
Ejemplo n.º 8
0
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]);
}
Ejemplo n.º 10
0
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;
}
Ejemplo n.º 11
0
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]);
}
Ejemplo n.º 12
0
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);
}
Ejemplo n.º 13
0
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));
}
Ejemplo n.º 14
0
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));
    }
}
Ejemplo n.º 16
0
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);
}
Ejemplo n.º 17
0
WebNode WebNode::firstChild() const
{
    return WebNode(m_private->firstChild());
}
Ejemplo n.º 18
0
WebNode WebEvent::currentTarget() const
{
    ASSERT(m_private);
    return WebNode(m_private->currentTarget()->toNode());
}
Ejemplo n.º 19
0
void ChromeClientImpl::onMouseDown(Node* mouseDownNode) {
  if (m_webView->client())
    m_webView->client()->onMouseDown(WebNode(mouseDownNode));
}
Ejemplo n.º 20
0
WebNode WebHitTestResult::node() const
{
    return WebNode(m_private->innerNode());
}
Ejemplo n.º 21
0
void ChromeClientImpl::focusedNodeChanged(Node* node)
{
    m_webView->client()->focusedNodeChanged(WebNode(node));
}
 WebNode root()
 {
     return WebNode(document().documentElement());
 }
Ejemplo n.º 23
0
WebNode WebDocument::focusedNode() const
{
    return WebNode(constUnwrap<Document>()->focusedNode());
}
Ejemplo n.º 24
0
WebNode WebNode::nextSibling() const
{
    return WebNode(m_private->nextSibling());
}
Ejemplo n.º 25
0
WebNode WebNode::lastChild() const
{
    return WebNode(m_private->lastChild());
}
Ejemplo n.º 26
0
void AutofillPopupMenuClient::selectionCleared()
{
    WebViewImpl* webView = getWebView();
    if (webView)
        webView->autofillClient()->didClearAutofillSelection(WebNode(getTextField()));
}
Ejemplo n.º 27
0
WebNode WebNode::previousSibling() const
{
    return WebNode(m_private->previousSibling());
}
Ejemplo n.º 28
0
WebNode WebNodeList::item(size_t index) const
{
    return WebNode(m_private->item(index));
}
Ejemplo n.º 29
0
WebNode WebNode::parentNode() const
{
    return WebNode(const_cast<ContainerNode*>(m_private->parentNode()));
}
Ejemplo n.º 30
0
void ChromeClientImpl::exitFullscreenForNode(WebCore::Node* node)
{
    if (m_webView->client())
        m_webView->client()->exitFullscreenForNode(WebNode(node));
}