Reset mUnderlineOffset on all platforms when user font set generation is bumped. (Bug 523717) r=jdaggett
authorL. David Baron <dbaron@dbaron.org>
Fri, 11 Dec 2009 08:13:20 -0800
changeset 35580 b06d6479f8a4d7be44d715795a2859a7dc41d830
parent 35579 e26f15a70aac0aa10877c9c31978e7fd95a2c35e
child 35581 180966423a3c8f87a1af9ff894a4c22d5d35e106
push idunknown
push userunknown
push dateunknown
reviewersjdaggett
bugs523717
milestone1.9.3a1pre
Reset mUnderlineOffset on all platforms when user font set generation is bumped. (Bug 523717) r=jdaggett
gfx/thebes/src/gfxCoreTextFonts.cpp
gfx/thebes/src/gfxPangoFonts.cpp
layout/reftests/font-face/reftest.list
layout/reftests/font-face/underline-offset-change-1-ref.html
layout/reftests/font-face/underline-offset-change-1.html
layout/reftests/font-face/underline-offset-change-2-ref.html
layout/reftests/font-face/underline-offset-change-2.html
layout/reftests/fonts/mark-generate.py
layout/reftests/fonts/mark2A-highunderline.ttf
layout/reftests/fonts/mark2A-lowunderline.ttf
layout/reftests/fonts/markA-highunderline.ttf
layout/reftests/fonts/markA-lowunderline.ttf
--- a/gfx/thebes/src/gfxCoreTextFonts.cpp
+++ b/gfx/thebes/src/gfxCoreTextFonts.cpp
@@ -1359,12 +1359,13 @@ gfxCoreTextFontGroup::WhichSystemFontSup
 
 void
 gfxCoreTextFontGroup::UpdateFontList()
 {
     // if user font set is set, check to see if font list needs updating
     if (mUserFontSet && mCurrGeneration != GetGeneration()) {
         // xxx - can probably improve this to detect when all fonts were found, so no need to update list
         mFonts.Clear();
+        mUnderlineOffset = UNDERLINE_OFFSET_NOT_SET;
         ForEachFont(FindCTFont, this);
         mCurrGeneration = GetGeneration();
     }
 }
--- a/gfx/thebes/src/gfxPangoFonts.cpp
+++ b/gfx/thebes/src/gfxPangoFonts.cpp
@@ -1943,16 +1943,17 @@ gfxPangoFontGroup::UpdateFontList()
         return;
 
     PRUint64 newGeneration = mUserFontSet->GetGeneration();
     if (newGeneration == mCurrGeneration)
         return;
 
     mFonts[0] = NULL;
     mFontSets.Clear();
