Commit graph

16990 commits

Author SHA1 Message Date
Andreas Kling
83a6be593c LibWeb: Add a 1-entry lookup cache to FormattingState
This makes repeated lookups of the state for the same box much faster
by bypassing the HashMap.
2022-07-06 20:31:22 +02:00
Andreas Kling
e7370443f2 LibWeb: Make non-finite CSS lengths resolve to "auto"
When we're performing max-content layout (a separate throwaway layout
pass that only exists to discover the intrinsic max-content size of
a specific box), we act as if the containing block has infinite width.

This allows an infinite length to propagate into the layout system,
which is fine, but at some point it needs to be turned into a finite
number or some loop conditions will not make sense and we can hang
indefinitely (e.g in the flexible lengths resolution algorithm.)

We fix this by making Length::resolved() turn non-finite values into
an "auto" length.
2022-07-06 20:31:19 +02:00
Timothy Flynn
b3deec061e LibJS: Implement Intl.Locale.prototype.weekInfo property 2022-07-06 16:56:42 +02:00
Timothy Flynn
12e7c0808a LibUnicode: Generate per-region week data
This includes:
* The minimum number of days in a week for that week to count as the
  first week of a new year.
* The day to be shown as the first day of the week in a calendar.
* The start/end days of the weekend.

Like the existing hour cycle data, week data is presented per-region in
the CLDR, rather than per-locale. The method to add likely subtags to a
locale to perform region lookups is the same.

The list of regions in the CLDR for hour cycle, minimum days, first day,
and weekend days are quite different. So rather than changing the
existing HourCycleRegion enum to a generic Region enum, we generate
separate enums for each of the week data fields. This allows each lookup
into these fields to remain simple array-based index access, without any
"jumps" for regions that don't have CLDR data for a field.
2022-07-06 16:56:42 +02:00
Timothy Flynn
88a560dd84 LibJS: Implement Intl.Locale.prototype.textInfo property 2022-07-06 16:56:42 +02:00
Timothy Flynn
4868b888be LibUnicode: Generate per-locale text layout information
Currently contains just each locale's character order, but is set up to
easily add other text layout fields from the CLDR if ECMA-402 eventually
requires them.
2022-07-06 16:56:42 +02:00
Timothy Flynn
814f13bc2a LibJS: Implement Intl.Locale.prototype.timeZones property 2022-07-06 16:56:42 +02:00
Timothy Flynn
fa005bd276 LibTimeZone: Parse and generate a list of time zones used by region
The zone1970.tab file in the TZDB contains regional time zone data, some
of which we already parse for the system time zone settings map.

This parses the region names from that file and generates a list of time
zones which are used in each of those regions.
2022-07-06 16:56:42 +02:00
Timothy Flynn
f6aa6a480c LibJS: Implement Intl.Locale.prototype.numberingSystems property 2022-07-06 16:56:42 +02:00
Timothy Flynn
ee2be5895f LibJS: Implement Intl.Locale.prototype.hourCycles property 2022-07-06 16:56:42 +02:00
Timothy Flynn
4d32f38a76 LibJS: Partially implement Intl.Locale.prototype.collations property
We do not yet parse collation data from the CLDR. This stubs out the
collations property, analogous to Intl.supportedValuesOf.
2022-07-06 16:56:42 +02:00
Timothy Flynn
e9bc35d805 LibJS: Implement Intl.Locale.prototype.calendars property 2022-07-06 16:56:42 +02:00
Linus Groh
028a6b90b1 LibJS: Revert partial resizable ArrayBuffer implementation
This is a manual but clean revert of all commits from #12595.

Adding a partial implementation of the resizable ArrayBuffer proposal
without implementing all the updates to TypedArray infrastructure that
is also covered by the spec introduced a bunch of crashes, so we
decided to revert it for now until a full implementation is completed.
2022-07-06 15:52:57 +02:00
thankyouverycool
69a385f559 FontEditor: Rename FontEditorWidget => FontEditor::MainWidget 2022-07-06 14:25:30 +02:00
thankyouverycool
dcf6454059 FontEditor: Hide Widget::set_font() in GlyphEditorWidget
We were already doing the same for its getters, and this makes its
API more consistent with GlyphMapWidget.
2022-07-06 14:25:30 +02:00
thankyouverycool
bae36a7264 FontEditor: Remove unused headers and member variables 2022-07-06 14:25:30 +02:00
thankyouverycool
2227f8f8ae FontEditor: Simplify GlyphMapWidget context menu construction 2022-07-06 14:25:30 +02:00
thankyouverycool
dc3ee84aca FontEditor: Update GML for new layout system
This patch removes deprecated GML properties and manual sizing
calculations in favor of the new UIDimensions, and registers more
widgets in the FontEditor namespace to simplify widget setup.
2022-07-06 14:25:30 +02:00
thankyouverycool
1b9dff5fb1 FontEditor: Convert preview window to GML and propagate its errors 2022-07-06 14:25:30 +02:00
thankyouverycool
7376c68652 FontEditor: Propagate errors when pushing undo commands 2022-07-06 14:25:30 +02:00
thankyouverycool
510551bb4f LibGUI: Add fallible try_push() variant to UndoStack 2022-07-06 14:25:30 +02:00
thankyouverycool
ae333fad98 FontEditor: Normalize GlyphMap selection before creating UndoSelection
Fixes bogus indexing crashes when creating new restore states.
2022-07-06 14:25:30 +02:00
thankyouverycool
9962a744eb FontEditor: Improve error propagation during construction
FontEditor now builds its actions, toolbars, models and menus
with fallible methods. Widget assignment from GML is now organized
in order of use.
2022-07-06 14:25:30 +02:00
Andrew Kaster
0a62fcfbdf Meta: Build select Services in Lagom
Add overrides for serenity_bin and serenity_lib to allow the actual
CMakeLists.txt from Userland to be used to build as many services as
possible without adding more clutter to Meta/Lagom/CMakeLists.txt
2022-07-06 14:24:23 +02:00
Timon Kruiper
2b82c83ceb LookupServer: Use _POSIX_HOST_NAME_MAX instead of HOST_NAME_MAX
HOST_NAME_MAX is not defined on the BSDs, including macOS. Use
_POSIX_HOST_NAME_MAX instead, which is defined on all the platforms.
2022-07-06 14:24:23 +02:00
Andrew Kaster
579eb7cf41 LookupServer: Use designated initializers for sockaddr_in
At least macOS has a non-standard sin_len field at the front of
the struct that Linux and Serenity do not. On BSDs, the
sin_len field must be initialized to the size of the structure.

Co-Authored-By: Timon Kruiper <timonkruiper@gmail.com>
2022-07-06 14:24:23 +02:00
Andrew Kaster
136b779a64 RequestServer: Only attach SIGINFO signal handler if SIGINFO is defined 2022-07-06 14:24:23 +02:00
Andrew Kaster
30b626414d LibCore: Stub out pledge and unveil for non-serenity systems 2022-07-06 14:24:23 +02:00
Andrew Kaster
73742176a4 LibCore: Stub out FileWatcher for Lagom platforms
Stub out the FileWatcher class with ENOTSUP stubs to let Services that
require it to compile for Lagom. Later we should add real code for this
using techniques like Linux's inotify(7).
2022-07-06 14:24:23 +02:00
Linus Groh
1f5cef1319 LibJS: Make AST.cpp compile with -O0 2022-07-06 14:12:51 +02:00
DexesTTP
eae8520dbb LibJS: Properly compute the line for source location hints
These were obvious wrong uses of the old default "only first occurence"
parameter that was used in String::replace.
2022-07-06 11:12:45 +02:00
DexesTTP
e371552ff2 LibIMAP: Properly escape the whole string instead of the first character
These were obvious wrong uses of the old default "only first occurence"
parameter that was used in String::replace.
2022-07-06 11:12:45 +02:00
DexesTTP
7ceeb74535 AK: Use an enum instead of a bool for String::replace(all_occurences)
This commit has no behavior changes.

