Commit Graph

2245 Commits

Author SHA1 Message Date
Edwin Hoksberg
dd843ae282 LibWeb: Implement grid-template function fit-content()
(cherry picked from commit e5deaa1c073f4762fe2cdc7d36f90099f0ca4d11)
2024-07-28 07:31:47 -04:00
Andreas Kling
c2fce0f19c LibWeb: Implement :host and :host(<compound-selector>) selector matching
The :host family of pseudo class selectors select the shadow host
element when matching against a rule from within the element's shadow
tree.

This is a bit convoluted due to the fact that the document-level
StyleComputer keeps track of *all* style rules, and not just the
document-level ones.

In the future, we should refactor style storage so that shadow roots
have their own style scope, and we can simplify a lot of this.

(cherry picked from commit 4c326fc5f6f64797764e7f32a9789b74665f2fec)
2024-07-27 22:53:52 -04:00
Andreas Kling
0b30b73e85 LibWeb: Don't infer descendant combinator for <compound-selector>
This fixes an issue where :host(foo) would parse as if "foo" was the
on the right side of a descendant combinator.

Not testable yet, but will be in the next commit.

(cherry picked from commit 274c46a3c97e1f9969d18b7704ced4c39770e152)
2024-07-27 22:53:52 -04:00
Andreas Kling
80b06d464f LibWeb: Make details and summary elements display:block in the UA style
This is the expected behavior per the HTML spec. Fixes an issue where
styling these elements wouldn't have the expected effect unless you also
set the display property.

(cherry picked from commit 3faff34bf6a290e4df1c73f92e8c7d992a78a8e0)
2024-07-27 15:13:37 -04:00
Edwin Hoksberg
360cea781b LibWeb: Support content-visibility css
(cherry picked from commit 020b20d817d51dda9c0f9306543c69f4020891eb)
2024-07-23 21:15:27 -04:00
Colin Reeder
a745a849cf LibWeb: Add more legacy -webkit- aliases
(cherry picked from commit 5c315b532e4edc561f30dfc492db9b2dcb59d5de)
2024-07-23 21:15:27 -04:00
Colin Reeder
70388b5676 LibWeb: Add support for -webkit-text-fill-color
(cherry picked from commit 449f81bfbed8343cfb49fcef4a890c33922889e5)

Commit altered to fix cherry-pick issue

Co-Authored-By: circl <circl.lastname@gmail.com>
2024-07-23 21:15:27 -04:00
Andreas Kling
9f173e5101 LibWeb: Verify something was removed in StyleSheetList::remove_sheet()
This would have saved me an hour of debugging, so putting it here for
the next person. :^)

(cherry picked from commit ebacb921dac6f8fd335d917100e6b04521a3f893)
2024-07-23 08:15:57 -04:00
simonkrauter
61f38a1fa7 LibWeb: Support accent-color for range input and progress element
Fixes #466

(cherry picked from commit 9df8e1f22468884db353f55d10823cd3d15c511b)
2024-07-22 21:29:38 -04:00
Sam Atkins
6ab6138fe6 LibWeb/CSS: Make StringStyleValue hold a FlyString
We already have a FlyString of its value from parsing, and most users
also want a FlyString from it, so let's use that instead of converting
backwards and forwards.

The two users that did want a String are:
- Quotes, which make sense as FlyString instead, so I've converted that.
- Animation names, which should probably be FlyString too, but the code
  currently also allows for other kinds of StyleValue, and I don't want
  to dive into this right now to figure out if that's needed or not.

(cherry picked from commit 9fb44cb05777c6d7a8a1950258edadfcee6d4e09)
2024-07-21 14:07:33 -04:00
Sam Atkins
6393e542ab LibWeb/CSS: Remove unused StyleProperties::grid_area()
This does not appear to be correct; the `grid-area` property's value is
quite complicated, and not just a string.

(cherry picked from commit d2f04b9f0415ebfebb1d8f6386ff13f8df053674)
2024-07-21 14:07:33 -04:00
Andreas Kling
4ce5aeb312 LibWeb: Skip CSS tokenizer filtering when string has no '\r' or '\f'
When loading a canned version of reddit.com, we end up parsing many many
shadow tree style sheets of roughly ~170 KiB text each.

None of them have '\r' or '\f', yet we spend 2-3 ms for each sheet just
looping over and reconstructing the text to see if we need to normalize
any newlines.

This patch makes the common case faster in two ways:

- We use TextCodec::Decoder::to_utf8() instead of process()
  This way, we do a one-shot fast validation and conversion to UTF-8,
  instead of using the generic code-point-at-a-time callback API.

- We scan for '\r' and '\f' before filtering, and if neither is present,
  we simply use the unfiltered string.

With these changes, we now spend 0 ms in the filtering function for the
vast majority of style sheets I've seen so far.

(cherry picked from commit dba6216caa71796f25831908035cd9eb0fb54715)
2024-07-21 12:37:05 -04:00
Diego Frias
e4d3b9060a LibWeb: Implement the :has() pseudo-class
See https://drafts.csswg.org/selectors-4/#relational.

