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

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2020-04-04 12:39:56 +00:00
Родитель 958e711f07
Коммит 84a2155141
2 изменённых файлов: 14 добавлений и 1 удалений

Просмотреть файл

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

Просмотреть файл

@ -20,6 +20,13 @@ xul|scrollbar {
display: block; display: block;
} }
/* We don't show resizers on android, so they may as well have
* pointer-events: none to simplify scrollbar caching */
xul|resizer,
xul|scrollcorner {
pointer-events: none;
}
xul|scrollbar[orient="vertical"] { xul|scrollbar[orient="vertical"] {
min-width: 6px; min-width: 6px;
max-width: 6px; max-width: 6px;