[Webkit-unassigned] [Bug 88618] [chromium] Use the marker region to replace a misspelled word with a suggestion

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jun 7 23:10:32 PDT 2012


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





--- Comment #3 from Ryosuke Niwa <rniwa at webkit.org>  2012-06-07 23:10:31 PST ---
(From update of attachment 146482)
View in context: https://bugs.webkit.org/attachment.cgi?id=146482&action=review

> Source/WebKit/chromium/src/WebFrameImpl.cpp:1363
> +    // If this caret selection has two or more markers, this function replace the range covered by the first marker with the specified word as Microsoft Word does.
> +    if (pluginContainerFromFrame(frame()))
> +        return;
> +    RefPtr<Range> caretRange = frame()->selection()->toNormalizedRange();
> +    if (!caretRange)
> +        return;
> +    Vector<DocumentMarker*> markers = frame()->document()->markers()->markersInRange(caretRange.get(), DocumentMarker::Spelling | DocumentMarker::Grammar);
> +    if (markers.size() < 1 || markers[0]->startOffset() >= markers[0]->endOffset())
> +        return;
> +    RefPtr<Range> markerRange = TextIterator::rangeFromLocationAndLength(frame()->selection()->rootEditableElementOrDocumentElement(), markers[0]->startOffset(), markers[0]->endOffset() - markers[0]->startOffset());
> +    if (!markerRange.get() || !frame()->selection()->shouldChangeSelection(markerRange.get()))
> +        return;
> +    frame()->selection()->setSelection(markerRange.get(), CharacterGranularity);
> +    frame()->editor()->replaceSelectionWithText(text, false, true);

This code looks awfully familiar. In fact, I saw almost exactly same comment elsewhere.

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