Commit Graph

18532 Commits

Author SHA1 Message Date
kleines Filmröllchen
056b081e2d PixelPaint: Reference-count filters
For multi-threading filter application, shared ownership is much easier
to work with.
2022-09-27 14:23:11 +01:00
Marco Santos
5f76ab9836 Spreadsheet: Add toolbar actions to change the cell style 2022-09-27 13:38:11 +03:30
Sam Atkins
42f36d4865 LibGUI: Make "Home" key behavior comfier on wrapped lines :^)
There's a big comment explaining it because it's somewhat confusing, but
the behavior I'm copying from other editors is, when you repeatedly
press the `Home` key:

1. Go to the start of the visual line, where it wraps.
2. Go to the first non-whitespace character on the logical line, which
   is what happens in non-wrapped lines.
3. Go to column 0.
4. GOTO 2
2022-09-26 23:12:31 +02:00
Enver Balalic
55c099c953 LibHTTP: Null out on_ready_to_read on socket close
This fixes the segfault reported in #15283.

on_ready_to_read gets re-registered on every job start anyways.
I see no reason why this could be bad.
2022-09-26 23:11:28 +02:00
Roberto Bampi
69f7a59a34 Magnifier: Add the option to save captures 2022-09-26 17:28:54 +01:00
MacDue
f6264523b9 LibWeb: Fix destination bitmap edge clip case in transform painting
This fixes an edge case, where the destination rect falls partly
outside the painter, so is clipped to a smaller size in
`get_region_bitmap()` (which needs to be accounted for with an extra
offset).
2022-09-26 01:38:30 +02:00
Linus Groh
bbaa05fcf9 LibWeb: Move DOMException from DOM/ to WebIDL/ 2022-09-25 19:13:31 +01:00
Linus Groh
ad04d7ac9b LibWeb: Move ExceptionOr from DOM/ to WebIDL/
This is a concept fully defined in the Web IDL spec and doesn't belong
in the DOM directory/namespace - not even DOMException, despite the name
:^)
2022-09-25 19:13:31 +01:00
MacDue
e3537e4374 LibWeb: Fix shadow painting when the target painter is translated 2022-09-25 18:37:31 +02:00
MacDue
3fad64dfbc LibWeb: Sample the destination when painting element opacity/transform
This now copies the area under the destination to a new bitmap, that
is then scaled to the size of the source. The element is then painted
into that bitmap, which is then scaled and painted back to
the destination. This is done as many effects such as shadows, border
radii, filters, etc require being able to read pixels from the painter.

This does work (and is not that noticeable in many cases), but it does
mean there may be a few scaling artifacts in the background
around transformed elements. Though that was already the case before
anyway for the elements (since it is just a bitmap scale).

What we really want is to (where possible) just scale the paintable
and its descendants, then paint things normally, which would give
much nicer results (but is much more tricky to achieve).

This also now makes it so only a bitmap of the size of the paintable is
copied/created, rather than the whole page.
2022-09-25 18:37:31 +02:00
MacDue
8967fe9d92 LibWeb: Add PaintableBox::absolute_paint_rect()
This method returns the total area this element will paint to.
Currently, this just means accounting for box-shadows, though
there are likely more effects that need to be accounted for here.
2022-09-25 18:37:31 +02:00
Andreas Kling
0843960235 LibWeb: Use CSS::Size for computed size and max-size values
This patch changes the *computed* representation of the following CSS
properties to use CSS::Size:

- width, min-width, max-width
- height, min-height, max-height

A few things had to change in order for things to keep working,
but I tried to keep the diff to a minimum.

The main trouble was that `min-width` and `max-width` can't actually be
`auto`, but they *can* be `none`. We previously treated `auto` as a
valid value (and it behaved mostly like `none`).
2022-09-25 17:51:43 +02:00
Andreas Kling
844321d89f LibWeb: Teach CSS::StyleProperties to create CSS::Size values
You can now use StyleProperties::size_value(CSS::PropertyID) to extract
a CSS::Size for a given property.
2022-09-25 17:51:43 +02:00
Andreas Kling
ba78fe008f LibWeb: Add CSS::Size to represent the full range of CSS size values
Until now, we've been using CSS::LengthPercentage, sometimes wrapped in
Optional, to represent CSS sizes.

This meant we could not support modern values like `min-content`,
`max-content`, `fit-content(<length>)`. We were also conflating `none`
and `auto` which made the `min-*` and `max-*` properties confusing.

The new CSS::Size class covers all possible size values as individual
substates. It'll be quite a bit of work to make all layout code aware of
the additional features, this patch merely makes the new type available.
2022-09-25 17:51:43 +02:00
Andreas Kling
022a49e9ac LibWeb: Only notify PageClient about top-level browsing context loads
We don't need to notify the web views that some deeply nested iframe
has started loading a new URL (and we don't want it showing up in the
browser location bar either!)
2022-09-25 12:28:40 +02:00
Andreas Kling
d89dc6e24c LibGUI: Add Model::unsafe_create_index()
This will be used by Ladybird to translate between LibGUI and Qt models.
2022-09-25 12:16:12 +02:00
Andreas Kling
05985b51f2 LibWebView: Make DOMTreeModel usable outside of SerenityOS
Two issues made this class unusable on other platforms:
- Hardcoded /res paths to icons
- It required a GUI::TreeView for palette access

This patch simply patches out those features on non-Serenity systemsf
for now.
2022-09-25 12:11:02 +02:00
Andreas Kling
f36cbd3b65 LibWeb: Invalidate layout when a DOM node is removed from the tree 2022-09-25 02:26:36 +02:00
Andreas Kling
5c6621547c LibWeb: Compute StackingContext transform origin only once
When mousing over twitter, 17% of time was spent computing stacking
context transform origins. Since this never changes after the stacking
context is created, we can cache it and avoid all that work.
2022-09-24 23:06:09 +02:00
thankyouverycool
901b80f988 LibGUI: Update calculated_min_size() for TextEditor
Defer to AbstractScrollableWidget when TextEditor is multi-line.
Otherwise, as "vertical_content_size" was unused, simply return
margins for now.
2022-09-24 22:59:12 +02:00
thankyouverycool
961a225316 LibGUI: Include scrubber and gutter in Scrollbar's calculated_min_size() 2022-09-24 22:59:12 +02:00
thankyouverycool
b50bce3cb9 LibGUI: Don't draw Scrollbar button triangles if they'd be off-center 2022-09-24 22:59:12 +02:00
thankyouverycool
cbd9cf93be LibGUI: Implement calculated_min_size() for StackWidget 2022-09-24 22:59:12 +02:00
thankyouverycool
f0a5ce6d11 LibGUI: Implement calculated_min_size() for ListView 2022-09-24 22:59:12 +02:00
thankyouverycool
d495405e53 LibGUI: Implement calculated_min_size() for AbstractScrollableWidget 2022-09-24 22:59:12 +02:00
martinfalisse
521e19444c LibWeb: Make CSS Grid work again
Fixes bug after the automatic_content_height() changes where the height
of the grid container was not being calculated correctly.
2022-09-24 20:57:28 +02:00
Linus Groh
2b2ccb3815 LibWeb: Replace 'heycam.github.io' links with 'webidl.spec.whatwg.org' 2022-09-24 19:32:09 +01:00
Linus Groh
56d8c4ff26 LibWeb: Move WindowProxy from Bindings/ to HTML/ 2022-09-24 19:31:39 +01:00
Linus Groh
86f68eb3c3 LibWeb: Move IDLOverloadResolution from Bindings/ to WebIDL/ 2022-09-24 19:31:39 +01:00
Linus Groh
6480faacb6 LibWeb: Move IDLAbstractOperations from Bindings/ to WebIDL/ 2022-09-24 19:31:39 +01:00
Linus Groh
4f73851afc LibWeb: Move CallbackType from Bindings/ to WebIDL/
Let's stop putting generic types and AOs from the Web IDL spec into
the Bindings namespace and directory in LibWeb, and instead follow our
usual naming rules of 'directory = namespace = spec name'. The IDL
namespace is already used by LibIDL, so Web::WebIDL seems like a good
choice.
2022-09-24 19:31:39 +01:00
Linus Groh
dc44effd44 LibWeb: Move cross-origin AOs from Bindings/ to HTML/CrossOrigin/
These are from the HTML spec and therefore belong in the HTML/ directory
in LibWeb. Bindings/ has become a bit of a dumping ground, so this is a
first step towards cleaning that up.
2022-09-24 19:31:39 +01:00
MacDue
c3841e1667 LibWeb: Restore clipping of positioned descendants
63c727a was meant to stop clipping absolutely positioned descendants,
but used `is_positioned()` rather than `is_absolutely_positioned()`,
which meant it disabled clipping in many more cases that it should
have.
2022-09-24 19:06:57 +02:00
Itamar
7165dbce5c LibGfx: Fix affine transformations in TrueType composite glyphs
This fixes an issue where, when looping over the components of a
composite glyph, we used to mutate the affine transformation of the
glyph itself when computing the transformations of its components.

