Commit Graph

52693 Commits

Author SHA1 Message Date
Shannon Booth
c8da880806 AK: Add spec comments to URL::serialize 2023-07-25 06:43:50 -04:00
Shannon Booth
177b04dcfc AK: Fix url host parsing check for 'ends in a number'
I misunderstood the spec step for checking whether the host 'ends with a
number'. We can't simply check for it if ends with a number, this check
is actually an algorithm which is required to avoid detecting hosts that
end with a number from an IPv4 host.

Implement this missing step, and add a test to cover this.
2023-07-25 06:43:50 -04:00
Nico Weber
715b6f868f LibPDF: Sketch out Type0 font support some more
Type0 fonts can be either CFF-based or TrueType-based.
Create a subclass for each, put in some spec text, and
give each case a dedicated error code, so that `--debugging-stats`
can tell me which branch is more common.
2023-07-25 12:10:36 +02:00
Aliaksandr Kalenik
0f21b35d1c Tests/LibWeb: Add tests for CSSPixels class
After the CSSPixels implementation evolved from a wrapper of double
to a fixed-point saturated math arithmetic implementation, it makes
sense to have separate tests for it.
2023-07-25 11:52:02 +02:00
Aliaksandr Kalenik
bec07d4af7 LibWeb: Use fixed-point saturated arithmetics for CSSPixels
Using fixed-point saturated arithmetics for CSSPixels allows to avoid
accumulating floating-point errors.

This implementation is not complete yet: currently saturated
arithmetics implemented only for addition. But it is enough to not
regress any of layout tests we have :)

See https://github.com/SerenityOS/serenity/issues/18566
2023-07-25 11:52:02 +02:00
Aliaksandr Kalenik
5cdd03fc53 LibWeb: Fix divisions by zero in FFC and GFC
This is the preparation to use fixed-point to represent CSSPixels.
Previously, it was acceptable to divide CSSPixels by zero, resulting
in inf, but after migrating to fixed-point stored as an integer, it
would lead to undefined behavior.
2023-07-25 11:52:02 +02:00
Aliaksandr Kalenik
d216621d2a AK: Add clamp_to_int(value) in Math.h
clamp_to_int clamps value to valid range of int values so resulting
value does not overflow.

It is going to be used to clamp float or double values to int that
represents fixed-point value of CSSPixels.
2023-07-25 11:52:02 +02:00
Aliaksandr Kalenik
c66dbc99ee LibWeb: Use a special value to represent an infinite growth limit in GFC
This is preparation for introducing fixed-point CSSPixels in upcoming
commits.

Infinity is a valid state for the growth limit value of a grid track.
It was possible to use INFINITY when CSSPixels were represented using
floating point, but it won't work after the transition to fixed point,
which is represented using integers. This change addresses this by
using -1 as a special value to represent the infinite state of the
growth limit.
2023-07-25 11:52:02 +02:00
Andi Gallo
66c92ebe3d LibWeb: Fix vertical position of top table caption
Setting the top of the table coordinate should not consider the top
padding and margin of the caption, just the bottom and content height.
2023-07-25 11:21:07 +02:00
Andreas Kling
902e76baff LibWeb: Ignore whitespace around easing function argument values
This makes our css-animations.html test file actually parse :^)
2023-07-25 07:20:29 +02:00
Shannon Booth
8d2ccf0f4f AK: Implement IPV4 host URL parsing to specification
This implements both the parsing and serialization IPV4 parts from
the URL spec.
2023-07-24 17:07:16 -04:00
Shannon Booth
50359567e0 AK: Add spec comments for URL spec defined member variables 2023-07-24 17:07:16 -04:00
Sam Atkins
9d2027de6b LibGUI: Make folded lines take up 0 vertical space in no-wrap mode
If a line is hidden by a folding region, then it needs to not take up
any vertical space, or else we just get a glitchy blank line instead of
a folded one. This change corrects the logic when wrapping is not
enabled.
2023-07-24 16:39:02 +01:00
Sam Atkins
d832f3a887 HackStudio+LibGUI: Remove TextDocument::is_code_document()
The same thing can be accomplished with `is` and `verify_cast`, without
making LibGUI care about HackStudio internals.
2023-07-24 16:39:02 +01:00
Sam Atkins
63d14a7e6e HackStudio: Remove Editor::gutter_icon_rect()
This was only used for a redundant call to update().
remove_gutter_indicator() already updates the correct area.
2023-07-24 16:39:02 +01:00
Sam Atkins
489f20d997 HackStudio: Remove unused Editor::m_autocomplete_in_focus field 2023-07-24 16:39:02 +01:00
Sam Atkins
4c551bfad9 HackStudio: Make use of existing TextEditor::on_focusin callback 2023-07-24 16:39:02 +01:00
Nico Weber
5aab31dc40 LibPDF: Dedicated messages for Indexed and Pattern spaces
Makes them easier to interpret in `pdf --debugging-stats` output.
2023-07-24 11:01:25 -04:00
Nico Weber
4bb29e6ac4 pdf: Add a --debugging-stats flag
Tries to render all pages of a PDF and then produces a report on which
unimplemented things were encountered.

