[Webkit-unassigned] [Bug 27632] Expose text segmentation through JavaScript

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Aug 20 23:02:30 PDT 2009


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





--- Comment #5 from Alexey Proskuryakov <ap at webkit.org>  2009-08-20 23:02:29 PDT ---
Bugzilla has experienced amnesia today, here is a comment that was lost:

--- Comment #5 from Xiaomei Ji <xji at chromium.org>  2009-08-20 11:30:01 PDT ---
Following spec has been proposed to both webkit-dev and public-webapps without
any further feedback.

If no object, I will go ahead to implement it in webkit.

*Syntax*: expands the range to the 'unit' boundary.
interface Range {
  void  expand(in DOMString uint)
}

*Parameters*:
unit: String that specifies the units to move in the range, using one of the
following values:
word -- expand the range to include completed words. A word is the smallest
semantic form in one language. In languages use space to break word, such as
English, a word is a collection of characters terminated by a space or
punctuation.
sentence -- expand the range to include completed sentences. A sentence is a
collection of words terminated by punctuation.
block -- expand the range to include completed paragraphs.
document -- expand the range to include the whole document.

*Use case*:
To identify a semantic unit (such as a word) when user mouse over or mouse
click on a page. A specific use case is dictionary, which shows the
worddefinition when user mouse over or mouse click in a webpage.

*Example*:
This example returns the range containing the word user moused over or mouse
clicked (not double-clicked).

var range = document.caretRangeFromPoint(event.clientX, event.clientY);
range.expand('word');

Please refer to
http://dev.w3.org/csswg/cssom-view/#dom-documentview-caretrangefrompoint for
document.caretRangeFromPoint().

*Reference*: Microsoft's  spec: 
http://msdn.microsoft.com/en-us/library/ms536421(VS.85).aspx

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