Commit graph

745 commits

Author SHA1 Message Date
Tim Ledbetter
7612f2161c LibWeb: Apply type presentational hint for HTMLOListElement 2025-02-21 01:25:30 +00:00
Andreas Kling
20c859519b LibWeb: Support cellpadding=0 and invalidate table cells when it changes
We were incorrectly treating cellpadding=0 as if the attribute was
missing. This commit fixes it so it behaves as `padding: 0` on cells.

When adding a test, I discovered that we were not invalidating style for
cells when their containing table's cellpadding attribute changed.
So this commit fixes that as well.
2025-02-21 01:16:38 +00:00
Sam Atkins
334c55c999 LibWeb/HTML: Add missing spec text/link for insert_html_element() 2025-02-20 21:55:34 +00:00
Sam Atkins
91fe0e1a1a LibWeb/HTML: Spec-ify reset_the_insertion_mode_appropriately()
It was already to-spec, with a couple of non-behavior-affecting changes,
but now it's clearer that this is the case. :^)
2025-02-20 21:55:34 +00:00
Sam Atkins
d7b4e1f2e3 LibWeb: Add missing text to find_appropriate_place_for_inserting_node() 2025-02-20 21:55:34 +00:00
Psychpsyo
3fbbe9d6a5 LibWeb: Make SelectElement arrow use text color 2025-02-20 14:06:23 -05:00
Tim Ledbetter
ea80167723 LibWeb: Apply HTMLTableSectionElement height presentational hint 2025-02-20 17:11:52 +00:00
Tim Ledbetter
3ffc7bd131 LibWeb: Apply HTMLTableElement bordercolor presentational hint 2025-02-20 17:11:52 +00:00
Andreas Kling
550613e526 LibWeb: Remember when HTML parser should ignore next line feed character
There's a quirk in HTML where the parser should ignore any line feed
character immediately following a `pre` or `textarea` start tag.

This was working fine when we could peek ahead in the input stream and
see the next token, but didn't work in character-at-a-time parsing with
document.write().

This commit adds the "can ignore next line feed character" as a parser
flag that is maintained across invocations, making it work in this
parsing mode as well.

20 new passes in WPT/html/syntax/parsing/ :^)
2025-02-20 14:32:13 +01:00
Andreas Kling
611833429a LibWeb: Lazily merge text nodes when invoking HTML parser incrementally
Instead of always inserting a new text node, we now continue appending
to an extisting text node if the parser's character insertion point is
a suitable text node.

This fixes an issue where multiple invocations of document.write() would
create unnecessary sequences of text nodes. Such sequences are now
merged automatically.

19 new passes in WPT/html/syntax/parsing/ :^)
2025-02-20 14:32:13 +01:00
Andreas Kling
0c0fe09e70 LibWeb: Preserve attributes in "reconstruct active formatting elements"
25 new passes in WPT/html/syntax/parsing/ :^)
2025-02-20 14:32:13 +01:00
Andreas Kling
7549f6842f LibWeb: Ensure "frameset ok" flag is disabled after parsing pre tag
2 new passes in WPT/html/syntax/parsing/ :^)
2025-02-20 14:32:13 +01:00
Andreas Kling
2e59dbd10f LibWeb: Don't process frameset token twice in "in body" insertion mode
We were neglecting to return after handling the `frameset` start tag,
which caused us to process it twice, once properly and once generically.

54 new passes in WPT/html/syntax/parsing/ :^)
2025-02-20 14:32:13 +01:00
Andreas Kling
6f7b865cd1 LibWeb: Let HTML parser handle EOF inserted by document.close()
Before this change, the explicit EOF inserted by document.close() would
instantly abort the parser. This meant that parsing algorithms that ran
as part of the parser unwinding on EOF would never actually run.

591 new passes in WPT/html/syntax/parsing/ :^)

