Commit graph

12771 commits

Author SHA1 Message Date
Timothy Flynn
6576d0291c LibJS: Implement Date.prototype.getTimezoneOffset 2022-01-15 20:13:48 +01:00
Timothy Flynn
032664332b LibJS: Implement MakeDay without using AK::years_to_days_since_epoch
Implementing years_to_days_since_epoch without a loop will be tricky.
The TimeFromYear AO gives a good enough approximation for MakeDay until
we figure that out.
2022-01-15 20:13:48 +01:00
Timothy Flynn
11d7c7ebbd LibJS: Move time conversion constants to the Date header
These are needed outside of the Date object .cpp file, so move them to
the header.
2022-01-15 20:13:48 +01:00
Timothy Flynn
34a1dd4257 LibJS: Remove Core::DateTime logic from the Date object :^) 2022-01-15 20:13:48 +01:00
Timothy Flynn
58ccca6a9d LibJS+js: Pretty-print Date objects using the ToDateString AO 2022-01-15 20:13:48 +01:00
Timothy Flynn
d83ce7dd0b LibJS: Re-implement the Date constructor / prototype for spec compliance
First, this adds a constructor to the Date object to be created from a
plain double. This is a first step to removing Core::DateTime as the
basis for the Date object. A subsequent commit will remove the now-
unused data from the object.

Next, this implements the constructor in accordance to the spec. The
constructor when NewTarget is undefined no longer allocates a Date on
the heap. The other constructor properly uses recently created AOs to
handle time zone and ensure the created [[DateValue]] is valid. Other
methods on the constructor (Date.now) have not been touched yet.

Last, the prototype is reimplemented. Again, we use other AOs to handle
time zones and time clipping. Not all prototypes are fixed; most of them
are, but a few (e.g. Date.prototype.getTimezoneOffset) were not fixed,
but left in a mostly unimplemented state for another commit.

In all of the above, spec comments are added. This is a rather large
change; but it's tough to do any of these parts individually without
breaking everything else.
2022-01-15 20:13:48 +01:00
Timothy Flynn
d31e6b9391 LibJS: Make the thisTimeValue AO public
It will be needed by the Date constructor.
2022-01-15 20:13:48 +01:00
Timothy Flynn
a488ec1ad0 LibJS: Implement spec-compliant ToDateString and its underlying AOs 2022-01-15 20:13:48 +01:00
Timothy Flynn
62dc9958f5 LibJS: Protect LocalTZA against non-finite times
It is undefined behavior to cast from a double to an integer if the
value does not fit in the limits of the integer.
2022-01-15 20:13:48 +01:00
Timothy Flynn
b2aa3c9f84 LibJS: Do not negate offset in LocalTZA for isUTC=false
In commmit 7d2834344a, I think I combined
the definitions of the LocalTZA and UTC AOs in my head, and thought the
offset should be negated within LocalTZA. Instead, the offset should be
left untouched, and the UTC AO is responsible for doing the subtraction.
2022-01-15 20:13:48 +01:00
Timothy Flynn
d93713b874 LibJS: Implement the LocalTime, UTC, and TimeWithinDay AOs 2022-01-15 20:13:48 +01:00
Timothy Flynn
5f5bcd549e LibJS: Sort Date.prototype methods by spec order
When viewing the code side-by-side with the spec, it's much nicer when
everything is in the same order.

