Commit Graph

21061 Commits

Author SHA1 Message Date
Tobias Christiansen
1ab82afee6 LibWeb: Add :not pseudoclass to the CSS parser
The selector given in the :not() is stored in the SimpleSelector as a
String.
2021-05-24 22:10:08 +01:00
Matthew Olsson
78f3bad7e6 LibPDF: Pre-initialize common FlyStrings in CommonNames.h 2021-05-25 00:24:09 +04:30
Matthew Olsson
cf3eb27108 PDFViewer: Add a toolbar
The toolbar has an option to toggle the sidebar, a number input to
set the current page, and two buttons to go up and down by one page
2021-05-25 00:24:09 +04:30
Matthew Olsson
cea7dbce42 PDFViewer: Add a tab bar with outlines and thumbnails
Outlines are in theory implemented (though I'm having trouble finding
a simple PDF with outlines to test it on), and thumbnails are not.
2021-05-25 00:24:09 +04:30
Matthew Olsson
67b65dffa8 LibPDF: Handle string encodings
Strings can be encoded in either UTF16-BE or UTF8. In either case,
there are a few initial bytes which specify the encoding that must
be checked and also removed from the final string.
2021-05-25 00:24:09 +04:30
Matthew Olsson
a08922d2f6 LibPDF: Parse outline structures 2021-05-25 00:24:09 +04:30
Matthew Olsson
777c232e16 AK: Add String::repeated(StringView, size_t count) 2021-05-25 00:24:09 +04:30
Matthew Olsson
be6e4b6f3c LibPDF: Store indirect value refs in Value objects
IndirectValueRef is so simple that it can be stored directly in the
Value class instead of being heap allocated.

As the comment in Value says, however, in theory the max bits needed to
store is 48 (16 for the generation index and 32(?) for the object
index), but 32 should be good enough for now. We can increase it to u64
later if necessary.
2021-05-25 00:24:09 +04:30
Matthew Olsson
534a2e95d2 LibPDF: Add basic color space support to the renderer
This commit only supports the three most basic color spaces:
DeviceGray, DeviceRGB, and DeviceCMYK
2021-05-25 00:24:09 +04:30
Matthew Olsson
f4941f5940 LibGfx: Add Color::from_cmyk 2021-05-25 00:24:09 +04:30
Matthew Olsson
f2d2f3fae7 LibPDF: Add a very poor path clipping implementation
This completely ignores the actual path and just uses its bounding box,
since our painter doesn't support clipping to paths.
2021-05-25 00:24:09 +04:30
Matthew Olsson
b6c884d20c LibGfx: Add Path::clear 2021-05-25 00:24:09 +04:30
Matthew Olsson
bf96ad674c LibPDF: Implement stubs for all graphical commands 2021-05-25 00:24:09 +04:30
Matthew Olsson
477e3946e5 LibPDF: Add support for stream filters
This commit also splits up StreamObject into PlainTextStreamObject and
EncodedStreamObject, which is essentially just a stream object which
does not own its bytes vs one which does.
2021-05-25 00:24:09 +04:30
Matthew Olsson
97cc482087 LibPDF: Make Reader::dump_state a bit more readable 2021-05-25 00:24:09 +04:30
Matthew Olsson
8c7ebc7a3f LibPDF: Do not assume value is an object in parse_indirect_value 2021-05-25 00:24:09 +04:30
Daniel Bertalan
e401ff0802 Userland: Fix stty not setting control characters
`AK::Result` does not work if both the error and value types are
integers.
2021-05-24 20:14:21 +01:00
Brendan Coles
7982f9aa70 HexEditor: Store UI layout preferences in config file 2021-05-24 20:11:41 +01:00
Andreas Kling
d1c8f4a2e0 Meta: Add Stephan Unverwerth to the contributors list :^) 2021-05-24 21:05:49 +02:00
Jelle Raaijmakers
dbbc583860 LibGUI/AbstractView: Expose activates_on_selection 2021-05-24 23:31:42 +04:30
Ali Mohammad Pur
27572c9d34 Base: Document the Shell's new termios allow-list
Also add `stty` to that list by default.
2021-05-24 23:26:49 +04:30
Ali Mohammad Pur
b2ef18d538 LibLine+Shell: Allow some programs to modify the current termios
This setting can be controlled by setting the
PROGRAMS_ALLOWED_TO_MODIFY_DEFAULT_TERMIOS _local_ shell variable to a
list containing such programs.
2021-05-24 23:26:49 +04:30
Ali Mohammad Pur
e318f12263 LibLine: Add bracketed paste mode support
This mode makes the editor insert all the "pasted" text into the buffer
without interpreting it in any way.
2021-05-24 23:26:49 +04:30
Stephan Unverwerth
e54d96d53e LibGL: Implement glReadPixels() 2021-05-24 19:03:25 +01:00
Stephan Unverwerth
d6c84ca4df LibGL: Implement glReadPixels() stub with argument validation 2021-05-24 19:03:25 +01:00
Stephan Unverwerth
24e74750d5 LibGL: Implement glReadBuffer() 2021-05-24 19:03:25 +01:00
Daniel Bertalan
0c6f019285 LibVT: Fix out-of bounds line insert
Unless DECOM mode is enabled, the cursor positions are measured from the
top left corner of the screen. We counted from the top margin, causing
line inserts in `vim` to go out-of-bounds and crash the terminal.
2021-05-24 22:26:54 +04:30
Daniel Bertalan
6465f87827 LibVT: Fix issues running nano
This commit fixes 3 correctness issues with the ANSI escape sequence
handling logic:
1. Default parameters were not handled correctly: the specification says
   that 0-valued CSI escape sequence parameters should take their
   default values.
