Commit Graph

1481 Commits

Author SHA1 Message Date
Bastiaan van der Plaat
0104225d9b LibWeb: Add TextEncoder encodeInto 2023-10-29 21:44:53 +01:00
Bastiaan van der Plaat
f1ead552ce LibWeb: Add constructor options to TextDecoder 2023-10-29 21:44:53 +01:00
Aliaksandr Kalenik
7d26cbf523 LibWeb: Add painting command executor that uses LibAccelGfx
This change introduces a command executor for RecordingPainter that
utilizes LibAccelGfx.
2023-10-29 17:13:23 +01:00
Timothy Flynn
8dc25dffc2 LibWebView: Protect URL highlighting against partially-typed URLs
The current helpers assume that a valid URL is a full URL (i.e. contains
the "://" separator between the scheme and domain). This isn't true, as
"file:" alone is parsed as a valid URL.

We must also avoid simply searching for the parsed public suffix in the
original URL string. For example, "com" is a public suffix. If we search
for that in the URL "com.com", we will think the public suffix starts at
index 0.
2023-10-28 19:03:19 +02:00
Andreas Kling
5b87d26027 LibJIT+LibJS: Move JIT::Assembler into a new LibJIT library
This will allow other parts of the system to generate machine code
at runtime. :^)
2023-10-27 19:07:22 +02:00
Lucas CHOLLET
8659a6d3a7 Lagom: Port LibImageDecoderClient to Lagom
This library offers tools to communicate with an ImageDecoder server
through IPC. There is currently no such executable for Lagom but that
shouldn't take long :^)
2023-10-27 07:26:32 +02:00
Dan Klishch
8b49bdb724 Meta+Documentation: Restore links to LibJS website
This partially reverts dacf7265 and 67ca5d65.
2023-10-27 07:08:57 +02:00
Ali Mohammad Pur
aa4360b9a3 Meta: Port LibJS Wasm repl to the new LibJS architecture
This was left behind when removing the AST interpreter, and the CI not
being around made it bitrot.

Co-Authored-By: Dan Klishch <danilklishch@gmail.com>
2023-10-27 05:57:18 +03:30
Martin Janiczek
7c2a569fca LibTest: Add a suite of tests for the generators 2023-10-26 17:26:52 -06:00
Dan Klishch
6ed069ea8d JSSpecCompiler: Provide an adequate command line interface 2023-10-26 15:45:31 -06:00
Dan Klishch
867ce0df52 JSSpecCompiler: Move passes to Passes subdirectory of Compiler/ 2023-10-26 15:45:31 -06:00
Dan Klishch
61fa00d46c JSSpecCompiler: Refactor CompilerPass to accept TranslationUnitRef 2023-10-26 15:45:31 -06:00
Timothy Flynn
9f9e5c0f55 LibWebView: Add an API to query if a host is on the Public Suffix List 2023-10-26 11:06:49 +02:00
Timothy Flynn
d4615c47a4 LibWebView: Generate the Public Suffix List as a compile-time array
No need for this to be a vector on the heap.
2023-10-26 11:06:49 +02:00
Dan Klishch
c2c37de201 JSSpecCompiler: Support Cpp::StringLiteral in C++ AST converter 2023-10-26 10:57:03 +02:00
Dan Klishch
d7b4dc2a6a JSSpecCompiler: Support Cpp::BinaryExpression in C++ AST converter 2023-10-26 10:57:03 +02:00
tetektoza
1c37385904 GMLCompiler: Add enum initializer for button_style property
This patch adds missing enum initializer for button_style property in
enum initializer generator in GML compiler.
2023-10-24 21:47:18 +02:00
Tim Ledbetter
fff1645c6b Fuzzers: Add WOFF2 fuzzer 2023-10-24 13:45:01 +02:00
Tim Ledbetter
03fbd6c0c8 Fuzzers: Add a fuzzer for JsonParser 2023-10-24 07:54:37 +02:00
Andrew Duerig
67ca5d6572 Meta: Update libjs.dev links to test262.fyi 2023-10-24 07:32:19 +02:00
Bastiaan van der Plaat
efadee7e6e Meta+BindingsGenerator: Add curly brackets for numeric union types 2023-10-20 07:20:29 +02:00
Nico Weber
ff4b0e678b MacPDF: Make "Open With" and dropping files on dock tile work
I would've expected that there's some way to have this work
automatically in an NSDocument-based application, but I haven't
found it yet. So manually implement the delegate for now.
2023-10-19 16:52:31 -04:00
Andrew Kaster
4d039b05b2 MacPDF: Load fonts via Core::Resource instead of filesystem paths 2023-10-17 11:02:01 -06:00
Timothy Flynn
a8f0fa5dd4 LibWebView+LibPublicSuffix: Merge LibPublicSuffix into LibWebView
After d2c7e1ea7d, there is now only one
user of LibPublicSuffix - the URL sanitation utility within LibWebView.
Rather than having an entire library for the small Public Suffix data
accessor, merge it into LibWebView.
2023-10-16 09:06:02 -04:00
Ali Mohammad Pur
988c6568a9 LibWeb: Remove Element::set_attribute(name, value?)
That API came from a mistake in the IDL compiler, where reflected
nullable attributes would try to call set_attribute(name, null).
This commit fixes the mistake in the IDL generator, and removes the
meaningless API.
2023-10-14 09:12:41 -04:00
Ali Mohammad Pur
aeee98b3a1 AK+Everywhere: Remove the null state of DeprecatedString
This commit removes DeprecatedString's "null" state, and replaces all
its users with one of the following:
- A normal, empty DeprecatedString
- Optional<DeprecatedString>

Note that null states of DeprecatedFlyString/StringView/etc are *not*
affected by this commit. However, DeprecatedString::empty() is now
considered equal to a null StringView.
2023-10-13 18:33:21 +03:30
Ali Mohammad Pur
b20f1da166 Lagom/IDLGenerators: Remove the unused generate_to_deprecated_string fn
There are no more users of this, so remove it and rename
`generate_to_new_string` to `generate_to_string` while we're at it.
2023-10-13 18:33:21 +03:30
Nico Weber
6528f6db26 MacPDF: Make up and down flip pages when PDF view has focus
Previously, it only reacted to arrow left andn arrow right,
and to opt-up and opt-down.
2023-10-11 21:38:15 -04:00
Nico Weber
627b152d49 MacPDF: Make opt-up and opt-down always go to previous / next page
When the outline has focus, arrow keys navigate the outline instead
of changing the current page.

Add opt-up and opt-down as a way to move by one page even when the
outline has focus. (This matches Preview.app.)

xib change: Added two menu Previous Page with key equivalent opt-up
and Next Page with key equivalent opt-down to Go menu and bound them to
goToPreviousPage: and goToNextPage: on First Responder.

When the outline has focus, the responder chain is outline ->
window, so also add the actions on the window controller, and
let that forward to the PDF view.
2023-10-11 21:38:15 -04:00
Andrew Kaster
99ffc935ef Lagom: Include all generated installed files on library targets
Do this with INSTALL_INTERFACE genex include directory rules. We should
really standardize where the generated headers *actually* get installed
to though.
2023-10-11 12:35:35 -04:00
Tim Ledbetter
e6d9bb0774 LibTLS: Don't attempt to read past EOF when parsing TBSCertificate
This allows the decoder to fail gracefully when reading a partial or
malformed TBSCertificate. We also now ensure that the certificate data
is valid before making a copy of it.
2023-10-11 07:08:22 +02:00
Nico Weber
409eb644c8 MacPDF: Unbreak persisting the current page
I broke this when moving from a xib file to creating the UI in code.

https://developer.apple.com/documentation/appkit/nsuserinterfaceitemidentification/1396829-identifier
says:

"Identifiers are used during window restoration operations to uniquely
identify the windows of the application. [...] If you create an item in
Interface Builder and do not set a value for this string, a unique value
is created for the item when the nib file is loaded. For
programmatically created views, you typically set this value after
creating the item but before adding it to a window."

Without this, encodeRestorableStateWithCoder: / restoreStateWithCoder:
in MacPDFView weren't getting called.
2023-10-10 09:50:28 -04:00
Nico Weber
a75f876ec0 MacPF: Add a small group header in front of the outline
This has to be part of the data source, which makes things a bit
annoying.

For PDFs that have no outline, it says "(No outline)".
2023-10-10 09:50:08 -04:00
Nico Weber
fee50cb387 MacPDF: Switch from a cell-based outline view to a view-based one
The documentation is very loud about cell-based things being
deprecated, but it's fairly hidden what to actually do to switch to
the non-deprecated way (implement a certain delegate method).

Session 120 from WWDC 2011 has some notes on this. Apple's official
site no longer seems to have that, but it's e.g. here:
https://docs.huihoo.com/apple/wwdc/2011/session_120__view_based_nstableview.pdf
2023-10-10 09:50:08 -04:00
Nico Weber
25515322e5 MacPDF: Remove outline view header
Just setting headerView to nil removes the header, but also has
the effect of no longer drawing the outline view with a sidebar
background ¯\_(ツ)_/¯.

