Commit graph

9433 commits

Author SHA1 Message Date
Andreas Kling
415d6fb230 Revert "Build: Use fakeroot if non-root build is possible"
This reverts commit 3d342f72a7.

This is causing trouble for macOS users. Also it's painfully slow
compared to using the sudo method. This should definitely not be
the default since it punishes people who have genext2fs installed.
2020-05-13 01:18:14 +02:00
Linus Groh
d69ed91790 LibJS: Check AssignmentExpression LHS in parser
There are many cases which shouldn't even parse, like

null = ...
true = ...
false = ...
123 = ...
"foo" = ...

However this *is* valid syntax:

foo() = ...

So we still have to keep the current code doing a runtime check if the
LHS value is a resolvable reference. I believe this was declared valid
syntax to *in theory* allow functions returning references - though in
practice that isn't a thing.

Fixes #2204.
2020-05-13 01:15:29 +02:00
Linus Groh
063228c02e LibJS: Handle empty values in operator<<()
Otherwise something like dbg() << Value(); chokes on
ASSERT_NOT_REACHED() in Value::to_string()
2020-05-13 01:14:22 +02:00
Andreas Kling
fbeaf76f96 PaintBrush: Update the LayerModel when moving layers around
This ensures that the layer table view always shows the correct
coordinates for the layer.
2020-05-13 00:21:13 +02:00
Andreas Kling
40ffa8c626 PaintBrush: Switch to the "move" cursor while moving layers around 2020-05-13 00:16:54 +02:00
Andreas Kling
c2b5519ce2 LibGUI+WindowServer: Allow apps to use the "move" cursor :^) 2020-05-13 00:16:40 +02:00
Andreas Kling
23ee68c63e PaintBrush: Borrow the "move" cursor for the "move" tool :^) 2020-05-13 00:11:47 +02:00
Andreas Kling
3d50f40396 PaintBrush: Add a "Move" tool for moving layers around :^)
Tool mouse event handlers now receive both a layer-relative mouse event
and the original event. This is needed for the move tool since it moves
the layer and thereby changes the origin of future events every time it
moves.
2020-05-13 00:09:04 +02:00
Andreas Kling
58ee75c87a PaintBrush: Silence debug spam in Image compositing 2020-05-13 00:00:24 +02:00
Andreas Kling
9566f6c8b3 PaintBrush: Let's have Layer::rect() and Layer::relative_rect()
These two have the same semantics as GUI::Widget. The rect() is always
at location { 0, 0 }, while the relative_rect()'s location is relative
to the "parent", which in this case is the Layer's Image.
2020-05-12 23:49:52 +02:00
Andreas Kling
83d24dcb1d PaintBrush: Port all the existing toolbox tools to the Layer world :^)
Many tools are not working perfectly right yet, but we'll fix them!
2020-05-12 23:44:46 +02:00
Andreas Kling
7dd8f1b921 LibGUI: Add missing Vector.h include to Event.h 2020-05-12 23:28:08 +02:00
Andreas Kling
35c2d389f5 PaintBrush: Show the layer stack in a table view on the right hand side 2020-05-12 23:00:23 +02:00
Andreas Kling
985c2550c1 PaintBrush: Start refactoring to support layer-based images
The main editing widget is now the new ImageEditor widget, which works
on an Image object, which internally has a stack of Layer objects.

