本文整理汇总了C++中webcore::Page::focusController方法的典型用法代码示例。如果您正苦于以下问题:C++ Page::focusController方法的具体用法?C++ Page::focusController怎么用?C++ Page::focusController使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类webcore::Page
的用法示例。
在下文中一共展示了Page::focusController方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: selectedRange
bool DumpRenderTreeSupportEfl::selectedRange(Evas_Object* ewkView, int* start, int* length)
{
if (!(start && length))
return false;
WebCore::Page* page = EWKPrivate::corePage(ewkView);
if (!page || !page->focusController() || !page->focusController()->focusedOrMainFrame())
return false;
WebCore::Frame* frame = page->focusController()->focusedOrMainFrame();
RefPtr<WebCore::Range> range = frame->selection()->toNormalizedRange().get();
if (!range)
return false;
WebCore::Element* selectionRoot = frame->selection()->rootEditableElement();
WebCore::Element* scope = selectionRoot ? selectionRoot : frame->document()->documentElement();
RefPtr<WebCore::Range> testRange = WebCore::Range::create(scope->document(), scope, 0, range->startContainer(), range->startOffset());
*start = WebCore::TextIterator::rangeLength(testRange.get());
WebCore::ExceptionCode ec;
testRange->setEnd(range->endContainer(), range->endOffset(), ec);
*length = WebCore::TextIterator::rangeLength(testRange.get());
return true;
}
示例2: clearClipboardContentsCallback
static void clearClipboardContentsCallback(GtkClipboard* clipboard, gpointer data)
{
DataObjectGtk* dataObject = DataObjectGtk::forClipboard(clipboard);
ASSERT(dataObject);
// Only clear the DataObject for this clipboard if we are not currently setting it.
if (dataObject != settingClipboardDataObject)
dataObject->clear();
// Only collapse the selection if this is an X11 primary clipboard
// and we aren't currently setting the clipboard for this WebView.
if (!data || data == settingClipboardData)
return;
WebKitWebView* webView = reinterpret_cast<WebKitWebView*>(data);
WebCore::Page* corePage = core(webView);
if (!corePage || !corePage->focusController()) {
g_object_unref(webView);
return;
}
Frame* frame = corePage->focusController()->focusedOrMainFrame();
// Collapse the selection without clearing it
ASSERT(frame);
frame->selection()->setBase(frame->selection()->extent(), frame->selection()->affinity());
g_object_unref(webView);
}
示例3: collapseSelection
static void collapseSelection(GtkClipboard* clipboard, WebKitWebView* webView)
{
if (viewSettingClipboard && viewSettingClipboard == webView)
return;
WebCore::Page* corePage = core(webView);
if (!corePage || !corePage->focusController())
return;
Frame* frame = corePage->focusController()->focusedOrMainFrame();
// Collapse the selection without clearing it
ASSERT(frame);
frame->selection()->setBase(frame->selection()->extent(), frame->selection()->affinity());
}
示例4: setComposition
void DumpRenderTreeSupportEfl::setComposition(Evas_Object* ewkView, const char* text, int start, int length)
{
WebCore::Page* page = EWKPrivate::corePage(ewkView);
if (!page || !page->focusController() || !page->focusController()->focusedOrMainFrame())
return;
WebCore::Editor* editor = page->focusController()->focusedOrMainFrame()->editor();
if (!editor || (!editor->canEdit() && !editor->hasComposition()))
return;
const String compositionString = String::fromUTF8(text);
Vector<WebCore::CompositionUnderline> underlines;
underlines.append(WebCore::CompositionUnderline(0, compositionString.length(), WebCore::Color(0, 0, 0), false));
editor->setComposition(compositionString, underlines, start, start + length);
}
示例5: respondToChangedSelection
void EditorClient::respondToChangedSelection()
{
g_signal_emit_by_name(m_webView, "selection-changed");
WebKitWebViewPrivate* priv = m_webView->priv;
WebCore::Page* corePage = core(m_webView);
Frame* targetFrame = corePage->focusController()->focusedOrMainFrame();
if (!targetFrame)
return;
if (targetFrame->editor()->ignoreCompositionSelectionChange())
return;
#if PLATFORM(X11)
setSelectionPrimaryClipboardIfNeeded(m_webView);
#endif
if (!targetFrame->editor()->hasComposition())
return;
unsigned start;
unsigned end;
if (!targetFrame->editor()->getCompositionSelection(start, end)) {
// gtk_im_context_reset() clears the composition for us.
gtk_im_context_reset(priv->imContext.get());
targetFrame->editor()->cancelComposition();
}
}
示例6: compositionRange
bool DumpRenderTreeSupportEfl::compositionRange(Evas_Object* ewkView, int* start, int* length)
{
*start = *length = 0;
WebCore::Page* page = EWKPrivate::corePage(ewkView);
if (!page || !page->focusController() || !page->focusController()->focusedOrMainFrame())
return false;
WebCore::Editor* editor = page->focusController()->focusedOrMainFrame()->editor();
if (!editor || !editor->hasComposition())
return false;
*start = editor->compositionStart();
*length = editor->compositionEnd() - *start;
return true;
}
示例7: isCommandEnabled
bool DumpRenderTreeSupportEfl::isCommandEnabled(const Evas_Object* ewkView, const char* name)
{
WebCore::Page* page = EWKPrivate::corePage(ewkView);
if (!page)
return false;
return page->focusController()->focusedOrMainFrame()->editor()->command(name).isEnabled();
}
示例8: executeCoreCommandByName
void DumpRenderTreeSupportEfl::executeCoreCommandByName(const Evas_Object* ewkView, const char* name, const char* value)
{
WebCore::Page* page = EWKPrivate::corePage(ewkView);
if (!page)
return;
page->focusController()->focusedOrMainFrame()->editor()->command(name).execute(value);
}
示例9: firstRectForCharacterRange
WebCore::IntRect DumpRenderTreeSupportEfl::firstRectForCharacterRange(Evas_Object* ewkView, int location, int length)
{
WebCore::Page* page = EWKPrivate::corePage(ewkView);
if (!page || !page->focusController() || !page->focusController()->focusedOrMainFrame() || !page->focusController()->focusedOrMainFrame()->editor())
return WebCore::IntRect();
if ((location + length < location) && (location + length))
length = 0;
WebCore::Frame* frame = page->focusController()->focusedOrMainFrame();
WebCore::Editor* editor = frame->editor();
RefPtr<WebCore::Range> range = WebCore::TextIterator::rangeFromLocationAndLength(frame->selection()->rootEditableElementOrDocumentElement(), location, length);
if (!range)
return WebCore::IntRect();
return editor->firstRectForRange(range.get());
}
示例10: confirmComposition
void DumpRenderTreeSupportEfl::confirmComposition(Evas_Object* ewkView, const char* text)
{
WebCore::Page* page = EWKPrivate::corePage(ewkView);
if (!page || !page->focusController() || !page->focusController()->focusedOrMainFrame())
return;
WebCore::Editor* editor = page->focusController()->focusedOrMainFrame()->editor();
if (!editor)
return;
if (!editor->hasComposition()) {
editor->insertText(String::fromUTF8(text), 0);
return;
}
if (text) {
editor->confirmComposition(String::fromUTF8(text));
return;
}
editor->confirmComposition();
}
示例11: collapseSelection
static void collapseSelection(GtkClipboard* clipboard, WebKitWebView* webView)
{
if (viewSettingClipboard && viewSettingClipboard == webView)
return;
WebCore::Page* corePage = core(webView);
if (!corePage)
return;
Frame& frame = corePage->focusController().focusedOrMainFrame();
// Collapse the selection without clearing it
const VisibleSelection& selection = frame.selection().selection();
frame.selection().setBase(selection.extent(), selection.affinity());
}
示例12: setSelectionPrimaryClipboardIfNeeded
static void setSelectionPrimaryClipboardIfNeeded(WebKitWebView* webView)
{
if (!gtk_widget_has_screen(GTK_WIDGET(webView)))
return;
GtkClipboard* clipboard = gtk_widget_get_clipboard(GTK_WIDGET(webView), GDK_SELECTION_PRIMARY);
DataObjectGtk* dataObject = DataObjectGtk::forClipboard(clipboard);
WebCore::Page* corePage = core(webView);
Frame* targetFrame = corePage->focusController()->focusedOrMainFrame();
if (!targetFrame->selection()->isRange())
return;
dataObject->clear();
dataObject->setRange(targetFrame->selection()->toNormalizedRange());
viewSettingClipboard = webView;
GClosure* callback = g_cclosure_new_object(G_CALLBACK(collapseSelection), G_OBJECT(webView));
g_closure_set_marshal(callback, g_cclosure_marshal_VOID__VOID);
PasteboardHelper::defaultPasteboardHelper()->writeClipboardContents(clipboard, PasteboardHelper::DoNotIncludeSmartPaste, callback);
viewSettingClipboard = 0;
}