Bug 144342 - Add support for lookup on iOS
Summary: Add support for lookup on iOS
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Enrica Casucci
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-28 11:21 PDT by Enrica Casucci
Modified: 2015-04-28 13:19 PDT (History)
2 users (show)

See Also:


Attachments
Patch (8.04 KB, patch)
2015-04-28 11:31 PDT, Enrica Casucci
thorton: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Enrica Casucci 2015-04-28 11:21:26 PDT
This tracks the work required to support lookup in WK2 on iOS.

rdar://problem/19994090
Comment 1 Enrica Casucci 2015-04-28 11:31:47 PDT
Created attachment 251870 [details]
Patch
Comment 2 Tim Horton 2015-04-28 11:39:12 PDT
Comment on attachment 251870 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=251870&action=review

> Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm:1309
> +        CGRect presentationRect = view->_page->editorState().selectionIsRange ? view->_page->editorState().postLayoutData().selectionRects[0].rect() : view->_page->editorState().postLayoutData().caretRectAtStart;

Why do we only use the first rect? What happens if you have a multi-line selection?
Comment 3 Enrica Casucci 2015-04-28 13:08:47 PDT
(In reply to comment #2)
> Comment on attachment 251870 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=251870&action=review
> 
> > Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm:1309
> > +        CGRect presentationRect = view->_page->editorState().selectionIsRange ? view->_page->editorState().postLayoutData().selectionRects[0].rect() : view->_page->editorState().postLayoutData().caretRectAtStart;
> 
> Why do we only use the first rect? What happens if you have a multi-line
> selection?

We could in theory compute the union of the rects, but this is used only to position the popover. I don't have clear indication of what is expected here and I think this is  good enough to start.
Comment 4 Enrica Casucci 2015-04-28 13:19:59 PDT
Committed revision 183503.