Commit graph

8 commits

Author SHA1 Message Date
Sam Atkins
48ef5c8e84 LibWeb: Use new StyleValue API in ComputedCSSStyleDeclaration
Why manually cast things when a method can do it for you safely?
2021-09-24 15:01:43 +02:00
Andreas Kling
99f9667e5d LibWeb: Simplify ComputedCSSStyleDeclaration property lookup
Factor out the per-property StyleValue generation to a separate function
so we don't have to repeat ourselves so much in property(). :^)
2021-09-18 13:14:40 +02:00
Sam Atkins
3f31f109b5 LibWeb: Speed up computed style calculation
Rather than destroying and rebuilding the entire document layout tree in
every call to `ComputedCSSStyleDeclaration::property()`, we now just
make sure that the layout tree exists.

This speeds up the DOM Inspector significantly, from taking several
seconds to select an element, to almost instant. :^)
2021-09-15 11:24:11 +02:00
kleines Filmröllchen
047c013be0 LibWeb: Add several computed CSS styles
These are mostly combined styles such as background, as well as handling
the Invalid and Custom property IDs (which both make no sense).
2021-09-14 22:02:14 +02:00
Tobias Christiansen
4c1da4d43a LibWeb: Fix opacity ComputedCSSStyleDeclaration
There was a classic copy&paste error, opacity wasn't getting the right
computed value to convert.
2021-09-13 21:26:31 +02:00
Tobias Christiansen
f160fe0407 LibWeb: Add support for a bunch of ComputedCSSStyleDeclarations
This patch adds support for a whole lot of other more easy
ComputedCSSStyleDeclararions.
2021-09-13 20:31:06 +02:00
Andreas Kling
a72fd78713 LibWeb: Log a FIXME when unimplemented computed style is requested
This will help us know which properties to compute next. :^)
2021-09-12 20:44:50 +02:00
Andreas Kling
8b27bc078c LibWeb: Add ComputedCSSSstyleDeclaration and support 2 properties :^)
getComputedStyle(element) now returns a ComputedCSSStyleDeclaration
object, which is a live view of the computed style of a given element.

This works by ComputedCSSStyleDeclaration being a wrapper around an
element pointer. When you ask it for a CSS property, it gets the latest
computed style values from the element and returns them as a
CSS::StyleProperty object.

This first cut adds support for computed 'color' and 'display'.

In case the element doesn't have a corresponding node in the layout
tree, we fall back to using specified style instead. This is achieved by
performing an on-the-fly style resolution for the individual element and
then grabbing the requested property from that resolved style.
2021-09-12 20:44:50 +02:00