Commit graph

20179 commits

Author SHA1 Message Date
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
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 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
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
Aliaksandr Kalenik 767cdf7b11 LibWeb: Return content box position from calculate_static_position
This change makes calculate_static_position to return content box
for both x and y (at least for the case when children are not inline).
It makes it possible to be consistent about x and y when calculating
box offset inside layout_absolutely_positioned_element.
2022-11-20 21:54:39 +01:00
Jonah b45225dbac LibJS/Temporal: Unroll the loop in to_temporal_time_record
This is an editorial change in the Temporal spec.
See: tc39/proposal-temporal@8e80575
2022-11-20 11:56:56 +00:00
Jonah 00da2e86e6 LibJS/Temporal: Unroll the loop in to_temporal_duration_record
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/8e80575
2022-11-20 11:56:56 +00:00
Jonah 912867526b LibJS/Temporal: Unroll the loop in to_temporal_partial_dictation_record
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/8e80575
2022-11-20 11:56:56 +00:00
Jonah 381b36b83f LibJS/Temporal: Rename ToIntegerWithRounding to ToIntegerIfIntegral
This is an editorial change to the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/1dceb57
2022-11-20 11:56:56 +00:00
Jonah 1cd0b5ad8a LibJS/Temporal: Reorder Tables by Order of Magnitude
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/f2d5642 and
https://github.com/tc39/proposal-temporal/commit/07673d3
2022-11-20 11:56:56 +00:00
Zaggy1024 7aabda37d1 LibVT/LibLine: Delete words when pressing Ctrl+Backspace in Terminal 2022-11-20 03:57:17 +03:30
Andreas Kling f7a252ae85 LibJS: Fix UTF-16 corruption in String.prototype.replace()
We were mistakenly trying to append UTF-16 code units to a StringBuilder
via the append(char) API. This patch fixes that by accumulating the
result in a Vector<u16> instead.

This'll be a bit worse for performance, since we're now doing additional
UTF-16 string conversions, but we're going for correctness at this stage
and can worry about performance later.
2022-11-19 11:30:06 -07:00
Sam Atkins c279fd1097 cksum: Manually count file size instead of using stat()
`stat()` doesn't work for stdin, but this does.
2022-11-19 17:00:10 +00:00
Sam Atkins b8a1d04a49 xml: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins fde9cba2a0 Utilities/w: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins 8d798c2716 utmpupdate: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins 6d7435d251 test-fuzz: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins f7fa88976f sysctl: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins 722879e2b9 strace: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins 4c3d2267db sql: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins f22d7ddd98 shot: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins 84e817a9f2 route: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins 97ef1ac260 pmap: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins bc76a4d787 nproc: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins c8b3e68c6e netstat: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins b5f4e96e71 mount: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins 9d34a1f4a7 md: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins 14ce07dd52 markdown-check: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins ccebf8bf59 man: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins 75208f2333 lsusb: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins 880b35739e lspci: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins 376b5731a2 lsof: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins 9e4689f4c8 lsirq: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins 2be7f9f42d lscpu: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins 03a3b6f91c lsblk: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins 8d7179766a js: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins f6884235e2 LibCore: Add a ConfigFile::open() overload for Core::Stream::File
Core::Stream is already used internally, but ironically you could not
open a ConfigFile using one!
2022-11-19 17:00:10 +00:00
Sam Atkins 678b4983cb json: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins 1d67a1e73f ifconfig: Port to Core::Stream and Core::System 2022-11-19 17:00:10 +00:00
Sam Atkins 78a94cd3b7 headless-browser: Port screenshot output to Core::Stream
As noted in https://github.com/SerenityOS/serenity/issues/15239
`headless-browser` is currently broken, with or without these changes.
2022-11-19 17:00:10 +00:00
Sam Atkins 2228786329 gron: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins c757db9475 gml-format: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins d39552a7b7 fortune: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins 813fc10aae file: Port to Core::Stream
Some nicer way of dealing with `stat` would be good. :thonk:
2022-11-19 17:00:10 +00:00
Sam Atkins 7684e514dd du: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins e08a42acd8 dmesg: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins 37d4e01fc4 diff: Port to Core::Stream
Also switched to calling Core::System::isatty(), and doing so once
instead of per hunk.
2022-11-19 17:00:10 +00:00
Sam Atkins ed6d353cdd df: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins 05c3b48e63 Utilities: Port cpp utilities to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins 39a4f1560b copy: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins 6763e1bd60 comm: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins 8ed5403d8c comm: Stop skipping a line in the output
Because of how we output lines in the loop above, if we leave that loop
when the last line was not the same in both files, then either
`file1_line` or `file2_line` has not been output yet.
`process_remaining()` does not print that line either, since it
immediately reads a new line. So, output the previously-missing line
before we call that. :^)
2022-11-19 17:00:10 +00:00
Sam Atkins 83366e2b2e cksum: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins d071a93047 base64: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins 5a0c298074 arp: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins 4ad1695c78 WebContent: Add $() and $$() functions to browser console
These are based on the ones in Firefox:

`$(selector, element = document)`:
    Equivalent to `element.querySelector(selector)`.

`$$(selector, element = document)`:
    Equivalent to `element.querySelectorAll(selector)`.
2022-11-19 16:56:31 +00:00
Sam Atkins c793beb0cc WebContent: Add $_ variable to browser console
This holds the return value of the expression that was last entered into
the browser console. If that last expression returned an error of some
kind, `$_` will be `undefined`. This matches the behaviour in Firefox.
2022-11-19 16:56:31 +00:00
Sam Atkins 3ec13fdb86 WebContent: Rename $0 getter and use global object instead of this
Using the global object works consistently in native accessors and
native functions, so changing this for consistency.
2022-11-19 16:56:31 +00:00
Sam Atkins f9c9506997 WebContent: Create a separate realm for JS console input
This allows us to expose extra functions and properties to the console,
such as `$0`, without them being available to website scripts.

`ConsoleEnvironmentSettingsObject` is basically a stub, since we require
an `EnvironmentSettingsObject` but it has abstract methods.
2022-11-19 16:56:31 +00:00
Timothy Flynn 9782660cb6 LibWebView: Update OOPWV's URL when a page starts/finishes loading
If the page's URL is changed from within the WebContent process (e.g.
window.location.href is set from JavaScript, or a navigation is started
from WebDriver), we would not store the URL at all within OOPWV. This
prevented actions like reloading from working properly, as the browser
would reload whatever URL was previously entered in the URL box.
2022-11-19 16:56:02 +00:00
thankyouverycool 325061b0e4 WindowServer: Add misbehavior restriction for Blocking modals
Two Blocking modals in the same modal chain which aren't descended
one from the other will block each other's input rendering the chain
noninteractive. This has caused confusion in the past for builders so
this warning makes the behavior explicitly forbidden.
2022-11-19 16:04:42 +01:00
thankyouverycool ef7d9c0166 LibGUI: Disallow shortcut propagation in Blocking modals and Popups
This restriction is already present for mouse shortcuts but was
forgotten in the recent key event refactor.
2022-11-19 16:04:42 +01:00
thankyouverycool 59e10d5283 WindowServer: Don't compute title usernames for frameless Windows
This was causing a slight delay when opening ComboBox ListViews.
As an easy first optimization, don't bother computing this at all
for frameless windows and those not type Normal.
2022-11-19 16:04:42 +01:00
thankyouverycool 4ba20f08c7 LibGUI: Don't search ComboBox Windows when holding a mod key 2022-11-19 16:04:42 +01:00
thankyouverycool 5c923977b7 LibGUI: Always close() Dialogs no matter the execution result
Fixes Blocking modal race conditions when new windows are created
in the same scope as Dialogs.
2022-11-19 16:04:42 +01:00
thankyouverycool 2028fbeae3 LibGUI: Remove redundant event handling in EmojiInputDialog
The Dialog class already handles closing on escape.
2022-11-19 16:04:42 +01:00
thankyouverycool a6581c2aac LibGUI: Paint text selections as active in Popups
And hide TextEditor cursors in active windows when focus is preempted
2022-11-19 16:04:42 +01:00
thankyouverycool f7eb72a8be Terminal+LibVT: Toggle TerminalWidget's focus on input preemption
This prevents Terminal's cursor from blinking when a Popup is open.
2022-11-19 16:04:42 +01:00
thankyouverycool 657ff1cd19 LibGUI: Set focus proxy for CommandPalette's TableView 2022-11-19 16:04:42 +01:00
thankyouverycool 3b18226fcb LibGUI: Let Widgets track their focus proxy delegators
And update them on relevant events.
2022-11-19 16:04:42 +01:00
thankyouverycool 4aa608aa71 LibGUI+Taskbar+Applets+Applications: Set various windows as Popups
Makes the Audio applet, Taskbar clock, CommandPalette, EmojiPicker,
and Assistant work as Popup windows. Popups are frameless, unmovable,
and unresizable by default, in addition to their preemptive function.
Also sets Assistant not to obey widget min size so its search result
area resizes correctly
2022-11-19 16:04:42 +01:00
thankyouverycool 24d299c9c8 LibGUI+WindowServer+Applets+Taskbar: Remove active input concepts
and the CaptureInput mode. They are a source of unneeded complexity
in WindowServer and have proven prone to regressions, so this patch
replaces them with a simple input preemption scheme using Popups.

Popup windows now have ergonomics similar to menus: When open,
a popup preempts all mouse and key events for the entire window
stack; however, they are fragile and will close after WindowServer
swallows the first event outside them. This is similar to how combo
box windows and popups work in the classic Windows DE and has the
added benefit of letting the user click anywhere to dismiss a popup
without having to worry about unwanted interactions with other
widgets.
2022-11-19 16:04:42 +01:00
thankyouverycool 35bd79701c WindowServer: Add request_close_fragile_windows() helper 2022-11-19 16:04:42 +01:00
thankyouverycool c23adeaaf7 WindowServer: Add foremost_popup_window() helper 2022-11-19 16:04:42 +01:00
thankyouverycool 3027cf7e99 LibGUI+WindowServer: Remove InputPreemptor concept
This functionality will be superceded by WindowType:Popups
2022-11-19 16:04:42 +01:00
thankyouverycool 5d567565a4 LibGUI+WindowServer: Replace WindowInput{Enter,Leave} Events
with WindowInput{Preempted,Restored} Events and allow Widgets to save
the state of their focus preemption. As of now, only Popups will
preempt input and trigger these events.
2022-11-19 16:04:42 +01:00
thankyouverycool 901878bad9 LibGUI: Use move_cursor() API for AutocompleteProvider
Fixes failure to update focus rect when moving between items.
2022-11-19 16:04:42 +01:00
thankyouverycool 2c58902939 LibGUI: Use WindowType:Autocomplete for AutocompleteProvider
And fix its inability to focus/resize correctly.
2022-11-19 16:04:42 +01:00
thankyouverycool 1718a40ac7 LibGUI+WindowServer: Add WindowType:Autocomplete and helpers 2022-11-19 16:04:42 +01:00
Julian Offenhäuser 0bc3333740 LibPDF: Parse integer numbers with atoi() instead of strtof()
strtof() produces rounding errors for very large numbers, which we
don't want for integers, as they may have to be precise.
2022-11-19 15:42:08 +01:00
Julian Offenhäuser c2ad29c85f LibPDF: Implement png predictor decoding for flate filter
For flate and lzw filters, the data can be transformed by this
predictor function to make it compress better. For us this means that
we have to undo this step in order to get the right result.

Although this feature is meant for images, I found at least a few
documents that use it all over the place, making this step very
important.
2022-11-19 15:42:08 +01:00
Julian Offenhäuser 4bd79338e8 LibPDF: Fix off-by-one error in Reader::remaining() 2022-11-19 15:42:08 +01:00
Julian Offenhäuser 4b1a72ff7a LibPDF: Fix loop condition in parse_xref_stream()
We previously compared two unrelated values to determine if we parsed
the xref table to completion. We now check if we added every subsection
instead, and double check to make sure we never read past the end.
2022-11-19 15:42:08 +01:00
Julian Offenhäuser a17a23a3f0 LibPDF: Make some variable names in parse_xref_stream() more clear
I found these to be a bit misleading.
2022-11-19 15:42:08 +01:00
Julian Offenhäuser f926dfe36b LibPDF: Implement the DCT filter
This filter basically tells us that we are dealing with a JPEG.
Note that by serializing the resulting image we assume that this filter
is the last one in the chain, everything else would be highly unlikely.
2022-11-19 15:42:08 +01:00
Julian Offenhäuser baaf42360e LibPDF: Derive alternate ICC color space from the number of components
We currently don't support ICC color spaces and fall back to a "simple"
one instead.

If no alternative is specified however, we are allowed to pick the
closest match based on the number of color components.
2022-11-19 15:42:08 +01:00
Julian Offenhäuser 16ed407c01 LibPDF: Support cascading stream filters
You can specify multiple filters as an array, where each one is fed the
output of the one before it.
2022-11-19 15:42:08 +01:00
Julian Offenhäuser becd648a78 LibPDF: Parse hexadecimal values in name objects correctly 2022-11-19 15:42:08 +01:00
Julian Offenhäuser 0308300b78 PDFViewer: Take the mousewheel delta into account for scrolling
We now respect the system-wide setting for scroll speed, where we would
previously use a fixed step.
2022-11-19 15:42:08 +01:00
Julian Offenhäuser 9b1331a984 PDFViewer: Simplify user-facing error messages
We now show a simple, if less helpful, message to the user and print
the verbose error message to serial instead.
2022-11-19 15:42:08 +01:00
Julian Offenhäuser e782d03f96 PDFViewer: Invalidate document when a page fails to load
This fixes an issue where we would show an error message on every
subsequent paint event, making it impossible to close or use the
application further.

Some more architectural work is needed if we want to invalidate the
sidebar entries as well.
2022-11-19 15:42:08 +01:00
thankyouverycool ef30073127 LibGUI: Let Delete remove selections greater than 1 in GlyphMapWidget
Updates keydown_event() to work with the new bubbling mechanism
for action shortcuts.
2022-11-19 15:41:09 +01:00
thankyouverycool 92a75ccaed FontEditor: Include file basename in error messages when available
And write messages in the [action] failed: [error] format to match
common error message formatting elsewhere in Userland.
2022-11-19 15:41:09 +01:00
thankyouverycool 9725fd162f LibGUI+Applications: Allow GlyphMapWidget's set_font() to fail
And TRY early during initialization in FontEditor to leave the app
in a valid state on error. Fixes OOM crashes when cloning the original
font for highlight modifications.
2022-11-19 15:41:09 +01:00
thankyouverycool 1be830e3c6 LibGfx: Add pure virtual fallible clone() for Fonts 2022-11-19 15:41:09 +01:00
thankyouverycool d9fb838cf6 LibGUI+FontEditor: Allow system emoji to be toggled in GlyphMapWidget
And remove their red backgrounds when visible to not be confused with
deletion highlights.
2022-11-19 15:41:09 +01:00
thankyouverycool c974e644ec FontEditor: Add Layout options to View menu
Like other apps, FontEditor now organizes widget visibility toggles
under a View->Layout submenu. The main toolbar and the status bar
can now be turned on and off.
2022-11-19 15:41:09 +01:00
thankyouverycool 61d93092cf FontEditor: Remove redundant set_scale() helper 2022-11-19 15:41:09 +01:00
thankyouverycool 8f7dbf363e FontEditor: Remove overzealous find-and-replace ""sv operator 2022-11-19 15:41:09 +01:00
thankyouverycool 894b41ef4d FontEditor: Consolidate GlyphEditor's flip_{horizontally,vertically} 2022-11-19 15:41:09 +01:00
thankyouverycool d867871bda FontEditor: Standardize Gfx::RotationDirections for rotate_90() 2022-11-19 15:41:09 +01:00
Andreas Kling fb00d3ed25 Kernel+lsirq: Track per-CPU IRQ handler call counts
Each GenericInterruptHandler now tracks the number of calls that each
CPU has serviced.

This takes care of a FIXME in the /sys/kernel/interrupts generator.

Also, the lsirq command line tool now displays per-CPU call counts.
2022-11-19 15:39:30 +01:00
MacDue 8a5d2be617 Everywhere: Remove unnecessary mutable attributes from lambdas
These lambdas were marked mutable as they captured a Ptr wrapper
class by value, which then only returned const-qualified references
to the value they point from the previous const pointer operators.

Nothing is actually mutating in the lambdas state here, and now
that the Ptr operators don't add extra const qualifiers these
can be removed.
2022-11-19 14:37:31 +00:00
MacDue 66a428ae03 LibJS+LibWeb: Return non-const types from Ptr class operators
Even if the pointer value is const, the value they point to is not
necessarily const, so these functions should not add the qualifier.

This also removes the redundant non-const implementations of these
operators.
2022-11-19 14:37:31 +00:00
Jamie Mansfield 24caacfe28 LibJS: Add spec comments to TypedArray.prototype.entries 2022-11-19 14:23:28 +00:00
Jamie Mansfield 67ed3e1d93 LibJS: Add spec comments to TypedArray.prototype.keys 2022-11-19 14:23:28 +00:00
Jamie Mansfield db00097700 LibJS: Match spec behaviour in TypedArray.prototype.join
This corrects 2 TRYs to MUSTs and a replaces a call to is_nullish to
is_undefined.
2022-11-19 14:23:28 +00:00
Jamie Mansfield 5341af6225 LibJS: Add spec comments to TypedArray.prototype.join 2022-11-19 14:23:28 +00:00
Jamie Mansfield 70a4e4bd67 LibJS: Add missing assert to TypedArray.prototype.indexOf 2022-11-19 14:23:28 +00:00
Jamie Mansfield 80d2d3812a LibJS: Add spec comments to TypedArray.prototype.indexOf 2022-11-19 14:23:28 +00:00
Jamie Mansfield f1b4412005 LibJS: Add missing assert to TypedArray.prototype.includes 2022-11-19 14:23:28 +00:00
Jamie Mansfield 34f27f76ec LibJS: Add spec comments to TypedArray.prototype.includes 2022-11-19 14:23:28 +00:00
Jamie Mansfield 43456ad708 LibJS: Add spec comments to TypedArray.prototype.reduceRight 2022-11-19 14:23:28 +00:00
Jamie Mansfield 364d873e33 LibJS: Add spec comments to TypedArray.prototype.reduce 2022-11-19 14:23:28 +00:00
Jamie Mansfield d7654aebd7 LibJS: Match spec behaviour in TypedArray.prototype.fill
This just replaces an instance where TRY was used when MUST should
have been, reflecting the difference between ? and ! in the spec.
2022-11-19 14:23:28 +00:00
Jamie Mansfield d492887dcd LibJS: Add spec comments to TypedArray.prototype.fill 2022-11-19 14:23:28 +00:00
Andreas Kling 524baa29e8 LibC+Tests: Simplify getpwuid_r() and getpwnam_r() and add tests
These functions are now implemented in terms of getpwent_r() which
allows us to remove two FIXMEs about global variable shenanigans.

I'm also adding tests for both APIs. :^)
2022-11-19 11:11:13 +01:00
Andreas Kling cc189ce0f3 LibC: Make getpwent_r() behave more like glibc
Two things:
- We now fail with ENOENT when we reach the end of the database.
- Errors are returned directly instead of via errno.
2022-11-19 11:11:13 +01:00
Julian Offenhäuser 7c4f5b58be LibPDF: Use Gfx::PathRasterizer for Adobe Type 1 font rendering
This gives much better visual results than painting the path directly.
It also has the nice side effect that Type 1 fonts will now look much
more similar to TrueType fonts, which use the same class :^)

In addition, we can now cache glyph bitmaps for repeated use.
2022-11-19 11:04:34 +01:00
Julian Offenhäuser 0b6299849e LibGfx: Move TTF::Rasterizer to its own files
The custom TTF path rasterizer is actually generic enough for it to be
used for other fonts. To make this more clear, it now lives on its own
in the "Font" directory.
2022-11-19 11:04:34 +01:00
thankyouverycool d444724d24 ThemeEditor: Update GML and polish interface
Registers the PreviewWidget for addition directly into GML. Fixes
its previous double Frame borders. Also standardizes the Apply and
Reset buttons as DialogButtons and spaces them consistently with
other apps. Gives the TabWidget some tasteful container margins.
2022-11-19 11:04:11 +01:00
thankyouverycool e99277611b Magnifier+ThemeEditor: Use CommonMenus::make_accessibility_menu() 2022-11-19 11:04:11 +01:00
thankyouverycool f31a56d086 LibGUI: Add CommonMenus
Right now only the accessibility menu is shared across apps but
it's a good bit of boilerplate that can be consolidated and will
make adding ColorBlindnessFilters to other widgets trivial.
2022-11-19 11:04:11 +01:00
thankyouverycool 7252a1aa4d LibGUI: Add fallible try_create_checkable() Action 2022-11-19 11:04:11 +01:00
thankyouverycool 032ca748c6 LibGUI: Add ColorFilterer class
Widgets will inherit from ColorFilterer in order to create the
accessibility CommonMenu
2022-11-19 11:04:11 +01:00
thankyouverycool c88d77361c LibGUI: Allow adding previously constructed menus to Menubar 2022-11-19 11:04:11 +01:00
thankyouverycool 9cf93528f5 LibGUI: Accept() mouse wheel events in {Spin,Combo}Boxes
Prevents ScrollableContainerWidgets from moving when changing
values in embedded widgets with the mouse wheel.
2022-11-19 11:04:11 +01:00
thankyouverycool 5c9a140084 LibGUI: Display shortcut text for Alt Graph modifier
Fixes Accessibility menus in ThemeEditor and Magnifier not showing
their complete shortcut combinations
2022-11-19 11:04:11 +01:00
Jamie Mansfield 8363225320 LibJS: Validate TypedArray when calling TypedArray.prototype.values 2022-11-18 17:14:55 +00:00
Jamie Mansfield 1eb15cbaf4 LibJS: Add spec comments to %TypedArray%.prototype.values 2022-11-18 17:14:55 +00:00
Timothy Flynn fa2579ffa9 LibWeb: Implement most of WebDriver capability matching
We don't completely implement version matching, and currently ignore the
"proxy" capability.
2022-11-18 15:30:29 +00:00
Timothy Flynn 021eb04640 LibWeb: Extract out the User-Agent browser name and version
This way we can re-use these elsewhere, and if they ever change again,
those other uses will get updated automatically.
2022-11-18 15:30:29 +00:00
Timothy Flynn 7398fd107c WebContent: Add missing user prompt handling steps
The text on these steps is slightly different than when this was also
done in 0e94904034, so these were missed.
2022-11-18 12:21:57 +00:00
Timothy Flynn 37c4bf3afd WebDriver: Implement all modes for handling the current user prompt 2022-11-18 12:21:57 +00:00
Timothy Flynn adc7977ec7 WebContent+WebDriver: Send the parsed capabilities over to WebContent 2022-11-18 12:21:57 +00:00
Timothy Flynn e0c7b5747d LibWeb+WebDriver: Begin processing and matching WebDriver capabilities
Still some TODOs here:
* We don't handle all capabilities (e.g. proxy)
* We don't match the capabilities against the running browser

