Enver Balalic
58398b1e12
LibWeb: Implement the flex order CSS property
...
Adds support for the flex order property and a test page for it
on the browser welcome page.
2022-04-02 18:40:32 +02:00
Idan Horowitz
086969277e
Everywhere: Run clang-format
2022-04-01 21:24:45 +01:00
Idan Horowitz
f45d361f03
LibWeb: Replace ad-hoc EventHandler type with callback function typedef
2022-03-31 01:10:47 +02:00
Sam Atkins
9a60b697aa
LibWeb: Remove redundant [[nodiscard]]
from CSS Parser methods
...
Optional and smart-pointers are already `[[nodiscard]]` so functions
returning them do not need to be declared as such.
2022-03-30 18:43:07 +02:00
Sam Atkins
cd199d9d06
LibWeb: Implement and use parse_a_style_blocks_contents()
2022-03-30 18:43:07 +02:00
Sam Atkins
6a0adbefc7
LibWeb: Tidy up StyleRule API
...
Constantly accessing private `m_foo` fields feels uncomfortable and
doesn't fit well with our code style.
2022-03-30 18:43:07 +02:00
Sam Atkins
75db8b1f86
LibWeb: Spec-comment consume_a_function()
2022-03-30 18:43:07 +02:00
Sam Atkins
512d1df1c4
LibWeb: Spec-comment consume_a_simple_block()
2022-03-30 18:43:07 +02:00
Sam Atkins
5a23965e93
LibWeb: Comment discrepancy from spec in consume_a_declaration()
...
We're calling this in a way that is incorrect, and so the algorithm's
assumption that the next token is an `<ident-token>` is wrong, and we
have to handle that failing. Ideally we would just stop calling this
incorrectly, but until then, let's actually document what is happening.
2022-03-30 18:43:07 +02:00
Sam Atkins
999cc51512
LibWeb: Spec-comment consume_a_component_value()
2022-03-30 18:43:07 +02:00
Sam Atkins
be86d19529
LIbWeb: Spec-comment consume_a_list_of_declarations()
2022-03-30 18:43:07 +02:00
Sam Atkins
e72f42bea1
LibWeb: Spec-comment consume_a_qualified_rule()
2022-03-30 18:43:07 +02:00
Sam Atkins
fe86718035
LibWeb: Spec-comment consume_an_at_rule()
2022-03-30 18:43:07 +02:00
Sam Atkins
d77de5ccec
LibWeb: Spec-comment consume_a_list_of_rules()
2022-03-30 18:43:07 +02:00
Sam Atkins
a4f8056828
LibWeb: Spec-comment parse_a_comma_separated_list_of_component_values
...
The code had to change a bit to match. Previously, we appended an empty
sub-list immediately, but now we append it at the end. The difference
is that if there are no tokens, we now correctly return an empty
list-of-lists, instead of a list containing an empty list.
2022-03-30 18:43:07 +02:00
Sam Atkins
6ec92f5527
LibWeb: Spec-comment parse_a_list_of_component_values()
2022-03-30 18:43:07 +02:00
Sam Atkins
34b3c09462
LibWeb: Spec-comment parse_a_component_value()
2022-03-30 18:43:07 +02:00
Sam Atkins
bcf4254331
LibWeb: Spec-comment parse_a_list_of_declarations()
...
The `parse_as_list_of_declarations()` public method is unused and will
not be used by any user code so has been removed.
2022-03-30 18:43:07 +02:00
Sam Atkins
2aac9f9258
LibWeb: Bring parse_a_declaration()
to spec and add comments
...
User code now calls `parse_as_supports_condition()` which actually does
the conversion to a StyleProperty.
2022-03-30 18:43:07 +02:00
Sam Atkins
239c36a19e
LibWeb: Spec-comment parse_a_rule()
...
We now correctly call convert_to_rule() outside of this function.
As before, I've renamed `parse_as_rule()` -> `parse_as_css_rule()` to
match the free function that calls it.
2022-03-30 18:43:07 +02:00
Sam Atkins
12a787ef8a
LibWeb: Use parse_a_list_of_rules() for @media
and @supports
...
From the spec:
> "Parse a list of rules" is intended for the content of at-rules such
> as @media. It differs from "Parse a stylesheet" in the handling of
> <CDO-token> and <CDC-token>.
- https://www.w3.org/TR/css-syntax-3/#ref-for-parse-a-list-of-rules
2022-03-30 18:43:07 +02:00
Sam Atkins
7a225a380c
LibWeb: Bring parse_a_list_of_rules()
to spec
...
This is not actually used by anything currently, but it should be used
for `@media` and other at-rules.
Removed the public parse_as_list_of_rules() because public functions
should be things that outside classes actually need to use.
2022-03-30 18:43:07 +02:00
Sam Atkins
85d8c652e9
LibWeb: Implement and use "parse a CSS stylesheet" algorithm
...
`parse_a_stylesheet()` should not do any conversion on its rules. This
change corrects that. There are other places where we get this wrong,
but one thing at a time. :^)
2022-03-30 18:43:07 +02:00
Sam Atkins
fc3d51c59e
LibWeb: Use an enum class for the "top-level flag"
2022-03-30 18:43:07 +02:00
Sam Atkins
87b125dcb9
LibWeb: Spec-comment parse_a_stylesheet()
...
Also introduce a `location` parameter when parsing a CSSStyleSheet. This
is not provided by anyone yet.
2022-03-30 18:43:07 +02:00
Sam Atkins
05bd0ca3ee
LibWeb: Rename parse_css()
-> parse_css_stylesheet()
2022-03-30 18:43:07 +02:00
Simon Wanner
6437f5da36
LibWeb: Add basic support for the attr() CSS function
...
CSS Values and Units Module Level 5 defines attr as:
`attr(<q-name> <attr-type>?, <declaration-value>?)`
This implementation does not contain support for the type argument,
effectively supporting `attr(<q-name>, <declaration-value>?)`
2022-03-30 03:18:14 +02:00
Andreas Kling
dd940dfa85
LibWeb: Use font-derived metrics for "line-height:normal"
...
Instead of multiplying the font-size with 1.4f because reasons, we now
ask the font for its preferred line spacing.
2022-03-30 00:57:15 +02:00
Andreas Kling
344374588b
LibGfx: Rename FontMetrics => FontPixelMetrics
...
Let's make it clear in the type name that this contains pixel metrics.
Also rename Font::metrics() => Font::pixel_metrics().
2022-03-30 00:57:15 +02:00
Andreas Kling
0f6dd8c62b
LibGfx: Make Gfx::FontMetrics include the advance of '0' instead of 'M'
...
CSS actually wants the advance of the ASCII '0' character for its "ch"
units, so let's include that instead of the arbitrarily chosen 'M'.
2022-03-30 00:57:15 +02:00
Andreas Kling
2f7b6af87e
LibGfx: Remove code point parameter from Gfx::Font::Metrics
...
Everyone was asking for the glyph width of 'M' anyway. We can just make
that request implicit and simplify the API.
2022-03-30 00:57:15 +02:00
Daniel Glazman
91e1383b85
LibWeb: Implement attribute selector case identifier
2022-03-29 18:53:20 +02:00
Daniel Glazman
049d847230
LibWeb: Clarify attribute selectors when needle is empty
2022-03-29 18:53:20 +02:00
Andreas Kling
427beb97b5
LibWeb: Streamline how inline CSS style declarations are constructed
...
When parsing the "style" attribute on elements, we'd previously ask the
CSS parser for a PropertyOwningCSSStyleDeclaration. Then we'd create a
new ElementCSSInlineStyleDeclaration and transfer the properties from
the first object to the second object.
This patch teaches the parser to make ElementCSSInlineStyleDeclaration
objects directly.
2022-03-29 16:35:46 +02:00
Andreas Kling
3efa6cedec
LibWeb: Remove unused StyleSheetList::m_generation
2022-03-29 16:35:46 +02:00
Andreas Kling
1f9aed2617
LibWeb: Load and use fonts described by @font-face rules :^)
...
When encountering a @font-face rule, StyleComputer will now fire off
a resource request and download the first source URL specified.
Once downloaded, we try to parse it as a TrueType font file, and if it
works, it's added to a cache in StyleComputer. This effectively makes
fonts per-document since every document has its own StyleComputer.
This is very unoptimized and could definitely use some caching, etc.
But it does work on Acid3. :^)
2022-03-29 02:14:20 +02:00
Sam Atkins
6672c19c93
LibWeb: Parse @font-face
rules
...
This is very limited for now, only caring about `font-family` and `src`.
2022-03-28 22:25:25 +02:00
Sam Atkins
804b8c85e8
LibWeb: Implement initial CSSFontFaceRule and FontFace classes
...
For now, this is the bare minimum that's needed: font-family and src.
2022-03-28 22:25:25 +02:00
Sam Atkins
1dcde57922
LibWeb: Bring "parse a list of declarations" closer to spec
...
The work to create a PropertyOwningCSSStyleDeclaration is now moved to
convert_to_style_declaration() instead.
2022-03-28 22:25:25 +02:00
Sam Atkins
da1a819858
LibWeb: Rename parse_css_declaration() -> parse_css_style_attribute()
2022-03-28 22:25:25 +02:00
Andreas Kling
fa71401bec
LibWeb: Rename ComputedValues::offset() => inset()
2022-03-27 18:16:08 +02:00
Andreas Kling
d5bba91a16
LibWeb: Don't round font sizes when looking them up
...
We previously had a rounding error which sometimes led to asking LibGfx
for fonts with slightly wrong sizes.
2022-03-27 01:14:56 +01:00
Sam Atkins
6edea1d59f
LibWeb: Assign limits to CSS properties that cannot be negative
...
I believe this is all of them, but I may have missed some.
Several properties technically do not allow negative numbers but the
description says to accept these as valid, and then clamp them
afterwards to the desired range. As such, we don't reject them during
parsing.
2022-03-26 18:15:08 +01:00
Andreas Kling
fda25f9505
LibWeb: Move HTML dimension value parsing from CSS to HTML namespace
...
These are part of HTML, not CSS, so let's not confuse things.
2022-03-26 17:31:01 +01:00
Andreas Kling
434970f022
LibWeb: Remove the totally ad-hoc parse_html_length()
...
All clients of this API have been migrated to HTML dimension value
parsing instead.
2022-03-26 17:31:01 +01:00
Andreas Kling
28c929e85c
LibWeb: Add parser for the HTML "non-zero dimensions value" microsyntax
2022-03-26 17:31:01 +01:00
Andreas Kling
075bdfdef8
LibWeb: Add a parser for the HTML "dimension value" microsyntax
2022-03-26 17:31:01 +01:00
Karol Kosek
44bfca369a
LibWeb: Resolve style values from the element inline style
...
This will set the background color in the project header on GitHub! :^)
2022-03-26 17:30:49 +01:00
Karol Kosek
0934573deb
LibWeb: Set CSS custom properties from the element inline style
2022-03-26 17:30:49 +01:00
Linus Groh
1e23fd94b1
LibWeb: Use ThreedShadow1 palette color for input border in Default.css
...
This is a bit easier on the eye than black.
2022-03-26 01:35:39 +00:00