Commit Graph

58926 Commits

Author SHA1 Message Date
Tim Ledbetter
88fe236c77 Tests/LibWeb: Remove unused code from dialog test 2024-02-16 17:21:48 -05:00
Tim Ledbetter
816d24f647 LibWeb: Implement HTMLFormElement.requestSubmit()
This can be used to submit a form using a specific submit button.
2024-02-16 17:21:48 -05:00
Andrew Kaster
94149db073 LibWeb: Implement Document named properties with light caching
We now cache potentially named elements on the Document when elements
are inserted and removed. This allows us to do lookup of what names are
supported much faster than if we had to iterate the tree every time.

This first cut doesn't implement the rules for 'exposed' object and
embed elements.
2024-02-16 16:18:31 -05:00
Matthew Olsson
faaf5b9652 LibWeb: Add the AnimationEvent IDL objects 2024-02-16 12:02:11 -07:00
Matthew Olsson
3a87c000c4 LibWeb: Add the CSSAnimation IDL object 2024-02-16 12:02:11 -07:00
Matthew Olsson
3721a1a81c LibWeb: Run update_finished_state when setting AnimationEffect's timing
This will need to a necessary style invalidation
2024-02-16 12:02:11 -07:00
Matthew Olsson
6d25bf3aac LibWeb: Invalidate element when setting AnimationEffect's animation 2024-02-16 12:02:11 -07:00
Matthew Olsson
ce99636cd0 LibWeb: Fix check for missing argument in Animation constructor
Receiving a null argument has a different result than not passing an
argument at all.
2024-02-16 12:02:11 -07:00
Nico Weber
bd74447dba LibPDF: Initial support for drawing CFF-based Type0 fonts
Together with the already-merged #23122, #23128, #23135, #23136, #23162,
and #23167, #23179, #23190, #23194 this adds initial support for
rendering some CFF-based Type0 fonts :^)

There's a long list of things that still need improving after this:

* A small number of CFF programs contain the charstring command 0,
  which is invalid. Currently, this makes us reject the whole font.

* Type1FontProgram::rasterize_glyph() is name-based. For CID-based
  fonts, we want a version that takes CIDs (character IDs) instead.
  For now, I'm printing the CID to a string and using that, yuck.
  (I looked into doing this nicely. I do want to do that, but I
  need to read up on how the `seac` type1 charstring command uses
  character names to identify parts of an accented character.
  Also, it looks like `seac`'s accented character handling moved
  over to `endchar` in type2 charstring commands (i.e. in CFF data),
  and it looks like we don't implement that at all. So I need to do
  more reading first, and I didn't want to block this on that.)

* The name for the first string in name-based CFF fonts looks wrong;
  added a FIXME for that for now.

* This supports the named Identity-H cmap only for now. Identity-H
  maps UTF16-BE values to glyph IDs with the idenity function, and
  assumes it's horizontal text. Other named cmaps in my test files are
  UniJIS-UCS2-H, UniCNS-UCS2-H, Identity-V, UniGB-UCS2-H, UniKS-UCS2-H.
  (There are also 2 files using the stream-based cmaps instead of the
  name-based ones.)

  * In particular, we can't draw vertical text (`-V`) yet

* Passing in the encoding to CFF::create() is awkward (it's nullptr
  for CID-keyed fonts), and it's also not necessary since
  `Type1Font::draw_glyph()` already does the "take encoding from PDF,
  and only from font if the PDF doesn't store one" dance.

* This doesn't cache glyphs but re-rasterizes them each time. Easy
  to add, but maybe I want to look at rotation first. And things
  don't feel glacial as-is.

* Type0Font::draw_glyph() is pretty similar to second half of
  Type1Font::draw_glyph()
2024-02-16 12:41:10 -05:00
Nico Weber
c9d48bbca4 LibPDF/CFF: Add a comment to CFF::parse_charset() 2024-02-16 12:41:10 -05:00
Nico Weber
5c8778a161 LibPDF/CFF: Compute per-glyph glyph width in CID-keyed fonts
Make TopDict's defaultWidthX and nominalWidthX Optional<>s so that
we can check if they're set per fdselect-selected font dict, and
if so use the value from there in CID-keyed fonts. Otherwise, keep
using the value in the top dict.
2024-02-16 12:41:10 -05:00
Shannon Booth
4348b484c6 LibJS: Verify valid Duraton is made in DifferenceTemporalPlainDate
It shouldn't be possible to create an invalid duration here, so follow
the spec and verify that this succeeds.
2024-02-16 12:27:23 -05:00
Shannon Booth
bb8dad5bb0 LibJS: Begin using CalendarMethodsRecord for AOs
This begins the process of aligning our implementation with the spec
with regard to using CalendarMethodsRecord. The main intent here is to
make it much easier to make normative changes to AOs which have been
updated to CalendarMethodsRecord.

While this does resolve various FIXMEs, many others above need to be
added in order to be able to pass through a CalendarMethodsRecord. The
use here aligns with what I can gather from the spec of what the
arguments to CreateCalendarMethodsRecord should be, but various AOs have
been updated so much with other changes it's not completely obvious.
Other AOs do not even exist in the latest version of the spec, but we
still rely on them.

As part of these updates, this commit coincidentally also fixes two
PlainDate roundingmode issues seen in test262 - a test of which is also
added in test-js. This issue boiled down to what appears to be an
observable optimization in the spec, where it can avoid calling
dateUntil in certain situations (roundingGranularityIsNoop).

However, the main goal here is to make it much easier to fix many more
issues in the future :^)

since/calendar-dateuntil-called-with-singular-largestunit.js  -> 
until/calendar-dateuntil-called-with-singular-largestunit.js  -> 
2024-02-16 12:27:23 -05:00
Shannon Booth
6d4eda0028 LibJS: Make CreateTemporalDuration return a NonnullGCPtr
Since it can't return null.

This also results in a bunch of fallout from callers who were
expecting a raw pointer.
2024-02-16 12:27:23 -05:00
Shannon Booth
fdfe06bb44 LibJS: Begin implementing Temporal's CalendarMethodsRecord
This is part of a large refactor made as part of the temporal spec.
Most AOs using the calendar now pass through this record. There will
need to be a long process of going through updating AOs to use this
record.
2024-02-16 12:27:23 -05:00
Ali Mohammad Pur
971e466521 LibIDL: Emit an error when two decls of the same function are present
Duplicates can show up when copy-pasting IDL snippets into existing IDL
files, and the resulting error is extremely useless and misleading.
This commit makes it so the parser catches these cases, and emits a more
helpful error like "Overload set 'instantiate' contains multiple
identical declarations".
2024-02-16 15:26:43 +01:00
Ali Mohammad Pur
bc301b6f40 AK+LibXML+JSSpecCompiler: Move LineTrackingLexer to AK
This is a simple extension of GenericLexer, and is used in more than
just LibXML, so let's move it into AK.
The move also resolves a FIXME, which is removed in this commit.
2024-02-16 15:26:43 +01:00
Tommy van der Vorst
08c02ad888 LibWeb: Only dump layout and text tree for the desired URL
Before this change, the rebaseline script would generate reference
based on 'about:blank' (at least running it on my macOS system).
This commit allows 'about:blank' through the assertion and only dumps
the layout tree when theloaded URL matches the one we are interested
in.
2024-02-16 15:05:30 +01:00
Nico Weber
17b22250b6 LibGfx/OpenType: Replace a magic number with a calculation
Makes this code look like the corresponding code in the ScaledFont ctor.

Similar to the last commit on #20084.

No behavior change.
2024-02-15 22:53:24 -05:00
Nico Weber
073e2bffcb LibGfx: Move POINTS_PER_INCH, DEFAULT_DPI to VectorFont.h
...so we can use it in OpenType/Font.cpp.

No behavior change.
2024-02-15 22:53:24 -05:00
Tim Ledbetter
c24652bd2e LibWeb: Implement document.scrollingElement
This returns a reference to the element that scrolls the document. In
standards mode it is equivalent to `document.documentElement`.
2024-02-15 22:51:15 -05:00
Gurkirat Singh
fc8f6c07b4 Utilities/pkg: Integrate LibSemVer for update information
Along with this, Port.h is include which helps generalising common
information for the port package, like it's name and version. With
SemVer complaint versions, it is possible to show positive change
(upgrade) or negative change (downgrade) in the installed ports.

However, for some non-complaint versions (eg. using git commit hash),
non-equality (`!=`) is used to notify upgrade. Since there is no
algorithm (without git history) to check the order of commits, it is
not possible to inform whether it is an upgrade or downgrade.
2024-02-15 18:23:05 +01:00
Gurkirat Singh
ee639fa1df Libraries: Implement SemVer for version parsing and comparisons
Semantic Versioning (SemVer) is a versioning scheme for software that
uses MAJOR.MINOR.PATCH format. MAJOR for significant, possibly
breaking changes; MINOR for backward-compatible additions; PATCH for
bug fixes. It aids communication, compatibility prediction, and
dependency management. In apps dependent on specific library versions,
SemVer guides parsing and validates compatibility, ensuring apps use
appropriate dependencies.

    <valid semver> ::= <version core>
                     | <version core> "-" <pre-release>
                     | <version core> "+" <build>
                     | <version core> "-" <pre-release> "+" <build>
2024-02-15 18:23:05 +01:00
Matthew Olsson
14200de80b LibWeb: Set DocumentTimeline origin time to zero
The current time should be used to set the timeline's new current time,
not its origin time
2024-02-15 12:34:19 +01:00
Matthew Olsson
727a9a6472 LibWeb: Run pending play tasks when the timeline time changes
Note that the timeline time changes every animation frame when the
Document sends out animation events
2024-02-15 12:34:19 +01:00
Matthew Olsson
daaaaec2d0 LibWeb: Add the Animatable IDL object 2024-02-15 12:34:19 +01:00
Matthew Olsson
4792dc294b LibWeb: Implement Animation::play 2024-02-15 12:34:19 +01:00
Matthew Olsson
88518c29ca LibWeb: Combine "pending" and "ASAP" animation task states
It seems that the difference between pending and ASAP in the spec is
only to allow the implementation to perform implementation-defined
operations between the two states. We don't need to distinguish the two
states, so lets just combine them for now.
2024-02-15 12:34:19 +01:00
Jelle Raaijmakers
66859c8cd8 Ports/SDL2: Support ShowMessageBox before VideoInit
An SDL2 application is allowed to show a message box before the video
subsystem is initialized. This change makes sure GUI::Application is
initialized.

An example of this is SRB2: the process forks itself to let the child
process install itself as the signal handler and deal with errors. This
child process could try to show a message box long after the video
subsystem was initialized, but since it is a forked process there is no
static state for GUI::Application or the connection to the window
server and the process would crash because of a null dereference.
2024-02-15 12:33:23 +01:00
Nico Weber
1d1e406b3a LibPDF/CFF: Implement some special handling for CID-keyed fonts
* FDArray, FDSelect must be present
* Encoding must not be present
* Charset maps from GID (Glyph ID) to CID (Character ID),
  instead of to character name
2024-02-15 12:32:31 +01:00
Nico Weber
7494f24430 LibPDF/CFF: Store if a font program is CID-keyed
...and reject CID-keyed font programs for Type1 fonts.
2024-02-15 12:32:31 +01:00
Nico Weber
bb7d29d007 LibPDF/CFF: Read font dicts pointed to by the fdarray offset
The fdselect array (that we already read) maps eachs glyph ID
to an fdarray index. The font dict at that index then stores
information for that glyph.

