Bug 1780075 - Remove outline-style: auto pref. r=layout-reviewers,dholbert

All platforms support it, so just assert instead.

Differential Revision: https://phabricator.services.mozilla.com/D152109
This commit is contained in:
Emilio Cobos Álvarez 2022-07-19 09:25:11 +00:00
parent cfaffe8d11
commit 3b6039fcf1
5 changed files with 15 additions and 58 deletions

View File

@ -9745,25 +9745,15 @@ static void ComputeAndIncludeOutlineArea(nsIFrame* aFrame,
SetOrUpdateRectValuedProperty(aFrame, nsIFrame::OutlineInnerRectProperty(),
innerRect);
}
const nscoord offset = outline->mOutlineOffset.ToAppUnits();
nsRect outerRect(innerRect);
bool useOutlineAuto = false;
if (StaticPrefs::layout_css_outline_style_auto_enabled()) {
useOutlineAuto = outline->mOutlineStyle.IsAuto();
if (MOZ_UNLIKELY(useOutlineAuto)) {
nsPresContext* presContext = aFrame->PresContext();
nsITheme* theme = presContext->Theme();
if (theme->ThemeSupportsWidget(presContext, aFrame,
StyleAppearance::FocusOutline)) {
outerRect.Inflate(offset);
theme->GetWidgetOverflow(presContext->DeviceContext(), aFrame,
StyleAppearance::FocusOutline, &outerRect);
} else {
useOutlineAuto = false;
}
}
}
if (MOZ_LIKELY(!useOutlineAuto)) {
if (outline->mOutlineStyle.IsAuto()) {
nsPresContext* pc = aFrame->PresContext();
outerRect.Inflate(offset);
pc->Theme()->GetWidgetOverflow(pc->DeviceContext(), aFrame,
StyleAppearance::FocusOutline, &outerRect);
} else {
nscoord width = outline->GetOutlineWidth();
outerRect.Inflate(width + offset);
}

View File

@ -4034,15 +4034,14 @@ void nsDisplayOutline::Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) {
}
bool nsDisplayOutline::IsThemedOutline() const {
const auto& outlineStyle = mFrame->StyleOutline()->mOutlineStyle;
if (!outlineStyle.IsAuto() ||
!StaticPrefs::layout_css_outline_style_auto_enabled()) {
return false;
}
#ifdef DEBUG
nsPresContext* pc = mFrame->PresContext();
nsITheme* theme = pc->Theme();
return theme->ThemeSupportsWidget(pc, mFrame, StyleAppearance::FocusOutline);
MOZ_ASSERT(
pc->Theme()->ThemeSupportsWidget(pc, mFrame,
StyleAppearance::FocusOutline),
"All of our supported platforms have support for themed focus-outlines");
#endif
return mFrame->StyleOutline()->mOutlineStyle.IsAuto();
}
bool nsDisplayOutline::CreateWebRenderCommands(

View File

@ -1,25 +0,0 @@
<!DOCTYPE HTML>
<html><head>
<title>Testcase for outline:auto</title>
<style type="text/css">
html,body {
color:black; background-color:white; padding:10px; margin:0;
}
div { outline:solid; width:200px; margin:20px; height:20px; background:black; }
.b div { border:solid blue; border-width: 1px 3px 5px 7px; }
</style>
</head>
<body>
<div style="outline-width:0; outline-offset:0;"></div>
<div style="outline-width:0; outline-offset:5px;"></div>
<div style="outline-width:0; outline-offset:-5px;"></div>
<div style="outline-width:5px; outline-offset:1px;"></div>
<div style="outline-width:1px; outline-offset:0;"></div>
<div style="outline-width:1px; outline-offset:5px;"></div>
<div style="outline-width:1px; outline-offset:-5px;"></div>
</body>
</html>

View File

@ -8,9 +8,8 @@ fuzzy-if(gtkWidget,0-136,0-120) fuzzy-if(Android,0-255,0-356) fuzzy-if(d2d,0-16,
== outline-overflow-block-float.html outline-overflow-block-ref.html
== outline-overflow-inlineblock-abspos.html outline-overflow-inlineblock-ref.html
== outline-overflow-inlineblock-float.html outline-overflow-inlineblock-ref.html
pref(layout.css.outline-style-auto.enabled,true) skip-if(!gtkWidget&&!winWidget&&!cocoaWidget) == outline-auto-001.html outline-auto-001-ref.html # only works on platforms that supports StyleAppearance::FocusOutline
== outline-auto-001.html outline-auto-001-ref.html
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

View File

@ -8381,12 +8381,6 @@
value: 1000
mirror: always
# Is layout of CSS outline-style:auto enabled?
- name: layout.css.outline-style-auto.enabled
type: bool
value: true
mirror: always
# Pref to control enabling scroll anchoring.
- name: layout.css.scroll-anchoring.enabled
type: bool