mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-15 15:42:52 +00:00
InlinePaintable was an ad-hoc paintable type required to support the fragmentation of inline nodes across multiple lines. It existed because there was no way to associate multiple paintables with a single layout node. This resulted in a lot of duplicated code between PaintableBox and InlinePaintable. For example, most of the CSS properties like background, border, shadows, etc. and hit-testing are almost identical for both of them. However, the code had to be duplicated to account for the fact that InlinePaintable creates a box for each line. And we had quite many places that operate on paintables with a code like: ``` if (box.is_paintable_box()) { // do something } else (box.is_inline_paintable()) { // do exactly the same as for paintable box but using InlinePaintable } ``` This change replaces the usage of `InlinePaintable` with `PaintableWithLines` created for each line, which is now possible because we support having multiple paintables per layout node. By doing that, we remove lots of duplicated code and bring our implementation closer to the spec.
23 lines
499 B
HTML
23 lines
499 B
HTML
<style>
|
|
span {
|
|
z-index: 10;
|
|
background: orange;
|
|
position: relative;
|
|
opacity: 0.5;
|
|
font-size: 100px;
|
|
}
|
|
div {
|
|
z-index: 5;
|
|
width: 100px;
|
|
height: 100px;
|
|
background: green;
|
|
position: relative;
|
|
top: -10px;
|
|
}
|
|
</style><span id="inline-stacking-context">hello</span><div></div>
|
|
<script src="../include.js"></script>
|
|
<script>
|
|
test(() => {
|
|
println(internals.hitTest(50, 50).node === document.getElementById("inline-stacking-context"));
|
|
});
|
|
</script>
|