Commit graph

41872 commits

Author SHA1 Message Date
Andreas Kling
8a3ca6416d LibWeb: Make labels be display: inline-block in the default UA style
This is weird, but matches the behavior we've had so far. Leaving a
FIXME about how this doesn't seem right.
2022-10-06 15:29:38 +02:00
Andreas Kling
34a2797211 LibWeb: Remove ad-hoc <hr> element rule from default UA style
This element is already covered by spec rules. :^)
2022-10-06 15:29:38 +02:00
Andreas Kling
0cd82d2da7 LibWeb: Add a little header to the top of the default UA stylesheet
Since all the spec sections are annotated with comments already, let's
also have a comment mentioning that the file starts with ad-hoc rules.
2022-10-06 15:29:38 +02:00
Andreas Kling
5989a3ee77 LibWeb: Honor CSS display value in is_inline() and is_inline_block()
These were totally ad-hoc before, is_inline() was based on a boolean
flag on Layout::Node that we set in various situations.

Meanwhile, is_inline_block() was a combination on is_inline() plus a
type check to see if the layout node inherited from BlockContainer.

This patch replaces the above mess with simple lookups of the CSS
display value. Note that layout nodes without their own style (i.e text
nodes) are automatically assumed to be inline and non-blocks. This has
to be special-cased since layout nodes without style will consult the
style of their parent, so without short-circuiting this would break.
2022-10-06 15:29:38 +02:00
Andreas Kling
fe03149a47 LibWeb: Base Layout::TreeBuilder decisions on CSS display property
This is one of many small steps towards being able to remove the ad-hoc
Layout::Node::is_inline() in favor of honoring the CSS display value
everywhere instead.
2022-10-06 15:29:38 +02:00
Andreas Kling
1ab7a8e0db LibWeb: Simplify construction of :before and :after pseudo elements
Let create_pseudo_element_if_needed() take care of inserting the pseudo
elements into the layout tree as well.
2022-10-06 15:29:38 +02:00
Andreas Kling
da781e90c1 AK: Print VERIFY() error messages in release builds
Until now, VERIFY() failures would just cause a __builtin_trap() in
release builds, which made them a bit too harsh. This commit adds an
out-of-line helper function that prints the error before trapping.
2022-10-06 15:29:38 +02:00
Andreas Kling
4fdfaff4ca LibWeb: Split out helper functions in TreeBuilder::create_layout_tree()
Let's make this function a little easier to understand by splitting out
helpers into separate functions.
2022-10-06 15:29:38 +02:00
Andreas Kling
1e26d3d02d LibWeb: Make the initial containing block style have display:block
We always create a Layout::InitialContainingBlock for the ICB, but in a
future where we always honor the CSS::Display everywhere, we need to
make sure everyone has the right display values.
2022-10-06 15:29:38 +02:00
Xexxa
6bbd6b1453 Base: Adjust size of emoji flags
🇬🇫 - U+1F1EC U+1F1EB FLAG: FRENCH GUIANA
🇬🇬 - U+1F1EC U+1F1EC FLAG: GUERNSEY
🇬🇭 - U+1F1EC U+1F1ED FLAG: GHANA
🇮🇳 - U+1F1EE U+1F1F3 FLAG: INDIA
🇮🇸 - U+1F1EE U+1F1F8 FLAG: ICELAND
🇯🇪 - U+1F1EF U+1F1EA FLAG: JERSEY
🇯🇵 - U+1F1EF U+1F1F5 FLAG: JAPAN
🇰🇬 - U+1F1F0 U+1F1EC FLAG: KYRGYZSTAN
🇰🇳 - U+1F1F0 U+1F1F3 FLAG: ST. KITTS & NEVIS
🇰🇵 - U+1F1F0 U+1F1F5 FLAG: NORTH KOREA
🇲🇦 - U+1F1F2 U+1F1E6 FLAG: MOROCCO
🇲🇪 - U+1F1F2 U+1F1EA FLAG: MONTENEGRO
🇲🇰 - U+1F1F2 U+1F1F0 FLAG: NORTH MACEDONIA
🇲🇱 - U+1F1F2 U+1F1F1 FLAG: MALI
🇲🇻 - U+1F1F2 U+1F1FB FLAG: MALDIVES
🇳🇫 - U+1F1F3 U+1F1EB FLAG: NORFOLK ISLAND
🇳🇬 - U+1F1F3 U+1F1EC FLAG: NIGERIA
🇵🇷 - U+1F1F5 U+1F1F7 FLAG: PUERTO RICO
🇵🇼 - U+1F1F5 U+1F1FC FLAG: PALAU
🇶🇦 - U+1F1F6 U+1F1E6 FLAG: QATAR
🇷🇴 - U+1F1F7 U+1F1F4 FLAG: ROMANIA
🇷🇺 - U+1F1F7 U+1F1FA FLAG: RUSSIA
🇷🇼 - U+1F1F7 U+1F1FC FLAG: RWANDA
🇸🇨 - U+1F1F8 U+1F1E8 FLAG: SEYCHELLES
🇸🇬 - U+1F1F8 U+1F1EC FLAG: SINGAPORE
🇸🇲 - U+1F1F8 U+1F1F2 FLAG: SAN MARINO
🇹🇬 - U+1F1F9 U+1F1EC FLAG: TOGO
🇹🇭 - U+1F1F9 U+1F1ED FLAG: THAILAND
🇹🇯 - U+1F1F9 U+1F1EF FLAG: TAJIKISTAN
🏴󠁧󠁢󠁥󠁮󠁧󠁿 - U+1F3F4 U+E0067 U+E0062 U+E0065 U+E006E U+E0067 U+E007F
FLAG: ENGLAND
🏴󠁧󠁢󠁳󠁣󠁴󠁿 - U+1F3F4 U+E0067 U+E0062 U+E0073 U+E0063 U+E0074 U+E007F
FLAG: SCOTLAND
🏴󠁧󠁢󠁷󠁬󠁳󠁿 - U+1F3F4 U+E0067 U+E0062 U+E0077 U+E006C U+E0073 U+E007F
FLAG: WALES
2022-10-06 14:17:12 +01:00
Xexxa
75a81f0603 Base: Adjust emoji
🥒 - U+1F952 CUCUMBER
📞 - U+1F4DE TELEPHONE RECEIVER
2022-10-06 14:17:12 +01:00
kleines Filmröllchen
fbe6ea7897 Meta: Add my GitHub sponsor profile to the repository list 2022-10-06 14:59:04 +02:00
matcool
c8d7b0a33a Tests: Add tests for LibUnicode's normalize 2022-10-06 08:24:39 -04:00
matcool
70d0c1616f LibUnicode: Add decomposition mappings and Unicode normalization
The mappings are exposed via `Unicode::code_point_decomposition(u32)`
and `Unicode::code_point_decompositions()`, the latter being useful for
reverse searching a code point from its decomposition.

