Commit Graph

41501 Commits

Author SHA1 Message Date
Luke Wilde
2133b7d58a LibWeb: Implement :enabled and :disabled pseudo classes to spec
Previously we only considered an element disabled if it was an <input>
element with the disabled attribute, but there's way more elements that
apply with more nuanced disabled/enabled rules.
2022-09-30 18:05:48 +02:00
Luke Wilde
c85fcd442f LibWeb: Check all <fieldset> ancestors in FormAssociatedElement::enabled
A form associated element is disabled if _any_ <fieldset> ancestor in
the ancestor chain has the disabled attribute, not just the first one.
2022-09-30 18:05:48 +02:00
Andreas Kling
30815c25a2 LibCore+LibGUI: Make it fast to check if a Core::Object is a Widget
This check happens very often in LibGUI code. 25% of time spent
layouting the emoji input dialog was wasted on RTTI. Adding a simple
fast_is<Widget>() melts almost all of that away.
2022-09-30 18:00:55 +02:00
Luke Wilde
1cff5fe2ff Base: Add ~200 more ads and trackers to the default content filter list 2022-09-30 15:51:39 +01:00
Luke Wilde
55d1e84e0b Base: Change 6sc.io in default content filter to 6sc.co
This was simply a typo, it's `co` instead of `io`.
2022-09-30 15:51:39 +01:00
Xexxa
757eeaa367 Base: Adjust emoji sizes for some flags
🇦🇪 - U+1F1E6 U+1F1EA FLAG: UNITED ARAB EMIRATES
🇦🇬 - U+1F1E6 U+1F1EC FLAG: ANTIGUA & BARBUDA
🇨🇦 - U+1F1E8 U+1F1E6 FLAG: CANADA
🇨🇺 - U+1F1E8 U+1F1FA FLAG: CUBA
🇬🇧 - U+1F1EC U+1F1E7 FLAG: UNITED KINGDOM
🇬🇱 - U+1F1EC U+1F1F1 FLAG: GREENLAND
🇳🇴 - U+1F1F3 U+1F1F4 FLAG: NORWAY
2022-09-30 11:50:46 +01:00
Xexxa
5676213f47 Base: Add more emoji
🇭🇳 - U+1F1ED U+1F1F3 FLAG: HONDURAS
🇭🇷 - U+1F1ED U+1F1F7 FLAG: CROATIA
🇭🇹 - U+1F1ED U+1F1F9 FLAG: HAITI
🇰🇪 - U+1F1F0 U+1F1EA FLAG: KENYA
🇰🇲 - U+1F1F0 U+1F1F2 FLAG: COMOROS
🇱🇰 - U+1F1F1 U+1F1F0 FLAG: SRI LANKA
🇲🇩 - U+1F1F2 U+1F1E9 FLAG: MOLDOVA
🇲🇳 - U+1F1F2 U+1F1F3 FLAG: MONGOLIA
🇲🇾 - U+1F1F2 U+1F1FE FLAG: MALAYSIA
🇳🇨 - U+1F1F3 U+1F1E8 FLAG: NEW CALEDONIA
🇵🇬 - U+1F1F5 U+1F1EC FLAG: PAPUA NEW GUINEA
🇵🇲 - U+1F1F5 U+1F1F2 FLAG: ST. PIERRE & MIQUELON
🇵🇾 - U+1F1F5 U+1F1FE FLAG: PARAGUAY
🇷🇸 - U+1F1F7 U+1F1F8 FLAG: SERBIA
🇸🇧 - U+1F1F8 U+1F1E7 FLAG: SOLOMON ISLANDS
🇸🇽 - U+1F1F8 U+1F1FD FLAG: SINT MAARTEN
🇸🇿 - U+1F1F8 U+1F1FF FLAG: ESWATINI
🇹🇫 - U+1F1F9 U+1F1EB FLAG: FRENCH SOUTHERN TERRITORIES
🇹🇰 - U+1F1F9 U+1F1F0 FLAG: TOKELAU
🇹🇿 - U+1F1F9 U+1F1FF FLAG: TANZANIA
🇺🇬 - U+1F1FA U+1F1EC FLAG: UGANDA
🇿🇲 - U+1F1FF U+1F1F2 FLAG: ZAMBIA
2022-09-30 11:50:46 +01:00
Andreas Kling
a0f3e2c9a2 LibWeb: Never claim that flex containers create a BFC
If a flex item is itself a flex container, we were previously lying when
asked if the item created a BFC. It creates an FFC, so stop lying about
this in FormattingContext::creates_block_formatting_context().
2022-09-29 20:10:12 +02:00
Andreas Kling
7c6e42c2d4 LibWeb: Fix bogus comparison when measuring if a float can fit
We were using `>=` instead of `>` when checking if a float with a given
width could fit in the available space. If the width was an exact match,
we rejected it! Oops :^)
2022-09-29 20:10:07 +02:00
Andreas Kling
b7f9387f69 LibWeb: Don't draw only-translated stacking contexts via bitmap
If the 2D transform in effect is just a simple translation, we don't
need to draw into a temporary bitmap and then transform it. We can
just translate the painter. :^)
2022-09-29 20:10:02 +02:00
Andreas Kling
e8a5233b94 LibWeb: Don't round fragment widths while accumulating in LineBuilder
By rounding the fragment widths, we sometimes inserted line breaks
prematurely, even though the fragment *would* fit.
2022-09-29 20:09:56 +02:00
Andreas Kling
d64a8c3d2a LibWeb: Resolve cross-axis flex item margins in the common case 2022-09-29 20:09:52 +02:00
Andreas Kling
9e4226f353 LibWeb: Create flex items for empty generated boxes
I couldn't find anything in the specs about this, but GMail uses
empty generated boxes (`::before` and `::after` with `content: ""`)
inside a flexbox container in order to vertically center things.

