mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-27 15:55:16 +00:00
Bug 1026641 - Put outline-style:auto rendering behind a pref and disable it by default. r=roc
This commit is contained in:
parent
1a6848ddaa
commit
8f40519109
@ -814,20 +814,22 @@ nsCSSRendering::PaintOutline(nsPresContext* aPresContext,
|
||||
gfxCornerSizes outlineRadii;
|
||||
ComputePixelRadii(twipsRadii, twipsPerPixel, &outlineRadii);
|
||||
|
||||
if (outlineStyle == NS_STYLE_BORDER_STYLE_AUTO) {
|
||||
nsITheme* theme = aPresContext->GetTheme();
|
||||
if (theme && theme->ThemeSupportsWidget(aPresContext, aForFrame,
|
||||
NS_THEME_FOCUS_OUTLINE)) {
|
||||
theme->DrawWidgetBackground(&aRenderingContext, aForFrame,
|
||||
NS_THEME_FOCUS_OUTLINE, innerRect,
|
||||
aDirtyRect);
|
||||
return;
|
||||
} else if (width == 0) {
|
||||
return; // empty outline
|
||||
if (nsLayoutUtils::IsOutlineStyleAutoEnabled()) {
|
||||
if (outlineStyle == NS_STYLE_BORDER_STYLE_AUTO) {
|
||||
nsITheme* theme = aPresContext->GetTheme();
|
||||
if (theme && theme->ThemeSupportsWidget(aPresContext, aForFrame,
|
||||
NS_THEME_FOCUS_OUTLINE)) {
|
||||
theme->DrawWidgetBackground(&aRenderingContext, aForFrame,
|
||||
NS_THEME_FOCUS_OUTLINE, innerRect,
|
||||
aDirtyRect);
|
||||
return;
|
||||
} else if (width == 0) {
|
||||
return; // empty outline
|
||||
}
|
||||
// http://dev.w3.org/csswg/css-ui/#outline
|
||||
// "User agents may treat 'auto' as 'solid'."
|
||||
outlineStyle = NS_STYLE_BORDER_STYLE_SOLID;
|
||||
}
|
||||
// http://dev.w3.org/csswg/css-ui/#outline
|
||||
// "User agents may treat 'auto' as 'solid'."
|
||||
outlineStyle = NS_STYLE_BORDER_STYLE_SOLID;
|
||||
}
|
||||
|
||||
uint8_t outlineStyles[4] = { outlineStyle, outlineStyle,
|
||||
|
@ -6795,3 +6795,18 @@ MaybeSetupTransactionIdAllocator(layers::LayerManager* aManager, nsView* aView)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
nsLayoutUtils::IsOutlineStyleAutoEnabled()
|
||||
{
|
||||
static bool sOutlineStyleAutoEnabled;
|
||||
static bool sOutlineStyleAutoPrefCached = false;
|
||||
|
||||
if (!sOutlineStyleAutoPrefCached) {
|
||||
sOutlineStyleAutoPrefCached = true;
|
||||
Preferences::AddBoolVarCache(&sOutlineStyleAutoEnabled,
|
||||
"layout.css.outline-style-auto.enabled",
|
||||
false);
|
||||
}
|
||||
return sOutlineStyleAutoEnabled;
|
||||
}
|
||||
|
@ -2278,6 +2278,8 @@ public:
|
||||
nsRect aDisplayPortBase,
|
||||
nsRect* aOutDisplayport);
|
||||
|
||||
static bool IsOutlineStyleAutoEnabled();
|
||||
|
||||
private:
|
||||
static uint32_t sFontSizeInflationEmPerLine;
|
||||
static uint32_t sFontSizeInflationMinTwips;
|
||||
|
@ -7147,17 +7147,20 @@ ComputeAndIncludeOutlineArea(nsIFrame* aFrame, nsOverflowAreas& aOverflowAreas,
|
||||
new nsRect(innerRect));
|
||||
const nscoord offset = outline->mOutlineOffset;
|
||||
nsRect outerRect(innerRect);
|
||||
bool useOutlineAuto = outlineStyle == NS_STYLE_BORDER_STYLE_AUTO;
|
||||
if (MOZ_UNLIKELY(useOutlineAuto)) {
|
||||
nsPresContext* presContext = aFrame->PresContext();
|
||||
nsITheme* theme = presContext->GetTheme();
|
||||
if (theme && theme->ThemeSupportsWidget(presContext, aFrame,
|
||||
NS_THEME_FOCUS_OUTLINE)) {
|
||||
outerRect.Inflate(offset);
|
||||
theme->GetWidgetOverflow(presContext->DeviceContext(), aFrame,
|
||||
NS_THEME_FOCUS_OUTLINE, &outerRect);
|
||||
} else {
|
||||
useOutlineAuto = false;
|
||||
bool useOutlineAuto = false;
|
||||
if (nsLayoutUtils::IsOutlineStyleAutoEnabled()) {
|
||||
useOutlineAuto = outlineStyle == NS_STYLE_BORDER_STYLE_AUTO;
|
||||
if (MOZ_UNLIKELY(useOutlineAuto)) {
|
||||
nsPresContext* presContext = aFrame->PresContext();
|
||||
nsITheme* theme = presContext->GetTheme();
|
||||
if (theme && theme->ThemeSupportsWidget(presContext, aFrame,
|
||||
NS_THEME_FOCUS_OUTLINE)) {
|
||||
outerRect.Inflate(offset);
|
||||
theme->GetWidgetOverflow(presContext->DeviceContext(), aFrame,
|
||||
NS_THEME_FOCUS_OUTLINE, &outerRect);
|
||||
} else {
|
||||
useOutlineAuto = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (MOZ_LIKELY(!useOutlineAuto)) {
|
||||
|
@ -6,4 +6,4 @@
|
||||
== 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
|
||||
skip-if(!gtk2Widget&&!winWidget&&!cocoaWidget) == outline-auto-001.html outline-auto-001-ref.html # only works on platforms that supports NS_THEME_FOCUS_OUTLINE
|
||||
pref(layout.css.outline-style-auto.enabled,true) skip-if(!gtk2Widget&&!winWidget&&!cocoaWidget) == outline-auto-001.html outline-auto-001-ref.html # only works on platforms that supports NS_THEME_FOCUS_OUTLINE
|
||||
|
@ -1967,6 +1967,9 @@ pref("layout.css.grid.enabled", false);
|
||||
// Is support for CSS box-decoration-break enabled?
|
||||
pref("layout.css.box-decoration-break.enabled", false);
|
||||
|
||||
// Is layout of CSS outline-style:auto enabled?
|
||||
pref("layout.css.outline-style-auto.enabled", false);
|
||||
|
||||
// pref for which side vertical scrollbars should be on
|
||||
// 0 = end-side in UI direction
|
||||
// 1 = end-side in document/content direction
|
||||
|
Loading…
x
Reference in New Issue
Block a user