Commit graph

22930 commits

Author SHA1 Message Date
Rodrigo Tobar
e8f1a2ef02 LibPDF: Add new error construction functions
These should make it easier to create specific errors, specially when
wanting to create a formatted message.
2023-02-24 20:16:50 +01:00
Rodrigo Tobar
db9fa7ff07 LibPDF: Allow show_text to return errors
Errors can (and do) occur when trying to render text, and so far we've
silently ignored them, making us think that all is well when it isn't.
Letting show_text return errors will allow us to inform the user about
these errors instead of having to hiding them.
2023-02-24 20:16:50 +01:00
Nico Weber
14c0bae704 LibGfx+Tests: Add test for webp ICC loading and fix bug
I drew the two webp files in Photoshop and saved them using the
"Save a Copy..." dialog, with ICC profile and all other boxes checked.

(I also tried saving with all the boxes unchecked, but it still wrote an
extended webp instead of a basic file.)

The lossless file exposed a bug: I didn't handle chunk padding
correctly before this patch.
2023-02-24 20:13:52 +01:00
Timothy Flynn
8be43cd3bf LibGfx: Use LibUnicode to filter code points that cannot start an emoji 2023-02-24 19:48:47 +01:00
Timothy Flynn
392c8c99aa LibGfx: Use the paths to emoji images generated alongside emoji data
Rather than formatting the paths at runtime, as vformat is quite heavy
in a profile.
2023-02-24 19:48:47 +01:00
Timothy Flynn
1484d3d9f5 LibUnicode: Add a method to check if a code point could start an emoji 2023-02-24 19:48:47 +01:00
Timothy Flynn
8c38d46c1a LibUnicode: Generate the path to emoji images alongside emoji data
This will provide for quicker emoji lookups, rather than having to
discover and allocate these paths at runtime before we find out if they
even exist.
2023-02-24 19:48:47 +01:00
Nico Weber
f5063fe7ec file: Add a description for the image/webp mime type 2023-02-24 19:44:20 +01:00
Nico Weber
f7e152d049 LibGfx: Add scaffolding for a webp decoder
At the moment, this processes the RIFF chunk structure and extracts
the ICCP chunk, so that `icc` can now print ICC profiles embedded
in webp files. (And are image files really more than containers
of icc profiles?)

It doesn't even decode image dimensions yet.

The lossy format is a VP8 video frame. Once we get to that, we
might want to move all the image decoders into a new LibImageDecoders
that depends on both LibGfx and LibVideo. (Other newer image formats
like heic and av1f also use video frames for image data.)
2023-02-24 19:44:20 +01:00
Nico Weber
4bf639b635 LibGfx: Drop tags of unknown type instead of writing invalid icc files
We could make UnknownTagData hold on to undecoded, raw input data and
write that back out when serializing. But for now, we don't.

On the flipside, this _does_ write unknown tags that have known types.
We could have a mode where we drop unknown tags with known types.
But for now, we don't have that either.

With this, we can for example reencode
/Library/ColorSync/Profiles/WebSafeColors.icc and icc (and other
tools) can dump the output icc file. The 'ncpi' tag with type 'ncpi'
is dropped while writing it, while the unknown tag 'dscm' with
known type 'mluc' is written to the output. (That file is a v2 file,
so 'desc' has to have type 'desc' instead of type 'mluc' which
it would have in v4 files -- 'dscm' emulates an 'mluc' description
in v2 files.)
2023-02-24 19:42:00 +01:00
Kenneth Myhra
fa1ba7fadf LibWeb: Mark JS::Promise* return value for digest() with JS::NNGCPtr 2023-02-24 19:24:39 +01:00
Kenneth Myhra
f783af05ed LibWeb: Port SubtleCrypto to new String
The algorithm comparison in digest() is done using a StringView to avoid
complex error handling and promise rejection.
2023-02-24 19:24:39 +01:00
Kenneth Myhra
a8cef1fa06 LibWeb: Port Crypto to new String 2023-02-24 19:24:39 +01:00
Nico Weber
b161f5ea05 LibGfx: Make ICC reader check that profile size is a multiple of 4
With this, I would've found e8bd067ce5 earlier.

(If this turns out to be too strict in practice, we can always relax
it again.)
2023-02-24 19:17:20 +01:00
timre13
d7f348ab50 VideoPlayer: Add button and menu item to toggle fullscreen
Add a button to the bottom toolbar and a menu item to toggle fullscreen.
Also implement toggling fullscreen mode by double-clicking the video.
2023-02-24 19:16:46 +01:00
Andreas Kling
3435820e1f LibWeb: Render HTML content if present for HTTP error pages
If an HTTP response fails with an error code (e.g 403) but still has
body content, we now render the content.

We only fall back to our own built-in error page if there's no body.
2023-02-24 19:15:49 +01:00
Itamar
47f5a3ea9a HackStudio: Add 'pause debuggee' button
This button sends a SIGSTOP to the debugged process, which pauses it.
The debuggee can be resumed with the 'continue' button.
2023-02-24 19:09:27 +01:00
Itamar
91224d47d2 SystemMonitor: Add "Debug In HackStudio" action to process context menu
This action launches HackStudio with its debugger attached to the
selected process.
2023-02-24 19:09:27 +01:00
Itamar
6e5b1f5819 HackStudio: Add progress bar to Debugger initialization
During Debugger initialization, most of the time is spent creating
DebugInfo objects for the libraries that the program has loaded.
2023-02-24 19:09:27 +01:00
Itamar
0896c03744 HackStudio: Add commandline option to debug a running process 2023-02-24 19:09:27 +01:00
Itamar
58c4fe52d4 HackStudio: Fix event loop usage in debugger callbacks
These callbacks are called from a different thread than the UI thread,
so we need to explicitly use the Application's event loop to perform GUI
logic.
2023-02-24 19:09:27 +01:00
Itamar
ff6fb2cb10 HackStudio: Add ability to attach debugger to a running process 2023-02-24 19:09:27 +01:00
Itamar
eb16513165 LibDebug: Remove file path fixup for library sources
It's no longer needed as the file paths we get for libraries in the
current build process is canonical.
2023-02-24 19:09:27 +01:00
Sam Atkins
0fb6f87d49 LibWeb: Add spec link to border-width: thin/medium/thick definitions
In the latest backgrounds-3 spec, these have official fixed values. :^)
2023-02-23 16:20:44 +00:00
Kenneth Myhra
e905f25911 LibWeb: Port Worker to new String 2023-02-23 15:48:38 +00:00
Kenneth Myhra
be727ea871 LibWeb: Port WorkerGlobalScope to new String 2023-02-23 15:48:38 +00:00
Kenneth Myhra
9c5bdb0b86 LibWeb: Port WorkerLocation to new String 2023-02-23 15:48:38 +00:00
Nico Weber
e8bd067ce5 LibGfx: Pad last element in ICC files to 4-byte boundary too
The spec wants that to happen.
2023-02-23 16:39:17 +01:00
Nico Weber
7853be7869 LibGfx: Implement serialization of LutAToBTagData and LutBToATagData
With this, we can write all tag types we can currently read :^)
2023-02-23 15:35:02 +01:00
Humberto Alves
d50b4f3581 LibGUI: Fix Action destructor to unregister itself correctly
Changed the Action destructor to fix an issue where global scoped
actions without shortcuts were not being properly unregistered from the
application. Previously, this could cause crashes when attempting to
open the command palette.
2023-02-23 12:41:47 +00:00
Humberto Alves
2df25f8edf LibGUI: Fix missing parent in LinkLabel open action
Fixed a bug where an action was being registered in the global shortcut
scope by mistake.
2023-02-23 12:41:47 +00:00
Timothy Flynn
fcd4535a55 LibGfx: Do not exclude all ASCII code points from emoji lookups
Keycap emoji, for example, begin with ASCII digits. Instead, check the
first code point for the Emoji Unicode property.

On a profile of scrolling around on the welcome page in the Browser,
this raises the runtime percentage of Font::glyph_or_emoji_width from
about 0.8% to 1.3%.
2023-02-22 21:51:09 +00:00
Timothy Flynn
f33ead7f5f LibGfx: Bail early from Emoji::emoji_for_code_point_iterator for ASCII
On a profile of scrolling around on the welcome page in the Browser,
this drops the runtime percentage of Font::glyph_or_emoji_width from
about 70% to 0.8%.
2023-02-22 21:11:48 +01:00
Timothy Flynn
fdf090a299 LibGUI: Wrap words at word break boundaries and don't break up emoji
We will currently only wrap "words" at ASCII spaces and, when wrapping,
will break up multi-code point emoji. This changes word wrapping to
behave as follows:

