Commit graph

48665 commits

Author SHA1 Message Date
Andreas Kling
949483fb01 Tests/LibWeb: Test flex column item with auto height and max-width
This case is important because we have to clamp the width before using
it to determine the auto height.
2023-03-26 15:14:35 +02:00
Andreas Kling
5b030a6923 Tests/LibWeb: Add test for flex item auto height with flex-wrap: wrap 2023-03-26 15:14:35 +02:00
Andreas Kling
2699f226fb LibWeb: Don't compute main axis "auto min-size" for flex item cross axis
The "flex item automatic minimum size in the main axis is the
content-based minimum size" behavior should only apply to flex item
sizes in the main axis. There was one case where we incorrectly applied
this behavior in the cross axis
2023-03-26 15:14:35 +02:00
Andreas Kling
1f7e6cc022 LibWeb: Use zero automatic minimum size for scroll-container flex items
The "flex item automatic minimum size in the main axis is the
content-based minimum size" behavior should only apply to flex items
that aren't scroll containers. We were doing it for all flex items.
2023-03-26 15:14:35 +02:00
Andreas Kling
8038824211 LibWeb: Add Layout::Box::is_scroll_container()
The computed `overflow` property values determine whether a box is a
scroll container or not, so let's have a simple helper for asking this.
2023-03-26 15:14:35 +02:00
Andreas Kling
3932afdc6a LibWeb: Remove unnecessary repeat of partial flex layout algorithm
When calculating one of the intrinsic sizes for a flex container, we
already go through the flex layout algorithm.

There's no need to perform some of the algorithm steps a second time.
This is a relic from an earlier time when we tried to bail early from
the layout algorithm in  the intrinsic sizing case. Now that we go
through the whole thing anyway, this is much simpler. :^)
2023-03-26 15:14:35 +02:00
MacDue
d38392d416 Base: Use radio button groups on accent-color demo page 2023-03-26 15:09:57 +02:00
MacDue
bcfe275563 Base: Add two more radio buttons to HTML input test page
You can't really test radio buttons with just one button.
2023-03-26 15:09:57 +02:00
MacDue
f96747b722 LibWeb: Check all conditions of radio button groups
This fixes a few issues I noticed when playing around with radio
buttons. Previously radio buttons would uncheck checkboxes with
the same "name" attribute, uncheck inputs across different forms,
and treated no name attribute as a group.

This now implements the radio button group check from the HTML spec.
2023-03-26 15:09:57 +02:00
Jelle Raaijmakers
256030da4e PixelPaint: Correctly set default layer name
Previously, if you confirmed the "new layer" dialog without any change
to the layer name, the layer would end up with an empty string for its
name.
2023-03-26 12:30:58 +01:00
Cameron Youell
f17bee0cb5 LibWeb: Fix mistype in LayoutState 2023-03-26 13:28:07 +02:00
Tim Ledbetter
30b3c30aba PixelPaint: Remove unused function definition from Image 2023-03-26 01:49:58 +01:00
Tim Ledbetter
8b4158633b PixelPaint: Use new String to format error messages 2023-03-26 00:47:29 +01:00
Tim Ledbetter
5b84fafbca PixelPaint: Include possible errno description in error messages
In the case where an error is created from an errno, calling
string_literal() will print nothing. Using Error's formatter
instead gives a more descriptive error message.
2023-03-26 00:47:29 +01:00
Tim Ledbetter
3faf089be5 PixelPaint: Add a Duplicate Layer action
The "Duplicate Layer" action inserts a copy of the selected layer into
the layer stack. The new layer is placed above the selected layer.
2023-03-26 00:44:26 +01:00
Tim Ledbetter
55feecee36 PixelPaint: Make wand tool work when layer and image rects differ
Previously, the position of the mask used to calculate the new
selection did not match the position of the active layer. The program
would crash when trying to set a mask pixel outside the bounds of the
active layer.
2023-03-26 00:21:29 +01:00
Julian Offenhäuser
bdd5f36121 LibPDF: Load replacements for TrueTypeFonts without an embedded font
This previously only happened for Type 1 fonts.
2023-03-25 16:27:30 -06:00
Julian Offenhäuser
5deac3a7f5 LibPDF: Actually return an error when failing to load replacement fonts 2023-03-25 16:27:30 -06:00
Julian Offenhäuser
fec7ccf020 LibPDF: Ask OpenType font programs for glyph widths if needed
If the font dictionary didn't specify custom glyph widths, we would fall
back to the specified "missing width" (or 0 in most cases!), which meant
that we would draw glyphs on top of each other in a lot of cases, namely
for TrueTypeFonts or standard Type1Fonts with an OpenType fallback.

