mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 935056 - Don't apply minimum font sizes to SVG text. r=heycam
Differential Revision: https://phabricator.services.mozilla.com/D74581
This commit is contained in:
parent
0da2867bf2
commit
5fa0ddbf8f
11
layout/reftests/bugs/935056-1-ref.html
Normal file
11
layout/reftests/bugs/935056-1-ref.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<meta charset=utf-8>
|
||||||
|
<style>
|
||||||
|
* { margin: 3px; }
|
||||||
|
p { font: 32px serif; }
|
||||||
|
text { font: 16px serif; }
|
||||||
|
</style>
|
||||||
|
<p>This text should be affected by the minimum font size.</p>
|
||||||
|
<svg width="800" height="40">
|
||||||
|
<text x="10" y="20">This text should not be affected by the minimum font size.</text>
|
||||||
|
</svg>
|
10
layout/reftests/bugs/935056-1.html
Normal file
10
layout/reftests/bugs/935056-1.html
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<meta charset=utf-8>
|
||||||
|
<style>
|
||||||
|
* { margin: 3px; }
|
||||||
|
p, text { font: 16px serif; }
|
||||||
|
</style>
|
||||||
|
<p>This text should be affected by the minimum font size.</p>
|
||||||
|
<svg width="800" height="40">
|
||||||
|
<text x="10" y="20">This text should not be affected by the minimum font size.</text>
|
||||||
|
</svg>
|
@ -1773,6 +1773,7 @@ fuzzy-if(skiaContent,0-1,0-3) == 931464-1.html 931464-1-ref.html
|
|||||||
== 931853.html 931853-ref.html
|
== 931853.html 931853-ref.html
|
||||||
== 931853-quirks.html 931853-quirks-ref.html
|
== 931853-quirks.html 931853-quirks-ref.html
|
||||||
== 933264-1.html 933264-1-ref.html
|
== 933264-1.html 933264-1-ref.html
|
||||||
|
test-pref(font.minimum-size.x-western,32) fuzzy-if(Android,0-45,0-324) == 935056-1.html 935056-1-ref.html
|
||||||
random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 936670-1.svg 936670-1-ref.svg # Bug 1392106
|
random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 936670-1.svg 936670-1-ref.svg # Bug 1392106
|
||||||
== 941940-1.html 941940-1-ref.html
|
== 941940-1.html 941940-1-ref.html
|
||||||
fails == 942017.html 942017-ref.html # bug 942017
|
fails == 942017.html 942017-ref.html # bug 942017
|
||||||
|
@ -1354,9 +1354,10 @@ void Gecko_nsStyleFont_PrioritizeUserFonts(
|
|||||||
|
|
||||||
nscoord Gecko_nsStyleFont_ComputeMinSize(const nsStyleFont* aFont,
|
nscoord Gecko_nsStyleFont_ComputeMinSize(const nsStyleFont* aFont,
|
||||||
const Document* aDocument) {
|
const Document* aDocument) {
|
||||||
// Don't change font-size:0, since that would un-hide hidden text, nor chrome
|
// Don't change font-size:0, since that would un-hide hidden text,
|
||||||
// docs, we assume those know what they do.
|
// or SVG text, or chrome docs, we assume those know what they do.
|
||||||
if (aFont->mSize == 0 || nsContentUtils::IsChromeDoc(aDocument)) {
|
if (aFont->mSize == 0 || !aFont->mAllowZoomAndMinSize ||
|
||||||
|
nsContentUtils::IsChromeDoc(aDocument)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2162,7 +2162,7 @@ bool nsComputedDOMStyle::GetLineHeightCoord(nscoord& aCoord) {
|
|||||||
// the text zoom, if any.
|
// the text zoom, if any.
|
||||||
const nsStyleFont* font = StyleFont();
|
const nsStyleFont* font = StyleFont();
|
||||||
float fCoord = float(aCoord);
|
float fCoord = float(aCoord);
|
||||||
if (font->mAllowZoom) {
|
if (font->mAllowZoomAndMinSize) {
|
||||||
fCoord /= presContext->EffectiveTextZoom();
|
fCoord /= presContext->EffectiveTextZoom();
|
||||||
}
|
}
|
||||||
if (font->mFont.size != font->mSize) {
|
if (font->mFont.size != font->mSize) {
|
||||||
|
@ -231,7 +231,7 @@ nsStyleFont::nsStyleFont(const nsStyleFont& aSrc)
|
|||||||
mMathDisplay(aSrc.mMathDisplay),
|
mMathDisplay(aSrc.mMathDisplay),
|
||||||
mMinFontSizeRatio(aSrc.mMinFontSizeRatio),
|
mMinFontSizeRatio(aSrc.mMinFontSizeRatio),
|
||||||
mExplicitLanguage(aSrc.mExplicitLanguage),
|
mExplicitLanguage(aSrc.mExplicitLanguage),
|
||||||
mAllowZoom(aSrc.mAllowZoom),
|
mAllowZoomAndMinSize(aSrc.mAllowZoomAndMinSize),
|
||||||
mScriptUnconstrainedSize(aSrc.mScriptUnconstrainedSize),
|
mScriptUnconstrainedSize(aSrc.mScriptUnconstrainedSize),
|
||||||
mScriptMinSize(aSrc.mScriptMinSize),
|
mScriptMinSize(aSrc.mScriptMinSize),
|
||||||
mScriptSizeMultiplier(aSrc.mScriptSizeMultiplier),
|
mScriptSizeMultiplier(aSrc.mScriptSizeMultiplier),
|
||||||
@ -252,7 +252,7 @@ nsStyleFont::nsStyleFont(const Document& aDocument)
|
|||||||
mMathDisplay(NS_MATHML_DISPLAYSTYLE_INLINE),
|
mMathDisplay(NS_MATHML_DISPLAYSTYLE_INLINE),
|
||||||
mMinFontSizeRatio(100), // 100%
|
mMinFontSizeRatio(100), // 100%
|
||||||
mExplicitLanguage(false),
|
mExplicitLanguage(false),
|
||||||
mAllowZoom(true),
|
mAllowZoomAndMinSize(true),
|
||||||
mScriptUnconstrainedSize(mSize),
|
mScriptUnconstrainedSize(mSize),
|
||||||
mScriptMinSize(nsPresContext::CSSTwipsToAppUnits(
|
mScriptMinSize(nsPresContext::CSSTwipsToAppUnits(
|
||||||
NS_POINTS_TO_TWIPS(NS_MATHML_DEFAULT_SCRIPT_MIN_SIZE_PT))),
|
NS_POINTS_TO_TWIPS(NS_MATHML_DEFAULT_SCRIPT_MIN_SIZE_PT))),
|
||||||
@ -269,8 +269,9 @@ nsStyleFont::nsStyleFont(const Document& aDocument)
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsChangeHint nsStyleFont::CalcDifference(const nsStyleFont& aNewData) const {
|
nsChangeHint nsStyleFont::CalcDifference(const nsStyleFont& aNewData) const {
|
||||||
MOZ_ASSERT(mAllowZoom == aNewData.mAllowZoom,
|
MOZ_ASSERT(
|
||||||
"expected mAllowZoom to be the same on both nsStyleFonts");
|
mAllowZoomAndMinSize == aNewData.mAllowZoomAndMinSize,
|
||||||
|
"expected mAllowZoomAndMinSize to be the same on both nsStyleFonts");
|
||||||
if (mSize != aNewData.mSize || mLanguage != aNewData.mLanguage ||
|
if (mSize != aNewData.mSize || mLanguage != aNewData.mLanguage ||
|
||||||
mExplicitLanguage != aNewData.mExplicitLanguage ||
|
mExplicitLanguage != aNewData.mExplicitLanguage ||
|
||||||
mMathVariant != aNewData.mMathVariant ||
|
mMathVariant != aNewData.mMathVariant ||
|
||||||
|
@ -121,8 +121,9 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleFont {
|
|||||||
bool mExplicitLanguage;
|
bool mExplicitLanguage;
|
||||||
|
|
||||||
// should calls to ZoomText() and UnZoomText() be made to the font
|
// should calls to ZoomText() and UnZoomText() be made to the font
|
||||||
// size on this nsStyleFont?
|
// size on this nsStyleFont? Also used to prevent SVG text from being
|
||||||
bool mAllowZoom;
|
// affected by minimum font size pref.
|
||||||
|
bool mAllowZoomAndMinSize;
|
||||||
|
|
||||||
// The value mSize would have had if scriptminsize had never been applied
|
// The value mSize would have had if scriptminsize had never been applied
|
||||||
nscoord mScriptUnconstrainedSize;
|
nscoord mScriptUnconstrainedSize;
|
||||||
|
@ -920,8 +920,8 @@ impl<'a, 'b: 'a> Cascade<'a, 'b> {
|
|||||||
|
|
||||||
let builder = &mut self.context.builder;
|
let builder = &mut self.context.builder;
|
||||||
|
|
||||||
let parent_zoom = builder.get_parent_font().gecko().mAllowZoom;
|
let parent_zoom = builder.get_parent_font().gecko().mAllowZoomAndMinSize;
|
||||||
let zoom = builder.get_font().gecko().mAllowZoom;
|
let zoom = builder.get_font().gecko().mAllowZoomAndMinSize;
|
||||||
if zoom == parent_zoom {
|
if zoom == parent_zoom {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -968,7 +968,7 @@ impl<'a, 'b: 'a> Cascade<'a, 'b> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let mut min = Au(parent_font.mScriptMinSize);
|
let mut min = Au(parent_font.mScriptMinSize);
|
||||||
if font.mAllowZoom {
|
if font.mAllowZoomAndMinSize {
|
||||||
min = builder.device.zoom_text(min);
|
min = builder.device.zoom_text(min);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1108,12 +1108,12 @@ fn static_assert() {
|
|||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn set__x_text_zoom(&mut self, v: longhands::_x_text_zoom::computed_value::T) {
|
pub fn set__x_text_zoom(&mut self, v: longhands::_x_text_zoom::computed_value::T) {
|
||||||
self.gecko.mAllowZoom = v.0;
|
self.gecko.mAllowZoomAndMinSize = v.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn copy__x_text_zoom_from(&mut self, other: &Self) {
|
pub fn copy__x_text_zoom_from(&mut self, other: &Self) {
|
||||||
self.gecko.mAllowZoom = other.gecko.mAllowZoom;
|
self.gecko.mAllowZoomAndMinSize = other.gecko.mAllowZoomAndMinSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
@ -1123,7 +1123,7 @@ fn static_assert() {
|
|||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn clone__x_text_zoom(&self) -> longhands::_x_text_zoom::computed_value::T {
|
pub fn clone__x_text_zoom(&self) -> longhands::_x_text_zoom::computed_value::T {
|
||||||
longhands::_x_text_zoom::computed_value::T(self.gecko.mAllowZoom)
|
longhands::_x_text_zoom::computed_value::T(self.gecko.mAllowZoomAndMinSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
<% impl_simple_type_with_conversion("font_language_override", "mFont.languageOverride") %>
|
<% impl_simple_type_with_conversion("font_language_override", "mFont.languageOverride") %>
|
||||||
|
@ -223,8 +223,8 @@ impl<'a> Context<'a> {
|
|||||||
pub fn maybe_zoom_text(&self, size: CSSPixelLength) -> CSSPixelLength {
|
pub fn maybe_zoom_text(&self, size: CSSPixelLength) -> CSSPixelLength {
|
||||||
// We disable zoom for <svg:text> by unsetting the
|
// We disable zoom for <svg:text> by unsetting the
|
||||||
// -x-text-zoom property, which leads to a false value
|
// -x-text-zoom property, which leads to a false value
|
||||||
// in mAllowZoom
|
// in mAllowZoomAndMinSize
|
||||||
if self.style().get_font().gecko.mAllowZoom {
|
if self.style().get_font().gecko.mAllowZoomAndMinSize {
|
||||||
self.device().zoom_text(Au::from(size)).into()
|
self.device().zoom_text(Au::from(size)).into()
|
||||||
} else {
|
} else {
|
||||||
size
|
size
|
||||||
|
Loading…
Reference in New Issue
Block a user