summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Painting/BackgroundPainting.cpp
AgeCommit message (Collapse)Author
2022-03-29LibWeb: Don't round numbers too early when painting backgroundsAndreas Kling
Preserve floating point precision and delay rounding until the last moment when figuring out where to paint background layers. This fixes an issue on Acid3 where a thin sliver of red was visible because the background X position was incorrectly rounded by 1px.
2022-03-29LibWeb: Use rounding instead of enclosing_int_rect() when paintingAndreas Kling
By using enclosing_int_rect(), borders and backgrounds of boxes were sometimes 1 pixel off, making things slightly larger than they should be. Fix this by using to_rounded() instead of enclosing_int_rect(). There's definitely more of these type of issues lurking in the code, and we'll get to them in time.
2022-03-25LibWeb: Attach BackgroundAttachment::Fixed to the window view portTimothy Flynn
This fixes the placement of several background images on Acid2, most notably the background of the eyes and the red rectangle near the bottom of the head.
2022-02-18LibWeb: Remove redundant Length::resolved() callsSam Atkins
Now that calc() is also resolved in to_px(), code in the form `foo.resolved(bar).to_px(bar)` can be simplified to `foo.to_px(bar)`.
2022-02-18LibWeb: Remove fallback value from Length::resolved()Sam Atkins
Nobody makes undefined Lengths now, (although actually removing Undefined will come in a later commit) so we can remove this parameter, and `resolved_or_auto()`/`resolved_or_zero()`.
2022-02-04LibWeb: Allow LengthPercentage to hold a calculated valueSam Atkins
Most of the time, we cannot resolve a `calc()` expression until we go to use it. Since any `<length-percentage>` can legally be a `calc ()`, let's store it in `LengthPercentage` rather than make every single user care about this distinction.
2022-01-20LibWeb: Remove reference_for_percent parameter from Length::resolved()Sam Atkins
Despite looking like it was still needed, it was only used for passing to other calls to Length::resolved() recursively. This makes the various `foo.resolved().resolved()` calls a lot less awkward. (Though, still quite awkward.) I think we'd need to separate calculated lengths out to properly tidy these calls up, but one yak at a time. :^)
2022-01-20LibWeb: Convert background-position to LengthPercentageSam Atkins
Not much needed changing this time, hurrah! :^)
2022-01-20LibWeb: Convert background-size from Length to LengthPercentageSam Atkins
Checking these for `auto` is awkward, but separating that will come later. :^)
2021-11-17LibWeb: Implement `background-repeat: round` :^)Sam Atkins
2021-11-17LibWeb: Implement `background-repeat: space`Sam Atkins
2021-11-17LibWeb: Implement background-size :^)Sam Atkins
This is including the `cover` and `contain` modes.
2021-11-17LibWeb: Implement background-position and background-origin :^)Sam Atkins
2021-11-17LibWeb: Manually tile background imagesSam Atkins
This reimplements image tiling instead of using `Painter::blit_tiled()`, so that we will be able to handle CSS's more complicated repetition rules. (Like `background-repeat: space`) Otherwise this does the same as before. :^)
2021-11-17LibWeb: Implement background-clip :^)Sam Atkins
We now pass in the Layout Node so that we can read the BoxModelMetrics. Renamed a couple of variables too for clarity.
2021-11-17LibWeb: Paint backgrounds with multiple layers :^)Sam Atkins
2021-11-17LibWeb: Stop 'no-repeat' from expanding the background areaSam Atkins
Previously, a `background-repeat` value of `no-repeat` in a direction would cause the image to be drawn at exactly that size. This was fine if the image was smaller than the element, but if it was larger, it would draw outside its bounds. Now, it behaves itself. :^)
2021-09-19LibWeb: Move background painting from Box to its own fileSam Atkins
This makes the code accessible to things that aren't a Box, such as InlineNode.