Commit graph

18699 commits

Author SHA1 Message Date
Luke Wilde 2133b7d58a LibWeb: Implement :enabled and :disabled pseudo classes to spec
Previously we only considered an element disabled if it was an <input>
element with the disabled attribute, but there's way more elements that
apply with more nuanced disabled/enabled rules.
2022-09-30 18:05:48 +02:00
Luke Wilde c85fcd442f LibWeb: Check all <fieldset> ancestors in FormAssociatedElement::enabled
A form associated element is disabled if _any_ <fieldset> ancestor in
the ancestor chain has the disabled attribute, not just the first one.
2022-09-30 18:05:48 +02:00
Andreas Kling 30815c25a2 LibCore+LibGUI: Make it fast to check if a Core::Object is a Widget
This check happens very often in LibGUI code. 25% of time spent
layouting the emoji input dialog was wasted on RTTI. Adding a simple
fast_is<Widget>() melts almost all of that away.
2022-09-30 18:00:55 +02:00
Andreas Kling a0f3e2c9a2 LibWeb: Never claim that flex containers create a BFC
If a flex item is itself a flex container, we were previously lying when
asked if the item created a BFC. It creates an FFC, so stop lying about
this in FormattingContext::creates_block_formatting_context().
2022-09-29 20:10:12 +02:00
Andreas Kling 7c6e42c2d4 LibWeb: Fix bogus comparison when measuring if a float can fit
We were using `>=` instead of `>` when checking if a float with a given
width could fit in the available space. If the width was an exact match,
we rejected it! Oops :^)
2022-09-29 20:10:07 +02:00
Andreas Kling b7f9387f69 LibWeb: Don't draw only-translated stacking contexts via bitmap
If the 2D transform in effect is just a simple translation, we don't
need to draw into a temporary bitmap and then transform it. We can
just translate the painter. :^)
2022-09-29 20:10:02 +02:00
Andreas Kling e8a5233b94 LibWeb: Don't round fragment widths while accumulating in LineBuilder
By rounding the fragment widths, we sometimes inserted line breaks
prematurely, even though the fragment *would* fit.
2022-09-29 20:09:56 +02:00
Andreas Kling d64a8c3d2a LibWeb: Resolve cross-axis flex item margins in the common case 2022-09-29 20:09:52 +02:00
Andreas Kling 9e4226f353 LibWeb: Create flex items for empty generated boxes
I couldn't find anything in the specs about this, but GMail uses
empty generated boxes (`::before` and `::after` with `content: ""`)
inside a flexbox container in order to vertically center things.

The flexbox spec tells us to not generate flex items for empty
*anonymous* boxes, so we continue not doing that, but generated boxes
(any pseudo-element box) now always produce a flex item. This probably
isn't perfect either, and we'll have to revisit it for stuff like
`::first-letter`.
2022-09-29 20:09:49 +02:00
Andreas Kling 7abb512a86 LibWeb: Make PercentageOr<T>::contains_percentage() handle more cases 2022-09-29 20:09:44 +02:00
Andreas Kling df416bb822 LibWeb: Add AvailableSpace.cpp to CMakeLists.txt 2022-09-29 20:05:28 +02:00
Andreas Kling e6eb8a9f06 LibWeb: Fix crash in get_response_mime_type()
We were creating a ref-counted HeaderList object on the stack,
which then crashed in ~RefCounted() on scope exit, since nobody had
adopted it.
2022-09-29 18:33:53 +02:00
Andreas Kling 8fa459f2d6 LibWeb: Add missing null checks in Layout::Node::set_needs_display()
Let's not assume the containing block has a paintable box just because
someone is calling set_needs_display(). It can just be a no-op in that
case, and nobody gets hurt.
2022-09-29 18:33:41 +02:00
Andreas Kling 385657a4bf LibWeb: Add a helper for calculating the stretch-fit width of a box 2022-09-29 18:33:41 +02:00
Andreas Kling fce1c673c7 LibWeb: Add CSS::Size::to_string() and an AK::Formatter for it 2022-09-29 18:33:41 +02:00
Andreas Kling fdc9dc5729 LibWeb: Don't force layout when scrolling to non-existent anchor
If we're asked to scroll to an anchor element that's not actually in the
document, we don't need to perform a layout.
2022-09-29 18:33:41 +02:00
Andreas Kling f161e20e57 LibWeb: Make FormattingContext::run() take available space as input
Instead of formatting contexts flailing around to figure out from the
"inside" how much space is available on the "outside", we should
provide the amount of available space in both axes as an input to run().

This basically means that when something creates a nested formatting
context, the parent context is responsible for telling the nested context
how much space is available for layout. This information is provided
immediately when invoking run().

Note that this commit doesn't pass accurate values in all cases yet.
This first step just makes it build, and passes available values in some
cases where getting them was trivial.
2022-09-29 18:33:41 +02:00
Andreas Kling 6b2ce2ccc3 LibWeb: Add CSS::Size::make_px(float) convenience helper 2022-09-29 18:33:41 +02:00
implicitfield 767b23c4aa LibC: Allow detection of supported locales through setlocale
Closes #14690
2022-09-29 09:02:17 -04:00
implicitfield 3353f89e22 Calendar: Only accept Calendar notifications
Previously, changing the time format caused Taskbar to crash.

This commit also simplifies TaskbarWindow::config_string_did_change()
so that it is in line with the changes made to
Calendar::config_string_did_change().

Fixes #15384
2022-09-29 08:48:06 -04:00
Sam Atkins a58d72656d Userland: Replace empty GUI::Widgets in GML with GUI::Layout::Spacer
This fixes the "Cancel" button on HackStudio's "New Project" dialog
being too small. It's also clearer what these actually are.
2022-09-29 08:31:15 -04:00
Timothy Slater 7fda016217 PixelPaint: Add option to make new layer from selection
New actions in the Layer Menu allows for the creation of a new layer
from the current selection. Layers can be made by copying the
selection or cutting it from the current layer. The new layer will be
sized to the bounding box of the selection. The newly produced layer
will be added to the layer stack.
2022-09-29 10:20:17 +01:00
Timothy Slater e66763c223 PixelPaint: Add function to make layer from selection to ImageEditor 2022-09-29 10:20:17 +01:00
networkException 9d1336a1c9 LibWeb: Rename an origin's protocol to origin scheme
This patch updates the naming of an origin's protocol to be called
scheme according to the specification.

See https://html.spec.whatwg.org/multipage/origin.html#concept-origin-scheme
2022-09-29 09:39:04 +01:00
networkException 4230dbbb21 AK+Everywhere: Replace "protocol" with "scheme" url helpers
URL had properly named replacements for protocol(), set_protocol() and
create_with_file_protocol() already. This patch removes these function
and updates all call sites to use the functions named according to the
specification.

See https://url.spec.whatwg.org/#concept-url-scheme
2022-09-29 09:39:04 +01:00
Sam Atkins 454bf1fde0 HackStudio: Insert tooltip styling directly into Markdown HTML output 2022-09-28 23:58:26 +01:00
Sam Atkins 36c5dd78b1 LibWeb: Make Markdown images shrink-to-fit by default
This inserts some CSS and JS to make images in Markdown documents which
are wider than the viewport, become shrink-to-fit. Clicking on these
toggles them between shrink-to-fit and full size.

Anyone who displays Markdown documents using LibWeb gets this
functionality for free! That's Browser, Help, and Welcome's README
display.
2022-09-28 23:58:26 +01:00
Sam Atkins aea4fbdd7b LibMarkdown: Allow extra content to be inserted into HTML output's head
This lets users supply custom styling and scripting, among other things.
2022-09-28 23:58:26 +01:00
Sam Atkins 1da53ef854 Welcome: Get LibWeb to parse Markdown documents for us 2022-09-28 23:58:26 +01:00
Sam Atkins 28a591ce7b LibWeb: Use zoom cursor for CSS zoom-in/zoom-out cursors
Ideally we'd use a different one for each, but this is fine.
2022-09-28 23:58:26 +01:00
Timothy Flynn c3fd4554a6 LibTimeZone: Do not use tzname to determine the current time zone
The tzname array stores the abbreviated names of the current time zone
when in standard and daylight time. These abbreviations are ambiguous;
a single abbreviation often maps to multiple time zones. For example,
EST is used by America/New_York and America/Detroit, and CST could be
the abbreviation of Central Standard Time or China Standard Time.

