Bug 1458159 - Use rounding instead of ceiling on max{Ascent,Descent} for DWriteFont. r=jfkthame

The ceiling was introduced in bug 549190 for improve the consistency of
underline positioning. However, removing ceiling now doesn't seem to
regress the testcases in that bug, probably thanks to improvement in
other part.

The ceiling here causes us to have different font metrics than other
browsers on Windows, and can lead to webcompat issue. We also don't do
this for other backends. So it's probably better removing it in favor
of rounding.

There are several test changes:

* min-intrinsic-with-percents-across-elements.html changes result due to
  height of wrapping div in reference page depends on line height, so a
  fixed line height is set to work around the issue.

* 368020-1.html changes result because a slightly different line-height
  triggers bug 1462514. It is changed to use fixed line-height to work
  around the issue.

* 456147.xul is disabled because it compares XUL against HTML page, but
  XUL has different approach to position text in its elements than HTML.
  Specifically, XUL elements don't seem to respect line height while
  HTML elements do. The original line height in the file was probably
  chosen to make the HTML match XUL, so it seems to be non-trivial to
  fix it in a platform-independent way.

* sizing-orthog-{vlr,vrl}-in-htb-{008,020}.xht fails due to text in <p>
  after the testing block shifts 1px up for unknown reason.

MozReview-Commit-ID: 2WJG1AigWl1

--HG--
extra : rebase_source : 540e68ffff618a6dc3c14b3702b2c042988061a3
This commit is contained in:
Xidorn Quan 2018-05-01 15:18:55 +10:00
Родитель 5247357739
Коммит 98bfde7521
11 изменённых файлов: 19 добавлений и 16 удалений

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

@ -203,8 +203,8 @@ gfxDWriteFont::ComputeMetrics(AntialiasOption anAAOption)
mMetrics->xHeight = fontMetrics.xHeight * mFUnitsConvFactor;
mMetrics->capHeight = fontMetrics.capHeight * mFUnitsConvFactor;
mMetrics->maxAscent = ceil(fontMetrics.ascent * mFUnitsConvFactor);
mMetrics->maxDescent = ceil(fontMetrics.descent * mFUnitsConvFactor);
mMetrics->maxAscent = round(fontMetrics.ascent * mFUnitsConvFactor);
mMetrics->maxDescent = round(fontMetrics.descent * mFUnitsConvFactor);
mMetrics->maxHeight = mMetrics->maxAscent + mMetrics->maxDescent;
mMetrics->emHeight = mAdjustedSize;

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

@ -5,7 +5,7 @@
</head>
<body>
<div style="-moz-column-count: 2; column-count: 2; -moz-column-fill: auto; height: 4.5em; background:yellow">
<div style="-moz-column-count: 2; column-count: 2; -moz-column-fill: auto; height: 72px; background:yellow; line-height: 16px">
<div style="margin: 7px 1% 2px 2em; border: medium dotted; border-width: 2px 3px 4px 5px;">
<div style="background: url(repeatable-diagonal-gradient.png);">

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

@ -5,7 +5,7 @@
</head>
<body>
<div style="-moz-column-count: 2; column-count: 2; -moz-column-fill: auto; height: 4.5em; background:yellow">
<div style="-moz-column-count: 2; column-count: 2; -moz-column-fill: auto; height: 72px; background:yellow; line-height: 16px">
<div>
<div style="background: url(repeatable-diagonal-gradient.png); background-clip: padding-box; background-clip: padding; background-origin: padding-box; background-origin: padding; margin: 7px 1% 2px 2em; border: medium dotted; border-width: 2px 3px 4px 5px; padding: 8px 6px 4px 2px;">

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

