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

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Aug 23 08:33:44 PDT 2011


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


Ryosuke Niwa <rniwa at webkit.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #104692|review?                     |review-
               Flag|                            |




--- Comment #4 from Ryosuke Niwa <rniwa at webkit.org>  2011-08-23 08:33:44 PST ---
(From update of attachment 104692)
View in context: https://bugs.webkit.org/attachment.cgi?id=104692&action=review

>> Source/WebKit/chromium/public/WebWidget.h:154
>> +    virtual bool surrounding(WebString& text, size_t& cursor, size_t& anchor) { return false; }
> 
> You can return WebSize. See (Source/WebKit/public/WebSize.h)

The standard term used is focus and anchor.  "cursor" usually refers to mouse cursor, and it's confusing.  Alos, Why isn't this function const?  Also the last time I checked, Chromium's coding style guide forbid mutable reference and instead forces pass by pointer.

> Source/WebKit/chromium/src/WebViewImpl.cpp:1530
> +    Element* scope = selectionRoot ? selectionRoot : frame->document()->documentElement();

Wait a minute, if rootEditableElement can be null, then element->innerText() would have blown up by null-pointer access, no?  r- because of this.

Also, this line appears to be much longer than 80 characters, yet chromium coding guideline mandates the column length to be at most 80 characters.

> Source/WebKit/chromium/src/WebViewImpl.cpp:1539
> +    anchor = TextIterator::rangeLength(testRange.get());
> +
> +    ExceptionCode ec;
> +    testRange->setEnd(selection->extent().containerNode(), selection->extent().offsetInContainerNode(), ec);
> +    cursor = TextIterator::rangeLength(testRange.get());

You should call TextIterator::locationAndLengthFromRange instead.

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