void ChromeClientQt::mouseDidMoveOverElement(const HitTestResult& result, unsigned modifierFlags) { if (result.absoluteLinkURL() != lastHoverURL || result.title() != lastHoverTitle || result.textContent() != lastHoverContent) { lastHoverURL = result.absoluteLinkURL(); lastHoverTitle = result.title(); lastHoverContent = result.textContent(); emit m_webPage->linkHovered(lastHoverURL.prettyURL(), lastHoverTitle, lastHoverContent); } }
void ChromeClientQt::mouseDidMoveOverElement(const HitTestResult& result, unsigned) { TextDirection dir; if (result.absoluteLinkURL() != lastHoverURL || result.title(dir) != lastHoverTitle || result.textContent() != lastHoverContent) { lastHoverURL = result.absoluteLinkURL(); lastHoverTitle = result.title(dir); lastHoverContent = result.textContent(); emit m_webPage->linkHovered(lastHoverURL.string(), lastHoverTitle, lastHoverContent); } }
void Chrome::setToolTip(const HitTestResult& result) { // First priority is a potential toolTip representing a spelling or grammar error String toolTip = result.spellingToolTip(); // Next priority is a toolTip from a URL beneath the mouse (if preference is set to show those). if (toolTip.isEmpty() && m_page->settings()->showsURLsInToolTips()) { if (Node* node = result.innerNonSharedNode()) { // Get tooltip representing form action, if relevant if (node->hasTagName(inputTag)) { HTMLInputElement* input = static_cast<HTMLInputElement*>(node); if (input->inputType() == HTMLInputElement::SUBMIT) if (HTMLFormElement* form = input->form()) toolTip = form->action(); } } // Get tooltip representing link's URL if (toolTip.isEmpty()) // FIXME: Need to pass this URL through userVisibleString once that's in WebCore toolTip = result.absoluteLinkURL().string(); } // Lastly we'll consider a tooltip for element with "title" attribute if (toolTip.isEmpty()) toolTip = result.title(); m_client->setToolTip(toolTip); }
void Chrome::setToolTip(const HitTestResult& result) { // First priority is a potential toolTip representing a spelling or grammar error TextDirection toolTipDirection; String toolTip = result.spellingToolTip(toolTipDirection); // Next we'll consider a tooltip for element with "title" attribute if (toolTip.isEmpty()) toolTip = result.title(toolTipDirection); // Lastly, for <input type="file"> that allow multiple files, we'll consider a tooltip for the selected filenames if (toolTip.isEmpty()) { if (Node* node = result.innerNonSharedNode()) { if (node->hasTagName(inputTag)) { HTMLInputElement* input = toHTMLInputElement(node); toolTip = input->defaultToolTip(); // FIXME: We should obtain text direction of tooltip from // ChromeClient or platform. As of October 2011, all client // implementations don't use text direction information for // ChromeClient::setToolTip. We'll work on tooltip text // direction during bidi cleanup in form inputs. toolTipDirection = LTR; } } } m_client->setToolTip(toolTip, toolTipDirection); }
void ChromeClient::mouseDidMoveOverElement(const HitTestResult& hit, unsigned modifierFlags) { // If a tooltip must be displayed it will be, afterwards, when // setToolTip is called; this is just a work-around to make sure // it updates its location correctly; see // https://bugs.webkit.org/show_bug.cgi?id=15793. g_object_set(m_webView, "has-tooltip", FALSE, NULL); GdkDisplay* gdkDisplay; GtkWidget* window = gtk_widget_get_toplevel(GTK_WIDGET(m_webView)); if (GTK_WIDGET_TOPLEVEL(window)) gdkDisplay = gtk_widget_get_display(window); else gdkDisplay = gdk_display_get_default(); gtk_tooltip_trigger_tooltip_query(gdkDisplay); // check if the element is a link... bool isLink = hit.isLiveLink(); if (isLink) { KURL url = hit.absoluteLinkURL(); if (!url.isEmpty() && url != m_hoveredLinkURL) { TextDirection dir; CString titleString = hit.title(dir).utf8(); CString urlString = url.prettyURL().utf8(); g_signal_emit_by_name(m_webView, "hovering-over-link", titleString.data(), urlString.data()); m_hoveredLinkURL = url; } } else if (!isLink && !m_hoveredLinkURL.isEmpty()) { g_signal_emit_by_name(m_webView, "hovering-over-link", 0, 0); m_hoveredLinkURL = KURL(); } }
void ChromeClient::mouseDidMoveOverElement(const HitTestResult& hit, unsigned modifierFlags) { // check if the element is a link... bool isLink = hit.isLiveLink(); if (isLink) { KURL url = hit.absoluteLinkURL(); if (!url.isEmpty() && url != m_hoveredLinkURL) { TextDirection dir; CString titleString = hit.title(dir).utf8(); CString urlString = url.string().utf8(); g_signal_emit_by_name(m_webView, "hovering-over-link", titleString.data(), urlString.data()); m_hoveredLinkURL = url; } } else if (!isLink && !m_hoveredLinkURL.isEmpty()) { g_signal_emit_by_name(m_webView, "hovering-over-link", 0, 0); m_hoveredLinkURL = KURL(); } if (Node* node = hit.innerNonSharedNode()) { Frame* frame = node->document()->frame(); FrameView* view = frame ? frame->view() : 0; m_webView->priv->tooltipArea = view ? view->contentsToWindow(node->getRect()) : IntRect(); } else m_webView->priv->tooltipArea = IntRect(); }
void ChromeClient::setToolTip(LocalFrame& frame, const HitTestResult& result) { // First priority is a tooltip for element with "title" attribute. TextDirection toolTipDirection; String toolTip = result.title(toolTipDirection); // Lastly, some elements provide default tooltip strings. e.g. <input // type="file" multiple> shows a tooltip for the selected filenames. if (toolTip.isEmpty()) { if (Node* node = result.innerNode()) { if (node->isElementNode()) { toolTip = toElement(node)->defaultToolTip(); // FIXME: We should obtain text direction of tooltip from // ChromeClient or platform. As of October 2011, all client // implementations don't use text direction information for // ChromeClient::setToolTip. We'll work on tooltip text // direction during bidi cleanup in form inputs. toolTipDirection = LTR; } } } if (m_lastToolTipPoint == result.hitTestLocation().point() && m_lastToolTipText == toolTip) return; m_lastToolTipPoint = result.hitTestLocation().point(); m_lastToolTipText = toolTip; setToolTip(frame, toolTip, toolTipDirection); }
void ChromeClientEA::mouseDidMoveOverElement(const HitTestResult& result, unsigned) { #if 0 // This could have interesting usage in UI. On PC, it is mostly used to display info in the // status panel. TextDirection dir; if (result.absoluteLinkURL() != lastHoverURL || result.title(dir) != lastHoverTitle || result.textContent() != lastHoverContent) { lastHoverURL = result.absoluteLinkURL(); lastHoverTitle = result.title(dir); lastHoverContent = result.textContent(); emit m_webPage->linkHovered(lastHoverURL.string(), lastHoverTitle, lastHoverContent); } #endif }
void Chrome::setToolTip(const HitTestResult& result) { // First priority is a potential toolTip representing a spelling or grammar error TextDirection toolTipDirection; String toolTip = result.spellingToolTip(toolTipDirection); // Next priority is a toolTip from a URL beneath the mouse (if preference is set to show those). if (toolTip.isEmpty() && m_page.settings().showsURLsInToolTips()) { if (Element* element = result.innerNonSharedElement()) { // Get tooltip representing form action, if relevant if (isHTMLInputElement(element)) { HTMLInputElement* input = toHTMLInputElement(element); if (input->isSubmitButton()) { if (HTMLFormElement* form = input->form()) { toolTip = form->action(); if (form->renderer()) toolTipDirection = form->renderer()->style()->direction(); else toolTipDirection = LTR; } } } } // Get tooltip representing link's URL if (toolTip.isEmpty()) { // FIXME: Need to pass this URL through userVisibleString once that's in WebCore toolTip = result.absoluteLinkURL().string(); // URL always display as LTR. toolTipDirection = LTR; } } // Next we'll consider a tooltip for element with "title" attribute if (toolTip.isEmpty()) toolTip = result.title(toolTipDirection); if (toolTip.isEmpty() && m_page.settings().showsToolTipOverTruncatedText()) toolTip = result.innerTextIfTruncated(toolTipDirection); // Lastly, for <input type="file"> that allow multiple files, we'll consider a tooltip for the selected filenames if (toolTip.isEmpty()) { if (Element* element = result.innerNonSharedElement()) { if (isHTMLInputElement(element)) { toolTip = toHTMLInputElement(element)->defaultToolTip(); // FIXME: We should obtain text direction of tooltip from // ChromeClient or platform. As of October 2011, all client // implementations don't use text direction information for // ChromeClient::setToolTip. We'll work on tooltip text // direction during bidi cleanup in form inputs. toolTipDirection = LTR; } } } m_client.setToolTip(toolTip, toolTipDirection); }
void Chrome::setToolTip(const HitTestResult& result) { // First priority is a potential toolTip representing a spelling or grammar error String toolTip = result.spellingToolTip(); // Next priority is a toolTip from a URL beneath the mouse (if preference is set to show those). if (toolTip.isEmpty() && m_page->settings()->showsURLsInToolTips()) { if (Node* node = result.innerNonSharedNode()) { // Get tooltip representing form action, if relevant if (node->hasTagName(inputTag)) { HTMLInputElement* input = static_cast<HTMLInputElement*>(node); if (input->inputType() == HTMLInputElement::SUBMIT) if (HTMLFormElement* form = input->form()) toolTip = form->action(); } } // Get tooltip representing link's URL if (toolTip.isEmpty()) // FIXME: Need to pass this URL through userVisibleString once that's in WebCore toolTip = result.absoluteLinkURL().string(); } // Next we'll consider a tooltip for element with "title" attribute if (toolTip.isEmpty()) toolTip = result.title(); // Lastly, for <input type="file"> that allow multiple files, we'll consider a tooltip for the selected filenames if (toolTip.isEmpty()) { if (Node* node = result.innerNonSharedNode()) { if (node->hasTagName(inputTag)) { HTMLInputElement* input = static_cast<HTMLInputElement*>(node); if (input->inputType() == HTMLInputElement::FILE) { FileList* files = input->files(); unsigned listSize = files->length(); if (files && listSize > 1) { Vector<UChar> names; for (size_t i = 0; i < listSize; ++i) { append(names, files->item(i)->fileName()); if (i != listSize - 1) names.append('\n'); } toolTip = String::adopt(names); } } } } } m_client->setToolTip(toolTip); }
void ChromeClient::mouseDidMoveOverElement(const HitTestResult& hit, unsigned modifierFlags) { // check if the element is a link... bool isLink = hit.isLiveLink(); if (isLink) { KURL url = hit.absoluteLinkURL(); if (!url.isEmpty() && url != m_hoveredLinkURL) { CString titleString = hit.title().utf8(); CString urlString = url.prettyURL().utf8(); g_signal_emit_by_name(m_webView, "hovering-over-link", titleString.data(), urlString.data()); m_hoveredLinkURL = url; } } else if (!isLink && !m_hoveredLinkURL.isEmpty()) { g_signal_emit_by_name(m_webView, "hovering-over-link", 0, 0); m_hoveredLinkURL = KURL(); } }
void ChromeClientEfl::mouseDidMoveOverElement(const HitTestResult& hit, unsigned modifierFlags) { // FIXME, compare with old link, look at Qt impl. bool isLink = hit.isLiveLink(); if (isLink) { KURL url = hit.absoluteLinkURL(); if (!url.isEmpty() && url != m_hoveredLinkURL) { const char* link[2]; TextDirection dir; CString urlStr = url.string().utf8(); CString titleStr = hit.title(dir).utf8(); link[0] = urlStr.data(); link[1] = titleStr.data(); ewk_view_mouse_link_hover_in(m_view, link); m_hoveredLinkURL = url; } } else if (!isLink && !m_hoveredLinkURL.isEmpty()) { ewk_view_mouse_link_hover_out(m_view); m_hoveredLinkURL = KURL(); } }