mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Auto merge of #13461 - servo:media, r=Manishearth
Pass the correct attribute to handle_stylesheet_url. <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13461) <!-- Reviewable:end -->
This commit is contained in:
commit
7fe688b8e9
7 changed files with 67 additions and 8 deletions
|
@ -154,7 +154,9 @@ impl VirtualMethods for HTMLLinkElement {
|
||||||
},
|
},
|
||||||
&atom!("media") => {
|
&atom!("media") => {
|
||||||
if string_is_stylesheet(&rel) {
|
if string_is_stylesheet(&rel) {
|
||||||
self.handle_stylesheet_url(&attr.value());
|
if let Some(href) = self.upcast::<Element>().get_attribute(&ns!(), &atom!("href")) {
|
||||||
|
self.handle_stylesheet_url(&href.value());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_ => {},
|
_ => {},
|
||||||
|
|
|
@ -37714,6 +37714,20 @@
|
||||||
"deleted": [],
|
"deleted": [],
|
||||||
"deleted_reftests": {},
|
"deleted_reftests": {},
|
||||||
"items": {
|
"items": {
|
||||||
|
"reftest": {
|
||||||
|
"html/semantics/document-metadata/the-link-element/stylesheet-media.html": [
|
||||||
|
{
|
||||||
|
"path": "html/semantics/document-metadata/the-link-element/stylesheet-media.html",
|
||||||
|
"references": [
|
||||||
|
[
|
||||||
|
"/html/semantics/document-metadata/the-link-element/stylesheet-media-ref.html",
|
||||||
|
"=="
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"url": "/html/semantics/document-metadata/the-link-element/stylesheet-media.html"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"testharness": {
|
"testharness": {
|
||||||
"html/semantics/forms/the-form-element/form-action-url.html": [
|
"html/semantics/forms/the-form-element/form-action-url.html": [
|
||||||
{
|
{
|
||||||
|
@ -37729,7 +37743,20 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"reftest_nodes": {}
|
"reftest_nodes": {
|
||||||
|
"html/semantics/document-metadata/the-link-element/stylesheet-media.html": [
|
||||||
|
{
|
||||||
|
"path": "html/semantics/document-metadata/the-link-element/stylesheet-media.html",
|
||||||
|
"references": [
|
||||||
|
[
|
||||||
|
"/html/semantics/document-metadata/the-link-element/stylesheet-media-ref.html",
|
||||||
|
"=="
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"url": "/html/semantics/document-metadata/the-link-element/stylesheet-media.html"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"reftest_nodes": {
|
"reftest_nodes": {
|
||||||
"2dcontext/building-paths/canvas_complexshapes_arcto_001.htm": [
|
"2dcontext/building-paths/canvas_complexshapes_arcto_001.htm": [
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
body {
|
||||||
|
color: red;
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
Content-Type: text/css
|
|
@ -0,0 +1,9 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<meta charset=utf-8>
|
||||||
|
<title>Test</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
color: green;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<p>This text should be green.
|
|
@ -0,0 +1,17 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<meta charset=utf-8>
|
||||||
|
<title>Test</title>
|
||||||
|
<link rel=match href=stylesheet-media-ref.html>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
color: green;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<link rel=stylesheet id=link>
|
||||||
|
<script>
|
||||||
|
// This tests for a bug in Servo, where it would treat the media attribute as
|
||||||
|
// if it was the href attribute.
|
||||||
|
var link = document.getElementById("link");
|
||||||
|
link.setAttribute("media", "all")
|
||||||
|
</script>
|
||||||
|
<p>This text should be green.
|
|
@ -147,9 +147,12 @@ class FileHandler(object):
|
||||||
raise HTTPException(404)
|
raise HTTPException(404)
|
||||||
|
|
||||||
def get_headers(self, request, path):
|
def get_headers(self, request, path):
|
||||||
rv = self.default_headers(path)
|
rv = (self.load_headers(request, os.path.join(os.path.split(path)[0], "__dir__")) +
|
||||||
rv.extend(self.load_headers(request, os.path.join(os.path.split(path)[0], "__dir__")))
|
self.load_headers(request, path))
|
||||||
rv.extend(self.load_headers(request, path))
|
|
||||||
|
if not any(key.lower() == "content-type" for (key, _) in rv):
|
||||||
|
rv.insert(0, ("Content-Type", guess_content_type(path)))
|
||||||
|
|
||||||
return rv
|
return rv
|
||||||
|
|
||||||
def load_headers(self, request, path):
|
def load_headers(self, request, path):
|
||||||
|
@ -206,9 +209,6 @@ class FileHandler(object):
|
||||||
f.seek(byte_range.lower)
|
f.seek(byte_range.lower)
|
||||||
return f.read(byte_range.upper - byte_range.lower)
|
return f.read(byte_range.upper - byte_range.lower)
|
||||||
|
|
||||||
def default_headers(self, path):
|
|
||||||
return [("Content-Type", guess_content_type(path))]
|
|
||||||
|
|
||||||
|
|
||||||
file_handler = FileHandler()
|
file_handler = FileHandler()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue