Re: [whatwg] Request for implementer feedback: multiple Ranges per Selection

2011-01-28 Thread Boris Zbarsky

On 1/28/11 10:59 AM, Aryeh Gregor wrote:

1) Are there real-world use-cases for multiple Ranges per Selection,
or was it just an attempt to be as general as possible?


In Gecko you can select table cells in a table.  For example, load this 
document:


  data:text/html,tabletrtd1td2trtd3td4

then accel-click (Cmd-click on mac, Ctrl-click on Windows/Linux) the 1, 
then the 4.  That this point the selection cannot be represented as a 
single range.


You can also create multi-range selections in Gecko outside of tables. 
For example, load this document:


  data:text/html,1234567890

Click to the left of the 1 and drag right to between the 2 and the 3. 
Then release the mouse, accel-click between the 6 and the 7 and drag to 
between the 8 and the 9.  Again, you have a 2-range selection.


So to represent selections that users can make, you have to allow 
multiple ranges in a Selection object.



4) Assuming that the answers to the last two questions are no, would
Gecko be willing to drop support for multiple Ranges per Selection?


The only ways we could do that would be to break user-facing selection 
behavior in our browser (which is obviously undesirable) or to make the 
DOM Selection object not actually reflect the state of the selection 
(again, seems undesirable).  We might be willing to do the latter if it 
were really necessary, but that would significantly reduce the 
usefulness of the Selection API to developers, I think.


On the other hand, multi-range selections can be very useful for 
scripting (e.g. Gecko actually uses them to implement spellcheck 
underlining, search result highlighting, and so forth).  So it seems to 
me that a better direction is to allow multi-range selection in UAs in 
general.


-Boris


Re: [whatwg] Request for implementer feedback: multiple Ranges per Selection

2011-01-28 Thread Ryosuke Niwa
On Fri, Jan 28, 2011 at 7:59 AM, Aryeh Gregor
simetrical+...@gmail.comsimetrical%2b...@gmail.com
 wrote:

 2) Have WebKit or Opera run into any websites that depend on being
 able to use multiple Ranges per Selection?


As far as I know, there is no bug filed against this, which seems to imply
that we haven't had significant issues.

3) Are WebKit or Opera planning to add support for multiple Ranges per
 Selection?  (I'd be interested in IE too, clearly, but they don't read
 this list.)


Not anytime soon as far as I'm concerned. We do have a comment in the code
indicating there had been a plan, but I don't think anyone is actively
working on it.  Because we haven't had much complaints from users and
developers and supporting it requires so much work, I personally think it's
not worth the effort.

- Ryosuke


Re: [whatwg] Request for implementer feedback: multiple Ranges per Selection

2011-01-28 Thread Tim Down
On 28 January 2011 16:53, Ryosuke Niwa rn...@webkit.org wrote:
 On Fri, Jan 28, 2011 at 7:59 AM, Aryeh Gregor
 simetrical+...@gmail.comsimetrical%2b...@gmail.com
 wrote:

 2) Have WebKit or Opera run into any websites that depend on being
 able to use multiple Ranges per Selection?


 As far as I know, there is no bug filed against this, which seems to imply
 that we haven't had significant issues.

 3) Are WebKit or Opera planning to add support for multiple Ranges per
 Selection?  (I'd be interested in IE too, clearly, but they don't read
 this list.)


 Not anytime soon as far as I'm concerned. We do have a comment in the code
 indicating there had been a plan, but I don't think anyone is actively
 working on it.  Because we haven't had much complaints from users and
 developers and supporting it requires so much work, I personally think it's
 not worth the effort.

At the risk of misusing this platform, I would venture that WebKit has
more pressing issues with Selections (for example, not being able to
place the caret at the start of a text node).

Tim


Re: [whatwg] Request for implementer feedback: multiple Ranges per Selection

2011-01-28 Thread Ryosuke Niwa
On Fri, Jan 28, 2011 at 9:05 AM, Tim Down timd...@gmail.com wrote:

   Not anytime soon as far as I'm concerned. We do have a comment in the
 code
  indicating there had been a plan, but I don't think anyone is actively
  working on it.  Because we haven't had much complaints from users and
  developers and supporting it requires so much work, I personally think
 it's
  not worth the effort.

 At the risk of misusing this platform, I would venture that WebKit has
 more pressing issues with Selections (for example, not being able to
 place the caret at the start of a text node).


Yes, and that seems to have a higher priority than multi-range support.

- Ryosuke


Re: [whatwg] Request for implementer feedback: multiple Ranges per Selection

2011-01-28 Thread Glenn Maynard
On Fri, Jan 28, 2011 at 10:59 AM, Aryeh Gregor
simetrical+...@gmail.comsimetrical%2b...@gmail.com
 wrote:

 1) Are there real-world use-cases for multiple Ranges per Selection,
 or was it just an attempt to be as general as possible?

 2) Have WebKit or Opera run into any websites that depend on being
 able to use multiple Ranges per Selection?


For what it's worth, the only thing I've noticed this used for is hijacking
copy events and adding ads to copied text (by appending a hidden div to the
selection), which is infuriating.  Unfortunately, methods of doing this
without ranges do exist; this just makes it easier...

-- 
Glenn Maynard