Commit Graph

18571 Commits

Author SHA1 Message Date
Sam Atkins
1da53ef854 Welcome: Get LibWeb to parse Markdown documents for us 2022-09-28 23:58:26 +01:00
Sam Atkins
28a591ce7b LibWeb: Use zoom cursor for CSS zoom-in/zoom-out cursors
Ideally we'd use a different one for each, but this is fine.
2022-09-28 23:58:26 +01:00
Timothy Flynn
c3fd4554a6 LibTimeZone: Do not use tzname to determine the current time zone
The tzname array stores the abbreviated names of the current time zone
when in standard and daylight time. These abbreviations are ambiguous;
a single abbreviation often maps to multiple time zones. For example,
EST is used by America/New_York and America/Detroit, and CST could be
the abbreviation of Central Standard Time or China Standard Time.

Instead, we mimic a subset of how both ICU and Howard Hinnant's "date"
library determines the current time zone. First, we try to parse the TZ
environment variable. If that fails, or isn't set, we try to resolve the
/etc/localtime symbolic link. On most Linux systems and on macOS, this
is a link to the current TZDB file in use.

If all of the above fails, we fall back to UTC.
2022-09-28 23:52:51 +01:00
demostanis
a194303948 less: Show correct line number
This patch makes less start at line 1 instead of 0.
2022-09-28 09:42:40 +01:00
demostanis
505910aea1 less: Properly stop on EOF 2022-09-28 09:42:40 +01:00
Lucas CHOLLET
e1edd620ee pls: Use LibCore::Account::login() instead of manually setting the uid
In addition to changing the uid, the method also changes the gid and
properly sets groups. So this patch will also mitigate the security
issue of `pls`.
2022-09-28 00:35:36 +01:00
Lucas CHOLLET
8fabe9a3ad LibCore: Propagate errors from LibCore::Account::login() 2022-09-27 21:29:44 +01:00
Lucas CHOLLET
08dcc40aa5 LibCore: Allow the setgroups wrapper to be used on Lagom
i.e. move Core::System::setgroups() outside the `__serenity__` define.
The base function is already used by LibCore::Account.
2022-09-27 21:29:44 +01:00
Lucas CHOLLET
6900c4fe29 su: Add the --login option
This option, often used with only a lonely dash, allows to "simulate a
login". For now, it just changes the current directory to the home of
the new user.
2022-09-27 21:29:44 +01:00
Lucas CHOLLET
507cb411c2 LibCore: Use StringView instead of char * in Account 2022-09-27 21:29:44 +01:00
Sam Atkins
54be317fa9 LibWeb: Use TokenStreams when expanding unresolved CSS values
This fixes a bug where any whitespace inside the `var()` or `attr()`
functions would make the StyleComputer fail to resolve them.
2022-09-27 19:36:31 +02:00
Sam Atkins
ae64cffd3a LibWeb: Expose token counts from CSS TokenStream 2022-09-27 19:36:31 +02:00
Sam Atkins
8ce38fddd9 LibWeb: Move CSS TokenStream to its own file
This lets us use TokenStream in StyleComputer without every user of
StyleComputer pulling in the entire CSS Parser.
2022-09-27 19:36:31 +02:00
Nico Weber
bf6d5fce18 LibWeb: In MimeType serialization, put just one \ in front of each " 2022-09-27 15:47:54 +01:00
Thomas Voss
80b56ced93 Meta: Update my email-address 2022-09-27 15:15:36 +01:00
Linus Groh
0b52b883af LibWeb: Implement '5.5. Response class' from the Fetch API :^) 2022-09-27 14:56:17 +01:00
Linus Groh
9fb672e981 LibWeb: Implement '5.4. Request class' from the Fetch API :^) 2022-09-27 14:56:17 +01:00
Linus Groh
5ad6283331 LibWeb: Implement '5.3. Body mixin' from the Fetch API :^)
This will be used to share functionality between Request and Response.
2022-09-27 14:56:17 +01:00
Linus Groh
afe2563e2b LibWeb: Make HeaderList ref-counted
This is needed to eventually share a header list between a Request or
Response object's internal infra request/response and the object's
exposed Header object.
2022-09-27 14:56:17 +01:00
Linus Groh
2d57d47132 LibWeb: Make Fetch::Infrastructure::Request::m_method default to "GET"
ByteBuffer has an inline capacity of 32 bytes, so this isn't fallible
and can be done inline.
2022-09-27 14:56:17 +01:00
Linus Groh
924d7721f0 LibWeb: Stub out Fetch::Infrastructure::Body::fully_read_as_promise() 2022-09-27 14:56:17 +01:00
Linus Groh
a7164f2674 LibWeb: Stub out Fetch::Infrastructure::Body::clone() 2022-09-27 14:56:17 +01:00
Linus Groh
ef5e2eb794 LibWeb: Implement Fetch::Infrastructure::Response::clone() 2022-09-27 14:56:17 +01:00
Linus Groh
b5e8e9b30b LibWeb: Support ReadonlyBytes as argument for extract_body()
This now matches the spec's requirement of "a byte sequence or BodyInit
object object".
2022-09-27 14:56:17 +01:00
Linus Groh
426e32e5c0 LibWeb: Add WebIDL::ExceptionOr constructor for wrapped ValueType
This is copied from JS::ThrowCompletionOr and will allow using them
interchangeably with types wrapped by JS::Value such as JS::Object*.
2022-09-27 14:56:17 +01:00
Linus Groh
4461234898 LibWeb: Support plain (throw) JS::Completion in WebIDL::ExceptionOr
This makes it possible to propagate exceptions from a function that
returns JS::ThrowCompletionOr via TRY() in another function that returns
WebIDL::ExceptionOr.
2022-09-27 14:56:17 +01:00
Linus Groh
fd52119ca3 LibWeb: Add getters and setters for Fetch::Header's members 2022-09-27 14:56:17 +01:00
Linus Groh
dc6fb43d26 LibWeb: Add referrer policy to Fetch::Infrastructure::Request
The enum is in its own directory and namespace as there's a standalone
spec for it, that will later also house AOs.

- https://w3c.github.io/webappsec-referrer-policy/
- https://www.w3.org/TR/referrer-policy/
2022-09-27 14:56:17 +01:00
Linus Groh
a602a4c780 LibWeb: Heap-allocate returned Fetch::Infrastructure::{Request,Response}
A Request/Response instance should always be heap-allocated and have
clear ownership, so let's also wrap it in a NonnullOwnPtr instead of
putting them on the stack.
2022-09-27 14:56:17 +01:00
Linus Groh
88ee15a497 LibWeb: Mark two Fetch::Infrastructure::Request getters as const 2022-09-27 14:56:17 +01:00
Linus Groh
37972e9f0c LibWeb: Implement most WebIDL promise operations 2022-09-27 14:56:17 +01:00
Linus Groh
e68e92b304 LibJS: Make JS::NativeFunction use JS::SafeFunction internally
This still needs a project-wide cleanup to remove handles captured in
lambdas, which is now longer required.
For now, this will be used in the next commit implementing promise AOs
from Web IDL, which make heavy use of deferred callbacks.
2022-09-27 14:56:17 +01:00
Linus Groh
00fa71725b LibWeb: Implement JS value <-> JSON parsing/serialization AOs 2022-09-27 14:56:17 +01:00
Linus Groh
4e536eaf98 LibJS: Add JSON.stringify function to the intrinsics
This is needed for some Web APIs.
2022-09-27 14:56:17 +01:00
Linus Groh
b42b950688 LibWeb: Implement MimeType serialization 2022-09-27 14:56:17 +01:00
ne0ndrag0n
d463b8e6fb SQLStudio: Save and load blank files without failing assertion 2022-09-27 14:38:50 +01:00
kleines Filmröllchen
5294fd671e PixelPaint: Use the parallel ImageProcessor to apply filters
The main advantage of this change is that heavy-weight filters do not
lock up the GUI anymore.

This first cut has several flaws:
- We do not account for modification of the referenced images while the
  filter is running. Depending on the exact filter behavior this might
  have all sorts of weird effects. A simple fix would be to show a
  progress dialog to the user, preventing them from performing other
  modifications in the meantime.
- We do not use the image processor for previews. Preview behavior has a
  couple of other considerations that are intentionally not addressed in
  this commit or pull request.
2022-09-27 14:23:11 +01:00
kleines Filmröllchen
ade868aa56 PixelPaint: Add a general-purpose parallel image processing pipeline
The ImageProcessor singleton is intended to be used by all sorts of
image processing which might take some time to complete; or other
background actions. We're not using BackgroundTask here because this
system is specifically designed to work with task queues and PixelPaint
interaction; e.g. it provides common image processing tasks such as
filter application.
2022-09-27 14:23:11 +01:00
kleines Filmröllchen
9483adee46 PixelPaint: Expose the GUI event loop from the ImageEditor
This allows processing threads to call back into the GUI.
2022-09-27 14:23:11 +01:00
kleines Filmröllchen
056b081e2d PixelPaint: Reference-count filters
For multi-threading filter application, shared ownership is much easier
to work with.
2022-09-27 14:23:11 +01:00
Marco Santos
5f76ab9836 Spreadsheet: Add toolbar actions to change the cell style 2022-09-27 13:38:11 +03:30
Sam Atkins
42f36d4865 LibGUI: Make "Home" key behavior comfier on wrapped lines :^)
There's a big comment explaining it because it's somewhat confusing, but
the behavior I'm copying from other editors is, when you repeatedly
press the `Home` key:

1. Go to the start of the visual line, where it wraps.
2. Go to the first non-whitespace character on the logical line, which
   is what happens in non-wrapped lines.
3. Go to column 0.
4. GOTO 2
2022-09-26 23:12:31 +02:00
Enver Balalic
55c099c953 LibHTTP: Null out on_ready_to_read on socket close
This fixes the segfault reported in #15283.

on_ready_to_read gets re-registered on every job start anyways.
I see no reason why this could be bad.
2022-09-26 23:11:28 +02:00
Roberto Bampi
69f7a59a34 Magnifier: Add the option to save captures 2022-09-26 17:28:54 +01:00
MacDue
f6264523b9 LibWeb: Fix destination bitmap edge clip case in transform painting
This fixes an edge case, where the destination rect falls partly
outside the painter, so is clipped to a smaller size in
`get_region_bitmap()` (which needs to be accounted for with an extra
offset).
2022-09-26 01:38:30 +02:00
Linus Groh
bbaa05fcf9 LibWeb: Move DOMException from DOM/ to WebIDL/ 2022-09-25 19:13:31 +01:00
Linus Groh
ad04d7ac9b LibWeb: Move ExceptionOr from DOM/ to WebIDL/
This is a concept fully defined in the Web IDL spec and doesn't belong
in the DOM directory/namespace - not even DOMException, despite the name
:^)
2022-09-25 19:13:31 +01:00
MacDue
e3537e4374 LibWeb: Fix shadow painting when the target painter is translated 2022-09-25 18:37:31 +02:00
MacDue
3fad64dfbc LibWeb: Sample the destination when painting element opacity/transform
This now copies the area under the destination to a new bitmap, that
is then scaled to the size of the source. The element is then painted
into that bitmap, which is then scaled and painted back to
the destination. This is done as many effects such as shadows, border
radii, filters, etc require being able to read pixels from the painter.

This does work (and is not that noticeable in many cases), but it does
mean there may be a few scaling artifacts in the background
around transformed elements. Though that was already the case before
anyway for the elements (since it is just a bitmap scale).

What we really want is to (where possible) just scale the paintable
and its descendants, then paint things normally, which would give
much nicer results (but is much more tricky to achieve).

This also now makes it so only a bitmap of the size of the paintable is
copied/created, rather than the whole page.
2022-09-25 18:37:31 +02:00
MacDue
8967fe9d92 LibWeb: Add PaintableBox::absolute_paint_rect()
This method returns the total area this element will paint to.
Currently, this just means accounting for box-shadows, though
there are likely more effects that need to be accounted for here.
2022-09-25 18:37:31 +02:00