Commit graph

43403 commits

Author SHA1 Message Date
Timothy Slater 3d542b0c38 PixelPaint: Add lasso selection tool
Lasso selection works by allowing the user to draw an arbitrary shape
much like the pen tool and ensuring the shape is closed by connecting
the start/end points when the user is done drawing. Everything inside
the shape becomes the selection.

Selection is determined via an outer flood fill. We begin a flood fill
from a point that is guaranteed to be outside of the drawn shape, and
anything the fill doesn't touch is determined to be the selection
region.
2022-11-25 22:52:45 +01:00
Timothy Slater dc5402f61e PixelPaint: Clear selection with escape key regardless of active tool
This makes ImageEditor responsible for clearing the active selection
when the escape key is pressed. If the active tool didn't act on the
Escape key (like some selection tools use this to indicate cancelling of
making a new selection), then ImageEditor will check for an active
selection and clear it.
2022-11-25 22:52:45 +01:00
Baitinq d6bb110d89 LibWeb: Handle disabling of StyleSheet HTMLLinkElements
We now can handle dynamic updating of the disabled attribute of a <link>
of the stylesheet type.

We do this by hooking the adding and removing attribute's handlers and
dynamically loading/removing the stylesheet if it has been
enabled/disabled.
2022-11-25 22:52:05 +01:00
Andreas Kling c884aa3f25 Base: Add a test for [SameObject] behavior in LibWeb 2022-11-25 22:49:59 +01:00
Andreas Kling 2157745093 LibWeb: Add missing [SameObject] extended attributes in IDL files 2022-11-25 22:49:59 +01:00
Andreas Kling 8540c4e574 LibWeb: Implement [SameObject] for HTMLTableElement.{rows,tBodies} 2022-11-25 22:49:59 +01:00
Andreas Kling ad36bc72f4 LibWeb: Implement [SameObject] behavior for HTMLTableSectionElement.rows 2022-11-25 22:49:59 +01:00
Andreas Kling d7c58aa58d LibWeb: Implement [SameObject] behavior for HTMLFormElement.elements 2022-11-25 22:49:59 +01:00
Andreas Kling 7d8ff0c581 LibWeb: Implement [SameObject] behavior for HTMLTableRowElement.cells 2022-11-25 22:49:59 +01:00
Julian Offenhäuser d1bc89e30b LibPDF: Try to repair XRef tables with broken indices
An XRef table usually starts with an object number of zero. While it
could technically start at any other number, this is a tell-tale sign
of a broken table.

For the "broken" documents I encountered, this always meant that some
objects must have been removed from the start of the table, without
updating the following indices. When this is the case, the document is
not able to be read normally.

However, most other PDF parsers seem to know of this quirk and fix the
XRef table automatically.

Likewise, we now check for this exact case, and if it matches up with
what we expect, we update the XRef table such that all object numbers
match the actual objects found in the file again.
2022-11-25 22:44:47 +01:00
Julian Offenhäuser e06a065594 LibPDF: Override Type 1 character mappings by encoding in font dict
If the font dictionary includes an "Encoding" entry, it will be used
instead of the PS1FontProgram's built-in encoding.
2022-11-25 22:44:47 +01:00
Julian Offenhäuser 65ff80e8a5 LibPDF: Add alternative names to is_standard_latin_font() helper 2022-11-25 22:44:47 +01:00
Julian Offenhäuser 9cb3b23377 LibPDF: Move all font handling to Type1Font and TrueTypeFont classes
It was previously the job of the renderer to create fonts, load
replacements for the standard 14 fonts and to pass the font size back
to the PDFFont when asking for glyph widths.

Now, the renderer tells the font its size at creation, as it doesn't
change throughout the life of the font. The PDFFont itself is now
responsible to decide whether or not it needs to use a replacement
font, which still is Liberation Serif for now.

This means that we can now render embedded TrueType fonts as well :^)

It also makes the renderer's job much more simple and leads to a much
cleaner API design.
2022-11-25 22:44:47 +01:00
Julian Offenhäuser e748a94f80 LibPDF: Introduce loading of common font data in PDFFont base class
This font data is shared between Type 1 and TrueType fonts, which is
why we can now load it in the base class that they both use.
2022-11-25 22:44:47 +01:00
Julian Offenhäuser dd82a026f8 LibPDF: Pass PDFFont::draw_glyph() a char code instead of a code point
We would previously pass this function a unicode code point, which is
not actually what we want here.

Instead, we want the "raw" code point, with the font itself deciding
whether or not it needs to be re-mapped.

This same mistake in terminology applied to PS1FontProgram.
2022-11-25 22:44:47 +01:00
Julian Offenhäuser 8532ca1b57 LibPDF: Convert dash pattern array elements to integers if necessary
They may be floats instead.
2022-11-25 22:44:47 +01:00
Liav A 71536e91c5 Documentation: Add a document about TmpFS 2022-11-25 14:43:28 -07:00
Liav A 9e7d099678 Documentation: Add guidelines document for kernel development 2022-11-25 22:34:32 +01:00
kleines Filmröllchen 66c903424c Base: Add an example presentation
This contains CatDog and uses most of the currently supported features.
2022-11-25 14:28:33 -07:00
kleines Filmröllchen de44d6c0a6 Applications: Add Presenter
This version can already:
- load all of the defined file format except for the image type and the
  frame-specific stuff
- navigate frames and slides (though frames are mostly stubbed out)
- display text with various common settings
- displays text with various fitting and scaling methods
- scale and position objects correctly no matter the window size
2022-11-25 14:28:33 -07:00
kleines Filmröllchen 295f83e54c Base: Document Presenter and its file format 2022-11-25 14:28:33 -07:00
kleines Filmröllchen af439cf3af LibGfx: Add Size::match_aspect_ratio
This will create a size that matches the given aspect ratio while
preserving one of the two dimensions.
2022-11-25 14:28:33 -07:00
kleines Filmröllchen 5b5b4f57fa LibGfx: Add Size::aspect_ratio
This can compute the aspect ratio of the size.
It can use another type for these computations,
which is important for integer sizes.
2022-11-25 14:28:33 -07:00
kleines Filmröllchen 2be89597a8 Base: Create "Office" Application category
This category includes anything useful for getting work done with your
computer. It is mostly a split-off from the Utilites category which was
becoming very large.
2022-11-25 14:28:33 -07:00
kleines Filmröllchen 4777dc75c5 LibCore: Allow array-like rectangle specifications for rect properties
This allows rectangle specifications in the form [x, y, width, height],
which mirrors margin properties and is much more convenient than the
JSON object specifications that were allowed before. Those are still
allowed, of course.
2022-11-25 14:28:33 -07:00
sin-ack 3b03077abb Kernel: Update the ".." inode for directories after a rename
Because the ".." entry in a directory is a separate inode, if a
directory is renamed to a new location, then we should update this entry
the point to the new parent directory as well.

Co-authored-by: Liav A <liavalb@gmail.com>
2022-11-25 17:33:05 +01:00
Aliaksandr Kalenik 2b246d980a LibWeb: Fix typo in calculate_inner_height 2022-11-25 17:06:59 +01:00
Aliaksandr Kalenik 7bc7790912 LibWeb: Flex, grid and table containers should not create BFC
Fixes https://github.com/SerenityOS/serenity/issues/16082
2022-11-25 10:45:37 +01:00
Lucas CHOLLET 1944e8936d cat: Return a non-null value if an error occurred 2022-11-24 21:01:54 -05:00
Lucas CHOLLET 71c9da90b6 cat: Use Core::Stream::File 2022-11-24 21:01:54 -05:00
Zaggy1024 7514e49c17 LibVideo: Make all VP9 block intermediates stack-allocated arrays
This has two benefits:
- I observed a ~34% decrease in decoding time running TestVP9Decode.
- Removing all of these silly Vector fields helps simplify the code
  relationships between all the functions in Decoder.cpp. It'll also be
  much easier to make these static with template specializations, if
  that turns out to be worthy performance improvement.
2022-11-25 02:44:18 +03:30
Andreas Kling c922d21ecb LibJS: Unbreak test262-parser-tests after source range caching changes
Turns out we have to be a little more lenient when dealing with the
slightly hostile inputs in tests262-parser-tests.

This fix papers over some problematic situations by returning a fallback
range if we can't figure out exactly where an error occurred.
I've added a FIXME about returning nicer values.
2022-11-24 18:01:52 +01:00
Andreas Kling d16fab5815 LibJS: Avoid unnecessary SourceRange construction in parse_program()
This takes `test-js` runtime from 4.3 sec to 4.1 sec on my machine.
2022-11-24 16:06:20 +00:00
Andreas Kling f0482b61bf LibJS: Make Error stack trace generation faster with a line break cache
Generating Error objects got a lot slower after the introduction of
SourceCode in b0b022507b.

