summaryrefslogtreecommitdiff
path: root/Userland
AgeCommit message (Collapse)Author
2022-02-09LibJS: Remove MarkedValueList in favor of MarkedVector<Value> :^)Linus Groh
2022-02-09LibJS: Replace uses of MarkedValueList with MarkedVector<Value>Linus Groh
This is effectively a drop-in replacement.
2022-02-09LibJS: Convert get_iana_time_zone_epoch_value() to MarkedVector<BigInt*>Linus Groh
2022-02-09LibJS: Convert 'possible instants' AOs to MarkedVector<Instant*>Linus Groh
Resolve TODOs suggesting the use of a strongly typed MarkedValueList (a.k.a. MarkedVector<T>) in the following AOs: - get_possible_instants_for() - disambiguate_possible_instants()
2022-02-09LibJS: Let MarkedVector<T> inherit from Vector and handle Cell* + ValueLinus Groh
Note: MarkedVector is still relatively new and has zero users right now, so these changes don't affect any code other than the class itself. Reasons for this are the rather limited API: - Despite the name and unlike MarkedValueList, MarkedVector isn't actually a Vector, it *wraps* a Vector. This means that plenty of convenient APIs are unavailable and have to be exported on the class separately and forwarded to the internal Vector, or need to go through the exposed Span - both not great options. - Exposing append(Cell*) and prepend(Cell*) on the base class means that it was possible to append any Cell type, not just T! All the strong typing guarantees are basically gone, and MarkedVector doesn't do much more than casting Cells to the appropriate type through the exposed Span. All of this combined means that MarkedVector - in its current form - doesn't provide much value over MarkedValueList, and that we have to maintain two separate, yet almost identical classes. Let's fix this! The updated MarkedVector steals various concepts from the existing MarkedValueList, especially the ability to copy. On the other hand, it remains generic enough to handle both Cell* and Value for T, making MarkedValueList effectively redundant :^) Additionally, by inheriting from Vector we get all the current and future APIs without having to select and expose them separately. MarkedVectorBase remains and takes care of communicating creation and destruction of the class to the heap. Visiting the contained values is handled via a pure virtual method gather_roots(), which is being called by the Heap's function of the same name; much like the VM has one. From there, values are added to the roots HashTable if they are cells for T = Value, and unconditionally for any other T. As a small additional improvement the template now also takes an inline_capacity parameter, defaulting to 32, and forwards it to the Vector template; allowing for possible future optimizations of current uses of MarkedValueList, which hard-codes it to 32.
2022-02-09LibC+Kernel: Remove global variable use from snprintf and fprintfAndrew Kaster
The global variable use in these functions is super thread-unsafe and means that any concurrent calls to sprintf or fprintf in a process could race with each other and end up writing unexpected results. We can just replace the function + global variable with a lambda that captures the relevant argument when calling printf_internal instead.
2022-02-09HackStudio: Allow toggling between simple and semantic highlightingItamar
Until it becomes enough stable and performant, semantic highlighting is disabled by default. It can be toggled on via the "Project" menu in HackStudio.
2022-02-09HackStudio: Use the C++ semantic syntax highlighterItamar
HackStudio::Editor will now send a request to get semantic token information to the language server whenever there's a short pause in editing. The result is used by the semantic c++ syntax highlighter to provide better highlighting information.
2022-02-09LibGUI: Add TextEditor::force_rehighlight() methodItamar
2022-02-09LibGfx: Add more syntax-related ColorRolesItamar
2022-02-09LibCpp: Add SemanticSyntaxHighlighterItamar
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.
2022-02-09LibDiff: Flush leftover hunks at the endItamar
This change makes sure that we arrive at the end of the "DP-matrix" and flush any leftover hunks to get a complete diff result.
2022-02-09HackStudio: Add tokens_info_result() and tokens_info_result() IPC callsItamar
These IPC calls are used in the communication with the language server to fetch semantic information about the tokens in a code document.
2022-02-09LanguageServers/Cpp: Make find_declaration_of() more flexibleItamar
Previously, find_declaration_of() only worked for AST nodes of type Identifier. It now also works for declaration node, member variables and function parameters.
2022-02-09LibGUI+HackStudio: Add TokenInfo struct for language-server IPCItamar
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.
2022-02-09LibCpp: Update regressions tests resultsItamar
The LibCpp regression tests results have to be updated after tweaking the token end position calculation logic of some token types.
2022-02-09LibCpp: Fix lexing of IncludePath tokenItamar
Previously, there was a duplicate IncludePath token in the lexing result.
2022-02-09LibCpp: Add Preprocessor:unprocessed_token()Itamar
2022-02-09LibCpp: Add public Parser::tokens() methodItamar
2022-02-09LibCpp: Fix end position calculation for various AST node typesItamar
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.
2022-02-09LibCpp: Fix parent of parameter type nodeItamar
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.
2022-02-09LibCpp: Fix Declaration::is_member()Itamar
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.
2022-02-08LibJS: Compare types instead of sizes in %TypedArray%.prototype.setIdan Horowitz
Just checking for a matching size is not enough, since floats and ints have the same size, but are represented completely differently.
2022-02-08LibJS: Make TypedArray::element_name return FlyString instead of StringIdan Horowitz
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.
2022-02-08LibJS: Implement the missing step 20 in %TypedArray%.prototype.setIdan Horowitz
2022-02-08LibJS: Implement the CloneArrayBuffer AOIdan Horowitz
2022-02-08LibJS: Add spec comments to %TypedArray%.prototype.setIdan Horowitz
2022-02-08Base: Change JSON file icon to add CSS file iconelectrikmilk
Add CSS icon and add replacement JSON icon as the colors conflict. Update HackStudioWidget.cpp
2022-02-08LibWeb: Implement EventHandler::focus_previous_element()Kenneth Myhra
This implements EventHandler::focus_previous_element() so we can cycle backwards through focusable elements on a web page with Shift+Tab.
2022-02-08Browser+LibWeb: Add "Dump Local Storage" item to Browser's Debug menuAndreas Kling
2022-02-08LibWeb: Add Storage interface and window.localStorageAndreas Kling
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.
2022-02-08LibWeb: Allow using Origin as a HashMap keyAndreas Kling
2022-02-08RequestServer: Avoid Vector OOB access in ConnectionCacheAli Mohammad Pur
`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.
2022-02-08LibJS: Fix two typos in commentsLinus Groh
2022-02-08LibWeb: Implement the JS host hooks for promises, job callbacks and moreLuke Wilde
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().
2022-02-08LibJS: Setup host hooks and have promise jobs work out the realmLuke Wilde
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"
2022-02-08LibWeb: Rewrite EventTarget to more closely match the specLuke Wilde
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.
2022-02-08LibWeb: Make FormAssociatedElement inherit from HTMLElementLuke Wilde
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
2022-02-08LibWeb: Introduce the Environment Settings ObjectLuke Wilde
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
2022-02-08LibWeb: Support passing more parameter types to HTML::report_exception()Andreas Kling
We now allow any JS::ThrowCompletion<T>, as well as JS::Completion directly (although we'll VERIFY() that it's a throw completion.)
2022-02-08LibWeb: Fixed disabled checkbox input behaviourRafał Babiarz
Previously disabled checkbox could be checked by clicking on it's label
2022-02-08LibWeb: Incorporate spread-distance into box-shadow renderingSam Atkins
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.
2022-02-08LibWeb: Render multiple box-shadowsSam Atkins
Because why not? :^)
2022-02-08LibWeb: Parse multiple box-shadows :^)Sam Atkins
Again, we don't yet render these (we render nothing) but this gets rid of a decent amount of CSS spam on Discord.
2022-02-08LibWeb: Parse spread-distance and `inset` parts of box-shadowSam Atkins
We do not actually use these when rendering the shadow yet.
2022-02-08LibWeb: Reorganize box-shadow parsing codeSam Atkins
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.
2022-02-08WindowServer: Preserve cursor position when dragging between statesthankyouverycool
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.
2022-02-08WindowServer: Add Vertically/HorizontallyMaximized WindowTileTypesthankyouverycool
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.
2022-02-08WindowServer: Fix comments in WindowManagerthankyouverycool
2022-02-08WindowServer: Unify Window restore rectsthankyouverycool
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.