Bug 1714524 - Don't draw native theme focus outlines if the author specifies a non-auto outline. r=mstange

While this doesn't match traditional Gecko behavior, the non-native
theme has much more opinionated focus outlines so I think this makes
sense.

It also matches Safari and Chrome, afaict.

Differential Revision: https://phabricator.services.mozilla.com/D116831
This commit is contained in:
Emilio Cobos Álvarez 2021-06-08 12:16:08 +00:00
parent 5a1587ef38
commit c413e19eec
5 changed files with 21 additions and 1 deletions

View File

@ -9,6 +9,7 @@
<html:style xmlns:html="http://www.w3.org/1999/xhtml" type="text/css">
* { outline: none; }
#b3 { outline: auto }
#l1:-moz-focusring, #l3:-moz-focusring, #b1:-moz-focusring { outline: 2px solid red; }
#l2:focus, #b2:focus { outline: 2px solid red; }
</html:style>

View File

@ -0,0 +1,7 @@
<!doctype html>
<style>
input {
outline: 1px solid green;
}
</style>
<input>

View File

@ -0,0 +1,8 @@
<!doctype html>
<style>
input:focus {
outline: 1px solid green;
caret-color: transparent;
}
</style>
<input autofocus>

View File

@ -13,6 +13,7 @@ skip-if(nativeThemePref) == outline-auto-002.html outline-auto-002-ref.html
pref(layout.css.outline-style-auto.enabled,false) == outline-auto-001.html outline-auto-001-solid-ref.html
skip-if(nativeThemePref) != outline-auto-follows-border-radius-non-native.html outline-auto-follows-border-radius-non-native-notref.html
skip-if(nativeThemePref) == outline-auto-follows-border-radius-non-native-02.html outline-auto-follows-border-radius-non-native.html
needs-focus skip-if(nativeThemePref) == outline-auto-suppressed-native-widget.html outline-auto-suppressed-native-widget-ref.html
== outline-initial-1a.html outline-initial-1-ref.html
== outline-initial-1b.html outline-initial-1-ref.html
== outline-on-table.html outline-on-table-ref.html

View File

@ -1812,7 +1812,10 @@ bool nsNativeBasicTheme::DoDrawWidgetBackground(PaintBackendData& aPaintData,
}
}
if (aDrawOverflow == DrawOverflow::No) {
// Don't paint the outline if we're asked not to draw overflow, or if the
// author has specified another kind of outline on focus.
if (aDrawOverflow == DrawOverflow::No ||
!aFrame->StyleOutline()->mOutlineStyle.IsAuto()) {
eventState &= ~NS_EVENT_STATE_FOCUSRING;
}