When the wrapping mode is "anywhere", use the iterator-based font width
computation overload. This will compute the width of multi-code point
emoji, whereas we currently only handle single-code point.

When the wrapping mode is "word", use the Unicode word segmentation
boundaries to break lines.
2023-02-22 15:24:16 +00:00
Timothy Flynn
2bc7c11e8d LibGfx: Consult Unicode data to decode emoji sequences
For example, consider the Pirate Flag emoji, which is the code point
sequence U+1F3F4 U+200D U+2620 U+FE0F. Our current emoji resolution does
not consider U+200D (Zero Width Joiner) as part of an emoji sequence.
Therefore fonts like Katica, which have a glyph for U+1F3F4, will draw
that glyph without checking if we have an emoji bitmap.

This removes some hard-coded code points and consults the UCD's code
point properties for emoji sequence components and variation selectors.
This recognizes the ZWJ code point as part of an emoji sequence.
2023-02-22 10:14:36 +01:00
Timothy Flynn
2eb2207f50 LibGUI: Convert mouse events from a visual to a physical position
When clicking a position within a TextEditor, we should interpret that
position as a visual location. That location should be converted to a
"physical" location before using it to set the physical cursor position.

For example, consider a document with 2 emoji, each consisting of 3 code
points. Visually, these will occupy 2 columns. When a mouse click occurs
between these columns, we need to convert the visual column number 1 to
the physical column number 3 when storing the new cursor location.
2023-02-22 10:14:36 +01:00
Timothy Flynn
b823f3d29f LibGfx: Consider multi-code point glyphs when computing text width
Currently, we compute the width of text one code point at a time. This
ignores grapheme clusters (emoji in particular). One effect of this is
when highlighting a multi-code point emoji. We will errantly increase
the highlight rect to the sum of all code point widths, rather than
just the width of the resolved emoji bitmap.
2023-02-22 10:14:36 +01:00
Timothy Flynn
a391ea3da3 LibGfx: Support computing a font's glyph width with code point iterators
This allows consideration of multi-code point glyphs.
2023-02-22 10:14:36 +01:00
Timothy Flynn
71967bc5de LibGfx: Implement Emoji::emoji_for_code_point_iterator for UTF-32 views 2023-02-22 10:14:36 +01:00
Kenneth Myhra
385b880862 LibWeb: Make factory method of IntersectionObserver fallible 2023-02-22 09:55:33 +01:00
Kenneth Myhra
f0fd1cae3d LibWeb: Make factory method of IdleDeadline fallible 2023-02-22 09:55:33 +01:00
Kenneth Myhra
ff2a991e19 LibWeb: Make factory method of ResizeObserver::ResizeObserver fallible 2023-02-22 09:55:33 +01:00
Kenneth Myhra
dcbe927b48 LibWeb: Make factory method of Selection::Selection fallible 2023-02-22 09:55:33 +01:00
Kenneth Myhra
d69e863286 LibWeb: Propagate error in factory method of Streams::ReadableStream 2023-02-22 09:55:33 +01:00
Kenneth Myhra
07db02cd2c LibWeb: Make factory method of Geometry::DOMRectReadOnly fallible 2023-02-22 09:55:33 +01:00
Kenneth Myhra
ec0049441c LibWeb: Make factory methods of Geometry::DOMRect fallible 2023-02-22 09:55:33 +01:00
Kenneth Myhra
9b190b9509 LibWeb: Make factory method of Geometry::DOMRectList fallible 2023-02-22 09:55:33 +01:00
Kenneth Myhra
4de5dc7a86 LibWeb: Make factory method of Geometry::DOMPointReadOnly fallible 2023-02-22 09:55:33 +01:00
Kenneth Myhra
530ec85c4a LibWeb: Make factory method of Geometry::DOMPoint fallible 2023-02-22 09:55:33 +01:00
Kenneth Myhra
459959b297 LibWeb: Make factory method of HTML::BrowsingContext fallible 2023-02-22 09:55:33 +01:00