But this will parse the capabilities JSON object received from the
WebDriver client.
2022-11-18 12:21:57 +00:00
Timothy Flynn 5b5b563968 LibWeb: Do not reject valid WebDriver script timeouts
The spec's text is pretty awkward here, but the way we've currently
transcribed it to C++ means we reject valid script timeouts. This meant
the following would fail:

    TimeoutsConfiguration config {}; // Default values.
    auto json = timeouts_object(config);
    config = TRY(json_deserialize_as_a_timeouts_configuration(json));
2022-11-18 12:21:57 +00:00
MacDue 862320828f LibWeb: Fix clicking on links
Since ff2f31b LibWeb has segfaulted when clicking on links, as the
browsing context (a GCPtr) in the lambda was captured by reference
and was out of scope by the time the callback fired.
2022-11-18 10:08:43 +00:00
Ali Mohammad Pur 253f4de302 LibRegex: Use spans<4> to avoid allocating small vectors
This path is hit a lot, and alloc/free of this vector was showing up on
profiles, so get rid of it.
2022-11-17 20:13:04 +03:30
Ali Mohammad Pur f1851346d3 LibRegex: Use a copy-on-write vector for fork state 2022-11-17 20:13:04 +03:30
Ali Mohammad Pur cfcd6e770c LibRegex: Don't copy forked results twice 2022-11-17 20:13:04 +03:30
Ali Mohammad Pur 464ac85a1b LibRegex: Avoid copying MatchInput when getting argument descriptions 2022-11-17 20:13:04 +03:30
davidot 73fcbbb0ee LibJS: Give the undeclared private identifier error more precedence
Before this could give the `must be followed by in` error before the
undeclared private identifier error. Fixing the `in` error would not
have resolved the other error so this order makes the errors more
actionable.
2022-11-17 16:05:20 +00:00
davidot 16ac43c9d4 LibJS: Make sure private identifier is valid in optional chain
If we don't check that a private identifier is valid this can break the
assumption that we have a private environment when evaluation the
private identifier. Also an unknown private identifier this should
be a SyntaxError.
2022-11-17 16:05:20 +00:00
davidot 49fc0e2514 LibJS: Add space in output of toEval in test-common.js 2022-11-17 16:05:20 +00:00
davidot 8fa6861f66 LibJS: Initialize functions in spec order
This is only visible with something like `Object.getOwnPropertyNames` on
the global object. All other declaration instantiations put the
functions on an environment making the order invisible.
Note that spec order is not quite tree order as in non-strict mode
functions which get hoisted out of blocks appear before top level
functions.

Co-authored-by: Hendiadyoin1 <leon.a@serenityos.org>
2022-11-17 16:05:20 +00:00
davidot 5ca6e8dca8 LibJS: No longer hoist if parent scope has a function with the same name 2022-11-17 16:05:20 +00:00
davidot 54b2d8c1b8 LibJS: Reuse as_i32 in as_double in JS::Value
Since this might be complicated with NaN boxing keeping it as one
implementation makes this easier to check and change.
2022-11-17 16:05:20 +00:00
davidot 2e24ee49aa LibTest: Fail if the top-level result of running a JS file is an error
Before putting `throw 1;` in a test file did not fail the file, and it
ignored the rest of the file. Now we check the resulting completion from
run and fail if that is an error.
2022-11-17 16:05:20 +00:00
Timothy Flynn f7bb835d09 LibWeb+LibWebView+WebContent+WebDriver: Implement Send Alert Text 2022-11-16 17:23:56 +00:00
Timothy Flynn f9b8742fff LibWeb+WebContent+WebDriver: Implement Get Alert Text 2022-11-16 17:23:56 +00:00
Timothy Flynn 3e7d633954 LibWeb+WebContent+WebDriver: Implement Accept Alert 2022-11-16 17:23:56 +00:00
Timothy Flynn 7cf2feb047 LibWeb+WebContent+WebDriver: Implement Dismiss Alert 2022-11-16 17:23:56 +00:00
Timothy Flynn 159dcb9507 LibWeb: Fix typo in WebDriver section comment 2022-11-16 17:23:56 +00:00
Timothy Flynn 0e94904034 LibWebView+WebContent: Begin handling open user dialogs for WebDriver
The way in which dialogs should be handled is configurable by the driver
capabilities object, which we don't support yet. So this implements just
the default mode to dismiss the dialog and return an error if there is
one open.