In particular, this does not fix any of the wrong uses of the previous
default parameter (which used to be 'false', meaning "only replace the
first occurence in the string"). It simply replaces the default uses by
String::replace(..., ReplaceMode::FirstOnly), leaving them incorrect.
2022-07-06 11:12:45 +02:00
Tim Schumacher
b2454888e8 LibC: Stop leaking FILE in getpwuid and getpwnam 2022-07-06 10:34:20 +02:00
Tim Schumacher
ee5ee0ef86 LibC: Don't clear static storage during endpwent 2022-07-06 10:34:20 +02:00
Tim Schumacher
d903af3614 LibC: Don't clear static storage during endgrent
The POSIX documentation for `endgrent` only mentions that it "closes
the group database", not that it clears the backing storage for return
values. This means that applications might make use of the returned
values even after closing the group database itself. This includes our
own implementations for `getgrnam` and `getgrgid`.

The specification also states that "the storage areas might be
overwritten by a subsequent call to `getgrgid`, `getgrnam`, or
`getgrent`". This implies that `getgrgid` and `getgrnam` aren't meant
to have their own static storage and instead rely on the storage of
`getgrent`.
2022-07-06 10:33:10 +02:00
Andreas Kling
d2b7d2440f LibWeb: Cache flex item main sizes to avoid relayout during same cycle
This makes twitter.com actually load & render (although not very well.)
2022-07-06 00:22:42 +02:00
Linus Groh
8733fbae76 LibJS: Rename TimeHourMinuteBasicFormatNotAmbiguous
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/70de75b
2022-07-05 23:15:52 +02:00
Linus Groh
e1a6418015 LibJS: Rename TimeZoneNumericUTCOffsetNotAmbiguousAllowedNegative
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/9ddd57e
2022-07-05 23:15:52 +02:00
Linus Groh
8dcd0d4a06 LibJS: Rename TimeZoneNumericUTCOffsetNotAmbiguous
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/5ebd34b
2022-07-05 23:15:52 +02:00
Linus Groh
7ef3b42685 LibJS: Simplify TimeZoneNumericUTCOffsetNotAmbiguous
This is an editorial change in the Temporal spec.

See:
- https://github.com/tc39/proposal-temporal/commit/ccef468
- https://github.com/tc39/proposal-temporal/commit/5b38ab4
2022-07-05 23:15:52 +02:00
Linus Groh
fec5d8d531 LibJS: Consistently check Temporal overflow options
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/c8ee2bd
2022-07-05 23:15:52 +02:00
Linus Groh
c3567faa8c LibJS: Remove unnecessary checks for undefined before ToPositiveInteger
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/9f3bf53
2022-07-05 23:15:52 +02:00
Itamar
9498555256 LibWeb: Trigger a relayout after setting Element.innerHTML
In addition to tearing down the layout tree, we also want to trigger a
relayout for the changes made by setting Element.innerHTML to take
effect.
2022-07-05 21:27:37 +02:00
thankyouverycool
1d81d2e072 LibGUI: Don't ignore invisible widgets during layout changes
As they may be setting themselves visible again in the process.
Fixes inability to toggle widgets on and off in some apps.
2022-07-05 21:26:04 +02:00
Luke Wilde
de88e119a0 LibWeb: Implement XMLSerializer
The main thing that is missing is validating certain pieces of data
against XML productions in well-formed mode, but nothing uses
well-formed mode right now.

Required by Closure Library for sanitising HTML.
e687b3d8ab/closure/goog/html/sanitizer/safedomtreeprocessor.js (L117)
2022-07-05 21:25:05 +02:00
Luke Wilde
a4e3fff3fb WebContent: Invalidate document style when changing the page's palette
This makes the page automatically update to reflect the system theme
when in "Color Scheme > Follow System Theme" mode without having to
manually cause a style update.
2022-07-05 18:23:22 +02:00
MacDue
3294753d6c Browser+WebContent: Fix inspecting non-visible nodes
I already fixed the crash from this in #14470, but didn't fully fix
the issue. Currently the browser just avoids sending the
inspect_dom_node() IPC call for non-visible nodes.

The main problem with this is it means the browser keeps displaying
the overlay for the previously selected node. This commit fixes
the crash in the WebContent side, so the IPC call can still be made
and the selection correctly updated.
2022-07-05 13:09:11 +02:00
Idan Horowitz
753844ec96 LibELF: Take TLS segment alignment into account in DynamicLoader
Previously we would just tightly pack the different libraries' TLS
segments together, but that is incorrect, as they might require some
kind of minimum alignment for their TLS base address.

We now plumb the required TLS segment alignment down to the TLS block
linear allocator and align the base address down to the appropriate
alignment.
2022-07-05 11:26:10 +02:00
Ali Mohammad Pur
5f012778b8 LibRegex: Use the correct values for comparing LUT entries
Previously we were ignoring the insensitive flag for LUT lookups.
2022-07-05 07:19:13 +02:00