Layers are composited back-to-front when painting the Image inside an
ImageEditor.
2020-05-12 22:22:45 +02:00
Andreas Kling
a87f5e4154 Browser: Allow Ctrl+clicking on bookmark bar buttons :^) 2020-05-12 20:35:45 +02:00
Andreas Kling
977863ea07 LibGUI: Include keyboard modifier state with button on_click calls
This will allow you us to implement special behavior when Ctrl+clicking
a button.
2020-05-12 20:31:16 +02:00
Andreas Kling
3a905aed06 SystemMonitor: Remove the toolbar above the process table
This was looking a bit too whimsical and didn't really fit with the
overall look of the window anymore. The actions are available via
the context menu still.
2020-05-12 19:51:36 +02:00
Andreas Kling
8b8a5fc6c6 LibHTTP+ProtocolServer: Use CaseInsensitiveStringTraits for headers
These are supposed to be interpreted caselessly so let's just use the
case insensitive traits throughout. This means we'll understand things
like "Content-Length" even when they send "content-length" etc.
2020-05-12 19:10:01 +02:00
Andreas Kling
413ab652c8 LibIPC+IPCCompiler: Templatize encoding/decoding of Optional<T>
This was the last one! IPCCompiler no longer has any type-specific
encoding/decoding logic! :^)
2020-05-12 19:04:05 +02:00
Andreas Kling
6800f6eff5 LibDesktop: Remove accidental unused struct 2020-05-12 19:04:05 +02:00
Andreas Kling
fbda28248a LibGfx+IPCCompiler: Add IPC encoders for Color and ShareableBitmap 2020-05-12 19:04:03 +02:00
Andreas Kling
f8e3c8326d Terminal: When offering to open a URL, show name + icon for handler app
Instead of just saying "Open URL" when you right click on a hyperlink
in the terminal, we now say something like "Open in Browser". :^)
2020-05-12 18:49:24 +02:00
Andreas Kling
512c04c64f LaunchServer+LibDesktop: Add API to list handlers for a given URL
You can now ask for a list of applications that can handle opening
a given URL. This will be useful for creating context menus.
2020-05-12 18:49:24 +02:00
Andreas Kling
3775983dfe LibIPC+LibGfx: Templatize IPC encoding as well as decoding
Now most classes dictate how they are serialized and deserialized when
transmitted across LibIPC sockets. This also makes the IPC compiler
a bit simpler. :^)
2020-05-12 18:49:24 +02:00
Andreas Kling
cba4880301 LaunchServer: Remove tab characters in LaunchServer.ipc 2020-05-12 18:49:24 +02:00
Linus Groh
1383cd23bc LibJS: Add missing keywords/tokens
Some of these are required for syntax we have not implemented yet, some
are future reserved words in strict mode.
2020-05-12 18:47:38 +02:00
Andreas Kling
388ae07960 Browser: Some action fixes
- Use the same reload action in menu and toolbar
- Scope more actions inside Browser::Tab
2020-05-12 17:07:20 +02:00
Andreas Kling
8c51063a88 LibGUI: Actually check widgets in focus chain for keyboard shortcuts
We were iterating the ancestor chain of the focused widget when looking
for a matching keyboard shortcut, but we didn't actually look at the
ancestors at each step.

With this fix, we now correctly activate actions found in the ancestor
chain of the focused widgets. :^)
2020-05-12 17:05:00 +02:00
Andreas Kling
479f16bb6c LibGUI: Add KeyEvent::to_string()
This makes it way easier to debug key events.
2020-05-12 17:03:17 +02:00
Andreas Kling
90eec0a3d7 LibGUI: Use KeyCode stringification helper in Shortcut::to_string() 2020-05-12 17:02:33 +02:00
Andreas Kling
0ac9986c2f Kernel: Add a stringification helper for KeyCode 2020-05-12 17:02:20 +02:00
Andreas Kling
39d55d1d76 LibGUI: Add a way to highlight the focused widget for debugging
You can now pass --gui-focus-debug to any GUI::Application and it will
draw a cyan rectangle around the currently focused widget.
2020-05-12 15:48:31 +02:00
Andreas Kling
e064999e0d LibGUI: Allow scrolling through a ComboBox with the mouse wheel 2020-05-12 15:11:06 +02:00
Andreas Kling
18ff75e67b HackStudio: Don't crash when navigating backtrace with up/down keys
It's up to BacktraceModel::index() to validate its inputs.
2020-05-12 15:09:54 +02:00
Andreas Kling
575b674081 LibGUI: Add missing window() null check when widget's child is removed
Before notifying our window that a child was removed, we should first
check that we actually have a window! :^)
2020-05-12 14:06:25 +02:00
Andreas Kling
9d6c85e6a6 LibGUI: Remove ancient code for debugging widget underdraw 2020-05-12 13:43:37 +02:00
AnotherTest
0fbcb3c5b6 LibHTTP: Support Transfer-Encoding: chunked
We advertise ourselves to servers as supporting HTTP/1.1; we should put
our money where our mouth is, and start supporting some of its features.
2020-05-12 13:28:57 +02:00
AnotherTest
6b1ed26e6a LibC: Always assign the offset pointer to endptr in strto{u,}ll()
This patch makes strto{u,}l{l,}() behave more to-spec about endptr.
"If endptr is not NULL, strtoull stores the address of the first invalid
character in *endptr."
2020-05-12 13:28:57 +02:00
Nikolay Kochulin
3d342f72a7 Build: Use fakeroot if non-root build is possible
If genext2fs and fakeroot are installed, the build will no longer
require superuser privileges.
2020-05-12 10:22:46 +02:00
Linus Groh
0399b38f77 AK: Fix gcc 10.1 compiler warnings in Vector.h
It's complaining about "size_t >= 0" checks.

