Ignore <meta name=viewport> if @viewport is.

Fixes #8373
This commit is contained in:
Michael Howell 2015-11-15 16:39:39 -07:00
parent 8f2a3a64f1
commit 987c9e63aa
6 changed files with 48 additions and 2 deletions

View file

@ -60,6 +60,9 @@ impl HTMLMetaElement {
}
fn apply_viewport(&self) {
if !::util::prefs::get_pref("layout.viewport.enabled").as_boolean().unwrap_or(false) {
return;
}
let element = self.upcast::<Element>();
if let Some(content) = element.get_attribute(&ns!(""), &atom!("content")).r() {
let content = content.value();

View file

@ -69,7 +69,7 @@ resolution=300x300,device-pixel-ratio=2 != pixel_snapping_position_a.html pixel_
!= text_decoration_underline_subpx_a.html text_decoration_underline_subpx_ref.html
!= text_overflow_a.html text_overflow_ref.html
flaky_cpu,prefs:"layout.writing-mode.enabled" == vertical-lr-blocks.html vertical-lr-blocks_ref.html
== viewport_meta.html viewport_rule_ref.html
prefs:"layout.viewport.enabled" == viewport_meta.html viewport_rule_ref.html
resolution=800x600 == viewport_percentage_vmin_vmax.html viewport_percentage_vmin_vmax_a.html
# resolution=600x800 == viewport_percentage_vmin_vmax.html viewport_percentage_vmin_vmax_b.html
resolution=800x600 == viewport_percentage_vw_vh.html viewport_percentage_vw_vh_a.html

View file

@ -4227,6 +4227,18 @@
"url": "/_mozilla/css/vertical_align_top_span_a.html"
}
],
"css/viewport_ignore_desktop.html": [
{
"path": "css/viewport_ignore_desktop.html",
"references": [
[
"/_mozilla/css/viewport_ignore_desktop_ref.html",
"=="
]
],
"url": "/_mozilla/css/viewport_ignore_desktop.html"
}
],
"css/visibility_hidden.html": [
{
"path": "css/visibility_hidden.html",
@ -9424,6 +9436,18 @@
"url": "/_mozilla/css/vertical_align_top_span_a.html"
}
],
"css/viewport_ignore_desktop.html": [
{
"path": "css/viewport_ignore_desktop.html",
"references": [
[
"/_mozilla/css/viewport_ignore_desktop.html",
"=="
]
],
"url": "/_mozilla/css/viewport_ignore_desktop.html"
}
],
"css/visibility_hidden.html": [
{
"path": "css/visibility_hidden.html",
@ -9802,4 +9826,4 @@
"rev": null,
"url_base": "/_mozilla/",
"version": 2
}
}

View file

@ -0,0 +1,13 @@
<!doctype html>
<meta charset="utf-8">
<title>viewport is ignored on desktop</title>
<link rel="match" href="viewport_ignore_desktop_ref.html">
<script>
if (window.userAgent.indexOf("Mobile") === -1) {
var meta = document.creatElement("meta");
meta.name = "viewport";
meta.content = "width=100";
document.getElementsByTagName("head")[0].appendChild(meta);
}
</script>
<p style='border: solid'>Test

View file

@ -0,0 +1,2 @@
prefs: ["layout.viewport.enabled:false"]

View file

@ -0,0 +1,4 @@
<!doctype html>
<meta charset="utf-8">
<title>viewport is ignored on desktop</title>
<p style='border: solid'>Test