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

Side by Side Diff: LayoutTests/csswg/contributors/adobe/submitted/shapes/shape-outside/resources/subpixel-utils.js

Issue 200633005: [CSS Shapes] Remove deprecated shapes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase against ToR Created 6 years, 9 months 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
OLDNEW
(Empty)
1 var SubPixelLayout = (function() {
2 var SUBPIXELS_PER_PIXEL = 64;
3 var enabled = undefined;
4
5 function isEnabled()
6 {
7 if (enabled === undefined) {
8 var elem = document.createElement('div');
9 elem.style.setProperty('width', '4.5px');
10 document.body.appendChild(elem);
11 var bounds = elem.getBoundingClientRect();
12 enabled = (bounds.width != Math.floor(bounds.width));
13 document.body.removeChild(elem);
14 }
15 return enabled;
16 }
17
18 return {
19 isEnabled: isEnabled,
20 snapToLayoutUnit: function(f) {
21 return isEnabled() ? Math.floor(f * SUBPIXELS_PER_PIXEL) / SUBPIXELS _PER_PIXEL : Math.floor(f); // as in LayoutUnit(f).toFloat()
22 },
23 ceilSnapToLayoutUnit: function(f) {
24 return isEnabled() ? Math.ceil(f * SUBPIXELS_PER_PIXEL) / SUBPIXELS_ PER_PIXEL : Math.ceil(f); // see ceiledLayoutUnit(), LayoutUnit.h
25 }
26 }
27 }());
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698