Граф коммитов

285 Коммитов

Автор SHA1 Сообщение Дата
Masayuki Nakano 2fde14a338 Bug 1623918 - part 2: Mark `nsINode::GetSelectionRootContent()` and its root callers as `MOZ_CAN_RUN_SCRIPT` as far as possible r=smaug
This patch tries to mark root callers of `nsINode::GetSelectionRootContent()`
which calls `nsINode::GetAnonymousRootElementOfTextEditor()` as far as possible
(and reasonable).

It's used by `ContentEventHandler` so that a lot of methods of
`EventStateManager`, `ContentEventHandler`, `IMEContentObserver` which are main
users of it are also marked as `MOZ_CAN_RUN_SCRIPT`.  I think that this is
reasonable.

On the other hand, it might not be reasonable to mark `IMEStateManager` methods
as `MOZ_CAN_RUN_SCRIPT` for initializing `IMEContentObserver` because
`IMEStateManager` may be able to initialize `IMEContentObserver` asynchronously
and its root callers are in XUL layout code.  Therefore, this patch uses
`MOZ_CAN_RUN_SCRIPT_BOUNDARY` for `IMEStateManager` at least for now.

Differential Revision: https://phabricator.services.mozilla.com/D92730
2020-10-09 02:37:47 +00:00
Narcis Beleuzu c163b394ef Backed out 2 changesets (bug 1623918) for crashtest failure on 1623918.html CLOSED TREE
Backed out changeset 519ca1b069e5 (bug 1623918)
Backed out changeset d8a09a5fea47 (bug 1623918)
2020-10-08 12:06:58 +03:00
Masayuki Nakano da386ef224 Bug 1623918 - part 2: Mark `nsINode::GetSelectionRootContent()` and its root callers as `MOZ_CAN_RUN_SCRIPT` as far as possible r=smaug
This patch tries to mark root callers of `nsINode::GetSelectionRootContent()`
which calls `nsINode::GetAnonymousRootElementOfTextEditor()` as far as possible
(and reasonable).

It's used by `ContentEventHandler` so that a lot of methods of
`EventStateManager`, `ContentEventHandler`, `IMEContentObserver` which are main
users of it are also marked as `MOZ_CAN_RUN_SCRIPT`.  I think that this is
reasonable.

On the other hand, it might not be reasonable to mark `IMEStateManager` methods
as `MOZ_CAN_RUN_SCRIPT` for initializing `IMEContentObserver` because
`IMEStateManager` may be able to initialize `IMEContentObserver` asynchronously
and its root callers are in XUL layout code.  Therefore, this patch uses
`MOZ_CAN_RUN_SCRIPT_BOUNDARY` for `IMEStateManager` at least for now.

Differential Revision: https://phabricator.services.mozilla.com/D92730
2020-10-08 03:56:51 +00:00
Markus Stange 41c70bcd59 Bug 1666617 - Add an observer description argument to AddRefreshObserver. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D91082
2020-09-25 02:36:29 +00:00
Timothy Nikkel 066a6ba348 Bug 1666991. Remove PresShell::GetNearestScrollableFrame. r=kats
The current formulation is inconsistent. If you call it with ScrollableDirection::Either it goes into nsLayoutUtils::GetNearestScrollableFrame which will return the first scroll frame with a non-hidden overflow. If you call it with any other ScrollableDirection it calls nsLayoutUtils::GetNearestScrollableFrameForDirection which returns the first scrollframe it finds that has non-hidden overflow AND has at least one dev pixel of scroll range.

So remove that function and call nsLayoutUtils::GetNearestScrollableFrameForDirection directly. This is a slight change of behaviour but it seems desirable for all callers.

Differential Revision: https://phabricator.services.mozilla.com/D91236
2020-09-24 13:44:54 +00:00
Timothy Nikkel b40f06a081 Bug 1665332. Fetch the value of mZoomableByAPZ in the ScrollFrameHelper constructor so it is always correct. r=kats
Otherwise the only time it gets set is when the ZoomConstraintsClient specifically sets it in response to one of the things that can change it. But if the scroll frame gets reconstructed and one of those things don't happen it will be wrong.

This shows up with desktop zooming scrollbars because we check mZoomableByAPZ (or WantAsyncScroll()) before we use the apz scroll path in ScrollFrameHelper::ScrollBy().

