Commit graph

42786 commits

Author SHA1 Message Date
Linus Groh 3ed1a14371 Browser: Refactor WebDriver flag activation into a single function 2022-11-04 23:38:38 -04:00
Timothy Flynn b0eb45f7c7 WebDriver+Browser: Implement GET /session/{id}/element/{id}/screenshot 2022-11-05 01:10:03 +00:00
Timothy Flynn 3c1c2994f1 LibWebView+WebContent: Add an IPC to take an element screenshot 2022-11-05 01:10:03 +00:00
Timothy Flynn 424e80ee75 LibWebView+WebContent: Add an IPC to scroll an element into view
Note that even though there is no response, this IPC has to be
synchronous to allow all scroll events to trigger before returning to
the calling WebDriver process.
2022-11-05 01:10:03 +00:00
Timothy Flynn 3510fbbea8 WebContent: Abstract calculating an element's absolute rect to a helper 2022-11-05 01:10:03 +00:00
Andreas Kling c79e8aab0a LibWeb: Make ON_WHITESPACE less heavy in HTML tokenizer
Once we know that the current code point is an ASCII character, we can
just check if it's one of the HTML whitespace characters.

Before this patch, we were using the generic StringView::contains(u32)
path that splats a code point into a StringBuilder and then searches
for it with memmem().

This reduces time spent in the HTML tokenizer from 16% to 6% when
loading the ECMA-262 spec.
2022-11-05 00:31:11 +01:00
Andreas Kling b400a34984 LibWeb: Cache the first <base href> (in tree order) in Document
When parsing relative URLs, we have to check the first <base href> in
tree order (if one is available). This was getting *very* costly on
large DOMs with many relative urls.

This patch avoids all that repeated traversal by letting Document cache
the first <base href> and invalidating the cache whenever a <base>
element is added/removed/edited in the DOM.

The browser was stuck doing this for a *very* long time when loading
the ECMA-262 spec, and this removes that problem entirely.
2022-11-05 00:30:10 +01:00
Linus Groh 0aca69853c LibWeb: Add abort algorithm after creating controller in fetch_impl()
This ensures that the controller GCPtr is non-null by the time we
capture a copy of it for the lambda passed to the request signal's
add_abort_algorithm() method. Currently, the VERIFY() would always fail
when aborting the signal. The alternative to this would be adding a cell
setter to Handle, and ensuring that null handles have a HandleImpl as
well; this seems not worth the hassle right now. Thanks to Lubrsi for
catching this!

Co-authored-by: Luke Wilde <lukew@serenityos.org>
2022-11-04 22:35:45 +00:00
Linus Groh 6cd57d4c15 LibWeb: Properly copy method and headers from the input in Request()
We were accidentally copying these from the newly created Request
object's underlying request, to itself. Thanks to Lubrsi for catching
this!

Co-authored-by: Luke Wilde <lukew@serenityos.org>
2022-11-04 22:35:45 +00:00
Smrtnyk 71228a8d86 LibWeb: Bring XHR::open() closer to spec
FIXME addressed in open method:
 10. If async is false, the current global object is a Window object,
 and either this’s timeout is not 0 or this’s response type is not the
 empty string, then throw an "InvalidAccessError" DOMException.
2022-11-04 21:32:18 +00:00
Timothy Flynn 8eec25b7ae LibJS: Use more accurate number-to-string method in Number toExponential 2022-11-04 21:12:10 +00:00
Timothy Flynn 5898db8c0f LibJS: Use more accurate number-to-string method in Number toPrecision 2022-11-04 21:12:10 +00:00
Timothy Flynn d56205f991 LibJS: Use more accurate number-to-string method in Intl.NumberFormat
Intl.NumberFormat only ever wants literal number-to-digits here, without
extra exponential formatting.
2022-11-04 21:12:10 +00:00
Timothy Flynn 9620a092de LibJS: Publicly expose double_to_string and rename it number_to_string
Rename it to match the name used by the spec.

Add an override mode to skip formatting numbers with an exponential sign
(e.g. 1e23). This mode is needed by Number and Intl.NumberFormat, who
don't call out a specific number-to-string method to use (they just say
to make "the String consisting of the digits of n").
2022-11-04 21:12:10 +00:00
Smrtnyk efe82e5c91 LibJS: Rename ToShowCalendarOption to ToCalendarNameOption
This is an editorial change in the Temporal spec.

See: 2c9e2615f7
2022-11-04 21:00:25 +00:00
meiskam 71359ee453 LibCore: Handle resolving executable paths even when PATH is null
This fixes a crash when trying to run `Escalator Terminal` from Run
2022-11-04 11:40:41 -04:00
Andreas Kling 892a3e7d12 LibWeb: Replace <svg> sizing hack with slightly smaller hack
When the <svg> box has a definite size, we use the same size for its
geometry-box descendants. This was using the presence of `width` and
`height` attributes on the <svg> element as evidence that the size was
definite, but this made no sense. We now check if it's actually
definite instead.
2022-11-04 13:06:59 +01:00
Andreas Kling ac329d0a18 LibWeb: Make HTMLIFrameElement.contentWindow return the WindowProxy
This fixes an issue where contentWindow was not accessible immediately
after programmatically creating an iframe element.
2022-11-04 10:38:00 +01:00
Andreas Kling 4de3449ad6 LibWeb: Recurse into block-level children when hit testing a box
Otherwise, we always say you hit the parent, even when you're really
clicking on a child that's visually above the parent.
2022-11-04 10:38:00 +01:00
Andreas Kling 5aeb6fec68 LibWeb: Make hit testing traverse positioned descendants in right order
We were doing a forward traversal in hit testing which led to sometimes
incorrect results when multiple boxes were occupying the same X and Y
coordinate.
2022-11-04 10:38:00 +01:00
Gunnar Beutner f2ccb702e8 Meta: Make file-system resizing work on macOS
Previously we'd fail to execute the resize2fs tool which then results
in us recreating the image from scratch:

