⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 295179 in webkit


Ignore:
Timestamp:
Jun 2, 2022, 11:45:17 PM (4 years ago)
Author:
Alan Coon
Message:

Cherry-pick 07c0107aa7af. rdar://problem/92301472

[selectors] Double script focus after mouse click shouldn't match :focus-visible
​https://bugs.webkit.org/show_bug.cgi?id=239472
<rdar://problem/92301472>

Reviewed by Antti Koivisto.

LayoutTests/imported/w3c:

  • web-platform-tests/css/selectors/focus-visible-script-focus-020-expected.txt: Added.
  • web-platform-tests/css/selectors/focus-visible-script-focus-020.html: Added.

Source/WebCore:

When you do the second script focus, we were setting
m_latestFocusTrigger to FocusTrigger::Bindings, that makes us lose the
information about the previous element that was focused via mouse
click and start matching :focus-visible on that case.

Test: imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-020.html

  • dom/Document.cpp: (WebCore::Document::setFocusedElement): We avoid setting m_latestFocusTrigger if we come from script focus. That way we know if the previous focused element was focused via mouse click after several script focus.

Canonical link: ​https://commits.webkit.org/250373@main
git-svn-id: ​https://svn.webkit.org/repository/webkit/trunk@293926 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Location:
branches/safari-613-branch
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-613-branch/LayoutTests/imported/w3c/ChangeLog

    r294305 r295179  
     12022-05-06  Manuel Rego Casasnovas  <rego@igalia.com>
     2
     3        [selectors] Double script focus after mouse click shouldn't match :focus-visible
     4        https://bugs.webkit.org/show_bug.cgi?id=239472
     5        <rdar://problem/92301472>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        * web-platform-tests/css/selectors/focus-visible-script-focus-020-expected.txt: Added.
     10        * web-platform-tests/css/selectors/focus-visible-script-focus-020.html: Added.
     11
    1122022-05-16  Alan Coon  <alancoon@apple.com>
    213
  • branches/safari-613-branch/Source/WebCore/ChangeLog

    r294850 r295179  
     12022-05-06  Manuel Rego Casasnovas  <rego@igalia.com>
     2
     3        [selectors] Double script focus after mouse click shouldn't match :focus-visible
     4        https://bugs.webkit.org/show_bug.cgi?id=239472
     5        <rdar://problem/92301472>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        When you do the second script focus, we were setting
     10        m_latestFocusTrigger to FocusTrigger::Bindings, that makes us lose the
     11        information about the previous element that was focused via mouse
     12        click and start matching :focus-visible on that case.
     13
     14        Test: imported/w3c/web-platform-tests/css/selectors/focus-visible-script-focus-020.html
     15
     16        * dom/Document.cpp:
     17        (WebCore::Document::setFocusedElement): We avoid setting
     18        m_latestFocusTrigger if we come from script focus. That way we know if
     19        the previous focused element was focused via mouse click after several
     20        script focus.
     21
    1222022-05-25  Alan Coon  <alancoon@apple.com>
    223
  • branches/safari-613-branch/Source/WebCore/dom/Document.cpp

    r295106 r295179  
    46724672        setFocusNavigationStartingNode(m_focusedElement.get());
    46734673        m_focusedElement->setFocus(true, options.visibility);
    4674         m_latestFocusTrigger = options.trigger;
     4674        if (options.trigger != FocusTrigger::Bindings)
     4675            m_latestFocusTrigger = options.trigger;
    46754676
    46764677        // The setFocus call triggers a blur and a focus event. Event handlers could cause the focused element to be cleared.
Note: See TracChangeset for help on using the changeset viewer.