Commit Graph

27445 Commits

Author SHA1 Message Date
kleines Filmröllchen
8ec9b26bba Help: Use new GML code generator 2023-08-11 21:33:48 +02:00
kleines Filmröllchen
d1645efde9 Meta+Userland: Allow generating C++ initializer code from GML
This does the exact same thing as the runtime initializer,
except it is faster and can catch some errors much earlier.

The code generator includes these important features:
- Automatic include generation where necessary
- Special-casing for TabWidget and ScrollableContainerWidget
- No use of DeprecatedString where possible
2023-08-11 21:33:48 +02:00
kleines Filmröllchen
1e67435ff5 Meta: Rename compile_gml to stringify_gml
This is what this function really does, it doesn't compile anything.
2023-08-11 21:33:48 +02:00
kleines Filmröllchen
e2dbce8fd7 LibGUI: Allow generating C++ "constructor" code for UIDimension
This will be used in the proper GML generator to initialize UI dimension
properties.
2023-08-11 21:33:48 +02:00
kleines Filmröllchen
d385adf6bd LibGUI: Don't silently create a 0 UIDimension when the JSON is invalid
The function already can report an invalid JSON value for the dimension,
so let's actually use that for when the number is too large or some
other invalid JSON type, like an object or a boolean, was passed.
2023-08-11 21:33:48 +02:00
kleines Filmröllchen
ea0ab87b88 LibGUI: Allow creating margins from arrays
This is necessary for upcoming GML -> C++ compilation.
2023-08-11 21:33:48 +02:00
Aliaksandr Kalenik
9101c8d079 LibWeb: Use available space to resolve table container width
Using avilable space directly while resolving table container width
allows to avoid assigning it to table wrapper box content width which
sometimes involves infinite (saturated) values.

Also this allows to get rid of set_max_content_width() which is a hack
that allows to bypass set_content_width() to assign infinite
(saturated) width to a box.

Closes https://github.com/SerenityOS/serenity/issues/19521
2023-08-11 19:36:19 +02:00
Liav A
fb60db7b00 Shell: Add builtin command to reset the internal state
The new builtin command "reset" now resets the entire internal state by
virtually destructing the Shell state and re-constructing it.

This helps for example when setting a new hostname and wanting to view
it in the current Shell program.
2023-08-11 18:48:53 +03:30
Andi Gallo
a426263dee LibWeb: Remove 3 decimal places rounding hack in Length::percentage_of
CSSPixels uses fixed point now.
2023-08-11 11:00:27 +01:00
Lucas CHOLLET
f2c60b7716 LibGfx/JPEGXL: Support images encoded with the YCbCr color space
While being way less frequent than for classical JPEG images, JPEG XL
images can use the YCbCr color space. Supporting it makes us properly
decode the "The Smoke Machine" image on https://jpegxl.info/jxl-art.html
2023-08-11 10:30:48 +02:00
Andi Gallo
b34b80104f LibWeb: Fix buttons with TextNode label
Fixes #20472.
2023-08-11 10:02:27 +02:00
Lucas CHOLLET
7a5cd7e5f4 LibGfx/JPEGXL: Add support for LZ77 encoded stream
On top of the Brotli/ANS compression, the entropy stream can have
another compression layer, this time using LZ77. This patch adds support
for this last layer, which makes us decode the `lz77_flower` test. This
double-compression is also often used for ICC profiles.
2023-08-10 22:39:31 +02:00
Lucas CHOLLET
80cb377990 LibGfx/JPEGXL: Factorize the code to read symbols from distributions
This will soon be used by the LZ77 decoder, so let's avoid some
duplication.
2023-08-10 22:39:31 +02:00
Lucas CHOLLET
3fdc000b90 LibGfx/JPEGXL: Use a wider type for the context id
These numbers can be way bigger than 255, let's use a `u32` instead of a
`u8`, which is what other decoders do.
2023-08-10 22:39:31 +02:00
Lucas CHOLLET
07ea66528e LibGfx/JPEGXL: Make EntropyDecoder::read_config() static
This function will soon be used for the LZ77 decoder with a different
parameter than `m_log_alphabet_size`.
2023-08-10 22:39:31 +02:00
Andreas Kling
a0bceeb704 LibJS: Remove unused VM::destructuring_assignment_evaluation() 2023-08-10 16:36:18 +02:00
Andreas Kling
0ff9992ea1 LibJS: Remove now-unused mutable caches from AST nodes
The Identifier and TaggedTemplateLiteral AST nodes had caches that were
only used by the AST interpreter.
2023-08-10 16:36:18 +02:00
Andreas Kling
f49c5ca553 LibJS: Fix most clang-tidy warnings in AST.h
Mostly adding a bunch of move() to avoid ref-count churn.
2023-08-10 16:36:18 +02:00
Hendiadyoin1
ce188c9a9c LibWeb: Allow direct rouding of CSSPixelRects to CSSPixelRects
Preciously we were casting to float, round and cast back, which actually
might loose precision and was quite ugly.
2023-08-10 12:24:21 +02:00
Hendiadyoin1
17b4109ba9 LibGfx: Allow outside specilization of Rect::to_rounded 2023-08-10 12:24:21 +02:00
Andreas Kling
9e22f01eba LibWeb: Stub out SVGMaskElement
Just enough that we stop creating layout nodes for mask elements, which
was making some SVG content look very wrong. :^)
2023-08-10 11:36:17 +02:00
Gurkirat Singh
adf70b8a16 FileManager: Add "Copy Path" action to the context menus
Adding a feature to "Copy Path" of the selected entries to the
context menus of directory_view, tree_view and file_view which
copies the absolute path of the entry in the global clipboard.

It will change the label text "Copy Path" -> "Copy Paths" when
multiple entries are selected in the directory_view.
2023-08-10 09:17:26 +02:00
Luke Wilde
fb33514029 LibWeb: Support skew{X,Y} in stacking context transforms
https://drafts.csswg.org/css-transforms/#SkewDefined
2023-08-10 05:21:33 +02:00
Andi Gallo
34cd7f4c22 LibWeb: Verify that table cells have a paintable when collecting them
Replicate the more conservative way it's done for other nodes, for
which we verify whether they have a paintable before doing
painting-related operations with it.

Fixes crash on https://www.haiku-os.org/.
2023-08-10 05:14:40 +02:00
Andi Gallo
670bbf24e5 LibWeb: Check paintable of target against null in mousewheel handling 2023-08-10 05:13:02 +02:00
Luke Wilde
ae7a0c43a9 LibJS: Implement await properly for async functions
Fixes #20275

```
Summary:
    Diff Tests:
        +4     -4    

Diff Tests:
    test/built-ins/Array/fromAsync/non-iterable-input-with-thenable
    -async-mapped-awaits-callback-result-once.js  -> 
    test/language/expressions/await/async-await-interleaved.js  -> 
    test/language/expressions/await/await-awaits-thenables-that-
    throw.js  -> 
    test/language/expressions/await/await-awaits-thenables.js  -> 
```
2023-08-10 05:12:07 +02:00
Aliaksandr Kalenik
5003b1a421 LibWeb: Use automatic width to resolve min/max-width for inline boxes 2023-08-10 05:10:44 +02:00
Aliaksandr Kalenik
b34b0a1cd3 LibWeb: Use root content width as automatic width if children inline
Returning greatest_child_width() from automatic_content_width() in BFC
if root box children are inline and there are min/max-width that caused
width to be changed after IFC layout while content_width should be
always set to correct value by layout_inline_children() regardless of
layout mode.
2023-08-10 05:10:44 +02:00
Luke Wilde
7550b4175e LibWeb: Unregister IntersectionObserver in finalize, not the destructor
Otherwise it UAFs the intersection root. Not sure how this didn't cause
a lot of crashes!
2023-08-09 22:12:54 -04:00
Luke Wilde
5694981352 LibWeb: Implement Element.hasAttributeNS
Particularly needed by xkcd's Right Click comic. https://xkcd.com/1975/
2023-08-09 22:10:58 -04:00
Timothy Flynn
375a6f5dd9 LibJS: Remove bytecode condition from tests expected to fail 2023-08-09 20:47:44 +01:00
Timothy Flynn
854330ec73 LibJS: Mark a test-js test as always passing
This passes in bytecode mode, which is now the only mode.
2023-08-09 20:47:44 +01:00
Andreas Kling
9c3e9e8981 LibWeb/Streams: Make ReadRequest GC-allocated
This allows it to keep its edges alive. Fixes an intermittent crash seen
by UBSAN on CI. :^)
2023-08-09 19:16:07 +02:00
Andreas Kling
40bdcdf966 LibWeb/Streams: Add WritableStreamDefaultController::visit_edges() 2023-08-09 19:16:07 +02:00
Andreas Kling
26d5d86682 LibWeb/Streams: Mark ReadableStreamGenericReaderMixin::m_realm 2023-08-09 19:16:07 +02:00
Tom
d7a3b65a44 LibWeb: Vertically align HTML Button content 2023-08-09 18:34:17 +02:00
flofriday
a2abc5b824 LibJS: Improve garbage collection trigger condition
This patch triggers the collector when allocated memory doubles instead
of every 100k allocations. Which can almost half (reduce by ~48%) the
time spent on collection when loading google-maps.