The flexbox spec tells us to not generate flex items for empty
*anonymous* boxes, so we continue not doing that, but generated boxes
(any pseudo-element box) now always produce a flex item. This probably
isn't perfect either, and we'll have to revisit it for stuff like
`::first-letter`.
2022-09-29 20:09:49 +02:00
Andreas Kling
7abb512a86 LibWeb: Make PercentageOr<T>::contains_percentage() handle more cases 2022-09-29 20:09:44 +02:00
Andreas Kling
df416bb822 LibWeb: Add AvailableSpace.cpp to CMakeLists.txt 2022-09-29 20:05:28 +02:00
Andreas Kling
e6eb8a9f06 LibWeb: Fix crash in get_response_mime_type()
We were creating a ref-counted HeaderList object on the stack,
which then crashed in ~RefCounted() on scope exit, since nobody had
adopted it.
2022-09-29 18:33:53 +02:00
Andreas Kling
8fa459f2d6 LibWeb: Add missing null checks in Layout::Node::set_needs_display()
Let's not assume the containing block has a paintable box just because
someone is calling set_needs_display(). It can just be a no-op in that
case, and nobody gets hurt.
2022-09-29 18:33:41 +02:00
Andreas Kling
385657a4bf LibWeb: Add a helper for calculating the stretch-fit width of a box 2022-09-29 18:33:41 +02:00
Andreas Kling
fce1c673c7 LibWeb: Add CSS::Size::to_string() and an AK::Formatter for it 2022-09-29 18:33:41 +02:00
Andreas Kling
fdc9dc5729 LibWeb: Don't force layout when scrolling to non-existent anchor
If we're asked to scroll to an anchor element that's not actually in the
document, we don't need to perform a layout.
2022-09-29 18:33:41 +02:00
Andreas Kling
f161e20e57 LibWeb: Make FormattingContext::run() take available space as input
Instead of formatting contexts flailing around to figure out from the
"inside" how much space is available on the "outside", we should
provide the amount of available space in both axes as an input to run().

This basically means that when something creates a nested formatting
context, the parent context is responsible for telling the nested context
how much space is available for layout. This information is provided
immediately when invoking run().

Note that this commit doesn't pass accurate values in all cases yet.
This first step just makes it build, and passes available values in some
cases where getting them was trivial.
2022-09-29 18:33:41 +02:00
Andreas Kling
6b2ce2ccc3 LibWeb: Add CSS::Size::make_px(float) convenience helper 2022-09-29 18:33:41 +02:00
Diego Iastrubni
58a44036a9 Lagom: Fix printf implementation on win32
It seems that Filip has already done the hard work, and found out the
implementation different between unix* and windows.

Borrowed from:
https://github.com/SerenityOS/serenity/compare/master...filiphsps:serenity:dev-win32#diff-e3209c9a434a102d0d9459e31e33ddb729dff925b95f41b9d1e56c1e7f88c487R466