+    mUnderlineOffset = UNDERLINE_OFFSET_NOT_SET;
     mCurrGeneration = newGeneration;
 }
 
 already_AddRefed<gfxFcPangoFontSet>
 gfxPangoFontGroup::MakeFontSet(PangoLanguage *aLang, gfxFloat aSizeAdjustFactor,
                                nsAutoRef<FcPattern> *aMatchPattern)
 {
     const char *lang = pango_language_to_string(aLang);
--- a/layout/reftests/font-face/reftest.list
+++ b/layout/reftests/font-face/reftest.list
@@ -108,8 +108,13 @@ HTTP(..) == 507960-1-woff-hint.html 5079
 HTTP(..) == 507960-1-bad-checksums-ttf.html 507960-1-ref.html
 HTTP(..) == 507960-1-bad-checksums-woff.html 507960-1-ref.html
 # try versions that should NOT load (bad offsets, signatures, hint)
 HTTP(..) != 507960-1-bad-sfnt-version-ttf.html 507960-1-ref.html
 HTTP(..) != 507960-1-bad-sfnt-version-woff.html 507960-1-ref.html
 HTTP(..) != 507960-1-bad-woff-sig.html 507960-1-ref.html
 HTTP(..) != 507960-1-bad-offset-woff.html 507960-1-ref.html
 HTTP(..) != 507960-1-woff-bad-hint.html 507960-1-ref.html
+
+# Bug 523717
+HTTP(..) == underline-offset-change-1.html underline-offset-change-1-ref.html
+HTTP(..) == underline-offset-change-2.html underline-offset-change-2-ref.html
+fails-if(MOZ_WIDGET_TOOLKIT=="cocoa") fails-if(MOZ_WIDGET_TOOLKIT=="windows") HTTP(..) != underline-offset-change-1-ref.html underline-offset-change-2-ref.html # Bug 534132
new file mode 100644
--- /dev/null
+++ b/layout/reftests/font-face/underline-offset-change-1-ref.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
+	"http://www.w3.org/TR/html4/strict.dtd">
+<html lang="en-US">
+<head>
+	<title>Switching first font to one with higher underline (reference)</title>
+	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+	<style type="text/css">
+
+	@font-face {
+		font-family: "Mark2AHighUnderline";
+		src: url(../fonts/mark2A-highunderline.ttf);
+	}
+
+	body { font-family: "Mark2AHighUnderline"; }
+
+	p { text-decoration: underline; border: blue solid; padding: 0.2em; }
+
+	</style>
+</head>
+<body>
+
+<p style="position:relative; width: -moz-max-content">A</p>
+
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/font-face/underline-offset-change-1.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
+	"http://www.w3.org/TR/html4/strict.dtd">
+<html lang="en-US" class="reftest-wait">
+<head>
+	<title>Switching first font to one with higher underline</title>
+	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+	<style type="text/css">
+
+	@font-face {
+		font-family: "Mark2AHighUnderline";
+		src: url(../fonts/mark2A-highunderline.ttf);
+	}
+
+	</style>
+	<style type="text/css">
+
+	@font-face {
+		font-family: "MarkALowUnderline";
+		src: url(../fonts/markA-lowunderline.ttf);
+	}
+
+	body { font-family: "Mark2AHighUnderline", "MarkALowUnderline"; }
+
+	p { text-decoration: underline; border: blue solid; padding: 0.2em; }
+
+	</style>
+	<script type="application/ecmascript">
+
+	document.getElementsByTagName("style")[0].disabled = true;
+
+	function run() {
+		// The resize-detector iframe will remove the class attribute.
+		document.getElementsByTagName("iframe")[0].contentWindow.arm_for_wider();
+
+		document.getElementsByTagName("style")[0].disabled = false;
+	}
+
+	</script>
+</head>
+<body onload="setTimeout(run, 20)">
+
+<p style="position:relative; width: -moz-max-content">A<iframe style="visibility:hidden;position:absolute;height:100%;width:100%" src="resize-detector-iframe.html"></iframe></p>
+
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/font-face/underline-offset-change-2-ref.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
+	"http://www.w3.org/TR/html4/strict.dtd">
+<html lang="en-US">
+<head>
+	<title>Switching first font to one with lower underline (reference)</title>
+	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+	<style type="text/css">
+
+	@font-face {
+		font-family: "Mark2ALowUnderline";
+		src: url(../fonts/mark2A-lowunderline.ttf);
+	}
+
+	body { font-family: "Mark2ALowUnderline"; }
+
+	p { text-decoration: underline; border: blue solid; padding: 0.2em; }
+
+	</style>
+</head>
+<body>
+
+<p style="position:relative; width: -moz-max-content">A</p>
+
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/font-face/underline-offset-change-2.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
+	"http://www.w3.org/TR/html4/strict.dtd">
+<html lang="en-US" class="reftest-wait">
+<head>
+	<title>Switching first font to one with lower underline</title>
+	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+	<style type="text/css">
+
+	@font-face {
+		font-family: "Mark2ALowUnderline";
+		src: url(../fonts/mark2A-lowunderline.ttf);
+	}
+
+	</style>
+	<style type="text/css">
+
+	@font-face {
+		font-family: "MarkAHighUnderline";
+		src: url(../fonts/markA-highunderline.ttf);
+	}
+
+	body { font-family: "Mark2ALowUnderline", "MarkAHighUnderline"; }
+
+	p { text-decoration: underline; border: blue solid; padding: 0.2em; }
+
+	</style>
+	<script type="application/ecmascript">
+
+	document.getElementsByTagName("style")[0].disabled = true;
+
+	function run() {
+		// The resize-detector iframe will remove the class attribute.
+		document.getElementsByTagName("iframe")[0].contentWindow.arm_for_wider();
+
+		document.getElementsByTagName("style")[0].disabled = false;
+	}
+
+	</script>
+</head>
+<body onload="setTimeout(run, 20)">
+
+<p style="position:relative; width: -moz-max-content">A<iframe style="visibility:hidden;position:absolute;height:100%;width:100%" src="resize-detector-iframe.html"></iframe></p>
+
+</body>
+</html>
--- a/layout/reftests/fonts/mark-generate.py
+++ b/layout/reftests/fonts/mark-generate.py
@@ -63,8 +63,30 @@ for codepoint in range(ord("A"), ord("D"
 
         g = f.createChar(codepoint, charname)
         g.importOutlines("mark" + mark + "-glyph.svg")
         g.width = width
 
         f.generate("mark" + mark + charname + ".ttf")
         f.generate("mark" + mark + charname + ".otf")
 
+
+for codepoint in range(ord("A"), ord("A") + 1):
+    for (mark, width) in [("", 1500), ("2", 1800)]:
+        for (uposname, upos) in [("low", -350), ("high", -50)]:
+            charname = chr(codepoint)
+            f = fontforge.font()
+            n = "Mark" + mark + charname
+            f.fontname = n
+            f.familyname = n
+            f.fullname = n
+            f.descent = 400
+            f.upos = upos
+            f.uwidth = 100
+            f.copyright = "Copyright (c) 2008 Mozilla Corporation"
+    
+            g = f.createChar(codepoint, charname)
+            g.importOutlines("mark" + mark + "-glyph.svg")
+            g.width = width
+    
+            f.generate("mark" + mark + charname + "-" + uposname +
+                       "underline.ttf")
+    
new file mode 100644
index 0000000000000000000000000000000000000000..eb483093e1a5d364ed8348760fd90e197a17702a
GIT binary patch
literal 1524
zc%02tOK1~882)B=v#DAi#RuX8#wSr|+(al<gEm%!2crc`6$E8T)+Cs8!#0W)4}zXV
z#FKbXyoh)b+lv<u;z7leH$8ahMNmZaP*Fh}znM&9eSt@3nf<^2_02!C|11Q6xi||O
z1G(H_e(=qu>p<)Utt<8)*pxo_JeUB)A?ibgnqS9!`#tpsoI49A8xjfYGhjRPJ0*Xl
z-fWTyv1imfO4ZS0htFT>r+*RkGv&Z9P7W`>LHv@lr%c1_RD3SElz(lx);P6zDK1jK
zOMO8#Echs6kog_dXV?5wb?m_w`g^I%VZRoPy<O(ge;KeA*29rT^D#<X|0ew#q4vi4
zDSxYWbbjU|<~WKMkF#$pZJ7Yvo3>Q-!a{2>M_a0KwJ!adY36XW#cAhQI!oF5kZf_p
zJH#YnWa_l{P`}-hRv)&B9+lwEYP0>sK5%Szkt|tcZ8=p(RaerEVMPfe)hrU)X09+X
z8EQi74y3NKRc)5vM!%a6r`d%2V{u`beasxc?)y)}{)d?Vd*~i!zo=(B)G6?cMVTjW
zBaY;lz^2T2+`+r_m>YYU8MiG$jM>T@Q|9rwE52sNg|ct%TGh2~bJv=L=$m@|;e#!|
zP9&^nJjtT!B<nsI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