This dynamic approach is inspired by some other GCs like Golang's and
Lua's and improves performance in memory heavy applications because
marking must visit old objects which will dominate the marking phase if
the GC is invoked too often.

This commit also improves the Octane Splay benchmark and almost
doubles it :^)
2023-08-09 18:32:19 +02:00
Karol Kosek
7fa5dd7a92 LibWeb: Implement more steps in 'fetching a single module script'
By using fetch, the request now also follows redirects, which in the end
makes the 'Polyfilled Features' section on
https://github.github.com/browser-support/ load :^)
2023-08-09 12:08:06 -04:00
Aliaksandr Kalenik
6354f950fd LibWeb: Support "order" property for items in GridFormattingContext
Closes https://github.com/SerenityOS/serenity/issues/20434
2023-08-09 18:01:36 +02:00
Aliaksandr Kalenik
0a4b869233 LibWeb: Remove boxes_to_place from GridFormattingContext class members
Make it local variable in place_grid_items() instead.
2023-08-09 18:01:36 +02:00
Aliaksandr Kalenik
bf4e2f3e9c LibWeb: Add hit testing API in internals object
Introduces `internals.hitTest(x, y)` that is going to allow us write
tests for hit testing :)
2023-08-09 17:26:44 +02:00
Andreas Kling
22a858a0cb LibWeb: Don't parse inline style sheets during HTML fragment parsing
Some websites (like Reddit) like to instantiate "components" by setting
innerHTML to a huge chunk of stuff. Sometimes those huge chunks of stuff
contain inline style sheets (i.e `<style>` elements).

Before this change, we would end up parsing the CSS in those elements
multiple times, because we had no way of knowing that we were within
a fragment parser's temporary document.

This patch avoids the extra CSS parsing work by adding adding a flag to
Document that tells us it's being used by the fragment parser. Then, we
simply avoid parsing CSS for style elements in such documents. The CSS
then gets parsed immediately upon insertion into the proper DOM.
2023-08-09 17:09:28 +02:00
Andreas Kling
97ebfd9f0f LibJS: Make Value::to_string_without_side_effects() infallible
Work towards #20449.
2023-08-09 17:09:16 +02:00
Andreas Kling
b8f78c0adc LibJS: Make JS::number_to_string() infallible
Work towards #20449.
2023-08-09 17:09:16 +02:00
Andreas Kling
09547ec975 LibJS: Make PrimitiveString::deprecated_string() infallible
Work towards #20449.
2023-08-09 17:09:16 +02:00
Andreas Kling
c084269e5f LibJS: Make PrimitiveString::utf8_string() infallible
Work towards #20449.
2023-08-09 17:09:16 +02:00
Andreas Kling
7849950383 LibJS: Make Utf16String & related APIs infallible
Work towards #20449.
2023-08-09 17:09:16 +02:00
Andreas Kling
9708b86d65 LibJS: Make PrimitiveString::resolve_rope_if_needed() infallible
Work towards #20449.
2023-08-09 17:09:16 +02:00
Andreas Kling
1a27c525d5 LibJS: Make PrimitiveString::create() infallible
Work towards #20449.
2023-08-09 17:09:16 +02:00
Jelle Raaijmakers
1c19c2bc92 PixelPaint: Guess image type based on its filename
We do this in ImageViewer so it understands TGA images; let's do it in
PixelPaint as well :^)
2023-08-09 14:40:26 +02:00