Commit Graph

10745 Commits

Author SHA1 Message Date
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
thislooksfun
e403796842 LibGUI: Abstract out some duplicated logic for suggesting properties
A lot of the code in this area is duplicated, which is not great. In
fact this also fixes a bug where suggested partially matched props
would include read-only properties, since that check had only been
added to one of the two loops.
2021-11-02 17:53:22 +01:00
thislooksfun
0be3f5b4ae HackStudio: Append a / when completing a directory 2021-11-02 17:53:22 +01:00
thislooksfun
8b3a2cdad9 HackStudio: Correctly handle nested paths
Previously the paths were concatinated incorrectly, so triggering
the autocomplete on `#include "foo/bar"` would never work. Now it
does. :^)
2021-11-02 17:53:22 +01:00
thislooksfun
a6a71869d7 HackStudio: Handle autocomplete inside #include's <> and "" 2021-11-02 17:53:22 +01:00
thislooksfun
4143f6f906 LibGUI: Make sure that children are actually widgets
Previously this section of code would blindly add *anything* as a child
as long as it has been registered as an object. Since there is no
guarentee that those objects are, in fact, Widgets, this feels like a
logical fallacy.

For example, up until this change, this is perfectly valid GML:

```
@GUI::Widget {
    layout: @GUI::VerticalBoxLayout {
    }

    @GUI::VerticalBoxLayout {
    }
}
```

What exactly does it do? Who knows! It doesn't seem to *break*, but I
think we can all agree it shouldn't be valid.

Instead, we now actually verify that the registered class inherets from
GUI::Widget before adding it as a child. We also error if it's not,
which should hopefully help new GML writers from forgetting to write
'layout: ' before the layout definition and being confused as to why
it's not working.
2021-11-02 17:53:22 +01:00
thislooksfun
eb3ca64819 LibGUI: Dynamically process layouts from GML files
There are only two layouts at the moment, but that could (and probably
will) change in the future. Why limit ourselves by hardcoding these
checks when we can do it dynamically instead?
2021-11-02 17:53:22 +01:00
thislooksfun
03b52e26f0 LibGUI: Use fuzzy matching for GML suggestions 2021-11-02 17:53:22 +01:00
thislooksfun
1a3ea0c892 LibGUI: Add myself to the copyright header 2021-11-02 17:53:22 +01:00
thislooksfun
49b4dfd6cd LibGUI: Suggest 'layout' even before the user starts typing 2021-11-02 17:53:22 +01:00
thislooksfun
8863fe5852 LibGUI: Remove unused check
This check was removed as it will now never trigger.

The completion has the suffix ': ' on it, and the key does not.
Therefore if the user has not yet typed the ':', it will not be equal,
and after they do the check on line 167 will fail so the entry won't be
in the list to begin with.
2021-11-02 17:53:22 +01:00
thislooksfun
9a70ae1593 LibGUI: Automatically append ': ' after autocompleted GML properties 2021-11-02 17:53:22 +01:00
thislooksfun
f7f9d09e72 LibGUI: Remove GUI::AutocompleteProvider::Entry::kind
The only code using it was removed in the previous commit.
2021-11-02 17:53:22 +01:00
thislooksfun
f699dbdc3f HackStudio+LibGUI: Handle #include quotes and brackets in the engine
Previously we had a special case in order to auto-append quotes or
angle brackets to #include statements. After the previous commit this
is no longer necessary.
2021-11-02 17:53:22 +01:00
thislooksfun
a5b3c3f85f LibGUI: Allow completion suggestions to fill and display different text
There are times when it is nice to display one suggestion but fill
something different. This lays the groundwork for allowing
GMLAutocompleteProvider to automatically add ': ' to the end of
suggested properties, while keeping the ': ' suffix from cluttering up
the suggestion UI.
2021-11-02 17:53:22 +01:00
thislooksfun
96029a4ac6 LibGUI: Replace the already typed text when autocompleting
This was a great optimization before, but it locks us out of some neat
features, like fuzzy matching.
2021-11-02 17:53:22 +01:00
thislooksfun
f8c98cbf55 LibGUI: Show autocomplete for Layout properties 2021-11-02 17:53:22 +01:00
thislooksfun
b0122744a6 LibGUI: Match layout classes even after you start typing
The previous commit fixed the issue with layout classes not being
suggested at all, but there was still another issue. Once you started
typing the class name a different suggester would take over and only
show widgets. This commit makes it so it still only suggests layouts
in that situation.

This, combined with the last commit, makes autocompleting layouts way
more discoverable and user-friendly. :^)
2021-11-02 17:53:22 +01:00
thislooksfun
f048d16be5 LibGUI: Correctly suggest layout classes
Previously when the GMLAutocompleteProvider was invoked just after the
'layout:' tag it would suggest nothing. This is because Layouts do not
inherit from Widget, so the two checks would always eliminate every
suggestion from the list. This patch makes it always suggest any
(registered) object that inherits from GUI::Layout.

This should make layouts more discoverable and easier to quickly use.
2021-11-02 17:53:22 +01:00
thislooksfun
989c111d65 LibGUI: Remove unnecessary curly braces
Not needed for the commit, but I always try to leave the code nicer
than I found it. :)
2021-11-02 17:53:22 +01:00
thislooksfun
416988cc7f LibGUI: Register layouts with inheritance 2021-11-02 17:53:22 +01:00
thislooksfun
6dc2749795 LibGUI: Register GUI::Layout
This will be used later to check inheritence.
2021-11-02 17:53:22 +01:00
thislooksfun
9cf9e604c3 LibCore: Add REGISTER_ABSTRACT_CORE_OBJECT
This behaves identically to REGISTER_CORE_OBJECT, but the resulting
ObjectClassRegistration's construct() method will always return null.
2021-11-02 17:53:22 +01:00
thislooksfun
c3b0b9057e LibCore+LibGUI: Make ObjectClassRegistration::construct() nullable
This lays the groundwork for allowing the registration of abstract
core objects, which will be needed for improved GML autocomplete.
2021-11-02 17:53:22 +01:00
Linus Groh
0e537e2e1f LibJS/Tests: Fix arg name in Instant.prototype.toZonedDateTime() test
"item", not "items".
2021-11-02 17:51:02 +01:00
Linus Groh
654380c2c2 LibJS: Implement Temporal.PlainDate.prototype.subtract() 2021-11-02 13:29:25 +01:00
Linus Groh
bcd96c80f3 LibJS: Implement Temporal.PlainDate.prototype.add() 2021-11-02 13:29:25 +01:00
Musab Kılıç
4de7b3ad24 PixelPaint: Map color_distance_squared from 0 to 1 2021-11-02 12:20:48 +01:00
Ben Wiederhake
59619572d6 LibThreading: Remove redundant method 2021-11-02 11:07:26 +01:00
Ben Wiederhake
17d95bc1db Utilities: Remove misbehaving-application
This used to be a target to demonstrate a bug in Inspector (#3159).
However, now that the inspection direction has inverted, this no longer
makes any sense.
2021-11-02 11:07:07 +01:00
Linus Groh
07b0aded99 LibJS: Implement Temporal.PlainDateTime.prototype.subtract() 2021-11-02 09:24:35 +01:00
Linus Groh
c4e371b3da LibJS: Implement Temporal.PlainDateTime.prototype.add() 2021-11-02 09:24:35 +01:00
Linus Groh
643a2433db LibJS: Enable Temporal.Calendar.prototype.dateAdd() test that now passes 2021-11-02 09:24:35 +01:00
Linus Groh
d49bbb1da3 LibJS: Implement TODO()'d parts of balance_duration()
Massive :yakstack:, so I understand why it was skipped in the first
place :^)
2021-11-02 09:24:35 +01:00
Luke Wilde
17fd08d752 LibJS: Implement Temporal.PlainTime.prototype.subtract()
a
2021-11-01 23:51:23 +01:00
Luke Wilde
4bf391ff4b LibJS: Implement Temporal.PlainTime.prototype.add() 2021-11-01 23:51:23 +01:00
Linus Groh
97f6c6029f LibJS: Implement Temporal.TimeZone.prototype.getInstantFor() 2021-11-01 21:39:45 +01:00
Ben Wiederhake
70c7861c33 UserspaceEmulator: Avoid special character in pseudo-identifier
In the generated HTML code, '#' gets interpreted as the beginning of a
shell comment, which throws the syntax highlighting off. Regardless,
spelling out the meaning of the '#' might make it more readable.
2021-11-01 21:12:58 +01:00
Ben Wiederhake
ea9f2f80a1 LibCore: Make ArgsParser '--help' description more general
Now that the output may end up in Markdown files (and thus the website),
the help message should no longer be self-referential.
2021-11-01 21:12:58 +01:00
Ben Wiederhake
0372f051e9 LibCore: Enable emitting markdown from ArgsParser
ArgsParser will now automatically look for an environment variable
'ARGSPARSER_EMIT_MARKDOWN', and if it is set to exactly the string "1"
(i.e. mere presence or values like "ON" or "yes" are not enough), then
ArgsParser will emit a Markdown-formatted help message, instead of the
regular help message designed for consumption through a terminal.
2021-11-01 21:12:58 +01:00
Ben Wiederhake
d2f9fee4ab LibMarkdown: Recognize and handle comments
This also improves Commonmark coverage, e.g. it fixes tests
HTML_blocks_ex179_2894..2906 and Lists_ex308_5439..5457.

In other words, we go from 271 out of 652 to 273 out of 652.
2021-11-01 21:12:58 +01:00
Ben Wiederhake
28195032a3 profile: Don't treat '--help' as an error
profile seems to be the only program treating '--help' as an error.
Let's change that.
2021-11-01 21:12:58 +01:00
Ben Wiederhake
b8f11b1bae Everywhere: Remove unused ArgsParser header
Found while trying to enumerate all programs that use ArgsParser.
2021-11-01 21:12:58 +01:00
Ben Wiederhake
4e1318fb0e less: Fix condition to read more data
While mathematically equivalent, the presence of a size_t forces the
comparison to work with size_t's. This means that '-1 < 0' is false,
contrary to the 'mathematically pure' interpretation of the inequality.
2021-11-01 10:55:10 +01:00
Ben Wiederhake
5096f9cff5 hexdump: Avoid using read_all
I like using hexdump to 'have a look' at binary files, for example
/dev/random or /dev/hda. Obviously, this usecase requires that hexdump
tries not to buffer the 'entire' device.
2021-11-01 10:55:10 +01:00
Ben Wiederhake
a5dda0b0c5 hexdump: Make non-ASCII output easier to read
Enclose the ASCII-interpretation in pipes, show non-ASCII bytes as a
dot, and fix the length of the last line.

Note that this makes it more similar to the behavior of many other
implementations.
2021-11-01 10:55:10 +01:00
Rodrigo Tobar
866c9cc1a5 echo: Obey -n when text is empty 2021-11-01 10:47:13 +01:00
Arne Elster
be9a7057ff HexEditor: Give magic constants names
There are a lot of numbers just floating around in the code.
Give them proper names.
2021-11-01 01:48:51 +01:00
Arne Elster
4aab6ff839 HexEditor: Use size_t where applicable
File positions as well as selection positions should be size_t,
as they are never negative and can become quite big.
2021-11-01 01:48:51 +01:00
Arne Elster
6b5456f132 HexEditor: Remove magic color constant for modified bytes
The magic constant does not work together well with themes.
As there does not seem to be a suitable palette color for this,
simply invert the color.
2021-11-01 01:48:51 +01:00
Arne Elster
41edc21a8e HexEditor: Show blinking caret at current position
For better visibility of wether the editing focus is on the hex or the
ascii view, render a blinking caret instead of a solid cell background.
For that to work, it's also necessary to change the way selection works.
The selection shouldn't extend to the current position but up to the
byte before it.
2021-11-01 01:48:51 +01:00
Andreas Kling
248ff8e971 strace: Teach mmap() pretty-printer about more MAP_FOO flags 2021-10-31 21:07:29 +01:00
Andreas Kling
472401a51e Revert "wc: Count last line even if it doesn't end in newline"
This reverts commit f356c4ab91.

According to Dr. POSIX, `wc -l` should print the number of *newlines*
in the input.
2021-10-31 21:07:29 +01:00
Andreas Kling
aff2b42f82 UserspaceEmulator: Fix inconsistent log formatting
Remove some extra { and } around the PID in log output that weren't used
consistently in all logging.
2021-10-31 21:07:29 +01:00
Timothy Flynn
95e492de59 LibWeb: Convert throw_dom_exception_if_needed() to ThrowCompletionOr
This changes Web::Bindings::throw_dom_exception_if_needed() to return a
JS::ThrowCompletionOr instead of an Optional. This allows callers to
wrap the invocation with a TRY() macro instead of making a follow-up
call to should_return_empty(). Further, this removes all invocations to
vm.exception() in the generated bindings.
2021-10-31 18:51:07 +01:00
Sam Atkins
2c901ae2be Browser: Add "Color scheme" setting
This allows the user to override whether to use a dark or light theme in
supporting websites.
2021-10-31 18:39:13 +01:00
Sam Atkins
84414da546 LibWeb: Implement prefers-color-scheme media query feature
This allows supporting websites to use a light or dark theme to match
our desktop theme, without being limited to palette colors. This can be
overridden with the `WebContentServer::set_preferred_color_scheme()` IPC
call.
2021-10-31 18:39:13 +01:00
Sam Atkins
53edaa3b26 LibWeb+WebContent: Add set_preferred_color_scheme IPC call
This allows the owner of a WebView to override whether to use a dark
theme or not, instead of just using the system theme's IsDark property.
2021-10-31 18:39:13 +01:00
Sam Atkins
c8550da9c5 LibWeb: Add Web::CSS::PreferredColorScheme enum 2021-10-31 18:39:13 +01:00
Sam Atkins
4f42e4ba90 LibGfx: Add 'IsDark' flag to SystemTheme and Palette
This explicitly states whether a given theme is a dark theme, so that
applications not using the system palette colors can still attempt to
match the overall theme.
2021-10-31 18:39:13 +01:00
Idan Horowitz
2eaed880b1 LibJS: Remove old Native Functions
Now that all the usages were updated to the new ThrowCompletionOr based
version we can remove the legacy version.
2021-10-31 18:20:37 +02:00
Idan Horowitz
9d1fb85f93 WebContent: Convert ConsoleGlobalObject functions to ThrowCompletionOr 2021-10-31 18:20:37 +02:00
Idan Horowitz
bcf168f771 LibJS: Use ThrowCompletionOr accessors in CreateMappedArgumentsObject 2021-10-31 18:20:37 +02:00
Idan Horowitz
aa61110bdd LibWeb: Convert WebAssemblyTablePrototype funcs to ThrowCompletionOr 2021-10-31 18:20:37 +02:00
Idan Horowitz
f19512bf55 LibWeb: Convert WebAssemblyMemoryPrototype funcs to ThrowCompletionOr 2021-10-31 18:20:37 +02:00
Idan Horowitz
c7c914800c LibWeb: Convert WebAssemblyInstancePrototype funcs to ThrowCompletionOr 2021-10-31 18:20:37 +02:00
Idan Horowitz
a8d39bc070 LibWeb: Convert WebAssemblyObject functions to ThrowCompletionOr 2021-10-31 18:20:37 +02:00
Idan Horowitz
3e8c76d5ab LibWeb: Convert WebAssemblyObject AOs to ThrowCompletionOr 2021-10-31 18:20:37 +02:00
Idan Horowitz
a76cd669b1 LibWeb: Make GlobalObject the first parameter of WebAssembly AOs
Let's be consistent with the rest of LibJS (and the rest of the file).
2021-10-31 18:20:37 +02:00
Daniel Bertalan
b883652a83 Profiler: Cache parsed DWARF debug information in disassembly view
This changes browsing through disassembled functions in Profiler from a
painfully sluggish experience into quite a swift one. It's especially
true for profiling the kernel, as it has more than 10 megabytes of DWARF
data to churn through.
2021-10-31 16:54:02 +01:00
Daniel Bertalan
8e1f882ac9 Profiler: Load the actual kernel binary for disassembly
/boot/Kernel.debug only contains the symbol table and DWARF debug
information, and has its `.text` and other PT_LOAD segments stripped
out. When we try to parse its data as instructions, we get a crash from
within LibX86.

We now load the actual /boot/Kernel binary when we want to disassemble
kernel functions.
2021-10-31 16:54:02 +01:00
Daniel Bertalan
80b660132c Profiler: Share the mapped kernel between Profile and DisassemblyModel
There is no point in keeping around a separate MappedFile object for
/boot/Kernel.debug for each DisassemblyModel we create and re-parsing
the kernel image multiple times. This will significantly speed up
browsing through profile entries from the kernel in disassembly view.
2021-10-31 16:54:02 +01:00
Timothy Flynn
c19c306744 LibWeb: Convert all generated bindings to ThrowCompletionOr
This also required converting URLSearchParams::for_each and the callback
function it invokes to ThrowCompletionOr. With this, the ReturnType enum
used by WrapperGenerator is removed as all callers would be using
ReturnType::Completion.
2021-10-31 15:48:36 +01:00
Timothy Flynn
19ac19eae1 LibWeb: Convert the Navigator object to ThrowCompletionOr 2021-10-31 15:48:36 +01:00
Timothy Flynn
0f93c9d6c8 LibWeb: Convert the CSS namespace object to ThrowCompletionOr 2021-10-31 15:48:36 +01:00
Timothy Flynn
85dc3a8099 LibWeb: Convert the Window object to ThrowCompletionOr 2021-10-31 15:48:36 +01:00
Timothy Flynn
585e420707 LibWeb: Convert the Location object to ThrowCompletionOr 2021-10-31 15:48:36 +01:00
Timothy Flynn
1939c72ecc Spreadsheet: Convert JSIntegration to ThrowCompletionOr 2021-10-31 15:48:36 +01:00
Marco Cutecchia
7653be6062 WindowServer: Remove some commented code in WindowManager.cpp 2021-10-31 12:37:49 +01:00
Marco Cutecchia
81b260bd1c PixelPaint: Use a bucket cursor for the Bucket tool 2021-10-31 12:37:49 +01:00
Marco Cutecchia
0f24678eaf PixelPaint: Support using a bitmap as a tool's cursor 2021-10-31 12:37:49 +01:00
Marco Cutecchia
116bb4888f LibGUI: Support using a bitmap as override cursor 2021-10-31 12:37:49 +01:00
Tetsui Ohkubo
4bfe060336 FileOperation: Deduplicate file names on move
For file copying, when there is a file with the same name in the
destination directory, the file will be automatically renamed to
"file-2.txt", for example. This change expands that special-case
handling to file moving.
2021-10-31 12:36:35 +01:00
Kyle Ambroff-Kao
0329a37271 Userland: Handle terminal window resizing in less(1)
Before this patch less would query the terminal geometry only at
startup and use this information to render the file when
appropriate. If the terminal is resized then the output is broken in
several different ways because of this.

This patch adds a SIGWINCH signal handler receive notification any
time the terminal is resized. This signal handler just sets a flag to
notify the main loop that a resize has occurred.

The main loop of the program just calls get_key_sequence() to get
input from the user, interpreting keystrokes as commands like scroll
up or down. The get_key_sequence() function has been changed to return
Optional<String>, so it either returns a keystroke from the user or it
returns nothing as an empty Optional.

While the user is not pressing any keys on the keyboard, the program
is blocking on a read() system call in get_key_sequence(). When
SIGWINCH is received, this read() will return with -1 and errno is set
to EINTR since the system call was interrupted by the signal. When
this happens we just return an empty Optional.

The mainloop now checks to see if a resize has been requested by
checking the flag, and if it has it performs a resize.

init() now just calls resize() since the required logic is the same.

Setters for m_filename and m_prompt are removed because these are now
just initialized by the constructor, as they never change for the life
of the program.
2021-10-31 12:34:37 +01:00
ForLoveOfCats
2c93ee50cd SpaceAnalyzer: Display scan progress with popup window during analysis 2021-10-31 12:15:12 +01:00
Musab Kılıç
8f9948ad66 Calculator: Add Constants menu 2021-10-31 12:10:44 +01:00
Musab Kılıç
2ef8cbe6cf Calculator: Fix copy button not copying the fractional part bug :^) 2021-10-31 12:10:33 +01:00
Musab Kılıç
8936d15efa Calculator: Improve KeypadValue conversion to handle integer values 2021-10-31 12:09:37 +01:00
Ali Mohammad Pur
d020d46846 Shell: Unwind execution after runtime errors
This commit makes the Shell check for errors after a node is run(), and
prevents further execution by unwinding until the error is cleared.
Fixes #10649.
2021-10-31 12:02:20 +01:00
Jelle Raaijmakers
8f332ac6a3 LibC: Add labs()
We defined it in `stdlib.h` but forgot to implement it.
2021-10-31 12:00:57 +01:00
Marco Cutecchia
0086466b61 Utilities: Add option to suppress errors to grep 2021-10-31 14:18:29 +03:30
Marco Cutecchia
647f89f15e Utilities: Add 'quiet' mode to grep 2021-10-31 14:18:29 +03:30
Timothy Flynn
0f91b22795 js: Convert JavaScript REPL to ThrowCompletionOr 2021-10-31 07:50:30 +02:00
Timothy Flynn
e8f722fb27 LibJS: Convert %IteratorPrototype% to ThrowCompletionOr 2021-10-31 07:50:30 +02:00
Timothy Flynn
d1abf3d8ce LibJS: Convert ObjectConstructor to ThrowCompletionOr 2021-10-31 07:50:30 +02:00
Timothy Flynn
0f224779aa LibJS: Convert ObjectConstructor GetOwnPropertyKeys to ThrowCompletionOr 2021-10-31 07:50:30 +02:00
Timothy Flynn
e92d14d498 LibJS: Convert GlobalObject to ThrowCompletionOr 2021-10-31 07:50:30 +02:00
Timothy Flynn
875b563664 LibJS: Convert GlobalObject's Encode and Decode AOs to ThrowCompletionOr 2021-10-31 07:50:30 +02:00
Timothy Flynn
2a967fd107 LibJS: Convert Object.prototype to ThrowCompletionOr 2021-10-31 07:50:30 +02:00
Peter
24fdf99d8b LibELF: Store SSE registers in x86_64 PLT Trampoline
Save and restore XMM registers so userspace programs don't
randomly lose values from calls. This fixes a crash in ScummVM.
2021-10-31 00:21:31 +02:00
Peter
80aa1b93d1 Debugger: Add logging for the other 8 GPRs too 2021-10-31 00:20:35 +02:00
Marco Cutecchia
5f04fb0ece Spreadsheet: Make the 'Help' window accessory 2021-10-31 00:58:05 +03:30
Linus Groh
2cbcb99ec7 LibJS: Update spec comment in parse_temporal_time_zone_string()
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/19b693c
2021-10-30 23:15:18 +02:00
Linus Groh
a7cb042ca8 LibJS: Fix format_time_zone_offset_string() for negative offsets
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/ec43be3
2021-10-30 23:14:50 +02:00
Linus Groh
5da8ae0020 LibJS: Update parse_temporal_time_zone_string() substring bounds
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/73b9fe3
2021-10-30 23:14:43 +02:00
Brendan Coles
6ccfa3e75e LibPDF: Parser::parse_header() return false if remaining bytes is zero 2021-10-30 17:34:56 +02:00
Linus Groh
92fdae178b LibJS: Implement Temporal.TimeZone.prototype.getPreviousTransition() 2021-10-30 16:32:20 +02:00
Linus Groh
e9cbeeac45 LibJS: Implement Temporal.TimeZone.prototype.getNextTransition() 2021-10-30 16:32:20 +02:00
Linus Groh
5fde02184d LibJS: Implement Temporal.TimeZone.prototype.getPossibleInstantsFor() 2021-10-30 16:32:20 +02:00
Linus Groh
82792a6815 LibJS: Mark single argument BigInt() constructor as 'explicit' 2021-10-30 16:32:20 +02:00
Noah Haasis
05aeff1c4d LibGUI: Focus next tab after closing active tab
Focus the next tab after closing the currently active tab.
If the tab being closed is the last one then the new last
tab is active.
2021-10-30 17:13:25 +03:30
Linus Groh
de2e95b278 LibJS: Ensure make_day()'s temporary Core::DateTime is treated as UTC
DateTime::create() and subsequently DateTime::set_time() uses mktime()
internally to ensure out-of-range input values still result in a valid
date (Jan 32 -> Feb 1 etc.).
This however also means that the input is treated as local time, and
then shifted to UTC accordingly for the returned time_t - it is however
already in UTC in this case! The temporary solution is simply to set the
"TZ" environment variable to "UTC" and back after create(). The proper
solution is probably to have better timezone support in Core::DateTime.
This should only affect Lagom, as serenity itself has no timezone
support yet and always assumes UTC.
2021-10-30 10:15:49 +02:00
Linus Groh
28a9a248d6 LibJS: Fix off-by-one in make_day()'s temporary Core::DateTime
Just like in the previous commit, the day value of Core::DateTime is
one-based, not zero based.
Noticed while implementing a new Temporal function, this likely would've
been caught earlier if we'd also use it for the Date API (we don't).
2021-10-30 10:15:49 +02:00
Linus Groh
232f54cd9b LibCore: Fix off-by-one in DateTime::{create,set_time} day default arg
Just like month, the day value here is one-based. This resulted in the
following situation, which is obviously unexpected:

    Core::DateTime::create(1970); // 1970-01-00 -> 1969-12-31
2021-10-30 10:15:49 +02:00
Daniel Bertalan
e9f0ebd4bd LibHTTP: Fix logic error leading to buffer over-read
When we receive HTTP payloads, we have to ensure that the number of
bytes read is *at most* the value specified in the Content-Length
header.

However, we did not use the correct value when calculating the truncated
size of the last payload. `m_buffered_size` does not store the total
number of bytes received, but rather the number of bytes that haven't
been read from us.

This means that if some data has already been read from us,
`m_buffered_size` is smaller than `m_received_size`. Because of this, we
ended up resizing the `payload` ByteBuffer to a larger size than its
contents. This garbage data was then read by consumers, producing this
warning when executing scripts:

> Extension byte 0xdc in 1 position after first byte 0xdc doesn't make
> sense.
2021-10-30 00:54:34 +03:30
Marco Cutecchia
3428e2a76c HackStudio: Add 'Show Dotfiles' option 2021-10-29 22:40:11 +02:00
Timothy Flynn
ef62118c8b LibWeb: Render any specified list-style-image for list items 2021-10-29 22:06:49 +02:00
Timothy Flynn
eb0fb38cac LibWeb: Support parsing some data: URLs in CSS
For now, data URLs are explicitly limited to expected MIME types. For
example, image-related styles accept image MIME types.
2021-10-29 22:06:49 +02:00
Timothy Flynn
2fadbe176e LibWeb: Remove extraneous semi-colon 2021-10-29 22:06:49 +02:00
Musab Kılıç
39afbceb53 Minesweeper: Set time label to a fixed width
This ensures the label width doesn't sporadically change as time elapses
2021-10-29 23:02:24 +03:00
Rodrigo Tobar
f356c4ab91 wc: Count last line even if it doesn't end in newline 2021-10-29 22:37:34 +03:00
Idan Horowitz
040e29c7b9 LibJS: Convert ShadowRealmPrototype functions to ThrowCompletionOr 2021-10-29 21:29:24 +03:00
Idan Horowitz
658056233e LibJS: Convert GeneratorObjectPrototype functions to ThrowCompletionOr 2021-10-29 21:29:24 +03:00
Idan Horowitz
7b5ccbc5ed LibJS: Convert ProxyConstructor functions to ThrowCompletionOr 2021-10-29 21:29:24 +03:00
Idan Horowitz
92bd64cb56 LibJS: Convert the ProxyCreate AO to ThrowCompletionOr 2021-10-29 21:29:24 +03:00
Idan Horowitz
84681788c4 LibJS: Convert FinalizationRegistryPrototype funcs to ThrowCompletionOr 2021-10-29 21:29:24 +03:00
Idan Horowitz
909e13c5e6 LibJS: Convert WeakSetPrototype functions to ThrowCompletionOr 2021-10-29 21:29:24 +03:00
Idan Horowitz
56e14ba09f LibJS: Convert WeakMapPrototype functions to ThrowCompletionOr 2021-10-29 21:29:24 +03:00
Idan Horowitz
f1e215ea3e LibJS: Convert MapIteratorPrototype functions to ThrowCompletionOr 2021-10-29 21:29:24 +03:00
Idan Horowitz
dab0a92c19 LibJS: Convert MapPrototype functions to ThrowCompletionOr 2021-10-29 21:29:24 +03:00
Idan Horowitz
8ff152ec5c LibJS: Convert MapConstructor functions to ThrowCompletionOr 2021-10-29 21:29:24 +03:00
Idan Horowitz
23ea1f1a3e LibJS: Convert MathObject functions to ThrowCompletionOr 2021-10-29 21:29:24 +03:00
Idan Horowitz
b184e872e4 LibJS: Convert ReflectObject functions to ThrowCompletionOr 2021-10-29 21:29:24 +03:00
Idan Horowitz
4c3ea0bb91 LibJS: Convert StringIteratorPrototype functions to ThrowCompletionOr 2021-10-29 21:29:24 +03:00
Idan Horowitz
720bb21ee2 LibJS: Convert ArrayBufferPrototype functions to ThrowCompletionOr 2021-10-29 21:29:24 +03:00
Idan Horowitz
ffa58184d2 LibJS: Convert ArrayBufferConstructor functions to ThrowCompletionOr 2021-10-29 21:29:24 +03:00
Idan Horowitz
70cbd43718 LibJS: Convert DataViewPrototype functions to ThrowCompletionOr 2021-10-29 21:29:24 +03:00
Idan Horowitz
9d3348d8da LibJS: Convert the SetViewValue AO to ThrowCompletionOr 2021-10-29 21:29:24 +03:00
Idan Horowitz
fca05f835f LibJS: Convert the GetViewValue AO to ThrowCompletionOr 2021-10-29 21:29:24 +03:00
Idan Horowitz
7f3fa7d7e0 LibJS: Convert NumberPrototype functions to ThrowCompletionOr 2021-10-29 21:29:24 +03:00
Idan Horowitz
2c6955462e LibJS: Convert NumberConstructor functions to ThrowCompletionOr 2021-10-29 21:29:24 +03:00
Idan Horowitz
08fb31087b LibJS: Convert BooleanPrototype functions to ThrowCompletionOr 2021-10-29 21:29:24 +03:00
Idan Horowitz
2a0c51149d LibJS: Convert FunctionPrototype functions to ThrowCompletionOr 2021-10-29 21:29:24 +03:00
Idan Horowitz
c0bb456fd2 LibJS: Convert the CreateDynamicFunction AO to ThrowCompletionOr 2021-10-29 21:29:24 +03:00
Idan Horowitz
47f762ab42 LibJS: Convert ErrorPrototype functions to ThrowCompletionOr 2021-10-29 21:29:24 +03:00
Idan Horowitz
c815519a65 LibJS: Convert WeakRefPrototype functions to ThrowCompletionOr 2021-10-29 21:29:24 +03:00
Idan Horowitz
719d1b48ac LibJS: Convert ArrayIteratorPrototype functions to ThrowCompletionOr 2021-10-29 21:29:24 +03:00
Idan Horowitz
d1d4ee699b LibJS: Convert ConsoleObject functions to ThrowCompletionOr 2021-10-29 21:29:24 +03:00
Idan Horowitz
e7a134a346 LibJS: Convert JSONObject functions to ThrowCompletionOr 2021-10-29 21:29:24 +03:00
Idan Horowitz
6b954b9e76 LibJS: Convert SetIteratorPrototype functions to ThrowCompletionOr 2021-10-29 21:29:24 +03:00
Idan Horowitz
d46d8c9016 LibJS: Convert SetPrototype functions to ThrowCompletionOr 2021-10-29 21:29:24 +03:00
Idan Horowitz
c2e0753d8a LibJS: Convert SetConstructor functions to ThrowCompletionOr 2021-10-29 21:29:24 +03:00
Idan Horowitz
7c96ed8cf3 LibJS: Convert SymbolPrototype functions to ThrowCompletionOr 2021-10-29 21:29:24 +03:00
Idan Horowitz
294f244745 LibJS: Convert SymbolConstructor functions to ThrowCompletionOr 2021-10-29 21:29:24 +03:00
Idan Horowitz
87ff51fa67 LibJS: Convert BigIntPrototype functions to ThrowCompletionOr 2021-10-29 21:29:24 +03:00
Idan Horowitz
4128f95903 LibJS: Convert BigIntConstructor functions to ThrowCompletionOr 2021-10-29 21:29:24 +03:00
Ali Mohammad Pur
ac856cb965 LibRegex: Don't ignore empty alternatives in append_alternation()
Doing so would cause patterns like `(a|)` to not match the empty string.
2021-10-29 15:57:59 +02:00
Luke Wilde
6088011c4b LibWeb: Add Element.webkitMatchesSelector
This is an alias of Element.matches for web compatibility.
https://dom.spec.whatwg.org/#dom-element-webkitmatchesselector

Used by particularly old versions of Sizzle, such as 1.10.2:
16b079b164/jquery.js (L1644)

This particular version is used by DuckDuckGo.
2021-10-28 21:43:36 +02:00
Andreas Kling
49916f494d LibWeb: Don't try to layout list-item markers in BFC
Marker boxes are laid out by the corresponding ListItemBox. BFC should
just leave them alone. This fixes a jiggling issue on welcome.html :^)
2021-10-28 19:44:21 +02:00
Andreas Kling
723ea4bcd7 LibWeb: Add Layout::Box::border_box_as_relative_rect()
This helper returns the border box (content+padding+border) of a given
box. Margin not included.
2021-10-28 19:44:21 +02:00
Andreas Kling
37f0bd0a42 LibWeb: Small fix to height computation for block-with-inline-children
We now compute the used height of height:auto by measuring from the top
content edge (y=0) to the bottom of the bottommost line box within the
block container.

This fixes an issue where we'd fail to account for the topmost line box
being taller than any of its fragments (which can happen if the
line-height is greater than the height of all fragments on the line.)
2021-10-28 19:20:40 +02:00
Andreas Kling
76fa57713d LibWeb: Use border edges when computing overflow for the ICB 2021-10-28 18:54:02 +02:00
Andreas Kling
03c3b3b7e5 LibWeb: Null-check document before doing layout in PageHost::paint() 2021-10-28 18:29:49 +02:00
Andreas Kling
d413d0557d LibWeb: Remove unused CSS::Length::relative_length_to_px(Layout::Node) 2021-10-28 18:15:15 +02:00
Andreas Kling
23561133aa LibWeb: Always update layout (if needed) before painting 2021-10-28 18:14:38 +02:00
Andreas Kling
7ec7729e1b LibWeb: Don't force line box fragments height to be at least line-height
I don't remember why we did things this way, but it's clearly not right
to stretch fragments vertically. Instead, we should just align their
bottom to the appropriate line (as we already do.)
2021-10-28 18:01:04 +02:00
Andreas Kling
88c32836d8 LibWeb: Make non-absolute values for line-height fall back to font-size
When using bitmap fonts, the computed *font* that we're using may be
smaller than the font-size property asked for. We can still honor the
font-size value in layout calculations.
2021-10-28 17:34:37 +02:00
Andreas Kling
ec49c8fefd LibWeb: Clip descendants of boxes with overflow:hidden
This is a very limited implementation of overflow:hidden, but since it's
easy to cover this common scenario, let's do it.
2021-10-28 17:09:51 +02:00
Andreas Kling
df3cd2fd56 LibWeb: Treat width:auto on tables as fit-content
Tables, unlike other block-level elements, should not stretch to fit
their containing block by default.
2021-10-28 16:06:08 +02:00
Sam Atkins
52a1be5eae LibWeb: Allow whitespace when parsing "!important" in CSS
This accounts for cases like:
```css
.foo {
    color: blue ! important ;
}
```

That's rare now that minifying is so popular, but does appear on some
websites.

