[webkit-dev] CSS Regions and multi-range Selection

Javier Fernandez jfernandez at igalia.com
Thu Jul 25 02:07:21 PDT 2013


hi,

During the last Contributors Meeting there was a discussion about how to
improve the Selection when using CSS Regions. These are some of the
conclusions got at that meeting:

* multi-range selection would help with this.
* come up with a better way to do selection that would allow a
single-range selection to select through regions.
* It's hard because of the difference in order between what is displayed
and what is in the DOM.
* one option could be like the way selection works with iframes, where
if you select inside the regions, the selection cannot go to the outside
of the region.
* this could be very surprising, since people don't think of regions
like iframes, might want to select the region content as well as an
image next to it, for example.
* suggestion of a different mode for selection that would be render tree
based.

I've been investigating how the Selection works with Regions now and
trying different approaches (see bug 106817 for details), but the most
promising one was based on multi-range Selection, which was discarded
because of WebKit not interested in multi-range support.

In order to simplify things I've followed the Iframe
approach, considering Regions in the same FlowThread as content not
directly related to other FlowThreads or outside Regions. However that's
not always the case, so the final goal would be to allow the user to
select content from both, inside and outside Regions.

Besides, even that the mentioned solution uses the rangeCount and
getRangeAt APIs, there is no actual multi-range selection but a way to
get the Selection content skipping some DOM nodes not directly related
to the content the user selected (this would solve the issues related to
the differences between DOM and Render trees). The key idea is that the
VisibleSelection class, besides providing start/end Positions to define
the selection boundaries, it provides a set of intermediate points to
consider the Region boundaries as well.

Even though allowing user gestures to select multiple regions would fit
better with CSS Regions usability, I think it's not a problem to make
the selection working properly with Regions. However, just using
multiple ranges to define more complex and richer selections it's a
different concept, in my opinion. Would it be a valid approach ?

I would like to start a discussion to evaluate different alternatives to
improve the Selection with CSS Regions.

BR.

--
Javi



More information about the webkit-dev mailing list