In practice, this is used to assign different defaultWidthX /
nominalWidthX values to blocks of glyphs in CID-keyed fonts.

We don't do anything yet with the data, and we also don't send
data of CID-keyed CFFs into this parser either, so no behavior
change.
2024-02-15 12:32:31 +01:00
Nico Weber
524a4f6256 LibPDF/CFF: Make parse_top_dict() return all top dicts
This happens for CFFs that contain multiple fonts. This doesn't
happen in practice, but the same code will be used for fdarray
parsing, which will contain several dicts.

No behavior change.
2024-02-15 12:32:31 +01:00
Nico Weber
9f1cf8babc LibPDF/CFF: Extract parse_top_dict() function
Pure code move, no behavior change.
2024-02-15 12:32:31 +01:00
Lucas CHOLLET
1f62984301 LibAudio/Wav: Always use u32 for the sample rate 2024-02-14 22:21:44 -05:00
Lucas CHOLLET
901baf31ff LibAudio/Wav: Remove unused methods 2024-02-14 22:21:44 -05:00
Tim Ledbetter
0ecbdc4627 LibWeb: Add support for form submission method 'dialog' 2024-02-14 22:20:44 -05:00
Tim Ledbetter
151cd11b5b LibWeb: Implement HTMLDialogElement::show() 2024-02-14 22:20:44 -05:00
Tim Ledbetter
8042558805 LibWeb: Implement HTMLDialogElement::close() for non-modal dialogs 2024-02-14 22:20:44 -05:00
Tim Ledbetter
cfbd14b958 Userland: Use MUST() to unwrap String values 2024-02-14 17:46:06 -05:00
Tim Ledbetter
2331d2bafa Userland: Propagate errors with TRY() where possible 2024-02-14 17:46:06 -05:00
Tim Ledbetter
3ffa2a39bc Tests: Propagate errors with TRY_OR_FAIL() where possible 2024-02-14 17:46:06 -05:00
Tim Ledbetter
532f2b644c Kernel: Propagate errors with TRY() where possible 2024-02-14 17:46:06 -05:00
Tim Ledbetter
89c0e3541e Fuzzers: Add PAM fuzzer 2024-02-14 19:58:46 +01:00
Sönke Holz
570480c7d5 Kernel/riscv64: Add missing include in Delay.cpp
This include was missed in 4409b33145.
RISC-V should build again now.
2024-02-14 10:32:45 -07:00
Jelle Raaijmakers
2a749525e0 LibGL: Add API stubs
- glBlendEquation
- glGetShaderInfoLog
- glGetUniformLocation
- glUniform*

This gives us full API coverage for the SRB2 port.
2024-02-14 15:09:53 +01:00
Jelle Raaijmakers
e18bc2a748 LibGL: Combine glLightModel definitions
Create a single definition with two variants for `glLightModeli` and
`glLightModelf`.
2024-02-14 15:09:53 +01:00
Jelle Raaijmakers
60bd458ed2 LibGL: Allow function name override in API definitions
Instead of limiting ourselves to the key of the property in the JSON,
allow overriding the function name so we can generate completely
different function signatures with very similar names to other existing
API methods (e.g. `glUniform*` vs `glUniform*v`).
2024-02-14 15:09:53 +01:00
Nico Weber
eb4632e08a LibPDF: Give CFF built-in encoding and charset arrays an underlying type
These arrays store SIDs ("String IDs"), so give them that type now
that we have to_array() and it's easy to do.

No behavior change.
2024-02-14 06:56:43 +01:00
Aliaksandr Kalenik
5bea99367a LibWeb: Add hit-testing test for SVG path
Adds a test for <rect> to ensure we have at least some hit-testing
coverage for SVGs.
2024-02-14 06:56:22 +01:00