This exposed a problem where the parser would try to insert a root
<html> element on EOF in a document where someone already inserted such
an element via direct DOM manipulation. The parser now gracefully
handles this scenario. It's covered by existing tests (which would
crash without this change.)
2025-02-20 14:32:13 +01:00
AppleFlavored
66bdb825c8 LibWeb: Use create_entry when constructing FormData entry list
When constructing an entry list, XHR::FormDataEntry is created
manually and appended to the entry list instead of using the
spec-defined method of creating an entry.
2025-02-20 03:24:51 +00:00
Shannon Booth
705001483a LibWeb: Make base URL of HTML::Script Optional
This is a null or a URL in the spec, which we were previously
representing through the invalid state of URL.
2025-02-19 08:01:35 -05:00
Shannon Booth
d62cf0a807 Everywhere: Remove some use of the URL constructors
These make it too easy to construct an invalid URL, which makes it
difficult to remove the valid state of URL - which this API relies
on.
2025-02-19 08:01:35 -05:00
Shannon Booth
0b8bcdcbd3 LibWeb: Remove some useless URL validity checks
It is not possible for a URL here to have a value and be invalid.
2025-02-19 08:01:35 -05:00
Shannon Booth
2c8dab36f3 LibWeb: Port EnvironmentSettings URL Parsing to return Optional<URL> 2025-02-19 08:01:35 -05:00
Tim Ledbetter
dd8cca180f LibWeb: Remove unintentional recursion in ValidityState::valid 2025-02-18 21:58:35 +01:00
Andrew Kaster
8760825bb4 LibWeb: Don't store Page on ResourceLoader
We only need a Page for file:// urls. At some point we probably
needed it for other kinds of requests, but the current functionality
doesn't need to store the Page pointer on the ResourceLoader.
2025-02-18 11:26:34 -07:00
Psychpsyo
aa243000f3 LibWeb: Implement TimeRanges and HTMLMediaElement.seekable() 2025-02-18 10:45:32 -07:00
Psychpsyo
3952ff4786 LibWeb: Add a stub for HTMLMediaElement.played() 2025-02-18 10:45:32 -07:00
Psychpsyo
0206697d36 LibWeb: Implement MediaCapabilities.decodingInfo() 2025-02-18 10:18:40 -07:00
Psychpsyo
a8004a77bb LibWeb: Implement setCustomValidity IDL attribute 2025-02-18 10:17:06 -07:00
Tim Ledbetter
0e470d5cdf LibWeb: Apply presentational hints for the HTMLHRElement align attribute 2025-02-18 12:06:44 +01:00
Tim Ledbetter
c217057cfd LibWeb: Apply presentational hints for the HTMLHRElement color attribute 2025-02-18 12:06:44 +01:00
Psychpsyo
83c4e22247 LibWeb: Implement validity IDL attribute 2025-02-18 06:37:11 +00:00
Aliaksandr Kalenik
184ae687c5 LibWeb+WebContent: Remove unused code in BrowsingContext 2025-02-17 19:11:14 -05:00
Gingeh
91e4fb248b LibWeb: Hide unrelated popovers when showing popovers
Also hides decendant popovers when hiding.
Also hides unrelated popovers when showing dialogs.
2025-02-16 19:40:07 +00:00
Psychpsyo
f839f1b44b LibWeb: Make a elements honor base element's target 2025-02-16 09:21:52 +01:00
Psychpsyo
8f79f2137e LibWeb: Fix steps for finding a navigable by target name 2025-02-16 09:03:51 +01:00
Aliaksandr Kalenik
d3c481f71a LibWeb: Schedule input event processing on HTML event loop
Our existing coalescing mechanism for input events didn't prevent
multiple mousemove/mousewheel events from being processed between paint
cycles. Since handling these events can trigger style & layout updates
solely for hit-testing purposes, we might end up doing work that won't
be observable by a user and could be avoided by shceduling input events
processing to happen right before painting the next frame.
2025-02-15 21:09:18 +01:00
Shannon Booth
9072a7caef Everywhere: Use URL::about_XXX factory functions 2025-02-15 17:05:55 +00:00
Shannon Booth
53826995f6 LibURL+LibWeb: Port URL::complete_url to Optional
Removing one more source of the URL::is_valid API.
2025-02-15 17:05:55 +00:00
Andreas Kling
c9cd795257 LibWeb: Don't lose change events on MediaQueryList internal state change
MediaQueryList will now remember if a state change occurred when
evaluating its match state. This memory can then be used by the document
later on when it's updating all queries, to ensure that we don't forget
to fire at least one change event.

