Commit graph

24187 commits

Author SHA1 Message Date
Timothy Flynn
15532df83d AK+Everywhere: Change AK::fill_with_random to accept a Bytes object
Rather than the very C-like API we currently have, accepting a void* and
a length, let's take a Bytes object instead. In almost all existing
cases, the compiler figures out the length.
2023-04-03 15:53:49 +02:00
Lucas CHOLLET
cb0c8634d4 LibGfx/JPEG: Use a basic Stream instead of a SeekableStream
Only one use `seek` remains, as it is a bit more complex to remove.
2023-04-03 09:19:15 -04:00
Lucas CHOLLET
dc9e783608 LibGfx/JPEG: Remove the ensure_bounds_okay function
This function has probably been added when we weren't as good with error
propagations as we are now. We can safely remove it and let future
calls to `read` fail if the file is corrupted.

This can be tested with the following bytes (already used in 9191829a):
ffd8ffc000000800080ef701101200ffda00030100
2023-04-03 09:19:15 -04:00
Tim Ledbetter
3fa9c9bda4 PixelPaint: Update recent files list on project save
This is consistent with the behavior of other applications.
2023-04-03 07:13:27 +02:00
matcool
1bd8f4eb03 PixelPaint: Make Bloom use InplaceFilter instead of Filter
This change affects the filter preview widget, which would get the bloom
filter applied over the same bitmap, leading to an incorrect preview.
2023-04-03 07:13:13 +02:00
justus2510
2259ddf937 ImageViewer: Fix crash when setting wallpaper
When trying to set the wallpaper from the menu, ImageViewer would
crash because setting the wallpaper requires the program to pledge
to the WindowManager domain. This patch adds that pledge.
2023-04-03 07:11:28 +02:00
MacDue
bed55ac669 LibWeb: Parse and plumb background-position-x/y
This parses the new background-position-x/y longhands and properly
hooks up them up. This requires converting PositionStyleValue to
just contain two EdgeStyleValues so that it can be easily expanded
into the longhands.
2023-04-03 07:10:33 +02:00
MacDue
2a659693bc LibWeb: Add EdgeStyleValue
This represents a single edge and offset, this will be needed for
the values of background-position-x/y.
2023-04-03 07:10:33 +02:00
MacDue
d5e61168b2 LibWeb: Add longhand properties for background-position
If background-position was not longhand enough for you, we've
now got background-position-x and background-position-y :^)
2023-04-03 07:10:33 +02:00
Ali Mohammad Pur
7375beced3 LookupServer: Put upstream DNS responses in cache 2023-04-02 20:42:39 +02:00
Ali Mohammad Pur
c7409af627 LibHTTP: Tolerate extra \r\n in chunked-encoding last block size
Some servers put CR/LF there, so let's tolerate that behaviour.
Fixes #18151.
2023-04-02 20:42:39 +02:00
martinfalisse
289285cd6e LibWeb: Add borders functionality to CSS Grid 2023-04-02 19:08:04 +02:00
martinfalisse
6f52272d34 LibWeb: Fix regression in definite grid row heights
Fixes a row height bug when a grid item in a row has a definite height.
2023-04-02 19:08:04 +02:00
martinfalisse
e65f4b3dc5 LibWeb: Rename PositionedBox to GridItem
This seems like a more accurate description of what this class really
is, and easier to understand in my opinion.
2023-04-02 19:08:04 +02:00
Andreas Kling
8bb0be7d4f LibWeb: Don't apply presentational hints to associated pseudo elements
CSS properties generated by presentational hints in content attributes
should not leak into pseudo elements.
2023-04-02 15:00:06 +02:00
Andreas Kling
620a34a463 LibWeb: Don't apply element inline style to associated pseudo elements
An element's inline style, if present, should not leak into any pseudo
elements generated by that element.
2023-04-02 15:00:06 +02:00
Timothy Flynn
eed956b473 AK: Increase LittleEndianOutputBitStream's buffer size and remove loops
This is very similar to the LittleEndianInputBitStream bit buffer change
from 8e834d4bb2.

We currently buffer one byte of data for the underlying stream. And when
we put bits onto that buffer, we do so 1 bit at a time.

This replaces the u8 buffer with a u64. And instead of looping at all,
we perform bitwise operations to write the desired number of bits.

Using the "enwik8" file as a test (100MB uncompressed, commonly used in
benchmarks: https://www.mattmahoney.net/dc/enwik8.zip), compression time
decreases from:

    13.62s to 10.9s on Serenity (cold)
    13.62s to 9.22s on Serenity (warm)
    2.93s to 2.32s on Linux

One caveat is that this requires explicitly flushing any leftover bits
when the caller is done with the stream. The byte buffer implementation
implicitly flushed its data every time the buffer was byte-aligned, as
doing so would always fill the byte. This is no longer the case. But for
now, this should be fine as the one user of this class, DEFLATE, already
has a "flush everything now that we're done" finalizer.
2023-04-02 10:54:37 +02:00
Andreas Kling
9cded6e1b5 LibWeb: Fix application of intrinsic aspect ratio to flex column items
The intrinsic aspect ratio of a box is a width:height ratio, so if we
have the width and need the height, we should divide, not multiply. :^)
2023-04-02 06:45:44 +02:00
Andreas Kling
2413de7e10 LibWeb: Make HTMLImageElement loads delay the document load event
This is something we're supposed to do according to the HTML spec.
Note that image loading is currently completely ad-hoc, and this just
adds a simple DocumentLoadEventDelayer to the existing implementation.

This will allow us to use images in layout tests, which rely on the
document load event firing at a predictable time.
2023-04-02 06:45:44 +02:00
Linus Groh
3709d11212 LibJS: Parse secondary expressions with the original forbidden token set
Instead of passing the continuously merged initial forbidden token set
(with the new additional forbidden tokens from each parsed secondary
expression) to the next call of parse_secondary_expression(), keep a
copy of the original set and use it as the base for parsing the next
secondary expression.

This bug prevented us from properly parsing the following expression:

```js
0 ?? 0 ? 0 : 0 || 0
```

...due to LogicalExpression with LogicalOp::NullishCoalescing returning
both DoubleAmpersand and DoublePipe in its forbidden token set.

The following correct AST is now generated:

Program
  (Children)
    ExpressionStatement
      ConditionalExpression
        (Test)
          LogicalExpression
            NumericLiteral 0
            ??
            NumericLiteral 0
        (Consequent)
          NumericLiteral 0
        (Alternate)
          LogicalExpression
            NumericLiteral 0
            ||
            NumericLiteral 0

An alternate solution I explored was only merging the original forbidden
token set with the one of the last parsed secondary expression which is
then passed to match_secondary_expression(); however that led to an
incorrect AST (note the alternate expression):

Program
  (Children)
    ExpressionStatement
      LogicalExpression
        ConditionalExpression
          (Test)
            LogicalExpression
              NumericLiteral 0
              ??
              NumericLiteral 0
          (Consequent)
            NumericLiteral 0
          (Alternate)
            NumericLiteral 0
        ||
        NumericLiteral 0

Truth be told, I don't know enough about the inner workings of the
parser to fully explain the difference. AFAICT this patch has no
unintended side effects in its current form though.

Fixes #18087.
2023-04-02 06:45:37 +02:00
Nico Weber
85d0637058 LibCompress: Make CanonicalCode::from_bytes() return ErrorOr<>
No intended behavior change.
2023-04-02 06:19:46 +02:00
Matthew Olsson
36ca1386e8 LibWeb: Add ReadableStream.locked/cancel()/getReader() 2023-04-01 23:43:07 +01:00
Matthew Olsson
d8710aa604 LibWeb: Implement ReadableStream's constructor 2023-04-01 23:43:07 +01:00
Matthew Olsson
66dec1bf54 LibWeb: Add UnderlyingSource struct for ReadableStream constructor 2023-04-01 23:43:07 +01:00
Matthew Olsson
bc9919178e LibWeb: Add ReadableStreamDefaultController 2023-04-01 23:43:07 +01:00
Matthew Olsson
222e3c32cd LibWeb: Add ReadableStreamDefaultReader 2023-04-01 23:43:07 +01:00
Matthew Olsson
7ff657ef57 LibWeb: Add the stream queue-related abstract operations 2023-04-01 23:43:07 +01:00
Matthew Olsson
fe69d66a4e LibWeb: Add the ReadableStreamGenericReader mixin interface 2023-04-01 23:43:07 +01:00
MacDue
f409f68a9a LibWeb: Use scaled font when painting list item markers
This now uses the current font (rather than the painter's default)
and scales it correctly. This is not perfect though as just naviely
doing .draw_text() here does not follow the proper text layout logic
so this is misaligned (by a pixel or two) with the text in the <li>.
2023-04-01 22:39:47 +01:00
MacDue
14f937b292 LibWeb: Use scaled font when painting text shadows
This fixes painting text shadows at non-100% zoom.
2023-04-01 22:39:47 +01:00
MacDue
7061a3d8e6 LibWeb: Add .scaled_font() helper to Layout::Node
This returns the font scaled for the current zoom level.
2023-04-01 22:39:47 +01:00
Eli Youngs
9bc45c0ae8 grep: Read patterns from a file with -f 2023-04-01 13:49:47 -06:00
Tim Schumacher
ad31265e60 LibCompress: Implement block size validation for XZ streams 2023-04-01 13:57:54 +02:00
Tim Schumacher
20f1a29202 LibCompress: Factor out the list of XZ check sizes 2023-04-01 13:57:54 +02:00
Nico Weber
bc70d7bb77 LibCompress: Reduce indentation in CompressedBlock::try_read_more()
...by removing `else` after `return`.

No behavior change.
2023-04-01 13:57:39 +02:00
Andreas Kling
bc6e61adec LibWeb: Don't churn HTML::EventLoop while in microtask checkpoint
At the end of HTML::EventLoop::process(), the loop reschedules itself if
there are more runnable tasks available.

However, the condition was flawed: we would reschedule if there were any
microtasks queued, but those tasks will not be processed if we're
currently within the scope of a microtask checkpoint.

To fix this, we now only reschedule the HTML event loop for microtask
processing *if* we're not already in a microtask checkpoint.

This fixes the 100% CPU churn seen when looking at PRs on GitHub. :^)
2023-04-01 12:45:47 +01:00
Tim Ledbetter
37bbd20cee LibCore: Remove colons from markdown header names in ArgsParser
This makes formatting more consistent across man pages.
2023-04-01 11:49:57 +01:00
Timothy Flynn
da6f32e5d8 gzip: Use utilities from LibCompress to (de)compress files 2023-04-01 08:15:49 +02:00
Timothy Flynn
7ec91dfde7 LibCompress: Add a utility to GZIP compress an entire file
This is copy-pasted from the gzip utility, along with its existing TODO.
This is currently only needed by that utility, but this gives us API
symmetry with GzipDecompressor, and helps ensure we won't end up in a
situation where only one utility receives optimizations that should be
received by all interested parties.
2023-04-01 08:15:49 +02:00
Timothy Flynn
857f559a06 gunzip+LibCompress: Move utility to decompress files to GzipDecompressor
This is to allow re-using this method (and any optimization it receives)
by other utilities, like gzip.
2023-04-01 08:15:49 +02:00
MacDue
df577b457a Browser: Add tooltip to reset zoom level button 2023-03-31 21:46:56 +01:00
sbcohen2000
9e21b3f216 KeyboardSettings: Add checkbox to enable Caps Lock mapping to Ctrl
This patch adds an additional control to KeyboardSettings allowing
the user to map Caps Lock to Ctrl. Previously, this was only possible
by writing to /sys/kernel/variables/caps_lock_to_ctrl.

Writing to /sys/kernel/variables/caps_lock_to_ctrl requires root
privileges, but KeyboardSettings will not attempt to elevate
the privilege of the user if they are not root. Instead, the
checkbox is rendered as un-editable.
2023-03-31 12:45:21 -04:00
Nico Weber
c3b8b3124c LibCompress: Remove two needless heap allocations 2023-03-31 08:44:30 -06:00
Sam Atkins
88d64fcb55 LibWeb: Add HTMLAnchorElement.referrerPolicy property 2023-03-31 11:36:41 +01:00
Sam Atkins
0c19d3aa58 LibWeb: Add HTMLAnchorElement.text getter and setter
And a FIXME for the missing `referrerPolicy` property.
2023-03-31 11:36:41 +01:00
Sam Atkins
888efe367e LibWeb: Add "CEReactions" to HTMLAnchorElement IDL as in spec 2023-03-31 11:36:41 +01:00
Sam Atkins
0761926127 HackStudio: Migrate git-diff indicators to TextEditor API
As part of this, the CodeDocument now keeps track of the kind of
difference for each line. Previously, we iterated every hunk every time
the editor was painted, but now we do that once whenever the diff
changes, and then save the type of difference for each line.
2023-03-31 12:09:40 +02:00
Sam Atkins
620bf45f43 HackStudio: Migrate execution-position indicator to TextEditor API 2023-03-31 12:09:40 +02:00
Sam Atkins
99221a436e HackStudio: Migrate breakpoint indicators to TextEditor API 2023-03-31 12:09:40 +02:00
Sam Atkins
4b29702fee LibGUI: Add gutter indicators to TextEditor :^)
HackStudio's Editor has displayed indicators in its gutter for a long
time, but each required manual code to paint them in the right place
and respond to click events. All indicators on a line would be painted
in the same location. If any other applications wanted to have gutter
indicators, they would also need to manually implement the same code.

This commit adds an API to GUI::TextEditor so it deals with these
indicators. It makes sure that multiple indicators on the same line
each have their own area to paint in, and provides a callback for when
one is clicked.

- `register_gutter_indicator()` should be called early on. It returns a
  `GutterIndicatorID` that is then used by the other methods.
  Indicators on a line are painted from right to left, in the order
  they were registered.
- `add_gutter_indicator()` and `remove_gutter_indicator()` add the
  indicator to the given line.
- `clear_gutter_indicators()` removes a given indicator from every line.
- The `on_gutter_click` callback is called whenever the user clicks on
  the gutter, but *not* on an indicator.
2023-03-31 12:09:40 +02:00
Sam Atkins
ce9b9a4f20 LibGUI: Rename TextEditor::LineVisualData -> LineData
This is going to hold other per-line data too.
2023-03-31 12:09:40 +02:00
Sam Atkins
03571b1fa9 LibGUI: Extract repeated code for populating TextEditor per-line data 2023-03-31 12:09:40 +02:00
Liav A
ba43ee4046 CrashReporter: Warn about malloc and free patterns in fault address
Warn the user about seemingly known malloc() and free() patterns in the
fault address.
This brings back the functionality that was removed recently in the
5416a37fde commit, but this time we detect
these patterns in userspace code and not in kernel code.
2023-03-31 12:09:06 +02:00
Pankaj Raghav
14e75ed721 disk_benchmark: Remove the call to umask
Calling umask and open with same permission value will result in a file
with no permissions bits if the program is stopped while it is doing an
IO. This will result in an error with EACCES when we try to run the
benchmark with the same file name. The file needs to be manually
removed before continuing the benchmark.

There is no use in calling umask here, so just remove it so that
interrupting the program while it is doing an IO will not result int the
file with no permissions the next time we run the program.
2023-03-31 09:43:00 +02:00
Timothy Flynn
8b56d82865 AK+LibCompress: Remove the Deflate back-reference intermediate buffer
Instead of reading bytes from the output stream into a buffer, just to
immediately write them back out, we can skip the middle-man and copy the
bytes directly into the output buffer.
2023-03-31 06:56:11 +02:00
Timothy Flynn
9f238793e0 gunzip+LibCompress: Increase buffer sizes used by Deflate and gunzip
Co-authored-by: Andreas Kling <kling@serenityos.org>
2023-03-31 06:56:11 +02:00
Timothy Flynn
62b575ad7c LibCrypto: Implement little endian CRC using the slicing-by-8 algorithm
This implements Intel's slicing-by-8 algorithm for CRC checksums (only
little endian CPUs for now, as I don't have a way to test big endian).

The original paper for this algorithm seems to have disappeared, but
Intel's source code is still available as a reference:

    https://sourceforge.net/projects/slicing-by-8/

As well as other implementations for reference:

    https://docs.rs/slice-by-8/latest/src/slice_by_8/algorithm.rs.html

Using the "enwik8" file as a test (100MB uncompressed, commonly used in
benchmarks: https://www.mattmahoney.net/dc/enwik8.zip), decompression
time decreases from:

    4.89s to 3.52s on Serenity (cold)
    1.72s to 1.32s on Serenity (warm)
    1.06s to 0.92s on Linux
2023-03-31 06:56:05 +02:00
Ali Mohammad Pur
83cb73a045 LibCore: Don't assume ArgsParser arguments are non-empty
This was fine before as the last entry was a null string (which could be
printed), but we no longer use C-style sentinel-terminated arrays for
arguments.
2023-03-31 06:55:46 +02:00
Ali Mohammad Pur
1173adb90a Shell: Don't require ArgsParser values to be null-terminated 2023-03-31 06:55:46 +02:00
Sam Atkins
1280d70d74 LibWeb: Split CalculatedStyleValue out of StyleValue.{h,cpp} 2023-03-30 21:29:50 +02:00
Sam Atkins
0c14103025 LibWeb: Move PercentageOr and subclasses into PercentageOr.{h,cpp}
This solves an awkward dependency cycle, where CalculatedStyleValue
needs the definition of Percentage, but including that would also pull
in PercentageOr, which in turn needs CalculatedStyleValue.

Many places that previously included StyleValue.h no longer need to. :^)
2023-03-30 21:29:50 +02:00
Sam Atkins
16e3a86393 LibWeb: Make absolutized_length() helper a Length method
There were a mix of users between those who want to know if the Length
changed, and those that just want an absolute Length. So, we now have
two methods: Length::absolutize() returns an empty Optional if nothing
changed, and Length::absolutized() always returns a value.
2023-03-30 21:29:50 +02:00
Sam Atkins
7d29262b8b LibWeb: Move to_gfx_scaling_mode() helper
There's no longer any reason to have this in StyleValue.h
2023-03-30 21:29:50 +02:00
Sam Atkins
d64ddeaec4 LibWeb: Move PositionValue into its own files
It's in Position.{h,cpp} because it represents a <position> in CSS, even
though it's currently named PositionValue to avoid collisions.
2023-03-30 21:29:50 +02:00
Sam Atkins
bcebca62d3 LibWeb: Move CSS::EdgeRect into its own files
Also remove the unused StyleValue::to_rect() because an EdgeRect is only
ever held by a RectStyleValue.
2023-03-30 21:29:50 +02:00
Sam Atkins
b3a7a00ccf LibWeb: Move BackgroundSize enum to ComputedValues.h
Again, this doesn't belong in StyleValue.h, though this may not be the
ideal place for it either.
2023-03-30 21:29:50 +02:00
Sam Atkins
c4afa79fed LibWeb: Move FlexBasis enum to ComputedValues.h
This may not be the ideal place for this, but it definitely doesn't
belong in StyleValue.h
2023-03-30 21:29:50 +02:00
Sam Atkins
53a4a31af2 LibWeb: Remove CalculatedStyleValue from Length 2023-03-30 21:29:50 +02:00
Sam Atkins
62a8cf2bb8 LibWeb: Let CSS::Size contain a CalculatedStyleValue
Technically this was already true, but now we explicitly allow it
instead of that calc value being hidden inside a Length or Percentage.
2023-03-30 21:29:50 +02:00
Sam Atkins
ac4350748e LibWeb: Remove CalculatedStyleValue from Time
Time also isn't used anywhere yet, hooray!
2023-03-30 21:29:50 +02:00
Sam Atkins
bf915fdfd7 LibWeb: Remove CalculatedStyleValue from Frequency
Conveniently, we don't actually use Frequency for any properties.
2023-03-30 21:29:50 +02:00
Sam Atkins
7a1a97f153 LibWeb: Remove CalculatedStyleValue from Angle
...and replace it with AngleOrCalculated.

This has the nice bonus effect of actually handling `calc()` for angles
in a transform function. :^) (Previously we just would have asserted.)
2023-03-30 21:29:50 +02:00
Sam Atkins
fa90a3bb4f LibWeb: Introduce CalculatedOr type
This is intended as a replacement for Length and friends each holding a
`RefPtr<CalculatedStyleValue>`. Instead, let's make the types explicit
about whether they are calculated or not. This then means a Length is
always a Length, and won't require including `StyleValue.h`.

As noted, it's probably nicer for LengthOrCalculated to live in
`Length.h`, but we can't do that until Length stops including
`StyleValue.h`.
2023-03-30 21:29:50 +02:00
Andreas Kling
b727f8113f LibJS: Add fast path to Value::to_u32() if Value is a positive i32
6.6% speed-up on Kraken's stanford-crypto-aes subtest. :^)
2023-03-30 19:13:35 +01:00
Andreas Kling
45f8542965 LibWeb: Actually visit rules and media queries in imported style sheets
Due to CSSImportRule::has_import_result() being backwards, we never
actually entered imported style sheets when traversing style rules or
media queries.

With this fixed, we no longer need the "collect style sheets" step in
StyleComputer, as normal for_each_effective_style_rule() will now
actually find all the rules. :^)
2023-03-30 16:54:15 +02:00
Tim Schumacher
fe761a4e9b LibCompress: Use LZMA context from preexisting dictionary 2023-03-30 14:39:31 +02:00
Tim Schumacher
c020ee8bfa LibCompress: Avoid overflowing the size of uncompressed LZMA2 chunks 2023-03-30 14:39:31 +02:00
Tim Schumacher
023c64011c LibCompress: Use the correct LZMA repetition offset in all cases 2023-03-30 14:39:31 +02:00
Tim Schumacher
9ccb0fc1d8 LibCompress: Only require new LZMA2 properties after dictionary reset 2023-03-30 14:39:31 +02:00
Tim Schumacher
d9627503a9 LibCompress: Reduce repeated code in the LZMA decompressor 2023-03-30 14:39:31 +02:00
Tim Schumacher
726963edc7 LibCompress: Implement support for multiple concatenated XZ streams 2023-03-30 14:38:47 +02:00
Tim Schumacher
00332c9b7d LibCompress: Move XZ header validation into the read function
The constructor is now only concerned with creating the required
streams, which means that it no longer fails for XZ streams with
invalid headers. Instead, everything is parsed and validated during the
first read, preparing us for files with multiple streams.
2023-03-30 14:38:47 +02:00
Andreas Kling
1f166b3a15 LibWeb: Don't re-sort StyleSheetList on every new sheet insertion
This was causing a huge slowdown when loading some pages with weirdly
huge number of style sheets. For example, amazon.com has over 200 style
elements, which meant we had to resort the StyleSheetList 200 times.
(And sorting itself was slow because it has to compare DOM positions.)

Instead of sorting, we now look for the correct insertion point when
adding new style sheets, and we start the search from the end, which is
where style sheets are typically added in the vast majority of cases.

This removes a 600ms time sink when loading Amazon on my machine! :^)
2023-03-30 14:12:07 +02:00
Andreas Kling
d4b2544dc5 LibWeb: Make the Node.compareDocumentPosition() return value enum public
This will allow other parts of LibWeb to understand these values.
2023-03-30 14:12:07 +02:00
Andreas Kling
a925c2dcf2 LibWeb: Remove redundant invocation of children changed in HTMLParser
Setting the `data` of a text node already triggers `children changed`
per spec, so there's no need for an explicit call.

This avoids parsing every HTMLStyleElement sheet twice. :^)
2023-03-30 11:10:02 +02:00
Tim Schumacher
8ff36e5910 LibCompress: Implement proper handling of LZMA end-of-stream markers 2023-03-30 08:45:35 +02:00
Tim Schumacher
b6f3b2f116 LibCompress: Move common LZMA end-of-file checks into helper functions 2023-03-30 08:45:35 +02:00
Andreas Kling
e77552519e LibWeb: Implement CRC2D.imageSmoothingEnabled
We now select between nearest neighbor and bilinear filtering when
scaling images in CRC2D.drawImage().

This patch also adds CRC2D.imageSmoothingQuality but it's ignored for
now as we don't have a bunch of different quality levels to map it to.

Work towards #17993 (Ruffle Flash Player)
2023-03-29 22:48:04 +02:00
Andreas Kling
e4b71495f5 LibWeb: Resolve percentage vertical-align values against line-height
...instead of not resolving them at all. :^)
2023-03-29 18:38:29 +02:00
Timothy Flynn
7447a91d7e LibCompress: Decode non-self-referencing back-references in one shot
We currently decode back-references one byte at a time, while writing
that byte back out to the output buffer. This is only necessary when the
back-reference refers to itself, i.e. when the back-reference distance
is less than its length. In other cases, we can read the entire back-
reference block in one shot.

Using the "enwik8" file as a test (100MB uncompressed, commonly used in
benchmarks: https://www.mattmahoney.net/dc/enwik8.zip), decompression
time decreases from:

    5.8s to 4.89s on Serenity (cold)
    2.3s to 1.72s on Serenity (warm)
    1.6s to 1.06s on Linux
2023-03-29 13:22:11 +01:00
Timothy Flynn
13bc999173 gunzip: Use a buffered file to read from the input file 2023-03-29 07:19:14 +02:00
Timothy Flynn
5aaefe4e62 LibCompress: Use prefix tables to decode Huffman codes up to 8 bits long
Huffman codes have a useful property in that they are prefix codes. That
is, a set of bits representing a Huffman-coded symbol is never a prefix
of another symbol. This allows us to create a table, where each index in
the table are integers whose prefix is the entry's corresponding Huffman
code.

With Deflate, we can have codes up to 16 bits in length, thus creating a
prefix table with 2^16 entries. So instead of creating a table fit all
possible codes, we use a cutoff of 8-bit codes. Codes larger than 8 bits
fall back to the binary search method.

Using the "enwik8" file as a test (100MB uncompressed, commonly used in
benchmarks: https://www.mattmahoney.net/dc/enwik8.zip), decompression
time decreases from 3.527s to 2.585s on Linux.
2023-03-29 07:19:14 +02:00
Timothy Flynn
20aaab47f9 LibCompress: Use a bit stream for the entire GZIP decompression process
We currently mix normal and bit streams during GZIP decompression, where
the latter is a wrapper around the former. This isn't causing issues now
as the underlying bit stream buffer is a byte, so the normal stream can
pick up where the bit stream left off.

In order to increase the size of that buffer though, the normal stream
will not be able to assume it can resume reading after the bit stream.
The buffer can easily contain more bits than it was meant to read, so
when the normal stream resumes, there may be N bits leftover in the bit
stream that the normal stream was meant to read.

To avoid weird behavior when mixing streams, this changes the GZIP
decompressor to always read from a bit stream.
2023-03-29 07:19:14 +02:00
MacDue
b7f9b316ed Browser: Add reset zoom level button to toolbar
This button shows the current zoom level and when clicked resets
the zoom back to 100%. It is only displayed for zoom levels other
than 100%.
2023-03-29 07:17:35 +02:00
Ali Mohammad Pur
64da05a96d LibWeb+LibWasm: Implement and use the "reset the Memory buffer" steps
This implements the memory object cache and its "reset on grow"
semantics, as the web depends on the exact behaviour.
2023-03-29 07:16:37 +02:00
Luke Wilde
14fb6372c3 LibWeb: Parse Element.style url functions relative to the document
Previously we used a parsing context with no access to the document, so
any URLs in url() functions would become invalid.

Fixes the images on Steam's store carousel, which sets
Element.style.backgroundImage to url() functions.
2023-03-29 07:10:53 +02:00
Andreas Kling
264b9b73ac LibGfx/OpenType: Ignore glyphs with bogus offsets
Some fonts (like the Bootstrap Icons webfont) have bogus glyph offsets
in the `loca` table that point past the end of the `glyf` table.

AFAICT other rasterizers simply ignore these glyphs and treat them as if
they were missing. So let's do the same.

This makes https://changelog.serenityos.org/ actually work! :^)
2023-03-29 07:06:13 +02:00
Tim Schumacher
d01ac59b82 Shell: Skip rc files when not running interactively
This makes debugging a bit nicer.
2023-03-29 03:39:09 +03:30
Tim Schumacher
9a6b5a53a7 Shell: Correctly mark the end line of a parsed list 2023-03-29 03:39:09 +03:30
Tim Schumacher
46c22ee49d Shell: Allow appending empty string literals
Otherwise, we just silently drop arguments that are empty strings.
2023-03-29 03:39:09 +03:30
Tim Schumacher
c26639eac2 Shell: Properly skip POSIX Fi tokens 2023-03-29 03:39:09 +03:30
Tim Schumacher
b1739029ef Shell: Evaluate the program name before parsing arguments
Otherwise, we are too late to catch the "load the POSIX-compatible
shellrc" branch.
2023-03-29 03:39:09 +03:30
Andreas Kling
c0a7a61288 LibWeb: Clamp fit-content widths in flex layout to min/max-width
In situations where we need a width to calculate the intrinsic height of
a flex item, we use the fit-content width as a stand-in. However, we
also need to clamp it to any min-width and max-width properties present.
2023-03-28 21:08:54 +02:00
Julian Offenhäuser
5ccb240945 LibGfx: Don't render OpenType glyphs that have no outline
The spec tells us that for glyph offsets in the "loca" table, if an
offset appears twice in a row, the index of the first one refers to a
glyph without an outline (such as the space character). We didn't check
for this, which would cause us to render a glyph outline where there
should have been nothing.
2023-03-28 18:17:17 +02:00
Srikavin Ramkumar
4a82f9bd03 LibWeb: Allow attachshadow for elements with valid custom element names 2023-03-28 07:18:09 -04:00
Srikavin Ramkumar
47a466865c LibWeb: Return HTMLElement for valid custom element tag names 2023-03-28 07:18:09 -04:00
Srikavin Ramkumar
f2dd878fe7 LibWeb: Implement custom element name validation 2023-03-28 07:18:09 -04:00
Srikavin Ramkumar
149e442c24 LibWeb: Iterate codepoints instead of characters in is_valid_name 2023-03-28 07:18:09 -04:00
Andrew Kaster
4a70fa052f LibWeb: Declare defaulted style value comparision operators inline
Some versions of clang, such as Apple clang-1400.0.29.202 error out on
the previous out of line operators. Explicitly defaulting comparison
operators out of line is allowed per P2085R0, but was checked in clang
before version 15 in C++20 mode.
2023-03-28 09:18:50 +01:00
Andrew Kaster
afb3a4a030 LibSQL: Block signals while forking SQLServer in Lagom
When debugging in Xcode, the waitpid() for the initial forked process
would always return EINTR or ECHILD. Work around this by blocking all
signals until we're ready to wait for the initial child.
2023-03-28 09:18:50 +01:00
Andreas Kling
af118abdf0 LibWeb: Use fit-content width in place of indefinite flex item widths
In `flex-direction: column` layouts, a flex item's intrinsic height may
depend on its width, but the width is calculated *after* the intrinsic
height is required.

Unfortunately, the specification doesn't tell us exactly what to do here
(missing inputs to intrinsic sizing is a common problem) so we take the
solution that flexbox applies in 9.2.3.C and apply it to all intrinsic
height calculations within FlexFormattingContext: if the used width of
an item is not yet known when its intrinsic height is requested, we
substitute the fit-content width instead.

Note that while this is technically ad-hoc, it's basically extrapolating
the spec's suggestion in one specific case and using it in all cases.
2023-03-27 23:28:07 +02:00
Andreas Kling
ca290b27ea LibWeb: Make box content sizes indefinite before intrinsic sizing
When calculating the intrinsic width of a box, we now make its content
width & height indefinite before entering the intrinsic sizing layout.
This ensures that any geometry assigned to the box by its parent
formatting context is ignored.

For intrinsic heights, we only make the content height indefinite.
This is because used content width is a valid (but optional) input
to intrinsic height calculation.
2023-03-27 23:28:07 +02:00
Andreas Kling
7639eccd53 LibWeb: Add default equality operators to Available{Space,Size}
I find myself adding these over and over again while testing.
Let's just have them always there.
2023-03-27 23:28:07 +02:00
Andreas Kling
3b76cc5245 LibWeb: Pass available inner space to inline-level SVG layout 2023-03-27 23:28:07 +02:00
Andreas Kling
4f752ca791 LibWeb: Pass available inner space to BFC root auto height calculation 2023-03-27 23:28:07 +02:00
Aliaksandr Kalenik
1ee99017e2 LibWeb: Fix intrinsic sizing early return condition in TFC
Early return before running full TFC algorithm is only possible when
just table width need to be calculated.
2023-03-27 23:10:16 +02:00
Sam Atkins
97b3f1230b WebServer: Propagate more errors
Use try_append() instead of append().
2023-03-27 20:29:51 +01:00
Sam Atkins
8dd0038f47 LibCore: Add DateTime::to_string()
This is just the contents of to_deprecated_string() with errors
propagated. to_deprecated_string() is now implemented using to_string().
2023-03-27 20:29:51 +01:00
Sam Atkins
7dfe1f9f8f WebServer: Use relative URLs for the directory listing
This fixes an issue found on Linus's hosted WebServer. Now, if WebServer
is hosted at a non-root URL. (eg, `example.com/webserver` instead of
`example.com`) the links will correctly go to
`example.com/webserver/foo` instead of `example.com/foo`.
2023-03-27 20:29:51 +01:00
Sam Atkins
cce5e3158f WebServer: Handle incomplete HTTP requests
Mostly by copying the code in LibWeb/WebDriver/Client.cpp
2023-03-27 20:29:51 +01:00
Sam Atkins
ba30f298f9 LibWeb: Stop returning the left padding for resolved padding-bottom
I accidentally broke this 8 months ago and nobody noticed. 😅
2023-03-27 14:27:09 +01:00
Fabian Dellwing
ee0ae18386 LibTLS: Check if certificate is self signed before importing it as CA 2023-03-27 15:34:28 +03:30
Fabian Dellwing
114a383af3 LibTLS: Add self signage information to our parsed certificates 2023-03-27 15:34:28 +03:30
Kemal Zebari
c5542ea2c9 Browser: Remove unused variables in BookmarksBarWidget 2023-03-27 10:39:17 +01:00
MacDue
039d5edc6f Browser: Show current zoom level in view menu 2023-03-26 21:55:21 +01:00
MacDue
a2d333ff4a LibGUI: Allow updating the names of menus and submenus 2023-03-26 21:55:21 +01:00
MacDue
cf730403ea WindowServer: Allow updating the name of a menu 2023-03-26 21:55:21 +01:00
MacDue
952f6bbb2a WindowServer: Rename menu_title to name in IPC API
This is referred to as the name everywhere else, so we should be
consistent here.
2023-03-26 21:55:21 +01:00
MacDue
b22052c0dd LibWebView: Expose getter for current zoom level 2023-03-26 21:55:21 +01:00
MacDue
17d23590bf LibWeb: Check for empty name in is_in_same_radio_button_group()
I missed this check in #18046 (though it was covered in one case
by an optimization).
2023-03-26 21:55:21 +01:00
Andreas Kling
32653f34f9 LibWeb: Don't force relayout whole page on programmatic scroll
When scrolling the page, we may need to flush any pending layout
changes. This is required because otherwise, we don't know if the target
scroll position is valid.

However, we don't need to *force* a layout. If the layout tree is
already up-to-date, we can use it as-is.

Also, if we're scrolling to (0, 0), we don't need to update the layout
at all, since (0, 0) is always a guaranteed valid scroll position.
2023-03-26 21:46:22 +01:00
Aliaksandr Kalenik
05a2d1f0e0 LibWeb/WebDriver: Wait for more data to arrive if request is incomplete
Currently significant portion of requests coming to WebDriver server
fails with error while parsing json body because requests are parsed
when they are not complete yet.

This change solves this by waiting for more data to arrive if HTTP
request parser found that there is not enough data yet to parse
the whole request.

In the future we would probably want to move this logic to LibHTTP
because this problem is relevant for any HTTP server.
2023-03-26 17:56:17 +02:00
Aliaksandr Kalenik
7b8a857e30 LibHTTP: Return error if request is incomplete
If there is not enough input to completely parse HTTP request we need
to return error and handle it in HTTP server.
2023-03-26 17:56:17 +02:00
Aliaksandr Kalenik
9220cdc285 LibHTTP+WebDriver+WebServer: Return error from HTTP request parser 2023-03-26 17:56:17 +02:00
Aliaksandr Kalenik
5b31d1208f LibWeb: Run XML parser input through encoding decoder
Fixes the issue that XML parser fails when loader passes input that is
prefixed with byte order mark.

Also it generally makes sense to pass text source through encoding
decoder before parsing. Probably we would even want to introduce method
similar to `create_with_uncertain_encoding` in `HTMLParser` but for
`XMLParser` to be make harder unconsciously pass non-UTF8 input to XML
parser.
2023-03-26 15:48:45 +01:00
Timothy Flynn
b3d033f027 LibWeb: Declare overflow_value_makes_box_a_scroll_container as static
It is only used in this file, and not being declared static gives a "no
previous declaration" error.
2023-03-26 10:38:05 -04:00
Cameron Youell
f251ff0521 LibWeb: Fix non return in overflow value check 2023-03-26 15:03:43 +01: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
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
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
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
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
Sam Atkins
1d948f7462 LibWeb: Split UnresolvedStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
87b7efa109 LibWeb: Split TimeStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
cd06b1341b LibWeb: Split TransformationStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
66cb7edffb LibWeb: Split TextDecorationStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
9b834058ee LibWeb: Split StringStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
08fa513887 LibWeb: Split ShadowStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
6cedf5e05b LibWeb: Split ResolutionStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
b1ccd30b02 LibWeb: Split PositionStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
4b711932cc LibWeb: Split PercentageStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
f98634586e LibWeb: Split OverflowStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
7f6add1c6e LibWeb: Split NumericStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
fba2dacc7a LibWeb: Split ListStyleStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
9a84151169 LibWeb: Split LengthStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
1591352531 LibWeb: Split InitialStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
44c9a5b648 LibWeb: Split InheritStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
e61a5ad180 LibWeb: Split AbstractImageStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
0f04fa2e6e LibWeb: Split RadialGradientStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
c8ffd82cb7 LibWeb: Split LinearGradientStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
f30b042890 LibWeb: Split ConicGradientStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
35b240c87d LibWeb: Split ImageStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
76de017a51 LibWeb: Split IdentifierStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
d39788556a LibWeb: Split GridTrackSizeStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
486ef3df7f LibWeb: Split GridTrackPlacementStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
402845fe00 LibWeb: Split GridTrackPlacementShorthandStyleValue out of StyleValue 2023-03-25 16:56:04 +00:00
Sam Atkins
675cb3b9da LibWeb: Split GridAreaShorthandStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
4dc99e49a1 LibWeb: Split GridTemplateAreaStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
015885f068 LibWeb: Split FrequencyStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
87f920a299 LibWeb: Split FontStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
e24679f870 LibWeb: Split FlexFlowStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
273b9b4ca1 LibWeb: Split FlexStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
89ed8e59f9 LibWeb: Split FilterValueListStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
9436b7de83 LibWeb: Split ContentStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
77b2826402 LibWeb: Split ColorStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
66bc816284 LibWeb: Split BorderRadiusStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
25114c159d LibWeb: Split BorderRadiusShorthandStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
1c03bc7a6f LibWeb: Split BorderStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
9d5296889f LibWeb: Split BackgroundSizeStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
52cd0b2f47 LibWeb: Split BackgroundRepeatStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
92a0d4c0af LibWeb: Split BackgroundStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Sam Atkins
777d3e73f9 LibWeb: Split AngleStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Ali Mohammad Pur
6fc9f5fa28 LibRegex: Make ^ and $ accept all LineTerminators instead of just '\n'
Also adds a couple tests.
2023-03-25 15:44:05 +01:00
MacDue
cd7459d608 LibCore: Get the environment in Core::Process::spawn() on macOS
This is copied over from ladybird, but putting it here makes this
more reusable.
2023-03-24 22:06:38 +00:00
MacDue
3feddbf9da Run: Use Core::Process::spawn() to launch commands 2023-03-24 22:06:38 +00:00
MacDue
43529ea25e Taskbar: Use Process::spawn_or_show_error() for shutdown actions 2023-03-24 22:06:38 +00:00
MacDue
e46b9c189e Taskbar: Use Process::spawn_or_show_error() to open the "Run" dialog 2023-03-24 22:06:38 +00:00
MacDue
c9043280ec Taskbar: Use GUI::Process::spawn_or_show_error() to launch apps
And while here make a partial fix for launching terminal apps that
require root and contain spaces in their name/path.
2023-03-24 22:06:38 +00:00
MacDue
0af3e37f5d KeyboardPreferenceLoader: Use Core::Process::spawn() to set keymap 2023-03-24 22:06:38 +00:00
MacDue
ceffca9a75 WebDriver: Use Core::Process::spawn() to launch browsers 2023-03-24 22:06:38 +00:00
MacDue
2aa8c9950e FileManager: Use GUI::Process::spawn_or_show_error() to open terminals 2023-03-24 22:06:38 +00:00
MacDue
d27a513dc5 LibCore: Add KeepAsChild option to Core::Process::spawn()
This now allows spawning a process without disowning.
2023-03-24 22:06:38 +00:00
MacDue
b3edd83e0a LibGUI: Allow passing working directory to spawn_or_show_error() 2023-03-24 22:06:38 +00:00
MacDue
62e8360dcf LibCore: Fix memory leak in Core::Process::spawn()
Previously the spawn_actions were not destroyed, which leaked a
little memory.
2023-03-24 22:06:38 +00:00
Andreas Kling
aeb8224ec8 LibCompress: Speed up deflate decompression by ~11%
...simply by using LittleEndianInputBitStream::read_bit() instead of
read_bits(1). This puts us on the fast path for single-bit reads.

There's still lots of money on the table for bigger optimizations to
claim here, just picking an embarrassingly low-hanging fruit. :^)
2023-03-24 17:08:35 +01:00
Jelle Raaijmakers
ea9707ec29 LibCrypto: Update entire blocks in SHA*::update()
Instead of going byte by byte, copy entire blocks at once and only check
if we need to update the state once per block. This pretty much
eliminates `::update()` from profiles and measurably improves
performance for utilities like `sha256sum`.
2023-03-24 15:28:10 +00:00
Jelle Raaijmakers
88b0b80aab LibCrypto: Stop shadowing i variable 2023-03-24 15:28:10 +00:00
Cameron Youell
c048cf2004 Libraries: Convert DeprecatedFile usages to LibFileSystem 2023-03-24 10:58:43 +00:00
Cameron Youell
1dc3ba6ed5 Applications: Convert DeprecatedFile usages to LibFileSystem 2023-03-24 10:58:43 +00:00
MacDue
dd77b878b3 LibWeb: Add scalable radio buttons (with theme/accent-color support)
These are similar to the checkboxes now (though no SDFs here all just
plain AA painter).
2023-03-24 09:57:48 +00:00
MacDue
56bc653e72 LibWeb: Move checkbox color palette computation to helper header
This will allow these to be more easily reused for other inputs.