Instead, we mimic a subset of how both ICU and Howard Hinnant's "date"
library determines the current time zone. First, we try to parse the TZ
environment variable. If that fails, or isn't set, we try to resolve the
/etc/localtime symbolic link. On most Linux systems and on macOS, this
is a link to the current TZDB file in use.

If all of the above fails, we fall back to UTC.
2022-09-28 23:52:51 +01:00
demostanis a194303948 less: Show correct line number
This patch makes less start at line 1 instead of 0.
2022-09-28 09:42:40 +01:00
demostanis 505910aea1 less: Properly stop on EOF 2022-09-28 09:42:40 +01:00
Lucas CHOLLET e1edd620ee pls: Use LibCore::Account::login() instead of manually setting the uid
In addition to changing the uid, the method also changes the gid and
properly sets groups. So this patch will also mitigate the security
issue of `pls`.
2022-09-28 00:35:36 +01:00
Lucas CHOLLET 8fabe9a3ad LibCore: Propagate errors from LibCore::Account::login() 2022-09-27 21:29:44 +01:00
Lucas CHOLLET 08dcc40aa5 LibCore: Allow the setgroups wrapper to be used on Lagom
i.e. move Core::System::setgroups() outside the `__serenity__` define.
The base function is already used by LibCore::Account.
2022-09-27 21:29:44 +01:00
Lucas CHOLLET 6900c4fe29 su: Add the --login option
This option, often used with only a lonely dash, allows to "simulate a
login". For now, it just changes the current directory to the home of
the new user.
2022-09-27 21:29:44 +01:00
Lucas CHOLLET 507cb411c2 LibCore: Use StringView instead of char * in Account 2022-09-27 21:29:44 +01:00
Sam Atkins 54be317fa9 LibWeb: Use TokenStreams when expanding unresolved CSS values
This fixes a bug where any whitespace inside the `var()` or `attr()`
functions would make the StyleComputer fail to resolve them.
2022-09-27 19:36:31 +02:00
Sam Atkins ae64cffd3a LibWeb: Expose token counts from CSS TokenStream 2022-09-27 19:36:31 +02:00
Sam Atkins 8ce38fddd9 LibWeb: Move CSS TokenStream to its own file
This lets us use TokenStream in StyleComputer without every user of
StyleComputer pulling in the entire CSS Parser.
2022-09-27 19:36:31 +02:00
Nico Weber bf6d5fce18 LibWeb: In MimeType serialization, put just one \ in front of each " 2022-09-27 15:47:54 +01:00
Thomas Voss 80b56ced93 Meta: Update my email-address 2022-09-27 15:15:36 +01:00
Linus Groh 0b52b883af LibWeb: Implement '5.5. Response class' from the Fetch API :^) 2022-09-27 14:56:17 +01:00
Linus Groh 9fb672e981 LibWeb: Implement '5.4. Request class' from the Fetch API :^) 2022-09-27 14:56:17 +01:00
Linus Groh 5ad6283331 LibWeb: Implement '5.3. Body mixin' from the Fetch API :^)
This will be used to share functionality between Request and Response.
2022-09-27 14:56:17 +01:00
Linus Groh afe2563e2b LibWeb: Make HeaderList ref-counted
This is needed to eventually share a header list between a Request or
Response object's internal infra request/response and the object's
exposed Header object.
2022-09-27 14:56:17 +01:00
Linus Groh 2d57d47132 LibWeb: Make Fetch::Infrastructure::Request::m_method default to "GET"
ByteBuffer has an inline capacity of 32 bytes, so this isn't fallible
and can be done inline.
2022-09-27 14:56:17 +01:00
Linus Groh 924d7721f0 LibWeb: Stub out Fetch::Infrastructure::Body::fully_read_as_promise() 2022-09-27 14:56:17 +01:00
Linus Groh a7164f2674 LibWeb: Stub out Fetch::Infrastructure::Body::clone() 2022-09-27 14:56:17 +01:00
Linus Groh ef5e2eb794 LibWeb: Implement Fetch::Infrastructure::Response::clone() 2022-09-27 14:56:17 +01:00
Linus Groh b5e8e9b30b LibWeb: Support ReadonlyBytes as argument for extract_body()
This now matches the spec's requirement of "a byte sequence or BodyInit
object object".
2022-09-27 14:56:17 +01:00
Linus Groh 426e32e5c0 LibWeb: Add WebIDL::ExceptionOr constructor for wrapped ValueType
This is copied from JS::ThrowCompletionOr and will allow using them
interchangeably with types wrapped by JS::Value such as JS::Object*.
2022-09-27 14:56:17 +01:00
Linus Groh 4461234898 LibWeb: Support plain (throw) JS::Completion in WebIDL::ExceptionOr
This makes it possible to propagate exceptions from a function that
returns JS::ThrowCompletionOr via TRY() in another function that returns
WebIDL::ExceptionOr.
2022-09-27 14:56:17 +01:00
Linus Groh fd52119ca3 LibWeb: Add getters and setters for Fetch::Header's members 2022-09-27 14:56:17 +01:00
Linus Groh dc6fb43d26 LibWeb: Add referrer policy to Fetch::Infrastructure::Request
The enum is in its own directory and namespace as there's a standalone
spec for it, that will later also house AOs.

- https://w3c.github.io/webappsec-referrer-policy/
- https://www.w3.org/TR/referrer-policy/
2022-09-27 14:56:17 +01:00
Linus Groh a602a4c780 LibWeb: Heap-allocate returned Fetch::Infrastructure::{Request,Response}
A Request/Response instance should always be heap-allocated and have
clear ownership, so let's also wrap it in a NonnullOwnPtr instead of
putting them on the stack.
2022-09-27 14:56:17 +01:00
Linus Groh 88ee15a497 LibWeb: Mark two Fetch::Infrastructure::Request getters as const 2022-09-27 14:56:17 +01:00
Linus Groh 37972e9f0c LibWeb: Implement most WebIDL promise operations 2022-09-27 14:56:17 +01:00
Linus Groh e68e92b304 LibJS: Make JS::NativeFunction use JS::SafeFunction internally
This still needs a project-wide cleanup to remove handles captured in
lambdas, which is now longer required.
For now, this will be used in the next commit implementing promise AOs
from Web IDL, which make heavy use of deferred callbacks.
2022-09-27 14:56:17 +01:00
Linus Groh 00fa71725b LibWeb: Implement JS value <-> JSON parsing/serialization AOs 2022-09-27 14:56:17 +01:00
Linus Groh 4e536eaf98 LibJS: Add JSON.stringify function to the intrinsics
This is needed for some Web APIs.
2022-09-27 14:56:17 +01:00
Linus Groh b42b950688 LibWeb: Implement MimeType serialization 2022-09-27 14:56:17 +01:00
ne0ndrag0n d463b8e6fb SQLStudio: Save and load blank files without failing assertion 2022-09-27 14:38:50 +01:00
kleines Filmröllchen 5294fd671e PixelPaint: Use the parallel ImageProcessor to apply filters
The main advantage of this change is that heavy-weight filters do not
lock up the GUI anymore.

This first cut has several flaws:
- We do not account for modification of the referenced images while the
  filter is running. Depending on the exact filter behavior this might
  have all sorts of weird effects. A simple fix would be to show a
  progress dialog to the user, preventing them from performing other
  modifications in the meantime.
- We do not use the image processor for previews. Preview behavior has a
  couple of other considerations that are intentionally not addressed in
  this commit or pull request.
