Commit Graph

7211 Commits

Author SHA1 Message Date
Timothy Flynn
345ef6abba LibRegex: Support ECMA-262 Unicode escapes of the form "\u{code_point}"
When the Unicode flag is set, regular expressions may escape code points
by surrounding the hexadecimal code point with curly braces, e.g. \u{41}
is the character "A".

When the Unicode flag is not set, this should be considered a repetition
symbol - \u{41} is the character "u" repeated 41 times. This is left as
a TODO for now.
2021-07-23 23:06:57 +01:00
Timothy Flynn
0e6375558d AK+LibRegex: Partially implement case insensitive UTF-16 comparison
This will work for ASCII code points. Unicode case folding will be
needed for non-ASCII.
2021-07-23 23:06:57 +01:00
Timothy Flynn
47f6bb38a1 LibRegex: Support UTF-16 RegexStringView and improve Unicode matching
When the Unicode option is not set, regular expressions should match
based on code units; when it is set, they should match based on code
points. To do so, the regex parser must combine surrogate pairs when
the Unicode option is set. Further, RegexStringView needs to know if
the flag is set in order to return code point vs. code unit based
string lengths and substrings.
2021-07-23 23:06:57 +01:00
Idan Horowitz
1d76be97f5 LibJS: Implement Temporal.PlainDate.prototype.inLeapYear 2021-07-23 22:00:23 +01:00
Idan Horowitz
c9ae7e1af1 LibJS: Implement Temporal.Calendar.prototype.inLeapYear 2021-07-23 22:00:23 +01:00
Idan Horowitz
dd15fc471c LibJS: Implement Temporal.PlainDate.prototype.monthsInYear 2021-07-23 22:00:23 +01:00
Idan Horowitz
342172da37 LibJS: Implement Temporal.Calendar.prototype.monthsInYear 2021-07-23 22:00:23 +01:00
Idan Horowitz
b1dd09840b LibJS: Implement Temporal.PlainDate.prototype.daysInYear 2021-07-23 22:00:23 +01:00
Idan Horowitz
7f27035342 LibJS: Implement Temporal.Calendar.prototype.daysInYear 2021-07-23 22:00:23 +01:00
Idan Horowitz
3160540d0e LibJS: Implement Temporal.PlainDate.prototype.daysInMonth 2021-07-23 22:00:23 +01:00
Idan Horowitz
69c8b8e8bd LibJS: Implement Temporal.Calendar.prototype.daysInMonth 2021-07-23 22:00:23 +01:00
Idan Horowitz
2150f5b374 LibJS: Implement Temporal.PlainDate.prototype.daysInWeek 2021-07-23 22:00:23 +01:00
Idan Horowitz
623df361e6 LibJS: Implement Temporal.Calendar.prototype.daysInWeek 2021-07-23 22:00:23 +01:00
Idan Horowitz
2cf582436f LibJS: Implement Temporal.PlainDate.prototype.weekOfYear 2021-07-23 22:00:23 +01:00
Idan Horowitz
d22fe25643 LibJS: Implement Temporal.Calendar.prototype.weekOfYear 2021-07-23 22:00:23 +01:00
Idan Horowitz
d561535ac9 LibJS: Implement Temporal.PlainDate.prototype.dayOfYear 2021-07-23 22:00:23 +01:00
Idan Horowitz
c0e7761758 LibJS: Implement Temporal.Calendar.prototype.dayOfYear 2021-07-23 22:00:23 +01:00
Idan Horowitz
bcbfd5b280 LibJS: Implement Temporal.PlainDate.prototype.dayOfWeek 2021-07-23 22:00:23 +01:00
Idan Horowitz
339b0a17e8 LibJS: Implement Temporal.Calendar.prototype.dayOfWeek 2021-07-23 22:00:23 +01:00
Idan Horowitz
59dc0e8421 LibJS: Implement Temporal.PlainDate.prototype.day 2021-07-23 22:00:23 +01:00
Idan Horowitz
8a20f258f0 LibJS: Implement Temporal.Calendar.prototype.day 2021-07-23 22:00:23 +01:00
Idan Horowitz
d9414e465a LibJS: Implement Temporal.PlainDate.prototype.monthCode 2021-07-23 22:00:23 +01:00
Idan Horowitz
9d9ba29cae LibJS: Implement Temporal.Calendar.prototype.monthCode 2021-07-23 22:00:23 +01:00
Idan Horowitz
a0af9b11fb LibJS: Implement Temporal.PlainDate.prototype.month 2021-07-23 22:00:23 +01:00
Idan Horowitz
3bec18432a LibJS: Implement Temporal.Calendar.prototype.month 2021-07-23 22:00:23 +01:00
Idan Horowitz
8434ca6c4b LibJS: Implement Temporal.PlainDate.prototype.year 2021-07-23 22:00:23 +01:00
Idan Horowitz
3895a8354d LibJS: Implement Temporal.Calendar.prototype.year 2021-07-23 22:00:23 +01:00
Idan Horowitz
9fa8f19a0f LibJS: Implement Temporal.PlainDate.prototype.withCalendar 2021-07-23 22:00:23 +01:00
Idan Horowitz
8123e957e3 LibJS: Add missing PlainDateTime case in ToTemporalDate 2021-07-23 22:00:23 +01:00
Itamar
8241a6c8eb TextEditor: Allow starting with a file argument that doesn't exist
If TextEditor is started with an argument for a file that doesn't
exist, we now allow editing it.

The file will be created once it is saved.
2021-07-23 21:19:30 +04:30
Ali Mohammad Pur
36bfc912fc LibRegex: Switch to east-const style 2021-07-23 21:19:21 +04:30
Ali Mohammad Pur
c8b2199251 LibRegex: Clear previous capture group contents in ECMA262 mode
ECMA262 requires that the capture groups only contain the values from
the last iteration, e.g. `((c)(a)?(b))` should _not_ contain 'a' in the
second capture group when matching "cabcb".
2021-07-23 21:19:21 +04:30
Ali Mohammad Pur
7b88857c5a LibWeb: Manually convert the js bigint to a wasm i64 value
SignedBigInteger::export() generates sign-magnitude, but the native i64
type uses 2's comp, make this work by exporting it as unsigned and
tweaking the sign later.
2021-07-23 17:36:15 +04:30
Ali Mohammad Pur
03629a2b3c LibWeb: Read the correct types in WebAssembly's to_js_value()
A wasm value containing an F64 does not contain a float, etc.
2021-07-23 17:36:15 +04:30
stelar7
8264511d32 LibWeb: Dont try to parse "data" urls as links 2021-07-23 14:18:17 +02:00
davidot
4ef9edbff7 LibWeb: Fix that empty event handlers return null instead of crashing 2021-07-23 14:15:28 +02:00
Linus Groh
080112eb82 LibJS: Implement Temporal.PlainDateTime.prototype.getISOFields() 2021-07-23 08:18:11 +01:00
Linus Groh
18fd0d4011 LibJS: Implement Temporal.PlainDateTime.prototype.toPlainDate() 2021-07-23 08:18:11 +01:00
Linus Groh
61b2780853 LibJS: Fix return type of PlainDateTime::iso_{milli,micro,nano}second() 2021-07-23 08:18:11 +01:00
Gunnar Beutner
59007bba84 Hearts: Avoid redrawing the UI unnecessarily 2021-07-23 02:34:59 +02:00
Andreas Kling
3f9e018d9a CrashDaemon: Remove BACKTRACE_DEBUG debugging code
This thing seems to work fine, no need to hang on to old debug code.
2021-07-22 23:34:33 +02:00
Andreas Kling
cdae397e6a DynamicLoader: Don't truncate dynamic section address on x86_64 2021-07-22 23:34:33 +02:00
Peter Elliott
bf16591c07 Assistant: Only open one Assistant at once
I found myself accidentally opening two assistants at once with the
Window+Space shortcut. Since only one assistant window is usable at the
same time, I made assistant only spawn 1 instance at most.
2021-07-22 23:34:15 +02:00
Peter Elliott
fdcfd2816e LibCore: Add LockFile, a filesystem based mutex
This API wraps flock(2) and also handles the file creation and deletion
when the LockFile goes out of scope.
2021-07-22 23:34:15 +02:00
Hendiadyoin1
7da12f0faf UserspaceEmulator: Move to using the new SoftFPU 2021-07-22 23:33:21 +02:00
Hendiadyoin1
45d0f84a27 UserspaceEmulator: Implement SoftFPU instructions
This implements almost all instructions related to the FPU, including
all MMX instructions as well.
A lot of these were copied and adjusted from the SoftCPU implementation.

The next big milestone would be QNan detection and ShadowValue handling.
2021-07-22 23:33:21 +02:00
Hendiadyoin1
09a1a0b319 UserspaceEmulator: Sketch out a SoftFPU interface 2021-07-22 23:33:21 +02:00
Hendiadyoin1
eb6af29421 LibX86: Add missing MovD and MovQ instructions
These are placeholders for now
2021-07-22 23:33:21 +02:00
Hendiadyoin1
efa42c4d45 LibX86: Use names closer to the spec for the Modrm
This gets rid of a lot of magic number shifts and ands.
2021-07-22 23:33:21 +02:00
Sam Atkins
68193c365f LibWeb: Resolve CSS text-decoration from value list
This detects and resolves these in the text-decoration property, in any
order:

- text-decoration-color
- text-decoration-line
- text-decoration-style

Only the solid underline renders, but all three sub-properties are
assigned correctly.
2021-07-22 23:09:01 +02:00
Sam Atkins
29b61123a4 LibWeb: Resolve background properties from ValueListStyleValue
As before, there are several sub-properties that we do not support, and
we ignore anything after the first comma.
2021-07-22 23:09:01 +02:00
Sam Atkins
6e08b200d4 LibWeb: Implement ImageStyleValue parsing
Later we will want to make a distinction between URL and Image values,
but this works for now.
2021-07-22 23:09:01 +02:00
Sam Atkins
82f3228dd2 LibWeb: Resolve CSS font property from value list
The font property now resolves into its various parts:

- font-family
- font-weight
- font-size
- font-style
- line-height

The font-variant and font-stretch parts are left unparsed since LibWeb
doesn't know how to render those.

Added `fonts.html` as a test for various forms of `font` declarations,
based on the examples in the spec.
2021-07-22 23:09:01 +02:00
Sam Atkins
a44d7670ab LibWeb: Resolve CSS list-style from value list
This resolves the three sub-properties, appearing in any order:

- list-style-image
- list-style-position
- list-style-type

Added `list-style-position` values to support this, though they are not
yet used in rendering.
2021-07-22 23:09:01 +02:00
Sam Atkins
b693a22c2d LibWeb: Resolve CSS flex/flex-flow from value list
Also moved the 'flex' code in StyleResolver to be next to
the 'flex-flow' code, because that seemed more reasonable.
2021-07-22 23:09:01 +02:00
Sam Atkins
7abfb18656 LibWeb: Implement CSS color parsing from Tokens
This was broken when we switched away from using StringStyleValues.
While I was at it, I have implemented hsl/a() and the percentage
syntax for rgb/a().

As a bonus, added `colors.html` as a test page for the various CSS
color syntaxes, since nothing was testing rgb() or rgba() before.

Much of the parsing code in LibGFX/Color.h seems to be centered
around CSS color values, but this is not used by the new Parser.
(And can't be used, because it requires a String value and we have
a list of Tokens of some kind instead.) Maybe that should be removed
from there when the new CSS parser is operational.
2021-07-22 23:09:01 +02:00
Sam Atkins
fabbd06de4 LibGfx: Implement Color::from_hsl/hsla()
This is required by CSS, and implemented based on the CSS standard's
algorithm.
2021-07-22 23:09:01 +02:00
Sam Atkins
4853c89c42 LibWeb: Handle ValueListStyleValues in StyleResolver
This implements a lot of cases, but not all of them. The following
need more infrastructure first:

- Flex
- FlexFlow
- Background
- BackgroundImage
- BackgroundRepeat
- ListStyle and parts
- Font

Also, colors are not parsed correctly. This will be handled next.
2021-07-22 23:09:01 +02:00
Sam Atkins
6e0376361a LibWeb: Expose StyleValue parsing method in CSS Parser
Now that StyleResolver is going to deal with StyleComponentValueRules,
it will need to be able to parse those into StyleValues, using
`parse_css_value()`.

Also added StyleValue::is_builtin_or_dynamic(), which returns true for
values that are valid anywhere - things like `initial` and `inherit`,
along with `var()`, `attr()` and `calc()` - which we want to test for
easily.
2021-07-22 23:09:01 +02:00
Sam Atkins
57d34f1966 LibWeb: Convert StyleResolver.{h,cpp} to east const 2021-07-22 23:09:01 +02:00
Sam Atkins
d72ce7b989 LibWeb: Generate a ValueListStyleValue when parsing CSS values
We skip whitespace tokens while doing this. As far as I can tell,
whitespace is not useful once we get to this point, and it legally
may or may not appear between any two tokens. By not including it
in the ValueListStyleValue, we make the "if it has 3 parts"-type
checks a lot more straightforward.
2021-07-22 23:09:01 +02:00
Sam Atkins
4a03279539 LibWeb: Add CSS ValueListStyleValue
As the new CSS parser tokenizes its input, we can no longer easily
rely on a StringStyleValue for multi-value properties. (eg, border)
ValueListStyleValue lets us wrap all of the ComponentValues that
the Parser produced for one declaration, as a single StyleValue, to
then be parsed into StyleValues by the StyleResolver.

Originally, I wanted it to be a list of StyleValues, but several
properties use syntax that makes use of non-StyleValue tokens, eg:
```css
/* Syntax using a / */
font: 12px/14px sans-serif;
/* Multiple values separated by commas */
background: url(catdog.png), url(another-image.jpg), blue;
```
Passing the ComponentValue tokens themselves means that all that
information is carried over. The alternative might be to create a
StyleValue subclass for each property and parse them fully inside
the Parser. (eg, `FontStyleValue`)

I decided against `ListStyleValue` as a name, to avoid confusion
with list styles. It's not ideal, but names are hard.
2021-07-22 23:09:01 +02:00
Karol Kosek
8c2be4b3dc LibAudio: Implement loaded_samples() in the FLAC Loader
This makes aplay show current playback position.
2021-07-22 22:57:05 +02:00
Karol Kosek
01e1e2c2c5 LibAudio: Read custom block sizes and sample rates as big endian
This fixes stucking in a loop at the end of the file, as
(a) custom block sizes are usually placed there, as the remaining
size might not be simply calculated as a power of two, and
(b) the number of bytes to read was incorrect (the program said
the block size was 32525, where flac -a said it's actually 3200).

Unfortunately, I couldn't trigger the bug for the sample rates,
so it may be not true, but I'd doubt it, giving the fact that flac
almost everywhere uses big endian numbers.
2021-07-22 22:57:05 +02:00
Karol Kosek
69c7b66f06 LibAudio: Don't read too much bytes in FLAC
This fixes crash when reading the end of the file.

The logic is mostly borrowed from WavLoader.
2021-07-22 22:57:05 +02:00
Timothy
ccd19d464e LibGUI: Handle multiple lines of text in MessageBox
The total height of text is calculated from the glyph height, the number
of lines, and a padding modifier.
2021-07-22 22:38:25 +02:00
Linus Groh
40580696a6 js: Implement pretty-printing of Temporal.PlainDateTime objects 2021-07-22 21:19:40 +01:00
Linus Groh
93e52f6ad8 js: Implement pretty-printing of Temporal.PlainDate objects 2021-07-22 21:19:40 +01:00
Linus Groh
38645347a7 LibJS/Tests: Fix this value error test description in a PlainDate test 2021-07-22 21:19:40 +01:00
Linus Groh
2c46a0fa6c LibJS/Tests: Replace snake_case with pascalCase in two PlainDate tests 2021-07-22 21:19:40 +01:00
Linus Groh
8b6865b128 LibJS: Add missing step number in PlainDatePrototype 2021-07-22 21:19:40 +01:00
Linus Groh
aa2c8b6b91 LibJS: Implement Temporal.PlainDateTime.prototype.calendar 2021-07-22 21:19:40 +01:00
Linus Groh
78acc976a6 LibJS: Implement Temporal.PlainDateTime.prototype.valueOf() 2021-07-22 21:19:40 +01:00
Linus Groh
591ee813fb LibJS: Implement Temporal.PlainDateTime.prototype[@@toStringTag] 2021-07-22 21:19:40 +01:00
Linus Groh
4be3196882 LibJS: Start implementing Temporal.PlainDateTime
This commit adds the PlainDateTime object itself, its constructor and
prototype (currently empty), and the CreateTemporalDateTime abstract
operation.
2021-07-22 21:19:40 +01:00
Linus Groh
8f26f51580 LibJS: Add missing spec links to System{Instant,UTCEpochNanoseconds} 2021-07-22 21:19:40 +01:00
Linus Groh
bece2093f2 LibJS: Remove pointless 'explicit' from a couple of constructors 2021-07-22 21:19:40 +01:00
Linus Groh
c65424d806 LibJS: Fix value of Temporal.PlainDate.length
Should be 3 (year, month, day, optional calendar-like), not 0.
2021-07-22 21:19:40 +01:00
Tom
fd60815c58 WindowServer: Fix rendering overlays when there's no desktop window
We were missing to account for areas that are not covered by any
window. If any of these areas are covered by an overlay we need to
render the wallpaper into transparency and also render the overlay
over them.

This fixes not rendering overlays properly when e.g. the FileManager
(desktop) crashed as there is no longer any window underneath.
2021-07-22 21:38:52 +02:00
Gunnar Beutner
60d6137e73 Userland: Use /proc/kernel_base to determine the kernel base address
This removes all the hard-coded kernel base addresses from userspace
tools.

One downside for this is that e.g. Profiler no longer uses a different
color for kernel symbols when run as a non-root user.
2021-07-22 21:38:23 +02:00
Andreas Kling
d79d768010 LaunchServer: Remove debug spam about incoming connections 2021-07-22 14:20:05 +02:00
Sam Atkins
9122967d5f FileOperation: Use LexicalPath::join() for all path joining 2021-07-22 12:48:44 +02:00
Sam Atkins
9ac757647f FileManager: Switch FileOperationProgressWidget::did_error() to SV& 2021-07-22 12:48:44 +02:00
Sam Atkins
469bca9d3a FileManager: Show progress dialog for file deletions
Progress dialogs are nice! :^)

Showing a proper file-deletion animation would be nice, but that is
outside the scope of my abilities.
2021-07-22 12:48:44 +02:00
Sam Atkins
967314023c FileOperation: Implement 'Delete' operation 2021-07-22 12:48:44 +02:00
Sam Atkins
e99200cc23 FileOperation: Combine 'sources' and 'destination' CL arguments
The upcoming 'Delete' operation has no destination, so this was the
best solution we could come up with for now. Perhaps ArgsParser
could support sub-commands, so we would define 'Copy', 'Move' and
'Delete' each as sub-commands with their own argument definitions.
That would make things like git's variety of commands possible.
2021-07-22 12:48:44 +02:00
Sam Atkins
dd833dc220 FileManager: Rename FileOperation::Cut to FileOperation::Move 2021-07-22 12:48:44 +02:00
Sam Atkins
5090b1bdba FileManager: Set file op progress window's text based on the operation 2021-07-22 12:48:44 +02:00
Sam Atkins
0a62d517fd FileManager+FileOperation: Implement (and use) 'Move' command
`FileOperation Move ...` is now used for cut-and-paste in the
FileManager.
2021-07-22 12:48:44 +02:00
Sam Atkins
a1b4ec1507 FileOperation: Extract execute_work_items() from perform_copy()
This is in preparation for a perform_move() function.
2021-07-22 12:48:44 +02:00
Sam Atkins
516764ef17 FileManager: Show progress dialog for pasted files
For now, this is a slight step backwards, as Cut does not remove the
source files. This will be rectified next.
2021-07-22 12:48:44 +02:00
Sam Atkins
d8fb8b9583 FileManager: Move mass-copy code from DirectoryView to FileUtils
This is preparation for calling it from FileManager/main.cpp

Also made file_operation_windows take NonnullRefPtrs.
2021-07-22 12:48:44 +02:00
Sam Atkins
9060310840 FileManager: Combine drag&drop file copies into one progress window
This fixes #6902.

Previously, dragging and dropping multiple files would create a window
for each file or directory that was selected. Now, we combine them and
show one progress window for the whole batch. :^)
2021-07-22 12:48:44 +02:00
Sam Atkins
3267556ce4 FileOperation: Accept multiple source arguments
You can now list multiple files or directories and they will all be
copied to the destination. :^)

Note that this means you can pass the same file or directory multiple
times. It runs fine, just means that it does unnecessary work. But
figuring out if a file is already queued is probably more hassle than
it's worth, if it's even possible at all due to symlinks.
2021-07-22 12:48:44 +02:00
Sam Atkins
ca039e6ba1 FileManager+FileOperation: Switch to east const
(And some adjustments based on MaxWipfli's feedback)
2021-07-22 12:48:44 +02:00
Andreas Kling
1610669519 LibC: Make calloc() actually fail on multiplication overflow 2021-07-22 09:17:02 +02:00
Andreas Kling
e4c1514033 LibGfx: Use calloc() instead of malloc()+memset() Gfx::BitmapFont 2021-07-22 09:17:01 +02:00
Andreas Kling
027bfc4eff DesktopPicker: Make sure the applet always ends up in the same place 2021-07-22 09:17:01 +02:00
Timothy Flynn
d3c25593b9 LibJS: Implement String.prototype.split with UTF-16 code units
Also required implementing the SplitMatch abstract operation with UTF-16
code units.
2021-07-22 09:10:44 +02:00
Timothy Flynn
733a92820b LibJS: Implement String.prototype.replaceAll with UTF-16 code units 2021-07-22 09:10:44 +02:00
Timothy Flynn
06208aaa15 LibJS: Implement String.prototype.replace with UTF-16 code units 2021-07-22 09:10:44 +02:00
Timothy Flynn
bdbe716547 LibJS: Implement String.prototype.endsWith with UTF-16 code units 2021-07-22 09:10:44 +02:00
Timothy Flynn
d2e63a641f LibJS: Implement String.prototype.startsWith with UTF-16 code units 2021-07-22 09:10:44 +02:00
Timothy Flynn
f920e121b3 LibJS: Implement String.prototype.lastIndexOf with UTF-16 code units 2021-07-22 09:10:44 +02:00
Timothy Flynn
5ac964d841 LibJS: Implement String.prototype.slice with UTF-16 code units
This also implements String.prototype.slice more closely to the spec
(such as handling indices equivalent to Infinity).
2021-07-22 09:10:44 +02:00
Timothy Flynn
eaa1360eee LibJS: Implement StringPad abstract operation with UTF-16 code units
Affects String.prototype.padStart and String.prototype.padEnd.
2021-07-22 09:10:44 +02:00
Timothy Flynn
ef2ff5f88b LibJS: Implement String.prototype.at with UTF-16 code units 2021-07-22 09:10:44 +02:00
Timothy Flynn
892bfdbbcf LibJS: Implement String.prototype.substr with UTF-16 code units 2021-07-22 09:10:44 +02:00
Timothy Flynn
60d8852fc2 LibJS: Implement String.prototype.substring with UTF-16 code units 2021-07-22 09:10:44 +02:00
Timothy Flynn
767700d8a1 LibJS: Implement String.prototype.indexOf with UTF-16 code units 2021-07-22 09:10:44 +02:00
Timothy Flynn
70f9c7e1c7 LibJS: Implement String.prototype.includes with UTF-16 code units
This also implements String.prototype.includes more closely to the spec
(such as returning false when the search string is a RegExp object).
2021-07-22 09:10:44 +02:00
Timothy Flynn
a05ce330b8 LibJS: Implement String.prototype.codePointAt with UTF-16 code units
This also implements the CodePointAt abstract operation. This is needed
to handle invalid code units specific to the JavaScript spec, rather
than e.g. inserting replacement code units. This abstraction is public
because RegExp.prototype will also need it.
2021-07-22 09:10:44 +02:00
Timothy Flynn
48a28a9a73 LibJS: Implement String.prototype.charCodeAt with UTF-16 code units 2021-07-22 09:10:44 +02:00
Timothy Flynn
5d11614bc7 LibJS: Implement String.prototype.charAt with UTF-16 code units 2021-07-22 09:10:44 +02:00
Timothy Flynn
2bba20d123 LibJS: Report string properties using UTF-16 code units
String length is reported as the number of UTF-16 code units, and string
indices are reported as the UTF-16 code units themselves.
2021-07-22 09:10:44 +02:00
Timothy Flynn
0c42aece36 LibJS: Transcode UTF-8 strings to UTF-16 and add UTF-16 accessors
LibJS parses JavaScript as UTF-8, so when creating a string, we must
transcode it to UTF-16 to handle encoded surrogate pairs.

For example, consider the following string:
    "\ud83d\ude00"

The UTF-8 encoding of this surrogate pair is:
    0xf0 0x9f 0x98 0x80

However, LibJS will currently store the two surrogates individually as
UTF-8 encoded bytes, rather than combining the pair:
    0xed 0xa0 0xb8, 0xed 0xb8 0x80

These are not equivalent. So, as String.prototype becomes UTF-16 aware,
this encoding will no longer work for abstractions like strict equality.
2021-07-22 09:10:44 +02:00
Timothy Flynn
0e25d2393f LibJS: Add UTF-16 tests to String.prototype methods that already work
These methods did not require UTF-16 views, so just add test cases to
ensure they remain correct.

This also adds a couple of FIXME comments on tests that will fail even
with UTF-16 String.prototype support (for reasons such as lack of UTF-16
support in RegExp.prototype and Unicode case folding).
2021-07-22 09:10:44 +02:00
Gunnar Beutner
0e0985f15c Utilities: Make the columns for readelf fit all reloc types on x86_64 2021-07-22 08:57:01 +02:00
Gunnar Beutner
db1c5c4830 LibELF+Utilities: Avoid truncating 64-bit values
This fixes displaying 64-bit addresses in readelf and also fixes
showing backtraces from core dumps on x86_64.
2021-07-22 08:57:01 +02:00
Gunnar Beutner
36c3927169 Utilities: Make sure columns are properly aligned for readelf on x86_64 2021-07-22 08:57:01 +02:00
Gunnar Beutner
29c5dcd2fa Utilities: Make sure columns are properly aligned for pmap on x86_64 2021-07-22 08:57:01 +02:00
Gunnar Beutner
11e02f222d AK: Add a getter to JsonValue to get machine-native addresses 2021-07-22 08:57:01 +02:00
Gunnar Beutner
36e36507d5 Everywhere: Prefer using {:#x} over 0x{:x}
We have a dedicated format specifier which adds the "0x" prefix, so
let's use that instead of adding it manually.
2021-07-22 08:57:01 +02:00
Gunnar Beutner
31f30e732a Everywhere: Prefix hexadecimal numbers with 0x
Depending on the values it might be difficult to figure out whether a
value is decimal or hexadecimal. So let's make this more obvious. Also
this allows copying and pasting those numbers into GNOME calculator and
probably also other apps which auto-detect the base.
2021-07-22 08:57:01 +02:00
FrHun
7bfd319652 NetworkApplet: Omit unnecessary newline in tooltip 2021-07-22 04:33:41 +02:00
FrHun
02c0b1f380 LibGUI: Fix multi-line tooltip height
Tooltips had a wrong calculation for the height of a tooltip window,
because they forgot to take into account the line spacing.
2021-07-22 04:33:41 +02:00
Gunnar Beutner
3904541938 LibC: Don't truncate arguments for ioctl() on x86_64
Among other things this makes "less" work on x86_64.
2021-07-22 04:18:39 +04:30
Karol Kosek
f2c9ef3763 WindowServer: Reuse config variable from the class on theme change
When changing the theme, there were two Core::ConfigFile instances
(one class scoped -- m_config and one function scoped -- wm_config)
fighting over the file, resulting in not saving the new theme name
to the config. :^(

This makes WindowServer remember selected theme from the menu
after reboot!
2021-07-22 00:26:44 +02:00
Idan Horowitz
d804ce830d LibJS: Implement Temporal.PlainDate.prototype.equals & Required AO 2021-07-21 22:49:37 +01:00
Idan Horowitz
cf78efaef5 LibJS: Implement the ToTemporalDate Abstract Operation
This is required by most Temporal.PlainDate.prototype methods.
2021-07-21 22:49:37 +01:00
Idan Horowitz
1e471e2e2f LibJS: Add Temporal.Calendar.prototype.dateFromFields & required AOs
This is required for implementing the DateFromFields PlainDate AO.
2021-07-21 22:49:37 +01:00
Idan Horowitz
7a33a5c9b5 LibJS: Use trunc instead of a static_cast<i64> in is_integral_number
This ensures we return true for integers that do not fit in an i64 aka,
above 9223372036854775807. (2**63 - 1)
2021-07-21 22:49:37 +01:00
Idan Horowitz
44c8e158c1 LibJS: Remove usages of String's null state in Temporal AOs 2021-07-21 22:49:37 +01:00
Idan Horowitz
68aad5d8fa LibJS: Implement Temporal.PlainDate.prototype.valueOf 2021-07-21 22:49:37 +01:00
Karol Kosek
3c62b661f4 LibAudio: Fix UTF-8 decoding logic in FLAC decoding :^)
The problem here was that the multi-byte UTF-8 encoded characters
were taking one byte too much, misaligning the data completely
and eventually crashing the program on the 128th frame.

This change reduces the for loop by one, as it has been already
calculated from the start_byte variable.
2021-07-21 22:12:44 +02:00
Karol Kosek
9c71e43c3f LibAudio: Check if zero-bit padding is actually zero
This might allow the program to return an error a bit quicker.
2021-07-21 22:12:44 +02:00
Andreas Kling
687a12d7fb Userland: Add GUI::Window::add_menu() and use it everywhere
Applications previously had to create a GUI::Menubar object, add menus
to it, and then call GUI::Window::set_menubar().

This patch introduces GUI::Window::add_menu() which creates the menubar
automatically and adds items to it. Application code becomes slightly
simpler as a result. :^)
2021-07-21 21:24:26 +02:00
Ariel Don
a4fdb7f029 VimEditingEngine: Prevent crash upon 'x' or 'v' on blank lines
Previously, pressing 'x' for deletion on an otherwise empty line
insinuated a crash in TextEditor because a nonexistent code point was
accessed -- likewise for visual mode.
2021-07-21 21:13:57 +02:00
Andreas Kling
cdc1315dc8 LibJS: Use IntrusiveList for keeping track of WeakContainers 2021-07-21 20:17:55 +02:00
Andreas Kling
3fe1be20b7 LibJS: Use IntrusiveList for keeping track of MarkedValueLists 2021-07-21 19:51:19 +02:00
Andreas Kling
746b310061 LibJS: Use IntrusiveList for keeping track of HandleImpls
This allows us to remove a HashTable from heap and cuts down on
some of the malloc traffic when creating handles.
2021-07-21 19:45:21 +02:00
Andreas Kling
3d0c5814d2 LibGfx: Sprinkle [[nodiscard]] on Gfx::Bitmap 2021-07-21 18:09:05 +02:00
Andreas Kling
c7d891765c LibGfx: Use "try_" prefix for static factory functions
Also mark them as [[nodiscard]].
2021-07-21 18:02:15 +02:00
Andreas Kling
f0409081f5 LibC: Simplify assertion failure dbgln() a bit
There's no need to say USERSPACE(PID) since dbgln() will prefix lines
with that information anyway.
2021-07-21 17:45:24 +02:00
LuK1337
de09a92bf8 DesktopPicker: Add mouse wheel control
This lets us use scroll wheel up/down to move between columns and
shift + scroll wheel up/down to move between rows.
2021-07-21 18:04:30 +04:30
Jamie Mansfield
137d716495 LibLine: Correct spelling mistake in variable name
This corrects the spelling of 'matching' from 'macthing'.
2021-07-21 14:15:24 +02:00
Jamie Mansfield
3be472176d KeyboardSettings: Use typical OK-Cancel-Apply arrangement
This brings KeyboardSettings in line with the other settings
applications.
2021-07-21 12:34:27 +02:00
Ralf Donau
6629af8bed TextEditor: Tighten unveil
Only read access to the file_to_edit is required since
FileSystemAccessServer handles all other requests.
2021-07-21 10:47:22 +02:00
Mathias Jakobsen
4384a236b0 MouseSettings: Use latest (unsaved) setting for testing double-click
Instead of using the doubleclick_event this uses the current double-
click speed setting to check whether or not the colors of the double-
click icon should be inverted. This allows us to use the current (and
unsaved) setting for comparison instead of having to apply the settings
first.
2021-07-21 01:24:24 +02:00
Tom
7e8a5d7323 LibIPC: Fix losing messages when connection is closed
This fixes not processing any messages read up until a connection
close is detected. We were returning from the function despite having
read some messages.
2021-07-21 01:13:45 +02:00
Tom
1b7e2eb970 DisplaySettings: Add ComboBox to allow selecting other screens
This enables changing monitor settings for each monitor individually.

In the event that changing a resolution causes screens to overlap we
now try to disperse the screens, although the algorithm currently
implemented may result in some rather unexpected layouts in certain
cases. We can still improve this logic, and eventually we're going to
have a widget where the screens can be arranged as desired.
2021-07-21 00:06:58 +02:00
Tom
dbb9f891fb WindowServer: Re-use existing Screen instances and improve fallbacks
If a screen layout cannot be applied, instead of failing to start
WindowServer try to fall back to an auto-generated screen layout with
the devices that are detected.

Also, be a bit smarter about changing the current screen layout.
Instead of closing all framebuffers and bringing them back up, keep
what we can and only change resolution on those that we need to change
them on. To make this work we also need to move away from using an
array of structures to hold compositor related per-screen data to
attaching it to the Screen itself, which makes re-using a screen much
simpler.
2021-07-21 00:06:58 +02:00
Tom
1ecb725357 LibGfx: Add an algorithm to disperse overlapping rectangles 2021-07-21 00:06:58 +02:00
Karol Kosek
8a6f69f2c8 SoundPlayer: Use full path for playlist items
This fixes an issue with not opening tracks if they have been placed
in a subfolder.
2021-07-21 00:04:54 +02:00
Karol Kosek
f572ddd280 IRCClient: Use target nick than the sender for received private chats
Sending a private message from other device by using a bouncer
caused the message to appear in the wrong channel, as if you had sent
it to yourself.
2021-07-21 00:03:13 +02:00
davidot
295192bf15 LibJS: Add tests for strict mode and strict mode propagation 2021-07-20 23:45:28 +02:00
davidot
f8a869f2fc LibJS: Fix that non-existent references are unresolvable in strict mode 2021-07-20 23:45:28 +02:00
davidot
a49b47bfe6 LibJS: Fix tests that expected wrong this values 2021-07-20 23:45:28 +02:00
Timothy Flynn
c6e9c6d6ab LibJS: Follow the spec more closely when determining the this value
Co-authored-by: davidot <david.tuin@gmail.com>
2021-07-20 23:45:28 +02:00
davidot
a394aa5830 LibJS: Fix that vm.in_strict_mode was propagated to eval and functions
For eval it depends on the CallerMode and for a created function it
depends on the function itself.
2021-07-20 23:45:28 +02:00
davidot
a6263150be LibJS: Disallow unqualified deletes in strict mode 2021-07-20 23:45:28 +02:00
davidot
697882a7ad LibJS: Disallow multiple __proto__ keys in object expression 2021-07-20 23:45:28 +02:00
davidot
93b57e6d8c LibJS: Disallow static methods named prototype in classes 2021-07-20 23:45:28 +02:00
davidot
40b8689f9b LibJS: Disallow duplicated variable declarations 2021-07-20 23:45:28 +02:00
davidot
5cc518f07a LibJS: Handle strict mode for functions more correctly
If a function is strict (has 'use strict' directive) it cannot have
bindings, cannot have duplicated parameter names and cannot have some
reserved keywords and identifiers as parameter names.
The logic partly applies depending on whether we are already in strict
mode or the function contains 'use strict';
2021-07-20 23:45:28 +02:00
davidot
4485df1405 LibJS: Be more strict about reserved and special identifiers 2021-07-20 23:45:28 +02:00
davidot
2a61b90fef LibJS: Be less strict about 'use strict'
It is allowed to have (bogus) directives e.g.
'does nothing'; 'same'; 'use strict';
Should still trigger strict mode.
2021-07-20 23:45:28 +02:00
Aziz Berkay Yesilyurt
41ebb12c9e ImageViewer: Do not resize the window if the image fits into the window 2021-07-20 23:40:26 +02:00
Aziz Berkay Yesilyurt
63e78ccd9f ImageViewer: Do not return early when the scale is not changed
When the image is rotated, the scale is still the same, but the window
needs to be still resized.
2021-07-20 23:40:26 +02:00
Aziz Berkay Yesilyurt
285d4fac38 ImageViewer: Use the same function to resize the window
ImageViewer used two different logic to resize the display window, which
leads to confusing behaviour for rotate function. Now all the resizing
behaviour goes through the existing resize_window function.
2021-07-20 23:40:26 +02:00
Andreas Kling
a19a40d6d3 MouseSettings: Further tweaks to margins and spacing :^) 2021-07-20 22:51:45 +02:00
Andreas Kling
81e6560009 MouseSettings: Give this application a GUI facelift :^)
Note that the double-click "icon" adapts to the double-click speed
and also reacts to double-clicks. :^)
2021-07-20 21:50:06 +02:00
Andreas Kling
3652ab8b2a LibGUI: Tweak GUI::GroupBox title text position 2021-07-20 21:50:06 +02:00
Linus Groh
feea534dae LibJS/Tests: Fix typo in Temporal.Instant.compare test description 2021-07-20 17:57:50 +01:00
Linus Groh
99662975ed LibJS: Partially revert e3fa32b
This was causing some syntactically wrong inputs to crash and
subsequently broke CI (test262 parser tests).
2021-07-20 17:53:48 +01:00
Andreas Kling
e7136399a1 LibX86: Add INT1 instruction (needed for disassembly) 2021-07-20 18:05:05 +02:00
Andreas Kling
d0fb511d75 FileManager: Set main window size before showing the window
This prevents sometimes seeing a smaller FileManager window on startup
before it resizes to the proper size.
2021-07-20 18:05:05 +02:00
Alexander
d528c9c2ee LibWeb: Don't print JavaScript syntax error hints
This uses the new flag in print_errors to not print hints. This
decreases the load time of JavaScript heavy webpages with many errors
significantly.
2021-07-20 16:20:59 +02:00
Alexander
e3fa32b2ad LibJS: Optimize source_location_hint and add flag in print_errors
This optimizes the algorithm used in source_location_hint and adds a
flag to not print hints in print_errors.
2021-07-20 16:20:59 +02:00
Peter Elliott
2ce8cca7b5 LibC: Implement flock(2) using fcntl's F_SETLK
While flock is not a posix interface, it exists on linux and all BSDs as
far as I am aware.
2021-07-20 17:44:30 +04:30
Peter Elliott
3fa2816642 Kernel+LibC: Implement fcntl(2) advisory locks
Advisory locks don't actually prevent other processes from writing to
the file, but they do prevent other processes looking to acquire and
advisory lock on the file.

This implementation currently only adds non-blocking locks, which are
all I need for now.
2021-07-20 17:44:30 +04:30
Gunnar Beutner
fbc56461da Profiler: Make profiler not truncate 64-bit addresses 2021-07-20 15:12:19 +02:00
Gunnar Beutner
60b52cfb02 Userland: Hardcode the x86_64 kernel base address for now 2021-07-20 15:12:19 +02:00
Ali Mohammad Pur
3184086679 LibLine: Avoid excessive write() syscalls when refreshing the display
Previously, we were generating the display update one character at a
time, and writing them one at a time to stderr, which is not buffered,
doing so caused one syscall per character printed which is s l o w (TM)
This commit makes LibLine write the update contents into a buffer, and
flush it after all the update is generated :^)
2021-07-20 11:55:42 +04:30
Ali Mohammad Pur
0f6654fef2 LibLine: Reset the suggestion page offset when finding the max length
Otherwise, something like shift+tab->tab->tab will mess up the page
contents (assuming that the max lengths in the pages are different).
2021-07-20 11:55:42 +04:30
Ariel Don
54bf6a7884 LibGUI: Add Ctrl-U to insert mode
While under insert mode, Ctrl-U deletes all characters between the first
non-blank character of the line and the cursor.

Implement delete_from_line_start_to_cursor() in TextEditor. Then, call
the method in VimEditingEngine via its pointer to an instance of
TextEditor.
2021-07-20 03:22:28 +02:00
Ariel Don
8230bf8944 LibGUI: Add Ctrl-H to insert mode
In Vim, Ctrl-H is effectively equivalent to backspace in insert mode, as
it deletes the previous character.

