Commit graph

50022 commits

Author SHA1 Message Date
Ali Mohammad Pur 79c76d67ce Shell: Add the 'break' and 'continue' POSIX builtins
These only support n=1 for now.
2023-05-05 09:35:24 +03:30
Aliaksandr Kalenik 0318ac5ce4 LibWeb: Remove setting length to 0px if it is not definite
If available width (or height) is max-content and width (or height)
value is 100% it should be resolved in infinite px, not 0 px.

Fixes #18639
2023-05-05 06:20:44 +02:00
Fabian Dellwing b443c0b80b Ports: Update OpenJDK 2023-05-05 02:19:05 +02:00
Fabian Dellwing 36a26d7fa8 Userland: Fix wrong signature of dladdr
This function is supposed to take a `const void *addr` as first
parameter, but we took a `void *addr`.

https://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/baselib-dladdr-3.html
2023-05-05 02:19:05 +02:00
Ali Mohammad Pur 87e95ceb69 LibXML: Notify the listener about the root node as well
We previously did not notify the listener about entering the root node,
which caused the following snippet to produce the wrong output:
    a = new DOMParser
    a.parseFromString("<x/>", "text/xml").documentElement // != null
2023-05-05 01:33:49 +02:00
kleines Filmröllchen 0ab19dc4cd Piano: Allow per-track controls (again)
This makes Piano exactly as usable as when I started the large refactor
some years ago, which *sounds* like I'm a terrible person but now it (1)
looks nicer and (2) has a flexible backend that can already deal with
aribtrary kinds of processors on any track.
2023-05-05 01:32:09 +02:00
kleines Filmröllchen d757027638 Piano: Use size_t for track count 2023-05-05 01:32:09 +02:00
kleines Filmröllchen 876f00e635 Base: Demonstrate ArgsParser and format strings in cli project template
This demonstrates both an option and an optional positional argument, as
well as some simple format string printing with {}.
2023-05-05 02:15:43 +03:30
kleines Filmröllchen fd68e9f1ac Base: Split out cpp-library template files into actual files
These were part of the postcreate script previously, but with the new
powers of sed, we can text-replace the library name and make changing
them much more convenient.
2023-05-05 02:15:43 +03:30
kleines Filmröllchen 2451e97a11 Base: Adjust serenity-application template with some cpp-gui pieces
Namely, the window title and size are carried over, since a larger
window with a more readable "Example Application" title is better to
understand. I also took the opportunity to add a missing trailing
newline to the generated CMake file.
2023-05-05 02:15:43 +03:30
kleines Filmröllchen 7a0fae7be1 Base: Remove the cpp-gui HackStudio template
This template is essentially an older version of the
serenity-application template, it does not compile anymore and is
therefore entirely redundant.
2023-05-05 02:15:43 +03:30
kleines Filmröllchen 5ebc741594 sed: Implement in-place file editing
This implements the '-i' flag in the GNU version, without suffix
support.
2023-05-05 02:15:43 +03:30
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