1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-10 18:10:56 +09:00
Commit graph

2350 commits

Author SHA1 Message Date
Tim Ledbetter
6d7b7e7822 LibWeb: Use as to cast global object to WindowOrWorkerGlobalScopeMixin
No functional changes.
2025-02-02 17:18:56 +01:00
Sam Atkins
3794665b0b LibWeb/DOM: Add spec steps for WebDriver BiDi to document history algo
This is "update document for history step application" but that's too
long for the commit title. :^)

No code changes, just adding more FIXME comments for the new steps.
(And indented step 7's substeps for clarity.)

Corresponds to https://github.com/whatwg/html/pull/10910
2025-02-01 23:32:39 +01:00
Aliaksandr Kalenik
0c5b61b7e1 LibWeb: Fix infinite repaint loop when cached display list is used
Before this change, `m_needs_repaint` was reset in
`Document::record_display_list()` only when the cached display list was
absent. This meant that if the last triggered repaint used the cached
display list, we would keep repainting indefinitely until the display
list was invalidated (We schedule a task that checks if repainting is
required 60/s).

This change also moves `m_needs_repaint` from Document to
TraversableNavigable as we only ever need to repaint a document that
belongs to traversable.
2025-02-01 23:31:16 +01:00
Aliaksandr Kalenik
0cfe90b59e LibWeb: Don't allow "display: none" start CSS animations
This is both a correctness fix and a performance optimization.
2025-02-01 13:42:00 +01:00
Gingeh
93f9ed72d2 LibWeb/SVG: Skip unwanted transformations on clip-path 2025-02-01 13:38:56 +01:00
Gingeh
3f8d4c2c92 LibWeb/SVG: Make SVGClipPathElement inherit from SVGGraphicsElement 2025-02-01 13:38:56 +01:00
Gingeh
59ba2fb2ee LibWeb: Clear stylesheet pointer when disabling link element
This fixes a crash when enabling an already disabled link element.
Fixes a crash when changing mdbook themes.
2025-02-01 08:11:37 +00:00
Sam Atkins
1bd73184da LibWeb/HTML: Update get_an_elements_noopener() to current spec
Note that this preemptively includes this fix to step 3:
https://github.com/whatwg/html/pull/10962
2025-01-31 17:27:03 +00:00
Sam Atkins
6bc38832af LibWeb/HTML: Update follow_the_hyperlink() to current spec 2025-01-31 17:27:03 +00:00
Sam Atkins
7fcd8df49b LibWeb/HTML: Update submit_form() to current spec 2025-01-31 17:27:03 +00:00
Sam Atkins
9254994687 LibWeb/HTML: Update get_an_elements_target() to current spec 2025-01-31 17:27:03 +00:00
Tim Ledbetter
8dfd382e12 LibWeb: Use as_if instead of dynamic_cast in a few places 2025-01-31 14:29:48 +01:00
Sam Atkins
6ebe19d13b LibWeb/CSS: Correct "percentages-resolve-to" data for properties
These were missing for properties that take a `<position>`, and were
incorrectly present for opacity-related properties.
2025-01-31 14:24:39 +01:00
Sam Atkins
d15e1eb9f6 LibWeb/CSS: Don't multiply non-canonical dimensions in calc()
This fixes the layout of tweakers.net, which regressed when calc
simplification was added in ee712bd98f.
2025-01-31 14:24:39 +01:00
Luke Wilde
6701aaf1cd LibWeb/CSS: Make inline-size a logical alias for the height property 2025-01-31 14:18:21 +01:00
Luke Wilde
010cdd8f90 LibWeb/CSS: Implement the ({min,max}-)block-size properties
These are heavily used by morrisons.com, using them in place of the
usual properties these map to.
2025-01-31 14:18:21 +01:00
Jelle Raaijmakers
f204970052 LibWeb: Ignore fragments with pointer-events: none in hit-testing 2025-01-31 13:37:15 +01:00
Jelle Raaijmakers
e7add9abc6 LibWeb: Remove unnecessary const_casts from TextPaintable 2025-01-31 13:37:15 +01:00
Jelle Raaijmakers
cbe78454fc LibWeb: Remove unused includes from PaintableFragment 2025-01-31 13:37:15 +01:00
Jelle Raaijmakers
342cb7addf LibGfx+LibWeb: Reuse DisplayListPlayer and PaintingSurface when possible
Previously, we were reinstantiating the DisplayListPlayer and
PaintingSurface on every paint.
2025-01-31 13:28:09 +01:00
Jelle Raaijmakers
7b3d4a9edb LibWeb: Cache Skia backend context in TraversableNavigable
We just need to create the backend context once and let Skia handle the
context's state.

On my machine, this reduces the load time for https://tweakers.net from
7.5s to 3.5s.
2025-01-31 13:28:09 +01:00
Jelle Raaijmakers
1d81c4d8eb LibGfx: Use same order for macOS and Vulkan specific code
No functional changes.
2025-01-31 13:28:09 +01:00
Jelle Raaijmakers
4fbeea6482 LibWeb+Services: Remove unused #includes
No functional changes.
2025-01-31 13:28:09 +01:00
Jelle Raaijmakers
20fbd38b77 LibWeb: Remove MetalContext from TraversableNavigable
There's no need for TraversableNavigable to keep track of the
MetalContext; our SkiaBackendContext keeps a reference to it.
2025-01-31 13:28:09 +01:00
sideshowbarker
738cb24691 LibWeb: Fire keypress event for Enter, Shift+Enter, and Ctrl+Enter keys
For web compat and interop with other engines, this change makes us fire
“keypress” events for the Enter key and for the combination of the Enter
key with the Shift or Ctrl keys — despite the fact the UI Events spec
states at https://w3c.github.io/uievents/#event-type-keypress it must be
fired “if and only if that key normally produces a character value”.

See https://github.com/w3c/uievents/issues/183#issuecomment-448091687
and https://github.com/w3c/uievents/issues/266#issuecomment-1887917756.
2025-01-31 12:07:17 +00:00
Feng Yu
30d1eb4caf LibWeb/Fetch: Sync with spec update (whatwg/fetch#1569)
This patch synchronizes changes from whatwg/fetch#1569 and
resolves a related FIXME: "Refactor this to the new version of the
spec introduced with whatwg/fetch@464326e.”
2025-01-30 16:24:50 -07:00
Aliaksandr Kalenik
a4c331c199 LibWeb: Fix unnecessary wheel event consumption with overflow: scroll
Allow wheel event to be consumed by a `overflow: scroll` box only if it
has content that overflows a scrollport.

This fixes the timing issue in the
`Text/input/scroll-window-using-wheel-event.html` test, where a `<body>`
element with `overflow: scroll` was incorrectly consuming wheel events
that should have propagated to the window.
2025-01-31 00:11:34 +01:00
Aliaksandr Kalenik
74dde4dc0f LibWeb: Rename is_scrollable() to could_be_scrolled_by_wheel_event()
Previous name for misleading because it checks if box could be scrolled
by user input event which is diffent from checking if box is scrollable.
For example box with `overflow: hidden` is scrollable but it can't be
scrolled by user input event.
2025-01-31 00:11:34 +01:00
Luke Warlow
dd37d1c536 LibWeb: Implement dialog.requestClose() 2025-01-30 15:50:06 -07:00
Gingeh
b056e27afd LibWeb: Hide visible popover when type is changed 2025-01-30 15:46:52 -07:00
Gingeh
e670caeb0c LibWeb: Ignore DOM state when hiding removed popovers
Using https://github.com/whatwg/html/pull/9457
(with some changes made to catch up with the current spec)
to fix a spec bug and a crash when removing a visible popover.
2025-01-30 15:46:52 -07:00
Gingeh
108f3a9aac LibWeb: Implement popovertarget buttons 2025-01-30 15:46:52 -07:00
Feng Yu
37e1d6ece1 LibWeb: Implement nagivator.serviceWorker.getRegistration() 2025-01-30 15:18:43 -07:00
Shannon Booth
8e410f959c LibWeb/FileAPI: Implement aborting a FileReader read
This fixes a timeout for the included WPT test.
2025-01-30 14:25:27 -07:00
Shannon Booth
33e80fbf51 LibWeb/FileAPI: Correctly fire an error event on error reading file
I can't find of a way to trigger this codepath, and there is for sure no
correpsonding WPT test, but let's fix this up for whenever it does
become relevant.
2025-01-30 14:25:27 -07:00
Shannon Booth
ebd6d49415 LibWeb/HTML: Add fastpath to skip selectedness update on option insert
This extends the optimization introduced in the previous commit to
also apply to the inserted steps for an option element. This makes
the test:

https://wpt.live/html/select/options-length-too-large.html

Go from not ever completing due to how slow it was to running, to
finishing in 800ms on my PC :^)
2025-01-30 13:55:40 -07:00
Shannon Booth
075c7ea63e LibWeb/HTML: Add fastpath to skip selectedness update on children change
We can definitely expand on this a bunch more, but using the metadata
provided in the children change notification we are able to skip
runnning the expensive selectedness algorithm on the <select> element.

This removes children changed from appearing in the profile of:

https://wpt.live/html/select/options-length-too-large.html
2025-01-30 13:55:40 -07:00
Shannon Booth
903c8860f8 LibWeb: Add metadata to children update steps invocation
Currently, this metadata is only provided on the insertion steps,
though I believe it would be useful to extend to the other cases
as well. This metadata can aid in making optimizations for these
steps by providing extra context into the type of change which
was made on the child.
2025-01-30 13:55:40 -07:00
Shannon Booth
6c1470994b LibWeb/HTML: Add a helper for getting parent <select> for <option> 2025-01-30 13:55:40 -07:00
Shannon Booth
5b6b4d93a3 LibWeb/HTML: Add a cache for the list of Options for HTMLSelectElement
This is still called _way_ too often, and we need to be much smarter
about when this needs to run. But we get two wins from this very
naive implementation:

  1. There is a inner text setter nested within the selectedness
     steps uses this list of elements. This saves us building
     up a list of elements again within these steps.
  2. More importantly, it caches the number of selected elements.
     This already allows us to skip a minor amount of work iterating
     over the children again. But in future commits, this will serve
     as one of the criteria for skipping running the selectedness
     algorithm altogether for certain cases, which is a very big win.

A example future idea might be to append to this list directly when
something like appendChild is run instead of iterating over all of
the children again. But that's left as future work.
2025-01-30 13:55:40 -07:00
Shannon Booth
c647ac407d LibWeb/HTML: Avoid double lookup of size attribute 2025-01-30 13:55:40 -07:00
Shannon Booth
319b447fdd LibWeb/HTML: Remove uneeded FIXMEs about global being a Window
The spec only refers to this property as something that is on a
Window object, and as far as I can tell this API is only ever
exposed on a Window object anyhow.
2025-01-30 13:55:40 -07:00
Shannon Booth
1db568d06f LibWeb/HTML: Remove microtask invocation of update selectedness
This is fundametally broken. A microtask only finishes after all
javascript has finished running. The selectedness of a select element
is observable by javascript, so any changes which are made as a result
of children changing associated with a select element should be made
through the children update steps and friends.
2025-01-30 13:55:40 -07:00
Luke Wilde
b35979c3f7 LibWeb: Set Sec-Fetch-Site header to same-site where appropriate
This also fixes it looking at the request's current URL origin instead
of the request's actual origin.
2025-01-30 19:32:57 +01:00
Sam Atkins
f8cc990bcd LibWeb/CSS: Remove ad-hoc calc simplification from var/attr() expansion
Now that we simplify calculations after parsing them, this is redundant.
2025-01-30 19:31:54 +01:00
Sam Atkins
ee712bd98f LibWeb/CSS: Simplify calculations after parsing them
If a calculation was simplified down to a single numeric node, then most
of the time we can instead return a regular StyleValue, for example
`calc(2px + 3px)` would be simplified down to a `5px` LengthStyleValue.
This means that parse_calculated_value() can't return a
CalculatedStyleValue directly, and its callers all have to handle
non-calculated values as well as calculated ones.

This simplification is reflected in the new test results. Serialization
is not yet correct in all cases but we're closer than we were. :^)
2025-01-30 19:31:54 +01:00
Sam Atkins
39cefd7abf LibWeb/CSS: Tell CalculationContext whether to treat numbers as integers
Calc simplification eventually produces a single style-value as its
output. This extra context data will let us know whether a calculated
number should be treated as a `<number>` or an `<integer>`, so that for
example, `z-index: 12` and `z-index: calc(12)` both produce an
`IntegerStyleValue` containing 12.
2025-01-30 19:31:54 +01:00
Sam Atkins
91831438e0 LibWeb/CSS: Implement "simplify a calculation" algorithm
This is not yet called anywhere.
2025-01-30 19:31:54 +01:00
Sam Atkins
581f5dfc86 LibWeb/CSS: Remove inaccurate VERIFY from CalculationResult::from_value
The goal of this VERIFY was to ensure that we didn't mess up the logic
for calculating the correct type. However, it's now unable to do so
because it doesn't have access to the CalculationContext, which
determines what type percentages are. This makes it crash when running
the simplification algorithm. The benefits of this check are small, and
it meant doing extra work, so let's just remove it.
2025-01-30 19:31:54 +01:00
Sam Atkins
b947ae60db LibWeb/CSS: Remove custom <integer> parsing from math-depth 2025-01-30 19:31:54 +01:00