зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1556275 - Handle unknown values for width and height as 'Auto' in viewport meta tag. r=botond
Without the change a green rectangle in each reftest in this commit covers whole screen. Differential Revision: https://phabricator.services.mozilla.com/D37328 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
546bfbc874
Коммит
dcfdeea7f1
|
@ -9498,7 +9498,7 @@ void Document::ParseWidthAndHeightInMetaViewport(const nsAString& aWidthString,
|
|||
// the range: [1px, 10000px]
|
||||
// 2. Negative number values are dropped
|
||||
// 3. device-width and device-height translate to 100vw and 100vh respectively
|
||||
// 4. Other keywords and unknown values translate to 1px
|
||||
// 4. Other keywords and unknown values are also dropped
|
||||
mMinWidth = nsViewportInfo::Auto;
|
||||
mMaxWidth = nsViewportInfo::Auto;
|
||||
if (!aWidthString.IsEmpty()) {
|
||||
|
@ -9509,7 +9509,7 @@ void Document::ParseWidthAndHeightInMetaViewport(const nsAString& aWidthString,
|
|||
nsresult widthErrorCode;
|
||||
mMaxWidth = aWidthString.ToInteger(&widthErrorCode);
|
||||
if (NS_FAILED(widthErrorCode)) {
|
||||
mMaxWidth = 1.0f;
|
||||
mMaxWidth = nsViewportInfo::Auto;
|
||||
} else if (mMaxWidth >= 0.0f) {
|
||||
mMaxWidth = clamped(mMaxWidth, CSSCoord(1.0f), CSSCoord(10000.0f));
|
||||
} else {
|
||||
|
@ -9536,7 +9536,7 @@ void Document::ParseWidthAndHeightInMetaViewport(const nsAString& aWidthString,
|
|||
nsresult heightErrorCode;
|
||||
mMaxHeight = aHeightString.ToInteger(&heightErrorCode);
|
||||
if (NS_FAILED(heightErrorCode)) {
|
||||
mMaxHeight = 1.0f;
|
||||
mMaxHeight = nsViewportInfo::Auto;
|
||||
} else if (mMaxHeight >= 0.0f) {
|
||||
mMaxHeight = clamped(mMaxHeight, CSSCoord(1.0f), CSSCoord(10000.0f));
|
||||
} else {
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
<!DOCTYPE html>
|
||||
<meta name="viewport" content="width=device-height">
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
#container {
|
||||
position: relative;
|
||||
}
|
||||
#inner {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background: green;
|
||||
}
|
||||
</style>
|
||||
<div id="container">
|
||||
<div id="inner"></div>
|
||||
</div>
|
|
@ -0,0 +1,24 @@
|
|||
<!DOCTYPE html>
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
#container {
|
||||
position: relative;
|
||||
}
|
||||
#inner {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background: green;
|
||||
}
|
||||
</style>
|
||||
<div id="container">
|
||||
<div id="inner"></div>
|
||||
</div>
|
|
@ -0,0 +1,24 @@
|
|||
<!DOCTYPE html>
|
||||
<meta name="viewport" content="width=devicewidth">
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
#container {
|
||||
position: relative;
|
||||
}
|
||||
#inner {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background: green;
|
||||
}
|
||||
</style>
|
||||
<div id="container">
|
||||
<div id="inner"></div>
|
||||
</div>
|
|
@ -8,6 +8,8 @@ default-preferences pref(dom.meta-viewport.enabled,true) pref(apz.allow_zooming,
|
|||
== viewport-width.html initial-scale-0_5-ref.html
|
||||
== initial-scale-1.html no-zoom-ref.html
|
||||
== minimum-scale.html no-zoom-ref.html
|
||||
== invalid-width.html invalid-width-ref.html
|
||||
== device-height-for-width.html invalid-width-ref.html
|
||||
== negative-initial-and-maximum-scale.html initial-scale-0_5-ref.html
|
||||
== no-scalable-with-minimum-scale.html no-scalable-with-minimum-scale-ref.html
|
||||
== clamped-by-default-minimum-scale.html initial-scale-0_25-ref.html
|
||||
|
|
Загрузка…
Ссылка в новой задаче