Commit graph

31494 commits

Author SHA1 Message Date
Luke Wilde
54454952e0 LibWeb: Capture <script> element's node document on execution
Step 1 of the spec is to capture the <script> element's node document
into a local variable.

When I originally implemented this, I thought this was not necessary.
However, I realised that the script that runs can adopt the current
script element into a different document, meaning step 5.4 and 6 then
operate on the incorrect document.

Covered by this WPT: 7b0ebaccc6/html/semantics/scripting-1/the-script-element/moving-between-documents-during-evaluation.html
2021-12-21 13:50:00 -08:00
creator1creeper1
cacac7927b Calculator: Construct KeypadValue precisely from the Clipboard contents
Previously, we would use lossy strtod() conversion. This was bad,
especially since we switched from internally storing Calculator
state in a double to storing it in the KeypadValue class
some time ago. This commit adds a constructor for the KeypadValue
class that is not lossy by using strtoll(). It handles numbers
with and without decimal points as well as negative numbers
correctly.
2021-12-21 13:22:12 -08:00
Michel Hermier
7ea3d40e19 LibCore: Unconditionally report error in EventLoop::wait_for_event
When `select` fails and `VERIFY_NOT_REACHED()` is reached, it is wise
to always have a trace of what went wrong.
2021-12-21 13:15:17 -08:00
Nick Johnson
08e4a1a4dc AK+Everywhere: Replace __builtin bit functions
In order to reduce our reliance on __builtin_{ffs, clz, ctz, popcount},
this commit removes all calls to these functions and replaces them with
the equivalent functions in AK/BuiltinWrappers.h.
2021-12-21 22:13:51 +01:00
Xavier Defrang
26bb3e1acf chmod+mkdir: Use convert_to_uint_from_octal 2021-12-21 13:13:04 -08:00
Xavier Defrang
9e97823ff8 AK: Add convert_to_uint_from_octal 2021-12-21 13:13:04 -08:00
Xavier Defrang
6ca34f5647 mkdir: Implement --mode option
Only supports permissions given in octal format
at the moment.
2021-12-21 13:13:04 -08:00
Xavier Defrang
1255316d26 mkdir: Use LibMain 2021-12-21 13:13:04 -08:00
Astraeus-
9971bb0b05 Profiler: Add horizontal_scrollbar height to initial_height
This prevents the scrollbar from covering the TimelineTrack
when there is one
2021-12-21 22:10:33 +01:00
Ali Mohammad Pur
b8f03bb072 LibRegex: Make append_alternation() significantly faster
...by flattening the underlying bytecode chunks first.
Also avoid calling DisjointChunks::size() inside a loop.
This is a very significant improvement in performance, making the
compilation of a large regex with lots of alternatives take only ~100ms
instead of many minutes (I ran out of patience waiting for it) :^)
2021-12-21 22:10:07 +01:00
Ali Mohammad Pur
66249612d6 LibRegex: Avoid calling DisjointChunks::size() in get_opcode()
That method is O(n), and should generally be avoided.
2021-12-21 22:10:07 +01:00
Ali Mohammad Pur
49cbd4dcca AK: Make DisjointChunks not query size() when there are no chunks 2021-12-21 22:10:07 +01:00
Ali Mohammad Pur
2df54a7b56 AK: Add Disjoint(Chunks Spans)::find(index)
For when the may or may not be out of bounds.
2021-12-21 22:10:07 +01:00
Timothy Flynn
c417374dd6 LibUnicode: Remove linkage from LibUnicode to LibUnicodeData
LibUnicodeData can now be loaded dynamically at runtime.
2021-12-21 13:09:49 -08:00
Timothy Flynn
52394deece LibUnicode: Remove now unused value-from-string generator overload
The generate_value_from_string_for_dynamic_loading() overload was just
temporary until all generates were switched over to dynamic loading.
2021-12-21 13:09:49 -08:00
Timothy Flynn
15e1498419 LibUnicode: Dynamically load the generated UnicodeDateTimeFormat symbols 2021-12-21 13:09:49 -08:00
Timothy Flynn
a1f0ca59ae LibUnicode: Dynamically load the generated UnicodeNumberFormat symbols 2021-12-21 13:09:49 -08:00
Timothy Flynn
09be26b5d2 LibUnicode: Dynamically load the generated UnicodeLocale symbols 2021-12-21 13:09:49 -08:00
Timothy Flynn
3fd53baa25 LibUnicode: Dynamically load the generated UnicodeData symbols
The generated data for libunicodedata.so is quite large, and loading it
is a price paid by nearly every application by way of depending on
LibRegex. In order to defer this cost until an application actually uses
one of the surrounding APIs, dynamically load the generated symbols.

To be able to load the symbols dynamically, the generated methods must
have demangled names. Typically, this is accomplished with `extern "C"`
blocks. The clang toolchain complains about this here because the types
returned from the generators are strictly C++ types. So to demangle the
names, we use the asm() compiler directive to manually define a symbol
name; the caveat is that we *must* be sure the symbols are unique. As an
extra precaution, we prefix each symbol name with "unicode_". For more
details, see: https://gcc.gnu.org/onlinedocs/gcc/Asm-Labels.html

This symbol loader used in this implementation provides the additional
benefit of removing many [[maybe_unused]] attributes from the LibUnicode
methods. Internally, if ENABLE_UNICODE_DATABASE_DOWNLOAD is OFF, the
loader is able to stub out the function pointers it returns.

Note that as of this commit, LibUnicode is still directly linked against
LibUnicodeData. This commit is just a first step towards removing that.
2021-12-21 13:09:49 -08:00
Timothy Flynn
749d5ebd68 LibUnicode: Add missing forward declarations to forwarding header 2021-12-21 13:09:49 -08:00
Timothy Flynn
97508b74eb LibUnicode: Remove declaration of function which moved to another header
Unicode::get_number_system_symbol is declared in UnicodeNumberFormat and
defined in UnicodeNumberFormat.cpp.
2021-12-21 13:09:49 -08:00
Timothy Flynn
10a8b6d411 Userland: Add unveil/pledge requisites for dynamic Unicode data loading
Loading libunicodedata.so will require dlopen(), which in turn requires
mmap(). The 'prot_exec' pledge is needed for this.

Further, the .so itself must be unveiled for reading. The "real" path is
unveiled (libunicodedata.so.serenity) as the symlink (libunicodedata.so)
itself cannot be unveiled.
2021-12-21 13:09:49 -08:00
alexmajor
35e5cbe3b3 Documentation: Update VSCode configuration
Remove note about CMake Tools as version 1.9.0 has shipped and no longer
needed. Update details for files to latest versions and allow easier
copy and paste into an empty file.
2021-12-21 22:09:06 +01:00
Jelle Raaijmakers
7fa2e792a8 LibGL: Simplify glDrawPixels checks and reduce debug spam 2021-12-21 12:58:58 -08:00
Jelle Raaijmakers
a1fb16e89c LibGL: Implement GL_POLYGON rendering
This is a deprecated feature that is still in use in some older games,
most notably Grim Fandango in ScummVM makes heavy use of it.

Luckily, since you can only draw convex polygons, the end result is
exactly the same as when you would have used `glBegin(GL_TRIANGLE_FAN)`
- so we just reuse that code as-is.
2021-12-21 12:58:58 -08:00
Jelle Raaijmakers
604eea5827 LibGL: Allow querying maximum matrix stack depths 2021-12-21 12:58:58 -08:00
Jelle Raaijmakers
18399d00fa LibGL: Implement matrix mode GL_TEXTURE
Implement support for the `GL_TEXTURE` matrix mode, the texture matrix
stack and texture coordinate matrix transformation.

Also, an unused `m_current_matrix` was removed to make room for
`m_texture_matrix`.
2021-12-21 12:58:58 -08:00
Jelle Raaijmakers
4703e8cbcf LibGL: Make texture coordinates a FloatVector4
In OpenGL, texture coordinates can have up to 4 values. This change
will help with easy application of texture coordinate matrix
transformations in the future.

Additionally, correct the initial value for texture coordinates to
`{ 0.f, 0.f, 0.f, 1.f}`.
2021-12-21 12:58:58 -08:00
Martin Bříza
86b249f02f Kernel: Implement sysconf(_SC_SYMLOOP_MAX)
Not much to say here, this is an implementation of this call that
accesses the actual limit constant that's used by the VirtualFileSystem
class.

As a side note, this is required for my eventual Qt port.
2021-12-21 12:54:11 -08:00
Martin Bříza
f75bab2a25 Kernel: Move symlink recursion limit to .h, increase it to 8
As pointed out by BertalanD on Discord, POSIX specifies that
_SC_SYMLOOP_MAX (implemented in the following commit) always needs to be
equal or more than _POSIX_SYMLOOP_MAX (8, defined in
LibC/bits/posix1_lim.h), hence I've increased it to that value to
comply with the standard.

The move to header is required for the following commit - to make this
constant accessible outside of the VFS class, namely in sysconf.
2021-12-21 12:54:11 -08:00
Ali Mohammad Pur
ccb9cae8e9 LibC: Make WEOF a signed value on clang
The actual value is unchanged, but the previous `0xffffffff` was an
unsigned value, which lead to clang getting mad at `foowc() == WEOF`.
This commit makes it a signed int on clang, which *should* serve
the same purpose and not lead to clang getting mad at us.
2021-12-21 21:24:36 +03:30
Ali Mohammad Pur
0d7d2b825e LibC: Add POSIX spec links to all applicable wide character functions 2021-12-21 21:24:36 +03:30
Ali Mohammad Pur
0fdf52f6dd LibC: Define WCHAR_{MIN,MAX} 2021-12-21 21:24:36 +03:30
Ali Mohammad Pur
687a3351c2 LibC: Stub out wcsftime() 2021-12-21 21:24:36 +03:30
Ali Mohammad Pur
e717ca32d1 LibC: Implement ungetwc() 2021-12-21 21:24:36 +03:30
Ali Mohammad Pur
14b91a3fe9 LibC: Stub out some wscanf variants 2021-12-21 21:24:36 +03:30
Ali Mohammad Pur
f0709c7a24 LibC+AK: Implement all sorts of wprintf variants 2021-12-21 21:24:36 +03:30
Ali Mohammad Pur
db7a6d6e74 LibC: Implement f{get,put}ws() 2021-12-21 21:24:36 +03:30
Ali Mohammad Pur
bd9a22e7e7 LibC: Stub out fwide()
This is a mess, and I'd rather not perform checks on every single stdio
operation, so just make it a noop.
2021-12-21 21:24:36 +03:30
Ali Mohammad Pur
cb90856756 LibC: Implement {f,}putwc() 2021-12-21 21:24:36 +03:30
Ali Mohammad Pur
a4e8a09188 LibC: Implement getwchar() 2021-12-21 21:24:36 +03:30
Ali Mohammad Pur
cf17677206 LibC: Implement {f,}getwc() 2021-12-21 21:24:36 +03:30
Ali Mohammad Pur
3b281baf75 LibC: Implement wcs{,c}spn() 2021-12-21 21:24:36 +03:30
Ali Mohammad Pur
4f8d095f5a LibC: Sort the SOURCES entries in CMakeLists.txt 2021-12-21 21:24:36 +03:30
Ali Mohammad Pur
cacc3ee857 LibC: Switch to using east const in wchar.cpp 2021-12-21 21:24:36 +03:30
Linus Groh
a00a3fa1ef LibGfx: Remove 'QOIImageDecoderPlugin: ' prefix from error messages
What the component which did the actual decoding is called is not
relevant for the error, and would be rather distracting once we show
decoding error messages e.g. in ImageViewer (instead of just silently
failing).
Also makes them more consistent as many already don't include it - a
mistake which is now turned into a feature :^)
2021-12-21 17:37:10 +01:00
Luke Wilde
6d5531112f LibJS: Add TypedArray.prototype.@@iterator 2021-12-21 15:40:41 +01:00
Timothy Flynn
4fe47ed86e LibJS: Update spec link for InstallErrorCause AO 2021-12-21 14:56:28 +01:00
Timothy Flynn
d69f5ca128 LibJS: Update spec numbers for Operations on Objects AOs
The error cause proposal was merged, so some spec numbers were bumped.
2021-12-21 14:56:28 +01:00
Timothy Flynn
968f6e2432 LibJS: Define RegExp.prototype methods in spec order 2021-12-21 14:56:00 +01:00