Commit graph

47911 commits

Author SHA1 Message Date
Andreas Kling
f97754942c LibWeb: Collapse margin-left with space used by left-side floats
We had an issue where boxes with margin-left were shifted right by
left-side floats twice instead of just once.
2023-03-11 10:46:26 +01:00
Andreas Kling
1cf5737e9e LibWeb: Add fast_is<T>() for various types stood out in a profile 2023-03-11 10:46:26 +01:00
Andreas Kling
f6426cdcd4 LibWeb: Use static_cast in SVGGeometryBox::dom_node()
These are only ever constructed with a corresponding SVGGeometryElement,
so we know it's safe to static_cast here.
2023-03-11 10:46:26 +01:00
Mathis Wiehl
ab4cf7c57d LibWeb: Don't overflow flex containers on margin auto
In case flex items had `margin: auto` on the primary flex axis, we were
still also distributing remaining space according to `justify-content`
rules. This lead to duplicated spacing in various places and overflows.

It looks like this issue was observed previously but missidentified
because there was logic to ignore margins at the start and end which
would partially paper over the root cause. However this created other
bugs (like for example not having a margin at beginning and end ;-)) and
I can find nothing in the spec or other browser behaviour that indicates
that this is something that should be done.

Now we skip justify-content space distribution alltogether if it has
already been distributed to auto margins.
2023-03-11 10:46:21 +01:00
Aliaksandr Kalenik
3716e1b8a0 Ladybird: Delete unused ConsoleClient and ConsoleGlobalObject
After the separation of LibWeb into WebContent process, ConsoleClient
and ConsoleGlobalObject are no longer used.
2023-03-11 08:09:10 +01:00
Andrew Kaster
3d33217d60 Ladybird+CI: Move layout_test.sh test runner from CI yml into CMake
We should be able to run this locally, as long as ENABLE_LAGOM_LADYBIRD
is true, or if building ladybird from the ladybird source directory.

