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

Side by Side Diff: LayoutTests/fast/shapes/resources/simple-rectangle.js

Issue 200633005: [CSS Shapes] Remove deprecated shapes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix test expectations 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
1 function createRectangleTest(elementId, stylesheetId, bounds, shapeBounds, units , content) { 1 function createRectangleTest(elementId, stylesheetId, bounds, shapeBounds, units , content) {
2 var elem; 2 var elem;
3 if (elementId) 3 if (elementId)
4 elem = document.getElementById(elementId); 4 elem = document.getElementById(elementId);
5 else { 5 else {
6 elem = document.createElement('div'); 6 elem = document.createElement('div');
7 elem.setAttribute('id', elementId); 7 elem.setAttribute('id', elementId);
8 document.appendChild(elem); 8 document.appendChild(elem);
9 } 9 }
10 10
11 var stylesheet = document.getElementById(stylesheetId).sheet; 11 var stylesheet = document.getElementById(stylesheetId).sheet;
12 var rules = []; 12 var rules = [];
13 for (var i in bounds) 13 for (var i in bounds)
14 rules.push(i + ':' + bounds[i] + units); 14 rules.push(i + ':' + bounds[i] + units);
15 var rectangleBounds = [shapeBounds.x + units, shapeBounds.y + units, shapeBo unds.width + units, shapeBounds.height + units]; 15 var rectangleBounds = {
16 rules.push('shape-inside: rectangle(' + rectangleBounds.join(',') + ')'); 16 top: shapeBounds.x + units,
17 left: shapeBounds.y + units,
18 bottom: (shapeBounds.y + shapeBounds.height) + units,
19 right: (shapeBounds.x + shapeBounds.width) + units
20 };
21 rules.push('-webkit-shape-inside: polygon(' +
22 rectangleBounds.left + " " + rectangleBounds.top + "," +
23 rectangleBounds.right + " " + rectangleBounds.top + "," +
24 rectangleBounds.right + " " + rectangleBounds.bottom + "," +
25 rectangleBounds.left + " " + rectangleBounds.bottom + ')');
17 rules.push('position: relative'); 26 rules.push('position: relative');
18 rules.push('overflow-wrap: break-word'); 27 rules.push('overflow-wrap: break-word');
19 stylesheet.insertRule('#' + elementId + '{' + rules.join(';') + '}', 0); 28 stylesheet.insertRule('#' + elementId + '{' + rules.join(';') + '}', 0);
20 29
21 rules = []; 30 rules = [];
22 rules.push('left: ' + (shapeBounds.x - 1) + units, 'top: ' + (shapeBounds.y - 1) + units, 'width: ' + rectangleBounds[2], 'height: ' + rectangleBounds[3]); 31 rules.push('left: ' + (shapeBounds.x - 1) + units, 'top: ' + (shapeBounds.y - 1) + units, 'width: ' + shapeBounds.width + units, 'height: ' + shapeBounds.he ight + units);
23 rules.push('position: absolute', 'display: block', 'content: \' \''); 32 rules.push('position: absolute', 'display: block', 'content: \' \'');
24 rules.push('border: 1px solid blue'); 33 rules.push('border: 1px solid blue');
25 stylesheet.insertRule('#' + elementId + ':before{' + rules.join(';') + '}', 0); 34 stylesheet.insertRule('#' + elementId + ':before{' + rules.join(';') + '}', 0);
26 if (content) 35 if (content)
27 elem.innerHTML = content; 36 elem.innerHTML = content;
28 } 37 }
29 38
30 function createRectangleTestResult(elementId, stylesheetId, bounds, shapeBounds, units, content) { 39 function createRectangleTestResult(elementId, stylesheetId, bounds, shapeBounds, units, content) {
31 var elem; 40 var elem;
32 if (elementId) 41 if (elementId)
(...skipping 14 matching lines...) Expand all
47 stylesheet.insertRule('#' + elementId + '{' + rules.join(';') + '}', 0); 56 stylesheet.insertRule('#' + elementId + '{' + rules.join(';') + '}', 0);
48 57
49 rules = []; 58 rules = [];
50 rules.push('left: ' + (shapeBounds.x - 1) + units, 'top: ' + (shapeBounds.y - 1) + units, 'width: ' + shapeBounds.width + units, 'height: ' + shapeBounds.he ight + units); 59 rules.push('left: ' + (shapeBounds.x - 1) + units, 'top: ' + (shapeBounds.y - 1) + units, 'width: ' + shapeBounds.width + units, 'height: ' + shapeBounds.he ight + units);
51 rules.push('position: absolute', 'display: block', 'content: \' \''); 60 rules.push('position: absolute', 'display: block', 'content: \' \'');
52 rules.push('border: 1px solid blue'); 61 rules.push('border: 1px solid blue');
53 stylesheet.insertRule('#' + elementId + ':before{' + rules.join(';') + '}', 0); 62 stylesheet.insertRule('#' + elementId + ':before{' + rules.join(';') + '}', 0);
54 if (content) 63 if (content)
55 elem.innerHTML = content; 64 elem.innerHTML = content;
56 } 65 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698