2. We did not call `scroll_{up, down}` when encountering RI/IND commands
   that reached the scroll margins. This caused nano to only scroll the
   first line.
2021-05-24 22:26:54 +04:30
Daniel Bertalan
146bd794eb LibVT: Add Alternate Screen Buffer support
The Alternate Screen Buffer is used by full-screen terminal applications
(like `vim` and `nano`). Its data is stored separately from the normal
buffer, therefore after applications using it exit, everything looks
like it was before, the bottom of their interfaces isn't visible. An
interesting feature is that it does not support scrollback, so it
consumes less memory by not having to allocate lines for history.

Because of the need to save and restore state between the switches, some
correctness issues relating to it were also fixed in this commit.
2021-05-24 22:26:54 +04:30
Valtteri Koskivuori
cb8d0c8d0d LibCore+Userland: Add 13 more detectable file types
This patch adds 13 new detectable file formats, which are as follows in
alphabetical order:
.blend, .isz, ext* filesystem, Lua bytecode, Matroska container, NES
ROM, .pdf, qcow image, .rtf, WebAssembly bytecode, Windows 3.1X/95
compressed archive and raw zlib stream

Some are a tad esoteric, but the more file types we detect, the more
useful this utility becomes! :^)
2021-05-24 18:55:56 +01:00
Tobias Christiansen
9a1ac662f1 LibWeb: Don't try to load anything if src is empty in <img>
Previously we tried to load "" if the src was present but empty and
essentially only waited for RequestServer to time out.
2021-05-24 17:45:09 +01:00
Daniel Bertalan
708f835477 LibVT: Implement Bracketed Paste Mode
This mode allow us to escape any data that was not directly typed by the
user. `vim` currently uses this. If we implement it in the shell, we
could prevent newlines from being injected into the shell by pasting
text or dragging files into it (see #7276).
2021-05-24 16:58:57 +04:30
Daniel Bertalan
ee24f2eb2d LibVT: Add title stack support
This feature allows applications to reset the window title once they
exited. It is used by `vim` if `set title` is enabled.
2021-05-24 16:58:57 +04:30
Andreas Kling
439dc9b734 Meta: Add Jean-Baptiste Boric to contributors list :^) 2021-05-24 13:33:52 +02:00
Jean-Baptiste Boric
e4394b1605 LibGfx: Use anonymous buffer instead of raw anon_fd for Gfx::Bitmap
Instead of using a low-level, proprietary API inside LibGfx, let's use
Core::AnonymousBuffer which already abstracts anon_fd and offers a
higher-level API too.
2021-05-24 13:31:01 +02:00
Andreas Kling
de395a3df2 AK+Everywhere: Consolidate String::index_of() and String::find()
We had two functions for doing mostly the same thing. Combine both
of them into String::find() and use that everywhere.

Also add some tests to cover basic behavior.
2021-05-24 11:59:18 +02:00
Daniel Bertalan
875a2cbb71 LibVT+Kernel: Add support for setting cursor styles
This commit introduces support for 3 new escape sequences:
1. Stop blinking cursor mode
2. `DECTCEM` mode (enable/disable cursor)
3. `DECSCUSR` (set cursor style)

