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-07 23:54:21 +00:00
Родитель 6c04a617e5
Коммит 83e940c1fd
4 изменённых файлов: 20 добавлений и 1 удалений

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

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

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

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

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

@ -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

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

@ -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;
}