Commit graph

20349 commits

Author SHA1 Message Date
Idan Horowitz 9e693304ff LibJS: Implement Set.prototype.intersection 2022-12-02 13:09:15 +01:00
Idan Horowitz fee65f6453 LibJS: Implement Set.prototype.union 2022-12-02 13:09:15 +01:00
Idan Horowitz 8e1df36588 LibJS: Implement the Set Methods proposal abstract operations 2022-12-02 13:09:15 +01:00
Marco Cutecchia 55c5c97ab5 LibWeb: Log failures to decode image resources inside ImageResource 2022-12-02 11:26:29 +01:00
Marco Cutecchia 07fb0882bf LibWeb: Add null checks before derefencing Bitmaps in ImageStyleValue 2022-12-02 11:26:29 +01:00
Linus Groh b0e7d59b8b LibJS: Throw on conversion from TimeZone to Calendar and vice versa
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/2084e77
2022-12-02 02:04:13 +01:00
Linus Groh ca038c1a4e LibJS: Align Temporal.{Calendar,TimeZone} id getters with toString
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/0bb391a
2022-12-02 02:04:13 +01:00
Timothy Flynn 4a30446999 LibWeb: Support displaying HTMLInputElement placeholder values
This adds support for parsing the ::placeholder pseudo-element and
injecting an anonymous layout node with that element when the input
element's data is empty.
2022-12-01 11:18:11 -05:00
Timothy Flynn fddbc2e378 LibWeb: Ensure the number of pseudo elements stays up-to-date
The ::placeholder pseudo element was added in commit 1fbad9c, but the
total number of pseudo elements was not updated. Instead of this manual
bookkeeping, add a dummy value at the end of the enumeration for the
count.
2022-12-01 11:18:11 -05:00
Timothy Flynn c21e9a415d LibJS: Add missing spec link on String.prototype.toWellFormed
Missed in commit 3ee5217adc.
2022-12-01 11:17:02 -05:00
Timothy Flynn 3ee5217adc LibJS: Implement String.prototype.toWellFormed 2022-12-01 17:03:55 +01:00
Timothy Flynn 0bb46235a7 LibJS: Implement String.prototype.isWellFormed 2022-12-01 17:03:55 +01:00
Linus Groh 24237ae5bf LibJS: Add FIXME to removed SplitMatch AO 2022-12-01 13:32:47 +01:00
Linus Groh e960f9549e LibJS: Sort String.prototype methods in spec order
This is similar to these previous changes in LibJS:

- 999ad734ec
- f19c4ab693
- 5f5bcd549e
2022-12-01 13:32:47 +01:00
Timothy Flynn 69f6fbdf99 LibJS: Replace CreateDataPropertyOrThrow with Set in TypedArray toSorted
This was an errant transcription in 4dbb2c2d44.
2022-11-30 23:27:51 +01:00
Timothy Flynn 34e328e580 LibJS: Allow TypedArrays to become detached while sorting
This is a normative change in the Change Array by Copy proposal. See:
https://github.com/tc39/proposal-change-array-by-copy/commit/17d8b54
2022-11-30 23:27:51 +01:00
Mateusz Górzyński 4dfdca74e2 LibWeb: Handle <relative-size> values in the font-size CSS property 2022-11-30 19:58:17 +00:00
Mateusz Górzyński a551e02e5e LibWeb: Handle <absolute-size> values in the font-size CSS property 2022-11-30 19:58:17 +00:00
Timothy Flynn 31d315001c LibJS: Allocate concrete TypedArrays with a preallocated base TypedArray
TypedArray constructors/prototypes are currently allocating within their
C++ constructor when trying to access the intrinsic base TypedArray. To
prevent this, construct these objects with an already-allocated base
TypedArray.
2022-11-30 13:05:57 -05:00
Timothy Flynn c0952e3670 LibJS: Do not allocate in Set's constructor
We are currently allocating in Set's constructor to create the set's
underlying Map. This can cause GC to occur before the member is actually
initialized, thus we will crash in Set::visit_edges trying to visit a
member that does not exist.