Fixes #2196.
2020-05-12 08:57:27 +02:00
AnotherTest
b64bb7a3e1 LibLine: Fix suggestion spacing regression
This patch fixes an issue where the line editor would put no spacing
between suggestions (only when there are two suggestions).
To reproduce, try on a build with no ports (starting with `pro`):
```
> pro<tab>
profilepro
```
2020-05-12 08:57:14 +02:00
Eryk Skalinski
ae3353bdbc LibWeb: Fixed non-spec processing of margin and padding 2020-05-12 08:53:58 +02:00
Andreas Kling
5f9d80d8bc LibWeb: Add basic support for CSS percentages
Many properties can now have percentage values that get resolved in
layout. The reference value (what is this a percentage *of*?) differs
per property, so I've added a helper where you provide a reference
value as an added parameter to the existing length_or_fallback().
2020-05-11 23:07:30 +02:00
Linus Groh
8ffdcce0d0 LibJS: Parse comma operator into SequenceExpression 2020-05-11 18:36:28 +02:00
Ben Wiederhake
71fd752289 LibC: Implement strtoull correctly
This fixes the behavior for several inputs:
- '-0' (shouldn't work but was accepted)
- '+3' (shouldn't work but was accepted)
- '13835058055282163712' (should work but returned 9223372036854775807 with errno=ERANGE)
2020-05-11 10:52:24 +02:00
Ben Wiederhake
4bff3defa8 LibC: strtod accuracy tests no longer need to skip 2020-05-11 10:52:24 +02:00
Ben Wiederhake
1f9dcdc41c LibC: Use more flexible digit parsing code, deduplicate 2020-05-11 10:52:24 +02:00
Ben Wiederhake
bc5d5bf75d LibC: Implement new strtod, accurate up to 8 eps
This strtod implementation is not perfectly accurate, as evidenced by the test
(accuracy_strtod.cpp), but it is sufficiently close (up to 8 eps).

The main sources of inaccuracy are:
- Highly repeated division/multiplication by 'base'
  (Each operation brings a multiplicative error of 1+2^-53.)
- Loss during the initial conversion from long long to double (most prominently,
  69294956446009195 should first be rounded to 69294956446009200 and then
  converted to 69294956446009200.0 and then divided by ten, yielding
  6929495644600920.0. Currently, it converts first to double, can't represent
  69294956446009195.0, and instead represents 69294956446009190, which
  eventually yields 6929495644600919.0. Close, but technically wrong.)

I believe that these issues can be fixed by rewriting the part at and after
    double value = digits.number();
and that the loss before that is acceptable.

Specifically, losing the exact exponent on overflow is obviously fine.
The only other loss occurs when the significant digits overflow a 'long long'.
But these store 64(-7ish) bits, and the mantissa of a double only stores 52 bits.
With a bit more thinking, one could probably get the error down to 1 or 2 eps.
(But not better.)

Fixes #1979.
2020-05-11 10:52:24 +02:00
Ben Wiederhake
c19d5943f1 LibC: Demonstrate strtod inaccuracy
See also #1979.
2020-05-11 10:52:24 +02:00
Linus Groh
5142acd13e LibWeb: Add very basic handling of "font-family" font stacks 2020-05-11 10:48:54 +02:00