Commit graph

63189 commits

Author SHA1 Message Date
Colin Reeder 14267b5d63 LibWeb: Add stub implementation of performance.navigation 2024-08-04 10:38:42 +02:00
Colin Reeder cca03e484b LibWeb: Also invalidate placeholder style on focus change 2024-08-04 10:38:09 +02:00
Shannon Booth a661daea71 LibURL: Don't consider file:// URL hosts as always opaque
Which was resulting in file URL hosts not being correctly percent
decoded.
2024-08-04 10:37:33 +02:00
Shannon Booth dd7c720657 LibURL: Remove note about bare-boned URL host parsing
It's not so bare-boned any longer :^)
2024-08-04 10:37:33 +02:00
Timothy Flynn 96bb8fe944 UI/Qt: Add a debug menu item to dump RequestServer connection info 2024-08-03 15:53:07 -04:00
Timothy Flynn b1433a8097 UI/AppKit: Add a debug menu item to dump RequestServer connection info 2024-08-03 15:53:07 -04:00
Timothy Flynn e75ba44f37 LibProtocol+RequestServer: Add IPC to dump RequestServer connection info
This was available on Serenity by sending SIGINFO to RequestServer. Add
an IPC so we may see this info while running the browser.
2024-08-03 15:53:07 -04:00
Timothy Flynn 62fa84865d UI/Qt: Unregister WebContentView instances just once
We already unregister the view in the ViewImplementation destructor. We
do not need to do so again in the WebContentView destructor.
2024-08-03 15:53:07 -04:00
Aliaksandr Kalenik fa605ef225 LibWeb: Fix OOB access in "text-overflow: ellipsis" clip
Fixes out of bound access to glyph run when `last_glyph_index` is 0.

Fixes crashing on https://github.com/LadybirdBrowser/ladybird/pulls
2024-08-03 19:45:41 +02:00
Tim Ledbetter c0f30f31d1 LibXML: Include line and column numbers in parse error messages 2024-08-03 18:23:36 +02:00
Tim Ledbetter 82ed253477 LibWeb: Match class selectors case insensitively in quirks mode
This align our implementation with the CSSWG Selectors Level 4
specification.
2024-08-03 16:45:23 +02:00
Tobias Christiansen e2c9e34050 Tests: Add ref-test for "text-overflow" 2024-08-03 10:04:38 +01:00
Tobias Christiansen da7f0897d1 LibWeb: Implement "text-overflow" property
The "text-overflow" property affects text that may get clipped if it is
larger than its container and does not do any line breaks.
The ellipsis character gets added to the end and the rest of the text
gets trunctated if the property is set to "ellipsis".
This patch implements this behavior in the InlineFormattingContext. :^)

The "text-overflow" property is also added  to the
getComputedStyle-print-all test.
2024-08-03 10:04:38 +01:00
Tobias Christiansen 794069b3cf LibWeb: Add plumbing for new "text-overflow" CSS property
This patch adds the new "text-overflow" CSS property to all the
relevant places.
2024-08-03 10:04:38 +01:00
Tobias Christiansen a8d3c077ea LibWeb: Add "text-overflow" property to code generation
The CSS property "text-overflow" as well as its valid identifiers are
added to the relevant json files for code generation
2024-08-03 10:04:38 +01:00
Andreas Kling e746b2b133 LibWeb: Cache the Document's node navigable when possible
To avoid expensive lookups, we now cache a weak pointer from document to
the last known node navigable. Before using the cache, we validate that
the document is still the navigable's active document.
2024-08-02 21:59:41 +02:00
Andreas Kling 936b76f36e LibURL: Make URL a copy-on-write type
This patch moves the data members of URL to an internal URL::Data struct
that is also reference-counted. URL then uses a CopyOnWrite<T> template
to give itself copy-on-write behavior.

This means that URL itself is now 8 bytes per instance, and copying is
cheap as long as you don't mutate.

This shrinks many data structures over in LibWeb land. As an example,
CSS::ComputedValues goes from 3024 bytes to 2288 bytes per instance.
2024-08-02 20:37:40 +02:00
Andreas Kling c282138fd0 LibWeb: Make CSS::PercentageOr<T> non-virtual
This shrinks each instance of PercentageOr by 8 bytes and avoids virtual
dispatch when resolving calc() values. It's a win-win!

Many data structures shrink as a result. An example is ComputedValues
which goes from 3376 bytes to 3024 bytes per instance.
2024-08-02 20:37:40 +02:00
Andreas Kling b42b7c8dd0 LibWeb: Use bitmaps for important/inherited bits in StyleProperties
This avoids padding the style value array, shrinking StyleProperties
from 4368 bytes to 2288 bytes per instance.
2024-08-02 20:37:40 +02:00
Andreas Kling c288bfb404 LibWeb: Only remember source CSSStyleDeclaration for animation-name
We were saving to source declarations for *every* property, even though
we only ever looked it up for animation-name.

This patch gets rid of the per-property source pointer and we now keep
a single pointer to the animation-name source only.