@ -1195,7 +1195,7 @@ fuzzy-if(webrender,4,361) == 449519-1.html 449519-1-ref.html
== 455171-5.html 455171-5-ref.html
== 455280-1.xhtml 455280-1-ref.xhtml
== 455826-1.html 455826-1-ref.html
fails-if(Android||cocoaWidget) fuzzy-if(webrender&&winWidget,222-222,2806-2806) == 456147.xul 456147-ref.html # bug 458047
fails-if(Android||cocoaWidget||winWidget) == 456147.xul 456147-ref.html # bug 458047
fuzzy-if(Android,11,41) fuzzy-if(winWidget||gtkWidget,4,6) fuzzy-if(d2d,15,69) fuzzy-if(skiaContent,42,154) == 456219-1a.html 456219-1-ref.html # bug 1128229
fuzzy-if(Android,11,41) fuzzy-if(winWidget||gtkWidget,4,6) fuzzy-if(d2d,15,69) fuzzy-if(skiaContent,42,154) == 456219-1b.html 456219-1-ref.html # bug 1128229
fuzzy-if(Android,11,41) fuzzy-if(winWidget||gtkWidget,4,6) fuzzy-if(d2d,15,69) fuzzy-if(skiaContent,42,154) == 456219-1c.html 456219-1-ref.html # bug 1128229

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

