WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
224549
Move FocusRemovalEventsMode into FocusOptions
https://bugs.webkit.org/show_bug.cgi?id=224549
Summary
Move FocusRemovalEventsMode into FocusOptions
Manuel Rego Casasnovas
Reported
2021-04-14 08:23:33 PDT
Move FocusRemovalEventsMode into FocusOptions
Attachments
Patch
(15.82 KB, patch)
2021-04-14 08:25 PDT
,
Manuel Rego Casasnovas
no flags
Details
Formatted Diff
Diff
Patch
(15.89 KB, patch)
2021-04-14 13:22 PDT
,
Manuel Rego Casasnovas
no flags
Details
Formatted Diff
Diff
Patch for landing
(9.27 KB, patch)
2021-04-15 00:15 PDT
,
Manuel Rego Casasnovas
no flags
Details
Formatted Diff
Diff
Patch for landing
(9.27 KB, patch)
2021-04-15 01:34 PDT
,
Manuel Rego Casasnovas
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch for landing
(9.34 KB, patch)
2021-04-15 02:23 PDT
,
Manuel Rego Casasnovas
no flags
Details
Formatted Diff
Diff
Patch
(1.98 KB, patch)
2021-04-15 12:51 PDT
,
Manuel Rego Casasnovas
no flags
Details
Formatted Diff
Diff
Show Obsolete
(5)
View All
Add attachment
proposed patch, testcase, etc.
Manuel Rego Casasnovas
Comment 1
2021-04-14 08:25:20 PDT
Created
attachment 425984
[details]
Patch
Manuel Rego Casasnovas
Comment 2
2021-04-14 13:22:52 PDT
Created
attachment 426041
[details]
Patch
Manuel Rego Casasnovas
Comment 3
2021-04-14 13:24:06 PDT
Comment on
attachment 426041
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=426041&action=review
> Source/WebCore/dom/Document.cpp:4363 > + FocusOptions focusOptions = { }; > + focusOptions.removalEventsMode = FocusRemovalEventsMode::DoNotDispatch; > + setFocusedElement(nullptr, focusOptions);
I've initially used the following line here, but it doesn't build on Windows port due to the C++ version: setFocusedElement(nullptr, { .removalEventsMode = FocusRemovalEventsMode::DoNotDispatch });
Darin Adler
Comment 4
2021-04-14 16:00:17 PDT
Comment on
attachment 426041
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=426041&action=review
>> Source/WebCore/dom/Document.cpp:4363 >> + setFocusedElement(nullptr, focusOptions); > > I've initially used the following line here, but it doesn't build on Windows port due to the C++ version: > setFocusedElement(nullptr, { .removalEventsMode = FocusRemovalEventsMode::DoNotDispatch });
Yes, I think that might be a C++20 feature and we can’t start using those yet. But soon I hope! But maybe you could write something like this: setFocusedElement(nullptr, { { }, { }, { FocusRemovalEventsMode::DoNotDispatch }, { } }); While it’s not super-beautiful, there’s no chance of the FocusRemovalEventsMode ending up in the wrong structure element, nor of anything else being set to a non-default value.
> Source/WebCore/dom/FocusRemovalEventsMode.h:30 > +enum class FocusRemovalEventsMode { Dispatch, DoNotDispatch };
Do we really need a separate header for this? Can we just put this into FocusOptions.h and include that everywhere this is needed? I’m willing to have a separate header for a single enumeration if it’s really helpful but it would be good to avoid if possible.
Manuel Rego Casasnovas
Comment 5
2021-04-15 00:15:19 PDT
Created
attachment 426079
[details]
Patch for landing
Manuel Rego Casasnovas
Comment 6
2021-04-15 00:24:03 PDT
Thanks for the quick review. (In reply to Darin Adler from
comment #4
)
> Comment on
attachment 426041
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=426041&action=review
> > >> Source/WebCore/dom/Document.cpp:4363 > >> + setFocusedElement(nullptr, focusOptions); > > > > I've initially used the following line here, but it doesn't build on Windows port due to the C++ version: > > setFocusedElement(nullptr, { .removalEventsMode = FocusRemovalEventsMode::DoNotDispatch }); > > Yes, I think that might be a C++20 feature and we can’t start using those > yet. But soon I hope! > > But maybe you could write something like this: > > setFocusedElement(nullptr, { { }, { }, { > FocusRemovalEventsMode::DoNotDispatch }, { } }); > > While it’s not super-beautiful, there’s no chance of the > FocusRemovalEventsMode ending up in the wrong structure element, nor of > anything else being set to a non-default value.
Yeah that works, thanks for the suggestion.
> > Source/WebCore/dom/FocusRemovalEventsMode.h:30 > > +enum class FocusRemovalEventsMode { Dispatch, DoNotDispatch }; > > Do we really need a separate header for this? Can we just put this into > FocusOptions.h and include that everywhere this is needed? > > I’m willing to have a separate header for a single enumeration if it’s > really helpful but it would be good to avoid if possible.
Yeah I don't think it's needed, I've merged it into FocusOptions (I was mimicking what is done for FocusDirection, but maybe that's separated just because it's older than FocusOptions).
Manuel Rego Casasnovas
Comment 7
2021-04-15 01:34:48 PDT
Created
attachment 426081
[details]
Patch for landing
Manuel Rego Casasnovas
Comment 8
2021-04-15 02:18:51 PDT
(In reply to Manuel Rego Casasnovas from
comment #6
)
> Thanks for the quick review. > > (In reply to Darin Adler from
comment #4
) > > Comment on
attachment 426041
[details]
> > Patch > > > > View in context: > >
https://bugs.webkit.org/attachment.cgi?id=426041&action=review
> > > > >> Source/WebCore/dom/Document.cpp:4363 > > >> + setFocusedElement(nullptr, focusOptions); > > > > > > I've initially used the following line here, but it doesn't build on Windows port due to the C++ version: > > > setFocusedElement(nullptr, { .removalEventsMode = FocusRemovalEventsMode::DoNotDispatch }); > > > > Yes, I think that might be a C++20 feature and we can’t start using those > > yet. But soon I hope! > > > > But maybe you could write something like this: > > > > setFocusedElement(nullptr, { { }, { }, { > > FocusRemovalEventsMode::DoNotDispatch }, { } }); > > > > While it’s not super-beautiful, there’s no chance of the > > FocusRemovalEventsMode ending up in the wrong structure element, nor of > > anything else being set to a non-default value. > > Yeah that works, thanks for the suggestion.
Actually that only worked on Linux ports, not on Mac. So I'm coming back to the code in the first patch.
Manuel Rego Casasnovas
Comment 9
2021-04-15 02:23:46 PDT
Created
attachment 426089
[details]
Patch for landing
EWS
Comment 10
2021-04-15 04:01:33 PDT
Committed
r276016
(
236568@main
): <
https://commits.webkit.org/236568@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 426089
[details]
.
Radar WebKit Bug Importer
Comment 11
2021-04-15 04:02:34 PDT
<
rdar://problem/76695885
>
Darin Adler
Comment 12
2021-04-15 07:52:25 PDT
(In reply to Manuel Rego Casasnovas from
comment #8
)
> Actually that only worked on Linux ports, not on Mac. So I'm coming back to > the code in the first patch.
Would eventually like to know what didn’t work on Mac about this. Not important, but curious. I suppose I can try it myself.
Manuel Rego Casasnovas
Comment 13
2021-04-15 12:49:18 PDT
(In reply to Darin Adler from
comment #12
)
> (In reply to Manuel Rego Casasnovas from
comment #8
) > > Actually that only worked on Linux ports, not on Mac. So I'm coming back to > > the code in the first patch. > > Would eventually like to know what didn’t work on Mac about this. Not > important, but curious. I suppose I can try it myself.
The error was: ./dom/Document.cpp:4360:48: error: braces around scalar initializer [-Werror,-Wbraced-scalar-init] I've been now testing on a Mac machine and the problem was that I was using too many braces. This works fine on Mac: setFocusedElement(nullptr, { { }, { }, FocusRemovalEventsMode::DoNotDispatch, { } }); I'll upload a follow-up patch to change this.
Manuel Rego Casasnovas
Comment 14
2021-04-15 12:51:47 PDT
Reopening to attach new patch.
Manuel Rego Casasnovas
Comment 15
2021-04-15 12:51:53 PDT
Created
attachment 426128
[details]
Patch
EWS
Comment 16
2021-04-15 15:27:54 PDT
Committed
r276077
(
236590@main
): <
https://commits.webkit.org/236590@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 426128
[details]
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug