Commit graph

57211 commits

Author SHA1 Message Date
Aliaksandr Kalenik
57e5abae92 LibJS+LibWebView+WebContent+Ladybird: Output GC-graph into a file
Instead of displaying a massive JSON in stdout, it's more practical
to save the GC-graph to a file.
2023-12-12 15:35:35 +01:00
Andreas Kling
ed1bee222b LibJS: Give Shape::TransitionType an underlying 8-bit type
This shrinks Shape by 8 bytes. :^)
2023-12-12 15:26:46 +01:00
Dan Klishch
8dfca6c464 LibWebView: Do not treat prefix of public suffix as valid public suffix 2023-12-12 06:44:54 -05:00
Liav A
dbae1873ec Base: Add manual page for drain(1) 2023-12-12 06:44:10 -05:00
Liav A
f67b9cb680 Utilities/drain: Add an option to specify different block size
This is useful for a situation when handling a small file than 512 KiB
or being under low system memory pressure.
2023-12-12 06:44:10 -05:00
Andreas Kling
5204020d42 LibWeb: Add missing DOM::Position::visit_edges()
Caught by running the test suite under ASAN.
2023-12-12 01:08:07 +01:00
Andreas Kling
6cbcd521a2 LibJS/JIT: Add fast path for UnaryMinus on Int32
5% speedup on Octane/mandreel.js :^)
2023-12-12 00:10:44 +01:00
Sönke Holz
78419e858d Kernel/Graphics: Don't use [[gnu::packed]] on Bochs VGA structs
The `[[gnu::packed]]` attribute apparently lowered the required
alignment of the structs, which caused the compiler to generate two
1 byte loads/stores on RISC-V. This caused the kernel to read/write
incorrect values, as the device only seems to accept 2 byte operations.
2023-12-11 14:46:06 -07:00
stelar7
dd391d5e8c LibWeb: Add test for week_number_of_the_last_day microsyntax 2023-12-11 14:04:27 -07:00
stelar7
479c48643e LibWeb: Move common date microsyntax to a separate file 2023-12-11 14:04:27 -07:00
stelar7
a72636ad8d LibWeb: Implement week_number_of_the_last_day 2023-12-11 14:04:27 -07:00
Aliaksandr Kalenik
6b79508c08 LibWeb: Use offset of nearest scrollable ancestor for positioned boxes
Because positioned descendants are painted out-of-order we need to
separately apply offset of nearest scrollable box for them.

Fixes https://github.com/SerenityOS/serenity/issues/20554
2023-12-11 20:37:05 +01:00
Aliaksandr Kalenik
2952f01e84 LibWeb: Add pair of methods to apply/reset scroll offset of paintable
Separate scroll application from before_children_paint and
after_children_paint.
2023-12-11 20:37:05 +01:00
Andreas Kling
8eacb81eba LibJS: Skip redundant marking of Shape property table keys
All the keys in a property table are guaranteed to be marked via
Shape::m_property_key in each step of the transition chain that leads
up to the Shape.
2023-12-11 20:36:15 +01:00
Andreas Kling
3d92c26445 LibJS: Stop making shapes unique
We previously had a concept of unique shapes, which meant that they
couldn't be shared between multiple objects.

Object shapes became unique in three situations:

- They were the shape of the global object.
- They had more than 100 properties added to them.
- They had one or more properties deleted from them.

Unfortunately, unique shapes presented an annoying problem for inline
caches, and we added a "unique shape serial number" for being able to
tell that a unique shape had been mutated.

This patch gets rid of the concept of unique shapes, simplifying all
the caching code, since inline caches can now simply perform a shape
check and then we're good.

To make this possible, we now have the concept of delete transitions,
which occur when a property is deleted from a shape.

Note that this patch by itself introduces a performance regression in
some situtations, since we now create a lot more shapes, and marking
their property keys can be very heavy. This will be addressed in a
subsequent patch.
2023-12-11 20:36:15 +01:00
Andreas Kling
ef86cf4646 LibJS: Mark forward shape transition keys
These should really be weakly held by the Shape, but we don't have a
mechanism for weak hashmap keys at the moment, so let's just mark
these for now so they don't go stale.
2023-12-11 20:36:15 +01:00
dependabot[bot]
e5120ab389 CI: Bump actions/setup-python from 4 to 5
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 5.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-11 12:07:40 -07:00
Andrew Kaster
0052f9e895 CMake: Don't try to enable install options if no languages are enabled
This removes a CMake dev warning when building serenity via the
Superbuild.
2023-12-11 11:03:32 -07:00
Sam Atkins
9b77fc00ba LibWeb: Add missing FIXME to Navigable::navigate() 2023-12-11 16:33:28 +00:00
Aliaksandr Kalenik
286ea068fc LibWeb: Use JS::Handle for page pointer in LoadRequest
Since we can't visit page pointer from LoadRequest we need to use
JS::Handle to keep it alive.
2023-12-11 16:55:25 +01:00
Aliaksandr Kalenik
6ac43274b2 LibWeb+LibJS: Use JS::GCPtr for pointers to GC-allocated objects
Fixes warnings found by LibJSGCVerifier
2023-12-11 16:55:25 +01:00
Shannon Booth
ed97946975 LibWeb: Support obsolete but required -webkit- CSS parsing quirk
As outlined in: https://www.w3.org/TR/selectors-4/#compat

We now do not treat unknown webkit pseudo-elements as invalid at parse
time, and also support serializing these elements.

Fixes: #21959
2023-12-11 16:54:59 +01:00
Shannon Booth
83758d4cdd LibWeb: Wrap PseudoElements stored in SimpleSelector in a class
No functional impact intended. This is just a more complicated way of
writing what we have now.

The goal of this commit is so that we are able to store the 'name' of a
pseudo element for use in serializing 'unknown -webkit-
pseudo-elements', see:

https://www.w3.org/TR/selectors-4/#compat

This is quite awkward, as in pretty much all cases just the selector
type enum is enough, but we will need to cache the name for serializing
these unknown selectors. I can't figure out any reason why we would need
this name anywhere else in the engine, so pretty much everywhere is
still just passing around this raw enum. But this change will allow us
to easily store the name inside of this new struct for when it is needed
for serialization, once those webkit unknown elements are supported by
our engine.
2023-12-11 16:54:59 +01:00
Shannon Booth
08920b7a34 LibWeb: Simplify a conditional check in parse_pseudo_simple_selector
Put a shared `pseudo_element.has_value()` check into the same block.
2023-12-11 16:54:59 +01:00
Shannon Booth
22d1337811 LibWeb: Use CSS::pseudo_element_name in Dump
This is a simple deduplication of code :^)
2023-12-11 16:54:59 +01:00
Shannon Booth
2dce09b12e LibWeb: Use code_points helper for getting delim CSS token codepoint
This is less code, and more expressive.
2023-12-11 16:54:59 +01:00
Shannon Booth
74284abcba LibWeb/Tests: Rename css-attr-ref.html reference to text-div.html
This is currently only used by CSS attr ref tests, but is useful outside
of attr ref tests as well. Give a more generic name to this ref file for
this usage.
2023-12-11 16:54:59 +01:00
Andreas Kling
6994ea5885 LibWeb: Skip out-of-flow boxes when wrapping inlines in anonymous block
Out-of-flow boxes (floating and absolutely-positioned elements) were
previously collected and put in the anonymous block wrapper as well, but
this actually made hit testing not able to find them, since they were
breaking expectations about tree structure that hit testing relies on.