resizing disk image...
Image resized.
line 132: /usr/sbin/resize2fs: No such file or directory
failed, not using existing image
done
2022-11-04 09:05:36 +00:00
Timothy Flynn 558901acb4 LibTimeZone: Update to TZDB version 2022f
https://mm.icann.org/pipermail/tz-announce/2022-October/000075.html
2022-11-04 08:56:11 +00:00
Gunnar Beutner 0eb7d1e05c FileManager: Improve error handling when posix_spawn() fails
Previously we'd try to disown() the newly created process even if
posix_spawn() had failed.
2022-11-04 09:47:30 +01:00
Dan Klishch 59e87cc998 AK: Add static_assert to check for effective size of long double 2022-11-03 20:17:09 -06:00
Dan Klishch 56aa21a7dc LibJS: Implement precise double_to_string 2022-11-03 20:17:09 -06:00
Dan Klishch fdc53a5995 AK: Add framework for a unified floating point to string conversion
Currently, the floating point to string conversion is implemented
several times across the codebase. This commit provides a pretty
low-level function to unify all of such conversions. It converts the
given double to a fixed point decimal satisfying a few correctness
criteria.
2022-11-03 20:17:09 -06:00
Dan Klishch 17c9a3e8d9 AK+LibC+LibCrypto: Move FloatExtractor to AK/FloatingPoint.h 2022-11-03 20:17:09 -06:00
Timothy Flynn 2d75229192 WebDriver+Browser: Implement GET /session/{id}/element/{id}/selected 2022-11-03 19:40:43 -04:00
Timothy Flynn 4067138702 LibWebView+WebConent: Add an IPC to get an element's selected state 2022-11-03 19:40:43 -04:00
Timothy Flynn d907fb304e WebDriver: Pass StringView by value
See: 8b1108e485.
2022-11-03 19:40:43 -04:00
Timothy Flynn 92cb67522d WebDriver: Consolidate getting a known connected element to a helper
Instead of verbosely repeating the NOTE and to_int() checks, move this
step to a helper. When we have real connected elements, we can then just
fix this helper.
2022-11-03 19:40:43 -04:00
Luke Wilde ac67077b57 LibJS: Fix length of PlainDateTime.withPlainTime
withPlainTime's argument is optional, so the length of the function is
actually 0.
2022-11-03 21:09:58 +00:00
Luke Wilde b26b18a0bc LibJS: Add timeZoneName: "critical" option to ZonedDateTime.toString()
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/d84937f
2022-11-03 19:15:50 +00:00
Luke Wilde 4a167cfbec LibJS: Add calendarName: "critical" option to toString() methods
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/e715a50
2022-11-03 19:15:50 +00:00
Luke Wilde 192aa75279 LibJS: Align ISO 8601 grammar with annotations from IXDTF
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/c64b844
2022-11-03 19:15:50 +00:00
Timothy Flynn 0f2b4d0aac WebDriver+Browser: Implement GET /session/{id}/element/{id}/enabled 2022-11-03 19:15:43 +00:00
Timothy Flynn 683c99f299 LibWebView+WebConent: Add an IPC to get an element's enabled state 2022-11-03 19:15:43 +00:00
Timothy Flynn 9564f04fa6 Base: Add a disabled button to the button.html test page 2022-11-03 19:15:43 +00:00
Timothy Flynn 08c687ef20 WebDriver+Browser: Implement GET /session/{id}/element/{id}/rect 2022-11-03 19:15:43 +00:00
Timothy Flynn a490bca29b WebDriver: Rename serialize_window_rect to serialize_rect
This won't only be used for "Window" rects.
2022-11-03 19:15:43 +00:00
Timothy Flynn 995f3db384 LibWebView+WebConent: Add an IPC to get an element's absolute rect 2022-11-03 19:15:43 +00:00
Timothy Flynn 77b6d0bf16 WebContent: Add a static helper to find an element by its remote ID
Instead of repeating the same checks for each WebDriver /element
endpoint, add a helper to perform the lookup.
2022-11-03 19:15:43 +00:00
Timothy Flynn 99fc94e138 LibJS: Delegate to NumberFormat for DurationFormat unit formatting
This is a normative change in the Intl.DurationFormat proposal. See:
https://github.com/tc39/proposal-intl-duration-format/commit/12ba9df
2022-11-03 18:37:48 +00:00
Timothy Flynn a5bf32018f LibJS+LibUnicode: Add "microsecond" and "nanosecond" as sanctioned units
This is a normative change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/f627573
2022-11-03 18:37:48 +00:00
Timothy Flynn 8ff0d35386 LibJS: Format sanctioned units such that there is one unit per line
Much easier to manage and view diffs this way, rather than one large
single line. This will soon be the only method in this file, so there's
no concern over taking up too much vertical space here.
2022-11-03 18:37:48 +00:00
Andreas Kling 305cb8a5d1 LibWeb: Treat unresolvable percentage sizes as auto on replaced elements
For replaced elements with percentage width or height, we were treating
them as 0 instead of auto when their containing block had an indefinite
corresponding size.

This produced incorrect layouts in various cases, and although I can't
actually find something about this exact scenario in specs, the new
behavior does match other browsers.
2022-11-03 19:22:40 +01:00
Andreas Kling db318aece0 LibWeb: Move should_treat_{width,height}_as_auto() to FormattingContext
These are not specific to BFC, so let's move them up to the super class
so that other layout classes can use them.
2022-11-03 19:22:40 +01:00
Andreas Kling 5fbe245406 LibWeb: Don't include object addresses in layout tree dumps
I've used this feature less than 3 times, and it's trivial to hack back
in if/when needed. Let's stop cluttering the layout tree dumps.
2022-11-03 18:52:53 +01:00
Xexxa c8b1124e68 Ports: Update serenity-theming use latest commit 490a15a 2022-11-03 17:40:49 +00:00
Nico Weber daeaefad17 Everywhere: Clean up "the the" comment typos 2022-11-03 17:38:32 +00:00