This removes a special case from the Lagom CI yml file.
2023-03-10 23:01:55 +00:00
Lucas CHOLLET
af58f012be Tests: Add a test for JPEGs with RGB components 2023-03-10 22:22:36 +01:00
Lucas CHOLLET
a47d775be6 LibGfx/JPEG: Support RGB JPEGs
By default, JPEGs use YCbCr to encode colors however other encoding
exist. This patch adds the logic to determine which transformation is
needed and support for RGB encoded JPEGs :^).
2023-03-10 22:22:36 +01:00
Lucas CHOLLET
c60338e187 LibGfx/JPEG: Decode the App14 segment
This half-standardized application specific segment is used for color
transform information. It means that the decoder is know informed if the
image uses YCbCr, RGB, CMYK or even YCCK.
2023-03-10 22:22:36 +01:00
Lucas CHOLLET
00808c5eba LibGfx/JPEG: Use decimal instead of hexadecimal for APP markers 2023-03-10 22:22:36 +01:00
implicitfield
d4d1cab895 ThemeEditor: Support more color scheme-related roles 2023-03-10 22:03:49 +01:00
implicitfield
e9e4baee77 Everywhere: Support overriding the system color scheme 2023-03-10 22:03:49 +01:00
implicitfield
fba0cee622 Flood: Update the man page to reflect current color scheme handling 2023-03-10 22:03:49 +01:00
Ali Mohammad Pur
56b5b78d7b Shell: Error out on invalid `export' argument
Previously `export =` would crash the shell, make this an error instead.
2023-03-10 22:33:30 +03:30
Andrew Kaster
a5c47d0be3 LibAudio: Include missing AK/Stream.h in Loader.h
This fixes the FuzzQOILoader build.
2023-03-10 11:44:11 -07:00
Tom
52e45fb6fa LibWeb+Base: Fix row-height bug in Grid when there is a column gap
This fixes a bug in the CSS Grid when there is a column and/or row gap,
as previously it would take the index of the incorrect column when
finding the `AvailableSize`.

There is a mild complication in the GridFormattingContext as the
OccupationGrid does not take into account the gap columns and rows that
later appear in the `Vector<TemporaryTrack>` columns and rows. The
PositionedBoxes are kind of a connection between the two, and so it's
now more explicit whether you would like to refer to a column by its
position taking into the gap columns/rows or not.
2023-03-10 18:20:27 +01:00
Andreas Kling
da861fe7af Tests/LibWeb: Use SerenitySans in new layout tests
This ensures consistent font metrics no matter which platform fonts
are available.
2023-03-10 18:10:33 +01:00
Andreas Kling
ff7b949061 LibWeb: Make HTMLScript private members private once again
These were accidentally made public a while ago. Thankfully nobody
started poking into script element internals since then. :^)
2023-03-10 14:59:46 +01:00
Andreas Kling
e8f5085669 LibWeb: Implement Range.createContextualFragment() 2023-03-10 14:58:55 +01:00
Andreas Kling
fb6d6a985f LibWeb: Implement Element.setAttributeNode{,NS}() 2023-03-10 14:56:29 +01:00
Andreas Kling
8c5c78f1f1 LibWeb: Implement Document.createAttribute{,NS}() 2023-03-10 14:56:03 +01:00
Andreas Kling
109ed27423 LibWeb: Rewrite FFC "resolve flexible lengths" algorithm from draft spec
The draft CSS-FLEXBOX-1 spec had a more detailed description of this
algorithm, so let's use that as our basis for the implementation.

Test by Aliaksandr. :^)
2023-03-10 13:38:34 +01:00
Andreas Kling
1cd61723f0 LibWeb: Show layout test failure diffs in unified format (diff -u) 2023-03-10 13:38:34 +01:00
Andreas Kling
0ef07383e5 LibWeb: Fix bogus min/max-height for box-sizing:border-box flex items
When resolving these constraints to CSS pixel sizes, we have to resolve
padding-top and padding-bottom against the flex container's *width*,
not its height.
2023-03-10 13:38:34 +01:00
Andreas Kling
24d5a9d7df LibWeb: Fix bogus percentage vertical padding with box-sizing:border-box
The padding-top and padding-bottom properties are relative to the
*width* of the containing block, not the height.

It's funny how we keep making this same mistake again and again. :^)
2023-03-10 13:38:34 +01:00
Andreas Kling
07f6ee9e73 LibWeb: Simplify FFC get_pixel_{width,height} internal helper API
These took an Optional<CSS::Size> for some reason, but that was not
necessary. Just take a CSS::Size.
2023-03-10 13:15:45 +01:00
Andreas Kling
6b19397452 LibWeb: Avoid unnecessary work for box-sizing: content-box flex items 2023-03-10 13:15:45 +01:00
Andreas Kling
64bda6de2a LibWeb: Use equals_ignoring_ascii_case() in infra helper 2023-03-10 13:15:44 +01:00
Andreas Kling
a504ac3e2a Everywhere: Rename equals_ignoring_case => equals_ignoring_ascii_case
Let's make it clear that these functions deal with ASCII case only.
2023-03-10 13:15:44 +01:00
Andreas Kling
03cc45e5a2 Kernel: Use RefPtr instead of LockRefPtr for File and subclasses
This was mostly straightforward, as all the storage locations are
guarded by some related mutex.

The use of old-school associated mutexes instead of MutexProtected
is unfortunate, but the process to modernize such code is ongoing.
2023-03-10 13:15:44 +01:00
kleines Filmröllchen
61bb9103c2 Base+Userland: Add support for QOA files everywhere
This adds MIME type sniffing,
`file` support,
LaunchServer support to open QOA in SoundPlayer,
and audio icons
2023-03-10 04:07:14 -07:00
kleines Filmröllchen
0f7a5006d1 Meta/Lagom: Add a fuzzer for QOA 2023-03-10 04:07:14 -07:00
kleines Filmröllchen
0b421a3764 LibAudio: Implement the Quite Okay Audio format
Brought to you by the inventor of QOI, QOA is a lossy audio codec that
is, as the name says, quite okay in compressing audio data reasonably
well without frequency transformation, mostly introducing some white
noise in the background. This implementation of QOA is fully compatible
with the qoa.h reference implementation as of 2023-02-25. Note that
there may be changes to the QOA format before a specification is
finalized, and there is currently no information on when that will
happen and which changes will be made.

This implementation of QOA can handle varying sample rate and varying
channel count files. The reference implementation does not produce these
files and cannot handle them, so their implementation is untested.

The QOA loader is capable of seeking in constant-bitrate streams.

QOA links:
https://phoboslab.org/log/2023/02/qoa-time-domain-audio-compression
https://github.com/phoboslab/qoa
2023-03-10 04:07:14 -07:00
kleines Filmröllchen
3c65c22728 LibAudio: Replace Result with ErrorOr
Since they are API compatible, this change is very simple.
2023-03-10 04:07:14 -07:00
kleines Filmröllchen
b38beb106e AK: Add constexpr floor and round 2023-03-10 04:07:14 -07:00
Johannes Fritz
6f29ea9976 Base: Replace office.png icon with BSD licensed one 2023-03-10 03:53:29 -07:00
Andrew Kaster
8f8e04677d Documentation: Reorganize Lagom README and update fuzzer documentation
Add some prose to the introduction of Lagom about how we use it. Also,
move the section on including Lagom in other projects above the fuzzer
documentation.

Remove the explicit cmake commands from the Fuzzer documentation, as the
script should be the source of truth.
2023-03-10 03:48:41 -07:00
Andreas Kling
806d32c88f LibWeb: Use shadow_root_internal() when building <input> UA shadow DOM 2023-03-09 21:54:59 +01:00
Andreas Kling
e6448f137e LibWeb: Avoid an unnecessary vector copy when generating flex items 2023-03-09 21:54:59 +01:00
Andreas Kling
8929c7b474 LibWeb: Remove FFC hack where we assign flex item box dimensions twice
This was necessary in the past, because IFC would set the height of its
containing block after inline layout.

Now that IFC can properly communicate the automatic size to its parent
formatting context, this hack is no longer necessary.
2023-03-09 21:54:59 +01:00
Andreas Kling
4bfdc4db17 LibWeb: Make CSS rule cache smarter about pseudo elements
Instead of putting every rule that matches a pseudo element in the
same bucket, let them go in the best ID/class/tag name bucket instead.
Then, add a flag to MatchingRule that says whether it contains a
pseudo element in the rightmost compound selector.

When deciding which selectors to run for an element, we can now simply
filter in/out pseudo element selectors as appropriate depending on what
we're trying to match.

This fixes an issue where pages using Font Awesome had 1700+ rules in the
pseudo-element rule cache. (This meant all those rules had to run
against every element twice or more while instantiating pseudo elements.)
2023-03-09 21:54:59 +01:00
Andreas Kling
2a607e9ebc LibWeb: Rename FFC::specified_axis_size() to inner_axis_size()
"Specified" means something else in CSS, so let's not use this
overloaded word here. These helpers return the inner main/cross size of
a given box, so let's say "inner" instead.
2023-03-09 21:54:59 +01:00
Andreas Kling
0315ba5e06 LibWeb: Use FlexItem& item consistenly in FlexFormattingContext
There was a pointless mix of `FlexItem*` vs `FlexItem&` as well as
`flex_item` vs `item`. Let's pick one and be consistent.
2023-03-09 21:54:59 +01:00
Andreas Kling
9eb8025463 LibWeb: Always include shadow roots in DOM debug dumps 2023-03-09 21:54:59 +01:00
Andreas Kling
d517e7fb3a AK: Make FlyString::hash() use the cached hash in StringData if possible
This avoids rehashing the string every time.
2023-03-09 21:54:59 +01:00
Andreas Kling
e6fc7b3ff7 Kernel: Switch LockRefPtr<Inode> to RefPtr<Inode>
The main place where this is a little iffy is in RAMFS where inodes
have a LockWeakPtr to their parent inode. I've left that as a
LockWeakPtr for now.
2023-03-09 21:54:59 +01:00
Sam Atkins
067d0689c5 AK: Replace C-style casts 2023-03-09 21:43:54 +01:00
Lucas CHOLLET
7d6908d9a5 Applets/Keymap: Repaint applet on keymap change 2023-03-09 21:42:23 +01:00
Tim Ledbetter
4fd12b6b79 PixelPaint: Add list of recently opened files to the file menu 2023-03-09 21:21:18 +01:00
Tim Ledbetter
4accc6a61f PixelPaint: Propagate errors from menu initialization 2023-03-09 21:21:18 +01:00