Commit graph

58035 commits

Author SHA1 Message Date
Andrew Kaster 23600fd76e BindingsGenerator: Qualify calls to WebIDL::convert_to_int
And make sure that the header for AbstractOperations is included in all
the implementation files that call AOs from it.
2024-01-12 09:11:18 +01:00
Nico Weber cfd05b1a55 LibPDF: Use MatrixMatrixConversion when possible
Reduces time spent rendering page 3 of 0000849.pdf from 1.32s to 1.13s
on my machine.

Also reduces the time to run Meta/test_pdf.py on 0000.zip
(without 0000849.pdf) from 56s to 54s.
2024-01-12 09:09:56 +01:00
Nico Weber c161b2d2f9 LibPDF: Extract ICCBasedColorSpace::sRGB() helper 2024-01-12 09:09:56 +01:00
Nico Weber 4704e6aa5f LibGfx/ICC: Refactor matrix/matrix conversion code a bit
No behavior change; the goal is to make it usable by LibPDF too.
2024-01-12 09:09:56 +01:00
Nico Weber 2fc6ec0f46 LibGfx/ICC: Fastpath for matrix->matrix image conversions
Doesn't help with PDF at all since that doesn't call convert_image()
(-‸ლ)
2024-01-12 09:09:56 +01:00
Tim Ledbetter 7772637d03 SystemMonitor: Condense process statistics displayed in processes tab
Previously, some non-default process statistics were displayed in a
long human readable format in the processes tab, which could negatively
affect readability. A shorter format is now used in the processes tab,
while the process properties window retains the longer format.
2024-01-12 09:07:51 +01:00
Hugh Davenport c566ef2a9d PartitionEditor: Show better error when can't find partition table 2024-01-11 20:57:40 +00:00
Hugh Davenport 91cdda7763 Calculator: Allow system shortcuts
Before the key events for shortcuts such as ALT-F4 did not work as the
widget was swallowing up the shortcut. This changes ignores the event
if nothing else matched
2024-01-11 19:00:46 +00:00
Sam Atkins 340936ad09 Base: Document NumericInput properties
I forgot to do this when I added them.
2024-01-11 11:36:27 +00:00
Ali Mohammad Pur e265d81277 LibRegex: Correct And/Or and inversion interplay semantics
This commit also fixes an incorrect test case from very early on, our
behaviour now matches the ECMA262 spec in this case.

Fixes #21786.
2024-01-11 11:36:09 +01:00
Nico Weber 89315787ae LibGfx/ICC: Cache presence of various tags
Reduces time spent rendering page 3 of 0000849.pdf from 1.45s to 1.32s
on my machine.

Also reduces the time to run Meta/test_pdf.py on 0000.zip
(without 0000849.pdf) from 58s to 55s.
2024-01-11 08:15:22 +00:00
Nico Weber 3365a92ead LibGfx/ICC: Cache inverted matrix on profile
Reduces time spent rendering page 3 of 0000849.pdf from 1.85s to 1.45s
on my machine.

As determined by running

    time Build/lagom/bin/pdf --page 3 --render out.png \
        ~/Downloads/0000/0000849.pdf

a few times and eyeballing the min time.

Also reduces the time to run Meta/test_pdf.py on 0000.zip
(without 0000849.pdf) from 1m7s to 58s.
2024-01-11 08:15:22 +00:00
Nico Weber 19d434b229 LibGfx/ICC: Extract matrix computation functions
No behavior (or perf) change.
2024-01-11 08:15:22 +00:00
Nico Weber 5c5a24c6b7 LibGfx/ICC: Move some Profile member vars up a bit
...so that they're not below a FIXME that doesn't apply to them.

No behavior change.
2024-01-11 08:15:22 +00:00
Nico Weber 7d796c83f1 image: Fix flag names and grammar in diagnostic texts 2024-01-11 08:00:27 +00:00
ronak69 52340dc78a Mandelbrot: Allow panning with the arrow keys 2024-01-11 08:02:23 +01:00
ronak69 0f33d2a36d Mandelbrot: Only calculate the set in paint event
The set should be calculated only when there is a paint event to keep
the number of times the set is calculated (which is compute expensive)
to the minimum.
2024-01-11 08:02:23 +01:00
ronak69 fa026df892 Mandelbrot: Use renormalized fractional iteration count to smooth colors 2024-01-11 08:02:23 +01:00
Aliaksandr Kalenik 225ed58f7e LibWeb/CSS: Resolve NumericCalculationNode to percentage when requested
When the caller of NumericCalculationNode::resolve() does not provide
a percentage_basis, it expects the method to return a raw percentage
value.

