本文整理汇总了C++中VisibleSelection::rootEditableElement方法的典型用法代码示例。如果您正苦于以下问题:C++ VisibleSelection::rootEditableElement方法的具体用法?C++ VisibleSelection::rootEditableElement怎么用?C++ VisibleSelection::rootEditableElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VisibleSelection
的用法示例。
在下文中一共展示了VisibleSelection::rootEditableElement方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setEndingSelection
void EditCommand::setEndingSelection(const VisibleSelection &s)
{
Element* root = s.rootEditableElement();
for (EditCommand* cmd = this; cmd; cmd = cmd->m_parent) {
cmd->m_endingSelection = s;
cmd->m_endingRootEditableElement = root;
}
}
示例2: canAppendNewLineFeedToSelection
bool canAppendNewLineFeedToSelection(const VisibleSelection& selection)
{
Node* node = selection.rootEditableElement();
if (!node)
return false;
RefPtr<BeforeTextInsertedEvent> event = BeforeTextInsertedEvent::create(String("\n"));
node->dispatchEvent(event, IGNORE_EXCEPTION);
return event->text().length();
}
示例3: canAppendNewLineFeedToSelection
bool canAppendNewLineFeedToSelection(const VisibleSelection& selection)
{
Element* element = selection.rootEditableElement();
if (!element)
return false;
RefPtrWillBeRawPtr<BeforeTextInsertedEvent> event = BeforeTextInsertedEvent::create(String("\n"));
element->dispatchEvent(event);
return event->text().length();
}
示例4: setStartingSelection
void EditCommand::setStartingSelection(const VisibleSelection& s)
{
Element* root = s.rootEditableElement();
for (EditCommand* cmd = this; ; cmd = cmd->m_parent) {
cmd->m_startingSelection = s;
cmd->m_startingRootEditableElement = root;
if (!cmd->m_parent || cmd->m_parent->isFirstCommand(cmd))
break;
}
}
示例5: canAppendNewLineFeed
static bool canAppendNewLineFeed(const VisibleSelection& selection)
{
Node* node = selection.rootEditableElement();
if (!node)
return false;
RefPtr<BeforeTextInsertedEvent> event = BeforeTextInsertedEvent::create(String("\n"));
ExceptionCode ec = 0;
node->dispatchEvent(event, ec);
return event->text().length();
}
示例6: toggleContinuousSpellChecking
void EditorClientImpl::toggleContinuousSpellChecking()
{
if (isContinuousSpellCheckingEnabled()) {
m_spellCheckThisFieldStatus = SpellCheckForcedOff;
} else {
m_spellCheckThisFieldStatus = SpellCheckForcedOn;
const Frame* frame = m_webView->focusedWebCoreFrame();
if (frame) {
VisibleSelection frameSelection = frame->selection()->selection();
Element* rootEditableElement = frameSelection.rootEditableElement();
// If a selection is in an editable element spell check its content.
if (rootEditableElement) {
VisibleSelection selection = VisibleSelection::selectionFromContentsOfNode(rootEditableElement);
frame->editor()->markMisspellingsAndBadGrammar(selection);
}
}
}
}
示例7: toggleContinuousSpellChecking
void EditorClientImpl::toggleContinuousSpellChecking()
{
if (isContinuousSpellCheckingEnabled()) {
m_spellCheckThisFieldStatus = SpellCheckForcedOff;
if (Page* page = m_webView->page()) {
for (Frame* frame = page->mainFrame(); frame && frame->document(); frame = frame->tree()->traverseNext()) {
frame->document()->markers()->removeMarkers(DocumentMarker::MisspellingMarkers());
}
}
} else {
m_spellCheckThisFieldStatus = SpellCheckForcedOn;
if (Frame* frame = m_webView->focusedWebCoreFrame()) {
VisibleSelection frameSelection = frame->selection().selection();
// If a selection is in an editable element spell check its content.
if (Element* rootEditableElement = frameSelection.rootEditableElement()) {
frame->editor().elementDidBeginEditing(rootEditableElement);
}
}
}
}