Differential Revision: https://phabricator.services.mozilla.com/D90384
2020-09-22 11:21:39 +00:00
Razvan Maries 3c91b4555b Backed out changeset bb1437fa93d0 (bug 1665332) for perma failures on ClipManager.cpp. CLOSED TREE 2020-09-22 14:10:37 +03:00
Timothy Nikkel 5039021d77 Bug 1665332. Fetch the value of mZoomableByAPZ in the ScrollFrameHelper constructor so it is always correct. r=kats
Otherwise the only time it gets set is when the ZoomConstraintsClient specifically sets it in response to one of the things that can change it. But if the scroll frame gets reconstructed and one of those things don't happen it will be wrong.

This shows up with desktop zooming scrollbars because we check mZoomableByAPZ (or WantAsyncScroll()) before we use the apz scroll path in ScrollFrameHelper::ScrollBy().

Differential Revision: https://phabricator.services.mozilla.com/D90384
2020-09-22 04:52:18 +00:00
Kartikaya Gupta b242b603bc Bug 1657995 - Rename UpdateViewportOverridden to a more appropriate name. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D86491
2020-08-09 21:40:56 +00:00
Kartikaya Gupta 6a68ea3e31 Bug 1657995 - Remove GetIsViewportOverridden. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D86438
2020-08-09 20:28:49 +00:00
Simon Giesecke 1e6ec7ec86 Bug 1656117 - Reduce include dependencies on nsRefreshDriver.h. r=mstange
The abstract observer base classes are moved to a separate header file
nsRefreshObservers.h and the includes are adjusted accordingly.

Some method implementations are moved to the corresponding implementation files
to avoid the need to include the nsRefreshDriver.h file in the header.

Differential Revision: https://phabricator.services.mozilla.com/D85764
2020-08-04 21:17:50 +00:00
Simon Giesecke 4e8c935384 Bug 1652023 - Remove unnecessary includes from PresShell.h. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D83114
2020-07-15 13:53:02 +00:00
Andrew Osmond a70c654c29 Bug 1550710 - Make vector images enable high quality scaling for embedded raster images. r=tnikkel
We did not pass FLAG_HIGH_QUALITY_SCALING down to the document used to
rasterize the SVG to a surface, resulting in embedded raster images to
not use high quality downscaling.

Differential Revision: https://phabricator.services.mozilla.com/D56422
2020-06-23 12:43:21 +00:00
Kartikaya Gupta 3cdcbca508 Bug 1646385 - Move SetVisualViewport goop from nsLayoutUtils to PresShell. r=tnikkel
There's no need to put this in nsLayoutUtils since it's so closely bound
to presShell anyway. So we move it from being a static nsLayoutUtils function
that takes a PresShell pointer, to being a method on the PresShell itself.

Two functional changes here:
1. Don't run the MaybeReflowForInflationScreenSizeChange code unless the
   visual viewport actually changes
2. Run the MaybeReflowForInflationScreenSizeChange if the visual viewport
   is reset.

These functional changes can be logically thought of as "group the font-
inflation reflow stuff together with the other visual-viewport-triggered
reflow stuff".

Depends on D80040

Differential Revision: https://phabricator.services.mozilla.com/D80041
2020-06-18 11:54:01 +00:00
Markus Stange c5cf53e63b Bug 1642603 - Make TransformAndClipBounds stop discarding the corner positions of empty rectangles. r=kip
Differential Revision: https://phabricator.services.mozilla.com/D79582
2020-06-17 18:54:46 +00:00
Emilio Cobos Álvarez 416e50d907 Bug 1640191 - Simplify system colors change notification. r=jmathies
The current notification enumerates all windows and calls
SysColorChanged on them.

The current implementation of SysColorChanged is not quite sound, as it
really needs most if not all of what ThemeChanged does: SVGs can use
system colors, so we need to also invalidate the image cache for
example.

It's also not clear it deals correctly with propagating system color
changes to other documents.

In some cases we were even firing both theme changes and system color
changes at the same time. Unify this code paths.