After this change, we simply let out-of-flow boxes stay in their
original parent, preserving the author's intended box tree structure.
2023-12-11 13:19:12 +01:00
Nico Weber
11354dbf9e LibPDF: Remember inline image stream bytes
We still don't process inline images, but now we have the pieces we need
for doing it (`map` and `stream_bytes`).
2023-12-11 10:50:39 +01:00
Nico Weber
cabc6a9d80 LibPDF: Add a comment that PDF 2.0 added a length key for inline images
In practice, basically no file has it, since it was only added in 2.0,
and 1.7 explicitly said "in particular, the Type, Subtype, and Length
entries normally found in a stream or image dictionary are unnecessary."
2023-12-11 10:50:39 +01:00
Nico Weber
071f890847 LibPDF: Require whitespace in front of inline image marker EI
Fixes a crash on page 3 of 0000450.pdf of 0000.zip, where we previously
started interpreting the middle of an inline image content stream as
operators, since it contained `EI` in its pixel data.
2023-12-11 10:50:39 +01:00
Nico Weber
27aae7e2b1 LibPDF: Parse inline image key-value pairs
Not used for anything yet.
2023-12-11 10:50:39 +01:00
Nico Weber
0912896ae0 LibPDF: Extract Parser::parse_dict_contents_until()
No behavior change.
2023-12-11 10:50:39 +01:00
Bastiaan van der Plaat
3b3558865c LibWeb: Improve select element CSS stylebility 2023-12-10 20:56:19 +01:00
Bastiaan van der Plaat
d025d207d9 LibWeb: Hide input placeholder when input already has a value 2023-12-10 20:56:19 +01:00
Aliaksandr Kalenik
df57d7ca68 LibGfx+LibWeb: Update for_each_glyph_position to use font cascade list
This change updates function that builds list of glyphs to use font
cascade list to find font for each code point.
2023-12-10 17:32:04 +01:00
Aliaksandr Kalenik
2cb0039a13 LibGfx+LibWeb: Produce font cascade list in CSS font matching algorithm
According to the CSS font matching algorithm specification, it is
supposed to be executed for each glyph instead of each text run, as is
currently done. This change partially implements this by having the
font matching algorithm produce a list of fonts against which each
glyph will be tested to find its suitable font.

Now, it becomes possible to have per-glyph fallback fonts: if the
needed glyph is not present in a font, we can check the subsequent
fonts in the list.
2023-12-10 17:32:04 +01:00
Aliaksandr Kalenik
f50bf00814 LibWeb+LibGfx: Move UnicodeRange from LibWeb to LibGfx
In upcoming changes UnicodeRange is going to be used in LibGfx in
a class that represents font cascade list.
2023-12-10 17:32:04 +01:00
Aliaksandr Kalenik
0d03257e69 LibGfx+LibAccelGfx+LibWeb: Use RefPtr for font in DrawGlyphOrEmoji 2023-12-10 17:32:04 +01:00
Timothy Flynn
451df70275 Ladybird+LibWebView: Ensure existing Inspector widgets inspect the page
If the Inspector widget already exists, be sure to inspect the page when
it is re-opened. However, this should be a no-op if the page was already
inspected (as any existing Inspector will be reset if a new page load
began).

Note this is not an issue in the AppKit chrome.
2023-12-10 16:45:08 +01:00
Timothy Flynn
41ffc69c9d LibWebView: Clear the Inspector DOM/accessibility trees upon reset
This prevents rendering stale trees while navigating to a new page. The
old non-WebView inspector widgets behaved this way.
2023-12-10 16:45:08 +01:00
Kyle Pereira
60c7ff9db1 Tests: Add a test for LibPDF pattern rendering
This is based largely on Adobe's EXAMPLE 2 on p176 of the specification,
manually edited slightly and then cleaned up with mutool.

https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/PDF32000_2008.pdf
2023-12-10 16:44:24 +01:00
Kyle Pereira
8c7fc4fe6c LibPDF: Offset PaintStyle when painting so pattern overlaps properly 2023-12-10 16:44:24 +01:00
Kyle Pereira
8ff87911a3 LibPDF: Add basic tiled, coloured pattern rendering 2023-12-10 16:44:24 +01:00
Kyle Pereira
8191f2b47a LibPDF: Add parameter for background color of render 2023-12-10 16:44:24 +01:00
Kyle Pereira
60c4803dd3 LibPDF: Pass Renderer to ColorSpace 2023-12-10 16:44:24 +01:00
Kyle Pereira
649f1df771 LibGfx: Add RepeatingBitmapPaintStyle and OffsetPaintStyle
RepeatingBitmapPaintStyle tiles a bitmap passed on passed in parameters
and paints according to that.

OffsetPaintStyle offsets an existing paint style and paints with that.

These two will be useful in the PDF renderer.
2023-12-10 16:44:24 +01:00
Kyle Pereira
082a4197b6 LibPDF: Use Variant<Color, PaintStyle> instead of Color for ColorSpaces
This is in anticipation of Pattern color space support which does not
yield a simple color.
2023-12-10 16:44:24 +01:00
Kyle Pereira
e4b8d68039 LibPDF: Permit comments at the end of a stream 2023-12-10 16:44:24 +01:00
Bastiaan van der Plaat
f621dc464b LibWeb: Add internal use_pseudo_element to DOM Element 2023-12-10 16:44:12 +01:00