Bug 1599606 - Don't interleave a non-scrolled canvas background color item and a fixed canvas background image with a scrolled background-color item. r=mattwoodrow

Differential Revision: https://phabricator.services.mozilla.com/D54855
This commit is contained in:
Markus Stange 2021-02-02 16:09:12 +00:00
Родитель 80789c4708
Коммит becfe5bfb3
4 изменённых файлов: 50 добавлений и 2 удалений

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

@ -498,8 +498,6 @@ void nsCanvasFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
dependentFrame = nullptr;
}
}
aLists.BorderBackground()->AppendNewToTop<nsDisplayCanvasBackgroundColor>(
aBuilder, this);
if (isThemed) {
aLists.BorderBackground()
@ -608,6 +606,25 @@ void nsCanvasFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
aLists.BorderBackground()->AppendToTop(&thisItemList);
}
bool hasFixedBottomLayer =
layers.mImageCount > 0 &&
layers.mLayers[0].mAttachment == StyleImageLayerAttachment::Fixed;
if (!hasFixedBottomLayer || needBlendContainer) {
// Put a scrolled background color item in place, at the bottom of the
// list. The color of this item will be filled in during
// PresShell::AddCanvasBackgroundColorItem.
// Do not add this item if there's a fixed background image at the bottom
// (unless we have to, for correct blending); with a fixed background,
// it's better to allow the fixed background image to combine itself with
// a non-scrolled background color directly underneath, rather than
// interleaving the two with a scrolled background color.
// PresShell::AddCanvasBackgroundColorItem makes sure there always is a
// non-scrolled background color item at the bottom.
aLists.BorderBackground()
->AppendNewToBottom<nsDisplayCanvasBackgroundColor>(aBuilder, this);
}
if (needBlendContainer) {
const ActiveScrolledRoot* containerASR = contASRTracker.GetContainerASR();
DisplayListClipState::AutoSaveRestore blendContainerClip(aBuilder);

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

@ -0,0 +1,11 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Reference for: Blend a background image and a background color on the root, specifying background-attachment: fixed</title>
<style>
html {
background: #777777;
}
</style>

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

@ -0,0 +1,18 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Blend a background image and a background color on the root, specifying background-attachment: fixed</title>
<style>
html {
scrollbar-width: none;
}
body {
background: url('as-image/white_square.svg'), #777777;
background-attachment: fixed ;
height: 20000px;
background-blend-mode: multiply;
}
</style>

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

@ -90,6 +90,8 @@ test-pref(image.animation_mode,"none") == background-blending-image-color-gif.ht
fuzzy-if(webrender,0-1,0-49719) == background-blend-mode-body-image.html background-blend-mode-body-image-ref.html
fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu),0-1,0-16408) fuzzy-if(Android,0-4,0-768) fuzzy-if(gtkWidget,0-1,0-132) fuzzy-if(skiaContent,0-1,0-800) fuzzy-if(d2d,0-1,0-33208) fuzzy-if(webrender,0-1,0-78472) == background-blend-mode-body-transparent-image.html background-blend-mode-body-transparent-image-ref.html
== background-blend-mode-body-fixed.html background-blend-mode-body-fixed-ref.html
== background-blending-moz-element.html background-blending-moz-element-ref.html
fuzzy(0-1,0-40000) == mix-blend-mode-soft-light.html mix-blend-mode-soft-light-ref.html