What we actually want to do in this case is ask the OpenType font for
the correct width.
2023-03-25 16:27:30 -06:00
Julian Offenhäuser
2b3a41be74 LibPDF: Remove the subroutine length limit for PS1 font programs
A limit of 1024 subroutines seemed like a sensible choice, but some
fonts actually do exceed it. We will now only assert that the specified
amount is positive.
2023-03-25 16:27:30 -06:00
Julian Offenhäuser
4ec01669fc LibPDF: Scale vector paths with the view
This ensures that lines have the correct size at every scale factor.
2023-03-25 16:27:30 -06:00
Julian Offenhäuser
731676c041 LibPDF: Accept floats as line dash pattern phases 2023-03-25 16:27:30 -06:00
Julian Offenhäuser
95a804bc4e LibPDF: Allow the page rotation to be inherited 2023-03-25 16:27:30 -06:00
Julian Offenhäuser
b90a794d78 LibPDF: Allow pages with no specified contents
The contents object may be omitted as per spec, which will just leave
the page blank.
2023-03-25 16:27:30 -06:00
Julian Offenhäuser
fde990ead8 LibPDF: Allow optional inheritable page attributes
Previously, get_inheritable_object would always try to find the object
and throw an error if it couldn't. The spec tells us that some page
attributes, like CropBox, are optional but also inheritable. Others,
like the media box and resources, are technically required by the spec,
but omitted by some documents.

In both cases, we are now able to search for inheritable objects and
find a suitable replacement if there wasn't one.
2023-03-25 16:27:30 -06:00
Julian Offenhäuser
320f5f91ab LibPDF: Ignore whitespace in the ASCII hex filter
The spec tells us that any amount of whitespace may appear between the
hex digits and that it should just be ignored.
2023-03-25 16:27:30 -06:00
Nico Weber
29796f8f5e LibCrypto: Use 8-byte crc32 instruction on arm too
Takes

    % time Build/lagom/gunzip -c \
        /Users/thakis/Downloads/trace_bug.json.gz > /dev/null

from 3.9s to 3.87s.
2023-03-25 21:42:50 +00:00
Nico Weber
0452a8ed4b LibCrypto: Start sometimes hardware-accelerating crc32
Takes

    % time Build/lagom/gunzip -c \
        /Users/thakis/Downloads/trace_bug.json.gz > /dev/null

from 4s to 3.9s on my MBP.
2023-03-25 21:42:50 +00:00
Nico Weber
ee6843a13c Meta: Add "gunzip" and "gzip" to lagom build
This makes it easy to compare the performance of Serenity's
deflate implementation to the host system implementation.

On my M1 Max MBP:

    % time gunzip -c \
        /Users/thakis/Downloads/trace_bug.json.gz > /dev/null

takes between 0.064s and 0.082s.

    % time Build/lagom/gunzip -c \
        /Users/thakis/Downloads/trace_bug.json.gz > /dev/null

on the other hand takes 4 seconds.

(That .gz file is a 5.8M file -- the largest .gz file that happend to be
in my Downloads folder.)
2023-03-25 21:42:50 +00:00
Lucas CHOLLET
3323127db0 LibGUI: Allow blocking modals and popups to handle their own shortcuts
Since ef7d9c0, shortcut propagation was blocked for blocking modals and
popups. This however is an issue as some blocking modals (like
FilePicker) use shortcuts. This patch allows propagation of shortcuts
but only until the current window.
2023-03-25 21:42:53 +01:00
Lucas CHOLLET
baac824ee3 LibGUI: Make propagate_shortcuts handle different level of propagation
First, this patch renames the function
`propagate_shortcuts_up_to_application` to `propagate_shortcuts`.
Handling those levels, will allow us to differentiate shortcuts at
`Window` level and `Application` level. Which will be convenient to
handle dialog-specific shortcuts.
2023-03-25 21:42:53 +01:00
Cubic Love
0b14ef134d Base: Add Keyboard Shortcuts & Tips and Tricks man pages
Add a list of system and general keyboard shortcuts as well as a list
of tips and tricks to man7 (Miscellanea). Add links to these in the
Help-index to aid discoverability for new users.
2023-03-25 14:35:11 -06:00
Cubic Love
911baf3b7c Base: Add keyboard symbols to Katica Regular 12
These symbols represent common icons found on a user's keyboard
(PC and Mac). Now it will be possible for these icons to be used in
documentation (if desired) as Katica Regular 12 is used by LibMarkdown/
the Help application. Some bonus symbols have been added where they've
been easy to make along the way.

https://www.unicode.org/charts/PDF/U1F100.pdf
1F130

https://www.unicode.org/charts/PDF/U2190.pdf
2190-2193, 21B7, 21B9, 21DE-21DF, 21E4-21F3

https://www.unicode.org/charts/PDF/U2200.pdf
229E

https://www.unicode.org/charts/PDF/U2300.pdf
2303, 2318, 2324-2327, 232B, 2370, 2380, 2384, 2386, 2388, 238B-238C,
2397-239A, 23CE, 23FB-23FE

