forked from mirrors/gecko-dev
Bug 1852457 - Simplify nsITheme::ThemeWantsButtonInnerFocusRing(). r=jfkthame,layout-reviewers
In practice, this is only ever true on the native windows theme. All other themes return true for ThemeDrawsFocusForWidget for Button and Menulist, which are the relevant appearance values here. So make this more explicit. Differential Revision: https://phabricator.services.mozilla.com/D187856
This commit is contained in:
parent
38d7173959
commit
d12231ae7a
4 changed files with 8 additions and 28 deletions
|
|
@ -235,17 +235,8 @@ class nsITheme : public nsISupports {
|
|||
*/
|
||||
virtual bool ThemeDrawsFocusForWidget(nsIFrame*, StyleAppearance) = 0;
|
||||
|
||||
/**
|
||||
* Whether we want an inner focus ring for buttons and such.
|
||||
*
|
||||
* Usually, we don't want it if we have our own focus indicators, but windows
|
||||
* is special, because it wants it even though focus also alters the border
|
||||
* color and such.
|
||||
*/
|
||||
virtual bool ThemeWantsButtonInnerFocusRing(nsIFrame* aFrame,
|
||||
StyleAppearance aAppearance) {
|
||||
return !ThemeDrawsFocusForWidget(aFrame, aAppearance);
|
||||
}
|
||||
// Whether we want an inner focus ring for buttons and menulists.
|
||||
virtual bool ThemeWantsButtonInnerFocusRing() { return false; }
|
||||
|
||||
/**
|
||||
* Should we insert a dropmarker inside of combobox button?
|
||||
|
|
|
|||
|
|
@ -81,12 +81,9 @@ nsresult nsButtonFrameRenderer::DisplayButton(nsDisplayListBuilder* aBuilder,
|
|||
|
||||
// Only display focus rings if we actually have them. Since at most one
|
||||
// button would normally display a focus ring, most buttons won't have them.
|
||||
const auto* disp = mFrame->StyleDisplay();
|
||||
nsPresContext* pc = mFrame->PresContext();
|
||||
if (mInnerFocusStyle && mInnerFocusStyle->StyleBorder()->HasBorder() &&
|
||||
mFrame->IsThemed(disp) &&
|
||||
pc->Theme()->ThemeWantsButtonInnerFocusRing(
|
||||
mFrame, disp->EffectiveAppearance())) {
|
||||
mFrame->IsThemed() &&
|
||||
mFrame->PresContext()->Theme()->ThemeWantsButtonInnerFocusRing()) {
|
||||
aForeground->AppendNewToTop<nsDisplayButtonForeground>(aBuilder, GetFrame(),
|
||||
this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -916,15 +916,9 @@ void nsComboboxControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||
}
|
||||
|
||||
// draw a focus indicator only when focus rings should be drawn
|
||||
if (mContent->AsElement()->State().HasState(dom::ElementState::FOCUSRING)) {
|
||||
nsPresContext* pc = PresContext();
|
||||
const nsStyleDisplay* disp = StyleDisplay();
|
||||
if (IsThemed(disp) &&
|
||||
pc->Theme()->ThemeWantsButtonInnerFocusRing(
|
||||
this, disp->EffectiveAppearance()) &&
|
||||
mDisplayFrame && IsVisibleForPainting()) {
|
||||
aLists.Content()->AppendNewToTop<nsDisplayComboboxFocus>(aBuilder, this);
|
||||
}
|
||||
if (Select().State().HasState(dom::ElementState::FOCUSRING) && IsThemed() &&
|
||||
PresContext()->Theme()->ThemeWantsButtonInnerFocusRing()) {
|
||||
aLists.Content()->AppendNewToTop<nsDisplayComboboxFocus>(aBuilder, this);
|
||||
}
|
||||
|
||||
DisplaySelectionOverlay(aBuilder, aLists.Content());
|
||||
|
|
|
|||
|
|
@ -80,9 +80,7 @@ class nsNativeThemeWin : public Theme {
|
|||
|
||||
bool ThemeDrawsFocusForWidget(nsIFrame*, StyleAppearance) override;
|
||||
|
||||
bool ThemeWantsButtonInnerFocusRing(nsIFrame*, StyleAppearance) override {
|
||||
return true;
|
||||
}
|
||||
bool ThemeWantsButtonInnerFocusRing() override { return true; }
|
||||
|
||||
bool ThemeNeedsComboboxDropmarker() override;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue