Andreas Kling
3406d500a4
LibWeb: Hook up WOFF2 decompression in the StyleComputer
...
With this, we now support WOFF2 fonts on the web :^)
2023-08-12 20:12:13 +02:00
Andreas Kling
6076580a47
LibWeb: Accept "woff2" as a @font-face source format
2023-08-12 20:12:13 +02:00
Aliaksandr Kalenik
bb52d76be3
LibWeb: Delete unused AvailableSize::to_px()
2023-08-12 20:06:01 +02:00
Aliaksandr Kalenik
fce4801460
LibWeb: Replace to_px() with to_px_or_zero() in InlineFormattingContext
...
to_px() usage should be avoided because it might leak saturated
(infinite) values into layout calculations.
2023-08-12 20:06:01 +02:00
Aliaksandr Kalenik
4646867a9f
LibWeb: Replace to_px() with to_px_or_zero() in FormattingContext
...
to_px() usage should be avoided because it might leak saturated
(infinite) values into layout calculations.
2023-08-12 20:06:01 +02:00
Aliaksandr Kalenik
c102bcda9b
LibWeb: Replace to_px() with to_px_or_zero() in TableFormattingContext
...
to_px() usage should be avoided because it might leak saturated
(infinite) values into layout calculations.
2023-08-12 20:06:01 +02:00
Aliaksandr Kalenik
af38f1cba4
LibWeb: Replace to_px() with to_px_or_zero() in GridFormattingContext
...
to_px() usage should be avoided because it might leak saturated
(infinite) values into layout calculations.
2023-08-12 20:06:01 +02:00
Aliaksandr Kalenik
8b99366b9d
LibWeb: Replace to_px() with to_px_or_zero() in FlexFormattingContext
...
to_px() usage should be avoided because it might leak saturated
(infinite) values into layout calculations.
2023-08-12 20:06:01 +02:00
Aliaksandr Kalenik
041d02cbb1
LibWeb: Replace to_px() with to_px_or_zero() in BlockFormattingContext
...
to_px() usage should be avoided because it might leak saturated
(infinite) values into layout calculations.
2023-08-12 20:06:01 +02:00
Aliaksandr Kalenik
57c1fe97fb
LibWeb: Define comparison operators with CSSPixels for AvailableSize
...
This allows to compare CSSPixels with AvailableSize without converting
it to CSSPixels, which might leak saturated (infinite) values into
layout calculations.
2023-08-12 20:06:01 +02:00
Aliaksandr Kalenik
d34007782d
LibWeb: Define operator<
for AvailableSize
2023-08-12 20:06:01 +02:00
Andreas Kling
3a4d386f05
LibWeb: Fetch CSS @font-face fonts in @import'ed style sheets
...
This makes importing Google Fonts via @import rule actually work. :^)
2023-08-12 19:03:59 +02:00
Sam Atkins
337754ae64
LibWeb: Add hack for :host
in pseudo-class serialization
...
The spec for this algorithm is quite outdated, we already have some
other pseudo-classes in here which the spec doesn't cover.
2023-08-12 16:26:32 +02:00
Sam Atkins
a31a0934b8
LibWeb: Use PseudoClassMetadata to simplify serialization
2023-08-12 16:26:32 +02:00
Sam Atkins
b684bab5f1
LibWeb: Make :host()
take a <compound-selector>
...
This matches the spec:
https://drafts.csswg.org/css-scoping-1/#selectordef-host
2023-08-12 16:26:32 +02:00
Sam Atkins
b314a115ca
LibWeb: Use generated PseudoClass data
...
Everything should behave the same as before.
2023-08-12 16:26:32 +02:00
Sam Atkins
f76c614a84
LibWeb: Generate PseudoClass metadata
...
The usual to/from-string functions, and metadata about whether the
pseudo-class is a a function or not, and what type of parameter it
takes.
2023-08-12 16:26:32 +02:00
Aliaksandr Kalenik
e25b1f76e1
LibWeb: Forbid usage of indefinite width in calculate_min{max}_height
...
Changing `calculate_min_content_heigh()` and
`calculate_min_content_heigh()` to accept width as `CSSPixels`, instead
of `AvailableSize` that might be indefinite, makes it more explicit
that width is supposed to be known by the time height is measured.
This change has a bit of collateral damage which is rows height
calculation regression in `table/inline-table-width` that worked before
by accident.
2023-08-12 16:26:08 +02:00
Andi Gallo
89305f1481
LibWeb: Copy button style properties for generated table and cell
2023-08-12 13:36:37 +02:00
Andi Gallo
a24deff21b
LibWeb: Remove unused computed values for removed button flow-root
2023-08-12 11:48:45 +02:00
Jonah
0b2da4f8c6
LibWeb: Add the default user agent MathML stylesheet
...
We now apply MathML's default user agent style sheet along with other
default styles. This sheet is not mixed in with the other styles in
CSS/Default.css because it is a namespaced stylesheet and so has to
be its own sheet.
2023-08-12 07:59:23 +01:00
Jonah
fd0ee8ae7b
LibWeb: Escape quotes in style sheet sources
...
Some rules in style sheets contain quotes, escaping them allows us to
generate code that actually compiles for them.
2023-08-12 07:59:23 +01:00
Jonah
442602bec8
LibWeb: Generate MathML Elements
...
We will now generate MathML elements when parsing HTML.
2023-08-12 07:59:23 +01:00
Jonah
52d6df5ee5
LibWeb: Add the MathML Element
...
This patch introduces the MathML element, which provides the interface
all MathML elements are built from.
2023-08-12 07:59:23 +01:00
Sam Atkins
a9620d8784
LibWeb: Implement the :target
selector pseudo-class
...
We don't yet set the Document's target element in most cases, so this
does not function very well. But that will improve once we *do* set it,
which involves a more complete Navigables implementation.
2023-08-12 08:39:04 +02:00
Sam Atkins
8bd3b74e3a
LibWeb: Implement and use "scroll to the fragment" algorithm
...
This will eventually be used by Navigable but for now, it's just when
traversing the history.
2023-08-12 08:39:04 +02:00
Sam Atkins
be9c975b2e
LibWeb: Implement algorithms for determining an indicated element
2023-08-12 08:39:04 +02:00
Sam Atkins
13b4bf48a8
LibWeb: Give Document a "target element"
...
The target element is the one matching the URL fragment. We don't yet
set it to anything.
2023-08-12 08:39:04 +02:00
Aliaksandr Kalenik
9101c8d079
LibWeb: Use available space to resolve table container width
...
Using avilable space directly while resolving table container width
allows to avoid assigning it to table wrapper box content width which
sometimes involves infinite (saturated) values.
Also this allows to get rid of set_max_content_width() which is a hack
that allows to bypass set_content_width() to assign infinite
(saturated) width to a box.
Closes https://github.com/SerenityOS/serenity/issues/19521
2023-08-11 19:36:19 +02:00
Andi Gallo
a426263dee
LibWeb: Remove 3 decimal places rounding hack in Length::percentage_of
...
CSSPixels uses fixed point now.
2023-08-11 11:00:27 +01:00
Andi Gallo
b34b80104f
LibWeb: Fix buttons with TextNode label
...
Fixes #20472 .
2023-08-11 10:02:27 +02:00
Hendiadyoin1
ce188c9a9c
LibWeb: Allow direct rouding of CSSPixelRects to CSSPixelRects
...
Preciously we were casting to float, round and cast back, which actually
might loose precision and was quite ugly.
2023-08-10 12:24:21 +02:00
Andreas Kling
9e22f01eba
LibWeb: Stub out SVGMaskElement
...
Just enough that we stop creating layout nodes for mask elements, which
was making some SVG content look very wrong. :^)
2023-08-10 11:36:17 +02:00
Luke Wilde
fb33514029
LibWeb: Support skew{X,Y} in stacking context transforms
...
https://drafts.csswg.org/css-transforms/#SkewDefined
2023-08-10 05:21:33 +02:00
Andi Gallo
34cd7f4c22
LibWeb: Verify that table cells have a paintable when collecting them
...
Replicate the more conservative way it's done for other nodes, for
which we verify whether they have a paintable before doing
painting-related operations with it.
Fixes crash on https://www.haiku-os.org/ .
2023-08-10 05:14:40 +02:00
Andi Gallo
670bbf24e5
LibWeb: Check paintable of target against null in mousewheel handling
2023-08-10 05:13:02 +02:00
Aliaksandr Kalenik
5003b1a421
LibWeb: Use automatic width to resolve min/max-width for inline boxes
2023-08-10 05:10:44 +02:00
Aliaksandr Kalenik
b34b0a1cd3
LibWeb: Use root content width as automatic width if children inline
...
Returning greatest_child_width() from automatic_content_width() in BFC
if root box children are inline and there are min/max-width that caused
width to be changed after IFC layout while content_width should be
always set to correct value by layout_inline_children() regardless of
layout mode.
2023-08-10 05:10:44 +02:00
Luke Wilde
7550b4175e
LibWeb: Unregister IntersectionObserver in finalize, not the destructor
...
Otherwise it UAFs the intersection root. Not sure how this didn't cause
a lot of crashes!
2023-08-09 22:12:54 -04:00
Luke Wilde
5694981352
LibWeb: Implement Element.hasAttributeNS
...
Particularly needed by xkcd's Right Click comic. https://xkcd.com/1975/
2023-08-09 22:10:58 -04:00
Andreas Kling
9c3e9e8981
LibWeb/Streams: Make ReadRequest GC-allocated
...
This allows it to keep its edges alive. Fixes an intermittent crash seen
by UBSAN on CI. :^)
2023-08-09 19:16:07 +02:00
Andreas Kling
40bdcdf966
LibWeb/Streams: Add WritableStreamDefaultController::visit_edges()
2023-08-09 19:16:07 +02:00
Andreas Kling
26d5d86682
LibWeb/Streams: Mark ReadableStreamGenericReaderMixin::m_realm
2023-08-09 19:16:07 +02:00
Tom
d7a3b65a44
LibWeb: Vertically align HTML Button content
2023-08-09 18:34:17 +02:00
Karol Kosek
7fa5dd7a92
LibWeb: Implement more steps in 'fetching a single module script'
...
By using fetch, the request now also follows redirects, which in the end
makes the 'Polyfilled Features' section on
https://github.github.com/browser-support/ load :^)
2023-08-09 12:08:06 -04:00
Aliaksandr Kalenik
6354f950fd
LibWeb: Support "order" property for items in GridFormattingContext
...
Closes https://github.com/SerenityOS/serenity/issues/20434
2023-08-09 18:01:36 +02:00
Aliaksandr Kalenik
0a4b869233
LibWeb: Remove boxes_to_place from GridFormattingContext class members
...
Make it local variable in place_grid_items() instead.
2023-08-09 18:01:36 +02:00
Aliaksandr Kalenik
bf4e2f3e9c
LibWeb: Add hit testing API in internals
object
...
Introduces `internals.hitTest(x, y)` that is going to allow us write
tests for hit testing :)
2023-08-09 17:26:44 +02:00
Andreas Kling
22a858a0cb
LibWeb: Don't parse inline style sheets during HTML fragment parsing
...
Some websites (like Reddit) like to instantiate "components" by setting
innerHTML to a huge chunk of stuff. Sometimes those huge chunks of stuff
contain inline style sheets (i.e `<style>` elements).
Before this change, we would end up parsing the CSS in those elements
multiple times, because we had no way of knowing that we were within
a fragment parser's temporary document.
This patch avoids the extra CSS parsing work by adding adding a flag to
Document that tells us it's being used by the fragment parser. Then, we
simply avoid parsing CSS for style elements in such documents. The CSS
then gets parsed immediately upon insertion into the proper DOM.
2023-08-09 17:09:28 +02:00
Andreas Kling
97ebfd9f0f
LibJS: Make Value::to_string_without_side_effects() infallible
...
Work towards #20449 .
2023-08-09 17:09:16 +02:00