本文整理汇总了C++中HTMLInputElement::defaultToolTip方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLInputElement::defaultToolTip方法的具体用法?C++ HTMLInputElement::defaultToolTip怎么用?C++ HTMLInputElement::defaultToolTip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLInputElement
的用法示例。
在下文中一共展示了HTMLInputElement::defaultToolTip方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setToolTip
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);
}
示例2: setToolTip
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 (Node* node = result.innerNonSharedNode()) {
// Get tooltip representing form action, if relevant
if (node->hasTagName(inputTag)) {
HTMLInputElement* input = static_cast<HTMLInputElement*>(node);
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 (Node* node = result.innerNonSharedNode()) {
if (node->hasTagName(inputTag)) {
HTMLInputElement* input = static_cast<HTMLInputElement*>(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);
}