Commit graph

13263 commits

Author SHA1 Message Date
Andreas Kling
468a29f4a1 LibGUI: Register the "text" property on GUI::TextEditor 2020-09-25 20:43:35 +02:00
Andreas Kling
a5878175e2 LibGUI: Register the "text" property on GUI::Label 2020-09-25 20:41:30 +02:00
Andreas Kling
d3adbed231 LibGUI: Move keyboard item activation up to AbstractView
All views want the same behavior, so move this to the base class. :^)
2020-09-24 21:35:47 +02:00
Andreas Kling
d8553a6406 LibGUI: Stop editing in views when the view is hidden
This fixes an issue in FileManager where an editor opened in the table
view mode would remain open after switching to the icon mode.
2020-09-24 21:14:14 +02:00
Maciej Zygmanowski
53f3313cee UserspaceEmulator: Use Core::ArgsParser 2020-09-24 20:24:12 +02:00
Andreas Kling
5a0b1c46aa LibGUI: Make inline editing work in ColumnsView
All it took was overriding content_rect() :^)
2020-09-24 11:50:47 +02:00
Andreas Kling
f52527ef9c LibGUI: Move editing key handling up to AbstractView
We want all views to respond to the editing key as long as the relevant
edit trigger is activated.
2020-09-24 11:42:11 +02:00
Andreas Kling
ece555b684 LibGUI: Support inline editing in GUI::IconView
IconView now responds to the editing key (F2) if the view is editable.
It does feel a little bit weird to have content_rect() return the text
rect for an item, and not the whole item rect. This internal API could
probably be better.
2020-09-24 11:40:19 +02:00
Andreas Kling
7d30cf7122 FileManager: Teach DirectoryView subviews to create editing delegates
This enables inline editing of filenames for table views, where this is
already supported. More work in LibGUI will be required to support the
feature in icon and columns views.
2020-09-24 11:36:02 +02:00
Andreas Kling
701787b906 LibGUI: Support editing filenames through FileSystemModel :^) 2020-09-24 11:30:14 +02:00
Andreas Kling
7f8e18b86a LibGUI: Make SortingProxyModel forward is_editable() and set_data()
This will allow us to edit models through a SortingProxyModel. :^)
2020-09-24 11:29:21 +02:00
Andreas Kling
b99eaad693 Kernel: Remove a whole bunch of unnecessary includes in Process.cpp 2020-09-24 10:49:43 +02:00
Andreas Kling
96fc476107 LibWeb: Add a separate UA style sheet for documents in quirks mode
We need to make some additional tweaks to the default UA style when
displaying documents in quirks mode.
2020-09-24 10:33:33 +02:00
asynts
1cb8be9906 Applications+IRCClient: Use new format functions. 2020-09-23 21:45:28 +02:00
asynts
5ed15a49f2 AK: Add outf, warnf and dbgf. 2020-09-23 21:45:28 +02:00
asynts
b7a4c4482f AK: Resolve format related circular dependencies properly.
With this commit, <AK/Format.h> has a more supportive role and isn't
used directly.

Essentially, there now is a public 'vformat' function ('v' for vector)
which takes already type erased parameters. The name is choosen to
indicate that this function behaves similar to C-style functions taking
a va_list equivalent.

The interface for frontend users are now 'String::formatted' and
'StringBuilder::appendff'.
2020-09-23 21:45:28 +02:00
asynts
3224fb7d55 AK: Allow calling format without arguments. 2020-09-23 21:45:28 +02:00
Andreas Kling
ed5407a3d7 js: Use VM::exception() instead of Interpreter::exception()
The VM is always there, but we only have an Interpreter while we are
running code.
2020-09-23 21:30:18 +02:00
Andreas Kling
60c2fba9b9 UserspaceEmulator+LibX86: Clean up some obnoxious template spam
Don't require clients to templatize modrm().read{8,16,32,64}() with
the ValueWithShadow type when we can figure it out automatically.
The main complication here is that ValueWithShadow is a UE concept
while the MemoryOrRegisterReference inlines exist at the lower LibX86
layer and so doesn't have direct access to those types. But that's
nothing we can't solve with some simple template trickery. :^)
2020-09-23 21:15:01 +02:00
Nico Weber
993ceb66fd UserspaceEmulator: Fix off-by-one in code cache access
m_cached_code_end points at the first invalid byte, so we need to
update the cache if the last byte we want to read points at the
end or past it.  Previously we updated the cache 1 byte prematurely in
read16, read32, read64 (but not in read8).

