C++ (Cpp) FrameView::windowToContents Examples

C++ (Cpp) FrameView::windowToContents - 2 examples found. These are the top rated real world C++ (Cpp) examples of FrameView::windowToContents extracted from open source projects. You can rate examples to help us improve the quality of examples.
// Manual drag caret manipulation
void DragController::placeDragCaret(const IntPoint& windowPoint)
{
    mouseMovedIntoDocument(m_page->mainFrame()->documentAtPoint(windowPoint));
    if (!m_documentUnderMouse)
        return;
    Frame* frame = m_documentUnderMouse->frame();
    FrameView* frameView = frame->view();
    if (!frameView)
        return;
    IntPoint framePoint = frameView->windowToContents(windowPoint);

    m_page->dragCaretController()->setCaretPosition(frame->visiblePositionForPoint(framePoint));
}
Example #2
0
/**
 * webkit_web_inspector_inspect_coordinates:
 * @web_inspector: the #WebKitWebInspector that will do the inspection
 * @x: the X coordinate of the node to be inspected
 * @y: the Y coordinate of the node to be inspected
 *
 * Causes the Web Inspector to inspect the node that is located at the
 * given coordinates of the widget. The coordinates should be relative
 * to the #WebKitWebView widget, not to the scrollable content, and
 * may be obtained from a #GdkEvent directly.
 *
 * This means @x, and @y being zero doesn't guarantee you will hit the
 * left-most top corner of the content, since the contents may have
 * been scrolled.
 *
 * Since: 1.1.17
 */
void webkit_web_inspector_inspect_coordinates(WebKitWebInspector* webInspector, gdouble x, gdouble y)
{
    g_return_if_fail(WEBKIT_IS_WEB_INSPECTOR(webInspector));
    g_return_if_fail(x >= 0 && y >= 0);

    WebKitWebInspectorPrivate* priv = webInspector->priv;

    Frame* frame = priv->page->focusController()->focusedOrMainFrame();
    FrameView* view = frame->view();

    if (!view)
        return;

    HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active);
    IntPoint documentPoint = view->windowToContents(IntPoint(static_cast<int>(x), static_cast<int>(y)));
    HitTestResult result(documentPoint);

    frame->contentRenderer()->layer()->hitTest(request, result);
    priv->page->inspectorController()->inspect(result.innerNonSharedNode());
}