Example, for pdf_reference_1-7.pdf:

    113 times: Rendering of feature not supported: Type0 font not imp...
        on pages: 170 (3x) 217 (2x) 250 (9x) 252 (2x) 329 (6x)...
    21 times: Rendering of feature not supported: unknown color space
        on pages: 489 (4x) 490 (5x) 491 (3x) 492 (5x) 493 (4x)
    4 times: Rendering of feature not supported: CCITTFaxDecode Filte...
        on pages: 494 (4x)

(Actually, rendering crashes for some page in that file at the moment.
This was with a local change to only render the first 800 pages to work
around that. So this is also good for finding crashes.)
2023-07-24 11:00:01 -04:00
Lucas CHOLLET
271d0015fe LibGfx/JPEGXL: Add support for x4 and x8 upsampling
All the logic is exactly the same as for x2 upsampling, so this commit
essentially boils down to adding arrays for default weights and the
logic to select the correct array.
2023-07-24 10:28:36 -04:00
Nico Weber
fad834a21c LibPDF: Add smoke-and-mirror implementation of SeparationColorSpace
None of the methods actually do anything, but we now create an
actual SeparationColorSpace object for /Separation color spaces.

This fixes a crash on page 810 of pdf_reference_1-7.pdf.
Previously, we'd log a "separation color space not supported" error,
which would lead to Renderer not updating its current color space.
It'd stay a DeviceCYMK color space, which would then later assert
when it got a 1-argument array as color (which now the
SeparationColorSpace gets instead, which logs an "unimplemented"
error for that instead of asserting).
2023-07-24 09:52:01 -04:00
Nico Weber
af5a7b9a51 LibPDF: Don't crash on encrypted files with streams with filter arrays
Makes it possible to render more than 0 pages of CIPA_DC-003-2020_E.pdf
2023-07-24 09:50:45 -04:00
Nico Weber
532230c0e4 LibPDF: Extract a Document::read_filters() method
No behavior change.
2023-07-24 09:50:45 -04:00
Ali Mohammad Pur
9f4feb7315 LibCore: Move the Promise::await() result instead of returning a ref
Returning a reference resulted in Mail's use of Promise causing a crash.
Also, awaiting an already-awaited promise is an odd thing to do anyway,
so let's just make it release the resolved/rejected value instead of
returning a reference to it.

Co-Authored-By: Valtteri Koskivuori <vkoskiv@gmail.com>
2023-07-24 16:42:15 +03:30
Valtteri Koskivuori
8ed3cc5f7b Spreadsheet: Update cell colors interactively while picking
Spreadsheet cells now show a real-time preview of the currently selected
color while the user is picking in `GUI::ColorPicker`
2023-07-24 11:30:54 +03:30
Valtteri Koskivuori
d1f6540196 Snake: Update snake skin color interactively while picking
The snake now changes color while interacting with `GUI::ColorPicker`
2023-07-24 11:30:54 +03:30
Valtteri Koskivuori
0388bb019f PixelPaint: Update palette colors in real-time while picking
Palette color selections in `PaletteWidget` now update while interacting
with `GUI::ColorPicker`
2023-07-24 11:30:54 +03:30
Valtteri Koskivuori
5866a3a731 Magnifier: Update grid color in real-time
The grid color now updates while interacting with `GUI::ColorPicker`
2023-07-24 11:30:54 +03:30
Valtteri Koskivuori
825c9eaeb1 LibGUI: Make GUI::ColorPicker interactive
There is now a `on_color_changed` callback that clients can optionally
hook into to receive real-time updates while the user is picking a
color. If the user hits Cancel, the callback gets called once more with
the color passed in while constructing `ColorPicker`. If the user hits
OK, the same happens with the currently selected color instead.

Programs therefore can perform all their updates with this callback, and
only care about `ExecResult` if they want to make a decision, like if we
should write the result to `ConfigServer`, for example.
2023-07-24 11:30:54 +03:30
Nico Weber
ca1a98ba9f LibPDF: Replace two more crashes with messages 2023-07-23 23:05:32 -04:00
Nico Weber
29c3a9c5f0 LibPDF: Don't crash on images without /Filter
Fixes a crash rendering page 819 of ISO_32000-2-2020_sponsored.pdf
which contains an uncompressed 2x2 1bpp grayscale bitmap.
2023-07-23 23:04:55 -04:00
Nico Weber
7dfa5fc1dc LibPDF: Make JPEG decoding errors not assert
Instead, they're now turned into a diagnostic like other rendering
problems, looking like so:

    Internal error while processing PDF file:
        Unsupported chroma subsampling factors

