mirror of
https://github.com/servo/servo.git
synced 2025-08-15 10:25:32 +01:00
Update web-platform-tests to revision b'b728032f59a396243864b0f8584e7211e3632005'
This commit is contained in:
parent
ace9b32b1c
commit
df68c4e5d1
15632 changed files with 514865 additions and 155000 deletions
|
@ -44,7 +44,7 @@
|
|||
|
||||
test(function() {
|
||||
var results = setUpTest("5px", null);
|
||||
assert_equals(results[0], null);
|
||||
assert_equals(results[0], "");
|
||||
assert_equals(results[1], "0px");
|
||||
}, "shape-margin is not inherited and defaults to 0px");
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<link rel="author" title="Rebecca Hauck" href="mailto:rhauck@adobe.com">
|
||||
<link rel="reviewer" title="Alan Stearns" href="mailto:stearns@adobe.com"> <!-- 2014-03-04 -->
|
||||
<link rel="help" href="http://www.w3.org/TR/css-shapes-1/#shape-outside-property">
|
||||
<meta name="assert" content="shape-outside can be explictly assigned the default value of none.">
|
||||
<meta name="assert" content="shape-outside can be explicitly assigned the default value of none.">
|
||||
<meta name="flags" content="ahem dom">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
|
|
|
@ -30,6 +30,8 @@ function testShapeMarginInlineStyle(value, expected) {
|
|||
div.style.setProperty('shape-outside', "border-box inset(10px)");
|
||||
div.style.setProperty('shape-margin', value);
|
||||
var actual = div.style.getPropertyValue('shape-margin');
|
||||
actual = roundResultStr(actual);
|
||||
expected = roundResultStr(expected);
|
||||
assert_equals(actual, expected);
|
||||
}
|
||||
|
||||
|
@ -322,15 +324,20 @@ function setUnit(str, convert, unit1, unit2, unit3) {
|
|||
return retStr;
|
||||
}
|
||||
|
||||
function roundCssNumber(n) {
|
||||
// See https://drafts.csswg.org/cssom/#serializing-css-values for numbers.
|
||||
return parseFloat(n.toPrecision(6));
|
||||
}
|
||||
|
||||
function convertToPx(origValue) {
|
||||
|
||||
var valuesToConvert = origValue.match(/[0-9]+(\.[0-9]+)?([a-z]{2,4}|%)/g);
|
||||
var valuesToConvert = origValue.match(/[0-9]+(\.[0-9]+)?([a-z]{2,4}|%|)/g);
|
||||
if(!valuesToConvert)
|
||||
return origValue;
|
||||
|
||||
var retStr = origValue;
|
||||
for(var i = 0; i < valuesToConvert.length; i++) {
|
||||
var unit = valuesToConvert[i].match(/[a-z]{2,4}|%/).toString();
|
||||
var unit = (valuesToConvert[i].match(/[a-z]{2,4}|%/) || '').toString();
|
||||
var numberStr = valuesToConvert[i].match(/[0-9]+(\.[0-9]+)?/)[0];
|
||||
|
||||
var number = parseFloat(numberStr);
|
||||
|
@ -367,7 +374,7 @@ function convertToPx(origValue) {
|
|||
else {
|
||||
convertedUnit = unit;
|
||||
}
|
||||
number = Math.round(number * 1000) / 1000;
|
||||
number = roundCssNumber(number);
|
||||
var find = valuesToConvert[i];
|
||||
var replace = number.toString() + convertedUnit;
|
||||
retStr = retStr.replace(valuesToConvert[i], number.toString() + convertedUnit);
|
||||
|
@ -388,7 +395,7 @@ function roundResultStr(str) {
|
|||
for(var i = 0; i < numbersToRound.length; i++) {
|
||||
num = parseFloat(numbersToRound[i]);
|
||||
if( !isNaN(num) ) {
|
||||
roundedNum = Math.round(num*1000)/1000;
|
||||
roundedNum = roundCssNumber(num);
|
||||
retStr = retStr.replace(numbersToRound[i].toString(), roundedNum.toString());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue