diff options
-rw-r--r-- | resources/shaders/es2_common.vs.glsl | 2 | ||||
-rw-r--r-- | resources/shaders/gl3_common.vs.glsl | 5 | ||||
-rw-r--r-- | tests/wpt/mozilla/meta/MANIFEST.json | 24 | ||||
-rw-r--r-- | tests/wpt/mozilla/meta/css/pixel_snapping_glyphs.html.ini | 4 | ||||
-rw-r--r-- | tests/wpt/mozilla/tests/css/pixel_snapping_glyphs.html | 5 | ||||
-rw-r--r-- | tests/wpt/mozilla/tests/css/pixel_snapping_glyphs_ref.html | 4 |
6 files changed, 42 insertions, 2 deletions
diff --git a/resources/shaders/es2_common.vs.glsl b/resources/shaders/es2_common.vs.glsl index ccb8c3dcec5..91d72015e49 100644 --- a/resources/shaders/es2_common.vs.glsl +++ b/resources/shaders/es2_common.vs.glsl @@ -65,6 +65,6 @@ vec2 SnapToPixels(vec2 pos) // Snap the vertex to pixel position to guarantee correct texture // sampling when using bilinear filtering. - // TODO(gw): ES2 doesn't have round(). Do we ever get negative coords here? + // TODO(gw): Do we ever get negative coords here? return floor(0.5 + pos * uDevicePixelRatio) / uDevicePixelRatio; } diff --git a/resources/shaders/gl3_common.vs.glsl b/resources/shaders/gl3_common.vs.glsl index cffcfc80eb7..e24cef9437e 100644 --- a/resources/shaders/gl3_common.vs.glsl +++ b/resources/shaders/gl3_common.vs.glsl @@ -62,5 +62,8 @@ vec2 SnapToPixels(vec2 pos) { // Snap the vertex to pixel position to guarantee correct texture // sampling when using bilinear filtering. - return round(pos * uDevicePixelRatio) / uDevicePixelRatio; + + // Don't use round() because its behavior is implementation-defined on 0.5. + // TODO: Do we ever get negative coords here? + return floor(0.5 + pos * uDevicePixelRatio) / uDevicePixelRatio; } diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index c274c632fd7..86965f1dc49 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -4022,6 +4022,18 @@ "viewport_size": "300x300" } ], + "css/pixel_snapping_glyphs.html": [ + { + "path": "css/pixel_snapping_glyphs.html", + "references": [ + [ + "/_mozilla/css/pixel_snapping_glyphs_ref.html", + "==" + ] + ], + "url": "/_mozilla/css/pixel_snapping_glyphs.html" + } + ], "css/pixel_snapping_position_a.html": [ { "dpi": "2", @@ -11122,6 +11134,18 @@ "viewport_size": "300x300" } ], + "css/pixel_snapping_glyphs.html": [ + { + "path": "css/pixel_snapping_glyphs.html", + "references": [ + [ + "/_mozilla/css/pixel_snapping_glyphs_ref.html", + "==" + ] + ], + "url": "/_mozilla/css/pixel_snapping_glyphs.html" + } + ], "css/pixel_snapping_position_a.html": [ { "dpi": "2", diff --git a/tests/wpt/mozilla/meta/css/pixel_snapping_glyphs.html.ini b/tests/wpt/mozilla/meta/css/pixel_snapping_glyphs.html.ini new file mode 100644 index 00000000000..76450e5e84d --- /dev/null +++ b/tests/wpt/mozilla/meta/css/pixel_snapping_glyphs.html.ini @@ -0,0 +1,4 @@ +[pixel_snapping_glyphs.html] + type: reftest + expected: + if os == "mac": FAIL diff --git a/tests/wpt/mozilla/tests/css/pixel_snapping_glyphs.html b/tests/wpt/mozilla/tests/css/pixel_snapping_glyphs.html new file mode 100644 index 00000000000..a423250c4d4 --- /dev/null +++ b/tests/wpt/mozilla/tests/css/pixel_snapping_glyphs.html @@ -0,0 +1,5 @@ +<!doctype html> +<meta charset="utf-8"> +<title>pixel snapping glyphs test</title> +<link rel="match" href="pixel_snapping_glyphs_ref.html"> +<div style="font: 13px 'Helvetica Neue'; padding: 0.5px;">illisible</div> diff --git a/tests/wpt/mozilla/tests/css/pixel_snapping_glyphs_ref.html b/tests/wpt/mozilla/tests/css/pixel_snapping_glyphs_ref.html new file mode 100644 index 00000000000..92ef1f14e7f --- /dev/null +++ b/tests/wpt/mozilla/tests/css/pixel_snapping_glyphs_ref.html @@ -0,0 +1,4 @@ +<!doctype html> +<meta charset="utf-8"> +<title>pixel snapping glyphs reference</title> +<div style="font: 13px 'Helvetica Neue'; padding: 1px;">illisible</div> |