Fixes crashing on https://discord.com/login
2024-01-11 08:01:47 +01:00
Nicolas Ramz 1593ff2d4c LibGfx/ILBMLoader: Don't throw too early when decoding bitplanes
We were (again) throwing even though the image could be decoded.
2024-01-10 23:41:15 +01:00
Ali Mohammad Pur 25eb903a8f LibProtocol: Don't assume request creation will succeed across IPC
Allow it to fail, and return null if it does.
Fixes frequent crashes in unfavourable network conditions.
2024-01-10 23:37:57 +01:00
Lucas CHOLLET f6b86096a5 LibGfx/TIFF: Prevent the CCITT decoder to run on non bilevel image 2024-01-10 23:34:44 +01:00
Lucas CHOLLET 0ef449a588 LibGfx/TIFF: Don't crash on invalid indices inside RGBPalette images
We were previously accessing a Vector's element using a user-provided
value as index input.
2024-01-10 23:34:44 +01:00
Lucas CHOLLET 58bdca96cd LibGfx/TIFF: Use a wider type for palette indices to prevent overflow
We refuse any image with a sample depth greater than 32, storing these
value as `u64` prevent any overflows. This is probably overkill as no
one in their right mind will use a 32 bits color table.
2024-01-10 23:34:44 +01:00
Lucas CHOLLET 4d1c99e414 LibGfx/TIFF: Don't crash on RGBPalette images without a ColorMap 2024-01-10 23:34:44 +01:00
Lucas CHOLLET 25c3f8cd8e LibGfx/TIFF: Prefer a verbal form over a noun 2024-01-10 23:34:44 +01:00
Tim Ledbetter 800cb4eceb SystemMonitor: Don't include the Idle Task in process statistics
The Idle Task is no longer displayed in the Processes tab and is not
included in the process count in the status bar.
2024-01-10 23:28:10 +01:00
Tim Ledbetter 1c1fc67f75 SystemMonitor: Prefer range-based for loop when updating ProcessModel 2024-01-10 23:28:10 +01:00
Shannon Booth faccca7b32 LibWeb: Add ref-tests for 3-value background positions with center 2024-01-10 23:27:28 +01:00
Shannon Booth d95461ebe1 LibWeb: Allow 'center' in 3-value background-positions
The grammar which we implemented did not match the spec, resulting in us
rejecting background positions which contained 'center' position
keywords.

Fixes: #22401
2024-01-10 23:27:28 +01:00
Nico Weber f7fc2df8ac LibPDF: Simplify load_image() a tiny bit
Images can't use Pattern color spaces, so we'll always have a Color.

No behavior (or perf) change.
2024-01-10 23:26:57 +01:00
Timothy Flynn 00510e40d9 LibWeb: Convert the cookie test page to a text test 2024-01-10 23:26:40 +01:00
Timothy Flynn 0989a81a48 headless-browser: Add support for cookies with SQLServer
This will allow us to test cookies and the database during CI.
2024-01-10 23:26:40 +01:00
Timothy Flynn a4f862a869 WebContent: Change the cookie setting IPC to be synchronous
Considering an operation like the following:

    document.cookie = "cookie=value";
    const value = document.cookie;

If the IPC for the cookie setter is asynchronous, the getter can execute
while the browser/SQLServer processes are still handling the setter.
This is often seen when hammering the document with cookie requests.
2024-01-10 23:26:40 +01:00
Timothy Flynn 5c5cbeb491 LibSQL+LibWebView: Do not manually serialize time stamps in CookieJar
LibSQL supports serializing time stamps as of commit
effcd080ca.

However, that commit serializes the timestamps as milliseconds, whereas
the CookieJar was serializing them as seconds. In retrospect, these
should have been updated in unison, along with the SQL heap version (as
this is a serialization change that affects the file format). So this
patch also updates the version, as this is not a backwards compatible
change.
2024-01-10 23:26:40 +01:00
Timothy Flynn 7a912ca891 LibSQL: Reset the highest written block during the zeroth block init
Otherwise, when changing the SQL heap version, the value from the now-
stale heap file will continue to be used.
2024-01-10 23:26:40 +01:00
Timothy Flynn cd0e07f6a4 LibSQL: Add a helper to convert a SQL::Value to a UnixDateTime
Support for constructing a Value from a UnixDateTime was added in commit
effcd080ca.

That constructor just stores the value as the number of milliseconds
since epoch. There's no way for outside users to know this, so this adds
a helper to retrieve the value as a UnixDateTime and let SQL::Value be
the source of truth for how the value is encoded/decoded.
2024-01-10 23:26:40 +01:00
Timothy Flynn 1205d39fc3 LibSQL+SQLServer: Inform SQLServer when the client has processed results
The architecture of SQLServer is currently such that it sends results
over IPC one row at a time. After the rows are exhausted, it sends a
completion IPC. However, it does not wait for the client to finish
processing a row before sending another row or the completion signal.

This can result in clients hanging if the completion comes in while a
row is being processed. At least in the case of WebView::Database, the
result is that the completion signal is dropped, and the browser then
hangs forever waiting for that signal (after it finishes processing the
row).

This patch makes SQLServer asynchronously wait for the client to tell it
that the row has been processed and the next row (or completion) may be
sent. We repurpose the `m_ongoing_executions` in SQLStatement for this
purpose (this member was oddly being written to, but otherwise unused).
2024-01-10 23:26:40 +01:00
Nico Weber df5451a889 LibPDF: Mark text rendering matrix dirty after changing it in text_begin
A certain PDF was drawing some text used `9 0 0 9 474.54 700.6801 Tm`
to set the text matrix to a matrix that scaled by 9 in one text object.

