Commit Graph

202 Commits

Author SHA1 Message Date
Masayuki Nakano
f3bcf4c6d1 Bug 1547418 - Make CapturingContentInfo a private struct of PresShell and move APIs for it from nsIPresShell to PresShell r=smaug
`CapturingContentInfo` struct is used only in `PresShell.cpp` so that we can
make it a private struct of `PresShell` if we move all users of them,
i.e., API to access them, from `nsIPresShell` to `PresShell`.

Differential Revision: https://phabricator.services.mozilla.com/D29111

--HG--
extra : moz-landing-system : lando
2019-04-30 00:26:57 +00:00
Botond Ballo
32567fa488 Bug 1529892 - Move the clearing of a pending visual scroll update to the end of the paint. r=kats
The fixes a latent bug with WebRender where we would clear it after reading it
in ComputeScrollMetadata, but WR would sometimes call ComputeScrollMetadata a
second time for the same scroll frame in the same transaction, resulting in
the update sometimes not making it into the transaction.

Differential Revision: https://phabricator.services.mozilla.com/D28776

--HG--
extra : moz-landing-system : lando
2019-04-26 05:14:00 +00:00
Emilio Cobos Álvarez
1c3126eaaa Bug 1545699 - Track editor stylesheets better. r=masayuki
Replacing the whole set of user-agent stylesheets seems a bit overkill.

Differential Revision: https://phabricator.services.mozilla.com/D28212
2019-04-25 14:00:01 +02:00
Masayuki Nakano
2933c032e7 Bug 1545342 - part 3: Move remaining public enum of nsIPresShell to mozilla namespace in mozilla/PresShellForwards.h and make them enum class r=smaug
This patch moves remaining public `enum` of `nsIPresShell` to `mozilla`
namespace in `mozilla/PresShellForwards.h` and make them `enum class`es.

Additionally, some methods which use the moving `enum`s from `nsIPresShell`
to `PresShell`.

Differential Revision: https://phabricator.services.mozilla.com/D28607

--HG--
extra : moz-landing-system : lando
2019-04-25 05:04:23 +00:00
Masayuki Nakano
3622509485 Bug 1545342 - part 2: Make some public enum of nsIPresShell move to mozilla namespace and defined as enum class in PresShellForwards.h r=smaug
This patch moves some `enum` in `nsIPresShell` which are in public scope into
`mozilla` namespace and change them as `enum class`es.

Unfortunately, only "where to scroll" enum is just defines constants of
percentages of scroll destination.  Therefore, this patch makes only them
as `static const`.

Differential Revision: https://phabricator.services.mozilla.com/D28606

--HG--
extra : moz-landing-system : lando
2019-04-25 05:04:15 +00:00
Masayuki Nakano
5932f01d53 Bug 1545342 - part 1: Create mozilla/PresShellForwards.h and move global enums/constants in nsIPresShell.h and mozilla/PresShell.h into the new one r=smaug
This patch creates new header, `mozilla/PresShellForwards.h`.  It should have
all forward declarations of global class/struct in `nsIPresShell.h` and
`mozilla/PresShell.h`.

Additionally, this moves all `enum`s and `constant`s in them into the new file
with changing them to `enum class`es.

This will make other headers which require only specific types in the header
files not include them.

Differential Revision: https://phabricator.services.mozilla.com/D28605

--HG--
extra : moz-landing-system : lando
2019-04-25 05:02:20 +00:00
Masayuki Nakano
530d2600c3 Bug 1543315 - part 12: Mark nsIPresShell::DoScrollContentIntoView() as MOZ_CAN_RUN_SCRIPT r=smaug
Now, we can mark `DoScrollContentIntoView()` as `MOZ_CAN_RUN_SCRIPT` and move
it from `nsIPresShell` to `PresShell` with a member.

Differential Revision: https://phabricator.services.mozilla.com/D28321

--HG--
extra : moz-landing-system : lando
2019-04-23 01:34:26 +00:00
Masayuki Nakano
3bd62fb08a Bug 1543315 - part 11: Mark nsIPresShell::ScrollContentIntoView() as MOZ_CAN_RUN_SCRIPT r=smaug
This patch marks `ScrollContentIntoView()` as `MOZ_CAN_RUN_SCRIPT` and changing
some callers of them to guarantee thar their parent callers are also safe.

Additionally, this patch moves it from `nsIPresShell` to `PresShell` because
all callers can refer `PresShell` directly.