In the OOPWV, this means we need to refer to the dialog after it has
been open, so we now hold a pointer to whatever dialog is open.
2022-11-16 17:23:56 +00:00
Timothy Flynn 5b31a3dbc7 LibGUI: Allow more programmatic control over GUI::InputBox
This will be needed for WebDriver, which will require constructing and
controlling dialogs manually. Currently, InputBox will only set its text
value when the OK button is pressed. This changes InputBox to update its
text when done(ExecResult::OK) is invoked in any way.

This also makes the text_value() method public, allows for setting the
text value, and allows for moving-in the initial text value.
2022-11-16 17:23:56 +00:00
Timothy Flynn db4fa36b58 LibGUI: Add GUI::Dialog to the LibGUI forwarding header 2022-11-16 17:23:56 +00:00
Timothy Flynn 364f44d7d8 LibWebView+WebContent: Wait for dialog responses without blocking IPC
Currently, the WebContent process is completely blocked while waiting
for a response to a dialog request. This patch allows the IPC event loop
to continue executing while only blocking the HTML event loop.

This will allow other processes like WebDriver to continue to operate on
the WebContent process while a dialog is open.
2022-11-16 17:23:56 +00:00
Timothy Flynn 4b8729aea6 LibWeb: Add a flag to pause an HTML event loop's execution
This will be used to unblock the WebContent IPC event loop while waiting
for a dialog response.
2022-11-16 17:23:56 +00:00
Andreas Kling 4aeb1ffc12 LibWeb: Add naive layout for SVG foreign objects
We now layout foreign objects as if they form a nested block formatting
context. This probably isn't the most correct way to do this, but it's
a start.
2022-11-16 13:01:21 +01:00
Andreas Kling 0555684682 LibWeb: Sketch out basic support for SVG <foreignObject> elements
This patch adds basic DOM construction and IDL bindings for foreign
objects in SVG trees.
2022-11-16 13:01:21 +01:00
Andreas Kling e9eba66361 LibWeb: Adjust foreignobject to foreignObject in HTML parser
This conversion was missing from the table we copied from the spec
for whatever reason.
2022-11-16 13:01:21 +01:00
Aliaksandr Kalenik 1b5b7e3b01 LibWeb: Solve width for absolute positioned elemenent according to spec
https://www.w3.org/TR/css-position-3/#abs-non-replaced-width
If left and width are auto and right is not auto, then
the width is shrink-to-fit. Then solve for left.
2022-11-16 03:10:26 +01:00
martinfalisse 35094fc744 LibWeb: Make auto-fit compatible with grid-gap
This fixes an error when using auto-fit with grid-gap, as previously
were not taking into account the fact that more columns had been added
to the grid yet the occupation grid had not grown.
2022-11-16 00:53:00 +01:00
martinfalisse 4b6534a26d LibWeb: Use fixed-size tracks for grid gap
Previously were incorrectly initializing the grid gap tracks as were
using the GridSize float constructor, which creates a flexible length.
What is actually wanted is a fixed-size track of a certain size,
indicated in pixels.
2022-11-16 00:53:00 +01:00
Torstennator b2a6066042 LibGfx: Optimize anti-aliased line drawing and stroking
This patch optimizes the drawing of aa-lines by rotating the drawn
rectangle to the direction where the line points. That enables us to
draw non-straight lines with the proper width.
If a aa-line is drawn that is infact a straigt line we now dont plot
those lines with multipe rectangles across the line - insted we draw
straight lines in one go with just one rectangle of proper size.
Stroking of lines has been enhanced to take care of the edges between
two lines with drawing the stroke till the intersections of two
connected lines.
2022-11-15 22:59:25 +01:00