Bug 69028 - [chromium] Add a selectionBounds() method to WebWidget.
Summary: [chromium] Add a selectionBounds() method to WebWidget.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-28 14:08 PDT by Peng Huang
Modified: 2011-10-13 09:11 PDT (History)
4 users (show)

See Also:


Attachments
Patch (7.20 KB, patch)
2011-09-28 14:13 PDT, Peng Huang
no flags Details | Formatted Diff | Diff
Patch (8.74 KB, patch)
2011-09-29 12:51 PDT, Peng Huang
no flags Details | Formatted Diff | Diff
Patch (8.69 KB, patch)
2011-10-11 11:36 PDT, Peng Huang
no flags Details | Formatted Diff | Diff
Patch (6.83 KB, patch)
2011-10-12 14:56 PDT, Peng Huang
no flags Details | Formatted Diff | Diff
Patch (6.79 KB, patch)
2011-10-12 18:06 PDT, Peng Huang
no flags Details | Formatted Diff | Diff
Patch (6.80 KB, patch)
2011-10-13 07:37 PDT, Peng Huang
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peng Huang 2011-09-28 14:08:28 PDT
Add getSubstringFromRange() and modify selectionRange() for chromium
Comment 1 Peng Huang 2011-09-28 14:13:04 PDT
Created attachment 109076 [details]
Patch
Comment 2 James Su 2011-09-29 01:59:50 PDT
I'm not authorized to add comment to the patch. Just paste my comment here:

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

And it's probably reasonable to rename WebWidget::caretOrSelectionRange() to selectionRange() to match the name of other similar methods.
I'm not qualified for reviewing the actual implementation, please find a webkit reviewer to help review that part.

> Source/WebKit/chromium/public/WebWidget.h:148
>      virtual bool getSelectionOffsetsAndTextInEditableContent(WebString&, size_t& focus, size_t& anchor) const { return false; }

Will this method be deprecated in favor of getSubstringFromRange()? If yes, then I suggest to add a comment and then remove it in an upcoming CL.

> Source/WebKit/chromium/public/WebWidget.h:155
>      virtual WebRect caretOrSelectionBounds() { return WebRect(); }

ditto.

> Source/WebKit/chromium/public/WebWidget.h:-159
> -    virtual bool selectionRange(WebPoint& start, WebPoint& end) const { return false; }

You cannot remove this method in this CL, otherwise you will break chrome code. Removing this method in an upcoming CL after landing this CL and migrating chrome to use to new methods.
So just add a comment in this CL stating that this method has been deprecated.
Comment 3 Peng Huang 2011-09-29 12:51:24 PDT
Created attachment 109191 [details]
Patch
Comment 4 Peng Huang 2011-09-29 13:10:44 PDT
Hi Darin, Could you please review this patch? Thanks.
Comment 5 Peng Huang 2011-10-11 11:36:32 PDT
Created attachment 110547 [details]
Patch
Comment 6 WebKit Review Bot 2011-10-11 11:40:16 PDT
Please wait for approval from fishd@chromium.org before submitting because this patch contains changes to the Chromium public API.
Comment 7 Darin Fisher (:fishd, Google) 2011-10-11 15:56:09 PDT
Comment on attachment 110547 [details]
Patch

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

> Source/WebKit/chromium/public/WebWidget.h:154
> +    virtual WebString getSubstringFromRange(size_t location, size_t length) const { return WebString(); }

shouldn't this just be a method on WebRange?  it seems like we should be using WebRange
for more of these range related APIs.  we should also be providing ways to get a WebRange
or construct a WebRange.
Comment 8 Darin Fisher (:fishd, Google) 2011-10-11 15:56:32 PDT
I gave similar feedback in https://bugs.webkit.org/show_bug.cgi?id=69846
Comment 9 Peng Huang 2011-10-12 10:48:43 PDT
Comment on attachment 110547 [details]
Patch

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

>> Source/WebKit/chromium/public/WebWidget.h:154
>> +    virtual WebString getSubstringFromRange(size_t location, size_t length) const { return WebString(); }
> 
> shouldn't this just be a method on WebRange?  it seems like we should be using WebRange
> for more of these range related APIs.  we should also be providing ways to get a WebRange
> or construct a WebRange.

Did you mean add a function `WebRange WebView::getRange(size_t location, size_t length)' here?
Or add a constructor WebRange::WebRange(WebFrame *frame, size_t location, size_t length).

For adding WebRange::WebRange, WebRange can not get enough information from WebFrame for creating a new WebRange. I think we need a function to convert WebFrame back to WebCore::Frame. Is it OK? What's you suggestion?
Comment 10 Peng Huang 2011-10-12 14:56:10 PDT
Created attachment 110751 [details]
Patch
Comment 11 Darin Fisher (:fishd, Google) 2011-10-12 17:48:17 PDT
Comment on attachment 110751 [details]
Patch

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

Otherwise, this patch looks fine to me.  R=me.

> Source/WebKit/chromium/src/WebViewImpl.h:123
> +    // TODO(penghuang): It has been replaced by selectionBounds. Remove it when

nit: we use FIXME in WebKit instead of TODO(user)
Comment 12 Peng Huang 2011-10-12 18:06:35 PDT
Created attachment 110784 [details]
Patch
Comment 13 Darin Fisher (:fishd, Google) 2011-10-12 22:15:24 PDT
Comment on attachment 110784 [details]
Patch

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

still R=me otherwise.

> Source/WebKit/chromium/src/WebViewImpl.cpp:1573
> +      return false;

nit: should be 4 space indent.  sorry for not catching this earlier :(
Comment 14 Peng Huang 2011-10-13 07:37:08 PDT
Created attachment 110842 [details]
Patch
Comment 15 Peng Huang 2011-10-13 07:43:48 PDT
Fixed. Sorry for the mistake.
Comment 16 WebKit Review Bot 2011-10-13 09:11:55 PDT
Comment on attachment 110842 [details]
Patch

Clearing flags on attachment: 110842

Committed r97368: <http://trac.webkit.org/changeset/97368>
Comment 17 WebKit Review Bot 2011-10-13 09:11:59 PDT
All reviewed patches have been landed.  Closing bug.