Commit Graph

49860 Commits

Author SHA1 Message Date
kleines Filmröllchen
34f8147385 sed: Correctly unveil all paths
- The veil was never closed.
- unveil() only works with absolute paths.
- Files from the regular input list weren't unveiled.
2023-05-05 02:15:43 +03:30
MacDue
95c571ca53 PixelPaint: Make gradient tool hardness slider width match other inputs 2023-05-04 23:59:51 +02:00
MacDue
3a60ddc5a8 PixelPaint: Correct variable names in GradientTool.cpp
Previously these variables were all prefixed `size_`, but used for
the opacity value.
2023-05-04 23:59:51 +02:00
Tim Schumacher
56d861ebe0 AK: Prevent bit counter underflows in the new BitStream
Our current `peek_bits` function allows retrieving more bits than we can
actually provide, so whenever someone discards the requested bit count
afterwards we were underflowing the value instead.
2023-05-04 20:01:16 +02:00
Tim Schumacher
dffef6bb71 LibCompress: Remove special casing for looping DEFLATE seekbacks
The `copy_from_seekback` method already handles this exactly as DEFLATE
expects, but it is slightly more optimized.
2023-05-04 20:01:16 +02:00
Tim Schumacher
00ac73be57 Tests: Add a zlib test for "missing end bits"
The actual cause for the "missing bits" is currently unknown, and this
test case doesn't actually start obviously breaking yet unless we start
reporting errors about missing bits. However, since we are touching the
BitStream implementation already, let's add the test early to make extra
sure that we aren't breaking anything.
2023-05-04 20:01:16 +02:00
Daniel van Gerpen
98badc1466 Ports/ncdu: Update to version 1.18.1 2023-05-04 19:45:24 +02:00
Andreas Kling
66c41e7c45 LibWeb: Use JS::SafeFunction for module fetching callbacks
This fixes another GC crash seen on https://shopify.com/

Found it by collecting garbage after every 500th heap allocation.
2023-05-04 18:30:57 +02:00
MacDue
390ade3cf4 Base: Add some SVG <radialGradient> examples 2023-05-04 16:50:01 +02:00
MacDue
9b652842e4 LibWeb: Add an initial implementation of SVG <radialGradient>
This follows on from the SVG linear gradients. It supports the same
features (xlink:href, gradientUnits, gradientTransform).

With this commit I have now implemented all web gradients :^)

(Though we are still missing a few parameters for SVG gradients,
e.g. spreadMethod).
2023-05-04 16:50:01 +02:00
MacDue
2826bd2b45 LibWeb: Move some common SVG gradient functions into SVGGradientElement
These functions will also be used by SVG radial gradients.
2023-05-04 16:50:01 +02:00
MacDue
eda429111e LibWeb: Don't inherit SVG color stops if current gradient has stops
The previous behaviour was incorrect, the template's stops should only
be used if the current gradient does not have any stops.
2023-05-04 16:50:01 +02:00
MacDue
9ecc5413de LibWeb: Add tag and attribute names for SVG linear gradients 2023-05-04 16:50:01 +02:00
MacDue
81cefab1b1 LibGfx: Implement PaintStyle for SVG radial gradients
This also slightly refactors things to share more implementation with
the SVG linear gradients, and improve accuracy (which fixes some banding
issues).
2023-05-04 16:50:01 +02:00
MacDue
3d54b9ffa3 LibWeb: Mark SVG::NumberPercentage accessors as const 2023-05-04 16:50:01 +02:00
MacDue
cf0e31ca87 LibWeb: Remove general SVGFormattingContext FIXME
Since this FIXME was added the SVGFormattingContext has got a fair bit
more spec compliant. The other more specific FIXMEs in this file should
be more useful.
2023-05-04 16:50:01 +02:00
Timothy Flynn
ac8b892a25 LibWeb: Pause HTMLMediaElement when its document becomes inactive
For example, when navigating to another page, this ensures any media
resource will not continue playing.
2023-05-04 16:48:10 +02:00
Timothy Flynn
f78eadf00f LibWeb: Add an interface to be notified of Document state changes
Some HTML elements, e.g. HTMLMediaElement, need to take action when the
document becomes inactive.
2023-05-04 16:48:10 +02:00
Timothy Flynn
88b8969443 LibWeb: Implement steps for removing an HTMLMediaElement from a document 2023-05-04 16:48:10 +02:00
Luke Wilde
344785ae3a LibWeb: Implement the EventTarget constructor
This is typically used as `class A extends EventTarget`. It's usage can
be found on websites such as https://loadout.tf/

This has the quirk that we don't do set the EventTarget prototype for
HTML::Window, as it would cause a null deref on startup. However, given
it wasn't doing this before, I don't think it should cause any issues.
2023-05-04 16:12:40 +02:00
Jelle Raaijmakers
1127bdb65c Ports: Add Serious Sam - The First Encounter
The actual port is SeriousSamClassic, but only The First Encounter is
built and installed. It should be relatively easy to also build and
install The Second Encounter from this port in the future.
2023-05-04 16:11:28 +02:00
Jelle Raaijmakers
ea2f88a483 LibGL: Implement support for the GL_RGB5_A1 internal image format
We already support this in all other logic and in LibSoftGPU, I just
forgot to add this constant to this list.
2023-05-04 16:11:28 +02:00
Nico Weber
54448040ec ICC: Verify curve types have valid types
LutAToBTagData::from_bytes() and LutBToATagData::from_bytes() already
reject curves for which this isn't true with an error.

Ensure potential future callers of the constructors get it right too.
2023-05-04 16:11:07 +02:00
Nico Weber
0079fad785 ICC: Prepare for eventually implementing conversions for LUT profiles
No behavior change yet (except for more detailed "not yet implemented"
messages), but it prepares for eventually implementing some of this.
2023-05-04 16:11:07 +02:00
Andreas Kling
4ad12f3cb2 LibWeb: Honor fill, stroke and stroke-width attribute on SVGSVGElement
These are presentational hints and are handled by SVGGraphicsElement (a
superclass of SVGSVGElement) so we just need to call up to it. :^)
2023-05-04 15:40:34 +02:00
Nico Weber
2abe62adfa LibWeb: Don't divide by 0 in DOMMatrix::invert_self()
We'd only check is_invertible() after calling inverse(), which would
do a divide-by-0 for non-invertible matrices.

Less ambitious version of #18593.
2023-05-04 15:39:34 +02:00
Andreas Kling
3811be2f7c LibWeb: Make module maps GC-allocated
This allows them to mark JS modules, and fixes a crash seen on
https://shopify.com/
2023-05-04 11:56:55 +02:00
Aliaksandr Kalenik
853ecb8d8e LibWeb: Narrow width of boxes that create BFC to avoid overlap of float
https://www.w3.org/TR/CSS22/visuren.html#floats says that when a box
establishes BFC it should not overlap with floats. The way to avoid
overlaps is up to implementor. This change implements avoiding overlap
by narrowing width of a box because it seems like what other engines
do (in the scenarios I tested).
2023-05-04 06:14:58 +02:00
Aliaksandr Kalenik
bf41af6b9d LibWeb: Calculate y of a box before resolving width in BFC
Calculating width of a box in BFC requires having resolved y to be able
to check if a box overlaps with any floating boxes.

This change makes compute_width() to be called after finding y
position. That also required to move resolving of vertical metrics
in the beginning of a box layout process to have vertical margins
resolved before finding y position.
2023-05-04 06:14:58 +02:00
Kemal Zebari
582c55a1c8 AK: Have JsonArray::set() change values instead of inserting values
Resolves #18618.

8134dcc changed `JsonArray::set()` to insert elements at an index
instead of changing existing elements in-place. Since no behavior
such as `Vector::try_at()` exists yet, it returns nothing.
2023-05-03 21:39:09 +01:00
Andreas Kling
590723aa3b LibWeb: Implement the "The html element fills the viewport quirk"
Fixes #18037.
2023-05-03 20:44:30 +02:00
Andreas Kling
508927cae2 LibWeb: Take floats into account when measuring automatic width of IFC
When there are floats present inside an IFC, we must coordinate with
the parent BFC to calculate the automatic width of the IFC's block box.
This is because the IFC is not directly aware of floats. Only the BFC
knows enough about them to account for them in automatic sizing.
2023-05-03 19:49:43 +02:00
Andreas Kling
610a7603a2 LibWeb: Implement more box type transformation edge cases
In particular, we now blockify layout internal boxes (e.g table parts)
by turning them into `block flow`. This fixes a crash when viewing
our GitHub repo :^)
2023-05-03 16:04:30 +02:00
Kenneth Myhra
368c255368 Ports: Add Duke Nukem 3D
This adds 'JonoF's Duke Nukem 3D Port'.

Parts of the network-related stuff has been patched out.
See patch: patches/0002-mmulti.c-ifdef-out-network-related-stuff-we-currentl.patch

Notes:
- Some sound work seems to be needed. During the title screen and
  gameplay SFX works, but music does not play. At the ending screen of
  Hollywood Holocaust music does play.
- GTK has been disabled, by default it will start in fullscreen, to get
  back to windowed mode can be done through the Video Settings.
- OpenGL support has been disabled, as far as I can tell it will need
  OpenGL 2.0 support which we do not currently have.
- True 3D renderer has been turned on.
2023-05-03 15:39:24 +02:00
Nico Weber
9c3e36e72c ICC: Implement TRC inversion in from_pcs for point curves
This allows converting to a color space that uses a non-parametric
curve, for example:

    Build/lagom/image -o foo.png \
        --convert-to-color-profile .../profiles/sRGB-v2-micro.icc \
        input.jpg

...where profiles/sRGB-v2-micro.icc is from
https://github.com/saucecontrol/Compact-ICC-Profiles/

(Parametric curves are new in ICC v4, which means all v2 profiles
use point curves.)
2023-05-03 15:05:13 +02:00
Nico Weber
926c0d8676 ICC+image: Add conversion between color spaces for images :^)
For now, only for color spaces that are supported by Profile::to_pcs()
and Profile::from_pcs(), which currently means that all matrix profiles
(but not LUT profiles) in the source color space work, and that
matrix profiles with parametric curves in the destination color
space work.

This adds Profile::convert_image(Bitmap, source_profile), and
adds a `--convert-to-color-profile file.icc` flag to `image`.

It only takes a file path, so to use it with the built-in
sRGB profile, you have to write it to a file first:

% Build/lagom/icc -n sRGB --reencode-to serenity-sRGB.icc

`image` by default writes the source image's color profile
to the output image, and most image viewers display images
looking at the profile.

For example, take `Seven_Coloured_Pencils_(rg-switch_sRGB).jpg`
from https://commons.wikimedia.org/wiki/User:Colin/BrowserTest.

It looks normal in image viewers because they apply the unusual
profile embedded in the profile. But if you run

% Build/lagom/image -o huh.png --strip-color-profile \
    'Seven_Coloured_Pencils_(rg-switch_sRGB).jpeg'

and then look at huh.png, you can see how the image's colors
look like when interpreted as sRGB (which is the color space
PNG data is in if the PNG doesn't store an embedded profile).

If you now run

% Build/lagom/image -o wow.png \
    --convert-to-color-profile serenity-sRGB.icc --strip-color-profile \
    'Seven_Coloured_Pencils_(rg-switch_sRGB).jpeg'

this will convert that image to sRGB, but then not write
the profile to the output image (verify with `Build/lagom/icc wow.png`).
It will look correct in image viewers, since they display PNGs without
an embedded color profile as sRGB.

(This works because 'Seven_Coloured_Pencils_(rg-switch_sRGB).jpeg'
contains a matrix profile, and Serenity's built-in sRGB profile
uses a matrix profile with a parametric curve.)
2023-05-03 15:05:13 +02:00
Aliaksandr Kalenik
09d698e0a0 LibWeb: Exclude table-wrapper margins from table available width
Table should not take up more width than is available inside wrapper
after margins are taken in account.
2023-05-03 15:03:56 +02:00
Aliaksandr Kalenik
4d971b5bc5 LibWeb: Use appropriate containing block width to get width of table
This solves the issue that previously width table-wrapper containing
block were used in the places were containing block of table-root
should be used.
2023-05-03 15:03:56 +02:00
Andreas Kling
da768e7c46 LibWeb: Don't crash on unresolvable line-height: calc() value
Instead, log the calc() value we failed to resolve, so we can debug it.
2023-05-03 13:59:05 +02:00
Andreas Kling
968db96101 LibWeb: Show formatting context roots in layout tree dumps
This patch does three things:

- Factors out the code that determines whether a box will create a new
  formatting context for its children (and which type of context)

- Uses that code to mark all formatting context roots in layout tree
  dumps. This makes it much easier to follow along with layout since
  you can now see exactly where control is transferred to a new
  formatting context.

- Rebaselines all existing layout tests, since the output format has
  changed slightly.
2023-05-03 13:14:36 +02:00
Joel Petersson
42e118e6a9 AudioServer: Dequeue all buffers when clearing a ClientAudioStream
Previously we would exit the dequeuing loop after just one buffer
had been dequeued due to some bogus logic. This would manifest
when stopping and starting a track in SoundPlayer, where a few
miliseconds of 'old' audio would play when restarting the playback.

This commit makes sure we clear the entire queue.
2023-05-03 10:01:14 +02:00
Joel Petersson
23bc306f99 SoundPlayer: Clear client buffer when playback is stopped
Previously we would not clear the client buffer of the
ConnectionToServer when playback was stopped. This would
cause old samples to be buffered and played when playback
was restarted.

With this commit we now perform this clearing of the client
buffer correctly.
2023-05-03 10:01:14 +02:00
PrestonLTaylor
5563ebab5a profile: Prevent crash when -p is supplied a non-integer value
Instead of crashing we give a helpful warning message to the user.

This also removes a fixme! :^)
2023-05-03 09:57:43 +02:00
PrestonLTaylor
6811ab9c3b profile: Add -a to warning message when -e, -d, -w xor -f is not set
-a and -p both require only one of the flags.
We will inform the user of this for both -a and -p <PID>.
2023-05-03 09:57:43 +02:00
Aliaksandr Kalenik
e1c1aaa956 LibWeb: Implement "create navigation params from a srcdoc resource"
Implements:
https://html.spec.whatwg.org/multipage/browsing-the-web.html#create-navigation-params-from-a-srcdoc-resource

This is supporting function for populating document in session history
entry.

This function populates navigation params response with HTML text
passed in document resource.
2023-05-03 09:39:49 +02:00
Aliaksandr Kalenik
c235ee380f LibWeb: Implement "create navigation params by fetching"
Implements:
https://html.spec.whatwg.org/multipage/browsing-the-web.html#create-navigation-params-by-fetching

This is supporting function for population of document in a session
history entry.

This function populates response in navigation params by fetching url
in navigation params and handling redirects if required.
2023-05-03 09:39:49 +02:00
Aliaksandr Kalenik
de2c016556 LibWeb: Implement "attempt to populate the history entry's document"
Implements:
https://html.spec.whatwg.org/multipage/browsing-the-web.html#attempt-to-populate-the-history-entry's-document

This is going to be a replacement for `FrameLoader::load()` after
switching to navigables.

Brief description of `populate_session_history_entry_document`:
- If navigation params have url with fetch scheme then DOM document
  will be populated by fetching url and parsing response. This
  is going to be a replacement for `FrameLoader::load(AK::URL&)`.
- If url in navigation params is abort:srcdoc then DOM document
  will be populated by parsing HTML text passed in document resource.
  This is going to be a replacement for `FrameLoader::load_html()`
2023-05-03 09:39:49 +02:00
Aliaksandr Kalenik
804af38a96 LibWeb: Move document loading into separate file
In upcoming navigables refactor new function that uses fetch
instead of ResourceLoader to load document content is going to be
introduced:
https://html.spec.whatwg.org/multipage/browsing-the-web.html#create-navigation-params-by-fetching

`parse_document()` need to be separated from FrameLoader to reuse
code responsible for parsing HTTP response into DOM document.
2023-05-03 09:39:49 +02:00
Aliaksandr Kalenik
60a26077a7 LibWeb: Reuse ReferrerType from Fetch in HTML::DocumentState 2023-05-03 09:39:49 +02:00
Aliaksandr Kalenik
a27a30898c LibWeb: Add fetch_controller property in HTML::NavigationParams 2023-05-03 09:39:49 +02:00