Commit Graph

8045 Commits

Author SHA1 Message Date
Linus Groh
be07e2e91b LibJS: Start implementing Temporal.PlainMonthDay
This commit adds the PlainMonthDay object itself, its constructor and
prototype (currently empty), and the CreateTemporalMonthDay abstract
operations.
2021-08-15 10:36:36 +01:00
Linus Groh
301d622b46 LibJS/Tests: Tweak PlainYearMonth Infinity test values
Since we want to test that +/- Infinity fails as an argument, we should
provide valid arguments for everything else - 0 for month isn't :^)
2021-08-15 10:36:36 +01:00
Nico Weber
f25be94487 LibCore: Make --version print same version as in LibGUI's About dialogs
Making every binary's behavior depend on the current git hash seems a
bit questionable to me, but we should be self-consistent about this.
2021-08-15 01:22:45 +02:00
Nico Weber
faa2c74b49 LibGUI: Simplify AboutDialog::version_string()
No behavior change.
2021-08-15 01:22:45 +02:00
Nico Weber
a45b6dbc07 LibCore: Include math.h instead of defining isnan() in ArgsParser.cpp 2021-08-15 01:22:45 +02:00
Idan Horowitz
04359995a7 LibJS: Exclude FinalizationRegistries with queued cleanup jobs from GC
This is done by just adding them to the list of GC roots, which
prevents the VM from trying to run cleanup job of garbage collected
registries.
2021-08-14 22:32:31 +01:00
Kenneth Myhra
f8d27303d0 LibC: Add stubs for several functions in xattr.h
The following functions are stubbed out:
- getxattr
- lgetxattr
- fgetxattr
- setxattr
- lsetxattr
- fsetxattr
- listxattr
- llistxattr
- flistxattr
2021-08-14 22:32:00 +01:00
Kenneth Myhra
04733ccb56 LibC: Add stub for res_query 2021-08-14 22:32:00 +01:00
Kenneth Myhra
8abfcb976d LibC: Add stub for fnmatch and a set of defined values
This adds a stub for fnmatch and the following defined values:
- FNM_PATHNAME
- FNM_NOESCAPE
- FNM_PERIOD
- FNM_FILE_NAME
- FNM_LEADING_DIR
- FNM_CASEFOLD
- FNM_EXTMATCH
2021-08-14 22:32:00 +01:00
Kenneth Myhra
8d19d8861a LibC: Add FIONREAD to ioctl.h 2021-08-14 22:32:00 +01:00
Kenneth Myhra
78eba1271f LibC: Add function fdopendir
This adds the function fdopendir and refactors opendir so that opendir
just opens a file descriptor and passes the file descriptor onto
fdopendir.
2021-08-14 22:32:00 +01:00
Nico Weber
1f71d7bf22 LibCore: Add --version flag to ArgsParser
`--version` always prints "git" for now.

The motivation is that the neofetch port calls `Shell --version` and
adds the output to its output. And if `Shell --version` prints a long
error message about it not knowing the flag, neofetch's output looks a
bit ugly. Per Discord discussion, just add the flag to ArgsParser
instead of only to Shell.
2021-08-14 22:46:34 +04:30
Andreas Kling
286a7ecd92 LibJS: Call base class visit_edges() in various Temporal objects
When overriding visit_edges() in a JS::Object subclass, we must make
sure to call the base class visit_edges(), or the object's Shape (and
any properties) will not get marked.
2021-08-14 20:12:22 +02:00
Andreas Kling
e1273a8ff7 Kernel+LibC: Share definitions for sys/statvfs.h 2021-08-14 19:58:11 +02:00
Andreas Kling
c9a5d83ccc Kernel+LibC: Share definitions for sys/uio.h 2021-08-14 19:58:11 +02:00
Andreas Kling
37e98a55b7 Kernel+LibC: Share definitions for sys/ptrace.h 2021-08-14 19:58:11 +02:00
Andreas Kling
6b6eca0631 Kernel+LibC: Share definitions for sys/time.h 2021-08-14 19:58:11 +02:00
Andreas Kling
35b52338bb Kernel+LibC: Share definitions for sys/times.h 2021-08-14 19:58:11 +02:00
Andreas Kling
808ce594db Kernel+LibC: Share definitions for stdio.h 2021-08-14 19:58:11 +02:00
Andreas Kling
9c2212a60a Kernel+LibC: Share definitions for unistd.h 2021-08-14 19:58:11 +02:00
Andreas Kling
d33b43276c Kernel+LibC: Share definitions for poll.h 2021-08-14 19:58:11 +02:00
Andreas Kling
d794ed1de7 Kernel+LibC: Share definitions for utsname.h 2021-08-14 19:58:11 +02:00
Andreas Kling
c65a735d71 Kernel+LibC: Share definitions for dirent.h 2021-08-14 19:58:11 +02:00
Andreas Kling
77c2c0f620 Kernel+LibC: Share definitions for serenity.h 2021-08-14 19:58:11 +02:00
Andreas Kling
6f78377864 Kernel+LibC: Share definitions for sys/wait.h 2021-08-14 19:58:11 +02:00
Andreas Kling
661bd992b0 Kernel+LibC: Share definitions for net/{if,if_arp,route}.h 2021-08-14 19:58:11 +02:00
Andreas Kling
ff50122dc5 Kernel+LibC: Share definitions for futex.h 2021-08-14 19:58:11 +02:00
Andreas Kling
6fd7212476 Kernel+LibC: Share definitions for signal.h 2021-08-14 19:58:11 +02:00
Andreas Kling
9dc1350177 Kernel+LibC: Share definitions for netinet/in.h 2021-08-14 19:58:11 +02:00
Andreas Kling
b92e6b02e5 Kernel+LibC: Share definitions for sys/socket.h and sys/un.h 2021-08-14 19:58:11 +02:00
Andreas Kling
d277cdfd4c Kernel+LibC: Share definitions for termios.h 2021-08-14 19:58:11 +02:00
Andreas Kling
a8d1c2dde9 Kernel+LibC: Share definitions for sys/mman.h 2021-08-14 19:58:11 +02:00
Andreas Kling
0a78056453 Kernel+LibC: Share definitions for time.h and sys/stat.h 2021-08-14 19:58:11 +02:00
Andreas Kling
740140a661 Kernel+LibC: Share definitions in fcntl.h and sys/types.h
This patch begins the work of sharing types and macros between Kernel
and LibC instead of duplicating them via the kludge in UnixTypes.h.

The basic idea is that the Kernel vends various POSIX headers via
Kernel/API/POSIX/ and LibC simply #include's them to get the macros.
2021-08-14 19:58:11 +02:00
Nico Weber
5c3440c5db Mandelbrot: Add a View menu with zoom actions 2021-08-14 19:50:44 +02:00
Nico Weber
19068945de Mandelbrot: Extract reset() method 2021-08-14 19:50:44 +02:00
Nico Weber
ad7bfe017f Mandelbrot: Extract zoom() method 2021-08-14 19:50:44 +02:00
Daniel Bertalan
fbdf17ae68 LibC: Don't flatten malloc and free
This is no longer needed as per the previous commit, UserspaceEmulator's
malloc tracer now correctly handles functions called from within
`malloc` and `free`. This might also have a benefit on performance
because forcibly inlining all function calls pessimizes cache locality.
2021-08-14 18:42:14 +02:00
Daniel Bertalan
87ef2718bc UserspaceEmulator+LibC: Use sys$emuctl() to disable auditing in malloc
It was fragile to use the address of the body of the memory management
functions to disable memory auditing within them. Functions called from
these did not get exempted from the audits, so in some cases
UserspaceEmulator reported bogus heap buffer overflows.

Memory auditing did not work at all on Clang because when querying the
addresses, their offset was taken relative to the base of `.text` which
is not the first segment in the `R/RX/RW(RELRO)/RW(non-RELRO)` layout
produced by LLD.

Similarly to when setting metadata about the allocations, we now use the
`emuctl` system call to selectively suppress auditing when we reach
these functions. This ensures that functions called from `malloc` are
affected too, and no issues occur because of the inconsistency between
Clang and GCC memory layouts.
2021-08-14 18:42:14 +02:00
Daniel Bertalan
09cef25e92 UserspaceEmulator: Make call rm32 work with address on the stack
Previously, we pushed the old `eip` on the stack before reading the new
address, which made us jump to the wrong place if the destination was
relative to the `esp`.
2021-08-14 18:42:14 +02:00
Daniel Bertalan
bfe5509a28 UserspaceEmulator: Prefix MmapRegions' name with '(UE)'
When printing a backtrace, each library's base address is found by
walking through all memory regions in the coredump, and selecting the
address of the first region whose name begins with the library's soname.
This is done to support the Clang toolchain, where .text is not at
offset 0.

However, because the libraries loaded by the emulated process used the
same names, we could not distinguish those with the ones used by
UserspaceEmulator, so the backtrace ended up being garbage.

Using the libraries mapped by UE would not be a sufficient, as the
running application could ask for other libraries too, and doing away
with setting names would make debugging issues within UE code more
difficult.
2021-08-14 18:42:14 +02:00
Karol Kosek
e8fad5614e DisplaySettings: Pass the parent window to the FilePicker
Prior this change, closing the Display Settings application
didn't close the File Picker.
2021-08-14 15:20:21 +02:00
Karol Kosek
e2ad59ce06 DisplaySettings: Remove the trailing dot from tooltip and window title 2021-08-14 15:20:21 +02:00
Karol Kosek
4d477824e0 DisplaySettings: Open the wallpaper file picker in the wallpaper path
This small change can indirectly tell you where wallpapers are saved.
2021-08-14 15:20:21 +02:00
Sam Atkins
46b93174fc LibWeb: Treat multi-value CSS properties as StyleValueList by default
Some properties, such as `margin`, take multiple values but are not
complicated enough to require special-case handling. These no longer
parsed after my previous StyleValue changes, so this fixes that.

In the future we may want to configure whether to allow this for each
property.
2021-08-14 15:09:19 +02:00
Andreas Kling
459115a59c Taskbar: Add keyboard shortcuts to the fixed items in the start menu 2021-08-14 13:34:59 +02:00
Stephan Unverwerth
949d27f21b LibGL: Implement glDrawElements 2021-08-14 12:49:29 +02:00
Stephan Unverwerth
e64d0d43d2 LibGL: Implement glDrawArrays 2021-08-14 12:49:29 +02:00
Stephan Unverwerth
b9261ade52 LibGL: Implement glTexCoord4fv 2021-08-14 12:49:29 +02:00
Stephan Unverwerth
f776402632 LibGL: Implement glTexCoordPointer 2021-08-14 12:49:29 +02:00
Stephan Unverwerth
f52f40925c LibGL: Implement glColorPointer 2021-08-14 12:49:29 +02:00
Stephan Unverwerth
07b9cba6e6 LibGL: Implement glVertexPointer 2021-08-14 12:49:29 +02:00
Stephan Unverwerth
886f154c2a LibGL: Implement glEnableClientState and glDisableClientState 2021-08-14 12:49:29 +02:00
Stephan Unverwerth
5f863016ca LibGL: Implement glDepthMask 2021-08-14 12:49:29 +02:00
Stephan Unverwerth
010e344a8e LibGL: Add missing defines needed for glquake 2021-08-14 12:49:29 +02:00
Marcus Nilsson
f080691424 PixelPaint: Disable context menu for GuideTool when no guide is found
Previously the context menu would popup even when closest_guide()
returned nullptr, making the Delete action do nothing.
2021-08-14 12:45:48 +02:00
Marcus Nilsson
1ad08ab7d6 PixelPaint: Show Guides on GuideTool activation
This adds on_tool_activation() to Tool which GuideTool can use
to show guides, if they're hidden, when it's activated. Also
show guides on mousedown since there's no use in drawing invisible
guides.
2021-08-14 12:45:48 +02:00
Marcus Nilsson
3b3df40eb9 PixelPaint: Revert update rect tightening for Selection
Tightening of the update rect when firing the marching ants timer
unfortunately meant that only finalized selections would be redrawn,
and any new selection drawn outside of the update rect would not
update.
2021-08-14 12:45:48 +02:00
Sam Atkins
afc434c416 LibWeb: Remove ValueListStyleValue :^)
This was the whole point of this PR. No more dealing with
ComponentValues in StyleResolver!
2021-08-14 12:45:01 +02:00
Sam Atkins
678760bd87 LibWeb: Parse multiple font-family values
Apart from now gathering comma-separated font-family names into a
StyleValueList, this also corrects the logic for parsing a single
font-family. Previously, we did not handle unquoted font names at all,
and now they are handled including when they are several words separated
by whitespace.

Modified the logic for `font` to use `parse_font_family_value()`.
`FontStyleValue.font_families()` is now a StyleValueList instead of a
vector, so that it can be better handled in StyleResolver.

We also finally remove the CSS::ParsingContext in
set_property_expanding_shorthands(). :^)
2021-08-14 12:45:01 +02:00
Sam Atkins
75450d2250 LibWeb: Handle StyleValueList for background-image
Also removed the string-parsing code I'd accidentally missed removing
before. Oops!
2021-08-14 12:45:01 +02:00
Sam Atkins
6f9263de04 LibWeb: Implement and use BackgroundRepeatStyleValue
This wraps an x and y background-repeat value. Potentially, we could use
this in place of the background-repeat-x and background-repeat-y
pseudo-properties, but for now StyleResolver splits it into those
properties, like it did before.
2021-08-14 12:45:01 +02:00
Sam Atkins
e6c0cb5a7f LibWeb: Implement and use OverflowStyleValue
Also added a test page for the `overflow` properties. They apparently
don't work, but at least they do parse.
2021-08-14 12:45:01 +02:00
Sam Atkins
168865dbdc LibWeb: Implement and use BorderRadiusStyleValue
This parses the elliptical border-radius values, though currently we
only support circular ones. So, to_length() is overloaded to return the
horizontal-radius. This means the code in Layout/Node.cpp does not need
to change for now.
2021-08-14 12:45:01 +02:00
Sam Atkins
cb3e097663 LibWeb: Implement and use BorderStyleValue 2021-08-14 12:45:01 +02:00
Sam Atkins
c27f99fc1d LibWeb: Implement and use FlexFlowStyleValue 2021-08-14 12:45:01 +02:00
Sam Atkins
ab57d7b408 LibWeb: Correct initial values for flex CSS properties
`flex-basis` and `flex-shrink` had different default values than are
dictated in the spec.
2021-08-14 12:45:01 +02:00
Sam Atkins
2644d2c221 LibWeb: Implement and use FlexStyleValue
This is not just moving the code from StyleResolver to Parser. The logic
has changed to allow for the `flex-basis` to come before or after the
`flex-grow/shrink` values, as well as handle the special one-value
cases.

Also added test cases to flex.html to check the parsing. It does parse
correctly, but elements with `flex-basis: auto` do not calculate their
width correctly.
2021-08-14 12:45:01 +02:00
Sam Atkins
44a082391b LibWeb: Implement and use TextDecorationStyleValue
Modified text-decoration.html to better test that the values can be in
any order, and that it adopts the color from the `color` property if no
decoration color is specified. Right now, it always does because we do
not support a different decoration color. Later, we need to support the
`currentcolor` special CSS value for this purpose.
2021-08-14 12:45:01 +02:00
Sam Atkins
0e15561df0 LibWeb: Implement and use ListStyleStyleValue
Yes, the name is silly, but it's a StyleValue for list-style, so...
yeah. :^)

Since `list-style-type` and `list-style-image` can both have `none` as a
value, and can appear in any order, we have to handle it separately, and
then assign either or both of those to `none` depending on how many
`none`s there are, and whether those sub-properties already have values.

Added some extra test cases to lists.html to cover list-style-image and
list-style-position parts of the list-style shorthand, and the `none`
values.
2021-08-14 12:45:01 +02:00
Sam Atkins
dcbfb61816 LibWeb: Implement and use BackgroundStyleValue
This one represents one secton of a `background` property, since it can
have multiple background values separated by commas. Eventually, we will
represent that as a List of BackgroundStyleValues.

Also modified some background-foo properties in StyleResolver so that
the is_background_x() functions could be removed.

I realized that our handling of var() in shorthand properties is wrong,
so have been removing the is_builtin_or_dynamic() calls from the parsing
code for shorthands. This broke our var() test page, so I have replaced
the use of 'background' with 'background-color' there.
2021-08-14 12:45:01 +02:00
Sam Atkins
59501f1940 LibWeb: Implement and use FontStyleValue
After working with the code for a while, it makes more sense to put all
the parsing in Parser, instead of some of it living in StyleResolver.
That means our current ValueListStyleValue needs to be replaced with
specific StyleValue types for the properties that are shorthands or
otherwise combine several values together.

Here we implement FontStyleProperty, which represents a `font` CSS
property.

Also adjusted the fonts.html test page so that font-weights are featured
in test cases without things we do not yet support.
2021-08-14 12:45:01 +02:00
Sam Atkins
5e1fad2dff LibWeb: Use new StyleValueList for simple properties
Also, moved the repeated code for assigning 1-4 values to
top/right/bottom/left properties, into an assign_edge_values() lambda,
for convenience.
2021-08-14 12:45:01 +02:00
Sam Atkins
21c9825caf LibWeb: Implement new StyleValueList
StyleValueList is a list of StyleValues of the same type, for use in
properties like `margin` which accept a variable number of arguments.

I had originally hoped to simply swap the old ValueListStyleValue from
being a list of ComponentValues to one of StyleValues, but I can see now
that I will need to have both for a little while, so renamed the old
is_value_list() to is_component_value_list() temporarily.
2021-08-14 12:45:01 +02:00
Sam Atkins
81527f5eba LibWeb: Add StyleValue.is_builtin() convenience function 2021-08-14 12:45:01 +02:00
Sam Atkins
ed962be0fa LibWeb: Make 'auto' be both a Length and Identifier in CSS
I had accidentally parsed it in `parse_builtin_or_dynamic_value()`
instead of `parse_length()` before, which was confusing, so now it's
parsed along with other Lengths.

Whether it should be a Length is up for debate, and has been tripping me
up a few times, but a lot of code expects it to be one. For now, an
'auto' Length value (or any other value which overloads `is_auto()`)
also claims to be a `ValueID::Auto` identifier.
2021-08-14 12:45:01 +02:00
Sam Atkins
c8c2a8df56 LibWeb: Make '0' always be both a number and a length in CSS
A '0' token can be interpreted both as a Number, and as a Length. This
is problematic as in our CSS parser, we often call parse_css_value()
first, to figure out what something is, and then assign it. So we do not
know in advance whether we want a Length or not. Previously, it always
got parsed as a Length, and then every place that expected a
NumericStyleValue had to also check for a Length(0), which is easy to
forget to do.

In particular, this was causing issues with the `flex` property parsing.

To solve this, we now always parse 0 as a NumericStyleValue, and NSVs of
0 pretend to be a Length(0px) when asked. In two places, we were casting
to a LengthStyleValue* based on is_length(), which no longer works, so
those have been adjusted to use `StyleValue::to_length()` instead. They
also now check for `is_numeric()` first, to avoid the extra conversion
to a Length and back.

Possibly this opens up new issues elsewhere. In my testing it seems
fine, but until we can get CSS test suites running, it's hard to know
for certain.
2021-08-14 12:45:01 +02:00
Itamar
e57fdb63f8 Tests: Add regression tests for the LibCpp preprocessor
Similarly to the LibCpp parser regression tests, these tests run the
preprocessor on the .cpp test files under
Userland/LibCpp/Tests/preprocessor, and compare the output with existing
.txt ground truth files.
2021-08-14 12:40:55 +02:00
Itamar
a38c330c68 LibCpp: Move parser tests to Userland/Libraries/LibCpp/Tests/parser 2021-08-14 12:40:55 +02:00
Itamar
fd864fbb74 Utilities: Add 'file' and 'definitions' arguments to cpp-preprocessor
The 'file' argument allows specifying a file path.
The 'definitions' flag controls whether preprocessor definitions are
printed.
2021-08-14 12:40:55 +02:00
Itamar
f6c9071f0d LibCpp: Evaluate function-like macro calls 2021-08-14 12:40:55 +02:00
Itamar
8505fcb8ae LibCpp: Understand preprocessor macro definition and invocation
The preprocessor now understands when a function-like macro is defined,
and can also parse calls to such macros.

The actual evaluation of function-like macros will be done in a
separate commit.
2021-08-14 12:40:55 +02:00
Itamar
c7d3a7789c LibCpp: Add lexer option to ignore whitespace tokens 2021-08-14 12:40:55 +02:00
Itamar
06e47ce7aa Utilities: Rename PreprocessorTest=>cpp-preprocessor 2021-08-14 12:40:55 +02:00
Andreas Kling
0d21a1307e Profiler: Set the initial size of the timeline container to a snug fit 2021-08-14 01:28:26 +02:00
Andreas Kling
8f590cbeb8 Profiler: Add a "Signposts" tab next to the "Samples" tab
This tab provides a filtered listing of all the signpost events in the
currently selected time range.
2021-08-14 01:28:26 +02:00
Andreas Kling
9a334ebb3a Profiler: Don't lose sight of timeline tracks when zooming out
Update the track sizes before repositioning them. This ensures that they
always remain visible in the timeline container.
2021-08-14 01:28:26 +02:00
Andreas Kling
3cc5308ddc Profiler: Don't include signposts in the samples list 2021-08-14 01:28:26 +02:00
Andreas Kling
2da817615e Profiler: Store signposts in the main event stream
Instead of keeping a separate Vector<Event> for signposts, let them live
in the main event stream. For fast iteration, we instead keep a cache of
the signpost event indices.
2021-08-14 01:28:26 +02:00
Andreas Kling
f5db92448d Profiler: Use AK::Variant for type-specific data in Profile::Event
Each event has a different set of data depending on the event type.
2021-08-14 01:28:26 +02:00
Linus Groh
f51f5e135a LibJS/Tests: Remove outdated FIXME comment 2021-08-13 23:59:22 +01:00
Linus Groh
95059b9549 LibJS/Tests: Enable Proxy handler apply() thisArg test that now passes 2021-08-13 23:57:33 +01:00
Linus Groh
419c21c66f LibJS/Tests: Test iteration order of Map.prototype.entries() 2021-08-13 23:54:08 +01:00
Linus Groh
455b94af7f LibJS/Tests: Test iteration order of Map.prototype.values() 2021-08-13 23:54:02 +01:00
Linus Groh
ea44d9e194 LibJS/Tests: Test iteration order of Map.prototype.keys() 2021-08-13 23:53:40 +01:00
Gunnar Beutner
a1518e870d LibC: Add struct ifconf in net/if.h
This fixes building the scummvm port.
2021-08-13 21:29:48 +02:00
Daniel Bertalan
b2ec579e98 SystemMonitor: Don't fail if we don't have ports installed
In #9373, /usr/local/bin was added to the unveiled directories to make
symbolization work on ports. This directory only exists if at least one
port is installed, so unveil would fail with ENOENT if we had none.
2021-08-13 21:29:10 +02:00
brapru
d456af1cd3 LibCore+LibHTTP: Check the status of the socket after EINPROGRESS
Previously the system would assume the socket was connected after the
file descriptor became writeable. Just because the fd is signaled as
ready for output does not necessarily indicate the socket is connected.
Instead, we should check the status of the socket with SO_ERROR and
handle successes/errors accordingly.
2021-08-13 20:30:19 +04:30
brapru
8059f28977 Utilities: Add program argument for netstat to display connection pid
Adds netstat command line argument to display slash-separated pair of
the id and name of the process that owns the socket. User must have
superuser privileges to see information on non-owned sockets.
2021-08-13 20:03:57 +04:30
Ali Mohammad Pur
15f95220ae AK+Everywhere: Delete Variant's default constructor
This was exposed to the user by mistake, and even accumulated a bunch of
users that didn't blow up out of sheer luck.
2021-08-13 17:31:39 +04:30
Jesse Buhagiar
90e6b9d453 LibGL: Implement glColor3fv 2021-08-13 16:54:37 +04:30
Brian Gianforcaro
27111cfc6c SystemMonitor: Unveil /usr/local/bin so symbolization works on ports 2021-08-13 11:08:38 +02:00
Jean-Baptiste Boric
b6b6add78f LibC: Implement pause function 2021-08-13 03:16:58 +02:00
Jean-Baptiste Boric
f2b8b46bb0 LibC: Implement sigsuspend function 2021-08-13 03:16:58 +02:00
Andreas Kling
7abf58ecaf Profiler: Store event type as enum
Also check for the most common event type (sample) first instead of
leaving it as the fallback. This avoids a lot of string comparisons
while parsing profiles.
2021-08-13 03:06:07 +02:00
Andreas Kling
5a2ccbffc5 Profiler: Remove "Signpost " prefix from timeline tooltips 2021-08-13 03:03:53 +02:00
sin-ack
4c6a97e757 Shell: Make caller specify the string parsing end condition
Heredocs have a different parse end condition than double-quoted
strings. parse_doublequoted_string_inner would assume that a string
would always end in a double quote, so let's generalize it to
parse_string_inner and have it take a StringEndCondition enum which
specifies how the string terminates.
2021-08-13 01:20:35 +04:30
sin-ack
c419b1ade6 Shell: Remove dbgln related to process group IDs
This is insignificant debugging information and will print out during
runs with Lagom.
2021-08-12 22:42:50 +02:00
Liav A
65730f459d SystemServer: Generalize chown_all_framebuffer_devices function
Instead of neatly searching for all framebuffer device nodes and
changing ownership of them, let's generalize this function so we can
apply the same pattern on tty nodes.
2021-08-12 21:10:55 +02:00
Daniel Bertalan
c2c12e9dc5 LibC+DynamicLoader: Prevent GCC from removing null checks
GCC implements `fputc`, `fputs` and `fwrite` as builtin functions, whose
`FILE*` argument is implicitly marked `__attribute__((nonnull))`. This
causes our `VERIFY(stream)` statements to be removed. This does not
happen with Clang, as they do not use the `nonnull` attribute in this
way.
2021-08-12 21:10:44 +02:00
Daniel Bertalan
b19fe744ab LibWeb: Remove pointless type casts
In these cases, the parameters' static type matched the desired dynamic
type, so these calls were discarded.
2021-08-12 21:10:44 +02:00
Daniel Bertalan
f95a11a7da LibC: Don't delete null check in gettimeofday
The `nonnull` attribute may delete null checks in the generated code, as
per the [GCC documentation]:

> The compiler may also perform optimizations based on the knowledge
> that nonnul parameters cannot be null. This can currently not be
> disabled other than by removing the nonnull attribute.

Disassembling the function as compiled by GCC, we can see that there is
no branch based on if `tv` is null.  This means that `gettimeofday`
would produce UB if passed a null parameter, even if we wanted to
predictably return an error.  Clang refuses to compile this due to a
`pointer-bool-conversion` warning.

In this commit, `settimeofday` is changed as well to match
`gettimeofday`'s null argument handling.

[GCC documentation]:
https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-nonnull-function-attribute
2021-08-12 21:10:44 +02:00
Ali Mohammad Pur
8b6397446e LibWasm: Move some Values and Vector<Value>s instead of copying them 2021-08-12 21:03:53 +02:00
Ali Mohammad Pur
fa2ae02564 LibWasm: Avoid calculating stack bounds on each wasm call
We only need to know the initial bounds, which we calculate by default
when the interpreter is constructed.
This cuts down on syscalls and makes wasm calls a lot cheaper.
2021-08-12 21:03:53 +02:00
Ali Mohammad Pur
2b35e9f9be LibWasm: Generate Value::type() on the fly instead of storing it
The variant member already contains enough information to give us the
type when needed, so remove the type member and synthesize it when
needed, this allows lots of optimisation opportunaties when copying and
moving Values around.
2021-08-12 21:03:53 +02:00
Ali Mohammad Pur
4060f18d7e LibWasm: Replace memory write macros with templated functions 2021-08-12 21:03:53 +02:00
Ali Mohammad Pur
b6381f785d LibWasm: Make memory operation address calculation match the spec
...or rather, match what the spec _means_ to say, not what it actually
says.
2021-08-12 21:03:53 +02:00
Ali Mohammad Pur
ad3de4648a LibWasm: Replace memory read macros with templated functions 2021-08-12 21:03:53 +02:00
Ali Mohammad Pur
563b402f04 LibWasm: Replace the numeric operation macros with templated functions
This should make debugging and profiling much better, at little to no
runtime cost.
Also moves off the operator definitions to a separate header, so it
should also improve the editing experience quite a bit.
2021-08-12 21:03:53 +02:00
Liav A
bf1adc2d5d Kernel+LibC: Use 64 bit values for ino_t
Since the InodeIndex encapsulates a 64 bit value, it is correct to
ensure that the Kernel is exposing the entire value and the LibC is
aware of it.

This commit requires an entire re-compile because it's essentially a
change in the Kernel ABI, together with a corresponding change in LibC.
2021-08-12 20:57:32 +02:00
Stephan Unverwerth
e405f436b6 3DFileViewer: Allow zooming via mouse wheel 2021-08-12 20:57:19 +02:00
Stephan Unverwerth
3c509cf2f7 3DFileViewer: Add magnification filters to texture menu 2021-08-12 20:57:19 +02:00
Stephan Unverwerth
00d527bc25 LibGL: Implement GL_LINEAR texture filter 2021-08-12 20:57:19 +02:00
Andreas Kling
00603d9fd0 Revert "HackStudio: Remove noop code when opening the project"
This reverts commit 012fc3f923.
2021-08-12 20:56:54 +02:00
Stephan Unverwerth
75bc7be622 3DFileViewer: Add texture menu
This allows setting different texture wrap modes
and setting different texture coordinate scale factors.
2021-08-12 18:58:41 +02:00
Stephan Unverwerth
b9523e15df LibGL: Implement glTexParameter{i,f}
This currently only implements a subset of this function.
Namely setting wrap, mag and min modes for the GL_TETXURE_2D target.
2021-08-12 18:58:41 +02:00
Stephan Unverwerth
e0fef60241 LibGL: Implement "mirrored repeat" wrap mode 2021-08-12 18:58:41 +02:00
Stephan Unverwerth
8902efa52d LibGL: Implement "clamp" wrap mode 2021-08-12 18:58:41 +02:00
Stephan Unverwerth
12785849aa LibGL: Turn Sampler2D into an actual class
This extracts the sampler functionality into its own class.
Beginning with OpenGL 3 samplers are actual objects, separate
from textures. It makes sense to do this already as it also
cleans up code organization quite a bit.
2021-08-12 18:58:41 +02:00
TheFightingCatfish
fdde19d616 Utilities: Add option to control when to use colored output for grep
Fixes #9351.
2021-08-12 18:57:21 +02:00
Jean-Baptiste Boric
2084289162 Userland: Fix PATH environment variable ordering 2021-08-12 18:56:30 +02:00
Jean-Baptiste Boric
62cd3af5a0 LibC: Add stub forwarders to LibRegex C API
The POSIX C regex functions are expected to live in the C standard
library, but Serenity split off its regex library into LibRegex. Make a
compromise by implementing stub forwarders for the C regex library that
load libregex.so and call the real implementation.

This is needed for ports that expect these C functions to be available
inside the standard C library without introducing a strong coupling
between LibC and LibDl or LibRegex. The non-standard Serenity C++ regex
API still lives inside LibRegex as before.
2021-08-12 18:56:30 +02:00
Karol Kosek
012fc3f923 HackStudio: Remove noop code when opening the project
28b1e66b51 made that
the m_all_editor_wrappers vector is cleared everytime a project path
is changed (the m_project if check is just for the app launch --
the vector is empty there anyway), making the code never execute.
2021-08-12 18:55:58 +02:00
Karol Kosek
a2cb5c862d HackStudio: Show the 'Save as...' dialog when saving uncreated file
Previously when user wanted to save an uncreated file, the program
would just quietly ignore the save request, without giving any message.
This can be seen when creating a new editor in split view mode.
2021-08-12 18:54:57 +02:00
Karol Kosek
8516b9532e HackStudio: Add 'Save as...' action
Not adding it to the toolbar, because it has the same icon as
a typical 'Save' action.
2021-08-12 18:54:57 +02:00
Karol Kosek
8a4bb581a2 HackStudio: Show text editor after starting the application
The user can now start typing text instead of creating a file first.

This also enables drag-and-dropping a file as soon as the application
starts.
2021-08-12 18:54:25 +02:00
Gunnar Beutner
e4f0795ae4 LibELF+LibTest: Fix incorrect #ifdef 2021-08-12 08:16:07 +02:00
Jean-Baptiste Boric
9b2cc9580b Userland: Add partial support for complex specifications to tr 2021-08-12 00:41:13 +02:00
Jean-Baptiste Boric
310eb72f72 Userland: Add support for --delete flag as alias of -d to tr 2021-08-12 00:41:13 +02:00
Jean-Baptiste Boric
89ba022ede Userland: Add support for -c/--complement flag to tr 2021-08-12 00:41:13 +02:00
Jean-Baptiste Boric
7f2d3df906 Userland: Add support for multiple character translations to tr 2021-08-12 00:41:13 +02:00
Andreas Kling
0c39f8128d LibTest: Emit a profile signpost at the start of each test
This makes it super easy to see which test is which when browsing a
profile of the test runner. :^)
2021-08-12 00:03:39 +02:00
Andreas Kling
1e90a3a542 Kernel: Make sys$perf_register_string() generate the string ID's
Making userspace provide a global string ID was silly, and made the API
extremely difficult to use correctly in a global profiling context.

Instead, simply make the kernel do the string ID allocation for us.
This also allows us to convert the string storage to a Vector in the
kernel (and an array in the JSON profile data.)
2021-08-12 00:03:39 +02:00
Andreas Kling
56e84a63ca LibJS: Emit a profile signpost when starting a garbage collection 2021-08-12 00:03:39 +02:00
Andreas Kling
3ed6c137df Profiler: Parse and render signpost strings
The first perf_event argument to a PERF_EVENT_SIGNPOST is now
interpreted as a string ID (in the profile strings set.)

This allows us to generate signposts with custom strings. :^)
2021-08-12 00:03:39 +02:00
Andreas Kling
4657c79143 Kernel+LibC: Add sys$perf_register_string()
This syscall allows userspace to register a keyed string that appears in
a new "strings" JSON object in profile output.

This will be used to add custom strings to profile signposts. :^)
2021-08-12 00:03:39 +02:00
Andreas Kling
00b11d7577 Profiler: Parse and paint profile signpost events :^)
Signposts generated by perf_event(PERF_EVENT_SIGNPOST) now show up in
profile timelines, and if you hover them you get a tooltip with the two
arguments passed with the event.
2021-08-12 00:03:38 +02:00
Andreas Kling
9ae8cd823c profile: Always enable PERF_EVENT_SIGNPOST 2021-08-12 00:03:38 +02:00
Andreas Kling
0d997d48ea Kernel+LibC: Add PERF_EVENT_SIGNPOST
This event will be used by userspace programs wanting to mark
interesting high-level events in the profile. :^)
2021-08-12 00:03:38 +02:00
Linus Groh
84053816d5 LibJS: Use Checked<T> for offsets in the SetViewValue AO
Fixes #9338.
2021-08-11 22:56:58 +01:00
Linus Groh
6fc0b2a43d LibJS: Use Checked<T> for offsets in the GetViewValue AO
Fixes #9336.
2021-08-11 22:56:58 +01:00
Federico Guerinoni
b2a849935b LibIPC: Pass only message size to decoder
Fixes #9015.
2021-08-11 18:28:59 +02:00
Timothy Flynn
df14d11a11 LibRegex: Disallow invalid interval qualifiers in Unicode mode
Fixes all remaining 'built-ins/RegExp/property-escapes' test262 tests.
2021-08-11 13:11:01 +02:00
Timothy Flynn
a98d3a1a85 LibUnicode: Download and parse DerivedNormalizationProps UCD file
This file contains the last properties that LibUnicode is not parsing.
Much of the data in this file is not currently used; that is left as a
FIXME for when String.prototype.normalize is implemented. Until then,
only the code point properties are utilized for regular expression
pattern escapes.
2021-08-11 13:11:01 +02:00
Timothy Flynn
1e91334008 LibUnicode: Handle edge-case script extensions, Common and Inherited
These script extensions have some peculiar behavior in the Unicode spec.
The UCD ScriptExtension file does not contain these scripts. Rather, it
is implied the code points which have these scripts as an extension are
the code points that both:

  1. Have Common or Inherited as their primary script value
  2. Do not have any other script value in their script extension lists

Because these are not explictly listed in the UCD, we must manually form
these script extensions.
2021-08-11 13:11:01 +02:00
Timothy Flynn
47bb350ebd LibUnicode: Generate separate tables for scripts and script extensions
Notice that unlike the note in populate_general_category_unions(),
script extension do indeed have code point ranges which overlap. Thus,
this commit adds code to handle that, and hooks it into the GC unions.
2021-08-11 13:11:01 +02:00
Timothy Flynn
e6e462249f LibUnicode: Generate *_from_string methods using a hash map
Rather than a long series of string comparisons, generate each of these
methods using a hash map of the enumeration name to its value.
2021-08-11 13:11:01 +02:00
Timothy Flynn
5ac23d244d LibUnicode: Generate separate tables for Unicode properties
Similar to General Categories, this generates separate tables for the
Property list.
2021-08-11 13:11:01 +02:00
Timothy Flynn
b06c104076 LibUnicode: Include Unassigned code points in the Other General Category
Now that the generator parses unassigned General Category properties, it
can include Unassigned (Cn) in the Other (C) category.
2021-08-11 13:11:01 +02:00
Timothy Flynn
7dce2bfe23 LibUnicode: Generate separate tables for General Category properties
Previously, each code point's General Category was part of the generated
UnicodeData structure. This ultimately presented two problems, one
functional and one performance related:

  * Some General Categories are applied to unassigned code points, for
    example the Unassigned (Cn) category. Unassigned code points are
    strictly excluded from UnicodeData.txt, so by relying on that file,
    the generator is unable to handle these categories.

  * Lookups for General Categories are slower when searching through the
    large UnicodeData hash map. Even though lookups are O(1), the hash
    function turned out to be slower than binary searching through a
    category-specific table.

So, now a table is generated for each General Category. When querying a
code point for a category, a binary search is done on each code point
range in that category's table to check if code point has that category.

Further, General Categories are now parsed from the UCD file
DerivedGeneralCategory.txt. This file is a normal "prop list" file and
contains the categories for unassigned code points.
2021-08-11 13:11:01 +02:00
Timothy Flynn
4e546cee97 LibUnicode: Remove WordBreakProperty from generated Unicode data
This was originally used for the "is_final_code_point" algorithm in
LibUnicode/CharacterTypes.cpp. However, it has since been superseded by
DerivedCoreProperties and is now unused. Remove it as it is currently a
waste of time to process the data, and is trivial to add back if we need
it again.
2021-08-11 13:11:01 +02:00
Karol Kosek
b1bc5532e7 HackStudio: Make "Open project" action open in the current project path
Prior this change, the action opened a File Picker
in user home directory.

Changing the startup path to a project path might make correcting
the path or switching between different projects a bit faster,
as you don't have to go through the subdirectories all over again.
It's also the path that's showed in the project tree view.
2021-08-11 01:50:33 +02:00
Ali Mohammad Pur
3ad2f1bfd1 Profiler: Disassemble the entire function if the symbol is a function
Previously the view would've cut off at the last instruction that was
hit in the profile, which is not the right behaviour for functions.
2021-08-10 23:19:33 +02:00
Timothy Flynn
b85b8ca350 LibJS: Reduce UTF-8 to UTF-16 transcoding when only UTF-16 is wanted
When appending two strings together to form a new string, if both of the
strings are already UTF-16, create the new string as UTF-16 as well.

This shaves about 0.5 seconds off the following test262 test:
  RegExp/property-escapes/generated/General_Category_-_Decimal_Number.js
2021-08-10 23:07:50 +02:00
Timothy Flynn
66264f7c2a LibJS: Change ExecutionContext's arguments list to a MarkedValueList
The test262 tests under RegExp/property-escapes/generated will invoke
Reflect.apply with up to 10,000 arguments at a time. In LibJS, when the
call stack reached VM::call_internal, we transfer those arguments from
a MarkedValueList to the execution context's arguments Vector.

Because these types differ (MarkedValueList is a Vector<Value, 32>), the
arguments are copied rather than moved. By changing the arguments vector
to a MarkedValueList, we can properly move the passed arguments over.

This shaves about 2 seconds off the following test262 test (from 15sec):
  RegExp/property-escapes/generated/General_Category_-_Decimal_Number.js
2021-08-10 23:07:50 +02:00
Timothy Flynn
34bd25f6c2 LibJS: Reduce copying of string data in RegExp.prototype
In addition to invoking js_string() with existing UTF-16 strings when
possible, RegExpExec now takes a Utf16String instead of a Utf16View. The
view was previously fully copied into the returned result object, so
this prevents potentially large copies of string data.
2021-08-10 23:07:50 +02:00
Timothy Flynn
6c45620709 LibJS: Reduce copying of string data in String.prototype
The primary themes here are invoking js_string() with existing instances
of Utf16String when possible, and not creating entire UTF-8 copies when
not needed.
2021-08-10 23:07:50 +02:00
Timothy Flynn
c1e99fca1a LibJS: Replace Vector<u16> usage in PrimitiveString wth Utf16String
This commit does not go out of its way to reduce copying of the string
data yet, but is a minimum set of changes to compile LibJS after making
PrimitiveString hold a Utf16String.
2021-08-10 23:07:50 +02:00
Timothy Flynn
02e7dceb96 LibJS: Add a simple reference-counted UTF-16 string
To help alleviate memory usage when creating and copying large strings,
create a simple wrapper around a Vector<u16> to reference count UTF-16
strings.
2021-08-10 23:07:50 +02:00
sin-ack
309a20c014 LibGUI: Draw a focus rect over the row when sel. behavior is SelectRows 2021-08-10 21:56:47 +02:00
sin-ack
b6ef12bd26 Profiler: Use SelectionBehavior::SelectRows
Profiler uses the TreeView in a tabular fashion, and so should set the
selection behavior appropriately.
2021-08-10 21:56:47 +02:00
sin-ack
158629d1c4 LibGUI: Partially restore original TreeView column painting behavior
TreeView now prints columns mostly like it used to. The paddings are now
properly applied, though. focus_rect drawing has been gated behind a
selection_behavior() check to make sure we don't draw a focus rect
around the column text when we're supposed to draw it over the entire
row.
2021-08-10 21:56:47 +02:00
sin-ack
8c1a6a8436 LibGUI: Default TreeView to SelectionBehavior::SelectItems
AbstractTableView (which TreeView inherits from) sets the selection
behavior of the view to SelectRows. This is not how TreeViews are used
in most of the system, and TreeView::paint_event actually always draws
with the assumption of selecting individual items. This commit defines
the expected selection behavior for TreeViews. Users of TreeView can
still override this via TreeView::set_selection_behavior.
2021-08-10 21:56:47 +02:00
Jean-Baptiste Boric
0286160b62 Kernel: Add syscall performance event type
This allows tracing the syscalls made by a thread through the kernel's
performance event framework, which is similar in principle to strace.

Currently, this merely logs a stack backtrace to the current thread's
performance event buffer whenever a syscall is made, if profiling is
enabled. Future improvements could include tracing the arguments and
the return value, for example.
2021-08-10 21:55:48 +02:00
Andreas Kling
afa225f55c LibC: Use CLOCK_REALTIME_COARSE for gettimeofday()
This doesn't need to use our highest-precision timestamp.
2021-08-10 21:51:05 +02:00
Liav A
16979bec15 SystemServer: Change group ownership on all framebuffer devices
WindowServer was not able to utilize any other framebuffer device in the
/dev directory due to wrong group ownership of other framebuffer
devices. Therefore we need to ensure that when SystemServer starts,
it checks all directory entries in /dev, searching for framebuffer
devices, and then apply the correct ownership for them.
2021-08-10 21:30:53 +02:00
Gunnar Beutner
f424485193 LaunchServer: Make sure launching absolute symlinks works
This was broken by 31d659d.
2021-08-10 20:17:34 +02:00
Andreas Kling
02f9ffeb7f UserspaceEmulator: Fail sys$map_time_page() with ENOSYS for now
This allows LibC to fall back to sys$clock_gettime() until we can
add support for the kernel time page to UserspaceEmulator.
2021-08-10 19:21:16 +02:00
Andreas Kling
fdfc66db61 Kernel+LibC: Allow clock_gettime() to run without syscalls
This patch adds a vDSO-like mechanism for exposing the current time as
an array of per-clock-source timestamps.

LibC's clock_gettime() calls sys$map_time_page() to map the kernel's
"time page" into the process address space (at a random address, ofc.)
This is only done on first call, and from then on the timestamps are
fetched from the time page.

This first patch only adds support for CLOCK_REALTIME, but eventually
we should be able to support all clock sources this way and get rid of
sys$clock_gettime() in the kernel entirely. :^)

Accesses are synchronized using two atomic integers that are incremented
at the start and finish of the kernel's time page update cycle.
2021-08-10 19:21:16 +02:00
Andreas Kling
f02d73db4d LibC+Kernel: Use an enum for clockid_t values 2021-08-10 13:01:39 +02:00
Andreas Kling
fa64ab26a4 Kernel+UserspaceEmulator: Remove unused sys$gettimeofday()
Now that LibC uses clock_gettime() to implement gettimeofday(), we can
get rid of this entire syscall. :^)
2021-08-10 13:01:39 +02:00
Andreas Kling
5f6e0e0162 LibC: Implement gettimeofday() in terms of clock_gettime(CLOCK_REALTIME) 2021-08-10 13:01:39 +02:00
sin-ack
1be59d663a Mandelbrot: Only recalculate missing areas after panning
We can reuse the areas that we have from before and just recalculate
the areas that are fresh. This makes panning super smooth. :^)
2021-08-10 09:48:12 +02:00
sin-ack
d28802ad22 Mandelbrot: Add panning
Adds the ability to use the middle-mouse click to pan the current view.
2021-08-10 09:48:12 +02:00
sin-ack
faec8bbe45 Mandelbrot: Add mousewheel zooming
This allows the user to zoom in with a up scroll of the mousewheel and
zoom out with a down scroll.
2021-08-10 09:48:12 +02:00
sin-ack
a08dd5b99c Mandelbrot: Use a GUI::Frame to paint into
This allows us to have a frame border which looks nicer.
2021-08-10 09:48:12 +02:00
LuK1337
31d659d9a0 LaunchServer: Resolve symlinks when querying for handler application
This lets us launch proper handler application for symlinks :^)
2021-08-10 05:26:36 +04:30
sin-ack
51d559e253 Spreadsheet: Call SheetModel::update() instead of invalidate()
SheetModel has its own custom updating method, and that must be called
in order to update the spreadsheet.
2021-08-10 05:21:49 +04:30
Ali Mohammad Pur
369e3da6a2 UserspaceEmulator: Move all the profiling details into the Emulator
Them being in the global namespace doesn't have a lot of fans, it seems.
2021-08-10 05:13:44 +04:30
Ali Mohammad Pur
2128ae4ab0 Profiler: Disassemble the containing function for non-function symbols
This can happen if the symbol is part of a switch-case, and not
a function, which would previously have made the disassembly view
appear empty.
Now we disassemble the containing function, starting at the given label
and continuing up until the last captured instruction.
2021-08-10 05:13:44 +04:30
Ali Mohammad Pur
4bef63fa6a Profiler: Show the symbol address in object file 2021-08-10 05:13:44 +04:30
Ali Mohammad Pur
64ccf2196c UserspaceEmulator+LibC: Add support for Region-of-Interest profiling 2021-08-10 05:13:44 +04:30
Daniel Bertalan
18b2484985 LibELF: Remove (FlatPtr)something.as_ptr() idiom
This is equivalent to `something.get()`, but more verbose.
2021-08-09 23:15:48 +02:00
Daniel Bertalan
e0e3198d51 LibELF: Fix 'applying offset produced null pointer' UBSAN failure
These integer => pointer => integer conversions were technically prone
to UB, since they were used as offsets (which are perfectly fine to be
zero), but we calculated them with pointer arithmetic. This made Clang
insert pointer overflow UBSAN checks, which trigger in case of a zero
result.
2021-08-09 23:15:48 +02:00
Tetsui Ohkubo
1479ee3f3e LaunchServer: Do not provide file handlers for special files
With this change, LaunchServer will always return an empty list of file
handlers for special files e.g. sockets and devices. Before this change,
TextEditor was always returned as a default handler for these files.
2021-08-09 22:50:09 +02:00
Tobias Christiansen
2a77abf85e Everywhere: Use tobyase@serenityos.org for my copyright headers 2021-08-09 21:43:05 +02:00
davidot
e1573991a3 LibJS: Fix this values in arrow functions
Also added a large this value test (and strict variant) to ensure this
values have no regressions.
2021-08-09 17:33:14 +01:00
davidot
151447bdf7 LibJS: Move Object::invoke to Value::invoke and fix it for primitives
This is a tiny difference and only changes anything for primitives in
strict mode. However this is tested in test262 and can be noticed by
overriding toString of primitive values.

This does now require one to wrap an object in a Value to call invoke
but all code using invoke has been migrated.
2021-08-09 17:33:14 +01:00
Mandar Kulkarni
b0ff91ff09 Spreadsheet: Make convert_from_string() return Optional<size_t>
Earlier, we were using 0 value for characters not found in "map".

We should return failure for invalid inputs.
So, I have changed the return type of function to Optional<size_t>.

Also changed caller to handle Optional return.
2021-08-09 14:14:07 +04:30
Mandar Kulkarni
2c44f2dc3c Spreadsheet: Fix column index string to number conversion
Fixed convert_from_string() function to return correct output.
The value of a number is equal to sum of each digit multiplied by it's
positional weight.
2021-08-09 14:14:07 +04:30
Marcus Nilsson
b1b6a6d6e8 PixelPaint: Let Tools have different cursors
This adds support for the Tools in PixelPaint to use different cursors
within ImageEditor. For now most of them get the crosshair cursor since
it's the most fitting, but in the future we will want to add custom
cursors.
2021-08-09 00:57:44 +02:00
Linus Groh
312946059b LibJS+Spreadsheet: Use js_string(VM&, ...) overload more 2021-08-08 21:32:58 +01:00
Linus Groh
97010d4903 LibJS: Implement Intl[@@toStringTag] 2021-08-08 20:14:59 +01:00
Linus Groh
44a8b55c50 LibJS: Add preparation for Intl constructors and prototypes
Add a JS_ENUMERATE_INTL_OBJECTS macro and use it to generate:

- Forward declarations
- CommonPropertyNames class name members
- Constructor and prototype GlobalObject members, getters, visitors,
  and initialize_constructor() calls
2021-08-08 20:14:59 +01:00
Linus Groh
a37dcf8ca7 LibJS: Add the Intl namespace object :^)
This is the start of implementing ECMA-402 in LibJS, better known as the
ECMAScript Internationalization API.

Much like Temporal this gets its own subdirectory (Runtime/Intl/) as
well as a new C++ namespace (JS::Intl) so we don't have to prefix all
the files and classes with "Intl".

