[webkit-reviews] review denied: [Bug 66681] Need API for getting surrounding text from webkit in chromium : [Attachment 106061] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Sep 1 16:41:18 PDT 2011


Ryosuke Niwa <rniwa at webkit.org> has denied Peng Huang
<penghuang at chromium.org>'s request for review:
Bug 66681: Need API for getting surrounding text from webkit in chromium
https://bugs.webkit.org/show_bug.cgi?id=66681

Attachment 106061: Patch
https://bugs.webkit.org/attachment.cgi?id=106061&action=review

------- Additional Comments from Ryosuke Niwa <rniwa at webkit.org>
View in context: https://bugs.webkit.org/attachment.cgi?id=106061&action=review


> Source/WebKit/chromium/ChangeLog:8
> +	   Add surroundingTextWithSelection() to Chromium's WebViewImpl

This doesn't explain anything about the function.  In fact, I can see that from
the code change.  What I'd like to know instead is why we're adding this
function and why it has this particular interface, etc...

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

I don't think "surroundingText" is a good name here because what it surrounds
is ambiguous. Maybe getSelectionOffsetsAndTextInEditableElement?

> Source/WebKit/chromium/src/WebViewImpl.cpp:1512
> +bool WebViewImpl::surroundingTextWithSelection(
> +    WebString& text, size_t& focus, size_t& anchor) const

Nit: I would put all in one line.

> Source/WebKit/chromium/src/WebViewImpl.cpp:1523
> +    text = element->innerText();

It seems odd that we'll obtain text even when selection range is 0 or
locationAndLengthFromRange returns false.
Since innerText is a pretty expensive operation, we should probably move this
below that return statement.


More information about the webkit-reviews mailing list