The SemanticSyntaxHighlighter uses TokenInfo results from the
language server to provide 'semantic' syntax highlighting, which
provides more fin-grained text spans results.
For example, the SemanticSyntaxHighlighter can color function calls,
member fields references and user-defined types in different colors.
With the simple lexer-only syntax highlighter, all of these tokens were
given the same text highlighting span type.
Since we have to provide immediate highlighting feedback to the user
after each edit and before we get the result for the language server,
we use a heuristic which computes the diff between the current tokens
and the last known tokens with compete semantic information
(We use LibDiff for this).
This heuristic is not very performant, and starts feeling sluggish with
bigger (~200 LOC) files.
A possible future improvement would be only computing the diff for
tokens in text ranges that have changes since the last commit.
Previously, find_declaration_of() only worked for AST nodes of type
Identifier. It now also works for declaration node, member variables
and function parameters.
The TokenInfo struct contains the token's position and a
"semantic type". The semantic type is a more fine-grained token type
than what's in Cpp::Token::Type.
For example, the semantic token type differentiates between a reference
to a variable and to a function parameter. In the normal Token::Type,
both would be Token::Type::Identifier.
Previously, the end position of the Type and Name nodes was incorrect.
It was incorrectly set to the start position of the next unconsumed
token.
This commit adds a previous_token_end() method and uses it to correctly
get the end position for these node types.
Previously, the parent of a parameter's Type node was incorrectly set
to the parent of the Parameter node.
We now set the parent of the parameter's Type node to the Parameter
node itself.
Previously, Declaration::is_member() was just a stub that always
returned false.
It now works by checking whether the parent ASTNode is a declaration
of a struct or a class type.
This ensures that comparison between TypedArray names will be
essentially free (just a pointer comparison), which will allow us to
efficiently implement specification steps like:
"24. If srcType is the same as targetType, then"
efficiently.
This is a naive-but-somewhat-functional initial implementation of
HTML Storage.
Note that there is no persistence yet, everything is in-process only,
and one local Storage object per origin.
`it.is_end()` could be updated to return false for a previously-invalid
iterator after we append a new socket, copy its value out to a local
variable to not hit this behaviour.
This overrides the JS host hooks to follow the spec for queuing
promises, making/calling job callbacks, unhandled promise rejection
handling and FinalizationRegistry queuing.
This also allows us to drop the on_call_stack_emptied hook in
Document::interpreter().
This allows the host of LibJS (notably LibWeb in this case) to override
certain functions such as HostEnqueuePromiseJob, so it can do it's own
thing in certain situations. Notably, LibWeb will override
HostEnqueuePromiseJob to put promise jobs on the microtask queue.
This also makes promise jobs use AK::Function instead of
JS::NativeFunction. This removes the need to go through a JavaScript
function and it more closely matches the spec's idea of "abstract
closures"
This isn't perfect (especially the global object situation in
activate_event_handler), but I believe it's in a much more complete
state now :^)
This fixes the issue of crashing in prepare_for_ordinary_call with the
`i < m_size` crash, as it now uses the IDL callback functions which
requires the Environment Settings Object. The environment settings
object for the callback is fetched at the time the callback is created,
for example, WrapperGenerator gets the incumbent settings object for
the callback at the time of wrapping. This allows us to remove passing
in ScriptExecutionContext into EventTarget's constructor.
With this, we can now drop ScriptExecutionContext.
The new event target implementation requires us to downcast an
EventTarget to a FormAssociatedElement to check if the current Element
EventTarget has a form owner to setup a with scope for the form owner.
This also makes all form associated elements inherit from
FormAssociatedElement where it was previously missing.
https://html.spec.whatwg.org/#form-associated-element
The environment settings object is effectively the context a piece of
script is running under, for example, it contains the origin,
responsible document, realm, global object and event loop for the
current context. This effectively replaces ScriptExecutionContext, but
it cannot be removed in this commit as EventTarget still depends on it.
https://html.spec.whatwg.org/multipage/webappapis.html#environment-settings-object
We also pass whether the shadow goes inside or outside the element. Only
outer shadows are rendered currently, and inner ones may want to be
handled separately from them, as they will never interfere with each
other.
The pattern we've adopted for other multi-value properties is to run in
a loop like this, since that makes it easier to cater for values
appearing in different orders.
Previously windows would end up in awkward positions relative to
the move cursor when dragging between tile types or unmaximizing.
This feels a bit more ergonomic.
VerticallyMaximized tiling replaces set_vertically_maximized() to
take advantage of tiling ergonomics.
Middle-clicking a window's maximize button now tiles vertically;
secondary-clicking tiles horizontally.
Adds Super+Alt+Arrow shortcuts for both. Super+Left/Right tiling
shortcuts now let windows shift between tile types directly.
Previously, different rects were used to restore tiled and maximized
windows, creating edge cases for inconsistent restoration. All states
now restore m_floating_rect, which saves the last valid size and
location of a window while free-floating.
The previous method could block multiple times, leading to a completely
stuck/deadlocked read() call, and it could also consume data without
telling the user about it, which is Not A Good Thing ™️.
This patch makes it block at most once, and fixes loading HTTP pages
with LibHTTP :^)