本文整理汇总了C++中DocumentMarker::description方法的典型用法代码示例。如果您正苦于以下问题:C++ DocumentMarker::description方法的具体用法?C++ DocumentMarker::description怎么用?C++ DocumentMarker::description使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DocumentMarker
的用法示例。
在下文中一共展示了DocumentMarker::description方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: replacedString
String HitTestResult::replacedString() const
{
// Return the replaced string associated with this point, if any. This marker is created when a string is autocorrected,
// and is used for generating a contextual menu item that allows it to easily be changed back if desired.
if (!m_innerNonSharedNode)
return String();
DocumentMarker* marker = m_innerNonSharedNode->document()->markers()->markerContainingPoint(point(), DocumentMarker::Replacement);
if (!marker)
return String();
return marker->description();
}
示例2: spellingToolTip
String HitTestResult::spellingToolTip(TextDirection& dir) const
{
dir = LTR;
// Return the tool tip string associated with this point, if any. Only markers associated with bad grammar
// currently supply strings, but maybe someday markers associated with misspelled words will also.
if (!m_innerNonSharedNode)
return String();
DocumentMarker* marker = m_innerNonSharedNode->document().markers().markerContainingPoint(m_hitTestLocation.point(), DocumentMarker::Grammar);
if (!marker)
return String();
if (RenderObject* renderer = m_innerNonSharedNode->renderer())
dir = renderer->style()->direction();
return marker->description();
}
示例3: showContextMenu
//.........这里部分代码省略.........
}
}
}
// An image can to be null for many reasons, like being blocked, no image
// data received from server yet.
data.hasImageContents =
(data.mediaType == WebContextMenuData::MediaTypeImage)
&& r.image() && !(r.image()->isNull());
// If it's not a link, an image, a media element, or an image/media link,
// show a selection menu or a more generic page menu.
if (selectedFrame->document()->loader())
data.frameEncoding = selectedFrame->document()->encodingName();
// Send the frame and page URLs in any case.
data.pageURL = urlFromFrame(m_webView->mainFrameImpl()->frame());
if (selectedFrame != m_webView->mainFrameImpl()->frame()) {
data.frameURL = urlFromFrame(selectedFrame);
RefPtr<HistoryItem> historyItem = selectedFrame->loader().currentItem();
if (historyItem)
data.frameHistoryItem = WebHistoryItem(historyItem);
}
if (r.isSelected()) {
if (!isHTMLInputElement(*r.innerNonSharedNode()) || !toHTMLInputElement(r.innerNonSharedNode())->isPasswordField())
data.selectedText = selectedFrame->selectedText().stripWhiteSpace();
}
if (r.isContentEditable()) {
data.isEditable = true;
// When Chrome enables asynchronous spellchecking, its spellchecker adds spelling markers to misspelled
// words and attaches suggestions to these markers in the background. Therefore, when a user right-clicks
// a mouse on a word, Chrome just needs to find a spelling marker on the word instead of spellchecking it.
if (selectedFrame->settings() && selectedFrame->settings()->asynchronousSpellCheckingEnabled()) {
DocumentMarker marker;
data.misspelledWord = selectMisspellingAsync(selectedFrame, marker);
data.misspellingHash = marker.hash();
if (marker.description().length()) {
Vector<String> suggestions;
marker.description().split('\n', suggestions);
data.dictionarySuggestions = suggestions;
} else if (m_webView->spellCheckClient()) {
int misspelledOffset, misspelledLength;
m_webView->spellCheckClient()->spellCheck(data.misspelledWord, misspelledOffset, misspelledLength, &data.dictionarySuggestions);
}
} else {
data.isSpellCheckingEnabled =
toLocalFrame(m_webView->focusedWebCoreFrame())->spellChecker().isContinuousSpellCheckingEnabled();
// Spellchecking might be enabled for the field, but could be disabled on the node.
if (toLocalFrame(m_webView->focusedWebCoreFrame())->spellChecker().isSpellCheckingEnabledInFocusedNode()) {
data.misspelledWord = selectMisspelledWord(selectedFrame);
if (m_webView->spellCheckClient()) {
int misspelledOffset, misspelledLength;
m_webView->spellCheckClient()->spellCheck(
data.misspelledWord, misspelledOffset, misspelledLength,
&data.dictionarySuggestions);
if (!misspelledLength)
data.misspelledWord.reset();
}
}
}
HTMLFormElement* form = selectedFrame->selection().currentForm();
if (form && isHTMLInputElement(*r.innerNonSharedNode())) {
HTMLInputElement& selectedElement = toHTMLInputElement(*r.innerNonSharedNode());
WebSearchableFormData ws = WebSearchableFormData(WebFormElement(form), WebInputElement(&selectedElement));
if (ws.url().isValid())
data.keywordURL = ws.url();
}
}
if (selectedFrame->editor().selectionHasStyle(CSSPropertyDirection, "ltr") != FalseTriState)
data.writingDirectionLeftToRight |= WebContextMenuData::CheckableMenuItemChecked;
if (selectedFrame->editor().selectionHasStyle(CSSPropertyDirection, "rtl") != FalseTriState)
data.writingDirectionRightToLeft |= WebContextMenuData::CheckableMenuItemChecked;
// Now retrieve the security info.
DocumentLoader* dl = selectedFrame->loader().documentLoader();
WebDataSource* ds = WebDataSourceImpl::fromDocumentLoader(dl);
if (ds)
data.securityInfo = ds->response().securityInfo();
data.referrerPolicy = static_cast<WebReferrerPolicy>(selectedFrame->document()->referrerPolicy());
// Filter out custom menu elements and add them into the data.
populateCustomMenuItems(defaultMenu, &data);
// Extract suggested filename for saving file.
if (isHTMLAnchorElement(r.URLElement())) {
HTMLAnchorElement* anchor = toHTMLAnchorElement(r.URLElement());
data.suggestedFilename = anchor->fastGetAttribute(HTMLNames::downloadAttr);
}
data.node = r.innerNonSharedNode();
WebLocalFrameImpl* selectedWebFrame = WebLocalFrameImpl::fromFrame(selectedFrame);
if (selectedWebFrame->client())
selectedWebFrame->client()->showContextMenu(data);
}
示例4: if
//.........这里部分代码省略.........
}
}
data.isImageBlocked =
(data.mediaType == WebContextMenuData::MediaTypeImage) && !r.image();
// If it's not a link, an image, a media element, or an image/media link,
// show a selection menu or a more generic page menu.
if (selectedFrame->document()->loader())
data.frameEncoding = selectedFrame->document()->encoding();
// Send the frame and page URLs in any case.
data.pageURL = urlFromFrame(m_webView->mainFrameImpl()->frame());
if (selectedFrame != m_webView->mainFrameImpl()->frame()) {
data.frameURL = urlFromFrame(selectedFrame);
RefPtr<HistoryItem> historyItem = selectedFrame->loader()->history()->currentItem();
if (historyItem)
data.frameHistoryItem = WebHistoryItem(historyItem);
}
if (r.isSelected()) {
if (!r.innerNonSharedNode()->hasTagName(HTMLNames::inputTag) || !static_cast<HTMLInputElement*>(r.innerNonSharedNode())->isPasswordField())
data.selectedText = selectedFrame->editor()->selectedText().stripWhiteSpace();
}
if (r.isContentEditable()) {
data.isEditable = true;
#if ENABLE(INPUT_SPEECH)
if (r.innerNonSharedNode()->hasTagName(HTMLNames::inputTag)) {
data.isSpeechInputEnabled =
static_cast<HTMLInputElement*>(r.innerNonSharedNode())->isSpeechEnabled();
}
#endif
// When Chrome enables asynchronous spellchecking, its spellchecker adds spelling markers to misspelled
// words and attaches suggestions to these markers in the background. Therefore, when a user right-clicks
// a mouse on a word, Chrome just needs to find a spelling marker on the word instead of spellchecking it.
if (selectedFrame->settings() && selectedFrame->settings()->asynchronousSpellCheckingEnabled()) {
DocumentMarker marker;
data.misspelledWord = selectMisspellingAsync(selectedFrame, marker);
if (marker.description().length()) {
Vector<String> suggestions;
marker.description().split('\n', suggestions);
data.dictionarySuggestions = suggestions;
} else if (m_webView->spellCheckClient()) {
int misspelledOffset, misspelledLength;
m_webView->spellCheckClient()->spellCheck(data.misspelledWord, misspelledOffset, misspelledLength, &data.dictionarySuggestions);
}
} else {
data.isSpellCheckingEnabled =
m_webView->focusedWebCoreFrame()->editor()->isContinuousSpellCheckingEnabled();
// Spellchecking might be enabled for the field, but could be disabled on the node.
if (m_webView->focusedWebCoreFrame()->editor()->isSpellCheckingEnabledInFocusedNode()) {
data.misspelledWord = selectMisspelledWord(defaultMenu.get(), selectedFrame);
if (m_webView->spellCheckClient()) {
int misspelledOffset, misspelledLength;
m_webView->spellCheckClient()->spellCheck(
data.misspelledWord, misspelledOffset, misspelledLength,
&data.dictionarySuggestions);
if (!misspelledLength)
data.misspelledWord.reset();
}
}
}
HTMLFormElement* form = selectedFrame->selection()->currentForm();
if (form && r.innerNonSharedNode()->hasTagName(HTMLNames::inputTag)) {
HTMLInputElement* selectedElement = static_cast<HTMLInputElement*>(r.innerNonSharedNode());
if (selectedElement) {
WebSearchableFormData ws = WebSearchableFormData(WebFormElement(form), WebInputElement(selectedElement));
if (ws.url().isValid())
data.keywordURL = ws.url();
}
}
}
#if OS(DARWIN)
if (selectedFrame->editor()->selectionHasStyle(CSSPropertyDirection, "ltr") != FalseTriState)
data.writingDirectionLeftToRight |= WebContextMenuData::CheckableMenuItemChecked;
if (selectedFrame->editor()->selectionHasStyle(CSSPropertyDirection, "rtl") != FalseTriState)
data.writingDirectionRightToLeft |= WebContextMenuData::CheckableMenuItemChecked;
#endif // OS(DARWIN)
// Now retrieve the security info.
DocumentLoader* dl = selectedFrame->loader()->documentLoader();
WebDataSource* ds = WebDataSourceImpl::fromDocumentLoader(dl);
if (ds)
data.securityInfo = ds->response().securityInfo();
data.referrerPolicy = static_cast<WebReferrerPolicy>(selectedFrame->document()->referrerPolicy());
// Filter out custom menu elements and add them into the data.
populateCustomMenuItems(defaultMenu.get(), &data);
data.node = r.innerNonSharedNode();
WebFrame* selected_web_frame = WebFrameImpl::fromFrame(selectedFrame);
if (m_webView->client())
m_webView->client()->showContextMenu(selected_web_frame, data);
return defaultMenu;
}