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

Side by Side Diff: third_party/WebKit/LayoutTests/css-parser/resources/property-parsing-test.js

Issue 1475903002: Don't handle unitless length quirk in CSS parser fast path (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/css-parser/unitless-length-quirk.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // testharness.js and testharnessreport.js need to be included first 5 // testharness.js and testharnessreport.js need to be included first
6 6
7 // Properties should be given in camelCase format 7 // Properties should be given in camelCase format
8 8
9 function convert_to_dashes(property) { 9 function convert_to_dashes(property) {
10 return property.replace(/[A-Z]/g, function(letter) { 10 return property.replace(/[A-Z]/g, function(letter) {
11 return "-" + letter.toLowerCase(); 11 return "-" + letter.toLowerCase();
12 }); 12 });
13 } 13 }
14 14
15 function assert_valid_value(property, value, serializedValue) { 15 function assert_valid_value(property, value, serializedValue, quirksModeOnly) {
16 if (arguments.length != 3) 16 if (arguments.length < 4)
17 quirksModeOnly = false;
18
19 if (arguments.length < 3)
17 serializedValue = value; 20 serializedValue = value;
18 21
19 stringifiedValue = JSON.stringify(value); 22 stringifiedValue = JSON.stringify(value);
23 dashedProperty = convert_to_dashes(property);
20 24
21 test(function(){ 25 test(function(){
22 assert_true(CSS.supports(convert_to_dashes(property), value)); 26 assert_equals(!quirksModeOnly, CSS.supports(dashedProperty, value));
23 }, "CSS.supports('" + property + "', " + stringifiedValue + ") should return true"); 27 }, "CSS.supports('" + dashedProperty + "', " + stringifiedValue + ") should return " + !quirksModeOnly);
24 28
25 test(function(){ 29 test(function(){
26 var div = document.createElement('div'); 30 var div = document.createElement('div');
27 div.style[property] = value; 31 div.style[property] = value;
28 assert_not_equals(div.style[property], ""); 32 assert_not_equals(div.style[property], "");
29 }, "e.style['" + property + "'] = " + stringifiedValue + " should set the va lue"); 33 }, "e.style['" + property + "'] = " + stringifiedValue + " should set the va lue");
30 34
31 test(function(){ 35 test(function(){
32 var div = document.createElement('div'); 36 var div = document.createElement('div');
33 div.style[property] = value; 37 div.style[property] = value;
34 var readValue = div.style[property]; 38 var readValue = div.style[property];
35 assert_equals(readValue, serializedValue); 39 assert_equals(readValue, serializedValue);
36 div.style[property] = readValue; 40 div.style[property] = readValue;
37 assert_equals(div.style[property], readValue); 41 assert_equals(div.style[property], readValue);
38 }, "Serialization should round-trip after setting e.style['" + property + "' ] = " + stringifiedValue); 42 }, "Serialization should round-trip after setting e.style['" + property + "' ] = " + stringifiedValue);
39 } 43 }
40 44
41 function assert_invalid_value(property, value) { 45 function assert_invalid_value(property, value) {
42 stringifiedValue = JSON.stringify(value); 46 stringifiedValue = JSON.stringify(value);
47 dashedProperty = convert_to_dashes(property);
43 48
44 test(function(){ 49 test(function(){
45 assert_false(CSS.supports(convert_to_dashes(property), value)); 50 assert_false(CSS.supports(dashedProperty, value));
46 }, "CSS.supports('" + property + "', " + stringifiedValue + ") should return false"); 51 }, "CSS.supports('" + dashedProperty + "', " + stringifiedValue + ") should return false");
47 52
48 test(function(){ 53 test(function(){
49 var div = document.createElement('div'); 54 var div = document.createElement('div');
50 div.style[property] = value; 55 div.style[property] = value;
51 assert_equals(div.style[property], ""); 56 assert_equals(div.style[property], "");
52 }, "e.style['" + property + "'] = " + stringifiedValue + " should not set th e value"); 57 }, "e.style['" + property + "'] = " + stringifiedValue + " should not set th e value");
53 } 58 }
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/css-parser/unitless-length-quirk.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698