Bug 1542935 - Re-introduce a call to EnsureStyleFlush from PresShell::Init to fix an Android scrolling regression. r=heycam
authorEmilio Cobos Álvarez <emilio@crisal.io>
Mon, 15 Apr 2019 05:26:27 +0000
changeset 469488 3b45bccf61cff70c9f444ad6e155792bc93d1271
parent 469487 7b8dc38bb07efef7a6e8dacca0f0ac695685050e
child 469489 6ff81d173403221744b133b086c4c2377d2a9478
push id112797
push userncsoregi@mozilla.com
push dateMon, 15 Apr 2019 15:29:43 +0000
treeherdermozilla-inbound@a2b89a27e8eb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1542935, 1544185
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1542935 - Re-introduce a call to EnsureStyleFlush from PresShell::Init to fix an Android scrolling regression. r=heycam Sorry for the vague commit message, but I haven't dug yet on why or how the Android code is depending on this. This call used to be part of nsPresContext::CompatibilityModeChanged, which unconditionally called PresShell::EnsureStyleFlush. This was not (in theory, at least) always necessary. There's there's no point in ensuring a style flush is going to happen if styles haven't changed, and CompatibilityModeChanged() didn't actually guarantee that the compat mode was different at all before my patch. Styles only change if the compat mode actually changes (since then selectors become case-sensitive or case-insensitive), or more obviously when you insert or remove the quirks.css stylesheet, and in that case ApplicableStylesChanged makes sure that the flush happens. Yet here we are, and not having that early call to EnsureStyleFlush, even in the case there's no quirks mode or quirks sheet change or anything of that sort (this happens even on XUL docs, which are always FullStandards) makes the first (and only the first) browsing session in Geckoview have terrible scrolling performance. I'm calling it a day for today, will investigate as time permits in bug 1544185. Differential Revision: https://phabricator.services.mozilla.com/D27416
layout/base/PresShell.cpp
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -941,16 +941,21 @@ void PresShell::Init(Document* aDocument
   mViewManager->SetPresShell(this);
 
   // Bind the context to the presentation shell.
   mPresContext = aPresContext;
   mPresContext->AttachPresShell(this);
 
   mPresContext->DeviceContext()->InitFontCache();
 
+  // FIXME(emilio, bug 1544185): Some Android code somehow depends on the shell
+  // being eagerly registered as a style flush observer. This shouldn't be
+  // needed otherwise.
+  EnsureStyleFlush();
+
   // Add the preference style sheet.
   UpdatePreferenceStyles();
 
   bool accessibleCaretEnabled =
       AccessibleCaretEnabled(mDocument->GetDocShell());
   if (accessibleCaretEnabled) {
     // Need to happen before nsFrameSelection has been set up.
     mAccessibleCaretEventHub = new AccessibleCaretEventHub(this);