Commit Graph

43417 Commits

Author SHA1 Message Date
Zaggy1024
9cf7e8c5aa LibVideo: Reorganize demuxer file hierarchy and rename Matroska files
As new demuxers are added, this will get quite full of files, so it'll
be good to have a separate folder for these.

To avoid too many chained namespaces, the Containers subdirectory is
not also a namespace, but the Matroska folder is for the sake of
separating the multiple classes for parsed information entering the
Video namespace.
2022-11-25 23:28:39 +01:00
Zaggy1024
edec6bdc32 LibVideo: Make all PlaybackManager Timer::start calls set an interval
Timers keep their previously set interval even for single-shot mode.
We want all timers to fire immediately if they don't have a delay set
in the start() call.
2022-11-25 23:28:39 +01:00
Baitinq
75e20a5fd7 PixelPaint: Add the Pen tool as the default tool
We now preselect the pen tool when PixelPaint is launched.
2022-11-25 23:17:44 +01:00
ne0ndrag0n
d8f25ad644 LibCore: Sync groups, getgrent to getgrent_r, fix gr_mem bug 2022-11-25 23:13:16 +01:00
ne0ndrag0n
8a09895bc1 LibC: Implement getgrent_r 2022-11-25 23:13:16 +01:00
martinfalisse
432b2aed67 CI: Upgrade actions/github-script to v6
The only breaking change is an internal switch to node 16 which doesn't
seem to affect the functionality of the lintcommits script.
2022-11-25 23:03:59 +01:00
Rodrigo Tobar
44c518e767 PDFViewer: Show single/multi page actions on toolbar
These actions were being constructed, and they work, but were not shown
in the toolbar. Adding them will allow users to actually use them, as
well as pick up any bugs they might have.
2022-11-25 23:03:24 +01:00
Rodrigo Tobar
cbb373e135 PDFViewer: Toggle prev/next page actions when page changes
These actions were not updated accordingly when one scrolled through the
document, and thus one could accidentally, for example, move to the next
page when standing on the last, which caused a crash.

This commit fixes that behavior, toggling the actions' enabled status
depending on the new page being displayed.
2022-11-25 23:03:24 +01:00
Rodrigo Tobar
a740423e23 PDFViewer: Prevent infinity recursion
When removing all contents from the NumericInput box in PDFViewer the
callback set the (empty) text again back in the box, triggering another
callback in a recursive, non-stopping fashion. Not setting the text back
in the box avoids the problem.
2022-11-25 23:03:24 +01:00
Rodrigo Tobar
bc7da24fe6 PDFViewer: Let users change clipping paths visibility
Now that the Renderer accepts preferences, PDFViewer can offer ways for
changing these preferences. The first step in this direction is to add a
checkbox that allows toggling whether clipping paths are visible or not.
A Config item has also been added to remember this setting.
2022-11-25 23:03:24 +01:00
Rodrigo Tobar
e92ec26771 LibPDF: Introduce rendering preferences and show clipping paths
A new struct allows users to specify specific rendering preferences that
the Renderer class might use to paint some Document elements onto the
target bitmap. The first toggle allows rendering (or not) the clipping
paths on a page, which is useful for debugging.
2022-11-25 23:03:24 +01:00
Rodrigo Tobar
a1e36e8f78 LibPDF: Improve path clipping support
The existing path clipping support was broken, as it performed the
clipping operation as soon as the path clipping commands (W/W*) were
received. The correct behavior is to keep a clipping path in the
graphic state, *intersect* that with the current path upon receiving
W/W*, and apply the clipping when performing painting operations. On top
of that, the intersection happening at W/W* time does not affect the
painting operation happening on the current on-build path, but takes
effect only after the current path is cleared; therefore a current and a
next clipping path need to be kept track of.

Path clipping is not yet supported on the Painter class, nor is path
intersection. We thus continue using the same simplified bounding box
approach to calculate clipping paths.

Since now we are dealing with more rectangles-as-path code, I've made
helper functions to build a rectangle path and reuse it as needed.
2022-11-25 23:03:24 +01:00
Eli Youngs
c92f450ff0 shuf: Support splitting on null bytes with -z 2022-11-25 22:59:27 +01:00
Eli Youngs
b2fd87950a shuf: Support reading input from a file
Previously, shuf exclusively read input from stdin. This PR adds an
option to read from a file using Core::Stream::File. Since a file might
contain arbitrary bytes, including null bytes, this PR represents lines
as Spans of Bytes instead of Strings.
2022-11-25 22:59:27 +01:00
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