From 0015c73286444bc290aa50cd6946dd5ec03aff98 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Thu, 26 Oct 2017 00:35:22 -0400 Subject: [PATCH] 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 --- layout/base/crashtests/1411138.html | 13 ++++ layout/base/crashtests/crashtests.list | 1 + layout/base/nsPresContext.cpp | 13 ++-- testing/web-platform/meta/MANIFEST.json | 67 +++++++++++++++++-- .../visufx/overflow-propagation-001a.html | 9 +++ .../visufx/overflow-propagation-001b.html | 14 ++++ .../visufx/overflow-propagation-001c.html | 16 +++++ .../support/overflow-propagation-001-ref.html | 7 ++ 8 files changed, 130 insertions(+), 10 deletions(-) create mode 100644 layout/base/crashtests/1411138.html create mode 100644 testing/web-platform/tests/css/CSS2/visufx/overflow-propagation-001a.html create mode 100644 testing/web-platform/tests/css/CSS2/visufx/overflow-propagation-001b.html create mode 100644 testing/web-platform/tests/css/CSS2/visufx/overflow-propagation-001c.html create mode 100644 testing/web-platform/tests/css/CSS2/visufx/support/overflow-propagation-001-ref.html diff --git a/layout/base/crashtests/1411138.html b/layout/base/crashtests/1411138.html new file mode 100644 index 000000000000..028e8c9222c2 --- /dev/null +++ b/layout/base/crashtests/1411138.html @@ -0,0 +1,13 @@ + + + + + + diff --git a/layout/base/crashtests/crashtests.list b/layout/base/crashtests/crashtests.list index 8e90267ff857..9cda08791b7b 100644 --- a/layout/base/crashtests/crashtests.list +++ b/layout/base/crashtests/crashtests.list @@ -513,3 +513,4 @@ load 1404789-2.html load 1406562.html load 1409088.html load 1409147.html +load 1411138.html diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index a884ea570adf..8276ee5464f7 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -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 tag, it's a . + 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 bodyStyle = styleSet->ResolveStyleFor(bodyElement, rootStyle, LazyComputeBehavior::Allow); diff --git a/testing/web-platform/meta/MANIFEST.json b/testing/web-platform/meta/MANIFEST.json index eb0d445eaa59..79696b2060bd 100644 --- a/testing/web-platform/meta/MANIFEST.json +++ b/testing/web-platform/meta/MANIFEST.json @@ -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": [ diff --git a/testing/web-platform/tests/css/CSS2/visufx/overflow-propagation-001a.html b/testing/web-platform/tests/css/CSS2/visufx/overflow-propagation-001a.html new file mode 100644 index 000000000000..77107d8faf50 --- /dev/null +++ b/testing/web-platform/tests/css/CSS2/visufx/overflow-propagation-001a.html @@ -0,0 +1,9 @@ + + +Ensure that body propagates its scrollbars + + + + The body should have visible overflow of the text that totally doesn't fit + in the little box. + diff --git a/testing/web-platform/tests/css/CSS2/visufx/overflow-propagation-001b.html b/testing/web-platform/tests/css/CSS2/visufx/overflow-propagation-001b.html new file mode 100644 index 000000000000..c72994b8c44b --- /dev/null +++ b/testing/web-platform/tests/css/CSS2/visufx/overflow-propagation-001b.html @@ -0,0 +1,14 @@ + + +Ensure that body propagates its scrollbars + + + diff --git a/testing/web-platform/tests/css/CSS2/visufx/overflow-propagation-001c.html b/testing/web-platform/tests/css/CSS2/visufx/overflow-propagation-001c.html new file mode 100644 index 000000000000..6956ff4143e3 --- /dev/null +++ b/testing/web-platform/tests/css/CSS2/visufx/overflow-propagation-001c.html @@ -0,0 +1,16 @@ + + +Ensure that body propagates its scrollbars even if there is a preceding frameset + + + diff --git a/testing/web-platform/tests/css/CSS2/visufx/support/overflow-propagation-001-ref.html b/testing/web-platform/tests/css/CSS2/visufx/support/overflow-propagation-001-ref.html new file mode 100644 index 000000000000..f0693fbea29d --- /dev/null +++ b/testing/web-platform/tests/css/CSS2/visufx/support/overflow-propagation-001-ref.html @@ -0,0 +1,7 @@ + + + + + The body should have visible overflow of the text that totally doesn't fit + in the little box. +