Commit graph

43253 commits

Author SHA1 Message Date
Sam Atkins
39a4f1560b copy: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins
6763e1bd60 comm: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins
8ed5403d8c comm: Stop skipping a line in the output
Because of how we output lines in the loop above, if we leave that loop
when the last line was not the same in both files, then either
`file1_line` or `file2_line` has not been output yet.
`process_remaining()` does not print that line either, since it
immediately reads a new line. So, output the previously-missing line
before we call that. :^)
2022-11-19 17:00:10 +00:00
Sam Atkins
83366e2b2e cksum: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins
d071a93047 base64: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins
5a0c298074 arp: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins
4ad1695c78 WebContent: Add $() and $$() functions to browser console
These are based on the ones in Firefox:

`$(selector, element = document)`:
    Equivalent to `element.querySelector(selector)`.

`$$(selector, element = document)`:
    Equivalent to `element.querySelectorAll(selector)`.
2022-11-19 16:56:31 +00:00
Sam Atkins
c793beb0cc WebContent: Add $_ variable to browser console
This holds the return value of the expression that was last entered into
the browser console. If that last expression returned an error of some
kind, `$_` will be `undefined`. This matches the behaviour in Firefox.
2022-11-19 16:56:31 +00:00
Sam Atkins
3ec13fdb86 WebContent: Rename $0 getter and use global object instead of this
Using the global object works consistently in native accessors and
native functions, so changing this for consistency.
2022-11-19 16:56:31 +00:00
Sam Atkins
f9c9506997 WebContent: Create a separate realm for JS console input
This allows us to expose extra functions and properties to the console,
such as `$0`, without them being available to website scripts.

`ConsoleEnvironmentSettingsObject` is basically a stub, since we require
an `EnvironmentSettingsObject` but it has abstract methods.
2022-11-19 16:56:31 +00:00
Timothy Flynn
9782660cb6 LibWebView: Update OOPWV's URL when a page starts/finishes loading
If the page's URL is changed from within the WebContent process (e.g.
window.location.href is set from JavaScript, or a navigation is started
from WebDriver), we would not store the URL at all within OOPWV. This
prevented actions like reloading from working properly, as the browser
would reload whatever URL was previously entered in the URL box.
2022-11-19 16:56:02 +00:00
thankyouverycool
325061b0e4 WindowServer: Add misbehavior restriction for Blocking modals
Two Blocking modals in the same modal chain which aren't descended
one from the other will block each other's input rendering the chain
noninteractive. This has caused confusion in the past for builders so
this warning makes the behavior explicitly forbidden.
2022-11-19 16:04:42 +01:00
thankyouverycool
ef7d9c0166 LibGUI: Disallow shortcut propagation in Blocking modals and Popups
This restriction is already present for mouse shortcuts but was
forgotten in the recent key event refactor.
2022-11-19 16:04:42 +01:00
thankyouverycool
59e10d5283 WindowServer: Don't compute title usernames for frameless Windows
This was causing a slight delay when opening ComboBox ListViews.
As an easy first optimization, don't bother computing this at all
for frameless windows and those not type Normal.
2022-11-19 16:04:42 +01:00
thankyouverycool
4ba20f08c7 LibGUI: Don't search ComboBox Windows when holding a mod key 2022-11-19 16:04:42 +01:00
thankyouverycool
5c923977b7 LibGUI: Always close() Dialogs no matter the execution result
Fixes Blocking modal race conditions when new windows are created
in the same scope as Dialogs.
2022-11-19 16:04:42 +01:00
thankyouverycool
2028fbeae3 LibGUI: Remove redundant event handling in EmojiInputDialog
The Dialog class already handles closing on escape.
2022-11-19 16:04:42 +01:00
thankyouverycool
a6581c2aac LibGUI: Paint text selections as active in Popups
And hide TextEditor cursors in active windows when focus is preempted
2022-11-19 16:04:42 +01:00
thankyouverycool
f7eb72a8be Terminal+LibVT: Toggle TerminalWidget's focus on input preemption
This prevents Terminal's cursor from blinking when a Popup is open.
2022-11-19 16:04:42 +01:00
thankyouverycool
657ff1cd19 LibGUI: Set focus proxy for CommandPalette's TableView 2022-11-19 16:04:42 +01:00
thankyouverycool
3b18226fcb LibGUI: Let Widgets track their focus proxy delegators
And update them on relevant events.
2022-11-19 16:04:42 +01:00
thankyouverycool
4aa608aa71 LibGUI+Taskbar+Applets+Applications: Set various windows as Popups
Makes the Audio applet, Taskbar clock, CommandPalette, EmojiPicker,
and Assistant work as Popup windows. Popups are frameless, unmovable,
and unresizable by default, in addition to their preemptive function.
Also sets Assistant not to obey widget min size so its search result
area resizes correctly
2022-11-19 16:04:42 +01:00
thankyouverycool
24d299c9c8 LibGUI+WindowServer+Applets+Taskbar: Remove active input concepts
and the CaptureInput mode. They are a source of unneeded complexity
in WindowServer and have proven prone to regressions, so this patch
replaces them with a simple input preemption scheme using Popups.

Popup windows now have ergonomics similar to menus: When open,
a popup preempts all mouse and key events for the entire window
stack; however, they are fragile and will close after WindowServer
swallows the first event outside them. This is similar to how combo
box windows and popups work in the classic Windows DE and has the
added benefit of letting the user click anywhere to dismiss a popup
without having to worry about unwanted interactions with other
widgets.
2022-11-19 16:04:42 +01:00
thankyouverycool
35bd79701c WindowServer: Add request_close_fragile_windows() helper 2022-11-19 16:04:42 +01:00
thankyouverycool
c23adeaaf7 WindowServer: Add foremost_popup_window() helper 2022-11-19 16:04:42 +01:00
thankyouverycool
3027cf7e99 LibGUI+WindowServer: Remove InputPreemptor concept
This functionality will be superceded by WindowType:Popups
2022-11-19 16:04:42 +01:00
thankyouverycool
5d567565a4 LibGUI+WindowServer: Replace WindowInput{Enter,Leave} Events
with WindowInput{Preempted,Restored} Events and allow Widgets to save
the state of their focus preemption. As of now, only Popups will
preempt input and trigger these events.
2022-11-19 16:04:42 +01:00
thankyouverycool
901878bad9 LibGUI: Use move_cursor() API for AutocompleteProvider
Fixes failure to update focus rect when moving between items.
2022-11-19 16:04:42 +01:00
thankyouverycool
2c58902939 LibGUI: Use WindowType:Autocomplete for AutocompleteProvider
And fix its inability to focus/resize correctly.
2022-11-19 16:04:42 +01:00
thankyouverycool
1718a40ac7 LibGUI+WindowServer: Add WindowType:Autocomplete and helpers 2022-11-19 16:04:42 +01:00
Julian Offenhäuser
0bc3333740 LibPDF: Parse integer numbers with atoi() instead of strtof()
strtof() produces rounding errors for very large numbers, which we
don't want for integers, as they may have to be precise.
2022-11-19 15:42:08 +01:00
Julian Offenhäuser
c2ad29c85f LibPDF: Implement png predictor decoding for flate filter
For flate and lzw filters, the data can be transformed by this
predictor function to make it compress better. For us this means that
we have to undo this step in order to get the right result.

