Commit graph

13024 commits

Author SHA1 Message Date
Andreas Kling
f470657d57 LibWeb: Fix layout of replaced with width:auto + no intrinsic ratio
We can't compute width based on the intrinsic ratio if we have no
intrinsic ratio! The comment was correct, the code was not.
2020-09-12 18:18:20 +02:00
Andreas Kling
cd5570670c LibWeb: Implement <input type=submit> without using LibGUI
Following in the footsteps of <input type=checkbox>, this patch adds
LayoutButton which implements a basic push button using LibGfx styling
primitives.
2020-09-12 18:18:20 +02:00
Andreas Kling
94c55d9e37 LibWeb: Two mouse event handling fixes
- After letting a LayoutNode handle a mouseup, re-do the hit test
  since things may have changed.
- Make sure we always update the document's hovered node.
2020-09-12 17:55:19 +02:00
AnotherTest
d103686261 Spreadsheet: Implement a specialised version of printf for formatting
Now all format values will format a single double, cast to the
appropriate types.
2020-09-12 15:01:19 +02:00
AnotherTest
c2228b669d Spreadsheet: Allow customising the cell foreground and background colors 2020-09-12 15:01:19 +02:00
AnotherTest
8fa385f774 Spreadsheet: Allow cells to optionally have static fg/bg colors 2020-09-12 15:01:19 +02:00
AnotherTest
1674903dcc AK: Fix PrintfImplementation "%x" handling for u32
This also fixes an issue with the color input value being messed up.
oops :P
2020-09-12 15:01:19 +02:00
redoste
ad031ec5d7 LibWeb: Do not handle mouse events on disabled checkboxes 2020-09-12 15:00:39 +02:00
Andreas Kling
8d574c7363 LibIPC: Remove unused DisconnectedEvent mechanism
This was previously used to defer handling disconnections until the
next event loop iteration. We now achieve the same with simple use
of deferred_invoke(). :^)
2020-09-12 14:49:29 +02:00
Andreas Kling
4873e2bb53 LibIPC: Move notifier handling entirely to IPC::Connection base class 2020-09-12 14:49:29 +02:00
Andreas Kling
54116115a8 LibIPC: Remove debug spam on disconnection 2020-09-12 14:49:29 +02:00
Andreas Kling
d9e39cb82d LibWeb: Support window.alert() in multi-process context
Alerts are now delegated to the embedding GUI process.
2020-09-12 14:49:29 +02:00
Andreas Kling
aba793fb3e LibIPC: Share most of the code between {Client,Server}Connection
This patch introduces IPC::Connection which becomes the new base class
of ClientConnection and ServerConnection. Most of the functionality
has been hoisted up to the base class since almost all of it is useful
on both sides.

This gives us the ability to send synchronous messages in both
directions, which is needed for the WebContent server process.
Unlike other servers, WebContent does not mind blocking on a response
from its client.
2020-09-12 14:49:29 +02:00
Andreas Kling
633e0bc944 Revert "Meta: Enable gcc warning about struct vs. class"
This reverts commit d25860f53c.

This broke the Travis build.
2020-09-12 14:49:29 +02:00
Ben Wiederhake
e8dc99dcad Kernel: Remove spurious ProcessInspectionHandle
The class was removed in 538b985487.
2020-09-12 13:46:15 +02:00
Ben Wiederhake
83b85e5578 IRCClient: Remove unused dump() logic
A 'FIXME' asked for this to be removed, so I did.
2020-09-12 13:46:15 +02:00
Ben Wiederhake
8498a5678d Meta: Avoid deprecated qemu option
Apparently "-soundhw pcspk" is deprecated too. However, I don't know which "name"
to insert, and I can't test it, hence I didn't touch it.
2020-09-12 13:46:15 +02:00
Ben Wiederhake
8280dcfb89 LibC: Avoid write-back of unused value
This might make sleep() faster by up to pi nanoseconds, or less.
It's more about avoiding a senseless write than about optimization.
2020-09-12 13:46:15 +02:00
Ben Wiederhake
be1e4f28cc LibC: Don't advertise wrong functions
str{,n}casecmp is supposed to be *only* declared by strings.h, note the
trailing 's' in the filename.