Differential Revision: https://phabricator.services.mozilla.com/D76487
2020-06-10 15:18:25 +00:00
Kartikaya Gupta c4698ef203 Bug 1627708 - Add boolean telemetry histograms for recording if APZ zooming occurred. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D77827
2020-06-06 00:32:12 +00:00
Timothy Nikkel 2096072d59 Bug 1640783. Should only call ClearPendingVisualScrollUpdate if we painted to the widget. r=botond
If we called PaintFrame for drawWindow or something other than painting to the widget the visual scroll update won't make it to the compositor, so don't clear it.

This doesn't fix anything specifically, just noticed it while reading code.

Differential Revision: https://phabricator.services.mozilla.com/D76781
2020-06-03 07:50:16 +00:00
Kartikaya Gupta 01892da471 Bug 1641246 - Remove unrelated stray function declaration. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D77112
2020-05-27 21:33:55 +00:00
Cameron McCormack 1e8189c0f1 Bug 1640537 - Improve style sheet dumping in the layout debugger. r=TYLin
Make it show the contents of style sheets (as it used to before Stylo)
and make it work in --disable-debug --enable-layout-debugger builds.

Differential Revision: https://phabricator.services.mozilla.com/D76640
2020-05-26 23:07:36 +00:00
Botond Ballo 887327825b Bug 1556556 - Convert mRefPoint to visual coordinates for synthesized events. r=tnikkel
As part of this change, PresShell::mMouseLocation in stored visual coordinates.

Differential Revision: https://phabricator.services.mozilla.com/D69640
2020-05-05 19:28:41 +00:00
Botond Ballo f7fde53875 Bug 1556556 - Remove some cruft related to handling the resolution in non-e10s setups. r=tnikkel
Prior to this bug, it was necessary to handle non-e10s specially, because the
resolution was being unapplied at the process boundary, and in non-e10s there
was no process boundary.

The remaining patches in this bug move the resolution unapplication away from
the process boundary in all cases, making special handling for non-e10s
unnecessary.

Differential Revision: https://phabricator.services.mozilla.com/D68273
2020-05-05 19:20:00 +00:00
Masayuki Nakano 11af44e544 Bug 1632726 - part 2: Remove some unused `nsISelectionController` methods r=smaug
Even in comm-central and BlueGriffon, `nsISelectionController::*ForDelete()`
are not used.  Therefore, we can remove them safely.

Differential Revision: https://phabricator.services.mozilla.com/D72296
2020-04-27 06:20:31 +00:00
Csoregi Natalia b073baab86 Backed out 30 changesets (bug 1556556, bug 1631568) for multiple mochitest failures. CLOSED TREE
Backed out changeset edd529f7a9c5 (bug 1631568)
Backed out changeset 1cc0881e244b (bug 1631568)
Backed out changeset ed3c1e85d5e3 (bug 1556556)
Backed out changeset 38ffc6215bbf (bug 1556556)
Backed out changeset 03c2c25d8023 (bug 1556556)
Backed out changeset 9c717eb067b8 (bug 1556556)
Backed out changeset 98e26bc98b85 (bug 1556556)
Backed out changeset 05a6a581e755 (bug 1556556)
Backed out changeset 867946cf05bb (bug 1556556)
Backed out changeset 20d72a334530 (bug 1556556)
Backed out changeset 2c62e61d9054 (bug 1556556)
Backed out changeset 62a223d057d2 (bug 1556556)
Backed out changeset 2c5d55a1f0b1 (bug 1556556)
Backed out changeset 700447945b4e (bug 1556556)
Backed out changeset 93190ae4f5ff (bug 1556556)
Backed out changeset a7bd34d961bb (bug 1556556)
Backed out changeset fccd1d3c7189 (bug 1556556)
Backed out changeset 24056e47183d (bug 1556556)
Backed out changeset 204881474cc1 (bug 1556556)
Backed out changeset 387320881876 (bug 1556556)
Backed out changeset be8f5eb58460 (bug 1556556)
Backed out changeset 629c58a9166b (bug 1556556)
Backed out changeset 4312b2b5dda8 (bug 1556556)
Backed out changeset d11dbf6403a5 (bug 1556556)
Backed out changeset 95c54c023779 (bug 1556556)
Backed out changeset 80fcb7e71188 (bug 1556556)
Backed out changeset d75a4ecb0d47 (bug 1556556)
Backed out changeset 903c4de34e7a (bug 1556556)
Backed out changeset f15334a3e803 (bug 1556556)
Backed out changeset 9553e99137ea (bug 1556556)
2020-04-28 12:43:11 +03:00
Botond Ballo 29e3ec7e90 Bug 1556556 - Convert mRefPoint to visual coordinates for synthesized events. r=tnikkel
As part of this change, PresShell::mMouseLocation in stored visual coordinates.