2022-09-27 14:23:11 +01:00
kleines Filmröllchen ade868aa56 PixelPaint: Add a general-purpose parallel image processing pipeline
The ImageProcessor singleton is intended to be used by all sorts of
image processing which might take some time to complete; or other
background actions. We're not using BackgroundTask here because this
system is specifically designed to work with task queues and PixelPaint
interaction; e.g. it provides common image processing tasks such as
filter application.
2022-09-27 14:23:11 +01:00
kleines Filmröllchen 9483adee46 PixelPaint: Expose the GUI event loop from the ImageEditor
This allows processing threads to call back into the GUI.
2022-09-27 14:23:11 +01:00
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
Andreas Kling 131c3f50de LibJS: Add JS::SafeFunction, like Function but protects captures from GC
SafeFunction automatically registers its closure memory area in a place
where the JS garbage collector can find it.

This means that you can capture JS::Value and arbitrary pointers into
the GC heap in closures, as long as you're using a SafeFunction, and the
GC will not zap those values!

There's probably some performance impact from this, and there's a lot of
things that could be nicer/smarter about it, but let's build something
that ensures safety first, and we can worry about performance later. :^)
2022-09-24 12:23:29 +02:00
MacDue f5052e5017 LibWeb: Don't trigger page_did_layout() on non-active documents
PageHost assumes page_did_layout() to be called when the layout
of the active document changes, however, it seems that sometimes
the layout can change on another document before the layout of
the active document has been calculated. This leads to a VERIFY()
being hit.

This commit now makes it so page_did_layout() is only called when
the document is the active document.

Fixes #15328
2022-09-24 00:38:10 +02:00
Luke Wilde 7b8a6b8e7a LibWeb: Set HTMLParser::m_scripting_enabled as according to the spec
This allows <noscript> elements to display their content as proper HTML
instead of raw text when scripting is disabled.
2022-09-23 22:25:09 +01:00
Luke Wilde dfe57543a4 LibWeb: Keep message alive in postMessage task callback lambda
Tasks can run at any time in the future and GC can run in the time
between postMessage and running the task, meaning the message can be
reaped if we don't keep a handle to it.

Fixes Google Syndication ads crashing 100% of the time on rpcs3.net
2022-09-23 17:23:55 +01:00
Liav A 36f2e85823 WindowServer: Fix mapping the correct framebuffer size
If we don't support double buffering for a certain type of hardware,
don't try to map with size calculated with (pitch * height * 2), as it
will result in trying to map more memory than is available in the
framebuffer memory range.
2022-09-23 14:04:00 +01:00
Linus Groh 76ace3629a LibWeb: Make Fetch::Infrastructure::Body::stream() const 2022-09-22 21:01:13 +01:00
Linus Groh c7c6d7d9e1 LibWeb: Make FileAPI::Blob::create() buffer/type overload infallible 2022-09-22 21:01:13 +01:00
Linus Groh 54a987ad45 LibWeb: Update extract_body() to use BodyInit 2022-09-22 21:01:13 +01:00
Linus Groh 8f5620b5d9 LibWeb: Add BodyInit union type 2022-09-22 21:01:13 +01:00
Linus Groh 571f4e3ebb LibWeb: Move extract_body() into Fetch 2022-09-22 21:01:13 +01:00
Linus Groh f98ce156c4 LibWeb: Remove ReadableStreamDummy in favor of ReadableStream 2022-09-22 21:01:13 +01:00
Linus Groh 87654f5b51 LibWeb: Start fleshing out the ReadableStream interface
This is so we can just assume it exists in Fetch APIs (while still
skipping functionality that relies on a full implementation, of
course).
2022-09-22 21:01:13 +01:00
Linus Groh 1ace80235b LibWeb: Move XMLHttpRequestBodyInit into Fetch
https://fetch.spec.whatwg.org/#typedefdef-xmlhttprequestbodyinit
2022-09-22 21:01:13 +01:00
thankyouverycool 1bba8589fe LibGUI: Hide unnecessary Scrollbars in ComboBox windows
And simplify rect calculations using content size.
2022-09-22 21:37:26 +02:00
thankyouverycool 7858f885fe LibGUI: Update ListView content size on relevant layout changes
Fixes incorrect content sizing when unnecessary scrollbars are hidden.
2022-09-22 21:37:26 +02:00
thankyouverycool 8b4bf96db3 LibGUI: Apply horizontal padding evenly for ListView items 2022-09-22 21:37:26 +02:00
thankyouverycool 930e5c27df ClockSettings: Increase max visible items for time zone ComboBox 2022-09-22 21:37:26 +02:00
thankyouverycool f86c5b1fa7 LibGUI: Allow setting max visible items for ComboBoxes
This will govern the maximum number of items ComboBox windows display
before scrolling content.
2022-09-22 21:37:26 +02:00
thankyouverycool aa8e7aba42 LibGUI: Don't show empty ComboBox windows 2022-09-22 21:37:26 +02:00
thankyouverycool a0de3860cc LibGUI: Make ListView item_count() public 2022-09-22 21:37:26 +02:00
thankyouverycool 04a9562601 LibGUI: Don't open windows for editable ComboBoxes when typing
Fixes inability to type custom values into ComboBox editors.