We don't have any implementation for strlcat; using any strcat variants is
a bad idea anyway, given our implementation of AK::String.

TODO: Find a way to lint for declared-but-nowhere-defined functions.
2020-09-12 13:46:15 +02:00
Ben Wiederhake
d25860f53c Meta: Enable gcc warning about struct vs. class
I know, the tags don't actually matter. However, clang warns by default,
and instead of disabling the warning for clang I'd rather enable the warning
for gcc.
2020-09-12 13:46:15 +02:00
Ben Wiederhake
0d79e57c4d Kernel: Fix various forward declarations
I decided to modify MappedROM.h because all other entried in Forward.h
are also classes, and this is visually more pleasing.

Other than that, it just doesn't make any difference which way we resolve
the conflicts.
2020-09-12 13:46:15 +02:00
Ben Wiederhake
d16f510805 AK: Fix forward-declaration of Array 2020-09-12 13:46:15 +02:00
Ben Wiederhake
04e3122526 HackStudio: Reduce debug spam 2020-09-12 13:46:15 +02:00
Ben Wiederhake
da966ac8d8 LibMarkdown: Make warning messages conditional
This is especially a problem during fuzzing.
2020-09-12 13:46:15 +02:00
Ben Wiederhake
e3101c74c6 LibGUI: Use new Bitmap::minimum_pitch method
Also, make sure that the painter actually draws on a RGB(A) bitmap.

Closes #3460.
2020-09-12 11:35:41 +02:00
Linus Groh
568d53c9b1 LibJS: Check validity of computed_property_name() result before using it
This fixes two cases obj[expr] and obj[expr]() (MemberExpression and
CallExpression respectively) when expr throws an exception and results
in an empty value, causing a crash by passing the invalid PropertyName
created by computed_property_name() to Object::get() without checking it
first.

Fixes #3459.
2020-09-12 11:29:39 +02:00
Linus Groh
75dac35d0e LibJS: Stop unwinding and reset exception for TryStatement finalizer
This fixes two issues with running a TryStatement finalizer:

- Temporarily store and clear the exception, if any, so we can run the
  finalizer block statement without it getting in our way, which could
  have unexpected side effects otherwise (and will likely return early
  somewhere).
- Stop unwinding so more than one child node of the finalizer
  BlockStatement is executed if an exception has been thrown previously
  (which would have called unwind(ScopeType::Try)). Re-throwing as
  described above ensures we still unwind after the finalizer, if
  necessary.

Also add some tests specifically for try/catch/finally blocks, we
didn't have any!
2020-09-12 09:31:16 +02:00
Linus Groh
ec43f73b74 LibJS: Extract most of Interpreter's run() into execute_statement()
Interpreter::run() was so far being used both as the "public API entry
point" for running a JS::Program as well as internally to execute
JS::Statement|s of all kinds - this is now more distinctly separated.
A program as returned by the parser is still going through run(), which
is responsible for creating the initial global call frame, but all other
statements are executed via execute_statement() directly.

Fixes #3437, a regression introduced by adding ASSERT(!exception()) to
run() without considering the effects that would have on internal usage.
2020-09-12 09:31:16 +02:00
Ben Wiederhake
bd6390d8cb LibGfx: Validate size of incoming shared bitmap
Errors like this became more likely due to the 'optimized' memory usage.
Also, this prevents the WindowServer from being killed by a goofy program
sharing an incomplete bitmap, and likely some other scenarios.
2020-09-12 00:13:29 +02:00
Ben Wiederhake
9c3a33762b LibGfx: Saner memory usage of indexed bitmaps
Indexed bitmaps used to allocate four times the required amount of memory.

Also, we should acknowledge that the underlying data is not always RGBA32,
and instead cast it only when the true type is known.
2020-09-12 00:13:29 +02:00
Ben Wiederhake
d6673b384e LibGfx: Remove redundant bits() method
In all circumstances, this returned exactly the same thing as scanline_u8(),
so let's just remove the silly detour.