This shrinks StyleProperties from 6512 bytes to 4368 bytes per instance.
2024-08-02 20:37:40 +02:00
Timothy Flynn faebbbc281 LibWeb: Move the navigable's cursor position to be owned by the document
Navigables are re-used for navigations within the same tab. Its current
ownership of the cursor position is a bit ad-hoc, so nothing in the spec
indicates when to reset the cursor, nor do we manually do so. So when a
cursor update happens on one page, that cursor is retained on the next
page.

Instead, let's have the document own the cursor. Each navigation results
in a new document, thus we don't need to worry about resetting cursors.

This also makes many of the callsites feel nicer. We were previously
often going from the node, to the document, to the navigable, to the
cursor. This patch removes the navigable hop.
2024-08-02 18:40:39 +02:00
Timothy Flynn f8d83b2922 LibWeb: Remove needless virtual qualifiers from EditEventHandler
This class does not inherit from any class, nor does any other class
inherit from EditEventHandler.
2024-08-02 18:40:39 +02:00
Timothy Flynn 5c73a31b4f LibWebView: Use an overflow-x value of 'auto' for Inspector containers
The Inspector looks a bit nicer if we don't paint the horizontal scroll
bars unless we need to.
2024-08-02 12:21:22 -04:00
Timothy Flynn d2c775b0ca LibWebView: Improve scrolling of Inspector content containers
Currently, the feel of scrolling containers in the Inspector is a bit
awkward. We make the entire split-view container scrollable, then we
absolutely position the tab control buttons to force them to not scroll.
The result is that the scroll bar is painted over the tab controls, and
the tab content that we actually want to scroll has to scroll under the
tab controls. This never looked quite right.

It was basically:

    <div tab-container> <!-- Scrollable -->
        <div tab-controls /> <!-- Pinned to not be scrollable -->
        <div tab-content /> <!-- The part we actually want to scroll -->
    </div>

This patch moves the "scrollability" to just the tab content. We then
don't need to go out of our way to ensure only the content is actually
scrollable.

So we now have:

    <div tab-container> <!-- Not scrollable -->
        <div tab-controls /> <!-- Not pinned, uses normal layout -->
        <div tab-content /> <!-- Scrollable -->
    </div>
2024-08-02 12:21:22 -04:00
Sam Atkins 113b4da1df LibWebView: Sort vendor-prefixed properties last in the inspector
Previously, the legacy `-webkit-foo` properties would all be top of the
list, when they are generally not useful to inspect. Instead, put them
at the bottom, so that users can still see them if they want to, but
they're not in the way.
2024-08-02 08:51:52 -04:00
BenJilks 963cf1c2c4 LibWeb: Add additional padding to the end of the scrollable overflow
Adds additional padding to the end-side of the scrollable overflow
rectangle as necessary to enable a scroll position that satisfies
the requirements of `place-content: end` alignment.
2024-08-02 08:07:56 +02:00
Timothy Flynn 40b2d24d55 LibWeb: Support ctrl/cmd-clicking a link to open it in a new tab
The spec does not define activation behavior of ctrl/cmd clicks, so we
have to go a bit ad-hoc here. When an anchor element is clicked with the
cmd (on macOS) or ctrl (on other platforms) modifier pressed, we will
skip activation of that element and pass the event on to the chrome. We
still dispatch the event to allow scripts to cancel the event.
2024-08-02 08:07:00 +02:00
Timothy Flynn c2d5e30a35 LibWeb: Remove debug spam when clicking a link 2024-08-02 08:07:00 +02:00
Timothy Flynn facaf953eb LibWeb+WebContent: Add a page hook to invoke the did-click-link IPC 2024-08-02 08:07:00 +02:00
Timothy Flynn 3ff965d672 WebContent: Remove unnecessary [[maybe_unused]] attributes
Noticed while copy-pasting this method to a did-click-link method.
2024-08-02 08:07:00 +02:00
Timothy Flynn 71b25e3e5a LibWeb: Define a helper constant for the platform ctrl-ish key
For all intents and purposes, the cmd (super) key on macOS should be
treated as the ctrl key.
2024-08-02 08:07:00 +02:00
Timothy Flynn ee00730225 LibUnicode+LibJS: Normalize spaces in formatted date-time strings
ICU 72 began using non-ASCII spaces in some formatted date-time strings.
Every major browser has found that this introduced major breakage in web
compatibility, as many sites and tools expect ASCII spaces. This patch
removes these non-ASCII spaces in the same manner as the major engines.
Such behavior is also tested by WPT.
2024-08-02 08:05:52 +02:00
Aliaksandr Kalenik 9e22233be9 LibWeb: Enable fast path of animation invalidation for pseudo-elements
3abd3ef5e2 made possible using fast
invalidation path for pseudo-element by saving previously computed style
in DOM::Element.
2024-08-02 08:05:31 +02:00
Aliaksandr Kalenik 4049cce40c LibWeb: Add slots for pseudo-elements animation cache in Animatable
Fixes the bug when animation does not run at all if an element has a
pseudo-element, because both of them use the same cache.
2024-08-02 08:05:31 +02:00
Tim Ledbetter 6a19cffdde WebDriver: Add a --force-cpu-painting option
This launches the browser withb the `--force-cpu-backend` option, which
forces Skia to use the CPU backend rather than the GPU.
2024-08-01 23:26:45 +01:00
Tim Ledbetter 2854113ee6 LibWebView+WebContent: Add a --force-cpu-painting option
This option forces Skia to use the CPU backend rather than using the
GPU.
2024-08-01 23:26:45 +01:00
Tim Ledbetter 3eb5c63df3 WebContent: Remove the --use-skia-painting option
This has been umused since Skia became the default painter.
2024-08-01 23:26:45 +01:00
Tim Ledbetter ae51fbd5de WebDriver: Use correct WebDriver IPC path argument name
Previously, the incorrect name for this argument  was being used when
attempting to launch `headless-browser`.
2024-08-01 16:40:19 -04:00
Timothy Flynn ce5f2861d8 LibWebView+UI: Allow profiling any helper process
This removes the --enable-callgrind-profiling flag, and replaces it with
a --profile-process=<process-name> flag. For example:

    ladybird --profile-process=WebContent
    ladybird --profile-process=RequestServer

