[Webkit-unassigned] [Bug 66681] Need API for getting surrounding text from webkit in chromium

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Sep 1 17:50:43 PDT 2011


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


Ryosuke Niwa <rniwa at webkit.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1




--- Comment #42 from Ryosuke Niwa <rniwa at webkit.org>  2011-09-01 17:50:43 PST ---
(In reply to comment #41)
> I think surroundingText is accurate even without WithSelection suffix (Without the cursor position, this text is useless. Or we need return two pieces of text. before cursor and after cursor). Maybe it is little brief, but it could be clear with a good document.

In WebKit, we avoid documentation in the favor of self-evident code. We should avoid giving a function name that requires comment or documentation to convey its purpose.

> At same time, the input methods just need a small piece of text surrounding the input cursor (The Surrounding Text concept is from qt and gtk), they do not need all content in the editable element. one paragraph is enough. Although this function returns all content in the root editable element currently, but we may optimize it to return a text in reasonable size in future.

Fair enough. But we should still emphasize the fact this function only works within an editable content.

> > > 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.
> I could put all in one line, but it will be very long.

I don't think 101 characters is considered long in WebKit's code base.

-- 
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