Also fixes the spec link for Date.prototype.getMilliseconds (it pointed
at setMilliseconds by mistake).
2022-01-15 20:13:48 +01:00
Timothy Flynn
247caac7a8 LibTimeZone: Canonicalize the current time zone and fall back to UTC
If the tzname is unknown, fall back to UTC for now. Unknown time zones
are most likely due to not parsing RULE entries yet, but at the very
least, it only makes sense for current_time_zone to return a time zone
that LibTimeZone actually knows about.
2022-01-15 20:13:48 +01:00
Andreas Kling
c482508aa1 LibELF: Use shared memory mapping when loading ELF objects
There's no reason to make a private read-only mapping just for reading
(and validating) the ELF headers, and copying out the data segments.
2022-01-15 19:51:15 +01:00
Glenford Williams
c55dfabdd5 Spreadsheet: Use FileSystemAccessClient for the reading of files 2022-01-15 22:20:15 +03:30
Luke Wilde
c6a0365c58 LibGL+LibSoftGPU: Add support for 8-bit luminance (+ alpha) textures
Used by Half-Life for single colour textures. The alpha variant is
especially used for UI textures.
2022-01-15 12:58:00 +01:00
Brian Gianforcaro
ef2fd31288 Terminal: Add config listeners for controlling scrollbar visibility 2022-01-15 11:03:23 +01:00
Brian Gianforcaro
ab4035e227 TerminalSettings: Expose a CheckBox controlling scrollbar visibility 2022-01-15 11:03:23 +01:00
Brian Gianforcaro
0e26ba59f7 LibVT: Enable caller to control the visibility of the scrollbar widget
In preparation for another feature, expose an API so that any users of
this widget can control the scrollbar visibility.
2022-01-15 11:03:23 +01:00
sin-ack
2e1bbcb0fa LibCore+LibIPC+Everywhere: Return Stream::LocalSocket from LocalServer
This change unfortunately cannot be atomically made without a single
commit changing everything.

Most of the important changes are in LibIPC/Connection.cpp,
LibIPC/ServerConnection.cpp and LibCore/LocalServer.cpp.

The notable changes are:
- IPCCompiler now generates the decode and decode_message functions such
  that they take a Core::Stream::LocalSocket instead of the socket fd.
- IPC::Decoder now uses the receive_fd method of LocalSocket instead of
  doing system calls directly on the fd.
- IPC::ConnectionBase and related classes now use the Stream API
  functions.
- IPC::ServerConnection no longer constructs the socket itself; instead,
  a convenience macro, IPC_CLIENT_CONNECTION, is used in place of
  C_OBJECT and will generate a static try_create factory function for
  the ServerConnection subclass. The subclass is now responsible for
  passing the socket constructed in this function to its
  ServerConnection base; the socket is passed as the first argument to
  the constructor (as a NonnullOwnPtr<Core::Stream::LocalServer>) before
  any other arguments.
- The functionality regarding taking over sockets from SystemServer has
  been moved to LibIPC/SystemServerTakeover.cpp. The Core::LocalSocket
  implementation of this functionality hasn't been deleted due to my
  intention of removing this class in the near future and to reduce
  noise on this (already quite noisy) PR.
2022-01-15 13:29:48 +03:30
sin-ack
4cad0dd74c LibCore: Implement LocalSocket::peer_pid
Mostly a copy of Core::LocalSocket::peer_pid.
2022-01-15 13:29:48 +03:30
sin-ack
92be52fd9f LibCore: Implement LocalSocket::adopt_fd
Similar to File::adopt_fd, this function creates a new LocalSocket with
an existing fd. The main use of this function is to create LocalSocket
objects from fds that have been passed to us by SystemServer to take
over.
2022-01-15 13:29:48 +03:30
sin-ack
27b49a60d0 LibCore: Implement LocalSocket::read_without_waiting
This uses recv with MSG_DONTWAIT to disable blocking operation for a
single call. LibIPC uses this to read in a non-blocking manner from an
otherwise blocking socket.
2022-01-15 13:29:48 +03:30
sin-ack
f9847372f3 LibCore: Implement LocalSocket::receive_fd and send_fd
These are just wrappers over the sendfd and recvfd syscalls.
2022-01-15 13:29:48 +03:30
Timothy Flynn
643992904c LibJS: Clip parsed IS0 8601 strings to +/- 8.64e15 2022-01-14 22:39:06 +01:00
Timothy Flynn
aea4f79b57 LibJS: Implement Date.parse using AK::Time and LibTimeZone
Fixes #4651
2022-01-14 22:39:06 +01:00
Timothy Flynn
7d2834344a LibJS: Implement the localTZA AO for isUTC=false 2022-01-14 22:39:06 +01:00
alexmajor
67473085a1 Utilities: Port ifconfig to LibMain 2022-01-14 21:38:38 +01:00
Jelle Raaijmakers
8efd6bc878 LibGL+LibSoftGPU: Implement glDrawPixels depth buffer support
This enabled writing directly to the depth buffer, and allows games
like Grim Fandango to render their pre-baked depth buffers correctly!
2022-01-14 21:38:09 +01:00
Jelle Raaijmakers
ca78327a96 LibGL+LibSoftGPU: Implement rasterization position
Implements support for `glRasterPos` and updating the raster position's
window coordinates through `glBitmap`. The input for `glRasterPos` is
an object position that needs to go through the same vertex
transformations as our regular triangles.
2022-01-14 21:38:09 +01:00
Jelle Raaijmakers
a4d98c4622 LibGL: Add context lifetime debug output
Also, make `::create_context` return a `NonnullOwnPtr`.
2022-01-14 21:38:09 +01:00
kleines Filmröllchen
4d3a5c21b0 Utilities/aplay: Print progress in seconds and minutes by default
By default, aplay now prints the played time, the remaining time and the
total duration of the file in seconds and minutes. This is much more
intuitive. The old sample-based format is kept and hidden behind the -s
flag.
2022-01-14 21:37:23 +01:00
kleines Filmröllchen
8467327807 Utilities/aplay: Print format name under "Format"
This is not only nice to see, but it additionally tells developers that
the correct loader plugin was selected.
2022-01-14 21:37:23 +01:00
kleines Filmröllchen
54ac4ba8cc LibAudio: Expose the format name from the loader plugins
The format of these names is "Full Abbreviation (.fileformat)". For
example: "FLAC (.flac)", "RIFF WAVE (.wav)", "MPEG Layer III (.mp3)",
"Vorbis (.ogg)" The reasoning is that the container and therefore the
file ending may differ significantly from the actual format, and the
format should be given as unambiguously as possible and necessary.
2022-01-14 21:37:23 +01:00
Colin
dc89ac1463 PixelPaint: Update SelectedColorWidget::m_color consistently 2022-01-14 21:33:32 +01:00
Maciej
08e5c6f349 WebServer: Add charset declaration to directory listings 2022-01-14 21:32:55 +01:00
Lucas CHOLLET
8bc1a9e946 hostname: Port to LibMain 2022-01-14 19:42:19 +02:00
Lucas CHOLLET
b3b40ae1fa LibCore: Add wrapper for sethostname 2022-01-14 19:42:19 +02:00
Lucas CHOLLET
8153282923 LibCore: Remove usage of a hardcoded constant in gethostname() 2022-01-14 19:42:19 +02:00
Lucas CHOLLET
63466d385c host: Port to LibMain 2022-01-14 19:42:19 +02:00
Lucas CHOLLET
dbcccde062 hexdump: Port to LibMain 2022-01-14 19:42:19 +02:00
Lucas CHOLLET
02cb34a48a head: Port to LibMain 2022-01-14 19:42:19 +02:00
Lucas CHOLLET
5ac52d0e4c gunzip: Remove StringView assignment on rhs-value 2022-01-14 19:42:19 +02:00
Lucas CHOLLET
80a1ab3487 gunzip: Port to LibMain 2022-01-14 19:42:19 +02:00
Lucas CHOLLET
c2e7acc8bb grep: Port to LibMain 2022-01-14 19:42:19 +02:00
Lucas CHOLLET
9e1e80954b gml-format: Port to LibMain 2022-01-14 19:42:19 +02:00
Lucas CHOLLET
f862fabe6e false: Port to LibMain 2022-01-14 19:42:19 +02:00
Lucas CHOLLET
affef5d1a9 disasm: Port to LibMain 2022-01-14 19:42:19 +02:00
qeeg
2d9bd24249 LibGL: Add a few defines so that Quake 2's OpenGL renderer compiles 2022-01-14 11:59:31 +01:00
kleines Filmröllchen
be6418cc50 Everywhere: Use my new serenityos.org e-mail :^) 2022-01-14 11:54:09 +01:00