The normalization code does not make use of `Quick_Check` props (https://www.unicode.org/reports/tr44/#Decompositions_and_Normalization),
meaning no quick check optimizations.
2022-10-06 08:24:39 -04:00
Timothy Flynn
e8410bc2ee Meta: Hide WebView behind ENABLE_LAGOM_LIBWEB CMake option
If ENABLE_LAGOM_LIBWEB is OFF, this will fail to build.
2022-10-06 14:12:54 +02:00
Sergiy Stupar
8a37badc42 PixelPaint: Add actions to crop layer to selection/content 2022-10-06 12:29:16 +01:00
luiz
d77ced8943 LibGfx: Make should_wrap flag default as true on convolution filters
Currently the default is false, but this is not the best strategy
for most filters producing artifacts on the borders, and wrap-around
option ends up being better, producing less artifacts.
2022-10-06 12:20:53 +01:00
FrHun
02b9461714 LibGUI: Consider spacing for Toolbar overflow calculation 2022-10-06 12:17:38 +01:00
FrHun
b868337d5e LibGUI: Include overflow button in overflow calculation only when shown
This prevents items from being put in the overflow menu, even though
there is still enough space for all items to be shown, because the
overflow button does not take up space when it is not needed.
2022-10-06 12:17:38 +01:00
FrHun
6330de15b6 Base: Update Toolbar manpage 2022-10-06 12:17:38 +01:00
FrHun
29a3ff22d7 LibGUI: Make Breadcrumbbar resizable below current size
By making proper use of the dynamic layout system, the Breadcrumbbar can
now shrink below its current (grown) size again, while still ensuring
that no icon gets cut off.
2022-10-06 12:17:38 +01:00
FrHun
6e2fc0285e FileManager: Group Toolbar overflow 2022-10-06 12:17:38 +01:00
FrHun
eefe6e35ac LibGUI: Add option to move Toolbar items to overflow menu in groups
When items are sent to the overflow menu one by one, it can happen that
buttons that are heavily related, and don't make sense without one
another (either visually or logically) are separated.
This new option enables the developer to choose the "grouping"
behavior, of sending all items that are not separated to the overflow
menu together, as soon as one of them doesn't have enough space to be
displayed. (provided the toolbar is set as collapsible)
2022-10-06 12:17:38 +01:00
Marco Cutecchia
41744a4a87 HackStudio: Prevent closing the last editor group
Previously if the user closed the last open tab in the last TabWidget
then the open file action would stop working until they explicitly
went to the View menu and added a new editor group.

Before this commit there was an attempt at preventing the user to
close the last open tab by hiding its close button, this didn't
account for the many other ways one could close it though.
2022-10-06 11:53:23 +01:00
Marco Cutecchia
f81b494182 HackStudio: Remove the 'Open in a new tab' action
This has become the default with the previous changes so it
doesn't make sense anymore
2022-10-06 11:53:23 +01:00
Marco Cutecchia
d8b54b7dd0 HackStudio: Open files in dedicated tabs
Previously when trying to open a file from the tree view the file
would open in the currently selected tab, substituting the file
we were previously reading.
This change makes it so that clicking on a file from the tree view
opens it in a new tab, or selects the tab containing that file if
it's already open in the selected editor group.
2022-10-06 11:53:23 +01:00
Andreas Kling
2ac385f4db CMake: Don't mess with absolute compile_ipc() source paths
If given an absolute path, compile_ipc() should just use it verbatim
instead of trying to be helpful.
2022-10-06 11:23:53 +02:00
Andreas Kling
b5681992e1 LibIPC: Allow overriding the use of deferred_invoke()
This will allow Ladybird to use IPC::Connection without having an
actively running Core::EventLoop.

The abstraction here is not great, and we should think of something
nicer, but we have to start somewhere.
2022-10-06 09:51:04 +02:00
Andreas Kling
f877782117 WebContent: Use Web::Platform::Timer instead of Core::Timer
This will allow WebContent to operate without a Core::EventLoop.
2022-10-06 09:51:04 +02:00
Andreas Kling
e75645bbf8 WebContent: Add ConnectionFromClient::fd() accessor 2022-10-06 09:51:04 +02:00
Andreas Kling
eb709ddd63 LibCore: Add fd() and notifier() accessors to Core::Stream::LocalSocket 2022-10-06 09:51:04 +02:00
Andreas Kling
35966cabe4 LibIPC: Remove platform-specific #ifdefs around FD passing in Connection
Let the LocalSocket class decide if FD passing is supported or not.
2022-10-06 09:51:04 +02:00
Andreas Kling
4d762fd3a6 Lagom: Add Build WebContentClient as part of Lagom's LibWebView
This will allow us to use it in Ladybird. :^)
2022-10-06 09:51:04 +02:00
Andreas Kling
ceccc2c163 LibWebView: Add abstract virtual base for WebView implementations
This patch adds WebView::ViewImplementation with all the
`notify_server_did_this_or_that()` functions from OOPWV.

This will allow us to share code between different web views, paving the
way for a Qt widget in Ladybird that can talk to a WebContent process.
2022-10-06 09:51:04 +02:00
Andreas Kling
d652794862 LibCore: Implement LocalSocket send_fd() and receive_fd() on Linux
We use a combination of SCM_RIGHTS and fcntl(FD_CLOEXEC) to implement
the equivalent functionality from SerenityOS.
2022-10-06 09:51:04 +02:00
Andreas Kling
ece1b7422f LibIPC: Allow giving Connection a separate socket for FD passing
Our IPC protocol currently relies on the behavior of recvfd() and
sendfd() on SerenityOS, which provide an out-of-band queue that can be
accessed independently of the in-band data stream.

To make LibIPC usable on other platforms, this patch adds a mechanism
where IPC::Connection can be given a dedicated socket for FD passing.
This gives us the same behavior as the syscalls on SerenityOS, without
having to change the protocol implementation.
2022-10-06 09:51:04 +02:00
Xexxa
3bb25ef227 Base: Adjust sizing of more emoji flags
🇦🇲 - U+1F1E6 U+1F1F2 FLAG: ARMENIA
🇦🇶 - U+1F1E6 U+1F1F6 FLAG: ANTARCTICA
🇦🇹 - U+1F1E6 U+1F1F9 FLAG: AUSTRIA
🇦🇺 - U+1F1E6 U+1F1FA FLAG: AUSTRALIA
🇦🇿 - U+1F1E6 U+1F1FF FLAG: AZERBAIJAN
🇧🇦 - U+1F1E7 U+1F1E6 FLAG: BOSNIA & HERZEGOVINA
🇧🇧 - U+1F1E7 U+1F1E7 FLAG: BARBADOS
🇧🇩 - U+1F1E7 U+1F1E9 FLAG: BANGLADESH
🇧🇬 - U+1F1E7 U+1F1EC FLAG: BULGARIA
🇧🇭 - U+1F1E7 U+1F1ED FLAG: BAHRAIN
🇧🇯 - U+1F1E7 U+1F1EF FLAG: BENIN
🇧🇴 - U+1F1E7 U+1F1F4 FLAG: BOLIVIA
🇧🇷 - U+1F1E7 U+1F1F7 FLAG: BRAZIL
🇧🇸 - U+1F1E7 U+1F1F8 FLAG: BAHAMAS
🇧🇹 - U+1F1E7 U+1F1F9 FLAG: BHUTAN
🇨🇫 - U+1F1E8 U+1F1EB FLAG: CENTRAL AFRICAN REPUBLIC
🇨🇲 - U+1F1E8 U+1F1F2 FLAG: CAMEROON
2022-10-05 16:09:31 -04:00
Linus Groh
1c12f5c31d LibWeb: Make Fetch::Infrastructure::{Request,Response} ref-counted
With the addition of the 'fetch params' struct, the single ownership
model we had so far falls apart completely.

