Commit graph

2672 commits

Author SHA1 Message Date
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
Shannon Booth d818bbf918 LibWeb: Remove UseDeprecatedAKString support for IDL generator
We no longer have any interface relying on this :^)
2023-10-06 08:25:40 +02:00
Timothy Flynn eeb16f03bb LibLocale: Parse day-period hour cycle preferences
For example, the locale "fr-FR" will have the preferred hour cycle list
of "H hB", meaning h23 and h12-with-day-periods. Whether date-times are
actually formatted with day-periods is up to the user, but we need to
parse the hour cycle as h12 to know that the FR region supports h12.

This bug was revealed by LibJS no longer blindly falling back to h12 (if
the `hour12` option is true) or h24 (if the `hour12` option is false).
2023-10-05 17:01:02 +02:00
Timothy Flynn 0bc401a1d6 LibTimeZone+Userland: Include Link entries when returning all time zones
We currently only return primary time zones, i.e. time zones that are
not a Link. LibJS will require knowledge of Link entries, and whether
each entry is or is not a Link.
2023-10-05 17:01:02 +02:00
Andreas Kling 7df1692580 LibJS: Add Object::may_interfere_with_indexed_property_access() virtual
This function must return true if the object may intercept and customize
access to indexed properties (properties where the property name is a
non-negative integer.)

This will be used to implement fast path optimizations for array-like
accesses in subsequent commits.
2023-10-05 16:57:45 +02:00
Bastiaan van der Plaat 3c27843cfe LibWeb: Add DOMMatrix fromFloat32Array and fromFloat64Array 2023-10-03 16:15:14 -06:00
Bastiaan van der Plaat 2e122b16e4 LibWeb: Add DOMMatrix toFloat32Array and toFloat64Array 2023-10-03 16:15:14 -06:00
Shannon Booth 9303e9e76f LibWeb: Port Element::local_name and TagNames from Deprecated String
Which pretty much needs to be done together due to the amount of places
where they are compared together.

This also involves porting over StackOfOpenElements over to FlyString
from DeprecatedFly string to prevent a gazillion calls to
`.to_deprecated_fly_string` calls in HTMLParser.
2023-10-03 14:47:53 +01:00
Dan Klishch 75fd28014c JSSpecCompiler: Add converter from LibCpp's AST
This will effectively allow us to use C++ code as an input for the
compiler. This would be useful for testing, since otherwise we would
have had to specify tests as a spec-like XML, which is not exactly the
most developer-friendly experience.
2023-10-02 21:15:08 +02:00
Dan Klishch 567b1f6e7c JSSpecCompiler: Adopt more C++ terminology
Let's not use strange names like `ExecutionContext`, which nobody will
understand in the future.
2023-10-02 21:15:08 +02:00
Dan Klishch 4578004ad6 JSSpecCompiler: Do not frame nodes with < and > when dumping AST
Let's not pretend we are outputting some invalid HTML.
2023-10-02 21:15:08 +02:00
Dan Klishch 14a86c8fd6 JSSpecCompiler: Elide nested TreeList nodes 2023-10-02 21:15:08 +02:00
Nico Weber 5e15c29e22 MacPDF: Use "MacPDF" in MainMenu.xib
I forgot to rename it there, whoops.
2023-09-30 19:37:39 -06:00
Nico Weber 76f0a09b5e MacPDF: Rename LagomPDFDocument to MacPDFDocument 2023-09-30 19:37:26 -06:00
Nico Weber f99771d46f MacPDF: Rename LagomPDFView to MacPDFView 2023-09-30 19:37:26 -06:00
Nico Weber a0b939cef4 MacPDF: Show correct page number in title bar after restore 2023-09-30 08:08:11 +02:00
Nico Weber e5283cd648 MacPDF: Define AK_DONT_REPLACE_STD
The bots complain that `forward()` could be either from libc++'s
include/c++/v1/__utility/forward.h or from AK/StdLibExtras.h.

I don't see this locally, but Ladybird also defined AK_DONT_REPLACE_STD,
so let's see if this does the trick.
2023-09-30 08:08:11 +02:00
Nico Weber e4d2aa82e2 MacPDF: Don't hardcode my serenity directory
https://www.africau.edu/images/default/sample.pdf is a good
document for testing that the built-in fonts load.
2023-09-30 08:08:11 +02:00
Nico Weber 8a7d3cb3f4 MacPDF: Override -[NSDocument isEntireFileLoaded]
We keep the NSData object around and stream for it, so that looks
like a good thing to do.
2023-09-30 08:08:11 +02:00
Nico Weber e9b0ebe55a MacPDF: Use Serenity license headers, remove Xcode boilerplate 2023-09-30 08:08:11 +02:00
Nico Weber 91e0438fca MacPDF: Make buildable from CMake
Use `Meta/serenity.sh build lagom MacPDF` to build, and either of
`open Build/lagom/bin/MacPDF.app` or
`Build/lagom/bin/MacPDF.app/Contents/MacOS/MacPDF` to run.

Xcode used to insert a bunch of things to Info.plist. Now it can
no longer do that, so manually put them there
2023-09-30 08:08:11 +02:00
Nico Weber 0216f34179 MacPDF: Move some files around
1. main.m is now main.mm
2. MainMenu.xib is now no longer in a Base.lproj subfolder
3. Remove SerenityPDF.entitlements since it won't be used in our CMake
   build
2023-09-30 08:08:11 +02:00
Nico Weber 5af30b8f63 MacPDF: Tweak "#pragma mark" comments 2023-09-30 08:08:11 +02:00
Nico Weber d2bda064da MacPDF: Pre-populate "Go to Page..." dialog with current page 2023-09-30 08:08:11 +02:00
Nico Weber e67d8cfb2a MacPDF: Show current page and page count in subtitle 2023-09-30 08:08:11 +02:00
Nico Weber bd19fcc039 MacPDF: Add a "Go to Page..." menu item
xib changes:
* Add a "Go" toplevel submenu
* Put a "Go to Page..." menu item in it
* Add showGoToPageDialog: to first responder
* Bind action of new menu item to that

The dialog is just a janky NSAlert for now.
2023-09-30 08:08:11 +02:00
Nico Weber fe4fe5ceff MacPDF: Support opening password-protected PDFs
This is a bit janky for several reasons:
* `initialize` is now no longer called on a bg thread
* sheet UI is janky both visually and from an implementation PoV