This does not add any new dependency on Bitmap-internals, because that already existed.
2020-09-12 00:13:29 +02:00
Ben Wiederhake
25ccd40d5a Meta: Describe how to analyze an LLVM fuzzer crash 2020-09-12 00:13:29 +02:00
Ben Wiederhake
e550df6467 LibGfx: Don't blindly trust file-internal offset
This also touches the return type of dib_size(), because kjdsfg
2020-09-12 00:13:29 +02:00
Ben Wiederhake
a098046309 LibGfx: Nicer error reporting for bitmap allocation 2020-09-12 00:13:29 +02:00
Ben Wiederhake
52a797afdb LibGfx: Protect against over-large bitmaps 2020-09-12 00:13:29 +02:00
Ben Wiederhake
98bfcb4b57 Meta+LibGfx: Fuzz BMP parsing 2020-09-12 00:13:29 +02:00
Ben Wiederhake
5d3c437cce LibJS: Fix start position of multi-line tokens
This broke in case of unterminated regular expressions, causing goofy location
numbers, and 'source_location_hint' to eat up all memory:

Unexpected token UnterminatedRegexLiteral. Expected statement (line: 2, column: 4294967292)
2020-09-12 00:13:29 +02:00
Ben Wiederhake
0d3a8d5397 AK: Fix accidentally-recursive call in BitStream 2020-09-12 00:13:29 +02:00
AnotherTest
bc9f8f5c39 Userland: Add an implementation of printf 2020-09-11 21:41:23 +02:00
AnotherTest
72edb33670 AK: Generalise 'PrintfImplementation'
This makes PrintfImplementation usable with any sequence, provided that
a 'next element' function can be written for it.
Does not affect the behaviour of printf() and co.
2020-09-11 21:41:23 +02:00
Andreas Kling
b62043dbca LibWeb: Protect LayoutCheckBox against crashes after event dispatch
After dispatching a "change" event due to the checked state being
modified, we may have been removed from the layout tree.

Make LayoutCheckBox protect itself to prevent this from crashing.

Also, add a little test page for checkboxes. :^)
2020-09-11 18:42:43 +02:00
Andreas Kling
71092226bd LibWeb: Dispatch a "change" event when <input> checked state changes 2020-09-11 18:42:43 +02:00
Andreas Kling
f2431adf47 LibWeb: Add basic support for <input type=checkbox>
This is implemented entirely inside LibWeb, there is no GUI::CheckBox
widget instantiated, unlike other input types. All input types should
be moved to this new style of implementation.
2020-09-11 18:42:43 +02:00
Andreas Kling
d6889ecf35 LibWeb: Allow layout nodes to receive and track mouse events
To implement form controls internally in LibWeb (necessary for multi
process forms), we'll need the ability to handle events since we can't
rely on LibGUI widgets anymore.

A LayoutNode can now override wants_mouse_events() and if it returns
true, it will now receive mousedown, mousemove and mouseup events. :^)
2020-09-11 18:42:43 +02:00
Andreas Kling
5782099106 LibWeb: Add basic support for boolean IDL attributes :^) 2020-09-11 18:42:43 +02:00
Andreas Kling
e7432efe24 LibWeb: Add the "checked" and "disabled" HTML attributes 2020-09-11 18:42:43 +02:00
Andreas Kling
1a2b626746 LibGUI+LibGfx: Move check box painting to Gfx::StylePainter
This will allow us to render check boxes from other places. :^)
2020-09-11 18:42:43 +02:00
pkotzbach
072e94caa2
LibCore: Fixed DeferredInvoke debug message (#3456) 2020-09-11 18:41:50 +02:00
asynts
3c03ce0c80 LibCompress: Add unit tests for CanonicalCode. 2020-09-11 16:07:45 +02:00
asynts
5c9c0082a1 LibCompress: Move CanonicalCode out of DeflateDecompressor. 2020-09-11 16:07:45 +02:00