This was noticeable with `test-js` which generates a lot of errors,
so walking the source code over and over to compute (line, column)
was eating a ton of time.

This patch makes repeated lookups a lot faster by building a cache
of line break offsets in the source code. The cache is built on first
offset lookup, so we only pay for this in code that actually throws.

On my machine, this takes `test-js` runtime from 6.7 sec to 4.3 sec.
2022-11-24 16:06:20 +00:00
Andreas Kling e7ba03ddd1 AK: Add Utf8View::iterator_at_byte_offset_without_validation()
Unlike iterator_at_byte_offset(), this function assumes the provided
byte offset is a valid offset into the UTF-8 character stream.

This avoids walking the stream from the start.
2022-11-24 16:06:20 +00:00
Baitinq 45e22dafb3 Meta: Look for e2fsck path on build-image-qemu.sh
Now we attempt to look for the path of e2fsck before checking if the
path can be found in any of the predefined routes. This fixes e2fsck
not being found on some "special" distros like NixOS.

Related #13754
2022-11-24 16:58:30 +01:00
Andreas Kling 5556b27e38 Kernel: Update tv_nsec field when using utimensat() with UTIME_NOW
We were only updating the tv_sec field and leaving UTIME_NOW in tv_nsec.
2022-11-24 16:56:27 +01:00
Andreas Kling 376b3c95f7 LibCore: Use utimensat() in Core::File to preserve nanosecond timestamps
This takes care of two FIXMEs! :^)
2022-11-24 16:56:27 +01:00
Andreas Kling a9d55ddf57 Kernel/TmpFS: Update mtime instead of ctime when asked to update mtime 2022-11-24 16:56:27 +01:00
Andreas Kling 10fa72d451 Kernel: Use AK::Time for InodeMetadata timestamps instead of time_t
Before this change, we were truncating the nanosecond part of file
timestamps in many different places.
2022-11-24 16:56:27 +01:00
Andreas Kling f8290e1ad4 stat: Show nanosecond part of file timestamps 2022-11-24 16:56:27 +01:00
Daniel Bertalan efaf9f137a LibIPC: Handle ECONNRESET when reading from the IPC socket
Reading from a socket with a dead peer returns the `ECONNRESET` error
code in some cases on Linux. This commit changes LibIPC to gracefully
shut down the socket if that happens, fixing an occasional crash in
Ladybird.

Fixes SerenityOS/ladybird#116
2022-11-24 14:37:13 +01:00
Jelle Raaijmakers 45108438ce Ports: Fix warning when building with useconfigure="false"
When building a port with `useconfigure="false"`, the `do_configure`
function invokes a `buildstep` with multiple positional arguments as the
command to execute.

