LibWeb/Painting: Fix blending with viewport background

The viewport is now drawn onto transparent black instead of the
background color of the viewport.
This commit is contained in:
Glenn Skrzypczak 2025-03-30 20:26:44 +02:00 committed by Alexander Kalenik
parent 9973b01848
commit da09608156
Notes: github-actions[bot] 2025-04-01 11:38:56 +00:00
31 changed files with 65 additions and 0 deletions

View file

@ -8,6 +8,7 @@
#include <LibWeb/DOM/Range.h>
#include <LibWeb/Layout/TextNode.h>
#include <LibWeb/Layout/Viewport.h>
#include <LibWeb/Painting/DisplayListRecorder.h>
#include <LibWeb/Painting/StackingContext.h>
#include <LibWeb/Painting/ViewportPaintable.h>
#include <LibWeb/Selection/Selection.h>
@ -63,7 +64,9 @@ void ViewportPaintable::build_stacking_context_tree()
void ViewportPaintable::paint_all_phases(PaintContext& context)
{
build_stacking_context_tree_if_needed();
context.display_list_recorder().save_layer();
stacking_context()->paint(context);
context.display_list_recorder().restore();
}
void ViewportPaintable::assign_scroll_frames()

View file

@ -1,5 +1,6 @@
<!DOCTYPE html>
<style>
html { background-color: white; }
div {
width: 200px;
height: 20px;

View file

@ -1,5 +1,6 @@
<!DOCTYPE html>
<style>
html { background-color: white; }
div {
width: 200px;
height: 20px;

View file

@ -1,5 +1,6 @@
<!DOCTYPE html>
<style>
html { background-color: white; }
div {
width: 200px;
height: 20px;

View file

@ -1,5 +1,6 @@
<!DOCTYPE html>
<style>
html { background-color: white; }
div {
width: 200px;
height: 20px;

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<link rel="match" href="../expected/color-hsl-ref.html" />
<style>
html { background-color: white; }
div {
width: 200px;
height: 20px;

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<link rel="match" href="../expected/color-hwb-ref.html" />
<style>
html { background-color: white; }
div {
width: 200px;
height: 20px;

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<link rel="match" href="../expected/color-oklab-ref.html" />
<style>
html { background-color: white; }
div {
width: 200px;
height: 20px;

View file

@ -1,6 +1,7 @@
<!DOCTYPE html>
<link rel="match" href="../expected/color-oklch-ref.html" />
<style>
html { background-color: white; }
div {
width: 200px;
height: 20px;

View file

@ -0,0 +1,10 @@
<!DOCTYPE html>
<style>
* {
margin: 0;
}
body {
background-color: white;
}
</style>
<img src="../images/css-compositing-ref.png">

Binary file not shown.

Before

Width:  |  Height:  |  Size: 330 KiB

After

Width:  |  Height:  |  Size: 382 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 KiB

After

Width:  |  Height:  |  Size: 265 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 112 KiB

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 257 KiB

After

Width:  |  Height:  |  Size: 346 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 589 KiB

After

Width:  |  Height:  |  Size: 683 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5 KiB

After

Width:  |  Height:  |  Size: 5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 87 KiB

View file

@ -0,0 +1,44 @@
<!DOCTYPE html>
<link rel="match" href="../expected/css-compositing-ref.html" />
<style>
div {
position: absolute;
width: 60px;
height: 60px;
opacity: 50%;
}
#d1 {
background-color: rgb(186, 190, 92);
}
#d2 {
background-color: linear-gradient(to right rgb(255, 132, 0) 51%),
linear-gradient(to right, rgb(255, 0, 212));
background-blend-mode: normal, difference;
mix-blend-mode: screen;
top: 10px;
}
#d3 {
background-color: rgb(21, 107, 118);
isolation: isolate;
mix-blend-mode: multiply;
top: 20px;
}
#d4 {
background-color: linear-gradient(to right rgb(77, 145, 113) 51%),
linear-gradient(to right, rgb(60, 118, 41));
background-blend-mode: normal, exclusion;
mix-blend-mode: normal;
isolation: isolate;
top: 30px;
}
#d5 {
background-color: rgb(34, 29, 78);
mix-blend-mode: difference;
top: 40px;
}
</style>
<div id="d1">111</div>
<div id="d2">222</div>
<div id="d3">333</div>
<div id="d4">444</div>
<div id="d5">555</div>