(cherry picked from commit f63a945ba0300551417c740e450957f29c9b73d1)
2024-07-21 11:10:11 -04:00
Luke Warlow
e8bcd3842d LibWeb: Implement support for scrollbar-gutter
This property is now correctly parsed.

Ladybird always uses overlay scrollbars so this property does nothing.

(cherry picked from commit 662317726549cd2dde4c7902b99f0b83397a3396)
2024-07-14 20:44:46 -04:00
Bastiaan van der Plaat
6ab28fd568 LibWeb/CSS: Serialize transform scale percentage values as numbers
(cherry picked from commit c81a640f3ed424b11830fbe9777f1a267240577f)
2024-07-14 19:34:39 -04:00
Colin Reeder
bf0a7667a0 LibWeb: Handle inline-start and inline-end as float values
Should resolve #449 for LTR languages at least

(cherry picked from commit d427344f39581cd7789280949eb6d102b39218a3)
2024-07-14 16:45:48 -04:00
Tim Ledbetter
fe5ccd3e0c LibWeb: Add styling for disabled button elements
(cherry picked from commit c92222dcae6bf641fc7da4fb568b0bb640ceb7e4)
2024-07-14 16:45:21 -04:00
simonkrauter
7b353a3a55 LibWeb: Define width for -webkit-slider-runnable-track
Fixes LadybirdBrowser/ladybird#512

(cherry picked from commit b5e80db2259448bc0b3dc48d88f53e8d1880987e)
2024-07-14 06:57:50 -04:00
rmg-x
c30d2197bc LibWeb: Remove StyleProperties::compute_line_height(Layout::Node)
This method was unused and a FIXME remained for combining it with
another, similar method.

(cherry picked from commit df7f7268db5edb37b735f30586d774544537e342)
2024-07-14 06:56:56 -04:00
simonkrauter
8884386b4e LibWeb: Harmonize look of range input element
Previously the entire slider track was colored.
Now only the lower part of the slider track (left side of the thumb) is
colored.
Chrome and Firefox do the same.

(cherry picked from commit 7766909415312b971252f8c7750b0a1873fd5ba0)
2024-07-14 06:56:43 -04:00
Luke Warlow
85b5be0a20 LibWeb: Implement :modal pseudo class
Adds the :modal pseudo class which matches dialogs opened with
showModal().

(cherry picked from commit 63a5ff70e5f3bee10839415885a158e304719fec)
2024-07-13 21:52:41 -04:00
Gingeh
d532331f34 LibWeb/CSS: Support hwb, oklab and oklch color functions
(cherry picked from commit e8d32bab58d9ffb183ee71ee6516d49556db136b,
manually amended to fix the two diags mentioned in
https://github.com/LadybirdBrowser/ladybird/pull/385#issuecomment-2227126447
)
2024-07-13 21:43:38 -04:00
Gingeh
052ff6e141 LibWeb/CSS: Split parse_rgb_or_hsl_color into separate functions
(cherry picked from commit 490a36bab18873db632496e594152b68cd2b8ca3)
2024-07-13 21:43:38 -04:00
simonkrauter
74408dae20 LibWeb: Use system colors for input type range and progress as default
Instead of using fixed arbitrary colors for the background of the bar,
AccentColor and Background are now used.

(cherry picked from commit 062a266574a24fe13f2a77401b97f833c3cdd099)
2024-07-13 21:40:59 -04:00
Tim Ledbetter
1149e8a0e9 LibWeb/CSS: Use serif for font and font-family initial property values
These properties previously used sans-serif for their initial values.

(cherry picked from commit 0a1fc7ee132840c4e888967ecdd70e698d2ead33)
2024-07-13 18:22:23 -04:00
Tim Ledbetter
b511ecee44 LibWeb/CSS: Set initial value of color property to canvastext
Previously the non-standard value `-libweb-palette-base-text` was used.

(cherry picked from commit 58589d6250696c86b3816efb979536e0633dafca)
2024-07-13 18:22:23 -04:00
Edwin Hoksberg
e2bf7d1a36 LibWeb: Add attribute list that must always be compared without casing
(cherry picked from commit 2b30414c1d8641eaf4212db69e40a4381005314c)
2024-06-28 10:56:14 +02:00
Ali Mohammad Pur
7b47c57c54 LibWeb/CSS: Avoid capturing structured binding in generic lambda
Apple Clang doesn't like this, rather than waiting for their version of
random-clang-commit-to-call-a-release to catch up with llvm trunk, just
work around the issue.

Fixes #186.

(cherry picked from commit 8c9d3b30cf62016ffb03e425f1e7e3f2461262bf)
2024-06-27 19:02:24 +02:00
Matthew Olsson
5e4e39d84a LibWeb: Remove TimingFunction in favor of EasingStyleValue::Function
Now that EasingStyleValue is a lot nicer to use, there isn't much reason
to keep TimingFunction around.

