Commit graph

34549 commits

Author SHA1 Message Date
Andreas Kling
1347c5032b LibWeb: Add spec comments to the StackOfOpenElements class 2022-02-15 02:05:53 +01:00
Andreas Kling
5cdbea4ae0 LibWeb: Rename element_before() => element_immediately_above()
This matches the spec terminology around the "stack of open elements".
2022-02-15 02:05:53 +01:00
Andreas Kling
6fe333607d LibWeb: Add spec comments to find_appropriate_place_for_inserting_node() 2022-02-15 02:05:53 +01:00
davidot
da374a82bc LibJS: Correct an include in PrimitiveString 2022-02-15 00:51:25 +00:00
davidot
c114be95f5 LibJS: Use CopyDataProperties when spreading in object expressions
Before this was a mix of different strategies but copy_data_properties
does all of that in a spec way.
This fixes numeric properties in object spreading. And ensures that any
new properties added during spreading are not taken into account.
2022-02-15 00:51:25 +00:00
davidot
eac3c4c127 LibJS: Use entire array of SimpleIndexedPropertyStorage before growing
A common use case in JS is pushing items in an array in a loop.
A simple test case of 100_000 pushes took around ~20 seconds.
This is due to the fact that any pushed element per definition is beyond
the current size of the array. This meant calling grow_storage_if_needed
which then grew the storage by 25%. But this was done on every single
push, growing the array just a little bigger than its current capacity.

Now we now first use capacity of the array and only grow if the array
is actually full.
This decreases the time for 100_000 to around 0.35 seconds.
One problem is that we never shrink the capacity of the array but this
was already an issue before this.
2022-02-15 00:51:25 +00:00
Linus Groh
24d5ca4a9d LibWeb: Remove non-standard ReturnNullIfCrossOrigin IDL attribute
This is no longer needed as BrowsingContextContainer::content_document()
now does the right thing, and HTMLIFrameElement.contentDocument is the
only user of this attribute. Let's not invent our own mechanisms for
things that are important to get right, like same origin comparisons.
2022-02-15 01:31:03 +01:00
Linus Groh
75dd4fbd16 LibWeb: Implement BCC's "content document" concept according to spec 2022-02-15 01:31:03 +01:00
Linus Groh
5e8bfb5efc LibWeb: Implement Origin's "same origin-domain" concept
Check of domains is left as a FIXME as our Origin class doesn't support
those yet.
2022-02-15 01:31:03 +01:00
Linus Groh
6d0e6e3811 LibWeb: Rename Origin::is_same() to Origin::is_same_origin()
The HTML Origin spec has two similar but slightly different concepts of
origin equality: "same origin" and "same origin-domain". Let's be
explicit with the naming here :^)
Also add spec comments.
2022-02-15 01:31:03 +01:00
Linus Groh
f2ee62e268 LibWeb: Rename Origin::is_null() to Origin::is_opaque()
This is what the HTML Origin spec calls it.
2022-02-15 01:31:03 +01:00
u9g
7590c0fff8 Spreadsheet: Make ranges vertically end-inclusive
With the spreadsheet:
```
A0:1
B0:2
A1:2
B1:3
```
Before: sum(range("A0","B1")) === 3
After: sum(range("A0","B1")) === 8
2022-02-15 03:03:21 +03:30
Linus Groh
8eb936538f LibJS: Add missing include for 'u32' to CanonicalIndex.h 2022-02-14 23:02:56 +00:00
Lenny Maiorani
160bda7228 Applications: Use default constructors/destructors
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules

"The compiler is more likely to get the default semantics right and
you cannot implement these functions better than the compiler."
2022-02-14 22:06:55 +00:00
Idan Horowitz
6be75bd5e4 Meta: Use clang-13 instead of clang-12 in Azure CI
This should hopefully resolve a clang ICE seen in PR #12523.
2022-02-14 23:55:23 +02:00
Anonymous
745b998774 LibJS: Get rid of unnecessary work from canonical_numeric_index_string
The spec version of canonical_numeric_index_string is absurdly complex,
and ends up converting from a string to a number, and then back again
which is both slow and also requires a few allocations and a string
compare.

Instead this patch moves away from using Values to represent canonical
a canonical index. In most cases all we need to know is whether a
PropertyKey is an integer between 0 and 2^^32-2, which we already
compute when we construct a PropertyKey so the existing is_number()
check is sufficient.

The more expensive case is handling strings containing numbers that
don't roundtrip through string conversion. In most cases these turn
into regular string properties, but for TypedArray access these
property names are not treated as normal named properties.
TypedArrays treat these numeric properties as magic indexes that are
ignored on read and are not stored (but are evaluated) on assignment.