It then tests whether the positional arguments evaluate to an emtpy
string, but could fail when multiple positional arguments were provided.
This resulted in the following warning when building the Composer port,
for example:

  ../.port_include.sh: line 16: [: echo: binary operator expected

Prevent this warning by testing against the number of positional
arguments, instead.
2022-11-24 12:06:25 +00:00
Jelle Raaijmakers fef0330ee5 Ports: Clean up PHP's package.sh 2022-11-24 10:52:10 +00:00
Jelle Raaijmakers aa32207746 Ports: Update PHP to 8.1.12 2022-11-24 10:52:10 +00:00
Jelle Raaijmakers f89d6a046f Ports: Configure LibCrypt include path for PHP
Since ac40197047 LibCrypt has its own library. PHP tries to detect the
`crypt_data` struct but fails to do so since it cannot find `crypt.h`.
By adding this explicit include path, PHP builds again.
2022-11-24 10:52:10 +00:00
Jelle Raaijmakers f0a4cc2d80 LibCrypt: Clean up crypt_r
Remove an unused constant, use a C++-style `reinterpret_cast` and employ
an early return to remove excessive indentation. No functional changes.
2022-11-24 10:52:10 +00:00
Xexxa 2f7873d427 Base: Add emoji for current and former Norwegian subdivisions
🏴󠁮󠁯󠀰󠀱󠁿 - U+1F3F4 U+E006E U+E006F U+E0030 U+E0031 U+E007F NO-01
Østfold
🏴󠁮󠁯󠀰󠀳󠁿 - U+1F3F4 U+E006E U+E006F U+E0030 U+E0033 U+E007F NO-03
Oslo
🏴󠁮󠁯󠀰󠀴󠁿 - U+1F3F4 U+E006E U+E006F U+E0030 U+E0034 U+E007F NO-04
Hedmark
🏴󠁮󠁯󠀰󠀵󠁿 - U+1F3F4 U+E006E U+E006F U+E0030 U+E0035 U+E007F NO-05
Oppland
🏴󠁮󠁯󠀰󠀶󠁿 - U+1F3F4 U+E006E U+E006F U+E0030 U+E0036 U+E007F NO-06
Buskerud
🏴󠁮󠁯󠀰󠀹󠁿 - U+1F3F4 U+E006E U+E006F U+E0030 U+E0039 U+E007F NO-09
Aust-Agder
🏴󠁮󠁯󠀱󠀰󠁿 - U+1F3F4 U+E006E U+E006F U+E0031 U+E0030 U+E007F NO-10
Vest-Agder
🏴󠁮󠁯󠀱󠀲󠁿 - U+1F3F4 U+E006E U+E006F U+E0031 U+E0032 U+E007F NO-12
Hordaland
🏴󠁮󠁯󠀱󠀴󠁿 - U+1F3F4 U+E006E U+E006F U+E0031 U+E0034 U+E007F NO-14
Fjordane
🏴󠁮󠁯󠀱󠀵󠁿 - U+1F3F4 U+E006E U+E006F U+E0031 U+E0035 U+E007F NO-15
Møre og Romsdal
🏴󠁮󠁯󠀱󠀶󠁿 - U+1F3F4 U+E006E U+E006F U+E0031 U+E0036 U+E007F NO-16
Sør-Trøndelag
🏴󠁮󠁯󠀱󠀷󠁿 - U+1F3F4 U+E006E U+E006F U+E0031 U+E0037 U+E007F NO-17
Nord-Trøndelag
🏴󠁮󠁯󠀱󠀸󠁿 - U+1F3F4 U+E006E U+E006F U+E0031 U+E0038 U+E007F NO-18
Nordland
🏴󠁮󠁯󠀱󠀹󠁿 - U+1F3F4 U+E006E U+E006F U+E0031 U+E0039 U+E007F NO-19
Troms
🏴󠁮󠁯󠀲󠀱󠁿 - U+1F3F4 U+E006E U+E006F U+E0032 U+E0031 U+E007F NO-21
Svalbard
🏴󠁮󠁯󠀲󠀲󠁿 - U+1F3F4 U+E006E U+E006F U+E0032 U+E0032 U+E007F NO-22
Jan Mayen
🏴󠁮󠁯󠀲󠀳󠁿 - U+1F3F4 U+E006E U+E006F U+E0032 U+E0033 U+E007F NO-23
Trøndelag
🏴󠁮󠁯󠀳󠀰󠁿 - U+1F3F4 U+E006E U+E006F U+E0033 U+E0030 U+E007F NO-30
Viken
🏴󠁮󠁯󠀳󠀴󠁿 - U+1F3F4 U+E006E U+E006F U+E0033 U+E0034 U+E007F NO-34
Innlandet
🏴󠁮󠁯󠀴󠀲󠁿 - U+1F3F4 U+E006E U+E006F U+E0034 U+E0032 U+E007F NO-42
Agder
🏴󠁮󠁯󠀴󠀶󠁿 - U+1F3F4 U+E006E U+E006F U+E0034 U+E0036 U+E007F NO-46
Vestland
🏴󠁮󠁯󠀵󠀰󠁿 - U+1F3F4 U+E006E U+E006F U+E0035 U+E0030 U+E007F NO-50
Trøndelag
🏴󠁮󠁯󠀵󠀴󠁿 - U+1F3F4 U+E006E U+E006F U+E0035 U+E0034 U+E007F NO-54
Troms og Finnmark
2022-11-24 10:06:42 +00:00
Timothy Flynn 7edd57dc87 LibWeb+WebDriver: Support running headless WebDriver sessions
This adds an "extension capability" for clients to indicate that a
headless browser should be used for the session.
2022-11-24 00:10:56 +00:00
Timothy Flynn e840d27d8e headless-browser: Add a mode for being controlled by WebDriver
This adds command line flags for WebDriver to pass its IPC socket path
(if running on Serenity) or its FD passing socket (if running elsewhere)
for the headless-browser to connect to.
2022-11-24 00:10:56 +00:00