Unfortunately, this patch changes a lot of methods in autocomplete and satchel
since this patch needs to mark some interface methods as `can_run_script` and
they are called each other.  This means that autocomplete module is really
sensitive like editor module.  Perhaps, autocomplete and satchel should do
scroll asynchronously and unmark some of them as `MOZ_CAN_RUN_SCRIPT` again.

Differential Revision: https://phabricator.services.mozilla.com/D28320

--HG--
extra : moz-landing-system : lando
2019-04-23 01:34:24 +00:00
Masayuki Nakano
65aa369673 Bug 1543315 - part 10: Mark nsIPresShell::GoToAnchor() and nsIPresShell::ScrollToAnchor() as MOZ_CAN_RUN_SCRIPT r=smaug
Next, we should mark `PresShell::ScrollContentIntoView()` as
`MOZ_CAN_RUN_SCRIPT` because it's used widely.

This patch marks its `PresShell` users, `GoToAnchor()` and `ScrollToAnchor()`,
as `MOZ_CAN_RUN_SCRIPT`.  Additionally, this patch moves them from
`nsIPresShell` to `PresShell` because all callers refers `PresShell` directly.

Differential Revision: https://phabricator.services.mozilla.com/D28319

--HG--
extra : moz-landing-system : lando
2019-04-23 01:27:47 +00:00
Hiroyuki Ikezoe
8bd0453a43 Bug 1528052 - Suppress resize events until the initial paint has finished on mobile. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D28172

--HG--
extra : moz-landing-system : lando
2019-04-23 04:14:55 +00:00
Ian Moody
99a41b5b92 Bug 1379466 - Add override pref to restore legacy non-primary click dispatch on specific domains. r=smaug
If needed for web-compat.
Also stop dispatching auxclicks if non-primary click has been preventDefaulted,
so that legacy new-tab prevention can work with the pref flip.

Differential Revision: https://phabricator.services.mozilla.com/D27364

--HG--
extra : moz-landing-system : lando
2019-04-18 12:57:37 +00:00
Emilio Cobos Álvarez
baf580cdfa Bug 1545107 - Remove nsIDocumentObserver::DocumentStatesChanged. r=smaug
It's a bit useless, only has one implementation. Call into the shell directly
instead.

Differential Revision: https://phabricator.services.mozilla.com/D27910

--HG--
extra : moz-landing-system : lando
2019-04-17 19:29:59 +00:00
Masayuki Nakano
f5737567dd Bug 1544343 - part 3: Make layout use mozilla::PresShell instead of nsIPresShell as far as possible r=emilio
This patch changes remaining things under `layout/`.  However, there are some
places which still need to use `nsIPresShell`.  That will be fixed in a
follow up bug.

Differential Revision: https://phabricator.services.mozilla.com/D27477

--HG--
extra : moz-landing-system : lando
2019-04-16 07:25:10 +00:00
Masayuki Nakano
60e014c55e Bug 1544215 - Make nsIContentVewer::GetPresShell() return mozilla::PresShell instead of nsIPresShell r=bzbarsky
Additionally, this patch makes `nsDocumentViewer` which is the only
implementation of `nsIContentViewer` use `mozilla::PresShell` directly
rather than via `nsIPresShell`.

Differential Revision: https://phabricator.services.mozilla.com/D27470

--HG--
extra : moz-landing-system : lando
2019-04-16 02:47:26 +00:00
Masayuki Nakano
414509fe00 Bug 1543315 - part 9: Mark nsIPresShell::FlushPendingNotifications() as MOZ_CAN_RUN_SCRIPT r=smaug
So, this patch makes all caller of it safe including its arguments unless
they come from other methods.

Differential Revision: https://phabricator.services.mozilla.com/D27225

--HG--
extra : moz-landing-system : lando
2019-04-13 12:43:57 +00:00
Masayuki Nakano
8d97a5efe1 Bug 1543315 - part 8: Mark HandlePostedReflowCallbacks() as MOZ_CAN_RUN_SCRIPT r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D27224

--HG--
extra : moz-landing-system : lando
2019-04-13 12:42:38 +00:00
Masayuki Nakano
93bae33c11 Bug 1543315 - part 7: Mark DidDoReflow() as MOZ_CAN_RUN_SCRIPT r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D27223

