Commit Graph

1769 Commits

Author SHA1 Message Date
MacDue
f3a6fe256f Tests/LibWeb: Add a ref test for many wacky SVG radialGradients
Believe it or not, these are all correct (± a pixel), there meant to
look like that!
2023-08-22 20:25:57 +02:00
MacDue
4ad0ac465e Tests/LibWeb: Update reference for svg-gradient-spreadMethod.html 2023-08-22 20:25:57 +02:00
Andreas Kling
0b83717ea2 AK: Make SourceGenerator::fork() infallible 2023-08-22 13:08:24 +02:00
Andrew Kaster
b3bd232a5e LibWeb: Implement StructuredSerialize for BigIntObject and Symbol 2023-08-22 13:08:08 +02:00
Andi Gallo
685ef4ec82 LibWeb: Stop collecting lookahead items on forced break
This avoids a crash since such items don't have a node nor CSS
properties. Fixes crashes on Wikipedia pages which contain preformatted
code.
2023-08-22 11:33:45 +02:00
Aliaksandr Kalenik
cca779e7f6 LibWeb: Treat grid items with z-index != auto as positioned elements 2023-08-22 11:33:24 +02:00
Aliaksandr Kalenik
95a8dec373 LibWeb: Treat grid item as it creates stacking context during painting
Grid specification https://www.w3.org/TR/css-grid-2/#z-order defines
special painting order for grid items which should be the same as for
defined for inline-blocks in CSS2.
2023-08-22 11:33:24 +02:00
Andi Gallo
3d7e788981 LibWeb: Improve the line breaking algorithm
Check the width of the next token after white space to decide line
breaks. The next width can also be the total width of multiple tokens.
This better follows the CSS Text specification and matches behavior of
other browsers.

Fixes #20388.
2023-08-21 19:31:00 +02:00
Andreas Kling
0103940cee LibWeb: Resolve viewport-relative <img sizes> values
We still don't know how to resolve font-relative lengths in <img sizes>
since we don't always have font size information available at this stage
in the pipeline, but we can at least handle viewport-relative lengths.

This fixes an issue on many websites where low-resolution images were
loaded (appropriate for a small viewport) even when the viewport is big.
2023-08-21 13:56:18 +02:00
Sam Atkins
b8e694c0f2 LibWeb: Implement the :dir() selector pseudo-class 2023-08-21 13:51:56 +02:00
Shannon Booth
7690f76f92 LibWeb/Tests: Move unresolvable % width on inline-block to layout test
Removing the last test fomr Base/res/html/tests :^)
2023-08-21 13:51:12 +02:00
Shannon Booth
ed03dd0f99 LibWeb/Tests: Port two DOM cloneNode() test cases to text tests 2023-08-21 13:51:12 +02:00
Shannon Booth
a5fb0b4243 LibWeb/Tests: Port height:auto abspos flex container test to layout test
This test was written before we had layout test functionality.
2023-08-21 13:51:12 +02:00
Shannon Booth
6cee028ecc LibWeb/Tests: Port HTMLCollection [[SameObject]] test to a text test
This test was written before we had the facility to write text tests -
port this test to a text test so that we test against it in CI.
2023-08-21 13:51:12 +02:00
Ali Mohammad Pur
5f013e5374 Meta: Generate bigint values for v128 constants in Wasm tests 2023-08-21 13:39:32 +03:30
Ali Mohammad Pur
2462064fcd LibWasm+LibWeb: Parse and validate all Wasm SIMD instructions 2023-08-21 13:39:32 +03:30
Ali Mohammad Pur
4f0f1c7c72 AK: Add support for Little/BigEndian<UFixedBigInteger<M>> 2023-08-21 13:39:32 +03:30
Sam Atkins
0d021a63c7 LibUnicode: Generate data for bidirectional character types
This will let us examine code points to determine the rtl/ltr direction
of a piece of text.
2023-08-20 16:21:35 -04:00
MacDue
8cef2f7be8 Tests/LibWeb: Add ref test for SVG gradients with various spreadMethods
Note: The final three gradients in this test are currently incorrectly
rendered.
2023-08-20 20:04:10 +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
Andi Gallo
769f11f9ae LibWeb: Implement table missing cells fixup
Fixes #19936.
2023-08-20 18:38:15 +02:00
Aliaksandr Kalenik
37f5253ec9 LibWeb/Layout: Add support for grid-auto-flow in GFC 2023-08-20 15:36:18 +02:00
Shannon Booth
9cf5b67162 LibWeb: Return a HTMLFormControlsCollection from HTMLFormElement element
Instead of a HTMLCollection
2023-08-20 11:04:03 +02:00
0GreenClover0
f6c3ec3742 LibWeb: Add Base::apply_presentational_hints call to <symbol> element 2023-08-20 05:03:27 +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
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
Andrew Kaster
4c26b0b047 Tests: Convert WebDriver patch to a git patch and clean up assumptions
Instead of assuming that the WebDriver binary is in PATH or the two
most common build directories for our scripts, add a command line
argument to the script to pass a WebDriver binary.
2023-08-20 03:20:54 +02:00
Andrew Kaster
326e8a0a33 LibWeb: Only update /etc/hosts for WPT if required lines are not present 2023-08-19 17:49:04 -06:00
Andrew Kaster
8e605fb0f9 Meta+LibWeb: Make WPT run script runnable anywhere, remove apt installs
We should be documenting required pacakges elsewhere and installing them
in the setup step of CI.