@ -3,6 +3,7 @@
<style>
body, input { font-size: 10px }
body { line-height: 1.5 }
input { padding: 0 1px; border: 1px solid maroon; font-family: monospace }
td:first-child {
@ -16,6 +17,7 @@ td:nth-child(2) {
}
td:nth-child(1) > * { vertical-align: bottom }
td:nth-child(1) > div > * { vertical-align: bottom }
canvas {
background: blue

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

@ -3,6 +3,7 @@
<style>
body, input { font-size: 10px }
body { line-height: 1.5 }
input { padding: 0 1px; border: 1px solid maroon; font-family: monospace }
td:first-child {

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

@ -92,7 +92,7 @@ fuzzy-if(skiaContent,1,12000) == float-in-rtl-4d.html float-in-rtl-4-ref.html
== float-in-rtl-vrl-4c.html float-in-rtl-vrl-4-ref.html
== float-in-rtl-vrl-4d.html float-in-rtl-vrl-4-ref.html
fuzzy-if(OSX==1010,28,11) fuzzy-if(Android,16,2) == orthogonal-floats-1a.html orthogonal-floats-1-ref.html
fuzzy-if(OSX==1010,28,11) == orthogonal-floats-1b.html orthogonal-floats-1-ref.html
fuzzy-if(OSX==1010,28,11) fuzzy-if(winWidget,137,3) == orthogonal-floats-1b.html orthogonal-floats-1-ref.html
fuzzy-if(OSX==1010,103,802) fuzzy-if(winWidget,135,700) == orthogonal-floats-1c.html orthogonal-floats-1-ref.html
fuzzy-if(OSX==1010,103,802) fuzzy-if(winWidget,135,700) == orthogonal-floats-1d.html orthogonal-floats-1-ref.html

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

@ -24,7 +24,7 @@ load ligature-with-space-1.html
== line-editing-1c.html line-editing-1-ref.html
== line-editing-1d.html line-editing-1-ref.html
== line-editing-1e.html line-editing-1-ref.html
fails-if(cocoaWidget||(winWidget&&dwrite)) == lineheight-metrics-1.html lineheight-metrics-1-ref.html # bug 657864
fails-if(cocoaWidget) == lineheight-metrics-1.html lineheight-metrics-1-ref.html # bug 657864
== lineheight-metrics-2a.html lineheight-metrics-2-ref.html
== lineheight-metrics-2b.html lineheight-metrics-2-ref.html
== lineheight-percentage-1.html lineheight-percentage-1-ref.html

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

@ -63,10 +63,10 @@ fails-if(OSX||winWidget||Android) css-writing-modes/sizing-orthog-htb-in-vlr-008
fails-if(OSX||winWidget||Android) css-writing-modes/sizing-orthog-htb-in-vlr-020.xht
fails-if(OSX||winWidget||Android) css-writing-modes/sizing-orthog-htb-in-vrl-008.xht
fails-if(OSX||winWidget||Android) css-writing-modes/sizing-orthog-htb-in-vrl-020.xht
css-writing-modes/sizing-orthog-vlr-in-htb-008.xht
css-writing-modes/sizing-orthog-vlr-in-htb-020.xht
css-writing-modes/sizing-orthog-vrl-in-htb-008.xht
css-writing-modes/sizing-orthog-vrl-in-htb-020.xht
fuzzy-if(winWidget,255,713) css-writing-modes/sizing-orthog-vlr-in-htb-008.xht
fuzzy-if(winWidget,255,713) css-writing-modes/sizing-orthog-vlr-in-htb-020.xht
fuzzy-if(winWidget,255,713) css-writing-modes/sizing-orthog-vrl-in-htb-008.xht
fuzzy-if(winWidget,255,713) css-writing-modes/sizing-orthog-vrl-in-htb-020.xht
fails-if(Android) css-writing-modes/sizing-orthog-htb-in-vlr-003.xht
fails-if(Android) css-writing-modes/sizing-orthog-htb-in-vlr-009.xht
fails-if(Android) css-writing-modes/sizing-orthog-htb-in-vlr-015.xht

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

@ -749,7 +749,7 @@ fails-if(Android) == css-writing-modes/sizing-orthog-vlr-in-htb-003.xht css-writ
== css-writing-modes/sizing-orthog-vlr-in-htb-004.xht css-writing-modes/sizing-orthog-vlr-in-htb-004-ref.xht
== css-writing-modes/sizing-orthog-vlr-in-htb-006.xht css-writing-modes/sizing-orthog-vlr-in-htb-006-ref.xht
== css-writing-modes/sizing-orthog-vlr-in-htb-007.xht css-writing-modes/sizing-orthog-vlr-in-htb-007-ref.xht
== css-writing-modes/sizing-orthog-vlr-in-htb-008.xht css-writing-modes/sizing-orthog-vlr-in-htb-008-ref.xht
fuzzy-if(winWidget,255,713) == css-writing-modes/sizing-orthog-vlr-in-htb-008.xht css-writing-modes/sizing-orthog-vlr-in-htb-008-ref.xht
fails-if(Android) == css-writing-modes/sizing-orthog-vlr-in-htb-009.xht css-writing-modes/sizing-orthog-vlr-in-htb-009-ref.xht
== css-writing-modes/sizing-orthog-vlr-in-htb-010.xht css-writing-modes/sizing-orthog-vlr-in-htb-010-ref.xht
== css-writing-modes/sizing-orthog-vlr-in-htb-011.xht css-writing-modes/sizing-orthog-vlr-in-htb-011-ref.xht
@ -759,7 +759,7 @@ fails-if(Android) == css-writing-modes/sizing-orthog-vlr-in-htb-015.xht css-writ
== css-writing-modes/sizing-orthog-vlr-in-htb-016.xht css-writing-modes/sizing-orthog-vlr-in-htb-016-ref.xht
== css-writing-modes/sizing-orthog-vlr-in-htb-018.xht css-writing-modes/sizing-orthog-vlr-in-htb-018-ref.xht
== css-writing-modes/sizing-orthog-vlr-in-htb-019.xht css-writing-modes/sizing-orthog-vlr-in-htb-019-ref.xht
== css-writing-modes/sizing-orthog-vlr-in-htb-020.xht css-writing-modes/sizing-orthog-vlr-in-htb-020-ref.xht
fuzzy-if(winWidget,255,713) == css-writing-modes/sizing-orthog-vlr-in-htb-020.xht css-writing-modes/sizing-orthog-vlr-in-htb-020-ref.xht
fails-if(Android) == css-writing-modes/sizing-orthog-vlr-in-htb-021.xht css-writing-modes/sizing-orthog-vlr-in-htb-015-ref.xht
== css-writing-modes/sizing-orthog-vlr-in-htb-022.xht css-writing-modes/sizing-orthog-vlr-in-htb-022-ref.xht
== css-writing-modes/sizing-orthog-vlr-in-htb-023.xht css-writing-modes/sizing-orthog-vlr-in-htb-023-ref.xht
@ -769,7 +769,7 @@ fails-if(Android) == css-writing-modes/sizing-orthog-vrl-in-htb-003.xht css-writ
== css-writing-modes/sizing-orthog-vrl-in-htb-004.xht css-writing-modes/sizing-orthog-vrl-in-htb-004-ref.xht
== css-writing-modes/sizing-orthog-vrl-in-htb-006.xht css-writing-modes/sizing-orthog-vrl-in-htb-006-ref.xht
== css-writing-modes/sizing-orthog-vrl-in-htb-007.xht css-writing-modes/sizing-orthog-vrl-in-htb-007-ref.xht
== css-writing-modes/sizing-orthog-vrl-in-htb-008.xht css-writing-modes/sizing-orthog-vrl-in-htb-008-ref.xht
fuzzy-if(winWidget,255,713) == css-writing-modes/sizing-orthog-vrl-in-htb-008.xht css-writing-modes/sizing-orthog-vrl-in-htb-008-ref.xht
fails-if(Android) == css-writing-modes/sizing-orthog-vrl-in-htb-009.xht css-writing-modes/sizing-orthog-vrl-in-htb-009-ref.xht
== css-writing-modes/sizing-orthog-vrl-in-htb-010.xht css-writing-modes/sizing-orthog-vrl-in-htb-010-ref.xht
== css-writing-modes/sizing-orthog-vrl-in-htb-011.xht css-writing-modes/sizing-orthog-vrl-in-htb-011-ref.xht
@ -779,7 +779,7 @@ fails-if(Android) == css-writing-modes/sizing-orthog-vrl-in-htb-015.xht css-writ
== css-writing-modes/sizing-orthog-vrl-in-htb-016.xht css-writing-modes/sizing-orthog-vrl-in-htb-016-ref.xht
== css-writing-modes/sizing-orthog-vrl-in-htb-018.xht css-writing-modes/sizing-orthog-vrl-in-htb-018-ref.xht
== css-writing-modes/sizing-orthog-vrl-in-htb-019.xht css-writing-modes/sizing-orthog-vrl-in-htb-019-ref.xht
== css-writing-modes/sizing-orthog-vrl-in-htb-020.xht css-writing-modes/sizing-orthog-vrl-in-htb-020-ref.xht
fuzzy-if(winWidget,255,713) == css-writing-modes/sizing-orthog-vrl-in-htb-020.xht css-writing-modes/sizing-orthog-vrl-in-htb-020-ref.xht
fails-if(Android) == css-writing-modes/sizing-orthog-vrl-in-htb-021.xht css-writing-modes/sizing-orthog-vrl-in-htb-015-ref.xht
== css-writing-modes/sizing-orthog-vrl-in-htb-022.xht css-writing-modes/sizing-orthog-vrl-in-htb-022-ref.xht
== css-writing-modes/sizing-orthog-vrl-in-htb-023.xht css-writing-modes/sizing-orthog-vrl-in-htb-023-ref.xht

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

@ -1,6 +1,6 @@
skip-if(!cocoaWidget) != 507947.html about:blank
== progressbar-fallback-default-style.html progressbar-fallback-default-style-ref.html
fuzzy-if(Android,17,1120) fuzzy-if(webrender&&winWidget,1-1,10-10) == meter-native-style.html meter-native-style-ref.html
fuzzy-if(Android,17,1120) fuzzy-if(webrender&&winWidget,1-1,5-5) == meter-native-style.html meter-native-style-ref.html
skip-if(!cocoaWidget) == meter-vertical-native-style.html meter-vertical-native-style-ref.html # dithering
== meter-fallback-default-style.html meter-fallback-default-style-ref.html
load 664925.xhtml