Additionally, this works nicely for FilteredResponse's internal response
instead of risking a dangling reference.

Replacing the public constructor with a create() function also found a
few instances of a Request being stack-allocated!
2022-10-05 09:14:49 +01:00
Linus Groh
886ca9c7b6 LibWeb: Add missing Request::policy_container() getter and setter 2022-10-05 09:14:49 +01:00
Linus Groh
16d6c62193 LibWeb: Make Fetch::Infrastructure::Request::set_client() take a pointer 2022-10-05 09:14:49 +01:00
Linus Groh
72a752685f LibWeb: Add missing link to Fetch::Infrastructure::Response member 2022-10-05 09:14:49 +01:00
Linus Groh
7b50e96434 LibWeb: Add missing links to Fetch::Infrastructure::Request members 2022-10-05 09:14:49 +01:00
Linus Groh
32ad939e44 LibWeb: Rename HighResolutionTime/{CoarsenTime => TimeOrigin}.cpp/h
This is being used for more than just time coarsening now, so let's use
the spec's section title for the name.
2022-10-05 09:12:59 +01:00
Linus Groh
4ea6cc56be LibWeb: Move unsafe_shared_current_time() to HighResolutionTime
This doesn't belong on the EventLoop at all, as far as I can tell.
2022-10-05 09:12:59 +01:00
Linus Groh
ff9a80f54f LibWeb: Implement 'coarsened shared current time' 2022-10-05 09:12:59 +01:00
Linus Groh
5c4eb90d65 LibWeb: Add DOMHighResTimeStamp typedef 2022-10-05 09:12:59 +01:00
Linus Groh
398e44b27b LibWeb: Pass status code to ResourceLoader error callback when available 2022-10-05 09:12:59 +01:00
Linus Groh
25909dcc05 LibWeb: Prepare to run callback in host_enqueue_promise_job()
...and clean up afterwards, of course. Additionally to preparing to run
a script, we also prepare to run a callback here. This matches WebIDL's
invoke_callback() / call_user_object_operation() functions, and prevents
a crash in host_make_job_callback() when getting the incumbent settings
object.

Running the following JS no longer crashes after this change:

```js
new Promise((resolve) => {
    setTimeout(resolve, 0);
}).then(() => {
    return Promise.reject();
});
```

See further discussion/investigation here:
https://discord.com/channels/830522505605283862/830525031720943627/995019647214694511
https://discord.com/channels/830522505605283862/830525031720943627/1026824624358576158
https://discord.com/channels/830522505605283862/830525031720943627/1026922985581457458

Many thanks to Luke for doing the hard work here, tracking this down,
and suggesting the fix!

Co-authored-by: Luke Wilde <lukew@serenityos.org>
2022-10-05 09:12:59 +01:00
Nico Weber
2af028132a AK+Everywhere: Add AK_COMPILER_{GCC,CLANG} and use them most places
Doesn't use them in libc headers so that those don't have to pull in
AK/Platform.h.

AK_COMPILER_GCC is set _only_ for gcc, not for clang too. (__GNUC__ is
defined in clang builds as well.) Using AK_COMPILER_GCC simplifies
things some.

AK_COMPILER_CLANG isn't as much of a win, other than that it's
consistent with AK_COMPILER_GCC.
2022-10-04 23:35:07 +01:00
Nico Weber
ff4b912b7c LibGfx: Remove a workaround for clang before 11
This bug has long been fixed.
2022-10-04 23:35:07 +01:00