Co-authored-by: Filiph Sandström <filiph.sandstrom@filfatstudios.com>
2022-09-29 17:01:22 +01:00
Diego Iastrubni
18257604eb Lagom: Win32 support baby steps
This is the initial port of Lagom to win32. This will enable developers
to use Lagom as an alternative to vanilla STL/StandardC++Library - which
gives a much richer environment (think QtCore - but modern).

My main incentive - is to have a native Windows Ladybird working.

I am starting with AK, which does not yet fully compile (on mingw). When
AK is compiling (currently fails building StringBuffer.cpp) - I will
continue to LibCore and then the rest of the user space libraries
(excluding the GUI, which will be another different effort).

Most of the code is happily stollen from Andrew Kaster's fork - he
deserves the credit.

Co-authored-by: Andrew Kaster <akaster@serenityos.org>
2022-09-29 17:01:22 +01:00
implicitfield
767b23c4aa LibC: Allow detection of supported locales through setlocale
Closes #14690
2022-09-29 09:02:17 -04:00
implicitfield
3353f89e22 Calendar: Only accept Calendar notifications
Previously, changing the time format caused Taskbar to crash.

This commit also simplifies TaskbarWindow::config_string_did_change()
so that it is in line with the changes made to
Calendar::config_string_did_change().

Fixes #15384
2022-09-29 08:48:06 -04:00
Sam Atkins
a58d72656d Userland: Replace empty GUI::Widgets in GML with GUI::Layout::Spacer
This fixes the "Cancel" button on HackStudio's "New Project" dialog
being too small. It's also clearer what these actually are.
2022-09-29 08:31:15 -04:00
Timothy Slater
7fda016217 PixelPaint: Add option to make new layer from selection
New actions in the Layer Menu allows for the creation of a new layer
from the current selection. Layers can be made by copying the
selection or cutting it from the current layer. The new layer will be
sized to the bounding box of the selection. The newly produced layer
will be added to the layer stack.
2022-09-29 10:20:17 +01:00
Timothy Slater
e66763c223 PixelPaint: Add function to make layer from selection to ImageEditor 2022-09-29 10:20:17 +01:00
networkException
9d1336a1c9 LibWeb: Rename an origin's protocol to origin scheme
This patch updates the naming of an origin's protocol to be called
scheme according to the specification.

See https://html.spec.whatwg.org/multipage/origin.html#concept-origin-scheme
2022-09-29 09:39:04 +01:00
networkException
4230dbbb21 AK+Everywhere: Replace "protocol" with "scheme" url helpers
URL had properly named replacements for protocol(), set_protocol() and
create_with_file_protocol() already. This patch removes these function
and updates all call sites to use the functions named according to the
specification.

See https://url.spec.whatwg.org/#concept-url-scheme
2022-09-29 09:39:04 +01:00
Sam Atkins
454bf1fde0 HackStudio: Insert tooltip styling directly into Markdown HTML output 2022-09-28 23:58:26 +01:00
Sam Atkins
36c5dd78b1 LibWeb: Make Markdown images shrink-to-fit by default
This inserts some CSS and JS to make images in Markdown documents which
are wider than the viewport, become shrink-to-fit. Clicking on these
toggles them between shrink-to-fit and full size.

Anyone who displays Markdown documents using LibWeb gets this
functionality for free! That's Browser, Help, and Welcome's README
display.
2022-09-28 23:58:26 +01:00
Sam Atkins
aea4fbdd7b LibMarkdown: Allow extra content to be inserted into HTML output's head
This lets users supply custom styling and scripting, among other things.
2022-09-28 23:58:26 +01:00
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
Timothy Flynn
5f9d8f25c6 AK+Meta: Define a debug flag for LibTimeZone 2022-09-28 23:52:51 +01:00
Timothy Flynn
9a1b24d5be LibTimeZone: Use the last DST rule in the TZDB if a match isn't found
Some time zones, like "Asia/Shanghai", use a set of DST rules that end
before present day. In these cases, we should fall back to last possible
RULE entry from the TZDB. The time zone compiler published by IANA (zic)
performs the same fallback starting with version 2 of the time zone file
format.
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
42518867d7 AK: Make ErrorOr::error() const and return a const reference 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
Lucas CHOLLET
0396b6da82 AK: Add StringView operator==(char) 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