CaptureInput preempts typing while the ListView window is open.
For now, searching can still be done by manually opening the window.
2022-09-22 21:37:26 +02:00
thankyouverycool 7c2edd232d LibGUI: Reset Windows as visible for timer purposes on show()
Fixes scrolling timers failing to fire if a ComboBox window
had previously become occluded.
2022-09-22 21:37:26 +02:00
thankyouverycool db2a1d3620 LibGUI: Always activate ComboBox ListView selections on MouseUp
Fixes having to doubleclick selected items to activate them if
the selection index hasn't changed since last activation.
2022-09-22 21:37:26 +02:00
thankyouverycool 7ac30f53a0 LibGUI: Block ComboBox windows from using CommandPalette 2022-09-22 21:37:26 +02:00
Andrew Kaster 8f38367d46 LibCore: Only include Account.h on Serenity in EventLoop and System
Core::Acount is only used within ``#ifdef __serenity__`` blocks in these
files, so guard the inclusion of Account.h in the same way.

This fixes the Android build of these files.
2022-09-22 11:07:21 -04:00
Andreas Kling a52d346839 LibWeb: Take coordinate spaces into account when clearing past floats
We were forgetting to convert to and from BFC root relative coordinates
when calculating how much clearance was needed to get past floats.

This fixes the last remaining issue on Acid1, which is now perfect. :^)
2022-09-22 17:06:49 +02:00
Andreas Kling 5efd63741f LibWeb: Perform horizontal inline alignment based on available space
Previously, we were using the full containing block width as a reference
for text-align values "right" and "center". This didn't take intruding
floats into account.
2022-09-22 17:06:48 +02:00
Andreas Kling d43ef27761 LibWeb: Only include containing blocks in coordinate space translation
Layout box offset coordinates are always relative to their containing
block. Therefore, the functions that convert between coordinate spaces
should only visit containing blocks and apply their offsets, not *every*
box in the parent chain.

This fixes an issue where some floating boxes were unexpectedly far away
from their containing block.
2022-09-22 16:54:12 +02:00
Andreas Kling 54fb5af9ee LibWeb: Use entire margin box of floats when testing for intrusions 2022-09-22 16:54:12 +02:00
Andreas Kling 389f47f6fe LibWeb: Check both top and bottom of float position when looking for fit
We have to check that there's enough space at both the top and bottom of
the float's margin box, otherwise we risk overlapping existing content.
2022-09-22 16:54:12 +02:00
Timothy Flynn 82e730eba1 LibJS: Change default time display options to "always" for digital style
This is a normative change in the Intl.DurationFormat proposal. See:
https://github.com/tc39/proposal-intl-duration-format/commit/d28076b
2022-09-22 14:39:24 +01:00
Timothy Flynn 73fcaaeda4 Taskbar: Add a context menu to open clock settings from the clock widget 2022-09-22 11:46:53 +01:00
Sam Atkins c64a5ccf29 LibWeb: Avoid unnecessary copies in CSS Parser 2022-09-22 02:04:23 +02:00