Differential Revision: https://phabricator.services.mozilla.com/D69640
2020-04-28 01:42:49 +00:00
Botond Ballo 5e9a66a3de Bug 1556556 - Remove some cruft related to handling the resolution in non-e10s setups. r=tnikkel
Prior to this bug, it was necessary to handle non-e10s specially, because the
resolution was being unapplied at the process boundary, and in non-e10s there
was no process boundary.

The remaining patches in this bug move the resolution unapplication away from
the process boundary in all cases, making special handling for non-e10s
unnecessary.

Differential Revision: https://phabricator.services.mozilla.com/D68273
2020-04-28 02:03:18 +00:00
Emilio Cobos Álvarez 31821e1fc4 Bug 1449522 - Remove nsIEditorStyleSheets. r=masayuki,m_kato
Users have much better, easier alternatives, like
DOMWindowUtils.{loadSheetUsingURIString,removeSheet}, which we use to
replace the only caller that exists in mozilla-central (the editor
element, which loads EditorOverride.css).

This allows to clean up the style system and editor. There are other
callers in comm-central, but it seems they can switch to DOMWindowUtils
trivially, as the DOMWindowUtils APIs also use the system principal and
thus they can load any URL.

I'll make sure to give them some time with the migration and/or help
out of course.

Differential Revision: https://phabricator.services.mozilla.com/D71263
2020-04-17 22:54:48 +00:00
Mirko Brodesser 66f056b308 Bug 1623858: part 4) Document `PresShell::mSelectionFlags`. r=smaug
Depends on D67601

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

--HG--
extra : moz-landing-system : lando
2020-03-20 13:24:48 +00:00
Emilio Cobos Álvarez 04828e3a4a Bug 253870 - Make disabled form controls selectable. r=masayuki,MarcoZ
This rejiggers a bit the way selection focus is handled so that focusing a
disabled form control with the mouse handles selection properly, and hides the
document selection and so on.

This matches the behavior of other browsers as far as I can tell.

Given now readonly and disabled editors behave the same, we can simplify a bit
the surrounding editor code.

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

--HG--
extra : moz-landing-system : lando
2020-03-19 13:18:16 +00:00
Simon Giesecke 8aa47bcfb7 Bug 1613985 - Use default for equivalent-to-default constructors/destructors in layout. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D66016

--HG--
extra : moz-landing-system : lando
2020-03-17 09:38:32 +00:00
Mihai Alexandru Michis 58bc354025 Backed out changeset 9eeee9ec66d9 (bug 253870) for causing failures in browser_bug1261299.js
CLOSED TREE
2020-03-16 22:32:41 +02:00
Emilio Cobos Álvarez 9f28f89085 Bug 253870 - Make disabled form controls selectable. r=masayuki,MarcoZ
This rejiggers a bit the way selection focus is handled so that focusing a
disabled form control with the mouse handles selection properly, and hides the
document selection and so on.

This matches the behavior of other browsers as far as I can tell.

Given now readonly and disabled editors behave the same, we can simplify a bit
the surrounding editor code.

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

--HG--
extra : moz-landing-system : lando
2020-03-16 17:41:07 +00:00
Masayuki Nakano c90d6c80b3 Bug 1569512 - Make `PresShell` ignore synthesized `mousemove` events coming from another process if the child process stores mouse location of synthesized mouse events for tests r=smaug
The reason of intermittent failure of `test_bug656379-2.html` is, synthesized
`mousemove` event coming from the parent process causes `mouseout` and
`mouseleave` events of the last synthesized `mousemove` in the test.  The
reason is, synthesized `mousemove` for tests makes `PresShell` in the content
process record the cursor location, but won't make it `PresShell` in the
parent process do it.  Therefore, parent process may synthesize `mousemove`
event for the system cursor position which does not match with the synthesized
mouse location in the content process.  Therefore, `:hover` state may be
updated unexpectedly.

