Commit graph

66696 commits

Author SHA1 Message Date
Tim Ledbetter
983540a244 LibWeb: Add missing spec links to HTML parser 2025-01-08 12:05:08 +00:00
Tim Ledbetter
27dbe49f00 LibWeb: Initialize OfflineAudioContext with correct defaults 2025-01-08 11:24:08 +00:00
Gingeh
2cac0dc20c LibWeb: Avoid crash from zero-duration transitions 2025-01-08 11:22:53 +00:00
Gingeh
8e56109515 LibWeb/CSS: Implement the light-dark color function 2025-01-08 11:18:13 +00:00
Gingeh
4a0ac312cc LibWeb: Obtain theme-color on meta element removal and modification 2025-01-08 11:18:13 +00:00
Gingeh
df70455d3f LibWeb: Implement the color-scheme meta tag name 2025-01-08 11:18:13 +00:00
Gingeh
ce5cd012b9 LibWeb/CSS: Implement the color-scheme CSS property 2025-01-08 11:18:13 +00:00
Sam Atkins
89296b88a0 LibWeb: Bring fragment parsing up to spec
Corresponds to https://github.com/whatwg/html/pull/10874

Also, parse_fragment() returns ExceptionOr, so stop voiding the error
from append_child().
2025-01-07 16:05:59 +01:00
Sam Atkins
7d502df807 LibWeb/DOM: Add Document::in_limited_quirks_mode() helper 2025-01-07 16:05:59 +01:00
stelar7
056b774b1e LibWeb: Provide default text for Reset and Submit buttons 2025-01-07 11:41:32 +00:00
InvalidUsernameException
c790cf2194 LibWeb: Prevent paths thinner than 1px from disappearing
SVGs are rendered with subpixel precision. As such it can happen that
paths are rendered with less than 1px width or height and that they can
have a bounding box thinner than 1px. Due to an optimization such paths
were ignored when painting because their bounding box was incorrectly
calculated to be empty.

As a result horizontal or vertical lines inside SVGs were missing if:
* The SVG is displayed at viewbox size but the lines are defined with
  less than 1px.
* The SVG contians 1px-thin lines, but is displayed at a size smaller
  than viewbox size.

To prevent this, the bounding box of the path is now enlarged to contain
all pixels that are partially affected.
2025-01-07 09:05:04 +00:00
Shannon Booth
b08db3dc1e LibWeb/HTML: Update editorial spec comments for Storage
See: https://github.com/whatwg/html/commit/8d2829a
2025-01-07 07:06:16 +00:00
Shannon Booth
7fee54b34e LibWeb/FileAPI: Update FIXME to point to spec bug
This is indeed a spec bug, and has been raised upstream to the FileAPI
spec.
2025-01-07 07:04:41 +00:00
Ryan Liptak
1ba15e1fa3 LibWeb: Fix hex character references accepting all alphabetic ASCII
Instead of just A-F/a-f, any char A-Z/a-z was being accepted as a valid
hexadecimal digit.
2025-01-07 00:43:41 +01:00
Ryan Liptak
df87a9689c LibWeb: Fix numeric character reference at EOF leaking its last digit
Previously, if the NumericCharacterReferenceEnd state was reached when
current_input_character was None, then the
DONT_CONSUME_NEXT_INPUT_CHARACTER macro would restore back before the
EOF, and allow the next state (after the SWITCH_TO_RETURN_STATE) to
proceed with the last digit of the numeric character reference.

For example, with something like `&#1111`, before this commit the
output would incorrectly be `<code point with the value 1111>1` instead
of just `<code point with the value 1111>`.

Instead of putting the `if (current_input_character.has_value())` check
inside NumericCharacterReferenceEnd directly, it was instead added to
DONT_CONSUME_NEXT_INPUT_CHARACTER, because all usages of the macro
benefit from this check, even if the other existing usage sites don't
exhibit any bugs without it:

- In MarkupDeclarationOpen, if the current_input_character is EOF, then
  the previous character is always `!`, so restoring and then checking
  forward for strings like `--`, `DOCTYPE`, etc won't match and the
  BogusComment state will run one extra time (once for `!` and once
  for EOF) with no practical consequences. With the `has_value()` check,
  BogusComment will only run once with EOF.

- In AfterDOCTYPEName, ConsumeNextResult::RanOutOfCharacters can only
  occur when stopping at the insertion point, and because of how
  the code is structured, it is guaranteed that current_input_character
  is either `P` or `S`, so the `has_value()` check is irrelevant.
2025-01-07 00:43:41 +01:00
Ryan Liptak
752deaf6ef LibWeb: Don't skip named-character-references test
This already passes, so there's no reason to skip it anymore
2025-01-07 00:43:41 +01:00
Andrew Kaster
223b13ae93 CMake: Enable -Wl,--no-undefined on ELF platforms
This is mostly a development helper, to move all undefined symbols
in shared libraries to link time rather than load time.

At the same time, set --no-allow-shlib-undefined and -z,defs to
further enforce the rule.
2025-01-06 12:41:47 -07:00
Andrew Kaster
5e43fec6dd CMake: Enable -Werror unconditionally 2025-01-06 12:41:47 -07:00
Psychpsyo
eb7824339b LibWeb: Improve user-select support 2025-01-06 12:22:37 +00:00
Pavel Shliak
6293556935 Meta: Update ffmpeg to 7.1 2025-01-06 12:29:02 +01:00
Aliaksandr Kalenik
5cac301bb7 LibWeb: Optimize hover style invalidation for shadow trees
With this change we skip all :hover selectors that don't belong to a
"style scope" (document or shadow root) of old/new hovered node.
2025-01-06 12:15:06 +01:00
Pavel Shliak
9e2eb93cc4 Meta: Update curl to 8.11.1 2025-01-06 11:46:49 +01:00
Tim Ledbetter
7356093af3 LibWeb: Fix selectionchange typo
This was a typo in the spec itself, which has since been fixed.
2025-01-06 08:55:00 +00:00
Sam Atkins
3dbaae5cfc LibWeb/HTML: Add cloning steps for HTMLScriptElement 2025-01-05 21:11:50 +00:00
Sam Atkins
2e96ba11e4 LibWeb/HTML: Update cloning steps to current spec algorithms
Reflects the changes in https://github.com/whatwg/html/pull/10859

I've also added missing calls to the Base::cloned() method, and modified
a couple of spec links to point to the multipage version.

I took the liberty to fix a spec typo, and submitted a PR for it:
https://github.com/whatwg/html/pull/10892
2025-01-05 21:11:50 +00:00
Shannon Booth
172d5f6987 LibWeb: Implement definition of remaining global event handlers 2025-01-05 16:19:19 +00:00
stasoid
9884cd0628 AK: Stub out AK::demangle on Windows 2025-01-05 15:02:32 +00:00
rmg-x
ba6b5adde3 UI/Qt: Add menu action to clear all cookies 2025-01-05 13:58:27 +00:00
rmg-x
dc34aeb764 LibWebView: Add method to remove all cookies globally
The inspector widget has this functionality, but it's limited to the
site you're currently viewing. This commit adds an option for removing
all cookies globally.

Previously, the workaround was to open a sqlite shell and run:
`DELETE FROM Cookies;` on the database yourself.
2025-01-05 13:58:27 +00:00
Andreas Kling
49a7a0f378 LibWeb: Avoid invalidation on .textContent setter no-op
When setting the textContent of an element with no children to null or
the empty string, nothing happens. Even so, we were still invalidating
style, layout and collections, causing pointless churn.

Skipping invalidation in this case also revealed that we were missing
invalidation when changing the selected state of HTMLOptionElement.
This was all caught by existing tests already in-tree. :^)
2025-01-05 13:36:17 +01:00
Shannon Booth
8214371ad5 LibWeb/HTML: Default ErrorEvent error to undefined
This was a change in the HTML spec, see:

https://github.com/whatwg/html/commit/032523196
2025-01-05 12:02:40 +01:00
Ivan Zuzak
cb9e3d5c9b Documentation: Mention TODOs and FIXMEs as potential sources of work
As many other projects, Ladybird has more than a few TODO and FIXME
comments sprinkled throughout the codebase. These can be a great
inspiration or starting point for contributors looking for work, so
we mention them in the docs on contributing to the project.
2025-01-05 12:02:16 +01:00
Aliaksandr Kalenik
8fdfadb0c9 LibWeb: Optimize inherited style update caused by animation
It is possible to skip inherited style recalculation for children if
parent's recalculation does not cause any changes.

Improves performance on Github where we could avoid dozens of inherited
style calculations that do not produce any visible changes.
2025-01-05 11:31:03 +01:00
Aliaksandr Kalenik
482e5deb85 LibWeb: Further optimize :hover style invalidation
Previously, we optimized hover style invalidation to mark for style
updates only those elements that were matched by :hover selectors in the
last style calculation.