Then, after ending that text object, it had the following new text
object which contained nothing that invalidated the text matrix:

```
BT
/F1 7 Tf
/DeviceRGB CS
0 0 0 SC
10 TL
86.37849 21.908 Td
(Authorized licensed use limited to: ...) Tj
ET
```

`BT` did reset it as required, but since we didn't mark the matrix
as dirty, we never recomputed it and drew the additional text scaled
up 9x.
2024-01-10 19:42:08 +01:00
Andreas Kling 5af02a914c LibWeb: Let parent formatting context determine size of flex containers
Until now, we had implemented flex container sizing by awkwardly doing
exactly what the spec said (basically having FFC size the container)
despite that not really making sense in the big picture. (Parent
formatting contexts should be responsible for sizing and placing their
children)

This patch moves us away from the Flexbox spec text a little bit, by
removing the logic for sizing the flex container in FFC, and instead
making sure that all formatting contexts can set both width and height
of flex container children.

This required changes in BFC and IFC, but it's actually quite simple!
Width was already not a problem, and it turns out height isn't either,
since the automatic height of a flex container is max-content.
With this in mind, we can simply determine the height of flex containers
before transferring control to FFC, and everything flows nicely.

With this change, we can remove all the virtuals and FFC logic for
negotiating container size with the parent formatting context.
We also don't need the "available space for flex container" stuff
anymore either, so that's gone as well.

There are some minor diffs in layout test results from this, but the
new results actually match other browsers more closely, so that's fine.

This should make flex layout, and indeed layout in general, easier to
understand, since this was the main weird special case outside of
BFC/IFC where a formatting context delegates work to its parent instead
of the other way around. :^)
2024-01-10 16:28:12 +01:00
Sam Atkins 5f0230a57e LibGUI: Make NumericInput work well in GML
- Register the widget
- Register property getters and setters
- Rename getters and setters to match the property names, as required by
  the GML compiler. The names min/max/value are chosen to match SpinBox.
- Prevent a crash when the minimum is less than the maximum (which can
  happen while editing the GML).
2024-01-10 13:13:27 +00:00
Sam Atkins da349607a3 LibGUI: Make NumericInput respond to the mouse wheel
Scroll the mouse wheel over a NumericInput to quickly change the value.
This matches the SpinBox behavior.
2024-01-10 13:13:27 +00:00
Sam Atkins 4b96136803 LibGUI: Store NumericInput value as an i64
Moar range = moar better. I'm hoping to use this for a size_t value
later, so this almost covers that.
2024-01-10 13:13:27 +00:00
Sam Atkins ea31c11aff LibGUI+PDFViewer: Move NumericInput into LibGUI
A text box that is restricted to numbers within a range, is generally
useful. Let's make it available for use!
2024-01-10 13:13:27 +00:00
Nico Weber 4fd5d450be LibPDF: Add support for image masks
An image mask is a 1-bit-per-pixel bitmap that's black where the
current color should be painted, and white where it should be
transparent (think: like ink).

load_image() already converts images like this into 8-bit-per-pixel
images that have 0xff, 0xff, 0xff in rgb for opaque (originally 0 bit)
pixels and 0, 0, 0 in rgb for transparent pixels.

So we just move copy the image mask's image data into the alpha
channel and replace rgb with the current color, and then draw
it like a regular bitmap.
2024-01-10 09:10:11 +00:00
Bastiaan van der Plaat 675b242e84 LibWeb: Add missing CSS Transforms Module Level 2 functions 2024-01-10 09:48:25 +01:00
Bastiaan van der Plaat c443f80137 LibWeb: Allow percentages on CSS transform scale functions 2024-01-10 09:48:25 +01:00
Ali Mohammad Pur 57ea3e160a LibCompress: Use a __FILE__-relative path for the brotli dictionary file
This makes it so the generated assembly doesn't depend on
compile-specific search paths, also making it possible to build with
LTO.
2024-01-10 09:40:51 +01:00
Ali Mohammad Pur cd4ebc45a0 RequestServer: Avoid multiple connections to incompatible servers
This really only implements a heuristic, assuming that HTTP/1.0 servers
cannot handle having multiple active connections; this assumption has
lots of false positives, but ultimately HTTP/1.0 is an out-of-date HTTP
version and people using it should just switch to a newer standard
anyway.

Specifically, python's "SimpleHTTPRequestHandler" utilises a
single-threaded HTTP/1.0 server, which means no keepalive and more
importantly, hangs and races with more than a single connection present.
This commit makes it so we serialise all requests to servers that are
known to serve only a single request per connection (aka HTTP/1.0 with
our setup, as we unconditionally request keepalive)
2024-01-10 09:39:51 +01:00
Nico Weber e770cf06b0 LibPDF: Send jpeg data down the same path as all other data
JPEG images now honor decode arrays and color spaces.
2024-01-10 09:39:00 +01:00