This also required plumbing the system visibility state to initial
about:blank documents, since otherwise they would be stuck in "hidden"
state indefinitely and never evaluate their media queries.
2025-02-13 20:52:31 +01:00
Sam Atkins
604400f758 LibWeb/HTML: Ensure HTMLOrSVGElement is BC-connected when running steps 2025-02-13 14:49:19 +00:00
Sam Atkins
b6fc4ec892 LibWeb/HTML: Update radio group when a checked radio button is connected
Corresponds to https://github.com/whatwg/html/pull/10917
2025-02-13 14:49:19 +00:00
stasoid
2be8052f0a LibWeb: Remove assertions about type of IPC::Transport
These constexpr checks and static assertions are really just
loud FIXME comments, and should be comments instead.
2025-02-12 18:42:05 -07:00
Sam Atkins
f4d3a01d32 LibWeb/HTML: Update submit-button-related spec text
Corresponds to 69110cba07
2025-02-12 23:46:05 +00:00
Sam Atkins
a01a3b18f5 LibWeb: Fix CSP navigation request blocking
Corresponds to 304782ca57
2025-02-12 17:05:37 +00:00
Psychpsyo
86859b77a2 LibWeb: Hide hidden select children from dropdown 2025-02-12 13:44:50 +00:00
Sam Atkins
0a805fe7a5 LibWeb/HTML: Add CanvasColorType
We don't implement the affected algorithms, and so the only change to
apply here is adding the dictionary member to IDL.

Corresponds to a5853ca8fa
2025-02-11 10:22:45 +01:00
Shannon Booth
f3ec727555 LibWeb/Bindings: Support returning nullable types in dictionaries
We were previously assuming that dictionary members were always
required when being returned.

This is a bit of a weird case, because unlike _input_ dictionaries
which the spec marks as required, 'result' dictionaries do not seem to
be marked in spec IDL as required. This is still fine from the POV that
the spec is written as it states that we should only be putting the
values into the dictionary if the value exists.

We could do this through some metaprogramming constexpr type checks.
For example, if the type in our C++ representation was not an
Optional, we can skip the has_value check.

Instead of doing that, change the IDL of the result dictionaries to
annotate these members so that the IDL generator knows this
information up front. While all current cases have every single
member returned or not returned, it is conceivable that the spec
could have a situation that one member is always returned (and
should get marked as required), while the others are optionally
returned. Therefore, this new GenerateAsRequired attribute is
applied for each individual member.
2025-02-10 17:05:15 +00:00
Shannon Booth
03370dc76a LibWeb/HTML: Improve assertion for apply the history step mismatch
This more directly catches the bug we have that causes this
assertion to happen on certain sites and WPT tests.
2025-02-10 15:55:46 +00:00
Sam Atkins
dc58f6567f LibWeb: Support :open for file and color <input> elements 2025-02-10 13:57:36 +00:00
Sam Atkins
52a92b7937 LibWeb/HTML: Extract dialog show_modal() into its own algorithm
Corresponds to https://github.com/whatwg/html/pull/10961
2025-02-10 13:56:59 +00:00
Psychpsyo
14e354bc29 LibWeb: Implement playbackRate 2025-02-10 11:38:02 +00:00
Shannon Booth
7441aa34e4 LibWeb/HTML: Bail from HTML parsing when EOF hit on document.close
This fixes a crash in the included test that regressed in 0adf261,
and is hit by the following HTML:

```html
<body></body>
<script>
  const frame = document.body.appendChild(document.createElement("iframe"));
  frame.contentDocument.open();
  const child = frame.contentDocument.createElement("html")
  const html = frame.contentDocument.appendChild(child);
  frame.contentDocument.close();
</script>
```

I am not 100% sure this is fully the correct fix and there are other
cases which would not work properly. But it's definitely an improvement
to make the confuisingly named 'insert_an_eof' function of the tokenizer
actually do something.
2025-02-09 19:20:09 +00:00
Andreas Kling
39abd75d59 LibWeb: Use invalidation sets for link-related pseudo classes
- :any-link
- :link
- :local-link
2025-02-08 18:11:24 +01:00