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

Unified Diff: LayoutTests/fast/css/parsing-unitless-length-quirk.html

Issue 764703002: Support unit-less lengths for white-list of properties only. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: min-width/height still accepts unitless lengths Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/css/parsing-unitless-length-quirk.html
diff --git a/LayoutTests/fast/css/parsing-unitless-length-quirk.html b/LayoutTests/fast/css/parsing-unitless-length-quirk.html
new file mode 100644
index 0000000000000000000000000000000000000000..4a6774e2298db06ba820468bc7be6cb6ed4090fd
--- /dev/null
+++ b/LayoutTests/fast/css/parsing-unitless-length-quirk.html
@@ -0,0 +1,221 @@
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<style>
+#t1 { border-top-width: 1 }
+#t2 { border-right-width: 1 }
+#t3 { border-bottom-width: 1 }
+#t4 { border-left-width: 1 }
+#t5 { border-width: 1 }
+#t6 { bottom: 1 }
+#t7 { clip: rect(1 1 1 1) }
+#t8 { font-size: 1 }
+#t9 { height: 1 }
+#t10 { left: 1 }
+#t11 { letter-spacing: 1 }
+#t12 { margin-right: 1 }
+#t13 { margin-left: 1 }
+#t14 { margin-top: 1 }
+#t15 { margin-bottom: 1 }
+#t16 { margin: 1 }
+#t17 { padding-right: 1 }
+#t18 { padding-left: 1 }
+#t19 { padding-top: 1 }
+#t20 { padding-bottom: 1 }
+#t21 { padding: 1 }
+#t22 { right: 1 }
+#t23 { top: 1 }
+#t24 { width: 1 }
+#t25 { word-spacing: 1 }
+#t26 { border-top: 1 }
+#t27 { border-right: 1 }
+#t28 { border-bottom: 1 }
+#t29 { border-left: 1 }
+#t30 { border-spacing: 10 }
+#t31 { border-spacing: 10 20 }
+#t32 { border-top: 10 double #ff0000 }
+#t33 { border-top: 10px double ff0000 }
+#t34 { border-top: 10px double #ff0000 }
+#t35 { border-top: 10 double ff0000 }
+#t36 { border: 10 solid #ff0000 }
+#t37 { border: 10px solid ff0000 }
+#t38 { border: 10px solid #ff0000 }
+#t39 { border: 10 solid ff0000 }
+#t40 { font: 10 }
+#t41 { font: 10 / 20 }
+#t42 { background-position: 10 }
+#t43 { background-position: 10 20 }
+#t44 { background: #ff0000 10 }
+#t45 { background: ff0000 10px }
+#t46 { background: #ff0000 10px }
+#t47 { background: ff0000 10 }
+#t48 { text-indent: 10 }
+#t49 { outline-width: 10 }
+#t50 { min-width: 10 }
+#t51 { min-height: 10 }
+#t52 { max-width: 10 }
+#t53 { max-height: 10 }
+</style>
+<script>
+var sheet = document.styleSheets[0];
+test(function(){ assert_true(!!sheet); }, "StyleSheet present");
+test(function(){ assert_equals(sheet.cssRules.length, 53); }, "All rules parsed");
+test(function(){
+ assert_equals(sheet.cssRules[0].style.borderTopWidth, "1px");
+}, "Unitless length quirk for border-top-width property");
+test(function(){
+ assert_equals(sheet.cssRules[1].style.borderRightWidth, "1px");
+}, "Unitless length quirk for border-right-width property");
+test(function(){
+ assert_equals(sheet.cssRules[2].style.borderBottomWidth, "1px");
+}, "Unitless length quirk for border-bottom-width property");
+test(function(){
+ assert_equals(sheet.cssRules[3].style.borderLeftWidth, "1px");
+}, "Unitless length quirk for border-left-width property");
+test(function(){
+ assert_equals(sheet.cssRules[4].style.borderWidth, "1px");
+}, "Unitless length quirk for border-width property");
+test(function(){
+ assert_equals(sheet.cssRules[5].style.bottom, "1px");
+}, "Unitless length quirk for bottom property");
+test(function(){
+ assert_equals(sheet.cssRules[6].style.clip, "rect(1px 1px 1px 1px)");
+}, "Unitless length quirk for clip property");
+test(function(){
+ assert_equals(sheet.cssRules[7].style.fontSize, "1px");
+}, "Unitless length quirk for font-size property");
+test(function(){
+ assert_equals(sheet.cssRules[8].style.height, "1px");
+}, "Unitless length quirk for height property");
+test(function(){
+ assert_equals(sheet.cssRules[9].style.left, "1px");
+}, "Unitless length quirk for left property");
+test(function(){
+ assert_equals(sheet.cssRules[10].style.letterSpacing, "1px");
+}, "Unitless length quirk for letter-spacing property");
+test(function(){
+ assert_equals(sheet.cssRules[11].style.marginRight, "1px");
+}, "Unitless length quirk for margin-right property");
+test(function(){
+ assert_equals(sheet.cssRules[12].style.marginLeft, "1px");
+}, "Unitless length quirk for margin-left property");
+test(function(){
+ assert_equals(sheet.cssRules[13].style.marginTop, "1px");
+}, "Unitless length quirk for margin-top property");
+test(function(){
+ assert_equals(sheet.cssRules[14].style.marginBottom, "1px");
+}, "Unitless length quirk for margin-bottom property");
+test(function(){
+ assert_equals(sheet.cssRules[15].style.margin, "1px");
+}, "Unitless length quirk for margin property");
+test(function(){
+ assert_equals(sheet.cssRules[16].style.paddingRight, "1px");
+}, "Unitless length quirk for padding-right property");
+test(function(){
+ assert_equals(sheet.cssRules[17].style.paddingLeft, "1px");
+}, "Unitless length quirk for padding-left property");
+test(function(){
+ assert_equals(sheet.cssRules[18].style.paddingTop, "1px");
+}, "Unitless length quirk for padding-top property");
+test(function(){
+ assert_equals(sheet.cssRules[19].style.paddingBottom, "1px");
+}, "Unitless length quirk for padding-bottom property");
+test(function(){
+ assert_equals(sheet.cssRules[20].style.padding, "1px");
+}, "Unitless length quirk for padding property");
+test(function(){
+ assert_equals(sheet.cssRules[21].style.right, "1px");
+}, "Unitless length quirk for right property");
+test(function(){
+ assert_equals(sheet.cssRules[22].style.top, "1px");
+}, "Unitless length quirk for top property");
+test(function(){
+ assert_equals(sheet.cssRules[23].style.width, "1px");
+}, "Unitless length quirk for width property");
+test(function(){
+ assert_equals(sheet.cssRules[24].style.wordSpacing, "1px");
+}, "Unitless length quirk for word-spacing property");
+test(function(){
+ assert_equals(sheet.cssRules[25].style.borderTop, "");
+}, "No unitless length quirk for border-top property");
+test(function(){
+ assert_equals(sheet.cssRules[26].style.borderRight, "");
+}, "No unitless length quirk for border-right property");
+test(function(){
+ assert_equals(sheet.cssRules[27].style.borderBottom, "");
+}, "No unitless length quirk for border-bottom property");
+test(function(){
+ assert_equals(sheet.cssRules[28].style.borderLeft, "");
+}, "No unitless length quirk for border-left property");
+test(function(){
+ assert_equals(sheet.cssRules[29].style.borderSpacing, "10px");
+}, "Unitless length quirk for border-spacing property");
+test(function(){
+ assert_equals(sheet.cssRules[30].style.borderSpacing, "10px 20px");
+}, "Unitless length quirk for border-spacing property");
+test(function(){
+ assert_equals(sheet.cssRules[31].style.borderTop, "");
+}, "No unitless length quirk for border-top property");
+test(function(){
+ assert_equals(sheet.cssRules[32].style.borderTop, "");
+}, "No unitless length quirk for border-top property");
+test(function(){
+ assert_equals(sheet.cssRules[33].style.borderTop, "10px double rgb(255, 0, 0)");
+}, "Unitless length quirk for border-top property");
+test(function(){
+ assert_equals(sheet.cssRules[34].style.borderTop, "");
+}, "No unitless length quirk for border-top property");
+test(function(){
+ assert_equals(sheet.cssRules[35].style.border, "");
+}, "No unitless length quirk for border property");
+test(function(){
+ assert_equals(sheet.cssRules[36].style.border, "");
+}, "No unitless length quirk for border property");
+test(function(){
+ assert_equals(sheet.cssRules[37].style.border, "10px solid rgb(255, 0, 0)");
+}, "Unitless length quirk for border property");
+test(function(){
+ assert_equals(sheet.cssRules[38].style.border, "");
+}, "No unitless length quirk for border property");
+test(function(){
+ assert_equals(sheet.cssRules[39].style.font, "");
+}, "No unitless length quirk for font property");
+test(function(){
+ assert_equals(sheet.cssRules[40].style.font, "");
+}, "No unitless length quirk for font property");
+test(function(){
+ assert_equals(sheet.cssRules[41].style.backgroundPosition, "10px 50%");
+}, "Unitless length quirk for background-position property");
+test(function(){
+ assert_equals(sheet.cssRules[42].style.backgroundPosition, "10px 20px");
+}, "Unitless length quirk for background-position property");
+test(function(){
+ assert_equals(sheet.cssRules[43].style.background, "");
+}, "No unitless length quirk for background property");
+test(function(){
+ assert_equals(sheet.cssRules[44].style.background, "");
+}, "No unitless length quirk for background property");
+test(function(){
+ assert_equals(sheet.cssRules[45].style.background, "10px 50% rgb(255, 0, 0)");
+}, "No unitless length quirk for background property");
+test(function(){
+ assert_equals(sheet.cssRules[46].style.background, "");
+}, "No unitless length quirk for background property");
+test(function(){
+ assert_equals(sheet.cssRules[47].style.textIndent, "10px");
+}, "Unitless length quirk for text-indent property");
+test(function(){
+ assert_equals(sheet.cssRules[48].style.outlineWidth, "");
+}, "No unitless length quirk for outline-width property");
+test(function(){
+ assert_equals(sheet.cssRules[49].style.minWidth, "10px");
+}, "Unitless length quirk for min-width property");
+test(function(){
+ assert_equals(sheet.cssRules[50].style.minHeight, "10px");
+}, "Unitless length quirk for min-height property");
+test(function(){
+ assert_equals(sheet.cssRules[51].style.maxWidth, "10px");
+}, "Unitless length quirk for max-width property");
+test(function(){
+ assert_equals(sheet.cssRules[52].style.maxHeight, "10px");
+}, "Unitless length quirk for max-height property");
+</script>

Powered by Google App Engine
This is Rietveld 408576698