Commit graph

5754 commits

Author SHA1 Message Date
Davide Carella
f146ff87f1 CharacterMap: Added a new Shift+AltGr map.
If this map isn't found in a keymap the Alt+Gr map gets used.
2021-01-06 09:32:08 +01:00
Andreas Kling
92fe63fbec LibGfx: Tolerate PNGs with fewer palette entries than possible
We shouldn't reject indexed palette PNGs just because they have fewer
palette entries than the bit depth allows. Instead, we need to check
for OOB palette accesses and fail the decode *then*.
2021-01-06 01:34:25 +01:00
Andreas Kling
4a7d948f14 LibWeb: Simplify one kind of whitespace collapsing
For a non-empty TextNode chunk that begins with collapsible whitespace,
we can simply step right over the whitespace by adjusting the chunk.
2021-01-06 00:54:54 +01:00
Andreas Kling
8649f923ea LibWeb: Set override cursor on IPWV itself instead of whole window
When changing the mouse cursor (e.g when hovering over a link) we now
only change the InProcessWebView's override cursor instead of setting
the cursor at the window level.

This fixes an issue where the I-beam or hand cursors would somehow
"escape" from the web view and over to other widgets.
2021-01-05 22:22:44 +01:00
Andreas Kling
a6d52e0c97 LibWeb: Add a basic content filter (ad blocking!) :^)
This patch adds a global (per-process) filter list to LibWeb that is
used to filter all outgoing resource load requests.

Basically we check the URL against a list of filter patterns and if
it's a match for any one of them, we immediately fail the load.

The filter list is a simple text file:

    ~/.config/BrowserContentFilters.txt

It's one filter per line and they are simple glob filters for now,
with implicit asterisks (*) at the start and end of the line.
2021-01-05 21:20:15 +01:00
Andreas Kling
1c8eaf28cd LibGUI: Add GUI::Application::active_window()
Instead of each window having a bool flag that says whether that window
is currently active, have a pointer to the active window on the app
object instead.
2021-01-05 17:13:17 +01:00
Andreas Kling
8b90e8d08b LibGUI: Remove unused hook Window::on_activity_change 2021-01-05 17:13:16 +01:00
Andreas Kling
7d5a369ac9 LibGfx: Fail PGM decode if there isn't enough color data in image
If we have less pixel color data than we need to fill the image, just
fail the decode.

Found by oss-fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29127
2021-01-05 15:14:29 +01:00
Andreas Kling
5e95d62ffe LibTTF: Guard against unsigned overflow in TTF table parsing
Found by oss-fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29170
2021-01-05 14:50:17 +01:00
Andreas Kling
51b880b038 LibJS: Disable ASAN during the conservative GC stack scan
This allows the JS fuzzer to survive garbage collection (so we can find
more interesting bugs!)

Found by oss-fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29266
2021-01-05 12:27:45 +01:00
Andreas Kling
fdd974b7ef LibJS: Fix UB downcast during GlobalObject construction
When constructing a GlobalObject, it has to pass itself as the global
object to its own Shape. Since this is done in the Object constructor,
and Object is a base class of GlobalObject, it's not yet valid to cast
"this" to a GlobalObject*.

Fix this by having Shape store the global object as an Object& and move
Shape::global_object() to GlobalObject.h where we can at least perform a
valid static_cast in the getter.

Found by oss-fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29267
2021-01-05 12:02:59 +01:00
Rok Povsic
b4a783d923 TextEditor+EditingEngine: Add support for the basics of Vim emulation 2021-01-05 00:00:36 +01:00
Andreas Kling
da536c8d22 LibGUI: Add CommonActions::make_about_action()
This creates an "About" menu action given the app name and icon.
It takes care of showing the about dialog for you.
2021-01-04 23:31:42 +01:00
Andreas Kling
22325dd63e LibWeb: Don't careleslly insert inline-level boxes into inline-blocks
Just because an inline-block is inline doesn't mean it's ready to
accept random inline children. If it's a block, we may need to create
an anonymous wrapper first.

Fixes #4604.
2021-01-04 22:32:34 +01:00
Andreas Kling
d991658794 Kernel+LibC: Tidy up assertion failures with a dedicated syscall
This patch adds sys$abort() which immediately crashes the process with
SIGABRT. This makes assertion backtraces a lot nicer by removing all
the gunk that otherwise happens between __assertion_failed() and
actually crashing from the SIGABRT.
2021-01-04 21:57:30 +01:00
Andreas Kling
ce2894c95b LibWeb: Restart the cursor blink cycle whenever the user edits content
Having the text cursor disappear during rapid continuous editing is
quite jarring, so let's make sure we always restart the blink cycle
whenever the user performs some kind of editing action in a frame.
2021-01-04 20:48:27 +01:00
AnotherTest
1c4a425bff LibLine: Don't overwrite stuff when moving origin around
This fixes an issue (mainly) with multiline prompts, where a multiline
prompt would overwrite the lines before it when libline tries to display
it.
To reproduce, set `PROMPT="a\nb\nc> "` in the shell, then press return
a few times.
2021-01-04 19:13:18 +01:00
Andreas Kling
1e4b9a9cd9 LibGUI: Don't include invisible widgets in BoxLayout preferred size 2021-01-04 18:48:41 +01:00
Andreas Kling
21bacec13f LibGUI: Simplify ToolBarContainer by using shrink-to-fit
This class was implementing shrink-to-fit manually. No need for that
anymore now that we can use Widget's shrink-to-fit mode.
2021-01-04 18:21:05 +01:00
Andreas Kling
b03e1b08b5 LibGUI: Add Widget shrink-to-fit layout flag
If this flag is enabled for a widget, it will be automatically sized
based on its children. This only works for widgets using a layout.

This allows you to put widgets inside each other without having to
manually calculate how large the container should be. It's not the
perfect API but it's a decent progression in ergonomics. :^)
2021-01-04 18:17:14 +01:00
Andreas Kling
6041e48eaa LibCore: Make Core::Object::property() const 2021-01-04 13:41:13 +01:00
Emanuele Torre
370ce42430 Toolchain+LibTTF: Remove some blank line at the end of CMake files. 2021-01-03 23:58:54 +01:00
Linus Groh
0571a17f57 Kernel+LibELF: Store termination signal in coredump ProcessInfo 2021-01-03 22:12:42 +01:00
Tom
bc3c0fa936 LibCore: Allow caching and reusing the ProcFS file descriptors
Because ProcFS will refresh the data upon seek to 0, we can re-use
the same file descriptor. This saves us from having to open it every
time, but it also reduces the odds that we are unable to open a new
file descriptor due to low memory conditions.
2021-01-03 22:12:19 +01:00
Tom
cf89180c35 LibCore: Report error condition when reading process statistics failed 2021-01-03 22:12:19 +01:00
Linus Groh
e608723031 LibGUI: Add GMLFormatter
This will be useful for both the Playground app as well as for a
standalone CLI tool (à la clang-format). It cannot handle comments yet
(and will drop them from the formatted output), but other than that it
produces valid GML that matches the formatting we have so far! :^)
2021-01-03 22:12:08 +01:00
Linus Groh
acdbf66b54 LibGUI: Allow comment(s) before first class marker in GML parser
This wasn't considered valid GML but now is:

    // This is a comment
    // This as well
    @Foo::Bar {}
2021-01-03 22:12:08 +01:00
Andreas Kling
5cbcb35d34 LibELF: Add missing newlines at end of files 2021-01-03 17:26:03 +01:00
Andreas Kling
7e0226dd02 LibVT: Show terminal hyperlink targets as tooltips
This lets you see the target of a hyperlink before deciding to drag or
double click it.
2021-01-03 17:25:06 +01:00
Andreas Kling
347e5aa7b5 LibGUI: Hide the tooltip if widget with open tooltip unsets it
If you call set_tooltip({}) on a widget currently showing a tooltip,
we will now remove the tooltip window from screen.
2021-01-03 17:25:06 +01:00
Andreas Kling
a0f2135f47 LibVT: Make terminal hyperlinks double-click-to-activate
This patch makes hyperlinked terminal cells require a double click
to activate. The appearance of a hovered link is changed to not look
like a classic underlined link, but instead like some kind of typical
double-clickable GUI widget.

Also the hover cursor for links is changed from Hand to Arrow.
2021-01-03 17:25:06 +01:00
William Marlow
05345fc07d LibELF: Support relocating weak symbols against global libraries
A strong symbol anywhere in an executable must override any
weak symbol used in any library. This means that the weak symbol
must be overridden by a strong symbol even if the strong symbol
is in a dependent library. This means we need to perform relocations
twice, and resolve weak symbols globally before attempting to resolve
them locally. Consequentially we need to defer performing any
initialisations until after we have performed the second round of
relocations.
2021-01-03 17:15:55 +01:00
William Marlow
3e815ad5b1 Loader.so+LibELF: Move most of Loader.so's logic into ELF::DynamicLinker
Loader.so now just performs the initial self relocations and static
LibC initialisation before handing over to ELF::DynamicLinker::linker_main
to handle the rest of the process.

As a trade-off, ELF::DynamicLinker needs to be explicitly excluded from
Lagom unless we really want to try writing a cross platform dynamic loader
2021-01-03 17:15:55 +01:00
Emanuele Torre
ec8577ac3c LibGfx+Ports: Add missing newlines at the end of file. 2021-01-03 17:12:50 +01:00
Andreas Kling
7bb18215cb LibGUI: Use String::formatted() and String::number() more 2021-01-03 15:26:47 +01:00
Andreas Kling
f181ddb56a LibGUI: Use String::formatted() and String::number() more 2021-01-03 14:52:50 +01:00
Andreas Kling
5e157eaf37 LibWeb: Convert a bunch of String::format() => String::formatted() 2021-01-03 14:35:09 +01:00
Andreas Kling
70c59dcbf8 LaunchServer+LibDesktop: Add ability to allow URL without handler
This lets clients say they want to be able to open a specific URL
without specifying which handler to use.
2021-01-03 12:10:01 +01:00
Andreas Kling
1f1763c37a LaunchServer+LibDesktop: Add unveil-like mechanism for LaunchServer
Clients of LaunchServer can now provide a list of allowed handlers,
optionally with a specific set of URLs. The list can be sealed to
prevent future additions to it.

If LaunchServer receives a request to open something not on the allowed
handlers list, it will disconnect the client immediately.

The main idea here is to allow otherwise restricted programs to launch
specific things, e.g "Help" to open their manual, or "Browser" to load
the SerenityOS home page. :^)
2021-01-03 11:39:33 +01:00
Andreas Kling
8b2e7628fa LibGUI: Also specialize PgUp/PgDn/Home/End in line-wrapped TextEditors
This exposes some bugs in TextEditor's widget/document coordinate
conversions which we'll need to track down separately.
2021-01-03 10:49:20 +01:00
Andreas Kling
906e310411 LibGUI: Improve up/down arrow behavior in TextEditor with wrapping
Instead of moving between physical lines, the up/down arrow keys now
move between visual lines.
2021-01-03 10:49:20 +01:00
AnotherTest
7f7656fe4e LibGUI: Make the autocomplete box window a child of its editor's window
Fixes #4761.
2021-01-03 10:47:29 +01:00
AnotherTest
432c37cafc LibGUI: Stop the automatic autocomplete timer when typing whitespace
There's no reason to bring up autocomplete when the user is just
inserting indentation and spaces and such.
2021-01-03 10:47:29 +01:00
AnotherTest
3b2668e996 LibGUI: Register the various BoxLayouts
They're not exactly "widgets", but the widget registration registers
Core::Objects anyway.
2021-01-03 10:47:29 +01:00
AnotherTest
2b38b2f83b LibCore: Add a way to check if a property is readonly 2021-01-03 10:47:29 +01:00
Glenford Williams
b795f582cf LibGUI: Add missing properties to Widget gml
Add a few properties to Widget class for usage when in a gml environment
2021-01-03 10:34:55 +01:00
Andrew Kaster
39908fd569 LibGUI: Move widget registrations to the corresponding cpp file
This gets a lot of unecessary includes out of Widget.cpp. Doing this
didn't work before, but improvements in the C library and using dynamic
libraries have likely un-broken it :^).

Also, move the registration global object to an anonymous namespace. No
reason it has to be an extern symbol.
2021-01-03 10:31:42 +01:00
Luke
0bf44ac9d8 LibWeb: Fully implement end tag parsing in foreign content
Required to view the Spotify home page
2021-01-03 00:29:28 +01:00
Linus Groh
306aff80d0 LibGUI: Remove Widget's unused m_{foreground,background}_color
...as well as the few remaining references to set_foreground_color().

These properties are not being used for rendering anymore, presumably
because they completely mess up theming - assigning random white and
gray backgrounds just doesn't work with dark themes.
I've chosen to not replace most of the few remaining uses of this
broken functionality with custom palette colors (the closest
replacement is background_role) for now (except for Minesweeper where
squares with mines are painted red again now), as no one has actually
complained about them being broken, so it must look somewhat decent
(some just look right anyway). :^)

Examples of this are the taskbar buttons, which apparently had a
DarkGray foreground color for minimized windows once - this has since
been replaced with bold/regular font. Another one is the Profiler's
ProfileTimelineWidget, which is supposed to have a white background -
which it didn't have for quite some time, it's grey now (with the
default theme, that is). Doesn't look bad either.
2021-01-02 23:31:22 +01:00
Andreas Kling
05f5d0dda3 LibGfx: Add Gfx::TextAttributes (and use it in GUI::TextDocumentSpan) 2021-01-02 20:57:43 +01:00