--HG--
extra : moz-landing-system : lando
2019-04-13 12:42:02 +00:00
Masayuki Nakano
55dc8a6004 Bug 1543315 - part 6: Mark ProcessReflowCommands() as MOZ_CAN_RUN_SCRIPT r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D27222

--HG--
extra : moz-landing-system : lando
2019-04-13 12:40:48 +00:00
Masayuki Nakano
40f02a6603 Bug 1543315 - part 5: Mark ResizeReflowIgnoreOverride() as MOZ_CAN_RUN_SCRIPT r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D27221

--HG--
extra : moz-landing-system : lando
2019-04-13 12:40:10 +00:00
Masayuki Nakano
e8514bbdc6 Bug 1543315 - part 4: Mark ResizeReflow() as MOZ_CAN_RUN_SCRIPT r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D27220

--HG--
extra : moz-landing-system : lando
2019-04-13 12:39:47 +00:00
Masayuki Nakano
2332e34945 Bug 1543315 - part 3: Mark WillPaint() as MOZ_CAN_RUN_SCRIPT r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D27219

--HG--
extra : moz-landing-system : lando
2019-04-13 12:39:03 +00:00
Masayuki Nakano
0986fb819b Bug 1542506 - Make nsDocShell use mozilla::PresShell* directly rather than nsIPresShell* r=bzbarsky
This patch makes `nsDocShell::GetPresShell()` and
`nsDocShell::GetEldestPresShell()` return `mozilla::PresShell*` and
some non-public methods use `mozilla::PresShell*` directly.

Differential Revision: https://phabricator.services.mozilla.com/D26424

--HG--
extra : moz-landing-system : lando
2019-04-13 01:03:13 +00:00
Masayuki Nakano
e8446480e1 Bug 1542407 - Make nsIFrame use mozilla::PresShell directly rather than via nsIPresShell r=emilio
Except retrieving from weak reference, `nsIFrame` should treat
`mozilla::PresShell` directly rather than via `nsIPresShell`.

Differential Revision: https://phabricator.services.mozilla.com/D26388

--HG--
extra : moz-landing-system : lando
2019-04-06 06:02:28 +00:00
Botond Ballo
fbb1036cee Bug 1531962 - Extract an MVMContext interface used by MobileViewportManager to interact with its surroundings. r=kats
Differential Revision: https://phabricator.services.mozilla.com/D26246

--HG--
extra : moz-landing-system : lando
2019-04-04 22:11:40 +00:00
Botond Ballo
2cb0da3cd1 Bug 1531962 - Avoid including MobileViewportManager.h from nsIPresShell.h. r=kats
nsIPresShell.h is widely included, so this avoids excessively long rebuilds
when MobileViewportManager.h is modified.

Differential Revision: https://phabricator.services.mozilla.com/D26245

--HG--
extra : moz-landing-system : lando
2019-04-04 22:09:55 +00:00
Masayuki Nakano
9165a150a1 Bug 1540930 - Make nsPresContext use mozilla::PresShell directly rather than via nsIPresShell r=emilio
`nsPresContext` should use `mozilla::PresShell` directly instead of
`nsIPresShell`.  This patch makes it.

Unfortunately, `nsPresContext` and `nsIFrame` have `PresShell()`.  Therefore,
we cannot use `PresShell*` in its methods so that this patch uses `mozilla::`
namespace prefix.

It might be better to rename them as `PresShellPtr()` in another bug.

Differential Revision: https://phabricator.services.mozilla.com/D25721

--HG--
extra : moz-landing-system : lando
2019-04-03 12:40:26 +00:00
Emilio Cobos Álvarez
d8e2990d8a Bug 1535788 - Make the Document own the StyleSet. r=heycam
This is the last step to be able to call matchMedia on display: none iframes.

This is green, except for some startup preference query tests that I'm going to
address in a blocking bug (making LangGroupFontPrefs global, basically).

The setup is similar to the ShadowRoot one, except we don't eagerly keep the
StyleSet around up-to-date, we only fill it if it ever had a pres context.

Differential Revision: https://phabricator.services.mozilla.com/D23903

--HG--
extra : moz-landing-system : lando
2019-04-03 07:02:00 +00:00
Masayuki Nakano
de2d589e58 Bug 1540015 - part 3: Rename Document::GetShell() to Document::GetPresShell() and make it return PresShell* rather than nsIPresShell* r=smaug,emilio
This makes `Document::GetShell()` return `PresShell*` instead of `nsIPresShell`.

