Bug 144342

Summary: Add support for lookup on iOS
Product: WebKit Reporter: Enrica Casucci <enrica>
Component: WebKit2Assignee: Enrica Casucci <enrica>
Status: RESOLVED FIXED    
Severity: Normal CC: bdakin, thorton
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch thorton: review+

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.