Note that we need this as the base LibGfx pallet does not quite have
the required range for HTML inputs (though these shades are based off
the LibGfx palette).
2023-03-24 09:57:48 +00:00
MacDue
98040c508f LibGfx: Handle signed distance field edges better
Small change to treat pixels outside the signed distance field bitmap
as outside the shape.
2023-03-24 09:57:48 +00:00
Lucas CHOLLET
fcaa535dec LibGfx/PortableFormat: Use static_cast instead of C-style casts 2023-03-24 10:56:58 +01:00
Lucas CHOLLET
fd04b2dc9b LibGfx/PortableFormat: Propagate errors from decode() 2023-03-24 10:56:58 +01:00
Lucas CHOLLET
7ec310384a LibGfx/PortableFormat: Propagate errors from read_image_data() 2023-03-24 10:56:58 +01:00
Lucas CHOLLET
2356b48f13 LibGfx/PortableFormat: Propagate errors from read_magic_number() 2023-03-24 10:56:58 +01:00
Lucas CHOLLET
f96b61fdd8 LibGfx: Remove unused class Streamer 2023-03-24 10:56:58 +01:00
Lucas CHOLLET
7cafd7d177 LibGfx/PortableFormat: Port to Stream
Each one of `[PBM, PGM, PPM]Loader` used yet another stream-like relic.
This patch ports all of them to `AK::Stream`.
2023-03-24 10:56:58 +01:00
Lucas CHOLLET
b9574c180e LibGfx/PortableFormat: Use finite loops in read_image_data
The `read_image_data` function of each one of[PBM, PGM, PPM]Loader use
the same structure to read an image. This patch harmonizes the three
functions and use finite loops instead of reading until EOF. It allows
to quit early on bloated file, but it's mainly done for refactoring
purpose.
2023-03-24 10:56:58 +01:00
Lucas CHOLLET
24087ef6eb LibGfx: Return true from PortableImageDecoderPlugin::initialize()
Reading the two magic bytes are always done in `decode()` by calling
`read_magic_number()`. So no need to read it twice.
2023-03-24 10:56:58 +01:00
Lucas CHOLLET
4554d10fe5 LibGfx: Remove unused functions load_from_memory and load_impl 2023-03-24 10:56:58 +01:00
Lucas CHOLLET
05e6ed6ecb LibGfx/PortableFormat: Propagate errors from some read_* functions
These functions are:
 - read_width
 - read_height
 - read_max_val
2023-03-24 10:56:58 +01:00
Lucas CHOLLET
bab2113ec1 LibGfx/PortableFormat: Make read_whitespace return an ErrorOr 2023-03-24 10:56:58 +01:00
Lucas CHOLLET
74f893e9f4 LibGfx/PortableFormat: Make read_comment return an ErrorOr 2023-03-24 10:56:58 +01:00
Lucas CHOLLET
964172754e LibGfx/PortableFormat: Don't accept comments that don't start with # 2023-03-24 10:56:58 +01:00
Lucas CHOLLET
9052a6febf LibGfx/PortableFormat: Simplify read_number signature
The function signature goes from:
`bool read_number(Streamer& streamer, TValue* value)`
to
`ErrorOr<u16> read_number(Streamer& streamer)`

It allows us to, on one hand use `ErrorOr` for error propagation,
removing an out parameter in the meantime, and on the other hand remove
the useless template.
2023-03-24 10:56:58 +01:00