Bug 1689327 - Resizers for non-themed scrollable content shouldn't be themed. r=NeilDeakin

Right now the resizer inside a random <div style="overflow: hidden"> is
the themed one, and that seems unintended.

I'm not sure how to best test this since resizers are sized to a
scrollbar width, so I can't just position an <img src=resizer.svg>.

I noticed this while looking at bug 1689253.

Differential Revision: https://phabricator.services.mozilla.com/D103304
This commit is contained in:
Emilio Cobos Álvarez 2021-02-20 00:15:42 +00:00
parent 6825bbc8f8
commit 8aefb5feca

View File

@ -192,7 +192,9 @@ bool nsNativeTheme::IsWidgetStyled(nsPresContext* aPresContext,
nsIFrame* aFrame,
StyleAppearance aAppearance) {
// Check for specific widgets to see if HTML has overridden the style.
if (!aFrame) return false;
if (!aFrame) {
return false;
}
// Resizers have some special handling, dependent on whether in a scrollable
// container or not. If so, use the scrollable container's to determine
@ -204,12 +206,18 @@ bool nsNativeTheme::IsWidgetStyled(nsPresContext* aPresContext,
if (parentFrame && parentFrame->IsScrollFrame()) {
// if the parent is a scrollframe, the resizer should be native themed
// only if the scrollable area doesn't override the widget style.
//
// note that the condition below looks a bit suspect but it's the right
// one. If there's no valid appearance, then we should return true, it's
// effectively the same as if it had overridden the appearance.
parentFrame = parentFrame->GetParent();
if (parentFrame) {
return IsWidgetStyled(
aPresContext, parentFrame,
parentFrame->StyleDisplay()->EffectiveAppearance());
if (!parentFrame) {
return false;
}
auto parentAppearance =
parentFrame->StyleDisplay()->EffectiveAppearance();
return parentAppearance == StyleAppearance::None ||
IsWidgetStyled(aPresContext, parentFrame, parentAppearance);
}
}