[Webkit-unassigned] [Bug 54633] [Gtk] webkit_web_view_popup_menu_handler should call SelectionController::localCaretRect

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Mar 1 21:24:48 PST 2011


https://bugs.webkit.org/show_bug.cgi?id=54633


Ryosuke Niwa <rniwa at webkit.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #82842|review?                     |review-
               Flag|                            |




--- Comment #4 from Ryosuke Niwa <rniwa at webkit.org>  2011-03-01 21:24:48 PST ---
(From update of attachment 82842)
View in context: https://bugs.webkit.org/attachment.cgi?id=82842&action=review

> Source/WebKit/gtk/webkit/webkitwebview.cpp:387
> +    if (!selection->start().node() || !selection->end().node()

You must be using an old checkout.  Position::node() no longer exists.  What you want to do here is probably selection->selection()->isNonOrphanedCaretOrRange() since when start() or end() is orphaned, meaning that they're detached from the document, it doesn't make sense to query the firstRectForRange on that selection.

> Source/WebKit/gtk/webkit/webkitwebview.cpp:397
> +    IntRect firstRect = frame->editor()->firstRectForRange(selection->selection().firstRange().get());

firstRange() will return 0 if selection->isNone().  You probably need to check this condition above as well (fortunately, if isNonOrphanedCaretOrRange returns true, then isNone is false so the suggested change above will fix this as well).

> Source/WebKit/gtk/webkit/webkitwebview.cpp:417
> -    location = view->contentsToWindow(location) + IntSize(0, -1);
> -    if (location.y() < 0)
> -        location.setY(contextMenuMargin);
> -    else if (location.y() > view->height())
> -        location.setY(view->height() - contextMenuMargin);
> -    if (location.x() < 0)
> -        location.setX(contextMenuMargin);
> -    else if (location.x() > view->width())
> -        location.setX(view->width() - contextMenuMargin);
> -    IntPoint global(globalPointForClientPoint(gtk_widget_get_window(widget), location));
> -
> -    PlatformMouseEvent event(location, global, RightButton, MouseEventPressed, 0, false, false, false, false, gtk_get_current_event_time());
> +        return FALSE;
>  
> +    // Never let the context menu abut very edge of the view.
> +    location = view->contentsToWindow(location);
> +    location.setY(max(gContextMenuMargin, location.y()));
> +    location.setY(min(view->height() - gContextMenuMargin, location.y()));
> +    location.setX(max(gContextMenuMargin, location.x()));
> +    location.setX(min(view->width() - gContextMenuMargin, location.x()));
> +    IntPoint globalPoint(globalPointForClientPoint(gtk_widget_get_window(widget), location));
> +    PlatformMouseEvent event(location, globalPoint, RightButton, MouseEventPressed, 0, false, false, false, false, gtk_get_current_event_time());

I can't review these changes.  Xan or someone else should do.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list