Upstream version 5.34.98.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / fast / regions / script-tests / css-regions-disabled.js
1 description('Test that parsing of css regions related properties is disabled by default.');
2
3 if (window.testRunner)
4     window.testRunner.overridePreference("WebKitCSSRegionsEnabled", "0");
5
6 function testWebKitFlowInto(declaration) {
7     var div = document.createElement("div");
8     div.setAttribute("style", declaration);
9     return div.style.webkitFlowInto;
10 }
11
12 function testWebKitFlowFrom(declaration) {
13     var div = document.createElement("div");
14     div.setAttribute("style", declaration);
15     return div.style.webkitFlowFrom;
16 }
17
18 function testWebKitRegionFragment(declaration) {
19     var div = document.createElement("div");
20     div.setAttribute("style", declaration);
21     return div.style.webkitRegionFragment;
22 }
23
24 function testComputedStyleWebKitFlowInto(value) {
25     var div = document.createElement("div");
26     document.body.appendChild(div);
27     div.style.setProperty("-webkit-flow-into", value);
28     var computedValue = getComputedStyle(div).getPropertyValue("-webkit-flow-into");
29     document.body.removeChild(div);
30     return computedValue;
31 }
32
33 function testComputedStyleWebKitFlowFrom(value) {
34     var div = document.createElement("div");
35     document.body.appendChild(div);
36     div.style.setProperty("-webkit-flow-from", value);
37     var computedValue = getComputedStyle(div).getPropertyValue("-webkit-flow-from");
38     document.body.removeChild(div);
39     return computedValue;
40 }
41
42 function testComputedStyleWebKitRegionFragment(value) {
43     var div = document.createElement("div");
44     document.body.appendChild(div);
45     div.style.setProperty("-webkit-region-fragment", value);
46     var computedValue = getComputedStyle(div).getPropertyValue("-webkit-region-fragment");
47     document.body.removeChild(div);
48     return computedValue;
49 }
50
51 shouldBeEqualToString('testWebKitFlowInto("-webkit-flow-into: none")', "");
52 shouldBeEqualToString('testWebKitFlowInto("-webkit-flow-into: first-flow")', "");
53 shouldBeEqualToString('testComputedStyleWebKitFlowInto("none")', "none");
54 shouldBeEqualToString('testComputedStyleWebKitFlowInto("first-flow")', "none");
55
56 shouldBeEqualToString('testWebKitFlowFrom("-webkit-flow-from: first-flow")', "");
57 shouldBeEqualToString('testWebKitFlowFrom("-webkit-flow-from: none")', "");
58 shouldBeEqualToString('testComputedStyleWebKitFlowFrom("first-flow")', "none");
59 shouldBeEqualToString('testComputedStyleWebKitFlowFrom("none")', "none");
60
61 shouldBeEqualToString('testWebKitRegionFragment("-webkit-region-fragment: auto")', "");
62 shouldBeEqualToString('testWebKitRegionFragment("-webkit-region-fragment: break")', "");
63 shouldBeEqualToString('testComputedStyleWebKitRegionFragment("auto")', "auto");
64 shouldBeEqualToString('testComputedStyleWebKitRegionFragment("break")', "auto");
65
66 // Test that region styling rules are not parsed.
67 var styleElement = document.createElement("style");
68 document.head.appendChild(styleElement);
69 var stylesheet = styleElement.sheet;
70 webkitRegionRuleIndex = -1;
71 try {
72     webkitRegionRuleIndex = stylesheet.insertRule("@-webkit-region #region3 { p { color: red; } }");
73 } catch(err) {
74 }
75
76 shouldBe("webkitRegionRuleIndex", "-1");
77