Additonally, "shell" is unclear ("docshell" vs. "presshell").  Therefore, this
also renames `Document::GetShell()` to `Document::GetPresShell()`.

Similarly, some other method names of `Document` are also renamed from
`*Shell*` to `*PresShell*`.

Differential Revision: https://phabricator.services.mozilla.com/D25338

--HG--
extra : moz-landing-system : lando
2019-03-29 15:12:47 +00:00
Masayuki Nakano
b7fbcf781f Bug 1540015 - part 2: Make nsPresContext.h stop including nsIPresShel.h and nsIPresShellInlines.h r=smaug
`*Inlines.h` shouldn't be included by another header file, but `nsPresContext.h`
does it.  This causes include-hell which blocks the following fix.

Additionally, it causes an include hell between `PresShell.h` vs.
`nsIPresShell.h` and `nsPresContext.h if `Document.h` includes `PresShell.h`.
Therefore, this patch also solves this include hell with adding
`nsPresContextInlines.h`.

Differential Revision: https://phabricator.services.mozilla.com/D25333

--HG--
extra : moz-landing-system : lando
2019-03-29 15:11:22 +00:00
Dorel Luca
5a0fa68b78 Backed out 3 changesets (bug 1540015) for build bustage. CLOSED TREE
Backed out changeset 7b71c9da0214 (bug 1540015)
Backed out changeset 5723ddbc5c44 (bug 1540015)
Backed out changeset 9561d2c36fa5 (bug 1540015)
2019-03-29 16:14:26 +02:00
Masayuki Nakano
9273f25ce2 Bug 1540015 - part 3: Rename Document::GetShell() to Document::GetPresShell() and make it return PresShell* rather than nsIPresShell* r=smaug,emilio
This makes `Document::GetShell()` return `PresShell*` instead of `nsIPresShell`.

Additonally, "shell" is unclear ("docshell" vs. "presshell").  Therefore, this
also renames `Document::GetShell()` to `Document::GetPresShell()`.

Similarly, some other method names of `Document` are also renamed from
`*Shell*` to `*PresShell*`.

Differential Revision: https://phabricator.services.mozilla.com/D25338

--HG--
extra : moz-landing-system : lando
2019-03-29 13:09:26 +00:00
Masayuki Nakano
2137fa4b14 Bug 1540015 - part 2: Make nsPresContext.h stop including nsIPresShel.h and nsIPresShellInlines.h r=smaug
`*Inlines.h` shouldn't be included by another header file, but `nsPresContext.h`
does it.  This causes include-hell which blocks the following fix.

Additionally, it causes an include hell between `PresShell.h` vs.
`nsIPresShell.h` and `nsPresContext.h if `Document.h` includes `PresShell.h`.
Therefore, this patch also solves this include hell with adding
`nsPresContextInlines.h`.

Differential Revision: https://phabricator.services.mozilla.com/D25333

--HG--
extra : moz-landing-system : lando
2019-03-29 12:13:08 +00:00
Botond Ballo
573a6eaafa Bug 1538511 - Move nsIScrollableFrame::ScrollMode into a separate file. r=kats
This allows this enumeration to be used from nsIPresShell.h without introducing
a circular dependency.

Its new home in layout/base/ScrollTypes.h, included as mozilla/ScrollTypes.h.
Others similar enums can be added to that file if desired.

This patch also makes ScrollMode an enum class (as it's no longer nested
inside a class) and switches its enumerators to the |eName| naming convention.

Differential Revision: https://phabricator.services.mozilla.com/D24796

--HG--
extra : moz-landing-system : lando
2019-03-25 23:17:20 +00:00
Masayuki Nakano
db43e47173 Bug 1536366 - Make PresShell::EventHandler::PrepareToDispatchEvent() call TouchManager::PreHandleEvent() instead of PresShell::EventHandler::HandleEventWithCurrentEventInfo() r=smaug
The only caller of `TouchManager::PreHandleEvent()` is
`PresShell::EventHandler::HandleEventWithCurrentEventInfo()` which is guaranteed
that it never handles untrused event by bug 1536353.  Therefore, we can make
`PresShell::EventHandler::PrepareToDispatchEvent()` call it instead.  That's
better place from the point of view of semantics and making
`PresShell::EventHandler::PrepareToDispatchEvent()` simpler.

