Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / css / link-disabled-attr.html
blob115fac233e5746e4331632005e1e83ff38a5e5b9
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <link id="sheet" rel="stylesheet" href="data:tex/css,#test-element{text-decoration:line-through}">
5 <link id="notsheet" rel="author" href="mailto:nosuch@webkit.org">
6 <link id="alt" rel="alternate stylesheet" title="altset" href="resources/green.css">
7 <script src="../../resources/js-test.js"></script>
8 </head>
9 <body>
11 <span id="test-element"></span>
13 <script>
15 description("Series of tests to validate behavior of getting/setting link.disabled and link.sheet.disabled.<br>" +
16 'Test for bug <a href="https://bugs.webkit.org/show_bug.cgi?id=61400">61400</a>: REGRESSION(84329): Stylesheets on some pages do not load');
18 window.jsTestIsAsync = true;
20 function onSheetLoaded(f, elem, maxtime) {
21 if (elem.sheet || maxtime <= 0)
22 f(elem);
23 else
24 setTimeout(function () { onSheetLoaded(f, elem, maxtime - 25);}, 25);
29 // With a non-stylesheet <link>, 'disabled' is always false.
31 var testElement = document.getElementById("test-element");
32 var originalBG = getComputedStyle(testElement).backgroundColor;
33 var link;
35 debug("notsheet");
37 link = document.getElementById("notsheet");
38 shouldBeNull("link.sheet");
39 link.disabled = true;
40 shouldBeFalse("link.disabled");
43 // With a stylesheet <link>, 'disabled' and 'link.style.disabled' should both
44 // work, and be consistent with each other.
46 debug("sheet");
48 link = document.getElementById("sheet");
49 shouldBeNonNull("link.sheet");
51 link.sheet.disabled = true;
52 shouldBeTrue("link.disabled");
53 shouldBeTrue("link.sheet.disabled");
54 shouldBeEqualToString("getComputedStyle(testElement).textDecoration", "none solid rgb(0, 0, 0)");
56 link.disabled = false;
57 shouldBeFalse("link.disabled");
58 shouldBeFalse("link.sheet.disabled");
59 shouldBeEqualToString("getComputedStyle(testElement).textDecoration", "line-through");
61 link.sheet.disabled = false;
64 // An alternate stylesheet defaults to disabled when its title does not
65 // match the preferred set.
67 debug("altsheet");
68 link = document.getElementById("alt");
69 shouldBeTrue("link.disabled");
71 // Toggling link.disabled activates the stylesheet.
73 function altSheetLoaded(e) {
74 link = e;
75 shouldBeNonNull("link.sheet");
76 shouldBe("getComputedStyle(testElement).backgroundColor", "'rgb(0, 128, 0)'");
78 // Enabling a stylsheet set modifies disabled status of style sheets.
80 document.selectedStyleSheetSet = "nosuchset";
81 shouldBeTrue("link.disabled");
82 shouldBe("getComputedStyle(testElement).backgroundColor", "originalBG");
84 document.selectedStyleSheetSet = "altset";
85 shouldBeFalse("link.disabled");
86 shouldBe("getComputedStyle(testElement).backgroundColor", "'rgb(0, 128, 0)'");
88 // Disabling a stylesheet *after* its stylesheet set has been selected
89 // de-activates it.
91 link.disabled = true;
92 shouldBe("getComputedStyle(testElement).backgroundColor", "originalBG");
94 finishJSTest();
97 link.disabled = false;
98 onSheetLoaded(altSheetLoaded, link, 500);
100 </script>
101 </body></html>