[Webkit-unassigned] [Bug 61532] A focusedNode should be kept in each TreeScope, not in each Document.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jun 7 23:15:26 PDT 2011


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





--- Comment #4 from Roland Steiner <rolandsteiner at chromium.org>  2011-06-07 23:15:26 PST ---
(In reply to comment #1)
> When a node B is focused, the following things will happen:
>  - focusController::focusedFrame -> A
>  - outerDocument::focusedNode() -> 0 (Hmm.. I'd like to change this behavior. If that were A, some things would get simpler..?)
>  - innerDocument::focusedNode() -> B
>  - outerDocument.activeElement -> A
>  - innerDocument.activeElement -> B

This seems to be correct to me. The focused node is not in outerDocument, so outerDocument::focusedNode() can only be 0 (the <iframe> isn't what is focused, after all).

(In reply to comment #3)
>   - shadow-host - A
>      - shadow-host - B
>         - iframe - C
>            - shadow-host - D
>                 <input> E ---> focused

All in all, from the discussion it seems to me, that the question rather is how should 'activeElement' behave, rather than focusedNode (?).

One possibility could be to have a separate TreeScope.activeElement: a TreeScope's activeElement could point to the deepest ancestor node of the focused node that is still in the same TreeScope, while a Document's activeElement is the deepest ancestor node of the focused node that is still in the same document. (where ancestors cross document boundaries). However, this would require a distinction between 'Document-as-TreeScope' and 'Document-as-Document'.

> > Another question: What happens when you have this?
> > 
> > Document
> >   - <shadow-host> <--- A
> >     … shadow-root
> >       - <content>
> >     - <input> <--- B
> > 
> > Say node B has focus. Is the activeElement of the document A or B?
> 
> Interesting. In this case, document.activeElement should be 'A' for me at the first glance.
> But we should discuss which is better and natural.

(Assuming B is a child of the shadow host) IMHO this can only be 'B' as otherwise activeElement would require rendering knowledge.

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