Commit graph

43349 commits

Author SHA1 Message Date
Timothy Flynn
c917a59abe LibWeb+WebContent: Virtualize PageClient methods needed for all clients 2022-11-24 00:10:56 +00:00
Timothy Flynn
1f08cb7020 LibWeb+WebContent: Move pending dialog handling from PageHost to Page
Currently, all handling of pending dialogs occurs in PageHost. In order
to re-use this functionality to run WebDriver in a headless move, move
it to Page.
2022-11-24 00:10:56 +00:00
Aliaksandr Kalenik
7c00619e47 LibWeb: Use calculate_inner_width to compute min and max widths
Use calculate_inner_width that consider box-sizing in compute_width
to resolve min_width and max_width.
2022-11-23 23:11:39 +01:00
Aliaksandr Kalenik
428db6e766 LibWeb: Return max margin box width from greatest_child_width
Return max margin box width instead of max border box width
from greatest_child_width.

This change fixes:
https://wpt.live/css/CSS2/margin-padding-clear/margin-008.xht
2022-11-23 23:11:39 +01:00
Linus Groh
16f2904443 Meta: Add mattco98's full name to mailmap
This will merge the following two git identities so they are considered
the same:

Matthew Olsson <matthewcolsson@gmail.com>
mattco98 <matthewcolsson@gmail.com>
2022-11-23 17:13:49 +00:00
Andreas Kling
a7ce0509f7 LibJS: Add missing <AK/TypeCasts.h> include in $262Object.cpp 2022-11-23 16:05:59 +00:00
Andreas Kling
15c324a70b Userland+Tests: Remove a few more LibJS/{AST.h,Parser.h} includes 2022-11-23 16:05:59 +00:00
Andreas Kling
3503c658fb LibJS+LibWeb: Move JS::ModuleRequest to its own header file
This allows us to not include LibJS/AST.h in a couple more places.
2022-11-23 16:05:59 +00:00
Andreas Kling
38c7fdaac1 LibWeb: Avoid including LibJS/Parser.h in a handful of cpp files 2022-11-23 16:05:59 +00:00
Andreas Kling
6dbca785d1 LibJS: Make AsyncFunctionConstructor.h not include AST.h 2022-11-23 16:05:59 +00:00
Andreas Kling
3f1ffc2b94 LibJS: Remove unnecessary AST.h include in a handful of cpp files 2022-11-23 16:05:59 +00:00
Andreas Kling
71067cbc6c LibJS+LibWeb: Make Runtime/AbstractOperations.h not include AST.h
This led to considerable fallout and many files had to be patched with
now-missing include statements.
2022-11-23 16:05:59 +00:00
Andreas Kling
b81816a539 LibJS+LibWeb: Make CyclicModule.h not include AST.h
This led to some fallout as many things in LibJS and LibWeb were pulling
in other things via CyclicModule.h
2022-11-23 16:05:59 +00:00
Andreas Kling
d16b808e71 LibJS: Make ECMAScriptFunctionObject.h not include AST.h 2022-11-23 16:05:59 +00:00
Andreas Kling
835d7aac96 LibJS: Make FunctionNode::Parameter be a standalone FunctionParameter
This will allow us to forward declare it and avoid including AST.h in a
number of places.
2022-11-23 16:05:59 +00:00
Andreas Kling
2a531efc5d LibJS: Make FunctionEnvironment not include ECMAScriptFunctionObject.h 2022-11-23 16:05:59 +00:00
Andreas Kling
97b5f4814e LibJS: Make SourceTextModule.h not include AST.h or Parser.h 2022-11-23 16:05:59 +00:00
Andreas Kling
65e7c58990 LibJS: Make Script.h not include AST.h 2022-11-23 16:05:59 +00:00
Andreas Kling
8cb6484f6c LibJS: Make Script.h not include Parser.h 2022-11-23 16:05:59 +00:00
Andreas Kling
e6331031c4 LibJS: Make Parser::Error a standalone ParserError class
This allows us to forward declare it and reduce the number of things
that need to include Parser.h.
2022-11-23 16:05:59 +00:00
Andreas Kling
e0916dbb35 LibJS: Move {Import,Export}Entry out of {Import,Export}Statement
By making these be standalone instead of nested structs, we can forward
declare them. This will allow us to stop including AST.h in some places.
2022-11-23 16:05:59 +00:00
Andreas Kling
27e0f56c90 LibJS: Make CyclicModule.h not include AST.h 2022-11-23 16:05:59 +00:00
Andreas Kling
1a30e77001 LibJS: Make Interpreter.h not include AST.h 2022-11-23 16:05:59 +00:00
Andreas Kling
ac417f3304 LibJS: Make RegExpObject.h not include AST.h 2022-11-23 16:05:59 +00:00
Andreas Kling
874ce8b4d0 LibJS: Make DeclarativeEnvironment not include AST.h 2022-11-23 16:05:59 +00:00
Andreas Kling
9ff02ad42c LibJS: Make AsyncGenerator not include AsyncGeneratorRequest.h 2022-11-23 16:05:59 +00:00
Andreas Kling
58feae8b60 LibJS: Make CyclicModule.h not include PromiseCapability.h 2022-11-23 16:05:59 +00:00
Andreas Kling
96cbf368bd LibJS: Move JobCallback functions out-of-line
This allows JobCallback.h to not include Runtime/AbstractOperations.h
and FunctionObject.h.
2022-11-23 16:05:59 +00:00
kleines Filmröllchen
20e51025bb Ports/SDL2: Rename LibGUI Window function in accordance with 5d56756 2022-11-23 15:06:15 +01:00
Aliaksandr Kalenik
0ca1af00e7 LibWeb: Try to place out-of-flow blocks only in anonymous blocks
This change makes out-of-flow blocks to be considered for joining
only to anonymous blocks that have inline children. It finally
solved the problem that out-of-flow break anonymous blocks into
chunks causing wrong layout without regressing Acid2.
2022-11-23 15:05:57 +01:00
implicitfield
e277185eb1 LibArchive: Do not assert if the provided stream cannot be discarded
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=52498
2022-11-23 11:19:16 +01:00
implicitfield
ee0c9ed87b LibArchive: Simplify error handling 2022-11-23 11:19:16 +01:00
Andreas Kling
0f1f925532 LibJS: Shrink Identifier's environment coordinate cache
This patch does two things:

- We now use u32 instead of size_t for the hops and index fields
  in EnvironmentCoordinate. This means we're limited to an environment
  nesting level and variable count of 4Gs respectively.

- Instead of wrapping it in an Optional, EnvironmentCoordinate now has
  a custom valid/invalid state using a magic marker value.

These two changes reduce the size of Identifier by 16 bytes. :^)
2022-11-22 21:13:35 +01:00
Andreas Kling
76f438eb3e LibJS: Remove unused "lexical argument index" metadata from Identifier
This shrinks Identifier by 16 bytes. :^)
2022-11-22 21:13:35 +01:00
Andreas Kling
b0b022507b LibJS: Reduce AST memory usage by shrink-wrapping source range info
Before this change, each AST node had a 64-byte SourceRange member.
This SourceRange had the following layout:

    filename:       StringView (16 bytes)
    start:          Position (24 bytes)
    end:            Position (24 bytes)

The Position structs have { line, column, offset }, all members size_t.

To reduce memory consumption, AST nodes now only store the following:

    source_code:    NonnullRefPtr<SourceCode> (8 bytes)
    start_offset:   u32 (4 bytes)
    end_offset:     u32 (4 bytes)

SourceCode is a new ref-counted data structure that keeps the filename
and original parsed source code in a single location, and all AST nodes
have a pointer to it.

The start_offset and end_offset can be turned into (line, column) when
necessary by calling SourceCode::range_from_offsets(). This will walk
the source code string and compute line/column numbers on the fly, so
it's not necessarily fast, but it should be rare since this information
is primarily used for diagnostics and exception stack traces.