(cherry picked from commit 7950992fc21e2428a7f32954bbe893a2b2d58cf7,
manually amended with the output of `git clang-format master`)
2024-06-27 14:49:14 +02:00
Matthew Olsson
e301c1d038 LibWeb: Parse easing values manually
The values aren't that complex, so it doesn't make much sense to have a
dedicated generator for them. Parsing them manually also allows us to
have much more control over the produced values, so as a result of this
change, EasingStyleValue becomes much more ergonomic.

(cherry picked from commit 667e313731f06fabf2a3f75893c3e8f15a4172be,
manually amended with the output of `git clang-format master`)
2024-06-27 14:49:14 +02:00
Andreas Kling
69514c8a18 LibWeb: Improve FIXME message about getComputedStyle() properties
Let's log which property we're trying to look up, since that's the most
interesting part!

(cherry picked from commit f7a83e57554c7a98cda165ea1fa18356a6ee54d9)
2024-06-26 23:07:42 +02:00
Andreas Kling
7cd1114f05 LibWeb: Remove unnecessary FIXME marker for CSSStyleDeclaration.cssFloat
(cherry picked from commit 4c94202e9734099b6e2839f5495b8280eec2ab2f)
2024-06-26 23:07:42 +02:00
Andreas Kling
99851591b5 LibWeb: Make CSSKeyframeRule.parentRule actually point to parent rule
(cherry picked from commit 19fa630fa7e8342673b2aaa23e451f221533f12c)
2024-06-26 23:07:42 +02:00
Andreas Kling
ea2876bc6f LibWeb: Implement CSSKeyframesRule.cssRuleList
To make this straightforward, CSSKeyframesRule now uses a CSSRuleList
for internal storage.

(cherry picked from commit 7f2c833a39e150c7372299dcfe4d2d5590ae779f)
2024-06-26 23:07:42 +02:00
Andreas Kling
da836c344a LibWeb: Implement CSSStyleDeclaration.parentRule
This readonly attribute returns the containing CSS rule, or null (in the
case of element inline style).

(cherry picked from commit a12d28fd3053638ce6f4215bed2d8d45cda86375)
2024-06-26 23:07:42 +02:00
Andreas Kling
47d7a3648e LibWeb: Allow flex-basis: {min,max,fit}-content
(cherry picked from commit 9c02ace89785cbc185553dc2711f79c4ad1bf389)
2024-06-26 14:13:40 +02:00
Jamie Mansfield
33262421a2 LibWeb: Remove is_media_feature_name function
This was made redundant in GH-12971 (SerenityOS), and removing it drops
a FIXME :^)

See:
- https://github.com/SerenityOS/serenity/pull/12971

(cherry picked from commit be08abbf8a0a62ae46275c3133f711c27b2efa02)
2024-06-26 14:13:20 +02:00
Daniel Bertalan
8d2a8dbb8b Everywhere: Write dtors for types with incomplete members out-of-line
These are rejected by Clang (19) trunk as a result of
https://github.com/llvm/llvm-project/pull/77753.

(cherry picked from commit bf1f631f257e90e91b0b45a6454d731b4b98914c)
2024-06-25 17:42:49 +02:00
Jamie Mansfield
4913e09a82 LibWeb/CSS: Implement FontFaceSet.onloadingerror 2024-06-08 14:08:14 -04:00
Jamie Mansfield
9bfdecd165 LibWeb/CSS: Implement FontFaceSet.onloadingdone 2024-06-08 14:08:14 -04:00
Jamie Mansfield
06c1934c3e LibWeb/CSS: Implement FontFaceSet.onloading 2024-06-08 14:08:14 -04:00
Jamie Mansfield
c171c9a6ec LibWeb/CSS: FontFaceSet extends EventTarget 2024-06-08 14:08:14 -04:00
Jamie Mansfield
f99508a53a LibWeb/CSS: Stub FontFaceSet.check 2024-06-08 14:08:14 -04:00
Matthew Olsson
e2cb25e35c LibWeb: Support interpolation of mixed percentage dimension units 2024-06-02 15:12:17 +02:00
Tim Ledbetter
0b0ad5c9db LibWeb: Calculate width property resolved value correctly
This means that relative width values are now correctly resolved when
calling `getComputedStyle()`.
2024-05-28 08:08:31 +02:00
Shannon Booth
97bf9e7953 LibWeb: Stub out Window-Management proposal extensions to Screen API
As defined in https://w3c.github.io/window-management
2024-05-27 17:24:51 -06:00
MacDue
517379ff80 LibWeb: Resolve basic-shape clip-paths
These will be ignored within SVGs (for now SVGs only support <clipPath>
elements), but will allow clipping standard HTML elements.
2024-05-26 07:55:50 +02:00
MacDue
0135af6e60 Meta: Add basic-shape as a CSS property value type 2024-05-26 07:55:50 +02:00
MacDue
120915048c LibWeb: Parse the polygon() basic shape function 2024-05-26 07:55:50 +02:00
MacDue
5f17d9b34a LibWeb: Add BasicShapeStyleValue to represent CSS basic shapes
See: https://www.w3.org/TR/css-shapes-1/#basic-shape-functions

This patch only implements the `polygon()` basic shape (with the rest
left as FIXMEs).
2024-05-26 07:55:50 +02:00