зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1730763 - Fix containment and body-to-root propagation. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D149226
This commit is contained in:
Родитель
4e751c966e
Коммит
34e23753e7
|
@ -2401,25 +2401,31 @@ nsIFrame* nsCSSFrameConstructor::ConstructDocElementFrame(
|
|||
"We need to copy <body>'s principal writing-mode before "
|
||||
"constructing mRootElementFrame.");
|
||||
|
||||
const WritingMode docElementWM(computedStyle);
|
||||
Element* body = mDocument->GetBodyElement();
|
||||
if (body) {
|
||||
const WritingMode propagatedWM = [&] {
|
||||
const WritingMode rootWM(computedStyle);
|
||||
if (computedStyle->StyleDisplay()->IsContainAny()) {
|
||||
return rootWM;
|
||||
}
|
||||
Element* body = mDocument->GetBodyElement();
|
||||
if (!body) {
|
||||
return rootWM;
|
||||
}
|
||||
RefPtr<ComputedStyle> bodyStyle = ResolveComputedStyle(body);
|
||||
if (bodyStyle->StyleDisplay()->IsContainAny()) {
|
||||
return rootWM;
|
||||
}
|
||||
const WritingMode bodyWM(bodyStyle);
|
||||
|
||||
if (bodyWM != docElementWM) {
|
||||
if (bodyWM != rootWM) {
|
||||
nsContentUtils::ReportToConsole(
|
||||
nsIScriptError::warningFlag, "Layout"_ns, mDocument,
|
||||
nsContentUtils::eLAYOUT_PROPERTIES,
|
||||
"PrincipalWritingModePropagationWarning");
|
||||
}
|
||||
return bodyWM;
|
||||
}();
|
||||
|
||||
mDocElementContainingBlock->PropagateWritingModeToSelfAndAncestors(
|
||||
bodyWM);
|
||||
} else {
|
||||
mDocElementContainingBlock->PropagateWritingModeToSelfAndAncestors(
|
||||
docElementWM);
|
||||
}
|
||||
mDocElementContainingBlock->PropagateWritingModeToSelfAndAncestors(
|
||||
propagatedWM);
|
||||
}
|
||||
|
||||
nsFrameConstructorSaveState docElementContainingBlockAbsoluteSaveState;
|
||||
|
|
|
@ -1321,6 +1321,10 @@ static Element* GetPropagatedScrollStylesForViewport(
|
|||
return docElement;
|
||||
}
|
||||
|
||||
if (rootStyle && rootStyle->StyleDisplay()->IsContainAny()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Don't look in the BODY for non-HTML documents or HTML documents
|
||||
// with non-HTML roots.
|
||||
// XXX this should be earlier; we shouldn't even look at the document root
|
||||
|
@ -1339,6 +1343,10 @@ static Element* GetPropagatedScrollStylesForViewport(
|
|||
"GetBodyElement returned something bogus");
|
||||
|
||||
const auto* bodyStyle = Servo_Element_GetMaybeOutOfDateStyle(bodyElement);
|
||||
if (bodyStyle && bodyStyle->StyleDisplay()->IsContainAny()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (CheckOverflow(bodyStyle, aStyles)) {
|
||||
// tell caller we stole the overflow style from the body element
|
||||
return bodyElement;
|
||||
|
|
|
@ -1188,12 +1188,12 @@ nsIFrame* nsCSSRendering::FindBackgroundStyleFrame(nsIFrame* aForFrame) {
|
|||
// through to the content sink, which will call |StartLayout|
|
||||
// and thus |Initialize| on the pres shell. See bug 119351
|
||||
// for the ugly details.
|
||||
if (!bodyContent) {
|
||||
if (!bodyContent || aForFrame->StyleDisplay()->IsContainAny()) {
|
||||
return aForFrame;
|
||||
}
|
||||
|
||||
nsIFrame* bodyFrame = bodyContent->GetPrimaryFrame();
|
||||
if (!bodyFrame) {
|
||||
if (!bodyFrame || bodyFrame->StyleDisplay()->IsContainAny()) {
|
||||
return aForFrame;
|
||||
}
|
||||
|
||||
|
@ -1242,26 +1242,29 @@ inline bool FindElementBackground(const nsIFrame* aForFrame,
|
|||
// was propagated to the viewport.
|
||||
|
||||
nsIContent* content = aForFrame->GetContent();
|
||||
if (!content || content->NodeInfo()->NameAtom() != nsGkAtoms::body)
|
||||
if (!content || content->NodeInfo()->NameAtom() != nsGkAtoms::body) {
|
||||
return true; // not frame for a "body" element
|
||||
}
|
||||
// It could be a non-HTML "body" element but that's OK, we'd fail the
|
||||
// bodyContent check below
|
||||
|
||||
if (aForFrame->Style()->GetPseudoType() != PseudoStyleType::NotPseudo) {
|
||||
return true; // A pseudo-element frame.
|
||||
if (aForFrame->Style()->GetPseudoType() != PseudoStyleType::NotPseudo ||
|
||||
aForFrame->StyleDisplay()->IsContainAny()) {
|
||||
return true; // A pseudo-element frame, or contained.
|
||||
}
|
||||
|
||||
// We should only look at the <html> background if we're in an HTML document
|
||||
Document* document = content->OwnerDoc();
|
||||
|
||||
dom::Element* bodyContent = document->GetBodyElement();
|
||||
if (bodyContent != content)
|
||||
if (bodyContent != content) {
|
||||
return true; // this wasn't the background that was propagated
|
||||
}
|
||||
|
||||
// This can be called even when there's no root element yet, during frame
|
||||
// construction, via nsLayoutUtils::FrameHasTransparency and
|
||||
// nsContainerFrame::SyncFrameViewProperties.
|
||||
if (!aRootElementFrame) {
|
||||
if (!aRootElementFrame || aRootElementFrame->StyleDisplay()->IsContainAny()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1521,6 +1521,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay {
|
|||
!IsInternalTableStyleExceptCell();
|
||||
}
|
||||
|
||||
bool IsContainAny() const { return !!EffectiveContainment(); }
|
||||
|
||||
mozilla::ContainSizeAxes GetContainSizeAxes() const {
|
||||
const auto contain = EffectiveContainment();
|
||||
// Short circuit for no containment whatsoever
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
[background-color-body-propagation-008.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[background-color-body-propagation-009.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[contain-body-bg-001.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[contain-body-bg-002.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[contain-body-bg-003.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[contain-body-dir-001.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[contain-body-dir-002.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[contain-body-dir-003.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[contain-body-overflow-001.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[contain-body-overflow-002.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[contain-body-overflow-003.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[contain-body-t-o-001.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[contain-body-t-o-002.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[contain-body-t-o-003.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[contain-body-w-m-001.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[contain-body-w-m-002.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[contain-body-w-m-003.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[contain-html-bg-001.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[contain-html-bg-002.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[contain-html-bg-003.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[contain-html-dir-001.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[contain-html-dir-002.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[contain-html-dir-003.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[contain-html-overflow-001.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[contain-html-overflow-002.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[contain-html-overflow-003.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[contain-html-t-o-001.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[contain-html-t-o-002.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[contain-html-t-o-003.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[contain-html-w-m-001.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[contain-html-w-m-002.html]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[contain-html-w-m-003.html]
|
||||
expected: FAIL
|
|
@ -1,4 +0,0 @@
|
|||
[overflow-body-propagation-011.html]
|
||||
expected:
|
||||
if os == "android": PASS
|
||||
FAIL
|
Загрузка…
Ссылка в новой задаче