[Webkit-unassigned] [Bug 242526] :focus-within pseudo class doesn't get invalidated when frame loses focus

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jul 8 23:53:21 PDT 2022


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

--- Comment #2 from Ryosuke Niwa <rniwa at webkit.org> ---
So :focus, :focus-within, :focus-visible all depend on FrameSelection::isFocusedAndActive() via isFrameFocused in SelectorCheckerTestFunctions.h

FrameSelection::isFocusedAndActive() in turn is defined in terms of two boolean states: FrameSelection::m_focused and FocusController::isActive().

FocusController calls FrameSelection::pageActivationChanged() whenever isActive state changes on the focused frame's FrameSelection.

In the ideal world, we have a single place where these two boolean states are updated at once, and that's where we instantiate relevant Style::PseudoClassChangeInvalidation but that's tricky because FocusController is a per-Page concept and FrameSelection is per-Frame concept.

To reconcile, I could imagine a few solutions:
1. Add a new boolean m_isPageActive to FrameSelection which gets sync'ed when FrameSelection becomes newly focused (inside FrameSelection::setFocused). We then update both m_focused & this new boolean whilst we have Style::PseudoClassChangeInvalidation.

2. In FrameSelection::focusedOrActiveStateChanged(), introduce a temporary override for FrameSelection::isFocusedAndActive(), which makes the function return the negative value while Style::PseudoClassChangeInvalidation are instantiated.

3. Simply use Element::invalidateStyle() on these elements for now. This will only occur when WKWebView becomes first responder or resigns first responder (i.e. view gets focused or unfocused in more Web / Windows terminology).

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20220709/d080a669/attachment.htm>


More information about the webkit-unassigned mailing list