Note that this may cause changing the score of a telemetry probe,
"INPUT_EVENT_QUEUED_APZ_TOUCH_MOVE_MS" because it will include the time of
the runtime cost of `TouchManager::PreHandleEvent()` when the event is an
`eTouchMove` event and handled by APZ.  However, this was expired in 60.
So, we don't meet any changes with this patch actually.

Differential Revision: https://phabricator.services.mozilla.com/D24133

--HG--
extra : moz-landing-system : lando
2019-03-27 01:08:23 +00:00
Csoregi Natalia
d105b005e8 Merge inbound to mozilla-central. a=merge 2019-03-26 19:43:22 +02:00
Masayuki Nakano
dbf37b7d62 Bug 1536353 - part 2: Merge PresShell::EventHandler::PrepareToDispatchEvent() and PresShell::EventHandler::PrepareToDispatchContextMenuEvent() r=smaug
`PresShell::EventHandler::PrepareToDispatchEvent()` checked whether the
given event is a trusted event or an untrusted event, but
`PresShell::EventHandler::PrepareToDispatchOntextMenuEvent()` didn't so.
However, now, both of them don't need to check it.  Therefore, we can merge
them.

Differential Revision: https://phabricator.services.mozilla.com/D24132

--HG--
extra : moz-landing-system : lando
2019-03-26 10:04:43 +00:00
Masayuki Nakano
f371fabc1b Bug 1536353 - part 1: Make PresShell::EventHandler stop checking WidgetEvent::IsTrusted() at runtime in release channel r=smaug
`PresShell::EventHandler` shouldn't be used to dispatch untrusted event.
However, it checks whether the given event is trusted or untrusted somewhere
and that makes the code harder to understand.  So, it should check each event
only with `MOZ_ASSERT()` or `MOZ_DIAGNOSTIC_ASSERT()` instead.  Then,
developers can trust the event is always a trusted event.

Differential Revision: https://phabricator.services.mozilla.com/D24131

--HG--
extra : moz-landing-system : lando
2019-03-26 10:02:06 +00:00
Cosmin Sabou
ddfb7ebc97 Backed out changeset a04938b3a757 (bug 1536781) for android mochitest failures on test_settings_fontinflation.html.
--HG--
extra : rebase_source : 7ca18ca3408b1ad18e5d57ddf4b5ad986f2daa08
2019-03-25 13:45:38 +02:00
Olli Pettay
abc400e3b3 Bug 1536781, use the same paint suppression delay on mobile and desktop, r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D24658

--HG--
extra : moz-landing-system : lando
2019-03-25 00:20:15 +00:00
Oana Pop Rus
90e63da7c3 Backed out 2 changesets (bug 1536353) for failing in 1397711.html on a CLOSED TREE
Backed out changeset 6ef59933242a (bug 1536353)
Backed out changeset 64a815f04641 (bug 1536353)
2019-03-22 05:29:03 +02:00
Masayuki Nakano
34f7f05430 Bug 1536353 - part 2: Merge PresShell::EventHandler::PrepareToDispatchEvent() and PresShell::EventHandler::PrepareToDispatchContextMenuEvent() r=smaug
`PresShell::EventHandler::PrepareToDispatchEvent()` checked whether the
given event is a trusted event or an untrusted event, but
`PresShell::EventHandler::PrepareToDispatchOntextMenuEvent()` didn't so.
However, now, both of them don't need to check it.  Therefore, we can merge
them.

Differential Revision: https://phabricator.services.mozilla.com/D24132

--HG--
extra : moz-landing-system : lando
2019-03-20 14:03:21 +00:00
Masayuki Nakano
0bb5218dd8 Bug 1536353 - part 1: Make PresShell::EventHandler stop checking WidgetEvent::IsTrusted() at runtime in release channel r=smaug
`PresShell::EventHandler` shouldn't be used to dispatch untrusted event.
However, it checks whether the given event is trusted or untrusted somewhere
and that makes the code harder to understand.  So, it should check each event
only with `MOZ_ASSERT()` or `MOZ_DIAGNOSTIC_ASSERT()` instead.  Then,
developers can trust the event is always a trusted event.

Differential Revision: https://phabricator.services.mozilla.com/D24131

--HG--
extra : moz-landing-system : lando
2019-03-20 13:58:55 +00:00
Olli Pettay
6143d2b90d Bug 1536781, use the same paint suppression delay on mobile and desktop, r=emilio
Differential Revision: https://phabricator.services.mozilla.com//D24804