With this, ASTNode shrinks from 80 bytes to 32 bytes. This gives us a
~23% reduction in memory usage when loading twitter.com/awesomekling
(330 MiB before, 253 MiB after!) :^)
2022-11-22 21:13:35 +01:00
Aliaksandr Kalenik
3d74d72bcb LibWeb: Do not try to join floats into anonymous block
Making floats to join anonymous block caused regressions in
Acid2 Test so let's leave it to be only absolute blocks who
might be joined into anonymous block when possible.
2022-11-22 21:13:01 +01:00
Aliaksandr Kalenik
aa08c825ec LibWeb: Support box-sizing in BFC
Add support for box-sizing in block formatting context, support
for Flex Formatting Context and Grid Formatting Context is missing
2022-11-22 12:43:36 +01:00
Names4Noobs
610f1a5aab 3DFileViewer: Propagate key events to the window
Before this, shortcuts would not work due to key events not
being propagated to the window.
2022-11-22 11:23:44 +00:00
martinfalisse
0c577b4b3b Base: Add test for multiple line names in CSS Grid 2022-11-21 21:48:25 +00:00
martinfalisse
513a123728 LibWeb: Handle multiple line names in the CSS Grid
Prevent crashing when multiple line names are declared in the
grid-template-* CSS properties by skipping over the character separating
each line name.
2022-11-21 21:48:25 +00:00
Andreas Kling
849499988e LibJS+LibWeb: Make JS::ExecutionContext protect its Web::HTML::ESO owner
We can't be nuking the ESO while its owned execution context is still on
the VM's execution context stack, as that may lead to a use-after-free.

This patch solves this by adding a `context_owner` field to each context
and treating it as a GC root.
2022-11-21 19:22:09 +00:00
Timothy Flynn
1fdce71483 WebContent: Implement WebDriver's implicit timeout for finding elements 2022-11-21 18:54:22 +00:00
Timothy Flynn
297186c68a WebContent: Don't assume start nodes for finding elements remain valid
When timeouts are implemented, the start node used to find elements may
not remain valid for the entire duration of the timeout. For example,
the active document element may change, or the start node may be removed
from the DOM.

To handle this, we will need to re-evaluate the start node on each
iteration of the find() operation. This patch wraps the steps to do so
in a lambda to be executed on each iteration.
2022-11-21 18:54:22 +00:00
Timothy Flynn
061bca99a9 AK: Define a convenience alias for a Function's return type
This is nice when the return type is long and needs to be specified as
a lambda's return type many times to resolve ambiguity.
2022-11-21 18:54:22 +00:00
Baitinq
2f16198bd6 LibWeb: Remove unused should_invalidate_styles_on_attribute_changes()
This getter and setter were previously labelled as a "hack" and used to
disable style invalidation on attribute changes during the HTML parsing
phase (as it caused big sites's loading to be slow). These functions
are currently not used, so they can be removed:^)
2022-11-21 10:12:07 +01:00
Andreas Kling
e54ae1bd11 LibWeb: Don't implement bogus assertion in prepare-the-script-element
The HTML spec is asking us to make a possibly-bogus assertion, so let's
disable it for now.

Spec bug: https://github.com/whatwg/html/issues/8534
2022-11-21 10:08:50 +01:00
Andreas Kling
b21b27fda3 LibWeb: Update the HTML parser part that deals with text in <script>
This commit adds inline spec comments to the part of the parser that
ends up calling HTMLScriptElement::prepare().

The code is tweaked to match the spec more closely.
2022-11-21 10:08:50 +01:00
Andreas Kling
1aac1085b3 LibWeb: Update HTMLScriptElement prepare and execute to latest HTML spec
The net result is some nice simplification of the prepare algorithm
and a bit of initial scaffolding for import maps support.
2022-11-21 10:08:50 +01:00
Andreas Kling
7d45927d41 LibWeb: Rename HTMLScriptElement "non-blocking" to "force async"
This has been renamed in the spec, so let's do it here too.
2022-11-21 10:08:50 +01:00
Andreas Kling
7b9138be55 LibWeb: Add spec links to HTMLScriptElement member variables
This makes it much easier to see which members represent something in
the spec, and which ones are LibWeb implementation details.
2022-11-21 10:08:50 +01:00