https://tc39.es/ecma402/
2021-08-08 20:14:59 +01:00
Linus Groh
7d8c182359 LibJS: Implement Temporal.PlainYearMonth.prototype.getISOFields() 2021-08-08 17:45:06 +01:00
Linus Groh
5a260fcad1 LibJS: Implement Temporal.PlainYearMonth.prototype.valueOf() 2021-08-08 17:45:06 +01:00
Linus Groh
d9ed0f1f47 LibJS: Implement Temporal.PlainYearMonth.prototype.inLeapYear 2021-08-08 17:45:06 +01:00
Linus Groh
3592a748b6 LibJS: Implement Temporal.PlainYearMonth.prototype.monthsInYear 2021-08-08 17:45:06 +01:00
Linus Groh
703eb1f7b4 LibJS: Implement Temporal.PlainYearMonth.prototype.daysInMonth 2021-08-08 17:45:06 +01:00
Linus Groh
1f1d7144bf LibJS: Implement Temporal.PlainYearMonth.prototype.daysInYear 2021-08-08 17:45:06 +01:00
Linus Groh
5ec70792fd LibJS: Implement Temporal.PlainYearMonth.prototype.monthCode 2021-08-08 17:45:06 +01:00
Linus Groh
0edec6578b LibJS: Implement Temporal.PlainYearMonth.prototype.month 2021-08-08 17:45:06 +01:00
Linus Groh
c947ba9ed9 LibJS: Implement Temporal.PlainYearMonth.prototype.year 2021-08-08 17:45:06 +01:00
Linus Groh
71eca69d7c LibJS: Implement Temporal.PlainYearMonth.prototype.calendar 2021-08-08 17:45:06 +01:00
Linus Groh
d8e835d22f LibJS: Implement Temporal.PlainYearMonth.prototype[@@toStringTag] 2021-08-08 17:45:06 +01:00
Linus Groh
4d3af45efb LibJS: Handle PlainYearMonth in the Calendar.prototype getters 2021-08-08 17:45:06 +01:00
Linus Groh
e2f016dc81 LibJS: Handle PlainYearMonth in ISO{Year,Month,MonthCode,Day} 2021-08-08 17:45:06 +01:00
Linus Groh
4ba5df7145 LibJS: Handle PlainYearMonth in GetTemporalCalendarWithISODefault 2021-08-08 17:45:06 +01:00
Linus Groh
2aec6653c4 LibJS: Handle PlainYearMonth in ToTemporalCalendar 2021-08-08 17:45:06 +01:00
Linus Groh
0a8edd5ce7 LibJS: Start implementing Temporal.PlainYearMonth
This commit adds the PlainYearMonth object itself, its constructor and
prototype (currently empty), and the CreateTemporalYearMonth and
ISOYearMonthWithinLimits abstract operations.
2021-08-08 17:45:06 +01:00
Linus Groh
5b12542d39 LibJS: Fix Vector<Value> => MarkedValueList in calendar_fields()
We need to ensure the temporary PrimitiveString cells don't get GC'd.
2021-08-08 17:45:06 +01:00
Linus Groh
53c44bea00 LibJS: Mark getters of more Temporal objects [[nodiscard]]
PlainDate, PlainTime, and PlainDateTime already do this. All the others
should as well.
2021-08-08 17:45:06 +01:00
Gunnar Beutner
aabbfa78e2 DynamicLoader: Make sure we don't link against libgcc_s
This bug was reintroduced by the removal of -fbuilding-gcc.
2021-08-08 16:41:51 +02:00
sin-ack
07f5e12568 WidgetGallery: Change model update() functions to invalidate()
These functions reload the whole model contents and thus can be moved to
invalidate(), which saves us from the need to manually call update() on
them.
2021-08-08 14:45:23 +02:00
Andreas Kling
2c1788e2e4 FileOperation: Don't follow symlinks
Deleting a symlink via "FileOperation Delete" should not recursively
delete whatever the symlink is pointing to. Same basic idea applies to
the Copy and Move operations.
2021-08-08 14:24:54 +02:00
sin-ack
8c9c2f46c7 LibGUI: Implement granular updates for FileSystemModel
FileSystemModel will now react to specific events from Core::FileWatcher
in order to granularly update its data based on addition or removal of
files from the tree. Metadata changes are currently not handled, but in
the future they can be used to re-stat() a file to get its updated
statistics.
2021-08-08 14:13:37 +02:00
sin-ack
e377b508b7 LibGUI: Prefix some private FileSystemModel::Node members with m_
This commit has no functional changes.
2021-08-08 14:13:37 +02:00
sin-ack
265e2832ef LibGUI: Resize the mapping rows during sort
SortingProxyModel always expected the source model to have the same
number of rows as long as it has not been invalidated. Now that we have
granular updates, this assumption is no longer true, and we need to
resize the source/proxy_rows vectors to the new size. This is safe since
the values in the vector are overwritten right afterwards.
2021-08-08 14:13:37 +02:00
sin-ack
7ba321c91b LibGUI: Implement granular operations for Model subclasses
These can be used by Model subclasses to signal the exact operations
that happened to a model, so that persistent model indices in that
area are not invalidated.
2021-08-08 14:13:37 +02:00
sin-ack
d73116e5d5 LibGUI: Implement persistent indices for models
This patch adds persistent indices to models.  A PersistentModelIndex is
a ModelIndex that will survive most model updates (provided that the
data the PersistentModelIndex points to has not been removed by the
model's data store).  PersistentModelIndex objects can be safely held
by objects outside the model they originated from.
2021-08-08 14:13:37 +02:00
sin-ack
1408aa1295 LibGUI: Do not allow tree column to shrink beyond indent and icon
We always display the tree indent and the icon, so we shouldn't allow
the tree column to shrink beyond that size.
2021-08-08 14:12:45 +02:00
sin-ack
ab2719fd53 LibGUI: Let the table view tell HeaderView about the min. section size
Previously HeaderView would just assume that each column or row could
have a minimum size of 2. This makes it so that AbstractTableView
subclasses can provide a new minimum value for a specific column.
2021-08-08 14:12:45 +02:00
Marcus Nilsson
854e16797e PixelPaint: Tighten update rects for Tools
This tightens the update rects for EraseTool, BrushTool And the marching
ants update in Selection. Inflate Selection update rect by 10x10 to
avoid misalignment when zoomed out.
2021-08-08 13:55:39 +02:00
Marcus Nilsson
8c81d195c7 PixelPaint: Inflate update rect for PenTool
Previously using PenTool while zoomed in could cause rendering glitches
since the update rect was misaligned with the image, most likely because
of rounding errors.
Loosening the rect with 1 pixel on either side takes care of this.
2021-08-08 13:55:39 +02:00
sin-ack
99dfab08c9 LibGUI: Correctly call update() in ProcessChooser
After the update -> invalidate change a couple places broke when
update() was supposed to be manually called. This instance was not
marked virtual or override, which made it hard to detect. This commit
makes sure that update() on the original model is called when the
RunningProcessesModel needs an update.
2021-08-08 13:46:27 +02:00
Linus Groh
16c38788c3 LibJS: Add missing spec links 2021-08-08 11:04:30 +01:00
Daniel Bertalan
0e21bf0f23 LibJS: Don't overflow size_t in Value::to_length()
Although this is not spec-compliant, we don't have a way to represent
objects larger than `NumericLimits<size_t>::max()`. Since this abstract
operation is only used when dealing with object size, we don't lose any
functionality by taking that limit into account too.

This fixes a UBSAN error when compiling with Clang.
2021-08-08 10:55:36 +02:00
Daniel Bertalan
78e7ff008b LibC: Fix negation overflow UB in sys/mman.cpp
When the system calls return `NumericLimits<ptrdiff_t>::min()`, negating
the return code would produce `NumericLimits<ptrdiff_t>::max() + 1`
since we are on a two's complement architecture. Because this value
cannot be stored, signed overflow occurs which is UB. This can be fixed
by applying the negation to `EMAXERRNO` since that's known to contain a
relatively small value.

Found when running tests with Clang.
2021-08-08 10:55:36 +02:00
Daniel Bertalan
12dc2c2079 LibJS: Fix wraparound UB in Value::to_u{8,16}
If we call these two functions on a negative value, undefined behavior
occurs due to casting a negative double to an unsigned integer. These
functions are defined to perform modular arithmetic, so negative values
can be fixed up by adding 2^8/2^16.

The reason why this step is not mentioned in ECMA-262 is that it defines
modular arithmetic so that `x mod m` had the same sign as `m`, while
LibM's `fmod(x, m)` copies `x`'s sign.

This issue was found by UBSAN with the Clang toolchain.
2021-08-08 10:55:36 +02:00
Daniel Bertalan
0a05f04d1b LibJS: Fix UB in Number.IsSafeInteger
Casting a floating point number to an integer and comparing that against
the original value is not a good way to test if it is a whole number. It
may cause unnecessary narrowing conversion issues and UB. This was the
case, which was caught be Clang's `-fsanitize=float-cast-overflow`.

This commit changes the code to use `is_integral_number`, as suggested
in ECMA-262.
2021-08-08 10:55:36 +02:00
Daniel Bertalan
fd76e71934 LibJS: Fix UB in Math.clz32
If the argument to this function is greater then or equal to 2^32, the
`double` => `u32` cast produces undefined behavior, which Clang catches.
To fix this, we now use `ToUint32` for getting the integer argument, as
specified by ECMA-262.
2021-08-08 10:55:36 +02:00
Daniel Bertalan
653d22e21f LibSanitizer+AK: Add float cast overflow handler
This is not enabled by default in GCC, but is in Clang.
2021-08-08 10:55:36 +02:00
Daniel Bertalan
3a8b8d8a0b SystemMonitor: Remove unused this lambda captures
This fixes an `unused-lambda-capture` warning emitted by Clang, and
reduces the size of the produced lambda object.
2021-08-08 10:55:36 +02:00
Daniel Bertalan
13e3df41de Meta: Add Clang support to the CMake build scripts 2021-08-08 10:55:36 +02:00
Daniel Bertalan
6de392e120 LibWeb: Add missing typeinfo include
Not having this header only causes an issue on Clang builds, since in
libc++, `std::type_info` is only forward-declared in `cxxabi.h`.
2021-08-08 10:55:36 +02:00
Daniel Bertalan
e9dd9d1f2c UserspaceEmulator: Use for_each_region_of_type in find_text_region
Since we now have this helper template, we can make our code cleaner.
2021-08-08 10:55:36 +02:00
Daniel Bertalan
c1d6637dc7 UserspaceEmulator: Make symbolication work when .text isn't the first
... segment

This happens with binaries build with Clang or with a custom linker
script. If this is the case, offsets should be calculated not from the
base address of `.text`, but from the first section loaded for the
library.

This commit moves all UserspaceEmulator symbolication into a common
helper function and fixes a FIXME.
2021-08-08 10:55:36 +02:00
Daniel Bertalan
980f314a03 UserspaceEmulator: Fix typo in a method name
Changes `load_library_from_adress` to `load_library_from_address`.
2021-08-08 10:55:36 +02:00
Daniel Bertalan
7396e4aedc LibDebug: Store 64-bit numbers in AttributeValue
This helps us avoid weird truncation issues and fixes a bug on Clang
builds where truncation while reading caused the DIE offsets following
large LEB128 numbers to be incorrect. This removes the need for the
separate `LongUnsignedNumber` type.
2021-08-08 10:55:36 +02:00