Diff
Modified: trunk/LayoutTests/ChangeLog (110625 => 110626)
--- trunk/LayoutTests/ChangeLog 2012-03-13 22:36:05 UTC (rev 110625)
+++ trunk/LayoutTests/ChangeLog 2012-03-13 22:40:16 UTC (rev 110626)
@@ -1,3 +1,35 @@
+2012-03-13 Dave Tharp <[email protected]>
+
+ Alternate stylesheets (without title attribute) are loaded on refresh
+ https://bugs.webkit.org/show_bug.cgi?id=24354
+
+ Reviewed by David Hyatt.
+
+ Addapted alternate stylesheet tests from http://robballou.com/switcher/sandbox/alternate1.php
+
+ * fast/css/link-alternate-stylesheet-1-expected.txt: Added.
+ * fast/css/link-alternate-stylesheet-1.html: Added.
+ * fast/css/link-alternate-stylesheet-2-expected.txt: Added.
+ * fast/css/link-alternate-stylesheet-2.html: Added.
+ * fast/css/link-alternate-stylesheet-3-expected.txt: Added.
+ * fast/css/link-alternate-stylesheet-3.html: Added.
+ * fast/css/link-alternate-stylesheet-4-expected.txt: Added.
+ * fast/css/link-alternate-stylesheet-4.html: Added.
+ * fast/css/link-alternate-stylesheet-5-expected.txt: Added.
+ * fast/css/link-alternate-stylesheet-5.html: Added.
+ * fast/css/resources/basic.css: Added.
+ (body):
+ (code):
+ (#source):
+ * fast/css/resources/high.css: Added.
+ (body):
+ (h1):
+ * fast/css/resources/normal.css: Added.
+ (body):
+ (h1):
+ * fast/css/resources/small.css: Added.
+ (body):
+
2012-03-13 Jessie Berlin <[email protected]>
WKTR needs an implementation of setAsynchronousSpellCheckingEnabled.
Added: trunk/LayoutTests/fast/css/link-alternate-stylesheet-1-expected.txt (0 => 110626)
--- trunk/LayoutTests/fast/css/link-alternate-stylesheet-1-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/link-alternate-stylesheet-1-expected.txt 2012-03-13 22:40:16 UTC (rev 110626)
@@ -0,0 +1,18 @@
+Alternate stylesheet (link) title test 1
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS getComputedStyle(element).getPropertyValue('text-decoration') is 'underline'
+PASS getComputedStyle(element).getPropertyValue('font-size') is '12px'
+PASS getComputedStyle(document.body).getPropertyValue('border-top-color') is 'rgb(0, 128, 0)'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Alternate stylesheets
+
+This document has 3 stylesheets, with no alternate stylesheets. It should:
+
+Have a green border at the top of the page
+An underlined H1
+12px text
Added: trunk/LayoutTests/fast/css/link-alternate-stylesheet-1.html (0 => 110626)
--- trunk/LayoutTests/fast/css/link-alternate-stylesheet-1.html (rev 0)
+++ trunk/LayoutTests/fast/css/link-alternate-stylesheet-1.html 2012-03-13 22:40:16 UTC (rev 110626)
@@ -0,0 +1,41 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <link rel="stylesheet" href="" type="text/css">
+ <link rel="stylesheet" href="" type="text/css">
+ <link rel="stylesheet" href="" type="text/css">
+ <script src=""
+</head>
+<body>
+ <h1 id="firstH1" >Alternate stylesheets</h1>
+
+ <p id="textLine" >This document has 3 stylesheets, with no alternate stylesheets. It should:</p>
+
+ <ul>
+ <li>Have a green border at the top of the page</li>
+ <li>An underlined <code>H1</code></li>
+ <li>12px text</li>
+ </ul>
+
+ <script>
+ description("Alternate stylesheet (link) title test 1");
+
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ window._onload_ = function () {
+ element = document.getElementById("firstH1");
+ shouldBe("getComputedStyle(element).getPropertyValue('text-decoration')", "'underline'");
+
+ element = document.getElementById("textLine");
+ shouldBe("getComputedStyle(element).getPropertyValue('font-size')", "'12px'");
+
+ shouldBe("getComputedStyle(document.body).getPropertyValue('border-top-color')", "'rgb(0, 128, 0)'");
+
+ wasPostTestScriptParsed = true;
+ finishJSTest();
+ }
+ </script>
+
+</body>
+</html>
Added: trunk/LayoutTests/fast/css/link-alternate-stylesheet-2-expected.txt (0 => 110626)
--- trunk/LayoutTests/fast/css/link-alternate-stylesheet-2-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/link-alternate-stylesheet-2-expected.txt 2012-03-13 22:40:16 UTC (rev 110626)
@@ -0,0 +1,18 @@
+Alternate stylesheet (link) title test 2
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS getComputedStyle(element).getPropertyValue('text-decoration') is 'underline'
+PASS getComputedStyle(element).getPropertyValue('font-size') is '12px'
+PASS getComputedStyle(document.body).getPropertyValue('border-top-color') is 'rgb(0, 128, 0)'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Alternate stylesheets
+
+This document has 3 stylesheets, with 1 alternate stylesheet without title. It should:
+
+Have a green border at the top of the page
+An underlined H1
+12px text
Added: trunk/LayoutTests/fast/css/link-alternate-stylesheet-2.html (0 => 110626)
--- trunk/LayoutTests/fast/css/link-alternate-stylesheet-2.html (rev 0)
+++ trunk/LayoutTests/fast/css/link-alternate-stylesheet-2.html 2012-03-13 22:40:16 UTC (rev 110626)
@@ -0,0 +1,45 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <link rel="stylesheet" href="" type="text/css" />
+ <link rel="stylesheet" href="" type="text/css" />
+ <link rel="stylesheet" href="" type="text/css" />
+ <link rel="alternate stylesheet" href="" type="text/css" />
+ <script src=""
+</head>
+
+<body>
+ <h1 id="firstH1">Alternate stylesheets</h1>
+
+ <p id="textLine">This document has 3 stylesheets, with 1 alternate stylesheet without title. It should:</p>
+
+ <ul>
+ <li>Have a green border at the top of the page</li>
+ <li>An underlined <code>H1</code></li>
+ <li>12px text</li>
+ </ul>
+
+ <script>
+ description("Alternate stylesheet (link) title test 2");
+
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ window._onload_ = function () {
+ element = document.getElementById("firstH1");
+ shouldBe("getComputedStyle(element).getPropertyValue('text-decoration')", "'underline'");
+
+ element = document.getElementById("textLine");
+ shouldBe("getComputedStyle(element).getPropertyValue('font-size')", "'12px'");
+
+ shouldBe("getComputedStyle(document.body).getPropertyValue('border-top-color')", "'rgb(0, 128, 0)'");
+
+ wasPostTestScriptParsed = true;
+ finishJSTest();
+ }
+ </script>
+
+</body>
+</html>
Added: trunk/LayoutTests/fast/css/link-alternate-stylesheet-3-expected.txt (0 => 110626)
--- trunk/LayoutTests/fast/css/link-alternate-stylesheet-3-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/link-alternate-stylesheet-3-expected.txt 2012-03-13 22:40:16 UTC (rev 110626)
@@ -0,0 +1,18 @@
+Alternate stylesheet (link) title test 3
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS getComputedStyle(element).getPropertyValue('text-decoration') is 'underline'
+PASS getComputedStyle(element).getPropertyValue('font-size') is '12px'
+PASS getComputedStyle(document.body).getPropertyValue('border-top-color') is 'rgb(0, 128, 0)'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Alternate stylesheets
+
+This document has 3 stylesheets, with 1 alternate stylesheet which now has the added title attribute. It should:
+
+Have a green border at the top of the page
+An underlined H1
+12px text
Added: trunk/LayoutTests/fast/css/link-alternate-stylesheet-3.html (0 => 110626)
--- trunk/LayoutTests/fast/css/link-alternate-stylesheet-3.html (rev 0)
+++ trunk/LayoutTests/fast/css/link-alternate-stylesheet-3.html 2012-03-13 22:40:16 UTC (rev 110626)
@@ -0,0 +1,43 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <link rel="stylesheet" href="" type="text/css">
+ <link rel="stylesheet" href="" type="text/css">
+ <link rel="stylesheet" href="" type="text/css">
+ <link rel="alternate stylesheet" href="" title="Different layout" type="text/css">
+ <script src=""
+</head>
+<body>
+ <h1 id="firstH1">Alternate stylesheets</h1>
+
+ <p id="textLine">This document has 3 stylesheets, with 1 alternate stylesheet which now has the added <code>title</code>
+ attribute. It should:</p>
+
+ <ul>
+ <li>Have a green border at the top of the page</li>
+ <li>An underlined <code>H1</code></li>
+ <li>12px text</li>
+ </ul>
+
+ <script>
+ description("Alternate stylesheet (link) title test 3");
+
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ window._onload_ = function () {
+ element = document.getElementById("firstH1");
+ shouldBe("getComputedStyle(element).getPropertyValue('text-decoration')", "'underline'");
+
+ element = document.getElementById("textLine");
+ shouldBe("getComputedStyle(element).getPropertyValue('font-size')", "'12px'");
+
+ shouldBe("getComputedStyle(document.body).getPropertyValue('border-top-color')", "'rgb(0, 128, 0)'");
+
+ wasPostTestScriptParsed = true;
+ finishJSTest();
+ }
+ </script>
+
+</body>
+</html>
Added: trunk/LayoutTests/fast/css/link-alternate-stylesheet-4-expected.txt (0 => 110626)
--- trunk/LayoutTests/fast/css/link-alternate-stylesheet-4-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/link-alternate-stylesheet-4-expected.txt 2012-03-13 22:40:16 UTC (rev 110626)
@@ -0,0 +1,17 @@
+Alternate stylesheet (link) title test 4
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS getComputedStyle(element).getPropertyValue('text-decoration') is 'none'
+PASS getComputedStyle(element).getPropertyValue('font-size') is '12px'
+PASS getComputedStyle(document.body).getPropertyValue('border-top-color') is 'rgb(139, 0, 0)'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Alternate stylesheets
+
+This document has 4 stylesheets, with no alternate stylesheets but the "high.css" stylesheet now has a title attribute.
+
+Have a red border at the top of the page
+12px text
Added: trunk/LayoutTests/fast/css/link-alternate-stylesheet-4.html (0 => 110626)
--- trunk/LayoutTests/fast/css/link-alternate-stylesheet-4.html (rev 0)
+++ trunk/LayoutTests/fast/css/link-alternate-stylesheet-4.html 2012-03-13 22:40:16 UTC (rev 110626)
@@ -0,0 +1,42 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <link rel="stylesheet" href="" type="text/css">
+ <link rel="stylesheet" href="" type="text/css">
+ <link rel="stylesheet" href="" type="text/css">
+ <link rel="stylesheet" href="" title="Layout" type="text/css">
+ <script src=""
+</head>
+<body>
+ <h1 id="firstH1">Alternate stylesheets</h1>
+
+ <p id="textLine">This document has 4 stylesheets, with no alternate stylesheets but the "high.css" stylesheet now
+ has a title attribute.</p>
+
+ <ul>
+ <li>Have a red border at the top of the page</li>
+ <li>12px text</li>
+ </ul>
+
+ <script>
+ description("Alternate stylesheet (link) title test 4");
+
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ window._onload_ = function () {
+ element = document.getElementById("firstH1");
+ shouldBe("getComputedStyle(element).getPropertyValue('text-decoration')", "'none'");
+
+ element = document.getElementById("textLine");
+ shouldBe("getComputedStyle(element).getPropertyValue('font-size')", "'12px'");
+
+ shouldBe("getComputedStyle(document.body).getPropertyValue('border-top-color')", "'rgb(139, 0, 0)'");
+
+ wasPostTestScriptParsed = true;
+ finishJSTest();
+ }
+ </script>
+
+</body>
+</html>
Added: trunk/LayoutTests/fast/css/link-alternate-stylesheet-5-expected.txt (0 => 110626)
--- trunk/LayoutTests/fast/css/link-alternate-stylesheet-5-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/link-alternate-stylesheet-5-expected.txt 2012-03-13 22:40:16 UTC (rev 110626)
@@ -0,0 +1,18 @@
+Alternate stylesheet (link) title test 5
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS getComputedStyle(element).getPropertyValue('text-decoration') is 'underline'
+PASS getComputedStyle(element).getPropertyValue('font-size') is '12px'
+PASS getComputedStyle(document.body).getPropertyValue('border-top-color') is 'rgb(0, 128, 0)'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Alternate stylesheets
+
+This document has 3 stylesheets, one with a title, and 1 alternate stylesheet. It should:
+
+Have a green border at the top of the page
+An underlined H1
+12px text
Added: trunk/LayoutTests/fast/css/link-alternate-stylesheet-5.html (0 => 110626)
--- trunk/LayoutTests/fast/css/link-alternate-stylesheet-5.html (rev 0)
+++ trunk/LayoutTests/fast/css/link-alternate-stylesheet-5.html 2012-03-13 22:40:16 UTC (rev 110626)
@@ -0,0 +1,41 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <link rel="stylesheet" href="" type="text/css">
+ <link rel="stylesheet" href="" type="text/css">
+ <link rel="stylesheet" href="" title="Different layout" type="text/css">
+ <link rel="alternate stylesheet" href="" type="text/css">
+ <script src=""
+</head>
+<body>
+ <h1 id="firstH1">Alternate stylesheets</h1>
+
+ <p id="textLine">This document has 3 stylesheets, one with a title, and 1 alternate stylesheet. It should:</p>
+
+ <ul>
+ <li>Have a green border at the top of the page</li>
+ <li>An underlined <code>H1</code></li>
+ <li>12px text</li>
+ </ul>
+
+ <script>
+ description("Alternate stylesheet (link) title test 5");
+
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ window._onload_ = function () {
+ element = document.getElementById("firstH1");
+ shouldBe("getComputedStyle(element).getPropertyValue('text-decoration')", "'underline'");
+
+ element = document.getElementById("textLine");
+ shouldBe("getComputedStyle(element).getPropertyValue('font-size')", "'12px'");
+
+ shouldBe("getComputedStyle(document.body).getPropertyValue('border-top-color')", "'rgb(0, 128, 0)'");
+ wasPostTestScriptParsed = true;
+ finishJSTest();
+ }
+ </script>
+
+</body>
+</html>
Added: trunk/LayoutTests/fast/css/resources/basic.css (0 => 110626)
--- trunk/LayoutTests/fast/css/resources/basic.css (rev 0)
+++ trunk/LayoutTests/fast/css/resources/basic.css 2012-03-13 22:40:16 UTC (rev 110626)
@@ -0,0 +1,3 @@
+body {font-family:Georgia,serif;max-width:900px;}
+code {font-size:11px;}
+#source {border:1px solid #ccc; background:#eee;padding:1em;margin:2em;}
Added: trunk/LayoutTests/fast/css/resources/high.css (0 => 110626)
--- trunk/LayoutTests/fast/css/resources/high.css (rev 0)
+++ trunk/LayoutTests/fast/css/resources/high.css 2012-03-13 22:40:16 UTC (rev 110626)
@@ -0,0 +1,2 @@
+body {background:#fff;color:#333;border-top:10px solid darkred;}
+h1 {text-decoration:none;}
Added: trunk/LayoutTests/fast/css/resources/normal.css (0 => 110626)
--- trunk/LayoutTests/fast/css/resources/normal.css (rev 0)
+++ trunk/LayoutTests/fast/css/resources/normal.css 2012-03-13 22:40:16 UTC (rev 110626)
@@ -0,0 +1,2 @@
+body {background:#fff;color:#333;border-top:10px solid green;}
+h1 {text-decoration:underline;}
Added: trunk/LayoutTests/fast/css/resources/small.css (0 => 110626)
--- trunk/LayoutTests/fast/css/resources/small.css (rev 0)
+++ trunk/LayoutTests/fast/css/resources/small.css 2012-03-13 22:40:16 UTC (rev 110626)
@@ -0,0 +1 @@
+body{font-size:12px;}
Modified: trunk/Source/WebCore/ChangeLog (110625 => 110626)
--- trunk/Source/WebCore/ChangeLog 2012-03-13 22:36:05 UTC (rev 110625)
+++ trunk/Source/WebCore/ChangeLog 2012-03-13 22:40:16 UTC (rev 110626)
@@ -1,3 +1,22 @@
+2012-03-13 Dave Tharp <[email protected]>
+
+ Alternate stylesheets (without title attribute) are loaded on refresh
+ https://bugs.webkit.org/show_bug.cgi?id=24354
+
+ Reviewed by David Hyatt.
+
+ Alternate stylesheets are now ignored in <link> tags if
+ they have no title attribute (per spec).
+
+ Tests: fast/css/link-alternate-stylesheet-1.html
+ fast/css/link-alternate-stylesheet-2.html
+ fast/css/link-alternate-stylesheet-3.html
+ fast/css/link-alternate-stylesheet-4.html
+ fast/css/link-alternate-stylesheet-5.html
+
+ * dom/Document.cpp:
+ (WebCore::Document::collectActiveStylesheets):
+
2012-03-13 Dana Jansens <[email protected]>
Region::contains(IntPoint) is slow
Modified: trunk/Source/WebCore/dom/Document.cpp (110625 => 110626)
--- trunk/Source/WebCore/dom/Document.cpp 2012-03-13 22:36:05 UTC (rev 110625)
+++ trunk/Source/WebCore/dom/Document.cpp 2012-03-13 22:40:16 UTC (rev 110626)
@@ -3197,6 +3197,7 @@
// Check to see if this sheet belongs to a styleset
// (thus making it PREFERRED or ALTERNATE rather than
// PERSISTENT).
+ AtomicString rel = e->getAttribute(relAttr);
if (!enabledViaScript && !title.isEmpty()) {
// Yes, we have a title.
if (m_preferredStylesheetSet.isEmpty()) {
@@ -3204,13 +3205,15 @@
// we are NOT an alternate sheet, then establish
// us as the preferred set. Otherwise, just ignore
// this sheet.
- AtomicString rel = e->getAttribute(relAttr);
if (e->hasLocalName(styleTag) || !rel.contains("alternate"))
m_preferredStylesheetSet = m_selectedStylesheetSet = title;
}
if (title != m_preferredStylesheetSet)
sheet = 0;
}
+
+ if (rel.contains("alternate") && title.isEmpty())
+ sheet = 0;
}
if (sheet)
sheets.append(sheet);