This commit implements method delete_previous_char() to TextEditor.
delete_char() already exists in EditingEngine, but it deletes the
next character rather than the previous. delete_previous_char() is then
called from within VimEditingEngine.
2021-07-20 03:22:28 +02:00
Ariel Don
808e5e813f LibGUI: Add Ctrl-W to insert mode
In Vim's insert mode, Ctrl-W deletes the word before the cursor, like
Ctrl-Backspace. Unlike Ctrl-Backspace, if only whitespace exists between
the end of the word and the cursor, the word will be deleted with the
whitespace.

To do so, this commit introduces two methods: delete_previous_word() for
TextEditor and first_word_before() for TextDocument, where the former
depends on the latter. delete_previous_word() is then called in
VimEditingEngine.
2021-07-20 03:22:28 +02:00
Andreas Kling
59b6169b51 Taskbar: Update the start button width when system fonts change 2021-07-20 02:48:29 +02:00
Andreas Kling
f5e914fb9f LibTTF+LibGfx: Make Gfx::Font::bold_variant() work for TTF fonts
There's no need for this to be a virtual, it's just a font database
lookup and can be done in the Font base class.
2021-07-20 02:48:29 +02:00
Andreas Kling
9f601fcbcf LibTTF+LibGfx: Improve vertical alignment of glyphs
Before this patch, some glyphs had a weird off-by-1 vertical position
which looked really jarring at small font sizes.