Instead, create the Map in Set::initialize, where we can allocate. Also
change Map to be stored as a normal JS heap-allocated object, rather
than as a stack variable.
2022-11-30 13:05:57 -05:00
MacDue 65acfe6c60 LibWeb: Handle degenerate radial gradients 2022-11-30 14:24:04 +00:00
MacDue 476acae04f LibWeb: Paint radial-gradient()s
This almost looks too easy now :^), but it's just another way to sample
the gradient line.
2022-11-30 14:24:04 +00:00
MacDue d1b06af307 LibWeb: Add missing equals() function for ConicGradientStyleValue
Also, tidy up the one for LinearGradientStyleValue.
2022-11-30 14:24:04 +00:00
MacDue 22a7611e1c LibWeb: Parse radial-gradient()s 2022-11-30 14:24:04 +00:00
MacDue 040dac558e LibWeb: Implement RadialGradientStyleValue
Adds a style value for `radial-gradient()`s and implements some helpers
for resolving their properties.
2022-11-30 14:24:04 +00:00
MacDue f1f1977e2d LibWeb: Move color stop list parsing to standalone functions
This makes these slightly less clunky to use for other gradient types.
2022-11-30 14:24:04 +00:00
MacDue c02163c31f LibWeb: Allow optional values to be missing when parsing <position>s 2022-11-30 14:24:04 +00:00
MacDue b7d436fe1b LibWeb: Only floor conic-gradient() angles for hard-edge gradients
This avoids a few little jaggy edges on gradients that are meant to
have smooth transitions.
2022-11-30 14:24:04 +00:00
Rodrigo Tobar cb3e05f476 LibPDF: Add initial implementation of XObject rendering
This implementation currently handles Form XObjects only, skipping
image XObjects. When rendering an XObject, its resources are passed to
the underlying operations so they use those instead of the Page's.
2022-11-30 14:51:14 +01:00
Rodrigo Tobar b3007c17bd LibPDF: Allow operators to receive optional resources
Operators usually assume that the resources its operations will require
will be the Page's. This assumption breaks however when XObjects with
their own resources come into the picture (and maybe other cases too).
In that case, the XObject's resources take precedence, but they should
also contain the Page's resources. Because of this, one can safely use
the XObject resources alone when given, and default to the Page's if
not.

This commit adds all operator calls an extra argument with optional
resources, which will be fed by XObjects as necessary.
2022-11-30 14:51:14 +01:00
Rodrigo Tobar e58165ed7a LibPDF: Render cubic bezier curves
The implementation of bezier curves already exists on Gfx, so
implementing the PDF rendering of this command is trivial.
2022-11-30 14:51:14 +01:00
Rodrigo Tobar fe5c823989 LibPDF: Communicate resources to ColorSpace, not Page
Resources can come from other sources (e.g., XObjects), and since the
only attribute we are reading from Page are its resources it makes sense
to receive resources instead. That way we'll be able to pass down
arbitrary resources that are not necessarily declared at the page level.
2022-11-30 14:51:14 +01:00
Rodrigo Tobar 164422f8d8 LibPDF: Add further common names 2022-11-30 14:51:14 +01:00
Rodrigo Tobar 5277ad1d6d LibPDF: Implement Run Length Decoding
This is a simple decoding process that is needed by some streams.
2022-11-30 14:51:14 +01:00
Rodrigo Tobar e776048309 LibPDF: Ignore whitespace on hex strings
The spec says that whitespaces should be ignored, but we weren't. PDFs
with whitespaces in their hex strings were thus crushing the parser.
2022-11-30 14:51:14 +01:00
Andreas Kling 9d4e0ba442 LibWeb: Fix WebIDL overload resolution with platform object arguments
We now check if an argument value is a platform object that implements
the relevant IDL interface when resolving overloads.

