本文整理汇总了C++中webcore::Frame::selection方法的典型用法代码示例。如果您正苦于以下问题:C++ Frame::selection方法的具体用法?C++ Frame::selection怎么用?C++ Frame::selection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类webcore::Frame
的用法示例。
在下文中一共展示了Frame::selection方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: selectedRange
bool DumpRenderTreeSupportEfl::selectedRange(Evas_Object* ewkView, int* start, int* length)
{
if (!(start && length))
return false;
DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page, false);
if (!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: fromDocumentRange
// static
WebRange WebRange::fromDocumentRange(WebFrame* frame, int start, int length)
{
WebCore::Frame* webFrame = static_cast<WebFrameImpl*>(frame)->frame();
Element* selectionRoot = webFrame->selection()->rootEditableElement();
Element* scope = selectionRoot ? selectionRoot : webFrame->document()->documentElement();
return TextIterator::rangeFromLocationAndLength(scope, start, length);
}
示例3: selectionRectangle
WebCore::IntRect DumpRenderTreeSupportEfl::selectionRectangle(const Evas_Object* ewkFrame)
{
WebCore::Frame* frame = EWKPrivate::coreFrame(ewkFrame);
if (!frame)
return WebCore::IntRect();
return enclosingIntRect(frame->selection()->bounds());
}
示例4: OnKillFocus
void wxWebView::OnKillFocus(wxFocusEvent& event)
{
WebCore::Frame* frame = 0;
if (m_mainFrame)
frame = m_mainFrame->GetFrame();
if (frame) {
frame->selection()->setFocused(false);
}
event.Skip();
}
示例5: OnKillFocus
void wxWebView::OnKillFocus(wxFocusEvent& event)
{
WebCore::Frame* frame = 0;
if (m_mainFrame)
frame = m_mainFrame->GetFrame();
if (frame) {
m_impl->page->focusController()->setActive(false);
frame->selection()->setFocused(false);
}
event.Skip();
}
示例6: selectedRange
QVariantList DumpRenderTreeSupportQt::selectedRange(QWebPageAdapter *adapter)
{
WebCore::Frame* frame = adapter->page->focusController()->focusedOrMainFrame();
QVariantList selectedRange;
RefPtr<Range> range = frame->selection()->toNormalizedRange().get();
Element* selectionRoot = frame->selection()->rootEditableElement();
Element* scope = selectionRoot ? selectionRoot : frame->document()->documentElement();
RefPtr<Range> testRange = Range::create(scope->document(), scope, 0, range->startContainer(), range->startOffset());
ASSERT(testRange->startContainer() == scope);
int startPosition = TextIterator::rangeLength(testRange.get());
ExceptionCode ec;
testRange->setEnd(range->endContainer(), range->endOffset(), ec);
ASSERT(testRange->startContainer() == scope);
int endPosition = TextIterator::rangeLength(testRange.get());
selectedRange << startPosition << (endPosition - startPosition);
return selectedRange;
}
示例7: firstRectForCharacterRange
QVariantList DumpRenderTreeSupportQt::firstRectForCharacterRange(QWebPageAdapter *adapter, int location, int length)
{
WebCore::Frame* frame = adapter->page->focusController()->focusedOrMainFrame();
QVariantList rect;
if ((location + length < location) && (location + length))
length = 0;
RefPtr<Range> range = TextIterator::rangeFromLocationAndLength(frame->selection()->rootEditableElementOrDocumentElement(), location, length);
if (!range)
return QVariantList();
QRect resultRect = frame->editor()->firstRectForRange(range.get());
rect << resultRect.x() << resultRect.y() << resultRect.width() << resultRect.height();
return rect;
}
示例8: firstRectForCharacterRange
WebCore::IntRect DumpRenderTreeSupportEfl::firstRectForCharacterRange(Evas_Object* ewkView, int location, int length)
{
DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page, WebCore::IntRect());
if (!page->focusController() || !page->focusController()->focusedOrMainFrame())
return WebCore::IntRect();
if ((location + length < location) && (location + length))
length = 0;
WebCore::Frame* frame = page->focusController()->focusedOrMainFrame();
RefPtr<WebCore::Range> range = WebCore::TextIterator::rangeFromLocationAndLength(frame->selection()->rootEditableElementOrDocumentElement(), location, length);
if (!range)
return WebCore::IntRect();
return frame->editor().firstRectForRange(range.get());
}
示例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: webkit_web_view_key_press_event
static gboolean webkit_web_view_key_press_event(GtkWidget* widget, GdkEventKey* event)
{
// WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
WebCore::Frame* frame = core(webView_s)->focusController()->focusedOrMainFrame();
PlatformKeyboardEvent keyboardEvent(event);
if (frame->eventHandler()->keyEvent(keyboardEvent))
return TRUE;
FrameView* view = frame->view();
SelectionController::EAlteration alteration;
if (event->state & GDK_SHIFT_MASK)
alteration = SelectionController::EXTEND;
else
alteration = SelectionController::MOVE;
// TODO: We probably want to use GTK+ key bindings here and perhaps take an
// approach more like the Win and Mac ports for key handling.
switch (event->keyval) {
case GDK_Down:
view->scrollBy(IntSize(0, (int)Scrollbar::pixelsPerLineStep()));
return TRUE;
case GDK_Up:
view->scrollBy(IntSize(0, (int)-Scrollbar::pixelsPerLineStep()));
return TRUE;
case GDK_Right:
view->scrollBy(IntSize((int)Scrollbar::pixelsPerLineStep(), 0));
return TRUE;
case GDK_Left:
view->scrollBy(IntSize((int)-Scrollbar::pixelsPerLineStep(), 0));
return TRUE;
case GDK_Home:
frame->selection()->modify(alteration, SelectionController::BACKWARD, DocumentBoundary, true);
return TRUE;
case GDK_End:
frame->selection()->modify(alteration, SelectionController::FORWARD, DocumentBoundary, true);
return TRUE;
case GDK_Escape:
gtk_main_quit();
return true;
case GDK_F1:
webView_s->goBack();
return true;
case GDK_F2:
webView_s->goForward();
return true;
case GDK_F3:
// We ignore the return value as we are not interested
// in whether the zoom occurred.
webView_s->zoomPageIn();
return true;
case GDK_F4:
// Same comment as above.
webView_s->zoomPageOut();
return true;
}
/* Chain up to our parent class for binding activation */
return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->key_press_event(widget, event);
}