Noticed by reading the code (the code looked different from read8() and
the other 3).  I didn't find anything that actually hit this case.
2020-09-23 21:00:28 +02:00
AnotherTest
642b52cbb8 Base: Fixup forgotten 'example' heading name in Shell man page
As noticed in #3578.
2020-09-23 20:46:07 +02:00
Nico Weber
f1c0f661f4
UserspaceEmulator+LibX86: Add support for 64-bit memory reads and writes (#3584)
This is useful for reading and writing doubles for #3329.
It is also useful for emulating 64-bit binaries.

MemoryOrRegisterReference assumes that 64-bit values are always
memory references since that's enough for fpu support. If we
ever want to emulate 64-bit binaries, that part will need minor
updating.
2020-09-23 20:45:43 +02:00
Tibor Nagy
1fa5a526e8 LibGUI: Use on_up_pressed/on_down_pressed events in SpinBox
Fixes keyboard increment/decrement of SpinBox values.

After PR #2412 the TextBox class started not propagating arrow key
events to the parent widgets because it handles them itself now.
It also added two new events for these arrow keys, so use them instead
in SpinBox.
2020-09-23 20:44:23 +02:00
Tibor Nagy
5eefce11ed Themes: Set the ruler color in "Sunshine" to cold gray 2020-09-22 21:31:07 +02:00
Andreas Kling
37c287b1d4 LibWeb: Disallow cross-origin access to <iframe>.contentDocument
With this patch, we now enforce basic same-origin policy for this one
<iframe> attribute.

To make it easier to add more attributes like this, I've added an
extended IDL attribute ("[ReturnNullIfCrossOrigin]") that does exactly
what it sounds like. :^)
2020-09-22 20:10:20 +02:00
Andreas Kling
4c1f317572 LibWeb: Add Origin::is_same(const Origin&)
Getting ready for some extremely basic same-origin policy stuff,
this initial implementation simply checks that two origins have
identical protocol, host and port.
2020-09-22 20:10:20 +02:00
Andreas Kling
b4a3537716 LibWeb: Add WindowObject::origin()
This is a convenience getter to retrieve the security origin of a DOM
window's document.
2020-09-22 20:10:20 +02:00
Andreas Kling
618dcbe405 LibWeb: Dispatch DOM "load" event on <iframe> elements 2020-09-22 20:10:20 +02:00
Andreas Kling
86a4eaca38 LibWeb: Rename HTMLIFrameElement::hosted_frame() => content_frame()
This matches the standard API names contentWindow and contentDocument.
2020-09-22 20:10:20 +02:00
Andreas Kling
69bbf0285b LibJS: Let the VM cache an empty ("") PrimitiveString
Empty string is extremely common and we can avoid a lot of heap churn
by simply caching one in the VM. Primitive strings are immutable anyway
so there is no observable behavior change outside of fewer collections.
2020-09-22 20:10:20 +02:00
Andreas Kling
d1b58ee9ad LibJS: Move well-known symbols to the VM
No need to instantiate unique symbols for each Interpreter; they can
be VM-global. This reduces the memory cost and startup time anyway.
2020-09-22 20:10:20 +02:00
Andreas Kling
676cb87a8f LibJS: Use VM::exception() instead of Interpreter::exception() a bunch
There's a lot more of these things to fix. We'll also want to move from
passing Interpreter& around to VM& instead wherever that is enough.
2020-09-22 20:10:20 +02:00
Andreas Kling
d74bb87d46 LibJS: Add a way to get from a Cell to the VM 2020-09-22 20:10:20 +02:00
Andreas Kling
4a8bfcdd1c LibJS: Move the current exception from Interpreter to VM
This will allow us to throw exceptions even when there is no active
interpreter in the VM.
2020-09-22 20:10:20 +02:00
asynts
675b482fe7 AK: Add missing overload to format.
I had this in #3580 but I must have lost it during rebasing.
2020-09-22 19:06:06 +02:00
Tibor Nagy
3bd6142918 SystemMonitor: Wrap file descriptor and unveiled paths model into a SortingProxyModel 2020-09-22 19:05:50 +02:00
Tibor Nagy
f910cdcdb7 SystemMonitor: Fix assert when sorting by the "Page map" column 2020-09-22 19:05:50 +02:00
Tibor Nagy
e596b1da88 SystemMonitor: Wrap adapters and sockets model into a SortingProxyModel 2020-09-22 19:05:50 +02:00
Tibor Nagy
2c1b244889 SystemMonitor: Add sorting key to the devices model 2020-09-22 19:05:50 +02:00
asynts
eaeb793454 AK: Use format in String::number. 2020-09-22 15:06:40 +02:00
asynts
90536a1558 AK: Consider long and unsigned long as integral types.
Two things I hate about C++:

 1. 'int', 'signed int' and 'unsigned int' are two distinct types while
    'char, 'signed char' and 'unsigned char' are *three* distinct types.

    This is because 'signed int' is an alias for 'int' but 'signed char'
    can't be an alias for 'char' because on some weird systems 'char' is
    unsigned.

    One might think why not do it the other way around, make 'int' an
    alias for 'signed int' and 'char' an alias for whatever that is on
    the platform, or make 'char' signed on all platforms. But who am I
    to ask?

 2. 'unsigned long' and 'unsigned long long' are always different types,
    even if both are 64 bit numbers.

This commit fixes a few bugs that coming from this.

See Also: 1b3169f405.
2020-09-22 15:06:40 +02:00
asynts
e5497a326a AK: Add StringBuilder::appendff using the new format.
StringBuilder::appendf was already used, thus this name. If we some day
replace all usages of printf, we could rename this method.
2020-09-22 15:06:40 +02:00
asynts
4fcdc19b14 AK: Remove strtoull dependency from format.
This function is not avaliable in the kernel.

In the future it would be nice to have some sort of <charconv> header
that does this for all integer types and then call it in strtoull and et
cetera.

The difference would be that this function say 'from_chars' would return
an Optional and not just interpret anything invalid as zero.
2020-09-22 15:06:40 +02:00
Peter Elliott
7ba7b72736 Userland: Convert passwd(1) to use Core::Account
this fixes the passwd issues discovered in #3296
2020-09-21 20:18:05 +02:00
Peter Elliott
4a834f969f Userland: Switch su over to Core::Account 2020-09-21 20:18:05 +02:00
Peter Elliott
3d34724d37 LibCore: Add Core::Account for login management.
Core::Account abstracts login semantics like password checking and
switching uid/gid.
2020-09-21 20:18:05 +02:00
asynts
2bda21318c AK: Add format function like std::format or fmt::format. 2020-09-21 20:17:36 +02:00
asynts
b5ca74e78a AK: Add template deduction guides for Array. 2020-09-21 20:17:36 +02:00
asynts
d831b5738d AK: Add StringView::substring_view(size_t) overload. 2020-09-21 20:17:36 +02:00
Itamar
b7bd2ed9d2 HackStudio: Add auto-complete capability to the Editor 2020-09-21 20:16:03 +02:00