https://www.unicode.org/charts/PDF/U2460.pdf
24D8

https://www.unicode.org/charts/PDF/U25A0.pdf
25A4, 25B2-25B3, 25B7, 25BC-25BD, 25C1, 25C6-25C8

https://www.unicode.org/charts/PDF/U2700.pdf
2726-2727, 2732

https://www.unicode.org/charts/PDF/U27F0.pdf
27F3, 27F5-27F7

https://www.unicode.org/charts/PDF/U2B00.pdf
2B58

https://www.unicode.org/charts/PDF/U2900.pdf
2912-2913
2023-03-25 14:35:11 -06:00
Lucas CHOLLET
3f9c5af553 LibGfx/JPEG: More support for scans with a single component
Introduced in 2c98eff, support for non-interleaved scans was not working
for frames with a number of MCU per line or column that is odd. Indeed,
the decoder assumed that they have scans that include a fabricated MCU
like scans with multiple components.

This patch makes the decoder handle images with a number of MCU per line
or column that is odd. To do so, as in the current decoder state we do
not know if components are interleaved at allocation time, we skip over
falsely-created macroblocks when filling them. As stated in 2c98eff,
this is probably not a good solution and a whole refactor will be
welcome.

It also comes with a test that open a square image with a side of 600px,
meaning 75 MCUs.
2023-03-25 21:31:21 +01:00
Lucas CHOLLET
b820f9ffbd LibGfx/JPEG: Rename mb_index to macroblock_index 2023-03-25 21:31:21 +01:00
Lucas CHOLLET
3d7888f309 LibGfx/JPEG: Log components present in a scan 2023-03-25 21:31:21 +01:00
Jelle Raaijmakers
e18c87c60c Meta: Make audio hardware configurable through environment variable
The new environment variable `SERENITY_AUDIO_HARDWARE` accepts the
values `ac97` and `intelhda` (default).
2023-03-25 21:27:03 +01:00
Jelle Raaijmakers
dd0a25de4d Meta: Use more aptly named variable for PC speaker configuration 2023-03-25 21:27:03 +01:00
Jelle Raaijmakers
dd8fa73da1 Kernel: Add support for Intel HDA
This is an implementation that tries to follow the spec as closely as
possible, and works with Qemu's Intel HDA and some bare metal HDA
controllers out there. Compiling with `INTEL_HDA_DEBUG=on` will provide
a lot of detailed information that could help us getting this to work
on more bare metal controllers as well :^)

Output format is limited to `i16` samples for now.
2023-03-25 21:27:03 +01:00
Jelle Raaijmakers
c530f74e2f Kernel: Mention right parent class for AC'97's device_name 2023-03-25 21:27:03 +01:00
Andreas Kling
b3b9ac6201 LibWeb: Add FIXME whining to debug log if layout produces negative sizes
Negative width/height sizes are not allowed in CSS, so if our layout
algorithm resolves something to a negative size, we have boogs.

Instead of crashing or rendering something very wrong, we now clamp the
values to 0 and whine on the debug log so that someone can go and figure
out how we got the negative values in the first place. :^)
2023-03-25 19:41:31 +01:00
Andreas Kling
4bf10674fa LibWeb: Don't allow resolved height of abspos elements to become negative
We have to clamp the resulting height to 0 when solving for it.
2023-03-25 19:41:31 +01:00
Andreas Kling
3f6f3966b9 LibWeb: Don't allow resolved width of abspos elements to become negative
We have to clamp the resulting width to 0 when solving for it.
2023-03-25 19:41:31 +01:00
Andreas Kling
8f311c61af LibWeb: Add out-of-flow boxes to anonymous wrapper block when possible
If the previous sibling of an out-of-flow box has been wrapped in an
anonymous block, we now stuff the out-of-flow box into the anonymous
block as well.

Co-authored-by: Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
2023-03-25 19:41:31 +01:00
Andreas Kling
71bdee2837 headless-browser: Don't print extra newline after layout tree dumps
The layout tree dump text already contains a final newline, so we don't
need to use outln() and add an extra one.
2023-03-25 19:41:31 +01:00
Andreas Kling
a15a44cfc8 LibWeb: Don't use image source URL as backup alt attribute
This was a non-standard behavior of ours that broke layout on many pages
where an image failed to load for some reason.
2023-03-25 19:41:31 +01:00
Sam Atkins
7d08d5ad6f LibWeb: Remove now-unused includes from StyleValue.cpp
And add them to all the places that relied on getting them transitively.
2023-03-25 16:56:04 +00:00
Sam Atkins
4c54c5d3dd LibWeb: Split StyleValueList out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
3a2de67c7b LibWeb: Split RectStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
4bf59c59bb LibWeb: Split UnsetStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00