Commit graph

9603 commits

Author SHA1 Message Date
Sergey Bugaev
88e23113ae Kernel: Tweak FileBackedFS API to avoid intermediary copies
read_block() and write_block() now accept the count (how many bytes to read
or write) and offset (where in the block to start; defaults to 0). Using these
new APIs, we can avoid doing copies between intermediary buffers in a lot more
cases. Hopefully this improves performance or something.
2020-05-19 11:07:35 +02:00
Sergey Bugaev
de4b7d9c21 Kernel: Make FS::block_size a size_t 2020-05-19 11:07:35 +02:00
Sergey Bugaev
9cbdd5f01e Kernel: Inline Inode::fsid() 2020-05-19 11:07:35 +02:00
Andreas Kling
3b11e471bd LibWeb: Allow reloading the current page with location.reload() 2020-05-18 22:05:13 +02:00
Andreas Kling
71007f6ebb LibWeb: Add location.protocol and location.host 2020-05-18 21:59:16 +02:00
Andreas Kling
efdfdbabdb LibWeb: Allow navigating to a new URL by setting window.location.href 2020-05-18 21:52:50 +02:00
Andreas Kling
1ec4db04cd LibWeb: Add a simple window.location object with some getters :^) 2020-05-18 21:42:40 +02:00
Andreas Kling
a1e7aa330c HackStudio: Don't use an OOB TextRange when looking for hovered text
We could going +1 past the end of a TextDocumentLine here. This caused
us to crash in the brave new world, so we could find it. :^)
2020-05-18 20:44:31 +02:00
Andreas Kling
4b202a3c79 LibCore+LibTLS: Don't keep a "ready to write" notifier on all Sockets
The "ready to write" notifier we set up in generic socket connection is
really only meant to detect a successful connection. Once we have a TCP
connection, for example, it will fire on every event loop iteration.

This was causing IRC Client to max out the CPU by getting this no-op
notifier callback over and over.

Since this was only used by TLSv12, I changed that code to create its
own notifier instead. It might be possible to improve TLS performance
by only processing writes when actually needed, but I didn't look very
closely at that for this patch. :^)
2020-05-18 20:16:52 +02:00
Andreas Kling
9eaf22090f test-crypto: Don't put TLSv12 in an OwnPtr as it's ref-counted :) 2020-05-18 20:15:56 +02:00
Andreas Kling
42651200d4 Base: Tweak browser toolbar icons to make them a bit livelier :^) 2020-05-18 19:38:20 +02:00
Matthew Olsson
e415dd4e9c LibJS: Handle hex and unicode escape sequences in string literals
Introduces the following syntax:

'\x55'
'\u26a0'
'\u{1f41e}'
2020-05-18 17:58:17 +02:00
Linus Groh
b3090678a9 LibJS: Add Math.clz32() 2020-05-18 17:57:28 +02:00
Linus Groh
452dbbc463 LibJS: Add Math.expm1() 2020-05-18 17:57:28 +02:00
Linus Groh
e375766f98 LibJS: Add Math.exp() 2020-05-18 17:57:28 +02:00
Linus Groh
b27834cf16 LibJS: Add Math.sign() 2020-05-18 17:57:28 +02:00
Andreas Kling
bdfd1f1545 LibGUI: Make text selection feel better in single-line editors
We should always stay on the only line when selecting in a single-line
editor, instead of requiring the user to keep the cursor inside the
text when selecting.