But hey, it works for now.
2023-09-30 08:08:11 +02:00
Nico Weber 97dbdbc9b0 MacPDF: Fill bitmap cache on demand in -[LagomPDFView drawRect]
Removes one needless paint on document restore, and makes sure
that window resizing invalidates the cache (since this now checks
the bitmap's size).
2023-09-30 08:08:11 +02:00
Nico Weber 2799dedb1b MacPDF: Save and restore current page
This works great when quitting and reopening the app,
but when closing a window and the reopening from Recent Files,
the current page isn't restored. In Preview.app, it is.
2023-09-30 08:08:11 +02:00
Nico Weber 5401f3aecc MacPDF: Clean up some includes 2023-09-30 08:08:11 +02:00
Nico Weber f5e81c8a99 MacPDF: Make pdfs without embedded fonts work again
A prior change removed some (very hacky) code needed for this
2023-09-30 08:08:11 +02:00
Nico Weber 87f31cab70 MacPDF: Remove application restore logging again 2023-09-30 08:08:11 +02:00
Nico Weber d3e8d87672 MacPDF: Add some temporary logging for application restoring
In the end, apparently I had "Close windows when quitting an
application" enabled in Desktop & Dock in System Settings. With that
turned off, it just worked (...but I still need to serialize the current
page in the view).

Even with it turned off, cmd-opt-q would "Quit and Keep Windows",
so I could've also used that for testing.
2023-09-30 08:08:11 +02:00
Nico Weber 751ed5e1ee MacPDF: Larger default window size 2023-09-30 08:08:11 +02:00
Nico Weber 43859f07ec MacPDF: Opt in to both automatic and sudden termination
Automatic termination means that the app no longer shows up as
opened in the doc when the last Window is closed, but it's actually
still running and opens immediately when clicked again.

Sudden termination means that the app can close quickly on logout.
I think it means the runtime just calls _exit() and assumes all
data is saved continuously.
2023-09-30 08:08:11 +02:00
Nico Weber 819a602ee1 MacPDF: Actually show contents of opened PDFs
xib change: connected _pdfView outlet to LagomPDFView instance.
2023-09-30 08:08:11 +02:00
Nico Weber 0a01a2c82b MacPDF: Start converting to document architecture
Cmd-O now produces an Open... dialog, and opening a PDF file reads it
(and then creates the old LagomPDFView object, which then reads
a hardcoded PDF again and displays that. One thing at a time.)

"Open Recent>" is also populated and seems to work.

See the guide:
https://developer.apple.com/library/archive/documentation/DataManagement/Conceptual/DocBasedAppProgrammingGuideForOSX/Introduction/Introduction.html
2023-09-30 08:08:11 +02:00
Nico Weber 77b311f00a MacPDF: FixedPoint hack fix courtesy of trflynn
Also some minor cleanups, and pick a different default document.
2023-09-30 08:08:11 +02:00
Nico Weber ef91ced481 MacPDF: Change current page with arrow left/right 2023-09-30 08:08:11 +02:00
Nico Weber c4c4ead9d2 MacPDF: Highdpi! 2023-09-30 08:08:11 +02:00
Nico Weber 6e0dea3a12 MacPDF: Style tweaks; one less leak 2023-09-30 08:08:11 +02:00
Nico Weber 4d9233dacc MacPDF: Fewer leaks; cache bitmap; refactor a bit 2023-09-30 08:08:11 +02:00
Nico Weber 2831654b00 MacPDF: Initial commit
This is mostly the output of the Xcode new app wizard.
2023-09-30 08:08:11 +02:00
Niklas Poslovski 485ae28ba7 AK: Add support for backtraces on Haiku 2023-09-29 15:11:52 +01:00
Sam Atkins b0317bb3a1 LibWeb: Implement Flex and FlexStyleValue types 2023-09-28 20:33:20 +01:00
Aliaksandr Kalenik e7a3040c9f LibWeb: Do not use JS::Handle for TimerHandler
There is no need to use JS::Handle for timer handler because it is
visited from JS::HeapFunction in HTML::Timer.
2023-09-27 16:33:21 +02:00
Shannon Booth 3bd04d2c58 LibWeb: Port Attr interface from DeprecatedString to String
There are an unfortunate number of DeprecatedString conversions required
here, but these should all fall away and look much more pretty again
when other places are also ported away from DeprecatedString.

Leaves only the Element IDL interface left :^)
2023-09-25 15:39:29 +02:00
Bastiaan van der Plaat 469563b398 GMLCompiler: Add icon_from_path and frame_style properties 2023-09-24 20:05:33 -06:00
Bastiaan van der Plaat a4e272d2c8 GMLCompiler: Fix bug where backslash in escaped sequence was preserved 2023-09-24 20:05:33 -06:00
Bastiaan van der Plaat 8f2319e966 Ladybird+LibWeb: Rename FileDirectoryLoader to GeneratedPagesLoader 2023-09-24 19:59:00 -06:00
Sam Atkins 1c4a05f8a4 LibWeb: Treat "revert" as a CSS-wide keyword
This isn't included in the base definition of a CSS-wide keyword, but
the CASCADE-4 spec which adds it says:

> The revert CSS-wide keyword rolls back the cascade to the cascaded
  value of the earlier origin.

So it is one. While I'm at it, rename `is_builtin()` to match the spec
terminology. It's not used currently, but will be in the next commit.
2023-09-25 00:46:21 +01:00
Sam Atkins aea112da71 LibWeb: Replace OverflowStyleValue with ShorthandStyleValue 2023-09-25 00:46:21 +01:00
Sam Atkins e905072e47 LibWeb: Replace GridTrackPlacementShorthandStyleValue with ShorthandSV 2023-09-25 00:46:21 +01:00
Sam Atkins 8efac89a16 LibWeb: Replace TextDecorationStyleValue with ShorthandStyleValue 2023-09-25 00:46:21 +01:00
Sam Atkins 6e311902de LibWeb: Replace PlaceItemsStyleValue with ShorthandStyleValue 2023-09-25 00:46:21 +01:00
Sam Atkins 8143d48161 LibWeb: Replace PlaceSelfStyleValue with ShorthandStyleValue
Turns out we were parsing `place-self` as a PlaceItemsStyleValue
sometimes, whoops.
2023-09-25 00:46:21 +01:00
Sam Atkins 1b0939b418 LibWeb: Replace PlaceContentStyleValue with ShorthandStyleValue 2023-09-25 00:46:21 +01:00
Sam Atkins 6758decc74 LibWeb: Replace ListStyleStyleValue with ShorthandStyleValue 2023-09-25 00:46:21 +01:00
Sam Atkins f5cb2e8dc2 LibWeb: Replace GridTrackSizeListShorthandStyleValue with ShorthandSV 2023-09-25 00:46:21 +01:00
Sam Atkins 48f3603119 LibWeb: Replace GridAreaShorthandStyleValue with ShorthandStyleValue 2023-09-25 00:46:21 +01:00
Sam Atkins 23d59a6caf LibWeb: Replace BorderStyleValue with ShorthandStyleValue
And also expand builtin values to the longhands, which we weren't doing
before.
2023-09-25 00:46:21 +01:00
Sam Atkins ae4b8d86df LibWeb: Include standard SVG user agent style sheet
For now, part of this is commented-out. Our current implementations of
`<mask>` and `<symbol>` rely on creating layout nodes, so they can't be
`display: none`.
2023-09-23 16:27:14 +02:00
Andrew Kaster 247f12d7b0 LibWeb: Insert WindowProperties object into Window's prototype chain
And implement WindowProperties, the "named properties object" for Window
according to the spec.

This involves moving an AO out of LegacyPlatformObject and into a common
place that the WindowProperties class can access.

This doesn't implement the AOs on Window that actually name lookup for
the unenumerable named properties on the window yet, just the
scaffolding.
2023-09-22 19:55:59 -06:00
Andreas Kling 51caa14381 LibWeb: Remove FrameLoader
This class is no longer used, now that we've moved to navigables.
2023-09-20 18:29:17 +02:00
Sam Atkins 9b4ddff6a9 LibWeb: Replace FontStyleValue with ShorthandStyleValue
Also, actually include font-variant since we were already parsing it but
throwing it away.
2023-09-20 12:17:16 +01:00
Sam Atkins 34591549b1 LibWeb: Replace BorderRadiusShorthandStyleValue with ShorthandStyleValue 2023-09-20 12:17:16 +01:00
Sam Atkins 34e0899ab0 LibWeb: Replace BackgroundStyleValue with ShorthandStyleValue
The `to_string()` for this is modified a little from the original,
because we have to calculate what the layer-count is then, instead of
having it already calculated.
2023-09-20 12:17:16 +01:00
Sam Atkins 1ae515c0b7 LibWeb: Replace FlexFlowStyleValue with ShorthandStyleValue 2023-09-20 12:17:16 +01:00
Sam Atkins aa45b3dfe3 LibWeb: Replace FlexStyleValue with ShorthandStyleValue
We still need the custom parsing and to_string() logic, but nothing
else. :^)
2023-09-20 12:17:16 +01:00
Sam Atkins d20254f1bc LibWeb: Rename CompositeStyleValue -> ShorthandStyleValue
It's a shorthand, so let's call it that. :^)
2023-09-20 12:17:16 +01:00
Junior Rantila f15d46fb8b Meta: Lint .mm files with lint-clang-format.sh 2023-09-19 11:37:48 -06:00
Karol Kosek 1681d6f721 Meta: Port recent build changes to gn build
This ports the following commits:
6476dea898
153ae93f9c
45b36bd08a
7870f10aa8
139c575cc9
63d09f6daf
1b3ad1c721
77d32fcb5f
2023-09-18 11:09:48 -06:00
Bastiaan van der Plaat 9939b028c6 LibWeb: Add basic Navigator send beacon support 2023-09-18 11:08:26 -06:00
Andreas Kling 0a133ccba4 LibWeb: Remove the HTML blink element
Support for this element has been removed from all major engines years
ago already, and it's currently the only reason we have a weird
"visible" flag on Layout::Node (which we toggle on a timer here..)
2023-09-18 14:45:20 +02:00
Daniel Bertalan 6fd8f9ea51 CMake: Link with -Bsymbolic-non-weak-functions if supported
This flag makes the linker bind default-visibility functions locally, so
that calls to them do not have to go through the PLT. This makes it
impossible to override them by preloading a DSO. This was already the
case partially due to `-fno-semantic-interposition`, however that flag
is only able to optimize call sites that are in the same Translation
Unit as the function definitions.

This removes 80% of the PLT relocations in `libjs.so.serenity`.

Obsoletes #20877
2023-09-18 10:26:42 +02:00
Daniel Bertalan 1f747b9132 CMake: Use CMAKE_POSITION_INDEPENDENT_CODE instead of explicit -fpic
This makes CMake pass `-fpie` instead of `-fpic` to the compiler when
building the Kernel and userland *executables*. This allows the compiler
to make certain optimizations based on the fact that the code will be
used in an executable, such as not having to emit `.localalias` symbols.
This leads to a 450 KiB decrease in the size of the Kernel binary.
2023-09-18 10:26:42 +02:00
Daniel Bertalan 4defa401d3 Toolchain+Ports: Update binutils to 2.41
Aside from a straightforward rebase, this contains an out-of-tree patch
from MaskRay which adds the `-Bsymbolic-non-weak-functions` flag to ld.
2023-09-18 10:26:42 +02:00
Shannon Booth e123492470 LibWeb: Allow ArrayBuffer attributes to be used in IDL
The FileReader IDL has the following entry:
```
readonly attribute (DOMString or ArrayBuffer)? result;
```

This change supports the use ArrayBuffer as a JS built-in in this
definition.
2023-09-17 16:37:31 -06:00
Dan Klishch 67e07fa4e2 JSSpecCompiler: Introduce ControlFlowOperator nodes 2023-09-17 16:04:42 -06:00
Dan Klishch 81519975c5 JSSpecCompiler: Add reference resolving pass
It replaces UnresolvedReference with Variable, FunctionPointer, or
SlotName nodes. Also, it gathers all variable names from their
declarations.
2023-09-17 16:04:42 -06:00
Dan Klishch 326bac19d9 JSSpecCompiler: Make nodes inherit from Statement or Expression
The distinction between them will become important during CFG building.
2023-09-17 16:04:42 -06:00
Dan Klishch ed5ef4da6d JSSpecCompiler: Make clang-tidy happier, no functional changes 2023-09-17 16:04:42 -06:00
nipos 2e0960a7ef Meta: Don't link LibCrypt to native libcrypt on Haiku 2023-09-17 13:38:12 -06:00
nipos 2691c079d4 Meta+Ladybird: Link to libnetwork on Haiku 2023-09-17 13:38:12 -06:00
nipos e345085329 Meta+Ladybird: Add some extra definitions for Haiku 2023-09-17 13:38:12 -06:00
implicitfield 7cb80c67d8 checksum: Add support for BLAKE2b 2023-09-17 16:49:35 +03:30
implicitfield 1b3ad1c721 LibCrypto: Add support for BLAKE2b 2023-09-17 16:49:35 +03:30
Aliaksandr Kalenik da2c18d1f9 Meta: Update LibJSGCVerifier to build with llvm 16.0.6
Changes to fix LibJSGCVerifier build with llvm version used in
BuildClang.sh
2023-09-16 20:51:28 -06:00
Andrew Kaster 78ebeb6a5a Ladybird/Android: Move gradle files to Ladybird/Android directory
And add documentation for how to use the thing
2023-09-15 14:18:52 -06:00
Timothy Flynn 139c575cc9 LibUnicode: Update to Unicode version 15.1.0
https://unicode.org/versions/Unicode15.1.0/

This update includes a new set of code point properties, Indic Conjunct
Break. These may have the values Consonant, Linker, or Extend. These are
used in text segmentation to prevent breaking on some extended grapheme
cluster sequences.
2023-09-15 18:30:26 +02:00
Tim Schumacher b0c1dc14f3 Meta: Download pnp_ids.html to the cache directory 2023-09-14 08:05:00 +01:00
Tim Schumacher cc6054ae3b Meta: Download commonmark.spec.json to the cache directory 2023-09-14 08:05:00 +01:00
Sam Atkins 2cb816ad69 LibWeb: Alphabetize property names in Properties.json
And add a check to make sure it stays that way!
2023-09-11 10:42:00 +01:00
Sam Atkins b78b5e6297 LibWeb: Generate property_is_shorthand(PropertyID) function
Sometimes we want to know if a property is a shorthand, but don't care
what its longhands are.
2023-09-11 10:42:00 +01:00
Dan Klishch 9b7aa8f6b6 Meta: Do not spam "<compiler-name>: command not found"
In bd7d01e9, Meta/serenity.sh started checking cc and cxx if CC or CXX
respectively are not set in the environment. My machine does not have
cxx symlink in PATH, so every invocation of the script resulted in
the "cxx: command not found" message outputted to stderr, and that
became quite annoying.
2023-09-09 13:38:06 -06:00
Dan Klishch 4c4e1e1aed JSSpecCompiler: Add if branch merging pass
It merges standalone IfBranch/ElseIfBranch nodes into IfElseIfChain
nodes. This will ease CFG generation later.
2023-09-09 11:20:43 -06:00
Dan Klishch 092ed1cc8a JSSpecCompiler: Allow storing NullableTrees in nodes
And use this in ElseIfBranch node.
2023-09-09 11:20:43 -06:00
Dan Klishch 4eede5282c JSSpecCompiler: Allow storing error text in ErrorNode
This will be the main way to communicate errors from compilation passes.
2023-09-09 11:20:43 -06:00
Dan Klishch 72794e7843 JSSpecCompiler: Add function call canonicalization pass
It simplifies ladders of BinaryOperators nodes in the function call
arguments into nice and neat FunctionCall node. Ladders initially appear
since I do not want to complicate expression parser, so it interprets
`f(a, b, c, d)` as `f "function_call_operator" (a, (b, (c, d))))`.
2023-09-09 11:20:43 -06:00
Dan Klishch 1c4cd34320 JSSpecCompiler: Restrict usage of NodeSubtreePointer
This class stores a non-owning raw pointer to a member of `Node`, so
extra care is needed to ensure that referenced `Node`s will be alive
by the time `NodeSubtreePointer` is used. Since we only need to use this
class while traversing AST in `RecursiveASTVisitor`, access to class
methods can be restricted using `Badge<RecursiveASTVisitor>`.
2023-09-09 11:20:43 -06:00
Timothy Flynn d0fd34112f LibJS: Remove the now-unused ThrowableStringBuilder 2023-09-09 13:03:25 -04:00
Andrew Kaster bd7d01e975 Meta: Move compiler detection functions to their own file
This way we can use them in other scripts that want to build Lagom
and pick a suitable host compiler.
2023-09-08 09:01:34 -06:00
Shannon Booth 41928c2902 LibWeb: Port DOMException interface from DeprecatedString to String 2023-09-06 11:44:45 -04:00
Andrew Kaster 4e9dc127ae Meta: Run Android CI via gradle wrapper instead of via CMake 2023-09-06 11:26:20 -04:00
Shannon Booth 914fb90bbe LibWeb: Don't generate Optional<String> from IDL for non-null arguments
Previously if the IDL was something like:
```
constructor(optional DOMString data = "");
```

We were generating code that would be passing through to the constructor
an Optional<String> - even though for this situation it is not possible
for it to be null.

Instead, if we know if there is a default value that is non-null and the
type is not nullish, just generate the cpp code as a String.
2023-09-05 20:36:09 -04:00
Shannon Booth f991e40d7f LibWeb: Support [Reflect] on IDL String attributes that may return null
This change allows IDL interfaces to be compiled using new AK String
which have a attribute in the interface that may return null.

Without this change we would run into a compile error from code such as
the following example:

```
auto retval = impl->deprecated_attribute(HTML::AttributeNames::ref);

if (!retval.has_value()) {
    return JS::js_null();
 }
 return JS::PrimitiveString::create(vm, retval.release_value());
```

As `deprecated_attribute` returns a `DeprecatedString` instead of an
`Optional<String>`. Fix that by using the non-deprecated attribute
implementation, and falling back to the empty string for where we cannot
return null.

Also add a test here to cover a regression I almost introduced here
which was not previously covered by our test suite.

Ideally, all of this should actually just be calling
Element::get_attribute_value, but I'm not entirely sure at this stage
what the behavioral change would be to test for here. Since this
implementation preserves the previous behavior, stick with it, and add a
FIXME for now.
2023-09-05 20:36:09 -04:00
Shannon Booth 0f6782fae6 LibWeb: Rename Element::attribute to Element::deprecated_attribute
This should allow us to add a Element::attribute which returns an
Optional<String>. Eventually all callers should be ported to switch from
the DeprecatedString version, but in the meantime, this should allow us
to port some more IDL interfaces away from DeprecatedString.
2023-09-05 20:36:09 -04:00
Daniel Bertalan dac443fbff Meta: Link Lagom with LLD by default and allow configuring the linker
This ports over the `LADYBIRD_USE_LLD` option from the standalone
Ladybird build and generalizes it to work for mold as well: the
`LAGOM_USE_LINKER` variable can be set to the desired name of the
linker. If it's empty, we default to trying LLD and Mold on ELF
platforms (in this order).
2023-09-05 14:50:36 +02:00
Sam Atkins e9b58ff096 LibWeb: Move check for CSS-wide keywords to ValueID.h
This feels like a better home for it. The new name better reflects the
spec phrasing.
2023-09-05 14:27:23 +02:00
Timothy Flynn bb4eca2037 LibLocale: Remove compact currency patterns
These are no longer used by the Intl.NumberFormat implementation.
2023-09-04 18:22:28 +02:00
Sönke Holz d6906736cc Meta: Add -fno-omit-frame-pointer flag
We currently only use frame pointer-based backtrace generation.
This option is necessary for RISC-V as otherwise the compiler doesn't
save `fp` most of the time.
I made this flag not riscv64 exclusive, as we should do everything
to make that kind of backtrace generation work.
(https://discord.com/channels/830522505605283862/1139481927594803260/1148020960499351643)
2023-09-04 07:45:35 +02:00
Andrew Kaster 7bc009d80f Ladybird: Add new template Kotlin Android application without Qt
This template app from Android Studio should hopefully be more fun to
work on than the Qt wrapped application we were using before. :^)

It currently builds the native code using gradle rules, and has a stub
WebViewImplementationNative class that will wrap a c++ class of the same
name that inhertis from WebView::ViewImplementation. Spawning helper
processes and creating proper views in Kotlin is next on the list.
2023-09-03 11:38:51 +02:00
Shannon Booth d4a890080d LibWeb: Switch IDL from UseNewAKString to UseDeprecatedAKString
NewAKString is effectively the default for any new IDL interface, so
let's mark this as the default behavior. It also makes it much easier to
figure out whatever interfaces are still left to port over to new AK
String.
2023-09-02 19:23:41 +01:00
Dan Klishch 198591cc20 JSSpecCompiler: Add infrastructure to run compiler passes on AST 2023-09-02 19:57:06 +02:00
Dan Klishch cd8f4aaa7d JSSpecCompiler: Introduce Function and ExecutionContext classes
Currently, they are not extremely useful, but the plan is to store
all function-local state in JSSpecCompiler::Function and all
"translation unit" state in ExecutionContext.
2023-09-02 19:57:06 +02:00
Andrew Kaster 4641af7873 AK: Always use our assertion failure method, and add backtrace to it
On platforms that support it, enable using ``<execinfo.h>`` to get
backtrace(3) to dump a backtrace on assertion failure. This should make
debugging things like WebContent crashes in Lagom much easier.
2023-09-01 11:50:47 +02:00
Sebastian Zaha 8dcb7c29ad Meta: Port recent build changes to gn build
This ports the following commits:

e26ead0995
5c5a00dd3a
2023-09-01 09:00:03 +02:00
Timothy Flynn f7adc3320d Meta: Replace Lagom's LibWebView setup with LibWebView's CMakeLists.txt
This lets us add new sources to LibWebView in a single location.
2023-08-31 06:33:04 -04:00
Dan Klishch 66f4cdba85 JSSpecCompiler: Make it compile and dump AST created from stdin input 2023-08-31 11:00:31 +02:00
Dan Klishch db0a03d1fb JSSpecCompiler: Add infrastructure to parse <emu-clause> into AST 2023-08-31 11:00:31 +02:00
Dan Klishch f70e39d501 JSSpecCompiler: Add TextParser for converting algorithm steps into AST 2023-08-31 11:00:31 +02:00
Dan Klishch 9f29e04897 JSSpecCompiler: Add functions for splitting node contents into tokens 2023-08-31 11:00:31 +02:00
Dan Klishch 8342361481 JSSpecCompiler: Add Token type 2023-08-31 11:00:31 +02:00
Dan Klishch 5846470a5f JSSpecCompiler: Add stubs for AST types 2023-08-31 11:00:31 +02:00
Dan Klishch da30afa0c3 Meta: Allow overriding root for local includes
Previously, we always assumed that local includes are relative to the
parent directory of a file. This effectively banned style-wise
multi-directory subprojects which are not libraries, since there was no
way to cleanly reference local file from a different directory.

This commit relaxes the restrictions by introducing
LOCAL_INCLUDE_ROOT_OVERRIDES. Entry in the set changes root of the
local includes to itself for all files in its subtree.
2023-08-31 11:00:31 +02:00
Timothy Flynn bf59e06d2a Ladybird+LibWebView: Extract common JS console functionality to a helper
This creates WebView::ConsoleClient to handle functionality that will be
common to the JS consoles of all Ladybird chromes. This will let each
chrome focus on just the UI.

Note that this includes the `console.group` functionality that only the
Serenity chrome previously had. This was a FIXME in the Qt chrome, and
it is implemented such that all chromes will receive this functionality
for free.
2023-08-30 09:24:59 +02:00
Timothy Flynn 1e1c3e5a34 LibWebView: Create a method to syntax-highlight page source with HTML
This tokenizes a page's source to produce HTML with syntax highlighting.
The first implementation here is rather simple; we do not yet implement
code folding, line numbers, etc.

The goal is for this to be used as the View Source implementation for
all Ladybird chromes.
2023-08-29 08:11:11 -04:00
Sebastian Zaha 967cb86c5b Meta: Port recent build changes to gn build
This ports the following commits:

848ec538c6
703c2bb06e
27dd2a40ad
daefe744ba
9812031a02
4c0816b002
8bb275f2ea
3f122b7335
2023-08-29 09:37:52 +02:00
Timothy Flynn 5d7e73adfe Meta: Add and document convenient method to build non-Qt Ladybird chrome
This lets us switch between the AppKit and Qt chromes more easily.
2023-08-27 19:02:36 -04:00
Luke Wilde af2886449a LibWeb: Implement PerformanceObserver 2023-08-27 23:27:44 +02:00
Timothy Flynn 3f122b7335 LibWebView: Allow using native/user style sheets on Lagom
Move the methods to set the native/user style sheets to the base
ViewImplementation class. We must also generate the native style sheet
explicitly for now, as LibWebView on Lagom isn't able to include the
main LibWebView CMakeLists.txt file yet.
2023-08-26 15:32:36 -04:00
Timothy Flynn 70a87795e4 LibWeb: Remove the Tests subfolder
These were used only by test-web, which was removed in commit 81aa60163.
2023-08-25 05:39:58 +02:00
Andrew Kaster d1aea87889 LibWeb: Add NavigateEvent, the main event of the Navigation API
This event is the star of the show, and the main way that web content
can react to either programmatic or user-initiated navigation.

All of the fun algorithms will have to come later though.
2023-08-24 11:03:57 -06:00
Andrew Kaster 3dd3b2019d LibWeb: Add NavigationTransition, a transient property of Navigation
This property is useful for web content to determine whether an ongoing
navigation has settled or not.
2023-08-24 11:03:57 -06:00
Andrew Kaster 4989375191 LibWeb: Add NavigationDestination, used for NavigateEvents
This class will be used in the algorithms for the navigate event firing
algorithms to populate the destination field of the NavigateEvent.
2023-08-24 11:03:57 -06:00
Andrew Kaster 0c2f758067 LibWeb: Implement the start of the Navigation API
This API is how JavaScript can manipulate the new Navigable concepts
directly. We are still missing most of the interesting algorithms on
Navigation that do the actual navigation steps, and call into the
currently WIP navigable AOs.
2023-08-24 11:03:57 -06:00
Andrew Kaster 51c2835044 LibWeb: Add NavigationCurrentEntryChangeEvent, fired when navigating
This event will be fired by Navigation when changing the current
NavigationHistoryEntry.
2023-08-24 11:03:57 -06:00
Andrew Kaster 3c1d4eab24 LibWeb: Add NavigationHistoryEntry, a wrapper around SessionHistoryEntry 2023-08-24 11:03:57 -06:00
Andrew Kaster cf0ffc12cc BindingsGenerator: Handle nullable enum properties
Add some checks to the statement wrapping code to make sure we properly
handle the expected pattern of returning ``Optional<Enum>`` from
nullable enum properties.
2023-08-24 11:03:57 -06:00
Sam Atkins eab44f982a Meta: Use embed_as_string_view() for stringify_gml() 2023-08-24 07:42:12 +01:00
Sam Atkins abba6f7b54 LibWeb: Use embed_as_string_view() for style sheet source generation 2023-08-24 07:42:12 +01:00
Sam Atkins af4642c826 Meta: Make embed_as_string_view.py usable by CMake builds :^) 2023-08-24 07:42:12 +01:00
Bastiaan van der Plaat c88f14902b LibWeb: Add DOMQuad and text tests 2023-08-23 12:11:21 +01:00
Bastiaan van der Plaat 43825acc79 Meta+BindingsGenerator: Add postfix to member_value_name to make unique 2023-08-23 12:11:21 +01:00
Tim Schumacher dbc25f18ec LibCompress: Let BrotliDecompressionStream take a MaybeOwned 2023-08-23 12:03:37 +01:00
Tim Schumacher 8a853278d0 LibCompress: Port ZlibDecompressor to AK::Stream 2023-08-23 12:03:37 +01:00
Timothy Flynn eb8f7b303c LibLocale+LibJS: Make relative time format APIs infallible
These APIs only perform small allocations, and are only used by LibJS.
Callers which could only have failed from these APIs are also made to
be infallible here.
2023-08-23 05:29:21 +02:00