Bug 1618678 - Make scrollbar style caching work on Android. r=heycam

Differential Revision: https://phabricator.services.mozilla.com/D65915
This commit is contained in:
Emilio Cobos Álvarez
2020-04-04 12:39:56 +00:00
parent ddd172d136
commit 09bb95c69f
2 changed files with 14 additions and 1 deletions

View File

@@ -3863,7 +3863,8 @@ nsresult nsCSSFrameConstructor::GetAnonymousContent(
// * when visibility or pointer-events is anything other than the initial
// value; we rely on visibility and pointer-events inheriting into anonymous
// content, but don't bother adding this state to the AnonymousContentKey,
// since it's not so common
// since it's not so common. Note that on android scrollbars always have
// pointer-events: none so we don't need to check for that.
//
// * when the medium is anything other than screen; some UA style sheet rules
// apply in e.g. print medium, and will give different results from the
@@ -3871,7 +3872,9 @@ nsresult nsCSSFrameConstructor::GetAnonymousContent(
bool allowStyleCaching =
StaticPrefs::layout_css_cached_scrollbar_styles_enabled() &&
aParentFrame->StyleVisibility()->mVisible == StyleVisibility::Visible &&
#ifndef ANDROID
aParentFrame->StyleUI()->mPointerEvents == StylePointerEvents::Auto &&
#endif
mPresShell->GetPresContext()->Medium() == nsGkAtoms::screen;
// Compute styles for the anonymous content tree.
@@ -3925,6 +3928,9 @@ nsresult nsCSSFrameConstructor::GetAnonymousContent(
cachedStyles[i]->EqualForCachedAnonymousContentStyle(*cs),
"cached anonymous content styles should be identical to those we "
"would compute normally");
#ifdef ANDROID
MOZ_ASSERT(cs->StyleUI()->mPointerEvents == StylePointerEvents::None);
#endif
#endif
Servo_SetExplicitStyle(elements[i], cachedStyles[i]);
}