Bug 1411138. Be consistent (and follow the spec) in terms of how we determine the element that propagates styles to the viewport. r=dholbert

MozReview-Commit-ID: 8tH3nCDQJID
This commit is contained in:
Boris Zbarsky 2017-10-26 00:35:22 -04:00
Родитель b3157c0147
Коммит 0015c73286
8 изменённых файлов: 130 добавлений и 10 удалений

Просмотреть файл

@ -0,0 +1,13 @@
<!-- Needs to be in quirks mode -->
<html>
<head>
<script>
try { o1 = document.createElement('frameset') } catch(e) { }
try { o2 = document.createElement('body') } catch(e) { }
try { o2.style.overflow = 'auto'; } catch (e) {}
try { document.documentElement.appendChild(o1) } catch(e) { }
try { document.documentElement.appendChild(o2) } catch(e) { }
try { o2.scrollLeft } catch(e) { }
</script>
</head>
</html>

Просмотреть файл

@ -513,3 +513,4 @@ load 1404789-2.html
load 1406562.html
load 1409088.html
load 1409147.html
load 1411138.html

Просмотреть файл

@ -25,6 +25,7 @@
#include "nsIContent.h"
#include "nsIFrame.h"
#include "nsIDocument.h"
#include "nsIDocumentInlines.h"
#include "nsIPrintSettings.h"
#include "nsLanguageAtomService.h"
#include "mozilla/LookAndFeel.h"
@ -56,6 +57,7 @@
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/Element.h"
#include "nsIMessageManager.h"
#include "mozilla/dom/HTMLBodyElement.h"
#include "mozilla/dom/MediaQueryList.h"
#include "nsSMILAnimationController.h"
#include "mozilla/css/ImageLoader.h"
@ -1516,14 +1518,15 @@ GetPropagatedScrollbarStylesForViewport(nsPresContext* aPresContext,
return nullptr;
}
Element* bodyElement = htmlDoc->GetBody();
if (!bodyElement ||
!bodyElement->NodeInfo()->Equals(nsGkAtoms::body)) {
// The body is not a <body> tag, it's a <frameset>.
Element* bodyElement = htmlDoc->GetBodyElement();
if (!bodyElement) {
// No body, nothing to do here.
return nullptr;
}
MOZ_ASSERT(bodyElement->IsHTMLElement(nsGkAtoms::body),
"GetBodyElement returned something bogus");
RefPtr<nsStyleContext> bodyStyle =
styleSet->ResolveStyleFor(bodyElement, rootStyle,
LazyComputeBehavior::Allow);

Просмотреть файл

@ -95709,6 +95709,42 @@
{}
]
],
"css/CSS2/visufx/overflow-propagation-001a.html": [
[
"/css/CSS2/visufx/overflow-propagation-001a.html",
[
[
"/css/CSS2/visufx/support/overflow-propagation-001-ref.html",
"=="
]
],
{}
]
],
"css/CSS2/visufx/overflow-propagation-001b.html": [
[
"/css/CSS2/visufx/overflow-propagation-001b.html",
[
[
"/css/CSS2/visufx/support/overflow-propagation-001-ref.html",
"=="
]
],
{}
]
],
"css/CSS2/visufx/overflow-propagation-001c.html": [
[
"/css/CSS2/visufx/overflow-propagation-001c.html",
[
[
"/css/CSS2/visufx/support/overflow-propagation-001-ref.html",
"=="
]
],
{}
]
],
"css/CSS2/visufx/visibility-005.xht": [
[
"/css/CSS2/visufx/visibility-005.xht",
@ -224201,6 +224237,11 @@
{}
]
],
"css/CSS2/visufx/support/overflow-propagation-001-ref.html": [
[
{}
]
],
"css/CSS2/visuren/anonymous-boxes-001a-ref.xht": [
[
{}
@ -391648,7 +391689,7 @@
"support"
],
"XMLHttpRequest/resources/auth2/corsenabled.py": [
"a70576e6ae82a030c6776923082e5aa50fad0078",
"4136b00b543096216f9f1ad1314c7062dda04179",
"support"
],
"XMLHttpRequest/resources/auth3/auth.py": [
@ -391668,11 +391709,11 @@
"support"
],
"XMLHttpRequest/resources/auth7/corsenabled.py": [
"3f8fe382e3aa4ffe0e7c1ecb4571a55866bba27f",
"cbc1e4a39cc2e999ef7bd4053a600e8b0d515bb5",
"support"
],
"XMLHttpRequest/resources/auth8/corsenabled-no-authorize.py": [
"c3add811ecf33bf3452fe471d27756dc152db81f",
"523fbc134ecfee5b13e4ef93508712847fc4e396",
"support"
],
"XMLHttpRequest/resources/auth9/auth.py": [
@ -469815,6 +469856,18 @@
"d71b8aa84a63f7579a5f33b05960571e24417110",
"reftest"
],
"css/CSS2/visufx/overflow-propagation-001a.html": [
"3aaba555d04ae9a0f6ee48aa7ac8fc4600554645",
"reftest"
],
"css/CSS2/visufx/overflow-propagation-001b.html": [
"c582c21c5fb8079047d6a2350351fede33c0f6db",
"reftest"
],
"css/CSS2/visufx/overflow-propagation-001c.html": [
"57062d2e0eb9077f965183aaed2a4c18675585a7",
"reftest"
],
"css/CSS2/visufx/shape-spaces-001.xht": [
"2449b8843064386c9854436bbc59eccb695b9578",
"visual"
@ -469823,6 +469876,10 @@
"e4843d42a26189132e1bdd53e8618521330baeca",
"support"
],
"css/CSS2/visufx/support/overflow-propagation-001-ref.html": [
"b5df0a9c23e9556ade5179681452a40b913d392d",
"support"
],
"css/CSS2/visufx/visibility-001.xht": [
"f75f3db564058f469756ec1398078fc76473d632",
"visual"
@ -585960,7 +586017,7 @@
"wdspec"
],
"webdriver/tests/element_retrieval/get_active_element.py": [
"9080770b60a988cb37e30700efb118d392a896c7",
"41dab8ecf11556f7b1490d515557de659813881e",
"wdspec"
],
"webdriver/tests/fullscreen_window.py": [
@ -586088,7 +586145,7 @@
"support"
],
"webdriver/tests/support/asserts.py": [
"b02f45e99cdee49f12608e60333e566c8c0e04d0",
"4e4f29b9d305383e5bcfa01fa1ba789d0c12ef93",
"support"
],
"webdriver/tests/support/fixtures.py": [

Просмотреть файл

@ -0,0 +1,9 @@
<!doctype html>
<meta charset=utf-8>
<title>Ensure that body propagates its scrollbars</title>
<link rel=match href="support/overflow-propagation-001-ref.html">
<link rel=help href="https://www.w3.org/TR/CSS21/visufx.html#overflow-clipping">
<body style="overflow: hidden; margin: 100px; width: 100px; height: 100px; border: 1px solid green; position: absolute; top: 0; left: 0">
The body should have visible overflow of the text that totally doesn't fit
in the little box.
</body>

Просмотреть файл

@ -0,0 +1,14 @@
<!doctype html>
<meta charset=utf-8>
<title>Ensure that body propagates its scrollbars</title>
<link rel=match href="support/overflow-propagation-001-ref.html">
<link rel=help href="https://www.w3.org/TR/CSS21/visufx.html#overflow-clipping">
<script>
onload = function() {
document.body.remove();
var b = document.createElement("body");
b.style = "overflow: hidden; margin: 100px; width: 100px; height: 100px; border: 1px solid green; position: absolute; top: 0; left: 0";
b.textContent = "The body should have visible overflow of the text that totally doesn't fit in the little box.";
document.documentElement.appendChild(b);
}
</script>

Просмотреть файл

@ -0,0 +1,16 @@
<!doctype html>
<meta charset=utf-8>
<title>Ensure that body propagates its scrollbars even if there is a preceding frameset</title>
<link rel=match href="support/overflow-propagation-001-ref.html">
<link rel=help href="https://www.w3.org/TR/CSS21/visufx.html#overflow-clipping">
<script>
onload = function() {
document.body.remove();
var f = document.createElement("frameset");
document.documentElement.appendChild(f);
var b = document.createElement("body");
b.style = "overflow: hidden; margin: 100px; width: 100px; height: 100px; border: 1px solid green; position: absolute; top: 0; left: 0";
b.textContent = "The body should have visible overflow of the text that totally doesn't fit in the little box.";
document.documentElement.appendChild(b);
}
</script>

Просмотреть файл

@ -0,0 +1,7 @@
<!doctype html>
<html style="overflow: hidden">
<meta charset=utf-8>
<body style="margin: 100px; width: 100px; height: 100px; border: 1px solid green; position: absolute; top: 0; left: 0">
The body should have visible overflow of the text that totally doesn't fit
in the little box.
</body>