`TerminalWidget` now supports the following cursor types: block,
underline and vertical bar. Each of these can blink or be steady.
`VirtualConsole` ignores these (just as we were doing before).
2021-05-24 11:27:58 +02:00
Thomas Keppler
7dfc804d7d FontSettingsWidget: Reduce duplication in Label setup code
Pull out the Label updating code into its own function.
Ideally, we should probably transform this code to use its own widget
rather than doing this all in-line.
I.e., having a `FontSettingWidget` that that ties the FontPicker, Label
and Button into its own little widget, so that we can stay extendible in
the main widget and reduce duplication some more!
2021-05-24 09:08:23 +01:00
Thomas Keppler
a1f8c10fe5 FontSettingsWidget: Promote Labels as instance members
In order to not resolve the widgets twice, we capture them in ivars.
2021-05-24 09:08:23 +01:00
Thomas Keppler
883d0d2466 FontSettingsWidget: Display the default (fixed-width) font's name
Previously, the font was applied to the Labels but the name wasn't
updated on initial startup.
This meant that the Label's content was only correct in the default
state but not if the user changed the defaults.
2021-05-24 09:08:23 +01:00
Gunnar Beutner
ad6587424f Kernel: Disable profiling if setting up the buffer or timer failed 2021-05-24 09:10:50 +02:00
Andreas Kling
d3f298c592 LibIPC: Fix unaligned u32 access in drain_messages_from_peer()
Caught by userspace UBSAN. :^)
2021-05-24 09:04:22 +02:00
Andreas Kling
8f2425125e LibGfx+Base: Tweak bitmap fonts to ensure glyph data is 4-byte aligned
When building userland with UBSAN enabled (#7434), we were getting
spammed to death by unaligned access errors.

Fix these by adding 2 bytes of padding to the FontFileHeader struct,
and adjusting all our font files to match the new format. :^)
2021-05-24 08:18:34 +02:00
Jelle Raaijmakers
22d8778437 LibGfx/Matrix: Add inverse() and friends
Matrix inversion comes in quite handy in 3D projections, so let's add
`Matrix<N,T>.inverse()`. To support matrix inversion, the following
methods are added:

* `Matrix.first_minor()`
  See: https://en.wikipedia.org/wiki/Minor_(linear_algebra)
* `Matrix.adjugate()`
  See: https://en.wikipedia.org/wiki/Adjugate_matrix
* `Matrix.determinant()`
  See: https://en.wikipedia.org/wiki/Determinant
* `Matrix.inverse()`
  See: https://en.wikipedia.org/wiki/Invertible_matrix
* `Matrix.operator/()`
  To support easy matrix division :-)

Code loosely based on an implementation listed here:
https://www.geeksforgeeks.org/adjoint-inverse-matrix/
2021-05-24 00:33:18 +01:00
Daniel Bertalan
06c835f857 Kernel: Signal EOF/EOL characters properly in TTY
I introduced a regression in #7184 where `TTY` would report 1 byte read
in canonical mode even if we had no more characters left. This was
caused by counting the '\0' that denotes EOF into the number of
characters that were read.

The fix was simple: exclude the EOF character from the number of bytes.

This still wouldn't be correct by itself, as the EOF and EOL control
characters could change between when the data was written to the TTY and
when it is read. We fix this by signaling out-of-band whether something
is a special character. End-of-file markers have a value of zero and
have their special bits set. Any other bytes with a special flag are
treated as line endings. This is possible, as POSIX doesn't allow
special characters to be 0.

Fixes #7419
2021-05-24 00:06:06 +01:00
Lynn
d3aae59478 tar: Ignore "extended headers"
Looking around online, it seems like this is normally a bit of
metadata that the extract operation can safely ignore.
2021-05-24 00:01:01 +01:00
Marcus Nilsson
6b85c7647c
Browser: Add context menu with history for back/forward button
Right clicking on back or forward will now show a context menu with
URLs to navigate to. Also added an optional argument for the number of
steps in go_back() and go_forward().
2021-05-23 23:58:00 +01:00
Gunnar Beutner
0688e02339 Kernel: Make sure we only log profiling events when m_profiling is true
Previously the process' m_profiling flag was ignored for all event
types other than CPU samples.

The kfree tracing code relies on temporarily disabling tracing during
exec. This didn't work for per-process profiles and would instead
panic.

This updates the profiling code so that the m_profiling flag isn't
ignored.
2021-05-23 23:54:30 +01:00
Idan Horowitz
a8ca4751b9
CI: Update comment-on-pr to a version that supports pull_request_target (#7431)
The previous version unfortunately didn't work for that workflow type if
the author of the PR did not already have write access to the repo.
2021-05-23 23:37:45 +01:00
Andrew Kaster
d3af011562 CI: Enable more verbose and strict sanitizer options
Options shamelessly stolen from this article on systemd's website:

https://systemd.io/TESTING_WITH_SANITIZERS/

We make ASAN more strict and tell UBSAN to print more verbose output on
failure. One of the more interesting ASAN options,
detect_stack_use_after_return, sadly causes both UBSAN and ASAN failures
in test-js.
2021-05-23 23:30:46 +01:00