This allows profiling any helper process with callgrind.
2024-08-01 15:40:49 +02:00
Timothy Flynn 7106a7bd58 LibWebView+UI: Allow debugging any helper process
This removes the --debug-web-content flag, and replaces it with a
--debug-process=<process-name> flag. For example:

    ladybird --debug-process=WebContent
    ladybird --debug-process=RequestServer

This allows attaching gdb to any helper process.
2024-08-01 15:40:49 +02:00
Aliaksandr Kalenik bbc89a383d LibWeb: Fix overflow clip when "complicated" CSS transform is used
Overflow clipping is currently implemented as:
1. Create clip frame for each box with hidden overflow
2. Calculate clip rect for each clip frame by intersecting padding boxes
   of all boxes with hidden overflow in containing block chain
3. Assign enclosing clip frame (closest clip frame in containing block
   chain) to each PaintableBox
4. Apply clip rect of enclosing clip frame in Paintable::before_paint()

It breaks when any CSS transform other than simple translation is lying
between box with hidden overflow and a clipped box, because clip
rectangle will be applied when transform has already changed.

The fix is implemented by relying on the following rule:
"For elements whose layout is governed by the CSS box model, any value
other than none for the transform also causes the element to establish
a containing block for all descendants."

It means everything nested into a stacking context with CSS transform
can't escape its clip, so it's safe to apply its clip for all children.
2024-08-01 12:03:13 +02:00
Aliaksandr Kalenik e75791d9e1 LibWeb: Add missing border-radius clip in refresh_clip_state()
Adds missing clip of border-radius for clip frame. While we have already
accounted for the border-radius of containing blocks, the box itself was
not being clipped.
2024-08-01 12:03:13 +02:00
Aliaksandr Kalenik 1829ec56e2 LibWeb: Apply scroll offset to transform origin in PushStackingContext 2024-08-01 12:03:13 +02:00
Aliaksandr Kalenik c47ec26bcd LibWeb: Delete m_clipping_overflow in PaintableBox 2024-08-01 12:03:13 +02:00
Diego Frias 23cfee2205 LibWasm: Clean up module sections API
Remove `for_each_section_of_type` in favor of making the module's
sections defined as distinct fields. This means it is no longer possible
to have two of the same section (which is invalid in WebAssembly, for
anything other than custom sections).
2024-08-01 11:44:07 +02:00
Shannon Booth 9f24176cac HTML: Partially implement HTMLInputElement's selection{Start,End}
Now that the implementation is in FormAssociatedElement, the
implementation in HTMLInputElement is effectively just a passthrough,
with some minor differences to handle small behavioural quirks between
the two (such as the difference in nullability of types).
2024-08-01 11:42:39 +02:00
Shannon Booth 62bf428a7f HTML: Put HTMLTextAreaElement selection helpers in FormAssociatedElement
This will allow us to more closely follow the spec and share these
functions with HTMLInputElement.
2024-08-01 11:42:39 +02:00
Shannon Booth 28ed8e5d0f HTML: Add const qualified form_associated_element_to_html_element
Put the const cast in a common location to make the helper more
convenient to use.
2024-08-01 11:42:39 +02:00
Shannon Booth ad32227c83 BindingsGenerator: Support nullable integral attributes
Previously we were assuming that the attribute return value was never
nullable and going to be returned in an Optional<IntegralType>, causing
complile errors for something such as: `attribute unsigned long?`.
2024-08-01 11:42:39 +02:00
Shannon Booth d6243abec3 BindingsGenerator: Factor out code to generate JS::Value from an integer
Mirroring the pre-existing `generate_from_integral` function. This will
allow us to fix a bug that all of these if statements have in common -
no handling of nullable types.

This also adjusts the type casted for each integral to fully match that
stated by the spec.
2024-08-01 11:42:39 +02:00