For that reason there's now a mode flag on canonical_numeric_index_string
so that only TypedArrays take the cost of the ToString round trip test.
In order to improve the performance of this path this patch includes
some early returns to avoid conversion in cases where we can quickly
know whether a property can round trip.
2022-02-14 21:06:49 +00:00
Steven Schmoll
7c4d42279d LibWeb: Add stacking contexts to Node::for_each_child_in_paint_order
The existing implementation, which is used by Node::hit_test() and
sub-classes, does not include stacking contexts which prevents hit
testing from returning elements contained by those stacking contexts
in some situations.

This is quite rough and definitely not optimal. The stacking contexts
are not retrieved in the correct order. They should be sorted by
z-index then tree order.

This change makes DuckDuckGo technically usable with all the absolute
and relative positioning they use.
2022-02-14 21:33:05 +01:00
Andreas Kling
f7f7aa6986 LibGfx/PNG: Respect the tRNS chunk transparency with color type 2
For PNG color type 2 (TrueColor), if there's a tRNS chunk, it specifies
an R/G/B triplet in the image bit depth. This triplet acts as the
transparency value, and should yield transparent pixels wherever that
specific color value is present.

We now support this. :^)
2022-02-14 18:39:20 +01:00
Andreas Kling
5c7f11f1cd LibGfx/PNG: Collect tRNS (transparency chunk) info for all color types
The tRNS metadata is valid for color types 0, 2 and 3, so let's collect
it in each of those cases.

This ensures that we produce a bitmap with an alpha channel if needed.
2022-02-14 18:39:20 +01:00
Andreas Kling
aa679643c1 LibGfx: Remove unnecessary includes from PNGLoader.cpp 2022-02-14 18:39:20 +01:00
Andreas Kling
81216c51d1 LibGfx: Make Bitmap::has_alpha_channel() return true for RGBA8888 2022-02-14 18:39:20 +01:00
Andreas Kling
f4625ed9de LibWeb: Paint inline-level and replaced elements on top of floats
This matches CSS 2.1 appendix E, and fixes an instance of red face
border on ACID2. :^)
2022-02-14 18:39:20 +01:00
Andreas Kling
f2a917229a LibWeb: Support inline-level padding and border properly
Here's roughly how this works:

- InlineLevelIterator keeps a nesting stack of inline-level nodes with
  box model metrics.
- When entering a node with box model metrics, we add them to the
  current "leading metrics".
- When exiting a node with box model metrics, we add them to the
  current "trailing metrics".
- Pending leading metrics are consumed by the first fragment added
  to the line.
- Pending trailing metrics are consumed by the last fragment added
  to the line.

Like before, the position of a line box fragment is the top left of its
content box. However, fragments are placed horizontally along the line
with space inserted for padding and border.

InlineNode::paint() now expands the content rect as appropriate when
painting background and borders.

Note that margins and margin collapsing is not yet implemented.

This makes the eyes on ACID2 horizontally centered. :^)
2022-02-14 18:00:21 +01:00
Andreas Kling
7d2a49eeb8 LibWeb: Always assign box model metrics in IFC::dimension_box_on_line()
Replaced elements have box model metrics, too. We shouldn't only assign
them to inline-block elements.
2022-02-14 18:00:21 +01:00
Timothy Flynn
b52e592eac LibUnicode: Port the CLDR time format generator to the stream API 2022-02-14 11:39:46 -05:00
Timothy Flynn
ca3bcf201f LibUnicode: Port the CLDR date format generator to the stream API 2022-02-14 11:39:46 -05:00
Timothy Flynn
f39540876b LibUnicode: Port the CLDR number format generator to the stream API 2022-02-14 11:39:46 -05:00
Timothy Flynn
a338e9403b LibUnicode: Port the CLDR locale generator to the stream API
This adds a generator utility to read an entire file and parse it as a
JSON value. This is heavily used by the CLDR generators. The idea here
is to put the file reading details in the utility so that when we have a
good story for generically reading an entire stream in LibCore, we can
update the generators to use that by only touching this helper.
2022-02-14 11:39:46 -05:00
Timothy Flynn
a64a7940e4 LibUnicode: Port the UCD generator to the stream API 2022-02-14 11:39:46 -05:00
Timothy Flynn
9327c2233f LibTimeZone: Port the TZDB generator to the stream API
This also moves the open_file helper to the utility file. It's currently
a lambda redefined in each TZDB/Unicode generator. It used to display
the missing command line flag and other info local to each generator.
After switching to LibMain, it just returns a generic error message, and
is duplicated several times.
2022-02-14 11:39:46 -05:00
Lady Gegga
6616e90cf6 Base: Add new bitmap font Comic Book 2022-02-14 15:34:53 +01:00
Liav A
6c0467f56b SystemServer: Remove now unnecessary call to chmod on /dev/audio
Don't use chmod now that DevTmpFS honors permission mode when creating
new directories.
2022-02-14 08:45:32 -05:00
Liav A
e23dda81de Kernel: Honor permission mode when creating new directories in DevTmpFS 2022-02-14 08:45:32 -05:00
James Puleo
f7f14d52e0 pape: Improve error handling during option handling and bitmap loading
Improper options now return with an error, and bitmap loading is now
`TRY` instead of `MUST`
2022-02-14 16:38:42 +03:30
James Puleo
e4c182d855 WindowServer: Remove extraneous whitespace in WindowServer.ipc 2022-02-14 16:38:42 +03:30
James Puleo
a0e7a4b9a8 WindowServer+Userland: Pass wallpapers as Gfx::Bitmap instead of path
The WindowServer _really_ does not need to know the filesystem path to
it's wallpaper, and allows setting arbitrary wallpapers (those outside
of `/res/wallpapers`).