--HG--
extra : rebase_source : 5fcdd643e253dcad6ab2f0c94ed3addd48724249
2019-03-25 14:44:56 +02:00
Masayuki Nakano
a5791dba14 Bug 1466208 - part 45: Rename aFrame of HandleEvent() to aFrameForPresShell r=smaug
Now, other methods taking `aFrame` of `HandleEvent()` names the argument as
`aFrameForPresShell`.  So, `HandleEvent()`'s `aFrame` should also be renamed.

This patch renames it and adds MOZ_CAN_RUN_SCRIPT and comment to
`nsIPresShell::HandleEvent()`.

This is the final patch for bug 1466208.

Differential Revision: https://phabricator.services.mozilla.com/D22463

--HG--
extra : moz-landing-system : lando
2019-03-13 10:32:36 +00:00
Masayuki Nakano
229762b203 Bug 1466208 - part 44: Rename PresShell::EventHandler::HandleEventInternal() to HandleEventWithCurrentEventInfo() r=smaug
In my understanding, `PresShell::EventHandler::HandleEvent()` may redirect
the event to another class or PresShell first.  Otherwise, it computes
event target and sets current event info of mPresShell to it.  Then, calls
`HandleEventInternal()` to dispatch the event.  Then, `HandleEventInternal()`
may handle the event before dispatch, and/or prepare to dispatch, then,
finally dispatches the event and finalize the state of mPresShell and the
event.  Therefore, `HandleEventInternal()` actually handles the event, but
the word, "internal" is not explicitly explain its different points from
`HandleEvent()`.  Therefore, I think that `HandleEventWithCurrentEventInfo()`
is better name since `HandleEvent()` considers the current event info.

Differential Revision: https://phabricator.services.mozilla.com/D22462

--HG--
extra : moz-landing-system : lando
2019-03-12 04:25:13 +00:00
Masayuki Nakano
5c8444252b Bug 1466208 - part 43: Create PresShell::EventHandler::FinalizeHandlingEvent() r=smaug
Finally, we should move the last switch statement in `HandleEventInternal()`
to the new method.  Then, `HandleEventInternal() does nothing complicated
things by itself.

Differential Revision: https://phabricator.services.mozilla.com/D22461

--HG--
extra : moz-landing-system : lando
2019-03-11 01:52:40 +00:00
Boris Zbarsky
6f2f3304b0 Bug 1533617 part 1. Improve MOZ_CAN_RUN_SCRIPT annotations around synth mouse events. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D22835

--HG--
extra : moz-landing-system : lando
2019-03-11 14:58:04 +00:00
Masayuki Nakano
2e39c4ee90 Bug 1466208 - part 41: Create PresShell::EventHandler::DispatchEvent() r=smaug
This is the part which actually handles the event.  The new method should
notify EventStateManager of dispatching event before and after that, and
actually dispatch the event into the DOM.

Differential Revision: https://phabricator.services.mozilla.com/D22459

--HG--
extra : moz-landing-system : lando
2019-03-09 23:39:16 +00:00
Masayuki Nakano
930da74b1d Bug 1466208 - part 40: Create PresShell::EventHandler::PrepareToDispatchEvent() r=smaug
For making `PresShell::EventHandler::HandleEventInternal()` easier to read,
move the large switch statement for preparation into the new method.

Differential Revision: https://phabricator.services.mozilla.com/D21341

--HG--
extra : moz-landing-system : lando
2019-03-09 23:38:38 +00:00
Masayuki Nakano
1b0e6d02fe Bug 1466208 - part 39: Create PresShell::EventHandler::MaybeHandleKeyboardEventBeforeDispatch() r=smaug
`PresShell::EventHandler::HandleEventInternal()` may handle `Escape` key before
dispatching it in some cases.  This requires too many lines for somebody who
investigate the method for the other events.  Therefore, this patch moves it
into the new method.

Additionally, this patch creates `WidgetKeyboardEvent::CanTreatAsUserInput()`
and `WidgetKeyboardEvent::ShouldInteractionTimeRecorded()` because we should
manage similar checks in one place (we already have
`WidgetKeyboardEvent::CanUserGestureActivateTarget()`).  Finally, their
conditions are not enough for what the comment wants to do there since they do
not check some modifier keys.  Therefore, this patch makes them check all
possible modifier keys too.

Differential Revision: https://phabricator.services.mozilla.com/D21340

--HG--
extra : moz-landing-system : lando
2019-03-08 12:46:17 +00:00