I've added spec comments to `consume_a_declaration()` while I was at it.
2021-10-28 16:05:48 +02:00
Sam Atkins
6f1debaab0 LibWeb: Allow whitespace inside CSS attribute selectors
Noticed this while checking some MediaWiki-based sites. It's not
obvious, but the spec does allow this, by not mentioning it in this list
of places whitespace is forbidden:
https://www.w3.org/TR/selectors-4/#white-space
2021-10-28 16:05:48 +02:00
Timothy Flynn
691e4820ac LibWeb: Remove two lowercase string creations from Element::has_class 2021-10-28 15:09:06 +02:00
Timothy Flynn
7f223e2290 LibWeb: Do not create lowercase strings in NamedNodeMap::get_attribute
Rather than following the spec exactly and creating lowercase strings,
we can simply do a case-insensitive string comparison. The caveat is
that creating attributes must follow the spec by creating the attribute
name with a lowercase string.
2021-10-28 15:09:06 +02:00
Ben Wiederhake
934360583f LibWeb: Remove duplicated auto height computation
Note that these two implementation differ, but the one in
FormattingContext.cpp seems to be more complete. It is also more recent.
2021-10-28 13:33:33 +02:00
Andreas Kling
84b15cc7b1 LibWeb: Remove StyleProperties::set_property(PropertyID, StringView)
This API has no more clients (and the last client that I just removed
wasn't even using it right) so let's get rid of it.
2021-10-28 12:53:31 +02:00
Andreas Kling
5c132724ea LibWeb: Properly handle the <td align> attribute
When valid, this attribute needs to result in an IdentifierStyleValue.
Before this change we were turning it into a StringStyleValue, which
then defaulted to left alignment for all values.

For "center" and "middle", we turn it into -libweb-center. All other
values are passed verbatim to the CSS parser.
2021-10-28 12:53:31 +02:00
Idan Horowitz
f12da0af13 LibC+LibELF: Move getauxval and AT_* flags to sys/auxv.h 2021-10-28 11:24:36 +02:00
Idan Horowitz
f22787dd39 LibC: Change the type of FBProperties' fields from bool to unsigned char
The bool type is not available in C89.
2021-10-28 11:24:36 +02:00
Sam Atkins
c1d26c884d ThemeEditor: Display the theme's window icons in the preview
If the icons could not be loaded, we fall back to the defaults (which
are the bitmaps that were always used before.)
2021-10-28 11:23:44 +02:00
Sam Atkins
dbeff9ad84 ThemeEditor: Add PathRole editing
This allows both typing the path, and selecting it with a file-open
dialog.
2021-10-28 11:23:44 +02:00
Sam Atkins
e58db5592e ThemeEditor: Update value edit boxes when loading a theme file
Previously, these would continue to show the previously entered values,
until you interacted with the ComboBoxes.
2021-10-28 11:23:44 +02:00
Sam Atkins
684f8a6b15 ThemeEditor: Add MetricRole editing
The editing UI at the bottom is now split into two groups, one for
colors and one for metrics.
2021-10-28 11:23:44 +02:00
Sam Atkins
859975f6bd LibGUI: Add MetricRole and PathRole to GUI::Variant
This is needed for making them editable in the ThemeEditor, like
ColorRole is.
2021-10-28 11:23:44 +02:00
Sam Atkins
31ce4d04b6 LibGfx: Add to_string() functions for MetricRole and PathRole 2021-10-28 11:23:44 +02:00
Sam Atkins
c885722a94 ThemeEditor: Convert layout to GML 2021-10-28 11:23:44 +02:00
Sam Atkins
daaf5890a6 ThemeEditor: Display window shadows in preview :^) 2021-10-28 11:23:44 +02:00
Sam Atkins
885ca2f968 LibGfx+WindowServer: Move shadow-painting code to StylePainter
Specifically, this is to make it accessible to ThemeEditor, but there's
nothing about it that is especially window-specific.
2021-10-28 11:23:44 +02:00
Sam Atkins
cf188df86c LibGfx: Make style painters use east const and virtual specifiers 2021-10-28 11:23:44 +02:00
Sam Atkins
ab1ce13eea ThemeEditor: Give both preview windows a background color
The inactive window previously didn't have a background fill, so it
looked odd.
2021-10-28 11:23:44 +02:00
Jelle Raaijmakers
770c1935d4 MouseSettings: Reset the double-click timer after every second click
The old behavior of restarting the timer after every second click could
result in double-click-chains (or triple+ clicks), which does not feel
like the right behavior.

By resetting the double-clicking timer, you need to perform a new full
double-click to make the arrows change color again.
2021-10-28 11:21:18 +02:00
Jelle Raaijmakers
7c939c58b8 LibCore: Add ElapsedTimer::reset() 2021-10-28 11:21:18 +02:00
Filiph Sandström
c6247fe414 Everywhere: Rename back-click to backward-click
This matches the current forward-click terminology.
2021-10-27 22:05:58 +03:00
Filiph Sandström
d6a0726302 Everywhere: Rename left/right-click to primary/secondary
This resolves #10641.
2021-10-27 22:05:58 +03:00
Ben Wiederhake
074ce35b37 Piano: Fix typo in Copyright header
This was introduced in 74f1f2b5e2.
I have no idea why the checker script didn't pick it up. Bash bug maybe?
2021-10-27 11:35:47 -07:00
Andreas Kling
f6573f5f9d LibWeb: Don't create anonymous table boxes around whitespace
This was confusing table layout by adding empty whitspace table boxes
that wound up stealing a bunch of horizontal space.
2021-10-27 18:22:00 +02:00
Andreas Kling
ca154723f7 LibWeb: Remove Layout::Box::width_of_logical_containing_block()
This was a hack to percentages within tables relative to the nearest
table-row ancestor instead of the nearest table container.

That didn't actually make sense, so this patch simply removes the hack
in favor of containing_block()->width().
2021-10-27 18:00:51 +02:00