Reviewed by Darin.
HTTP test for <rdar://problem/5305788>
REGRESSION: Safari sometimes loads IE-specific stylesheet on www.apaema.org
Test that order style sheets arrive has no impact to selection of preferred style sheet set.
* http/tests/local/fail.css: Added.
* http/tests/local/link-stylesheet-preferred-expected.txt: Added.
* http/tests/local/link-stylesheet-preferred.html: Added.
* http/tests/local/slow-css-pass.cgi: Added.
WebCore:
Reviewed by Darin.
Fix <rdar://problem/5305788>
REGRESSION: Safari sometimes loads IE-specific stylesheet on www.apaema.org
Pick the preferred style sheet set based on document order even if the sheet is still loading. Previously
the set was chosen based on which stylesheet happened to arrive first. Just fix the problem at hand
and resist urge to start refactoring this function.
* dom/Document.cpp:
(WebCore::Document::recalcStyleSelector):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@24497
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-07-21 Antti <antti@apple.com>
+
+ Reviewed by Darin.
+
+ HTTP test for <rdar://problem/5305788>
+ REGRESSION: Safari sometimes loads IE-specific stylesheet on www.apaema.org
+
+ Test that order style sheets arrive has no impact to selection of preferred style sheet set.
+
+ * http/tests/local/fail.css: Added.
+ * http/tests/local/link-stylesheet-preferred-expected.txt: Added.
+ * http/tests/local/link-stylesheet-preferred.html: Added.
+ * http/tests/local/slow-css-pass.cgi: Added.
+
2007-07-20 Sam Weinig <sam@webkit.org>
Reviewed by Darin.
--- /dev/null
+#fail { display: inline }
+#pass { display: none }
\ No newline at end of file
--- /dev/null
+Test that load order of stylesheets does not affect resolution of preferred style sheet set. This test works only as DRT HTTP test.
+
+PASS
--- /dev/null
+<html>
+<head>
+ <script>
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+ </script>
+ <style>
+ #pass { display: none }
+ </style>
+ <link rel=stylesheet title=thisSetShouldBeSelected href="http://127.0.0.1:8000/local/slow-css-pass.cgi">
+ <link rel=stylesheet title=thisSetShouldNotBeSelected href="fail.css">
+</head>
+<body>
+<p>Test that load order of stylesheets does not affect resolution of preferred style sheet set. This test works only as DRT HTTP test.</p>
+<span id=pass>PASS</span><span id=fail>FAIL</span>
+</body>
+</html>
--- /dev/null
+#!/usr/bin/perl -w
+
+print "Content-type: text/css\n\n";
+sleep(0.5);
+print "#pass { display: inline }\n";
+print "#fail { display: none }\n";
+
+2007-07-21 Antti <antti@apple.com>
+
+ Reviewed by Darin.
+
+ Fix <rdar://problem/5305788>
+ REGRESSION: Safari sometimes loads IE-specific stylesheet on www.apaema.org
+
+ Pick the preferred style sheet set based on document order even if the sheet is still loading. Previously
+ the set was chosen based on which stylesheet happened to arrive first. Just fix the problem at hand
+ and resist urge to start refactoring this function.
+
+ * dom/Document.cpp:
+ (WebCore::Document::recalcStyleSelector):
+
2007-07-20 Sam Weinig <sam@webkit.org>
Reviewed by Darin.
if (e->hasLocalName(linkTag)) {
// <LINK> element
HTMLLinkElement* l = static_cast<HTMLLinkElement*>(n);
- if (l->isLoading() || l->isDisabled())
+ if (l->isDisabled())
continue;
+ enabledViaScript = l->isEnabledViaScript();
+ if (l->isLoading()) {
+ // it is loading but we should still decide which style sheet set to use
+ if (!enabledViaScript && !title.isEmpty() && m_preferredStylesheetSet.isEmpty()) {
+ const AtomicString& rel = e->getAttribute(relAttr);
+ if (!rel.domString().contains("alternate")) {
+ m_preferredStylesheetSet = title;
+ m_selectedStylesheetSet = title;
+ }
+ }
+ continue;
+ }
if (!l->sheet())
title = DeprecatedString::null;
- enabledViaScript = l->isEnabledViaScript();
}
// Get the current preferred styleset. This is the