(AffineTransform::multiply() is non-const).
2022-09-24 17:06:29 +02:00
Liav A
13e9947b4b WindowServer: Fallback to safe mode-setting in case of mapping overflow
In case of possible framebuffer mapping overflow, just fallback to the
safe mode-setting of the DisplayConnector, because in that state we know
for sure that we can map a usable framebuffer (otherwise it is a bug in
the Kernel, and not WindowServer).
2022-09-24 15:38:56 +01:00
Liav A
d5b97eb41e Kernel+Userland: Provide bytes count for a DisplayConnector framebuffer
This value will be used later on by WindowServer to reject resolutions
that will request a mapping that will overflow the hardware framebuffer
max length.
2022-09-24 15:38:56 +01:00
Liav A
50ed50752f LibEDID: Remove head index when retrieving an EDID from DisplayConnector
We simply don't need that field anymore, as it was used when one
FramebufferDevice could contain multiple framebuffers within it, each
for a connected screen head.
2022-09-24 15:36:19 +01:00
Andreas Kling
c04b107e26 LibWeb: Treat replaced % sizes as 0 if containing block is indefinite 2022-09-24 14:41:18 +02:00
Andreas Kling
416fa7bd4f LibWeb: Bring flex basis calculation a little closer to spec
This ends up having a big impact on performance, as we now correctly
treat a used flex-basis of `content` as `max-content` which means
we can use cacheable intrinsic sizes for flex items in the majority
of cases.
2022-09-24 14:09:56 +02:00
Andreas Kling
f0ac687823 LibWeb: Remove awkward BFC::compute_theoretical_height() function
This was used by FFC to estimate the height of flex items after
performing layout inside them.

Now that we have automatic_content_height(), we no longer need this
awkward API and we can fold it into BFC's own height calculation.
2022-09-24 13:53:23 +02:00
MacDue
4d7e4e5da8 LibWeb: Avoid overflow and OOB indexing in get_buffer_source_copy()
Previously, this would overflow when both length and offset were
zero, leading to an OOB index into es_array_buffer. This would lead to
a crash on a few MDN pages.
2022-09-24 13:49:15 +02:00
Andreas Kling
ba065faa54 LibWeb: Remove unused capture in queue_a_microtask() 2022-09-24 13:48:38 +02:00
Andreas Kling
a8e1599ae1 LibWeb: Use automatic_content_height() in flex item internal layouts 2022-09-24 13:47:58 +02:00
Andreas Kling
5656173e00 LibWeb: Use automatic_content_height() when computing intrinsic heights 2022-09-24 13:47:17 +02:00
Andreas Kling
62974160da LibWeb: Add FormattingContext::automatic_content_height()
This function should return the automatic height of the formatting
context's root box.

Until now, we've been relying on some magical handshakes between parent
and child context, when negotiating the height of child context root
boxes. This is a step towards something more reasonable.
2022-09-24 13:41:08 +02:00
Andreas Kling
b52165c5d7 LibWeb+LibGfx: Move the blit image through 2D transfrom to Gfx::Painter
Even though this code is obnoxiously slow, it still belongs in LibGfx
and should not be hidden away in LibWeb's CanvasRenderingContext2D.
2022-09-24 13:00:53 +02:00
Andreas Kling
37ea6de772 LibWeb: Remove now-unnecessary JS::Handles in microtask capture lists 2022-09-24 12:23:29 +02:00
Andreas Kling
874e64d664 LibWeb: Make queue_an_element_task() use JS::SafeFunction 2022-09-24 12:23:29 +02:00
Andreas Kling
2ccb9bef49 LibWeb: Remove now-unnecessary JS::Handles in HTML task capture lists
JS::SafeFunction will protect anything captures for HTML tasks now.
2022-09-24 12:23:29 +02:00
Andreas Kling
d505192014 LibWeb: Use JS::SafeFunction in the HTML task queues
This means that HTML tasks automatically protect anything in their
capture lists, and we no longer need to jump through hoops with
JS::Handle etc.
2022-09-24 12:23:29 +02:00