This patch makes `WidgetEvent::mFlags` have a flag to indicate whether it
came from another process.  Then, makes `PresShell::HandleEvent()` ignore
synthesized `mousemove` events coming from another process only when the
recorded mouse location was set by a mouse event synthesized for tests.

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

--HG--
extra : moz-landing-system : lando
2020-03-05 21:34:28 +00:00
Emilio Cobos Álvarez 0fd680394f Bug 1617746 - Minor cleanup of ServoStyleSet. r=nordzilla
Removing unused arguments and so on.

The origin can always be inferred from the stylesheet so it wasn't being used.

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

--HG--
extra : moz-landing-system : lando
2020-02-27 01:46:10 +00:00
Cosmin Sabou 3497aa8314 Backed out 2 changesets (bug 1617746) assertion failures on ShadowRoot.cpp.
CLOSED TREE
Backed out changeset 6cb30e866b95 (bug 1617746)
Backed out changeset 3543162b815b (bug 1617746)
2020-02-27 01:12:46 +02:00
Emilio Cobos Álvarez 28effe5605 Bug 1617746 - Minor cleanup of ServoStyleSet. r=nordzilla
Removing unused arguments and so on.

The origin can always be inferred from the stylesheet so it wasn't being used.

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

--HG--
extra : moz-landing-system : lando
2020-02-26 21:20:38 +00:00
Simon Giesecke b50347f917 Bug 1611415 - Prefer using std::move over forget. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D60980

--HG--
extra : moz-landing-system : lando
2020-02-13 14:38:48 +00:00
shindli 91aa0518dd Backed out changeset 0c982bc69cb3 (bug 1611415) for causing build bustages in /builds/worker/workspace/build/src/obj-firefox/dist/include/nsCOMPtr CLOSED TREE 2020-02-12 20:13:29 +02:00
Simon Giesecke f604a47fa5 Bug 1611415 - Applied FixItHints from mozilla-non-std-move. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D60980

--HG--
extra : moz-landing-system : lando
2020-02-12 17:24:41 +00:00
Hiroyuki Ikezoe 63a96a5c4a Bug 1611038 - Introduce PresShell::AddResizeEventFlushObserverIfNeeded. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D60811

--HG--
extra : moz-landing-system : lando
2020-01-23 11:30:02 +00:00
Ting-Yu Lin 16737fbf2f Bug 1306634 Part 1 - Handle a long press to select a word in an unfocused iframe. r=mats,marionette-reviewers,whimboo
Long-pressing on a text in an unfocused iframe to select a word never
works. Currently, you need to single tap to focus the iframe first.

Each PresShell has an associated AccessibleCaretEventHub. This patch
fixes this bug by routing the event to the AccessibleCaretEventHub under
the event point, and handle it there. If the event is not handled, then
we handle it by the focused AccessibleCaretEventHub as before.

I've experimented with only routing the event to the
AccessibleCaretEventHub under the event point, without routing to the
fallback focused AccessibleCaretEventHub. However, caret dragging didn't
work in iframes. I didn't debug further.

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

--HG--
extra : moz-landing-system : lando
2020-01-17 22:21:35 +00:00
Masayuki Nakano 487e463bb5 Bug 1543315 - part 21: Mark `PresShell::DidCauseReflow()` as `MOZ_CAN_RUN_SCRIPT` r=smaug
It removes a script blocker.  Therefore, although it depends on the caller
whether it causes running script or not.  However, we should mark it as
`MOZ_CAN_RUN_SCRIPT` for safer code.

It's called only by the destructor of `nsAutoCauseReflowNotifier`.  Therefore,
this patch also marks its constructor as `MOZ_CAN_RUN_SCRIPT` for making
each creator method marked as `MOZ_CAN_RUN_SCRIPT` or
`MOZ_CAN_RUN_SCRIPT_BOUNDARY`.

Most of the creators is mutation listener methods.  However, `PresShell`
does nothing after destroying `nsAutoCauseReflowNotifier`.  Therefore,
this patch does not change the callers in MutationObserver.cpp to use
`RefPtr<PresShell>` at calling them because changing it may cause performance
regression.

Perhaps, we should create another methods of `WillCauseReflow()` and
`DidCauseReflow()` to avoid unnecessary `MOZ_CAN_RUN_SCRIPT` marking.
However, I'm not sure whether most callers may run script or not because
of outside of my knowledge.

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