This broke with the variable-width font changes.
2020-05-18 17:55:21 +02:00
Andreas Kling
3d5233ae40 FileManager: Make the location box 2px taller 2020-05-18 17:51:09 +02:00
Andreas Kling
9895405b7c Browser: Make the location box 2px taller 2020-05-18 17:50:44 +02:00
Andreas Kling
62b7418376 LibGUI: Add 1px of horizontal content padding to TextEditor
This adds a little bit of needed air around the text.
2020-05-18 17:47:01 +02:00
Andreas Kling
558ca65ca5 LibGUI: Grow the "line content rect" slightly in single line text boxes
Previously we would sometimes leave some pixels from an old selection
rect on screen after clearing the selection. It was because the line
content rect was smaller than the visual selection rect, and we were
using the line content rect for invalidations.
2020-05-18 16:48:54 +02:00
Andreas Kling
22cd861c7e Calculator: Set a fixed-width font on the text box
GUI::TextEditor does not yet support right-aligned variable-width fonts
so just switch this to a fixed-width font for now.
2020-05-18 16:48:54 +02:00
Andreas Kling
a6e2125727 LibGUI: Use a variable-width font by default in single-line TextEditors
This makes things like the Browser location bar look way nicer. :^)
2020-05-18 16:48:54 +02:00
Andreas Kling
2e11c16be4 LibGUI: Support variable-width fonts in TextEditor
This patch reworks metric and coordinate computation to iterate over
text content instead of making assumptions about fixed glyph widths.
2020-05-18 16:48:54 +02:00
Andreas Kling
7207276697 AK: Make Utf32View::substring_view() with 0 length not crash
Just make it hand out a zero-length Utf32View :^)
2020-05-18 16:48:54 +02:00
Shannon Booth
195c1784ba WindowServer: Rename WindowManager wm_config() to config()
It looked a little silly with all of the callers saying wm.wm
2020-05-18 14:34:57 +02:00
Shannon Booth
d3eccf0409 WindowServer: Make some WindowManager member functions const 2020-05-18 14:34:57 +02:00
Shannon Booth
1048283186 WindowServer: Remove uneeded const_casts for getting a submenu 2020-05-18 14:34:57 +02:00
Shannon Booth
41471eb3ae WindowServer: Add const version of Menu::find_menu_by_id(int menu_id)
It's a little sad having two diferent versions of this function, but I
don't know of any better way to do it. This also gets rid of some const
casts down the line.
2020-05-18 14:34:57 +02:00
Shannon Booth
08064ed219 WindowServer: Add const qualified version of MenuItem::submenu() 2020-05-18 14:34:57 +02:00
Linus Groh
f06c12173c LibJS: Return early from parseFloat() if argument is a number
This saves us both a bit of time and accuracy, as Serenity's strtod()
still is a little bit off sometimes - and stringifying the result and
parsing it again just increases that offset.
2020-05-18 14:33:53 +02:00
Andreas Kling
088841202d LibGUI: Remove outdated FIXME in TextEditor 2020-05-18 14:25:57 +02:00
Andreas Kling
4402207b98 Kernel: WaitBlocker should always unblock immediately on WNOHANG
This fixes a problem where we'd block if a process with no children
would call sys$waitid() with WNOHANG. This unbreaks bash :^)
2020-05-18 13:07:20 +02:00
Linus Groh
eb72ba2466 LibJS: Remove is_nan() check in as_size_t() and fix to_size_t()
We need to call as_double() on the freshly converted number, not the
value itself.
2020-05-18 11:39:11 +02:00
AnotherTest
3bc3f36cfe LibLine: Handle unicode correctly
This commit also fixes a problem with us throwing out data that was
inserted while a command was running.
2020-05-18 11:31:43 +02:00
AnotherTest
a4e0b585fe AK: Add a way to get the number of valid bytes in a Utf8View 2020-05-18 11:31:43 +02:00
Linus Groh
07c765e258 Ports: Make bash link again
No idea why this was suddenly broken, but removing these duplicated
declarations make it build to completion again.
2020-05-18 11:29:08 +02:00
Nicholas Hollett
181eacd3ba LibVT: Pass the handler name to Launcher::open_url to control what gets launched
Now we can pick which application gets opened in the context menu for
URLs in the Terminal \o/
2020-05-18 11:27:27 +02:00
Nicholas Hollett
02cc3ac21f Base: Add file type & protocol definitions for known handlers.
This matches the existing user configuration in /home/anon/LaunchServer.ini
2020-05-18 11:27:27 +02:00
Nicholas Hollett
3c5f75ed53 LaunchServer: Discover handlers from *.af files, allow launching based on a known handler
Adds metadata about apps for what file types and protocols they can
handle, then consumes that in the LaunchServer. The LaunchServer can
then use that to offer multiple options for what apps can open a given
URL. Callers can then pass back the handler name to the LaunchServer to
use an alternate app :)
2020-05-18 11:27:27 +02:00
Linus Groh
36996bd720 LibJS: Rename to_{i32,size_t}() to as_{i32,size_t}() for clarity
As these parameter-less overloads don't change the value's type and
just assume Type::Number, naming them as_i32() and as_size_t() is more
appropriate.
2020-05-18 10:21:51 +02:00
Andreas Kling
014cb1a55b LibGUI: Tweak EmojiInputDialog layout :^) 2020-05-18 09:55:19 +02:00
Andreas Kling
5aba8cc750 Base: Add thinking face emoji (U+1F914) 🤔 2020-05-18 09:52:48 +02:00
Linus Groh
56502b0e84 LibJS: Check for exception after converting object to string primitive 2020-05-18 09:39:55 +02:00
Linus Groh
4569e88bea LibJS: Throw TypeError when coercing symbol to number 2020-05-18 09:39:55 +02:00
Linus Groh
476094922b LibJS: Pass Interpreter& to Value::to_number() et al.
This patch is unfortunately rather large and might make some things feel
bloated, but it is necessary to fix a few flaws in LibJS, primarily
blindly coercing values to numbers without exception checks - i.e.

interpreter.argument(0).to_i32();  // can fail!!!

Some examples where the interpreter would actually crash:

var o = { toString: () => { throw Error() } };
+o;
o - 1;
"foo".charAt(o);
"bar".repeat(o);

To fix this, we now have the following...

to_double(Interpreter&)
to_i32()
to_i32(Interpreter&)
to_size_t()
to_size_t(Interpreter&)

...and a whole lot of exception checking.

There's intentionally no to_double(), use as_double() directly instead.

This way we still can use these convenient utility functions but don't
need to check for exceptions if we are sure the value already is a
number.

Fixes #2267.
2020-05-18 09:39:55 +02:00
Linus Groh
1a1394f7a2 LibJS: Change Value::to_object(Heap& -> Interpreter&)
Passing a Heap& to it only to then call interpreter() on that is weird.
Let's just give it the Interpreter& directly, like some of the other
to_something() functions.
2020-05-18 09:39:55 +02:00
Linus Groh
b8b7f84547 LibJS: Remove no-op SymbolPrototype::description_setter()
We can just give put_native_property() a nullptr for the setter.
2020-05-18 09:36:14 +02:00
jarhill0
50c116e57b Base: Add smiling face with horns emoji (U+1F608) 😈 2020-05-18 09:36:00 +02:00
jarhill0
50336dc6ff Base: Add splashing sweat emoji (U+1F4A6) 💦 2020-05-18 09:36:00 +02:00