This also fixes a problem where the run script would fail if you already
had a cloned wpt directory.
2023-08-19 23:50:29 +02:00
Hendiadyoin1
b342b4dfb8 LibWeb: Fix a rounding issue on CSSPixels multiplication
Co-Authored-By: ronak69 <ronak69@danwin1210.de>
2023-08-18 17:58:44 +02:00
Daniel Bertalan
c63fe0e1f1 Tests/LibELF: Test loading libraries with dynamic TLS
The setup is a bit peculiar: both the definition and the use site of
these TLS variables have to be in a shared library, otherwise the linker
might relax the global-dynamic access mode to something that doesn't
require a `__tls_get_addr` call.
2023-08-18 16:20:13 +02:00
Poseydon42
d160ff2f8d LibGLSL: Add tests for GLSL parser 2023-08-18 15:29:48 +02:00
Andi Gallo
65854c3411 LibWeb: Set table wrapper width from the table box
Fixes #20385 and some Wikipedia pages, for example:
https://en.wikipedia.org/wiki/2022%E2%80%9323_UEFA_Champions_League_knockout_phase
2023-08-18 12:52:29 +02:00
MacDue
3a42ef4118 Tests/LibWeb: Add ref test for CSS gradients
This has to cheat and use a screenshot but thanks to the "Take Full
Screenshot" feature of Ladybird, it is very easy to update this test.

The steps are documented in the test.
2023-08-18 05:26:04 +02:00
Aliaksandr Kalenik
37bd216c52 LibWeb: Ignore % max-width if box is sized under max-content constraint
When a box is sized under max-content constraint, any percentage value
set for max-width should be considered as if it were infinite. In other
words, it should have no effect on restricting the box's width.
2023-08-18 05:08:52 +02:00
martinfalisse
70919dbed7 LibWeb: Fix parsing bug for SVG attributes
This doesn't seem to actually have fixed any bugs, as having
FillOpacity instead of StrokeOpacity in the call to parse_css_value
doesn't seem to have actually been causing bugs. But, I still think it's
worthwhile correcting.

The reason that it wasn't causing bugs is that having FillOpacity
instead of StrokeOpacity in the call to parse_css_value means that when
parsing the value is compared to the acceptable values for that property
(for example the value can only be a percentage, or a number, etc.). In
this case both FillOpacity and StrokeOpacity seem to accept the same
values.
2023-08-17 17:48:34 +02:00
martinfalisse
f2047a5c32 LibWeb: Size SVG G container according to children
The SVG G container should have the same size as its children. This
fixes a bug when there was an opacity value on the G element, as in
StackingContext it would try and get a bitmap of the element which would
be empty due to it having no size.
2023-08-17 17:48:34 +02:00
Andreas Kling
f34cc0b8e3 LibWeb: Null check fonts after parsing them in CRC2D.font assignment
Fixes an issue where setting CRC2D.font to an unparseable value would
assert due to a null dereference.
2023-08-17 10:07:38 +02:00
Andi Gallo
d5f54956ba LibWeb: Use the auto table width formula if it cannot be resolved
If the width is a percentage but the parent isn't resolved yet, take the
same path as for auto width.
2023-08-17 04:13:46 +02:00
Ali Mohammad Pur
4d27257c45 LibRegex: Treat backwards jumps to IP 0 as normal backwards jumps too
This shows up in something like /\d+|x/, where the `+` ends up jumping
to the start of its own alternative.
2023-08-16 22:20:24 +03:30
Sam Atkins
12a2750d1e LibWeb: Support multiple values in :lang() selector
Parse them, and also don't give up completely if the first language
listed doesn't match an element.
2023-08-16 18:05:26 +02:00
Sam Atkins
631a988a57 LibWeb: Allow any valid <color> in CSS gradients
We now keep the color value as a StyleValue up until we go to paint the
gradient, which makes `currentColor` work, along with any other color
values that can't be immediately converted into a `Gfx::Color` while
parsing.
2023-08-16 14:51:12 +02:00
Andreas Kling
1c47695bae LibWeb: Invalidate layout-transformed text on DOM text node change
This fixes an issue where programmatically changing the value of an
input element wasn't reflected visually.
2023-08-16 12:16:05 +02:00
Andreas Kling
e2740bd19d LibWeb: Don't overwrite existing text content when flushing HTML parser
If we run an inline script from the HTML parser, it may append a text
node to the current insertion point.

If there was text content immediately following the script element,
we would previously overwrite the script-inserted text content, due to
an oversight in the way we select an appropriate insertion point

This patch fixes the issue by only inserting parser content into
existing text nodes if they are empty.
2023-08-16 12:16:05 +02:00
Nicolas Ramz
0986533c11 Meta+Tests: Add a fuzzer and a test for the ILBM decoder 2023-08-15 18:36:11 +01:00
Andreas Kling
dea91afba7 LibWeb: Make HTMLElement.offset{Left,Top} work on inline elements
Before this change, we were returning (0, 0) for inline elements, due to
a bogus paintable type check in box_type_agnostic_position().
2023-08-15 16:37:11 +02:00
Andreas Kling
25a3d0d643 LibWeb: Resolve relative offsets *once* after layout
Instead of applying relative offsets (like position:relative insets)
during painting and hit testing, we now do a pass at the end of layout
and assign the final resolved offsets to paintables.

This makes painting and hit testing easier since they don't have to
think about relative offsets, and it also fixes a bug where offsets were
not applied to text fragments inside inline-flow elements that were
themselves position:relative.
2023-08-15 16:37:11 +02:00
MacDue
4e49aee545 Tests/LibWeb: Add opacity-stacking.html test to manifest.json
(Also explicitly set the background color)
2023-08-14 23:52:53 +02:00
MacDue
9006c7aece LibWeb: Add ref test for opacity (stacking context) paint order
Now that we can test this, let's add a test, as mentioned in:
https://github.com/SerenityOS/serenity/pull/20559#issuecomment-1677126697

(I confirmed this test failed before #20559)
2023-08-14 22:42:25 +02:00