Makes us no longer crash rendering page 1141 of pdf_reference_1.7-pdf.
2023-07-23 23:04:25 -04:00
Dominique Liberda
d6ddc25975 LibWeb: Skip alternate stylesheets in HTMLLinkElement::attribute_changed
This mirrors the existing FIXME in HTMLLinkElement::inserted.

A good test case is the following page, which loads several alternate
stylesheets: https://www.w3.org/Style/Examples/007/center.en.html
2023-07-24 02:28:21 +02:00
Dominique Liberda
4dc98af419 LibWeb: Make table headings centered by default 2023-07-24 02:28:21 +02:00
Dominique Liberda
1968cb0cc5 LibWeb: Pass color to draw_text in marker painting routines 2023-07-24 02:28:21 +02:00
Nico Weber
7b825fb44b LibPDF: Replace two TODO()s with Error returns
That way, we render an incomplete page and log a message instead of
crashing the viewer application.

Lets us survive e.g. page 489 of pdf_reference_1-7.pdf.
2023-07-23 11:42:44 -04:00
Andi Gallo
268355c759 LibWeb: Implement iterative percentage size for spanning table cells
Follow the computing column measures section of the specification, which
gives an algorithm for setting intrinsic percentage widths when spanning
columns are involved.
2023-07-23 16:11:20 +02:00
Andi Gallo
1f3fca996c LibWeb: Use intrinsic_percentage instead of percentage_{width, height}
Follow the terminology from specification.
2023-07-23 16:11:20 +02:00
Dan Klishch
2f7527b0a4 LibXML: Actually append resolved references when parsing content 2023-07-23 16:09:12 +02:00
Dan Klishch
f25745ed27 Meta: Test LibXML on Lagom 2023-07-23 16:09:12 +02:00
Shannon Booth
732ef1e7e9 Meta: Enable test-js bytecode tests 2023-07-23 07:36:13 +02:00
Shannon Booth
d766014787 LibJS/Tests: Set failing bytecode tests as xfail when in bytecode mode
This should allow us to enable running test-js in bytecode mode in CI.
2023-07-23 07:36:13 +02:00
Shannon Booth
9b66e87bd8 LibJS/Tests: Run 'delete always evaluates the lhs' in bytecode mode
As this test passes for bytecode, but fails in AST.
2023-07-23 07:36:13 +02:00
Shannon Booth
2401c0ff7e LibJS/Tests: Add support for expected failure (xfail) tests
To allow us to add tests that are failing now, but can be enabled as
soon as a change is made to make it pass (without any opportunity to
forget about enabling it).

Additionally, support is added for `xfailIf`, for tests that are
expected to fail given a certain condition, but are expected to pass
otherwise. This is intended to be used for tests that fail in bytecode
mode, but pass in AST (and vice versa).
2023-07-23 07:36:13 +02:00
Shannon Booth
cb23eaa92d test-js: Add global function to determine if using bytecode interpreter
This is intended to be used in adding test-js tests where there is
different behaviour between the AST interpreter and bytecode mode.
In particular, this is useful for tests which fail in AST, but pass in
bytecode, as the AST interpreter is run in CI but bytecode is not.
2023-07-23 07:36:13 +02:00
Shannon Booth
af60c740e3 LibTest: Add support for xfail JavaScriptTestRunner tests
This is meant to be used in a similar manner to skipping tests, with the
extra advantage that if the test begins passing unexpectedly, the test
will fail.

Being notified of unexpected passes allows for the test to be updated to
the correct expectation.
2023-07-23 07:36:13 +02:00
Kenneth Myhra
2c06ad3a05 Tests/LibWeb: Add primitives test for structuredClone() 2023-07-23 06:37:14 +02:00
Kenneth Myhra
8c88e8f896 LibWeb: Add primitive support to Structured{Serialize,Deserialize}
This adds support for Undefined, Null, Boolean, BigInt, and String to
AOs StructuredSerializeInternal and StructuredDeserialize.
2023-07-23 06:37:14 +02:00
MacDue
b30a1b957d LibWeb: Add support for SVG <tspan> elements 2023-07-23 06:32:39 +02:00
MacDue
0e12503586 LibWeb: Split SVGTextContentElement into spec defined subclasses
As part of this move properties/methods to the correct subclass
(position related properties go under SVGTextPositioningElement).

SVG text element hierarchy:

  SVGTextContentElement
           ^- SVGTextPositioningElement
                     ^- SVGTextElement
                     ^- SVGTSpanElement
           ^- SVGTextPathElement (TODO)
           ^- SVGTRefElement (TODO)
2023-07-23 06:32:39 +02:00