[webkit-dev] A Range question

Finnur Thorarinsson finnur at chromium.org
Fri Apr 9 11:06:23 PDT 2010


Thanks for a super quick response Darin. One followup question:

> The find code in markAllMatchesForText needs to not consider matches that
cross the boundary between the inside of an edit field and the rest of the
document.

Fair enough. I can see why it should ignore those matches, but if you look
at the details for the bug (https://bugs.webkit.org/show_bug.cgi?id=25868)
it states that the markAllMatchesForText function not only ignores the match
but it also stops looking for more matches...

I assume that's not expected?


On Fri, Apr 9, 2010 at 10:58, Darin Adler <darin at apple.com> wrote:

> On Apr 9, 2010, at 10:52 AM, Finnur Thorarinsson wrote:
>
> > I need a WebKit "Ranger" for this question:
> >
> > Imagine I have the word "Foo" inside an edit field (input type=text
> value="Foo") and the word "bar" outside of it, like so: [Foo]bar
> >
> > If I try to create a Range of the text Foobar, the range will get
> collapsed.
> >
> > It collapses because Range::setEnd has a |start| inside the shadow tree
> and an |end| outside of it. Specifically, setEnd walks up the parent chain
> for both |start| and |end| (to see if they share the same root container),
> but doesn't reach the top for |start| because while walking up the parent
> list it stops on a shadow node (TextControlInnerTextElement), which has only
> a shadow parent.
> >
> > Is this expected? Is this a bug? Is the right fix to have it walk up the
> shadow parent for shadow nodes?
> >
> > Best regards,
> > Finnur
> >
> > PS. I believe this is the root cause for
> https://bugs.webkit.org/show_bug.cgi?id=25868, which was a regression
> caused by the fix for https://bugs.webkit.org/show_bug.cgi?id=7023.
>
> It’s expected behavior.
>
> A selection needs to be either entirely inside an edit field, or outside
> the edit field. We don’t support selections that start partway through an
> edit field and then continue out to the outside document.
>
> From the DOM API’s point of view, selections inside an edit field aren’t
> really selections at all. The DOM nodes within the shadow DOM tree should
> never be exposed to JavaScript in a webpage.
>
> The find code in markAllMatchesForText needs to not consider matches that
> cross the boundary between the inside of an edit field and the rest of the
> document.
>
>    -- Darin
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20100409/cd85f1cd/attachment.html>


More information about the webkit-dev mailing list