This was caused by glyph bitmaps having different heights from each
other. (Each glyph bitmap was minimally sized to fit only the glyph
itself, and then vertically positioned during the paint phase.
Since this vertical positioning was integer based, subpixel precision
was lost and things ended up looking wonky.)

Fix this by making all glyph bitmaps be the same height so we can blit
them at the same integer y position. We use the typographic ascent from
the OS/2 table to transform the glyph coordinates.

The end result is a huge improvement visually. :^)
2021-07-20 02:48:29 +02:00
Andreas Kling
e984200206 LibTTF: Parse OS/2 tables
The OS/2 table contains nice typographic ascent/descent information.
2021-07-20 02:48:29 +02:00
Andreas Kling
3b1e05f714 LibTTF: Don't choke on fonts with CompositeGlyfFlags::UseMyMetrics
This was preventing us from loading JetBrains Mono Regular with LibTTF.
2021-07-20 02:48:29 +02:00
Andreas Kling
808f1f63ff LibTTF: Minor const correctness fix in TTF rasterizer 2021-07-20 02:48:29 +02:00
Andreas Kling
d8f435fa50 LibTTF: Propagate glyph bitmap allocation failure in rasterizer 2021-07-20 02:48:28 +02:00
Andreas Kling
7b3a4f8281 LibTTF: Rename "raster" => "rasterize" 2021-07-20 02:48:28 +02:00
Andreas Kling
8070bbd442 LibTTF: Convert code to east-const style 2021-07-20 02:48:28 +02:00
Linus Groh
37cc110003 Taskbar: Launch apps in Terminal when RunInTerminal=true is specified
This feels a bit awkward right now, and needs code duplication - I think
adding a mechanism to the AppFile class to run the executable would be
neat, especially if we add an arguments field to app files - but this
will do for now.
2021-07-20 00:58:26 +01:00
Linus Groh
4983a972b0 LibDesktop: Add a RunInTerminal boolean field to app files
This is common enough to warrant its own setting by now - but it's also
partially a workaround. Since app files currently only support a single
executable path with no arguments, we resort to generating wrapper
scripts for port launchers with arguments - and then the executable is
that shell script. We also moved from manually specifying icon files to
embedding them in executables. As shell scripts can't have icons
embedded in them, a different solution is needed - this one solves the
common case of running a CLI program in a terminal, and still allows
embedding of icons in the executable itself as no shell script is
needed, meaning it will be shown in the taskbar and system menu.

The second use case of actually passing arguments to the executable
itself (and not just "Terminal -e ...") is not covered by this and still
requires an external script (meaning no icon for now), but I think that
can easily be solved by adding something like an "Arguments" field to
app files. :^)
2021-07-20 00:58:26 +01:00
roepfeli
f44f7927a8 Help: Add check for pushing current page to history 2021-07-20 01:54:36 +02:00