Commit graph

53658 commits

Author SHA1 Message Date
MacDue a93ba23e10 Base: Add some examples of SVG gradients with different spreadMethods
The radial gradients here are rendered correctly as focal radius is
zero, so the focal point is the center of the start circle.
2023-08-20 20:04:10 +02:00
MacDue 46f42d9755 LibWeb: Add support for the SVG gradient spreadMethod attribute 2023-08-20 20:04:10 +02:00
MacDue 1ecb2cf28c LibGfx: Add FIXME for SVG/canvas radial gradients
The current implementation assumes the focal point is the center of the
start circle, for most cases the difference this makes is very subtle,
but becomes more apparent with spreadMethod=repeat/reflect.
2023-08-20 20:04:10 +02:00
MacDue b9294e5fdf LibGfx: Add support for SVG repeat/reflect gradients 2023-08-20 20:04:10 +02:00
Sam Atkins a48b2c1c66 LibWeb: Fill in missing kinds of calc() expansion in StyleComputer
This is all of them currently, except Length, because we lack the needed
information to be able to expand font-relative lengths.

The whole way `expand_unresolved_values()` works is awkward, but at some
point we'll be able to run the simplification algorithm on the
calculation, which will either return a single value, or a new
calculation that's simplified as much as possible.

Mostly I just wanted that FIXME log message to go away, because it's
overwhelming on certain sites.
2023-08-20 19:38:03 +02:00
Sam Atkins 2c7603f2ae LibWeb: Add helper for creating <dimension> CSS tokens 2023-08-20 19:38:03 +02:00
Andreas Kling 27ddfa84fa LibWeb: Accept height: {min,max,fit}-content
And treat them as "auto" for now, per CSS-SIZING-3, with a FIXME about
supporting more layout directions.

This fixes an issue on MDN where `height: max-content` was not
overriding height from non-CSS presentational hints.
2023-08-20 19:37:50 +02:00
Andreas Kling 90e95d38d7 LibWeb: Make align-items: normal behave like stretch on flex items
CSS-ALIGN-3 tells us that `normal` behavior inside flex containers is
simply to behave as `stretch` so this patch makes them behave the same
inside FFC.

Furthermore, we change the `align-items` initial value to `normal`,
matching other engines.
2023-08-20 19:37:50 +02:00
Aliaksandr Kalenik d05be0d504 LibWeb: Fix Request::visit_edges to actually visit m_body
This fixes bug introduced in bdd3a16b16
that `m_body` is not visited because `BodyType` variant has
`JS::NonnullGCPtr` instead of `JS::GCPtr`.
2023-08-20 19:08:37 +02:00
Andi Gallo 769f11f9ae LibWeb: Implement table missing cells fixup
Fixes #19936.
2023-08-20 18:38:15 +02:00
Andi Gallo 4c0816b002 LibWeb: Move table grid slots functionality to separate module 2023-08-20 18:38:15 +02:00
Sam Atkins 6367b6a3d0 LibWeb: Use x-macro for StyleValue::Type instead of manual boilerplate
This saves us from having to manually write these every time we add a
new type of StyleValue:

- bool is_foo() const;
- FooStyleValue const& as_foo() const;
- FooStyleValue& as_foo();
2023-08-20 17:59:36 +02:00
Sam Atkins f7f7ab9775 LibWeb: Forward-declare RevertStyleValue 2023-08-20 17:59:36 +02:00
Sam Atkins fae05faf7f LibWeb: Rename StyleValue::Type::Url -> URL
This matches the URLStyleValue name. (This will be important shortly.)
2023-08-20 17:59:36 +02:00
Aliaksandr Kalenik 01cc14714e LibWeb: Implement getting "inclusive ancestor navigables" of a document 2023-08-20 16:07:24 +02:00
Andreas Kling e211f6c925 LibWeb: Implement getting "ancestor navigables" of a document 2023-08-20 16:07:24 +02:00
Aliaksandr Kalenik c8271ac9e6 LibWeb: Start fleshing out "navigate to a fregment" for Navigables 2023-08-20 16:06:56 +02:00
Aliaksandr Kalenik d5adb7f10c LibWeb: Implement "finalize a same-document navigation" 2023-08-20 16:06:56 +02:00
Aliaksandr Kalenik 37f5253ec9 LibWeb/Layout: Add support for grid-auto-flow in GFC 2023-08-20 15:36:18 +02:00
Andreas Kling 703c2bb06e LibWeb: Add support for parsing grid-auto-flow CSS property
Co-Authored-By: Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
2023-08-20 15:36:18 +02:00
Sam Atkins 1a5533e528 LibWeb: Tokenize CSS numbers as doubles
Every later stage uses doubles, so dropping that precision right at the
start of parsing is a little silly. :^)
2023-08-20 14:25:18 +01:00
Sam Atkins c20df751c9 LibWeb: Use correct NumericLimits in CalculatedStyleValue 2023-08-20 14:25:18 +01:00
Sam Atkins 1feacd4b52 LibWeb: Use doubles for CSS dimension types
Avoid unintentionally converting between float and double multiple times
by just using double everywhere. Also, remove the unused `int` versions
of their constructors.
2023-08-20 14:25:18 +01:00
Sam Atkins 95f80bc65b LibWeb: Use double in CSS Token
It was already a double internally, so let's expose that and get rid of
some of clangd's red wiggly underlines.
2023-08-20 14:25:18 +01:00
Shannon Booth 9cf5b67162 LibWeb: Return a HTMLFormControlsCollection from HTMLFormElement element
Instead of a HTMLCollection
2023-08-20 11:04:03 +02:00
Shannon Booth 27dd2a40ad LibWeb: Implement HTMLFormControlsCollection
This collection is used in the form element for when element lookup
yields multiple elements.
2023-08-20 11:04:03 +02:00
Shannon Booth daefe744ba LibWeb: Implement RadioNodeList
This interface is used in the interface for HTMLFormControlsCollection
as a live view over its matching elements.