But also setting drawsBackground to NO on the scroll view restores
the sidebar look, so do that too.

With this, it is no longer necessar to explicitly set style.
The default NSTableViewStyleAutomatic now seems to resolve to
NSTableViewStyleSourceList, so stop explicitly setting it.
(This part has no behavior change.)
2023-10-10 09:50:08 -04:00
Nico Weber
e7d41480fc MacPDF: Make clicking outline items have an effect
Clicking an item in the outline now opens that page.

This requires giving the outline view a delegate, which for some
reason also has th effect of indenting expandable items ¯\_(ツ)_/¯
The vertical alignment of text still looks off, though.
2023-10-10 09:50:08 -04:00
Nico Weber
185301c027 MacPDF: Add PDF outline to sidebar
The outline has drawing artifacts, but it is somewhat functional:
You can click on disclosure triangles to open outline items, and
if the outline doesn't fit in the sidebar, it's scrollable.

The outline view has the correct sidebar look: gray with a slightly
transparent glass effect.

Clicking items doesn't have an effect yet.
2023-10-10 09:50:08 -04:00
Nico Weber
79bba20efc MacPDF: Add an NSOutlineViewDataSource for the PDF outline
Not used yet.
2023-10-10 09:50:08 -04:00
Shannon Booth
b37aab1277 LibWeb: Port named_item_value from DeprecatedFlyString 2023-10-08 08:11:48 -04:00
Shannon Booth
e4f8c59210 LibWeb: Port AttributeNames to FlyString 2023-10-08 08:11:48 -04:00
Nico Weber
f02b84d34d MacPDF: Give sidebar the more modern look
This Just Works with NSToolbarSidebarTrackingSeparatorItemIdentifier,
as long as your window is has NSWindowStyleMaskFullSizeContentView
in its style mask. If it doesn't, things behave pretty weirdly and
at least in the docs I looked at, this requirement wasn't documented
at all :/

Anyways, switch MacPDFView to use safeAreaRect instead of bounds
now that we use NSWindowStyleMaskFullSizeContentView so that we
don't draw parts of the PDF under the title bar.

Also be careful to invalidate the PDF view if safeAreaRect changes,
so that the page is redrawn when toolbar visibility gets toggled.
2023-10-07 09:47:43 +02:00
Nico Weber
b1e9c419a6 MacPDF: Add a split view for a togglable sidebar
It can be toggled with the (only) toolbar button, or via the
menu bar, or the standard shortcut Cmd-Ctrl-S.
2023-10-07 09:47:43 +02:00
Nico Weber
ae1b179474 MacPDF: Add a toolbar with a standard sidebar button 2023-10-07 09:47:43 +02:00
Nico Weber
1f1a596a46 MacPDF: In window controller, use window directly
No need to go through the view now that there's a dedicated
window controller.

No behavior change.
2023-10-07 09:47:43 +02:00
Nico Weber
c0d8131a26 MacPDF: Remove logspam 2023-10-07 09:47:43 +02:00
Nico Weber
6b9afcfb7c MacPDF: Create window UI in code instead of in xib
No intentional behavior change.
2023-10-07 09:47:43 +02:00
Nico Weber
dcf40892b8 MacPDF: Start moving window-related things into MacPDFWindowController
- MacPDFWindowController is now the xib file's owner
- _pdfView moves over
- MacPDFWindowController is now the MacPDFViewDelegate and responsible
  for updating the window's title
- Due to MacPDFWindowController now being the xib file's owner,
  windowControllerDidLoadNib: is no longer called automatically,
  so call a custom windowIsReady method manually instead

No behavior change.
2023-10-07 09:47:43 +02:00
Nico Weber
67f6baead0 MacPDF: Introduce MacPDFWindowController
I'd like to add a sidebar, and NSSplitViewItem apparently isn't
accessibly in .xib files without contortions. So I want to move
to creating the window in code, and this is a step towards that.

No behavior change.
2023-10-07 09:47:43 +02:00
Nico Weber
d6dff83397 MacPDF: Introduce CocoaWrapper.h
No behavior change.
2023-10-07 09:47:43 +02:00
Andreas Kling
65717e3b75 LibJS: Inline fast case for Value::to_{boolean,number,numeric,primitive}
These functions all have a very common case that can be dealt with a
very simple inline check, often avoiding the need to call an out-of-line
function. This patch moves the common case to inline functions in a new
ValueInlines.h header (necessary due to header dependency issues..)

8% speed-up on the entire Kraken benchmark :^)
2023-10-07 07:13:52 +02:00