| Index: LayoutTests/svg/text/text-rect-precision.html
|
| diff --git a/LayoutTests/svg/text/text-rect-precision.html b/LayoutTests/svg/text/text-rect-precision.html
|
| index b7587cd46b15cdfbedb58379290b59580c7e6b20..f05043d0d2082748b24a5799c688aab6eed4b2d8 100644
|
| --- a/LayoutTests/svg/text/text-rect-precision.html
|
| +++ b/LayoutTests/svg/text/text-rect-precision.html
|
| @@ -15,6 +15,15 @@
|
|
|
| var hasSubpixelPrecision = false;
|
|
|
| + function subpixelTolerance(testElement)
|
| + {
|
| + // Due to fixed-point rounding, each single-character measurement may differ by up to
|
| + // one LayoutUnit (i.e., 0.16 pixel) from the same character's measurement in the full
|
| + // string.
|
| + var str = testElement.firstChild.nodeValue;
|
| + return str.length * 0.16;
|
| + }
|
| +
|
| function measureText(testElement)
|
| {
|
| var measureElement = document.getElementById('measure');
|
| @@ -40,7 +49,7 @@
|
| var el = document.getElementById('test');
|
| var elementWidth = el.getBoundingClientRect().width;
|
| var textWidth = measureText(el);
|
| - var tolerance = hasSubpixelPrecision ? 0.1 : 2; // enclosing may expand up to one pixel in each direction.
|
| + var tolerance = hasSubpixelPrecision ? subpixelTolerance(el) : 2; // enclosing may expand up to one pixel in each direction.
|
| if (Math.abs(elementWidth - textWidth) <= tolerance)
|
| testPassed('Width of text element is the sum of the width of all characters.');
|
| else
|
|
|