--HG--
extra : moz-landing-system : lando
2020-01-17 10:00:28 +00:00
Noemi Erli 13b7594c46 Backed out 2 changesets (bug 1306634) for causing assertion failures in nsAutoLayoutPhase.cpp CLOSED TREE
Backed out changeset fb20602d0c39 (bug 1306634)
Backed out changeset 35651fd9e240 (bug 1306634)
2020-01-17 01:01:09 +02:00
Ting-Yu Lin 2e68f8780b Bug 1306634 Part 1 - Handle a long press to select a word in an unfocused iframe. r=mats,marionette-reviewers,whimboo
Long-pressing on a text in an unfocused iframe to select a word never
works. Currently, you need to single tap to focus the iframe first.

Each PresShell has an associated AccessibleCaretEventHub. This patch
fixes this bug by routing the event to the AccessibleCaretEventHub under
the event point, and handle it there. If the event is not handled, then
we handle it by the focused AccessibleCaretEventHub as before.

I've experimented with only routing the event to the
AccessibleCaretEventHub under the event point, without routing to the
fallback focused AccessibleCaretEventHub. However, caret dragging didn't
work in iframes. I didn't debug further.

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

--HG--
extra : moz-landing-system : lando
2020-01-16 05:08:36 +00:00
Sebastian Streich 0df7a35f3c Bug 1602487 - Remove GetURI calls in PresShell.cpp r=ckerschb
Differential Revision: https://phabricator.services.mozilla.com/D58790

--HG--
extra : moz-landing-system : lando
2020-01-09 12:09:18 +00:00
Ting-Yu Lin 391acfb3c7 Bug 1604701 - Make EventTargetData::mPresShell always compute from the frame. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D57601

--HG--
extra : moz-landing-system : lando
2019-12-19 17:08:41 +00:00
Emilio Cobos Álvarez 3405fe8b57 No bug - Remove a useless include in PresShell.h. r=jya
Differential Revision: https://phabricator.services.mozilla.com/D57690

--HG--
extra : moz-landing-system : lando
2019-12-18 22:57:48 +00:00
Gurzau Raul fb5285c3cd Backed out changeset c6d6f7799ed7 requested by emilio on a CLOSED TREE. 2019-12-19 00:49:07 +02:00
Emilio Cobos Álvarez e0d010d688 No bug - Remove to useless includes in PresShell.h. r=jya
Differential Revision: https://phabricator.services.mozilla.com/D57690

--HG--
extra : moz-landing-system : lando
2019-12-18 22:40:47 +00:00
Masayuki Nakano 271d1b6d1d Bug 1543315 - part 20: Mark `PresShell::ContentStateChanged()` as `MOZ_CAN_RUN_SCRIPT_BOUNDARY` r=smaug
While it calls `RestyleManager::ContentStateChanged()`, it blocks script
with `nsAutoCauseReflowNotifier`.  Therefore, it should be marked as
`MOZ_CAN_RUN_SCRIPT_BOUNDARY` at least (looks like the other override,
`DocAccessible::ContentStateChanged()` does not run script).

There is a concern about the lifetime of `RestyleManager`.  It's destroyed
when `nsPresContext::DetachPresShell()` is called.  It's called by
`PresShell::Destroy()` and destructor of `nsPresContext`.  The latter is
safe since `PresShell` owns `mPresContext` and it's never cleared.  However,
I'm not sure about the former.  It might be better to create blocker of
synchronous handling of `PresShell::Destroy()`.

And also this does not make `Document::ContentStateChanged()` use
`RefPtr<PresShell>` at calling it because it might cause performance
regression, but it does not do anything after destroying
`nsAutoCauseReflowNotifier`.

Finally, for guaranteeing that the lifetime of `PresShell::mPresContext` is
longer than `PresShell`, this makes it to `RefPtr<nsPresContext> const`.
However, initializing it in constructor breaks other objects' initialization
process since they assume that `PresShell::GetPresContext()` won't return
valid pointer until the `nsPresContext` is attached.  For solving this issue
safe, this patch keeps setting `mPresContext` in `Init()` with `const_cast`
hack.

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

--HG--
extra : moz-landing-system : lando
2019-12-11 12:18:33 +00:00