Although this feature is meant for images, I found at least a few
documents that use it all over the place, making this step very
important.
2022-11-19 15:42:08 +01:00
Julian Offenhäuser
4bd79338e8 LibPDF: Fix off-by-one error in Reader::remaining() 2022-11-19 15:42:08 +01:00
Julian Offenhäuser
4b1a72ff7a LibPDF: Fix loop condition in parse_xref_stream()
We previously compared two unrelated values to determine if we parsed
the xref table to completion. We now check if we added every subsection
instead, and double check to make sure we never read past the end.
2022-11-19 15:42:08 +01:00
Julian Offenhäuser
a17a23a3f0 LibPDF: Make some variable names in parse_xref_stream() more clear
I found these to be a bit misleading.
2022-11-19 15:42:08 +01:00
Julian Offenhäuser
f926dfe36b LibPDF: Implement the DCT filter
This filter basically tells us that we are dealing with a JPEG.
Note that by serializing the resulting image we assume that this filter
is the last one in the chain, everything else would be highly unlikely.
2022-11-19 15:42:08 +01:00
Julian Offenhäuser
baaf42360e LibPDF: Derive alternate ICC color space from the number of components
We currently don't support ICC color spaces and fall back to a "simple"
one instead.

If no alternative is specified however, we are allowed to pick the
closest match based on the number of color components.
2022-11-19 15:42:08 +01:00
Julian Offenhäuser
16ed407c01 LibPDF: Support cascading stream filters
You can specify multiple filters as an array, where each one is fed the
output of the one before it.
2022-11-19 15:42:08 +01:00
Julian Offenhäuser
becd648a78 LibPDF: Parse hexadecimal values in name objects correctly 2022-11-19 15:42:08 +01:00
Julian Offenhäuser
0308300b78 PDFViewer: Take the mousewheel delta into account for scrolling
We now respect the system-wide setting for scroll speed, where we would
previously use a fixed step.
2022-11-19 15:42:08 +01:00
Julian Offenhäuser
9b1331a984 PDFViewer: Simplify user-facing error messages
We now show a simple, if less helpful, message to the user and print
the verbose error message to serial instead.
2022-11-19 15:42:08 +01:00
Julian Offenhäuser
e782d03f96 PDFViewer: Invalidate document when a page fails to load
This fixes an issue where we would show an error message on every
subsequent paint event, making it impossible to close or use the
application further.

Some more architectural work is needed if we want to invalidate the
sidebar entries as well.
2022-11-19 15:42:08 +01:00
thankyouverycool
ef30073127 LibGUI: Let Delete remove selections greater than 1 in GlyphMapWidget
Updates keydown_event() to work with the new bubbling mechanism
for action shortcuts.
2022-11-19 15:41:09 +01:00
thankyouverycool
92a75ccaed FontEditor: Include file basename in error messages when available
And write messages in the [action] failed: [error] format to match
common error message formatting elsewhere in Userland.
2022-11-19 15:41:09 +01:00
thankyouverycool
9725fd162f LibGUI+Applications: Allow GlyphMapWidget's set_font() to fail
And TRY early during initialization in FontEditor to leave the app
in a valid state on error. Fixes OOM crashes when cloning the original
font for highlight modifications.
2022-11-19 15:41:09 +01:00
thankyouverycool
1be830e3c6 LibGfx: Add pure virtual fallible clone() for Fonts 2022-11-19 15:41:09 +01:00
thankyouverycool
d9fb838cf6 LibGUI+FontEditor: Allow system emoji to be toggled in GlyphMapWidget
And remove their red backgrounds when visible to not be confused with
deletion highlights.
2022-11-19 15:41:09 +01:00
thankyouverycool
c974e644ec FontEditor: Add Layout options to View menu
Like other apps, FontEditor now organizes widget visibility toggles
under a View->Layout submenu. The main toolbar and the status bar
can now be turned on and off.
2022-11-19 15:41:09 +01:00
thankyouverycool
61d93092cf FontEditor: Remove redundant set_scale() helper 2022-11-19 15:41:09 +01:00
thankyouverycool
8f7dbf363e FontEditor: Remove overzealous find-and-replace ""sv operator 2022-11-19 15:41:09 +01:00