This change takes it a step further by invalidating only the elements
where the set of selectors that use :hover changes after hovered element
is modified. The implementation is as follows:
1. Collect all elements whose styles might be affected by a change in
   the hovered element.
2. Retrieve a list of all selectors that use :hover.
3. Test each selector against each element and record which selectors
   match.
4. Update m_hovered_node to the newly hovered element.
5. Repeat step 3.
6. For each element, compare the previous and current sets of matched
   selectors. If they differ, mark the element for style recalculation.
2025-01-04 20:32:35 +01:00
Aliaksandr Kalenik
ae9257bf3b AK: Define operator== for BitmapView 2025-01-04 20:32:35 +01:00
Aliaksandr Kalenik
e465e922bd LibWeb: Optimize :hover style invalidation
Instead of recalculating styles for all nodes in the common ancestor of
the new and old hovered nodes' subtrees, this change introduces the
following approach:
- While calculating ComputedProperties, a flag is saved if any rule
  applied to an element is affected by the hover state during the
  execution of SelectorEngine::matches().
- When the hovered element changes, styles are marked for recalculation
  only if the flag saved in ComputedProperties indicates that the
  element could be affected by the hover state.
2025-01-04 20:32:35 +01:00
Jaycadox
db58986e5f LibWeb/CSS: Recalculate calc() numeric type when resolving percentages
Previously, `percentage_of` would be called on the previous value,
potentially changing its numeric type, yet this potential change
was never reflected as the old numeric type was always used. Now,
the numeric type will be re-calculated every time after the
percentage is resolved. As well, VERIFY checks have been placed to
uphold the requirements for the numeric types to match what the
actual values are.
2025-01-04 18:47:44 +00:00
Sam Atkins
938ffe183e LibWeb/DOM: Update validate_and_extract to latest spec
The "strictly split" infra algorithm feels like an inefficient way of
doing basically what our existing split() does, except working with
code points instead of bytes. It didn't seem worth it to implement now.
2025-01-04 18:08:15 +00:00
Psychpsyo
33f87288e9 LibWeb: Remove unneeded spec deviation from font loading 2025-01-04 17:58:38 +00:00
Sam Atkins
c60ad5b0b8 LibWeb/DOM: Update node cloning to latest spec
Main difference is that a chunk of the "clone a node" steps are pulled
out into a "clone a single node" algorithm.

Reflects these spec PRs:
https://github.com/whatwg/dom/pull/1332
https://github.com/whatwg/dom/pull/1334

Though this code is quite old so there may also be older spec changes
included here.
2025-01-04 12:14:25 +00:00
Psychpsyo
331b1b22f5 LibWeb: Implement some viewport proximity features 2025-01-04 11:53:39 +00:00
Psychpsyo
8632ce5cdd LibWeb: Hide audio element when controls is not set
When an audio element has no controls attribute,
it should not render at all and take up no space.
2025-01-04 11:47:09 +00:00
Psychpsyo
8f11dfc08a LibWeb: Make select element use option's label, not text content 2025-01-04 11:44:03 +00:00
Tim Ledbetter
8c4e4ec31b LibWeb: Implement OscillatorNode.setPeriodicWave() 2025-01-04 10:12:24 +00:00
Tim Ledbetter
acbae1b118 LibWeb: Set OscillatorNode type in the constructor 2025-01-04 10:12:24 +00:00
Tim Ledbetter
72818300c0 LibWeb: Implement the OscillatorNode.detune attribute 2025-01-04 10:12:24 +00:00
Tim Ledbetter
ed46d247de LibWeb: Initialize OcillatorNode with the correct default options 2025-01-04 10:12:24 +00:00
Shannon Booth
c804d08d34 LibJS: Parse dates like "2025-01-02 14:00:00+0000"
This was getting spammed in the console by a website in the wild.
2025-01-03 14:43:13 -08:00
Feng Yu
57f776fcb7 WebDriver: Actually create a UUID for session_id 2025-01-03 13:15:52 -08:00
Sam Atkins
ed83bb75e9 LibWeb/WebDriver: Use actions queue for undo actions
This reflects part of https://github.com/w3c/webdriver/pull/1853

Also updated to reflect some minor spec text changes.
2025-01-03 13:14:53 -08:00