Commit graph

10840 commits

Author SHA1 Message Date
FrHun
72139e1262 LibGUI: Add content margins
Introduce the basic interface through which widgets can define a
rect relative to which Layout margins are now applied.
2021-11-03 16:13:19 +01:00
FrHun
8249ea792e LibGUI+FileManager: Clarify Widget margins name
Even though they are called content_margins,
they are actually only ever used to determine where
a Widget is supposed to be grabbable.
So all methods and members are renamed accordingly.
2021-11-03 16:13:19 +01:00
FrHun
a261e4d9d5 LibGUI+Settings: Remove superfluous margin sets
The margin set is completely superfluous, because it only ever affects
grabbing (in splitters), which is never used for these classes.
2021-11-03 16:13:19 +01:00
FrHun
a08685b9a4 LibGUI: Add utility functions to Margins 2021-11-03 16:13:19 +01:00
Luke Wilde
e42431ec7c LibJS: Implement Temporal.PlainDateTime.prototype.toJSON 2021-11-03 11:03:30 +01:00
Luke Wilde
2a98b521b4 LibJS: Implement Temporal.PlainDateTime.prototype.toLocaleString 2021-11-03 11:03:30 +01:00
Luke Wilde
b2bbd4d2b8 LibJS: Implement Temporal.PlainDateTime.prototype.toString 2021-11-03 11:03:30 +01:00
kleines Filmröllchen
f922ffb032 LibGUI: Make ComboBox text editor release focus when Escape is pressed 2021-11-03 10:48:25 +01:00
kleines Filmröllchen
1349b8b10f LibGUI: Make ComboBox report on_change for set_selected_index
As navigate and navigate_relative also do this, it seems reasonable to
have it here.
2021-11-03 10:48:25 +01:00
Andreas Kling
642915215f LibWeb: Size non-loaded <img> to fit the replacement (alt) text
We achieve this by simply setting the intrinsic size to the size needed
to render the replacement text.

This fixes a long-standing issue where non-loaded images would default
to the goofy-looking 300x150 fallback size for replaced elements.
2021-11-03 10:27:23 +01:00
Andreas Kling
409b20e316 LibMarkdown: Allow nested links
This fixes an issue where the linked images in our README.md didn't
get turned into images.
2021-11-03 10:21:50 +01:00
sin-ack
edb3e71c1b WindowServer: Add missing window_was_constructed call
In 2e6bb987a3 the "did_construct" API in
Core::Object was removed, since it had only one user. For a replacement,
the Window would manually call the frame's "frame_was_constructed"
method. However, WindowServer::Window has two constructors, and only one
of them called this method. This caused windows to spawn without
buttons and various other breakage that spawned from this.
2021-11-03 09:05:09 +01:00
Ben Wiederhake
0e3397aabe WindowServer: Fix visibility of WindowSwitcher constructor
Derivatives of Core::Object should be constructed through
ClassName::construct(), to avoid handling ref-counted objects with
refcount zero. Fixing the visibility means that misuses like this are
more difficult.

This commit is separate from the other Servives changes because it
required additional adaption of the code. Note that the old code did
precisely what these changes try to prevent: Create and handle a
ref-counted object with a refcount of zero.
2021-11-02 22:56:53 +01:00
Ben Wiederhake
52a1ff4d4b LibDSP+Piano: Fix visibility of Object-derivative constructors
Derivatives of Core::Object should be constructed through
ClassName::construct(), to avoid handling ref-counted objects with
refcount zero. Fixing the visibility means that misuses like this are
more difficult.

This commit is separate from the other Applications/Libraries changes
because it required additional adaption of the code. Note that the old
code did precisely what these changes try to prevent: Create and handle
a ref-counted object with a refcount of zero.
2021-11-02 22:56:53 +01:00
Ben Wiederhake
25032a02aa AudioServer: Fix visibility of Object-derivative constructors
Derivatives of Core::Object should be constructed through
ClassName::construct(), to avoid handling ref-counted objects with
refcount zero. Fixing the visibility means that misuses like this are
more difficult.

This commit is separate from the other Servives changes because it
required additional adaption of the code. Note that the old code did
precisely what these changes try to prevent: Create and handle a
ref-counted object with a refcount of zero.
2021-11-02 22:56:53 +01:00
Ben Wiederhake
4e55d649d7 Services: Fix visibility of Object-derivative constructors
Derivatives of Core::Object should be constructed through
ClassName::construct(), to avoid handling ref-counted objects with
refcount zero. Fixing the visibility means that misuses like this are
more difficult.
2021-11-02 22:56:53 +01:00
Ben Wiederhake
b3e9a4e603 Libraries: Fix visibility of Object-derivative constructors
Derivatives of Core::Object should be constructed through
ClassName::construct(), to avoid handling ref-counted objects with
refcount zero. Fixing the visibility means that misuses like this are
more difficult.
2021-11-02 22:56:53 +01:00
Ben Wiederhake
3796d417e0 Demos+DevTools+Games: Fix visibility of Object-derivative constructors
Derivatives of Core::Object should be constructed through
ClassName::construct(), to avoid handling ref-counted objects with
refcount zero. Fixing the visibility means that misuses like this are
more difficult.
2021-11-02 22:56:53 +01:00
Ben Wiederhake
465af4c4d4 Applications: Fix visibility of Object-derivative constructors
Derivatives of Core::Object should be constructed through
ClassName::construct(), to avoid handling ref-counted objects with
refcount zero. Fixing the visibility means that misuses like this are
more difficult.
2021-11-02 22:56:53 +01:00
Ben Wiederhake
6b75a4dfc3 Everywhere: Mark overridden methods 'override'
This is good practice, and fixes some IDE warnings.
2021-11-02 22:56:53 +01:00
Ben Wiederhake
2e6bb987a3 AK+WindowServer: Remove did_construct() framework used only once
There is also make_ref_counted(), which does not call did_construct(),
so the method was not guaranteed to be run. Since there is only a single
user, and `WindowServer::Window` is a final class anyway (so there is no
need to separate the constructor and post-constructor phases), let's get
rid of this concept.

(The following commits reduce the opportunities to call
make_ref_counted, but still.)
2021-11-02 22:56:53 +01:00
Andreas Kling
68c8d23e39 LibWeb+Browser: Show DOM comments with syntax_comment color in inspector
This required a hack since models can't return a color role directly
from data(). I've added a FIXME about it.
2021-11-02 22:30:06 +01:00
Andreas Kling
5088846606 LibWeb: Show DOM comment contents in DOM inspector 2021-11-02 22:30:06 +01:00
Andreas Kling
5db51d85a3 LibWeb: Hide uninteresting whitespace text nodes from DOM inspector
Use a simple heuristic to exclude uninteresting whitespace and
de-clutter the inspector's DOM tree.

Uninteresting whitespace is currently one of these:
- Non-rendered whitespace-only text nodes
- Rendered whitespace-only text nodes between block-level elements
2021-11-02 22:30:06 +01:00
Luke Wilde
b83e3fd01d LibJS: Implement Temporal.PlainTime.prototype.round 2021-11-02 21:42:40 +01:00
Idan Horowitz
853fab352d LibJS: Convert the InitializeReferencedBinding AO to ThrowCompletionOr 2021-11-02 19:48:35 +01:00
Idan Horowitz
1aaaf521b8 LibJS: Convert the PutValue AO to ThrowCompletionOr 2021-11-02 19:48:35 +01:00
Idan Horowitz
390a04a985 LibJS: Convert the GetValue AO to ThrowCompletionOr 2021-11-02 19:48:35 +01:00
Idan Horowitz
d73b258874 LibJS: Convert reference deletion to ThrowCompletionOr 2021-11-02 19:48:35 +01:00
Linus Groh
330ac1e5ad LibJS: Implement Temporal.PlainTime.prototype.toZonedDateTime() 2021-11-02 18:40:37 +01:00
Linus Groh
070f056926 LibJS: Implement Temporal.PlainDateTime.prototype.toZonedDateTime() 2021-11-02 18:40:37 +01:00
Linus Groh
e27bb94038 LibJS: Implement Temporal.PlainDate.prototype.toZonedDateTime() 2021-11-02 18:40:37 +01:00
thislooksfun
fc411695c7 LibGUI: Keep autocomplete open after applying 'layout: ' 2021-11-02 17:53:22 +01:00
thislooksfun
7a2c8452f1 LibGUI: Don't re-trigger the autocomplete box when the timer fires
Previously there was a situation where the autocomplete box would
appear to "jump" to the side. This was due to the following race
condition:

