Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Side by Side Diff: LayoutTests/imported/csswg-test/css-shapes-1/shape-outside/supported-shapes/support/subpixel-utils.js

Issue 816533002: Import CSSWG Shapes tests (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: One more test expectations update Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 var SubPixelLayout = (function() { 1 var SubPixelLayout = (function() {
2 var enabled = undefined; 2 var enabled = undefined;
3 3
4 function isEnabled() 4 function isEnabled()
5 { 5 {
6 if (enabled === undefined) { 6 if (enabled === undefined) {
7 var elem = document.createElement('div'); 7 var elem = document.createElement('div');
8 elem.style.setProperty('width', '4.5px'); 8 elem.style.setProperty('width', '4.5px');
9 document.body.appendChild(elem); 9 document.body.appendChild(elem);
10 var bounds = elem.getBoundingClientRect(); 10 var bounds = elem.getBoundingClientRect();
11 enabled = (bounds.width != Math.floor(bounds.width)); 11 enabled = (bounds.width != Math.floor(bounds.width));
12 document.body.removeChild(elem); 12 document.body.removeChild(elem);
13 } 13 }
14 return enabled; 14 return enabled;
15 } 15 }
16 16
17 return { 17 return {
18 isEnabled: isEnabled, 18 isEnabled: isEnabled,
19 snapToLayoutUnit: function(f) { 19 snapToLayoutUnit: function(f) {
20 return isEnabled() ? Math.floor(f * 64) / 64 : Math.floor(f); // as in LayoutUnit(f).toFloat() 20 return isEnabled() ? Math.floor(f * 64) / 64 : Math.floor(f); // as in LayoutUnit(f).toFloat()
21 }, 21 },
22 ceilToLayoutUnit: function(f) { 22 ceilSnapToLayoutUnit: function(f) {
23 return isEnabled() ? Math.ceil(f * 64) / 64 : Math.ceil(f); // see c eiledLayoutUnit(), LayoutUnit.h 23 return isEnabled() ? Math.ceil(f * 64) / 64 : Math.ceil(f); // see c eiledLayoutUnit(), LayoutUnit.h
24 },
25 resolution: function() {
26 return isEnabled() ? 1/64 : 1;
27 } 24 }
28 } 25 }
29 }()); 26 }());
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698