This makes passing a Path2D object to CanvasRenderingContext2D.fill()
actually choose the Path2D overload. :^)
2022-11-30 14:43:22 +01:00
Andreas Kling 12ddeeb9ce LibWeb: Add PlatformObject::implements_interface(String)
This can be used to ask a PlatformObject if it implements a given IDL
interface. It's implemented by a chain of virtual overrides that get
inserted for each subclass by the WEB_PLATFORM_OBJECT macro.
2022-11-30 14:43:22 +01:00
Andreas Kling 00a98c24a2 LibWeb: Update incorrect WEB_PLATFORM_OBJECT base class for two classes 2022-11-30 14:43:22 +01:00
Andreas Kling b1f8c5879f LibIDL: Fix bug where entire EffectiveOverloadSet was erased
There was a funny bug here: by storing the "last matched item" as a
pointer, and then using Vector::remove_all_matching() to remove all
items that didn't have that exact address, we would end up removing
everything unless the last item matched was the very first item.

(This happened because every time an item was removed from the vector,
the remaining contents shift one step towards the start of the vector,
affecting item addresses.)

This patch fixes the issue by storing the last match as an index.
2022-11-30 14:43:22 +01:00
Andreas Kling c266284559 LibWeb: Support creating Path2D objects from SVG path strings
This reuses the SVG path parsing code.
2022-11-30 14:43:22 +01:00
Andreas Kling 65d762130a LibWeb: Factor out SVG path parsing from SVGPathElement
Converting a Vector<PathInstruction> is now done by a free function so
that we can share this code with HTML::Path2D. :^)
2022-11-30 14:43:22 +01:00
Andreas Oppebøen b716c14c32 MouseDemo: Eliminate visual artifacts when filling in the color
The drawing had several visual artifacts with the colors not perfectly
filling out their outlines. By re-using the path for both stroke and
fill, we ensure that the exact same floating point coordinates are
used. Drawing the fill first and the stroke after also helps eliminate
artifacts.
2022-11-30 12:56:29 +00:00
Andreas Oppebøen 54edd162a9 MouseDemo: Draw blue color for longer to indicate double click
When double-clicking, the button remains blue a bit longer. This
provides a convenient way to test the double click speed.

Piggybacks the timer for the scroll indicators, which is a bit weird,
but not noticeable.
2022-11-30 12:56:29 +00:00
Andreas Oppebøen 3cf81f1930 MouseDemo: Restart timer when scrolling to avoid blinking indicator
When scrolling, a timer is triggered to hide the indicator cross. When
we continuously scroll, the indicator cross would then blink once the
timer kicks in. Instead, let's cancel the current timer and schedule a
new one, making the indicator visually smooth.
2022-11-30 12:56:29 +00:00
Andreas Oppebøen 2c142e4c57 MouseDemo: Show distinct colors for primary vs secondary button
This shows mouse down of primary button in blue color,
and secondary button in light blue color.
2022-11-30 12:56:29 +00:00
Andreas Oppebøen 903bfc3d68 MouseDemo: Replace constructor with initialization at member definition
This adheres to CodingStyle.md#other-punctuation which states:
> Prefer initialization at member definition whenever possible

Since the zero-arg constructor was only initializing members, it was
simply removed.
2022-11-30 12:56:29 +00:00
Andreas Oppebøen 29de0dbea5 LibGfx: Add missing color LightBlue
Will be used in a follow-up commit as alternative to Blue
2022-11-30 12:56:29 +00:00
Filiph Sandström 4a766245fa HackStudio: Replace blank file when opening a new one
Before this we just added a new tab and left the `(Untitled)` tab in the
background. Now we instead check that it hasn't been modified and that
it's empty; if both these conditions are true we replace the blank
editor with the newly opened one.
2022-11-30 12:36:54 +00:00
Andreas Oppebøen 8cca9e94a2 PixelPaint: Record action for all select operations to allow undo
Since selections with the select tools support undo, it makes
sense for the edit operations 'select all', 'none', 'invert' and
'clear selection' to also support undo.
2022-11-30 12:18:06 +00:00
Andreas Oppebøen 427d488d7e PixelPaint: Record action when erasing a selection to allow undo 2022-11-30 12:18:06 +00:00