1. Start typing, thus triggering the autocomplete timer to start
2. Manually trigger autocomplete before the timer finishes
3. Continue typing
4. The autocomplete timer now fires

When the timer fires it causes the autocomplete box to show, which, if
it is already shown, has the effect of moving the box to the current
cursor position.
2021-11-02 17:53:22 +01:00
thislooksfun
8462234208 HackStudio: Don't close autocomplete after applying #include directories 2021-11-02 17:53:22 +01:00
thislooksfun
d5baf1c1fa LibGUI: Allow autocomplete to stay open after applying
Previously the autocomplete box would always close after applying a
suggestion. This is the desired behavior in almost all cases, but there
are some situations (like autocompleting paths) where it would be nicer
to keep the autocomplete box open after applying the suggestion.
2021-11-02 17:53:22 +01:00
thislooksfun
352f593958 LibGUI: Add and use TextEditor::hide_autocomplete()
There were cases where the autocomplete box was being hidden but the
autocomplete timer wasn't being cancelled.
2021-11-02 17:53:22 +01:00
thislooksfun
81f00c0aa8 HackStudio: Remove unused #include
Found this while looking at who uses GUI::AutocompleteProvider.
2021-11-02 17:53:22 +01:00
thislooksfun
aea9ba3b42 LibGUI: Refactor out common code
This is prepping for a future commit.
2021-11-02 17:53:22 +01:00
thislooksfun
713b6badb0 LibGUI: Add AutocompleteProvider::has_suggestions() 2021-11-02 17:53:22 +01:00
thislooksfun
1bf428d296 LibGUI: Add missing #include 2021-11-02 17:53:22 +01:00
thislooksfun
6bd16cc309 LibGUI: Always pre-select the first autocomplete suggestion
Previously we would only pre-select the row the first time the box
was shown, which is not ideal. Now we behave like other editors.
2021-11-02 17:53:22 +01:00
thislooksfun
86ea41970d LibGUI: Hide autocomplete on any event other than typing
Moving the cursor to a different location, by any means, should
dismiss the autocomplete popup. This is the behavior of virtually
every editor/IDE out there, and it is really annoying (and
confusing) when our autocomplete doesn't behave like that.
2021-11-02 17:53:22 +01:00
thislooksfun
0627ed9900 LibGUI: Always show a box when the user requests autocomplete
Previously if there were no suggestions, we simply wouldn't show the
autocomplete popup at all. This is functional, but when there are no
resultes it does leave the user wondering if it actually worked.

Now, if the user requests autocomplete and we do have requests, it
behaves exactly as before, but if there' aren't any we now show a box
with the message "No suggestions" to show the user that we got the
request, there just isn't anything to suggest.
2021-11-02 17:53:22 +01:00
thislooksfun
6c776d267a LibGUI: Remove unnecessary braces 2021-11-02 17:53:22 +01:00
thislooksfun
4e5bf5c138 LibGUI: Abstract out even more duplicated logic 2021-11-02 17:53:22 +01:00
thislooksfun
d4eef0f17d LibGUI: Abstract out and name repeated logic 2021-11-02 17:53:22 +01:00
thislooksfun
d73d044f2b LibGUI: Suggest classes when typing identifiers
We now suggest classes even if the line does not start with an @.
After all, we now have fuzzy matching, so why *shouldn't* "color"
match @GUI::ColorInput as well as background_color?
2021-11-02 17:53:22 +01:00
thislooksfun
22a955b2d7 LibGUI: Abstract out widget and layout class matching 2021-11-02 17:53:22 +01:00
thislooksfun
e1e856132c LibGUI: Don't suggest widgets inside layouts
Having a widget inside a layout is meaningless, so why suggest them in
the first place?
2021-11-02 17:53:22 +01:00