Currently the "value" attribute for this interface is left
unimplemented.
2023-08-20 11:04:03 +02:00
Shannon Booth c2bf391f81 LibWeb: Don't mark LiveNodeList as final
This is to accommodate for adding the RadioNodeList interface which
returns a live list of elements.
2023-08-20 11:04:03 +02:00
Shannon Booth 15944c5b26 LibWeb: Const qualify HTMLCollection::length 2023-08-20 11:04:03 +02:00
Andrew Kaster 041d5bff91 Meta: Port changes to gn build
This commit includes gn changes for the following commits:
625aac2367
8451c4d91c
8fcf42f684
9ba4c33940
1d6c2cb287
8e5b2907f6
d68433653a
2023-08-19 21:05:06 -06:00
Andrew Kaster 863fad0e32 Meta: Add ccache compiler launcher to gn build 2023-08-19 21:05:06 -06:00
Andrew Kaster 50383d318c Toolchain: Add a script to build GN from source 2023-08-19 21:05:06 -06:00
Andrew Kaster 0acd87954b Meta: Add Serenity Kernel to gn build 2023-08-19 21:05:06 -06:00
Andrew Kaster f4e37c8ad4 Meta: Add serenity toolchain to gn build 2023-08-19 21:05:06 -06:00
Andrew Kaster f8e1544f41 StateMachineGenerator: Pass output file as an argument
This allows us to avoid shell redirection to create output files, and
will help with the GN build.
2023-08-19 21:05:06 -06:00
Andrew Kaster f87a488b22 AK: Silence -Wimplicit-const-int-float-conversion in clamp_to_int 2023-08-19 21:05:06 -06:00
Andrew Kaster 871485cc0d Meta: Port fe672989a9 to gn build 2023-08-19 21:05:06 -06:00
0GreenClover0 f6c3ec3742 LibWeb: Add Base::apply_presentational_hints call to <symbol> element 2023-08-20 05:03:27 +02:00
Andreas Kling d296992fb3 LibWeb: Make StackingContext point to paint tree instead of layout tree
Eventually we should not need the layout tree for anything when painting
and this code will only look at the paint tree. For now, this is just
another step in that direction.
2023-08-20 05:02:59 +02:00
Andreas Kling 1e0ea45fe5 LibWeb: Make sure that SVG use and symbol elements get paintables
I'm about to make StackingContext traverse the paintable tree instead of
actually traversing the layout tree, and it turns out we were not
creating paintables for these SVG elements.

Also switch them to Layout::Box instead of the default InlineNode to
make the trees look a bit less weird. Ultimately, we should do something
specialized for these subtrees, but for now this'll do.
2023-08-20 05:02:59 +02:00
Andreas Kling 3d7c880a42 LibWeb: Give DOM::Node a direct pointer to its Paintable
Instead of going via the layout tree.
2023-08-20 05:02:59 +02:00
Andreas Kling 25375bf1d5 LibWeb: Make Document::paintable() return a ViewportPaintable 2023-08-20 05:02:59 +02:00
Andreas Kling 8bb275f2ea LibWeb: Move painting logic from Layout::Viewport to ViewportPaintable 2023-08-20 05:02:59 +02:00
Andreas Kling c01c4b41e2 LibWeb: Add ViewportPaintable to represent viewports in the paint tree
This patch just adds the new root paintable and updates the tests
expectations. The next patch will move painting logic from the layout
viewport to the paint viewport.
2023-08-20 05:02:59 +02:00
Andreas Kling 136ac1a6a5 LibWeb: Add virtuals to check if Paintable is PBox or PWithLines
Instead of inferring the type of paintables by looking at the type of
their origin in the layout tree, let's ask them directly.
2023-08-20 05:02:59 +02:00
Andreas Kling 6b3af92262 LibWeb: Give paintables their own pointer to the BrowsingContext 2023-08-20 05:02:59 +02:00
Andreas Kling e67ac16862 LibWeb: Give Paintable its own pointer to the corresponding DOM node
Instead of going through the layout node's DOM pointer.
2023-08-20 05:02:59 +02:00
Andreas Kling 216bd513fa LibWeb: Make the paint tree a proper standalone tree
Until now, paint trees have been piggybacking on the layout tree for
traversal, and paintables didn't actually have their own parent/child
pointers.

This patch changes that by making Paintable inherit from TreeNode, and
adding a new pass to LayoutState::commit() where we recursively build
the new paint tree.
2023-08-20 05:02:59 +02:00
Andreas Kling 4d4dbacfc3 LibWeb: Remove all the unused functions from TreeNode 2023-08-20 05:02:59 +02:00
Andreas Kling 2f3e7187ca LibWeb: Remove unused TreeNode::is_child_allowed()
This is not used by any of the TreeNode template users.
2023-08-20 05:02:59 +02:00