The GUI::Desktop will keep track of the path to the wallpaper (if any),
and save it to config if desired (to be persisted).

This avoids the need to `unveil` paths to the wallpaper, fixing #11158
2022-02-14 16:38:42 +03:30
Harrison Marshall
f538545987 HackStudio: Fix crash when requesting parameter list
When requesting a parameter hint message with `Ctrl + p` in a file that
doesn't have a language server, we would crash.

Now, rather than verifying that we have a language server, we return
early if we don't have one.
2022-02-14 13:48:05 +01:00
Steven Schmoll
d345a3689f LibGfx: Support color blending in Painter::draw_bitmap
This method is commonly used by bitmap text rendering. Adding support
for color blending enables support in the browser for text opacity using
their color property.
2022-02-14 12:49:19 +01:00
brapru
75a3be852d ping: Count argument must be greater than zero
Previously, when passing 0 as a count number to the ping utility it
would ping the specified host indefinitely. This is obviously not the
intended behavior, so forcing the count to be in the range of 1 <= value
<= UINT32_MAX resolves the issue.
2022-02-14 12:48:43 +01:00
brapru
ef3605604e ping: Fix off by one error in count argument
Previously, the count and total_pings comparison was evaluated after a
ping was sent for that iteration. This would cause one extra ping to be
sent greater than the specific count passed.
2022-02-14 12:48:43 +01:00
czapek1337
6cdb41ccab Documentation: Add information about the limine-image target 2022-02-14 11:52:07 +01:00
czapek1337
7b919c9d93 Meta: Bump Limine version to 2.78.2 2022-02-14 11:52:07 +01:00
czapek1337
77f25e44ed Meta: Include the EFI executable in Limine image 2022-02-14 11:52:07 +01:00
czapek1337
64ff8af074 Meta: Add support for the Limine bootloader 2022-02-14 11:52:07 +01:00
Mustafa Quraish
c3e4123ed7 PixelPaint: Change menu shortcut for "Fit Image to View"
This makes it consistent with `ImageViewer`, where `F` was unavailable
for use as a shortcut. A small change, but it's nice having the same
keyboard shortcuts where we can :^)
2022-02-14 11:49:21 +01:00
Mustafa Quraish
4556b8e943 ImageViewer: Add "Fit Image to View" action
This is analogous to PixelPaint, it resizes the image so that it fits
in the view (with some padding).
2022-02-14 11:49:21 +01:00
Mustafa Quraish
481ed1ca16 ImageViewer: Fix window resizing on first image
The logic in place for this no longer worked since we abstracted away
the logic for zooming / panning (which changed how scale is stored).
This commit fixes the behaviour so when the first image is opened, the
window resizes to fit it.
2022-02-14 11:49:21 +01:00
Mustafa Quraish
5c763e9832 LibGUI+PixelPaint: Move fit_image_to_view to AbstractZoomPanWidget
We often want to zoom and fit the content of the widget into the
visible frame (or some rect within the frame), and it makes sense to
move this functionality into the AbstractZoomPanWidget to minimize
the amount of coordinate math derived classes need to do.

This commit moves the code that implements this functionality from
`PixelPaint::ImageEditor` into `AbstractZoomPanWidget` so that we
can also use it for other applications (such as ImageViewer!)
2022-02-14 11:49:21 +01:00
Pankaj Raghav
12daecf72d Utilities: Fix du to print stats for regular files
du <filename> will not print anything until `-a` option was provided.

Fix the behaviour by taking into account the `-a` option only when a
directory is given as the input.
2022-02-14 11:47:52 +01:00
brapru
b04528c0de nc: Extend TCP listening port functionality
Previously the nc implementation during listening mode would only accept
a single client and close the listening file description immediately.
Additionally, it did not have support for read/write handling of the
accepted client.

This patch extends the functionality of nc's listening capability by
allowing multiple client connections over TCP. Clients/server are able
to pass data back and forth between the connection.

Being able to listen on sockets and accept connections is helpful for
debugging the networking stack.
2022-02-14 11:47:14 +01:00