Changeset 287563 in webkit
- Timestamp:
- Jan 4, 2022 5:29:08 AM (7 months ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/selectors/focus-visible-accesskey-expected.txt (added)
-
LayoutTests/fast/selectors/focus-visible-accesskey.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/dom/Element.cpp (modified) (2 diffs)
-
Source/WebCore/dom/Element.h (modified) (1 diff)
-
Source/WebCore/dom/FocusOptions.h (modified) (1 diff)
-
Source/WebCore/html/HTMLOrForeignElement.idl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r287559 r287563 1 2022-01-04 Manuel Rego Casasnovas <rego@igalia.com> 2 3 [selectors] :focus-visible not matching on accessKey focus after focusing something via mouse 4 https://bugs.webkit.org/show_bug.cgi?id=234077 5 <rdar://problem/86572561> 6 7 Reviewed by Antti Koivisto. 8 9 Writing an internal test as WPT tests for this don't work due to webkit.org/b/234139. 10 11 * fast/selectors/focus-visible-accesskey-expected.txt: Added. 12 * fast/selectors/focus-visible-accesskey.html: Added. 13 1 14 2022-01-03 Diego Pino Garcia <dpino@igalia.com> 2 15 -
trunk/Source/WebCore/ChangeLog
r287558 r287563 1 2022-01-04 Manuel Rego Casasnovas <rego@igalia.com> 2 3 [selectors] :focus-visible not matching on accessKey focus after focusing something via mouse 4 https://bugs.webkit.org/show_bug.cgi?id=234077 5 <rdar://problem/86572561> 6 7 Reviewed by Antti Koivisto. 8 9 This patch adds Element::focusForBindings() to differentitate when this is called from JavaScript. 10 If that's the case it pass a new FocusTrigger::Bindings value to Element::focus(), 11 so we can differentiate when this was called from some internal code or from JavaScript. 12 13 When Element::focus() has been called internally, we always want to show the focus ring 14 (thus pass FocusVisibility::Visible). However when it's called from a script 15 we'll set it to Visible or Invisible depending on if the previously focused element 16 was focused via mouse click or not (this is needed to pass 17 the css/selectors/focus-visible-script-focus-* tests from WPT repository). 18 19 Test: fast/selectors/focus-visible-accesskey.html 20 21 * dom/Element.cpp: 22 (WebCore::Element::focus): 23 (WebCore::Element::focusForBindings): 24 * dom/Element.h: 25 (WebCore::Element::focusForBindings): 26 * dom/FocusOptions.h: 27 * html/HTMLOrForeignElement.idl: 28 1 29 2022-01-03 Alan Bujtas <zalan@apple.com> 2 30 -
trunk/Source/WebCore/dom/Element.cpp
r287540 r287563 3098 3098 3099 3099 FocusOptions optionsWithVisibility = options; 3100 if (!document->wasLastFocusByClick()) 3100 if (options.trigger == FocusTrigger::Bindings && document->wasLastFocusByClick()) 3101 optionsWithVisibility.visibility = FocusVisibility::Invisible; 3102 else 3101 3103 optionsWithVisibility.visibility = FocusVisibility::Visible; 3102 3104 … … 3109 3111 3110 3112 newTarget->findTargetAndUpdateFocusAppearance(options.selectionRestorationMode, options.preventScroll ? SelectionRevealMode::DoNotReveal : SelectionRevealMode::Reveal); 3113 } 3114 3115 void Element::focusForBindings(FocusOptions&& options) 3116 { 3117 options.trigger = FocusTrigger::Bindings; 3118 focus(WTFMove(options)); 3111 3119 } 3112 3120 -
trunk/Source/WebCore/dom/Element.h
r287461 r287563 427 427 static AXTextStateChangeIntent defaultFocusTextStateChangeIntent() { return AXTextStateChangeIntent(AXTextStateChangeTypeSelectionMove, AXTextSelection { AXTextSelectionDirectionDiscontiguous, AXTextSelectionGranularityUnknown, true }); } 428 428 virtual void focus(const FocusOptions& = { }); 429 virtual void focusForBindings(FocusOptions&&); 429 430 void findTargetAndUpdateFocusAppearance(SelectionRestorationMode, SelectionRevealMode = SelectionRevealMode::Reveal); 430 431 virtual RefPtr<Element> focusAppearanceUpdateTarget(); -
trunk/Source/WebCore/dom/FocusOptions.h
r276628 r287563 33 33 enum class FocusRemovalEventsMode : bool { Dispatch, DoNotDispatch }; 34 34 35 enum class FocusTrigger : bool { Other, Click};35 enum class FocusTrigger : uint8_t { Other, Click, Bindings }; 36 36 37 37 enum class FocusVisibility : bool { Invisible, Visible }; -
trunk/Source/WebCore/html/HTMLOrForeignElement.idl
r285478 r287563 33 33 [CEReactions=NotNeeded, Reflect] attribute boolean autofocus; 34 34 [CEReactions, ImplementedAs=tabIndexForBindings] attribute long tabIndex; 35 undefined focus(optional FocusOptions options);35 [ImplementedAs=focusForBindings] undefined focus(optional FocusOptions options); 36 36 undefined blur(); 37 37 };
Note: See TracChangeset
for help on using the changeset viewer.