Commit Graph

6745 Commits

Author SHA1 Message Date
Sam Atkins
f9ffa34622 LibWeb: Remove broken CSS:Parser::is_combinator()
A single DELIM token is only one character long, so the check for
a "||" DELIM didn't work. We now just do the check inline.
2021-07-11 23:19:56 +02:00
Sam Atkins
9115c23bd5 LibWeb: Fix greedy CSS Tokenizer whitespace parsing
Whitespace parsing was too greedy, consuming the first non-
whitespace character after it.
2021-07-11 23:19:56 +02:00
Sam Atkins
06fc099310 LibWeb: Fix Off-by-one error in CSS::Parser::next_token() 2021-07-11 23:19:56 +02:00
Sam Atkins
06cd418770 LibWeb: Convert QualifiedStyleRule to a RefPtr type in new Parser 2021-07-11 23:19:56 +02:00
Sam Atkins
f690259a42 LibWeb: Add new CSS attribute match types to new parser 2021-07-11 23:19:56 +02:00
Sam Atkins
7fefe34797 LibWeb: Add remaining CSS AttributeMatchTypes
This adds:
- ContainsString     [att*=val]
- StartsWithSegment  [att|=val]
- StartsWithString   [att^=val]
- EndsWithString     [att$=val]

Renamed AttributeMatchType::Contains to ::ContainsWord for clarity.
2021-07-11 23:19:56 +02:00
Sam Atkins
29d78bba4b LibWeb: Use StyleComponentValueRules for StyleBlockRule's values
Noticed while doing this that attribute selectors have two different
ways of saying "starts with", and so AttributeMatchType::StartsWith
needs a better name. But I'll change that when I add the missing
types.

These class names are a mouthful to fit in a commit message. :^)
2021-07-11 23:19:56 +02:00
Sam Atkins
89bfde29dc LibWeb: Convert some CSS parser *Rule classes to using pointers
Previously these were all passed around by value, but some of them
(StyleComponentValueRule and StyleBlockRule) want to include each
other as fields, so this had to change.
2021-07-11 23:19:56 +02:00
Sam Atkins
a558916e1f LibWeb: Make CSS selector parsing use StyleComponentValueRules
Also added some pseudo-classes that were handled in the deprecated
parser:
- :disabled
- :enabled
- :checked
- :nth-child
- :nth-last-child
- :not
2021-07-11 23:19:56 +02:00
Sam Atkins
f7c79de0c5 LibWeb: Add convenience methods to CSS::Parser::Token
Some of these will be removed later, when we move to using is()
exclusively.
2021-07-11 23:19:56 +02:00
Sam Atkins
d6b4022b58 LibWeb: Make CSS::QualifiedStyleRule's prelude StyleComponentValueRule 2021-07-11 23:19:56 +02:00
Linus Groh
54e1180f61 LibJS: Uncomment Number.isInteger() tests that now pass :^) 2021-07-11 22:03:04 +01:00
Linus Groh
1856400547 LibJS: Uncomment Object.{freeze,seal}() tests that now pass :^) 2021-07-11 21:58:14 +01:00
Ali Mohammad Pur
dfb7e716f7 LibJS: Use expected() instead of syntax_error("Expected ...") 2021-07-11 21:41:54 +01:00
Ali Mohammad Pur
049e210cfa LibJS: Rework Identifier parsing to match the spec more closely 2021-07-11 21:41:54 +01:00
Ali Mohammad Pur
77a5144264 LibJS: Add support for binding patterns in catch clauses
`try { ... } catch({a=foo}) {}` is valid, and now we parse and evaluate
it correctly :^)
2021-07-11 21:41:54 +01:00
Ali Mohammad Pur
1a9518ebe3 LibJS: Implement parsing and evaluation for AssignmentPatterns
e.g. `[...foo] = bar` can now be evaluated :^)
2021-07-11 21:41:54 +01:00
Ali Mohammad Pur
7fc6cd6b20 LibJS: Allow 'name = value' in object literals as the spec does
Currently, these are _always_ a syntax error, future commits will make
it valid in certain contexts.
2021-07-11 21:41:54 +01:00
Ali Mohammad Pur
7dae25eceb LibJS: Fix computed property ending token in binding pattern parsing
The syntax is supposed to be '[expression]', not '[expression['.
2021-07-11 21:41:54 +01:00
Ali Mohammad Pur
b5b84029ab LibJS: Treat default parameter values as being in function context
e.g. `new.target` should be permitted in
`function foo(x = new.target) {}`.
2021-07-11 21:41:54 +01:00
Jelle Raaijmakers
0f35912bd7 TableView: Do not select input on keydown
In the Spreadsheet app, selecting a cell and typing something (like
"1") would create an empty editing delegate, set "1" as its value and
immediately select the entire contents of the text box. If your goal
was to type "123", that "1" was selected and will be replaced by "23".

This changes the behavior of TableView to not select the editing
delegate's contents if its creation was a result of a keydown event.
2021-07-11 22:07:57 +02:00
Karol Kosek
9d36369c58 SoundPlayer: Show the context menu right under the cursor
The context menu used the mouse position by window,
which resulted in a pop-up menu in the upper left corner of the screen.
2021-07-11 21:15:56 +02:00
Andrew Kaster
2ca1193d9a Userland+Tests: Convert test_io to be LibTest based
Add a few extra tests as well, to make sure we don't have any future
TmpFs regressions.
2021-07-11 19:42:00 +02:00
Andrew Kaster
4cc75501d7 Utilities+Tests: Convert test_efault to be LibTest based
This test exposed a kernel panic in is_user_range calculations, so let's
convert it to be a LibTest test so we can prevent regressions in mmap,
the page allocator, and the memory manager.
2021-07-11 19:42:00 +02:00
Hendiadyoin1
a8d86cc533 DynamicLoader+LibC: Make _start a naked function 2021-07-11 17:07:20 +02:00
Adam Hodgen
47bfd366a8 LibWeb: Fix syntax for Table test
The parser fixes this by inserting the <tr> tags, but for this test it's
better to have perfect syntax - we're not testing the parser here.
2021-07-11 14:14:01 +02:00
Adam Hodgen
3e46e8fea8 LibWeb: Fix HTMLTable Element attributes
`Element::tag_name` return an uppercase version of the tag name. However
the `Web::HTML::TagNames` values are all lowercase.

This change fixes that using `Element::local_name`, which returns a
lowercase value.
2021-07-11 14:14:01 +02:00
LuK1337
99013ac3d5 LibTTF: Port width calculation changes from BitmapFont 2021-07-11 14:12:59 +02:00
LuK1337
c0f9adabd6 LibGfx: Try to get TTF font when query is not in name->font map
This change allows us to select TTF fonts in display settings again :^)
2021-07-11 14:12:47 +02:00
Timothy
c03353e7ca TextEditor: Show an error message when opening a file failed 2021-07-11 14:11:53 +02:00
Gunnar Beutner
71840c1bf4 TextEditor: Open files with ReadOnly when we're just reading them 2021-07-11 14:11:53 +02:00
Gunnar Beutner
c343e9a4fd TextEditor: Avoid calling realpath()
We can't use realpath() at that point because we've already called
unveil(nullptr, nullptr).
2021-07-11 14:11:53 +02:00
Karol Kosek
a90c484d4b Pong: Only paint areas that needs to be updated 2021-07-11 14:11:26 +02:00
Adam Hodgen
a3638639a1 TextEditor: Show an error dialog when failing to open/save a file 2021-07-11 09:46:50 +02:00
Adam Hodgen
643ecfee73 FileSystemAccessServer: Return user_picked_value even on error
If a user picks a file which can't be opened for some reason, we should
still return the value, so client applications can report the error
along with the chosen filepath.
2021-07-11 09:46:50 +02:00
Timothy Flynn
dd65f52331 FlappyBug: Only paint areas which need to be painted
Drawing the entire PNG background is rather expensive. Instead, only
draw the rects that are updating.
2021-07-10 23:28:20 +02:00
Itamar
b5a02b180c LibCpp: Use fast_is<T> and verify_cast<T> to replace C-style casts
Thanks to @alimpfard for suggesting this :)
2021-07-10 21:58:28 +02:00
Itamar
34fc6c7e1c LibCpp: Make the fields of AST node types private
Previously almost all fields were public and were directly accessed by
the Parser and CppComprehensionEngine.

This commit makes all fields of AST node types private. They are now
accessed via getters & setters.
2021-07-10 21:58:28 +02:00
FalseHonesty
d60bd42972 LibVideo/VP9: Implement MV reading & rectify MV storage issues
With this patch we are finally done with section 6.4.X of the spec :^)
The only parsing left to be done is 6.5.X, motion vector prediction.

Additionally, this patch fixes how MVs were being stored in the parser.
Originally, due to the spec naming two very different values very
similarly, these properties had totally wrong data types, but this has
now been rectified.
2021-07-10 21:28:56 +02:00
FalseHonesty
27fdf8361c LibVideo/VP9: Finish implementing block decoding (6.4.4)
Though technically block decoding calls into some other incomplete
methods, so it isn't functionally complete yet. However, we are
very close to being done with the 6.4.X sections :)
2021-07-10 21:28:56 +02:00
FalseHonesty
074fbd1b06 LibVideo/VP9: Implement parsing Token and MoreCoefs trees
These elements were being used in the new tokens implementation, so
support for them in the TreeParser has been added.

Additionally, this uncovered a bug where the nonzero contexts were
being cleared with the wrong size.
2021-07-10 21:28:56 +02:00
FalseHonesty
aa27ca1b16 LibVideo/VP9: Implement token parsing (6.4.24-6.4.26)
Note that this now requires a couple new syntax types to be parsed
in the TreeParser, so a follow-up commit will implement that behavior.
2021-07-10 21:28:56 +02:00
FalseHonesty
d79c9c262f LibVideo/VP9: Implement sections 6.1.2 and 8.4.1-8.4.4
These section implement the behavior to refresh the probability
tables after parsing a frame.
2021-07-10 21:28:56 +02:00
FalseHonesty
cf6b3d0ce9 LibVideo/VP9: Begin reference frame update process (8.10)
This was required for correctly parsing more than one frame's
height/width data properly. Additionally, start handling failure
a little more gracefully. Since we don't fully parse a tile before
starting to parse the next tile, we will now no longer make it past
the first tile mark, meaning we should not handle that scenario well.
2021-07-10 21:28:56 +02:00
FalseHonesty
514559f074 LibVideo/VP9: Rename Decoder -> Parser & create an actual Decoder class
The class that was previously named Decoder handled section 6.X.X of
the spec, which actually deals with parsing out the syntax of the data,
not the actual decoding logic which is specified in section 8.X.X.
The new Decoder class will be in charge of owning and running the
Parser, as well as implementing all of the decoding behavior.
2021-07-10 21:28:56 +02:00
FalseHonesty
66628053d4 LibVideo/VP9: Start parsing residuals (6.4.21-6.4.23)
Additionally, this uncovered a couple bugs with existing code,
so those have been fixed. Currently, parsing a whole video does
fail because we are now using a new calculation for frame width,
but it hasn't been fully implemented yet.
2021-07-10 21:28:56 +02:00
FalseHonesty
cbff7c386a LibVideo/VP9: Refactor how above & left contexts are stored & cleared
These make more sense as Vectors, and it makes it much easier to manage
their sizing.
2021-07-10 21:28:56 +02:00
FalseHonesty
91572a49c4 LibVideo/VP9: Specify which spec section defines certain behaviors 2021-07-10 21:28:56 +02:00
FalseHonesty
ce524214c9 LibVideo/VP9: Clean up formatting & use range-based for loops 2021-07-10 21:28:56 +02:00
FalseHonesty
559f5a087d LibVideo/VP9: Implement simple FIXMEs that use now supported data 2021-07-10 21:28:56 +02:00
FalseHonesty
e4f015ce3d LibVideo/VP9: Implement more TreeParser probability calculations
Now TreeParser has mostly complete probability calculation
implementations for all currently used syntax elements. Some of these
calculation methods aren't actually finished because they use data
we have yet to parse in the Decoder, but they're close to finished.
2021-07-10 21:28:56 +02:00
FalseHonesty
f85f557a1f LibVideo/VP9: Implement syntax element counting for supported elements
With the progress made in the Decoder thus far, we have the ability
to support most of the syntax element counters in the tree parser.

Additionally, it will now crash when trying to count unsupported
elements.
2021-07-10 21:28:56 +02:00
Tom
83b512789c WindowServer: Flush display buffer when flashing
If the device requires a flush and we modify the front buffer, we need
to flush those changes to the front buffer. This makes the flashing
work using the VirtIOGPU.

Also fix a minor bug where we flushed the front buffer instead of
the back buffer after flipping, which caused the VirtIOGPU to not work
as expected when using the SDL backend and disabling buffer flipping.
2021-07-10 21:24:52 +02:00
Marcus Nilsson
e718de454e PixelPaint: Check modifier on mousemove in LineTool
Previously m_constrain_angle could end up not being reset if the
keyup-event was lost, for example when opening a dialog. Instead check
the modifiers in on_mousemove().
2021-07-10 21:23:36 +02:00
Karol Kosek
5836710e8f SpaceAnalyzer: Show folder total size 2021-07-10 21:23:11 +02:00
Linus Groh
674f3d0347 LibJS: Pad abs(year) < 1000 with zeros in Date.prototype.toString() 2021-07-10 19:51:07 +01:00
Linus Groh
a647f0abf6 LibJS: Make parse_simplified_iso8601() use Optional<int> instead of -1
...for the non-success state. This fixes a crash when parsing dates with
the year -1, as we would assert successful parsing ("year != -1").
Mixing Optional and -1 seems worse and more complicated than just using
Optional for all the values, so I did that instead.
2021-07-10 19:51:07 +01:00
Linus Groh
39cdffd78d LibJS: Make Date.now() return a floor()'d milliseconds value
It is defined as follows:

    21.4.3.1 Date.now ( )
    https://tc39.es/ecma262/#sec-date.now

    The now function returns the time value designating the UTC date and
    time of the occurrence of the call to now.

"Time value" is defined as:

    21.4.1.1 Time Values and Time Range
    https://tc39.es/ecma262/#sec-time-values-and-time-range

    An ECMAScript time value is a Number, either a finite integral
    Number representing an instant in time to millisecond precision or
    NaN representing no specific instant.

By flooring the value we match the behavior in the Temporal proposal's
Temporal.ZonedDateTime.prototype.epochMilliseconds getter:

    4. Let ms be RoundTowardsZero(ℝ(ns) / 10^6).

With that being defined as:

    13.30 RoundTowardsZero ( x )
    https://tc39.es/proposal-temporal/#sec-temporal-roundtowardszero

    1. Return the mathematical value that is the same sign as x and
    whose magnitude is floor(abs(x)).

This is makes the last of the currently 15 Temporal tests in test262
work, which compares Temporal.now.instant() with Date.now() :^)
2021-07-10 19:51:07 +01:00
Ali Mohammad Pur
a5bc366d9a expr: Make Match expressions comply with POSIX
They should print the contents of capture group 1, if it exists.
2021-07-10 23:14:08 +04:30
Ali Mohammad Pur
11a8476cf4 LibRegex: Use the parser state capture group count in BRE
Otherwise the users won't know how many capture groups are in the
parsed regular expression.
2021-07-10 23:14:08 +04:30
Ali Mohammad Pur
1c584e9d80 LibRegex: Correctly parse BRE bracket expressions
Commonly, bracket expressions are in fact, enclosed in brackets.
2021-07-10 22:58:24 +04:30
Nico Weber
1c69c686e3 chres: Make screen an optional parameter
Most people have only one screen.
2021-07-10 18:51:14 +01:00
Nico Weber
8cf348c14c chres: Unbreak scale factor setting after aa15bf81e4 2021-07-10 18:51:14 +01:00
Aziz Berkay Yesilyurt
9b0ff229e3 Utilities: Use alpha channel instead of opacity in shot
The way overlay was drawn is not the correct way to achieve window
transparency in selection mode. With this change, shot window becomes
truely transparent.
2021-07-10 21:22:25 +04:30
Andreas Kling
b368560800 LibGUI: Only repaint the affected indices on AbstractView item hover
Previously, moving the cursor over items in an item view would cause it
to repaint itself completely. Now we only repaint the two affected
items (the old hovered item and the new hovered item.)
2021-07-10 18:30:46 +02:00
Andreas Kling
df96380121 LibGUI: Tighten paint invalidation rects in item views :^)
AbstractView now has a paint_invalidation_rect(index) function that
subclasses can override to provide a tighter invalidation rect for
an index.
2021-07-10 18:30:46 +02:00
Andreas Kling
148e72bfa0 LibGUI: Add AbstractView::editing_rect() to allow custom editing rects
This allows view classes to customize the editing rect for an index.
2021-07-10 18:30:46 +02:00
Timothy Flynn
6c67de8186 LibJS: Implement RegExp.prototype.hasIndices proposal
https://tc39.es/proposal-regexp-match-indices/
2021-07-10 16:49:35 +01:00
Timothy Flynn
d1e06b00e3 LibJS: Parse the RegExp.prototype.hasIndices flag 2021-07-10 16:49:35 +01:00
Timothy Flynn
e801cc7afd LibJS: Remove ECMAScriptFlags value from JS_ENUMERATE_REGEXP_FLAGS
All regex flags supported by LibJS currently correspond to a LibRegex
option, but this is not the case for the RegExp.prototype.hasIndices
proposal, which is handled entirely in RegExpBuiltinExec. Remove the
flag mapping to prepare for this. This incurs a bit of an optimization
loss in the flag getters, as we now do a substring search, but we can
revisit the getter implementation if it becomes an issue.
2021-07-10 16:49:35 +01:00
Timothy Flynn
6cd966c1e1 LibJS: Implement RegExp.prototype.source according to the spec
RegExp.prototype.source must check if "this" object is the
RegExp.prototype object before raising a TypeError.
2021-07-10 16:49:35 +01:00
Timothy Flynn
2f6eec1322 LibJS: Implement RegExp.prototype.<flag name> according to the spec
The flag getters (e.g. RegExp.prototype.unicode) must specially handle
when "this" object is the RegExp.prototype object.
2021-07-10 16:49:35 +01:00
Idan Horowitz
75541c48b5 LibJS: Add Temporal.Instant.prototype.valueOf 2021-07-10 15:39:47 +01:00
Idan Horowitz
ac8e76be23 LibJS: Add a couple of missing specification links to Temporal.Instant 2021-07-10 15:39:47 +01:00
Andreas Kling
42fab36f02 FontEditor: Tweak offensive padding :^) 2021-07-10 16:13:44 +02:00
Andreas Kling
234d53a324 Terminal: Put debug spam in unimplemented_control_code() behind a flag 2021-07-10 16:13:34 +02:00
Timothy
3c3e5ffe2f TextEditor: Remove unused includes 2021-07-10 15:33:46 +02:00
Timothy
73226a2861 LibGUI: Convert TextEditor to east-const style 2021-07-10 15:33:46 +02:00
Timothy
a3c8005546 TextEditor: Convert to east-const style 2021-07-10 15:33:46 +02:00
Timothy
73ae5200a9 TextEditor+LibGUI: Use unveil and FileSystemAccessServer
Making use of the new FileSystemAccessServer we are able to use
unveil without restricting our ability to open and save files.
A file argument will be unveiled automatically however all other files
require user action via the FileSystemAccessServer to gain access.
2021-07-10 15:33:46 +02:00
Timothy
41ce2debda FileSystemAccessServer: Add service for accessing veiled files nicely
Adds new service FileSystemAccessServer which allows programs to
request a file descriptor for any file on the file system.

The user can be prompted to choose the path with a FilePicker, or the
path can be provided by the application which will show a MessageBox
showing the pid and name of the calling process and allows the user to
approve or deny the request.
2021-07-10 15:33:46 +02:00
LuK1337
5e823d3de0 Taskbar: Scale window icon bitmap if it's not 16x16
Fixes: #5806
2021-07-10 14:04:21 +01:00
Ali Mohammad Pur
eca74088a0 grep: Use Basic POSIX regexps by default and make -E not the default 2021-07-10 13:33:08 +02:00
Ali Mohammad Pur
97f7132b82 expr: Use Basic Posix regular expressions
Dr.POSIX requires expr to use BREs, so let's use BREs.
Fixes #8506.
2021-07-10 13:33:08 +02:00
Ali Mohammad Pur
daa6d99e6e LibRegex: Add support for non-extended regular expressions in regcomp()
Fixes part of #8506.
2021-07-10 13:33:08 +02:00
Ali Mohammad Pur
54d89609de LibRegex: Add support for the Basic POSIX regular expressions
This implements the internal regex stuff for #8506.
2021-07-10 13:33:08 +02:00
Ali Mohammad Pur
addfa1e82e LibRegex: Make the bytecode transformation functions static
They were pretty confusing when compared with other non-transforming
functions.
2021-07-10 13:33:08 +02:00
Andreas Kling
f670adb298 LibWeb: Avoid HashMap copy in BrowsingContext::set_frame_nesting_levels 2021-07-10 13:24:46 +02:00
Ralf Donau
821b752993 Userland: Add fopen error handling to less 2021-07-10 10:32:01 +02:00
networkException
2e4be5e98c LibGUI: Rename "to_gmousebutton" => "to_mouse_button" 2021-07-10 09:31:01 +02:00
Gunnar Beutner
b11fe40240 LibELF: Make sure calls to _fixup_plt_entry use a properly aligned stack 2021-07-10 01:41:57 +02:00
Gunnar Beutner
06883ed8a3 Kernel+Userland: Make the stack alignment comply with the System V ABI
The System V ABI for both x86 and x86_64 requires that the stack pointer
is 16-byte aligned on entry. Previously we did not align the stack
pointer properly.

As far as "main" was concerned the stack alignment was correct even
without this patch due to how the C++ _start function and the kernel
interacted, i.e. the kernel misaligned the stack as far as the ABI
was concerned but that misalignment (read: it was properly aligned for
a regular function call - but misaligned in terms of what the ABI
dictates) was actually expected by our _start function.
2021-07-10 01:41:57 +02:00
Andreas Kling
f4a318ee2d LibGUI: Only repaint grabbable part of Splitter when hovered/unhovered
Before this change, we would repaint the Splitter and all of its split
children when hovering over it. Now we only repaint the grabbable part.
2021-07-10 01:40:51 +02:00
Daniel Bertalan
05c174b45a LibVT: Reset scrollbar after switching to/from the alternate buffer
We did not call the history change callback after switching to the
alternate screen buffer, which caused the scrollbar to not change its
maximum value. If we already had lines in the scrollback buffer, this
meant that we could drag the scrollbar, which then tried to access
non-existent lines from the scrollback.

Fixes #8581
2021-07-10 01:23:23 +02:00
LuK1337
5e1e67277b LibGUI: Remove left margin on MessageBox text when icon is unset
It looks better when text is properly centered.
2021-07-09 23:36:34 +02:00
Idan Horowitz
a44de7a55f LibJS: Add %TypedArray%.prototype.toLocaleString 2021-07-09 22:32:25 +01:00
Idan Horowitz
56d8098d13 LibJS: Use PropertyName instead of StringOrSymbol in Object::invoke()
This prevents the unnecessary PropertyName -> StringOrSymbol ->
PropertyName conversion.
2021-07-09 22:32:25 +01:00
Andreas Kling
fd898be51a PixelPaint: Only update the layer thumbnail on layer bitmap changes
When a layer bitmap is modified, we don't have to repaint the whole
layer gadget in the layer list, only the little thumbnail. :^)
2021-07-09 22:07:00 +02:00
Andreas Kling
285f0383d4 PixelPaint: Move LayerListWidget gadget rect computation to a function
This will allow functions other than paint_event() to use the various
gadget rects (thumbnail, text, etc.)
2021-07-09 22:07:00 +02:00
Andreas Kling
1cec672e69 PixelPaint: Remove unused member from LayerListWidget::Gadget 2021-07-09 22:07:00 +02:00
Andreas Kling
0ef3cf7b0f PixelPaint: Call correct base class in LayerListWidget::resize_event() 2021-07-09 22:07:00 +02:00
Andreas Kling
bce1d633ca PixelPaint: Make PenTool invalidate even less when drawing :^) 2021-07-09 22:07:00 +02:00
Andreas Kling
5439453139 LibGfx: Improve Painter::draw_line() alignment with (thickness > 1)
Thicker lines are drawn by filling rectangles along the path.
Previously these rectangles used the points as their top left corner.
This patch changes it to use the points as the center of the rectangles
which makes the PixelPaint line tool feel a lot more natural. :^)
2021-07-09 22:07:00 +02:00
Gunnar Beutner
5662e72126 LibC: Make sure crt0 and crt0_shared are built before LibC
We need these two object files in order for ld to work.

Fixes #4538.
2021-07-09 21:56:21 +02:00
Timothy Flynn
e4124d0218 LibJS: Implement RegExp.prototype [ @@split ] 2021-07-09 19:45:55 +01:00
Timothy Flynn
43918b0104 LibJS: Implement RegExpBuiltinExec closer to the spec
Our RegExpBuiltinExec implementation differed from the spec in some
areas such as handling of the sticky/global flags and updating the
lastIndex property.
2021-07-09 19:45:55 +01:00
Timothy Flynn
0f0ac37b56 LibRegex: Break from execution loop when the sticky flag is set
If the sticky flag is set, the regex execution loop should break
immediately even if the execution was a failure. The specification for
several RegExp.prototype methods (e.g. exec and @@split) rely on this
behavior.
2021-07-09 19:45:55 +01:00
Timothy Flynn
3892b6e6ec LibJS: Implement RegExp constructor according to the spec
This allows passing an existing RegExp object (or an object that is
sufficiently like a RegExp object) as the "pattern" argument of the
RegExp constructor.
2021-07-09 19:45:55 +01:00
Timothy Flynn
2686c5f503 LibJS: Do not use "this" object in RegExpExec
As an abstraction, RegExpExec should not assume that the RegExp object
being used is "this" object. Instead, it should only interact with the
provided object.

This prepares for some methods, such as @@split, which invoke RegExpExec
with a secondary RegExp object.
2021-07-09 19:45:55 +01:00
Timothy Flynn
1d19649a19 LibJS: Remove accidental dead code 2021-07-09 19:45:55 +01:00
Max Wipfli
5af4f8041f LibGfx: Add "override" declarations and use east const in BitmapFont.h 2021-07-09 20:17:07 +02:00
Max Wipfli
006e5998c5 LibGfx: Optimize BitmapFont::unicode_view_width() a bit
This optimizes the method to no longer compare if width > longest_width
on every iteration, since it's only required on CR/LF or at the end.
2021-07-09 20:17:07 +02:00
Max Wipfli
4578ab3ed0 LibGfx: ALWAYS_INLINE BitmapFont::unicode_view_width
This adds the ALWAYS_INLINE attribute to unicode_view_width. Also, it
cleans up the BitmapFont::view() code a little bit. This should help
performance of this hot code. Because the call to the width() methods is
a virtual dispatch, it doesn't help to inline the width() methods
themselves.
2021-07-09 20:17:07 +02:00
Max Wipfli
2afa35deb8 LibGfx: Remove unused headers from BitmapFont.{cpp,h} 2021-07-09 20:17:07 +02:00
LuK1337
a552c3bc8c LibTTF: Use en-us naming table if available
Some fonts tend to have multiple naming tables, namely MS-Gothic has
3 tables: [macintosh, ja], [windows, en-us], [windows, ja].
2021-07-09 20:16:33 +02:00
Jean-Baptiste Boric
934e53079f Utilities: Add ability to query specific user with id 2021-07-09 20:15:40 +02:00
Jean-Baptiste Boric
538cc9d99a Utilities: Use Core::Account for id 2021-07-09 20:15:40 +02:00
Jean-Baptiste Boric
16983dbe8e LibCore: Add ability to not read shadow data for Account
This stops spamming the kernel logs with unveil violations if the
program didn't unveil /etc/shadow.
2021-07-09 20:15:40 +02:00
Jean-Baptiste Boric
fdf638dde0 LibCore: Implement Account::self() 2021-07-09 20:15:40 +02:00
Jean-Baptiste Boric
3db1681214 Utilities: Fix return value of expr 2021-07-09 20:15:40 +02:00
Jean-Baptiste Boric
897a706075 Utilities: Add support for -d flag to tr 2021-07-09 20:15:40 +02:00
Jean-Baptiste Boric
eb65e41a9c Utilities: Implement pwd 2021-07-09 20:15:40 +02:00
LuK1337
f234c416af LibGUI: Handle TTF size selection changes in font picker properly
This patch addresses the following issues:
- size resetting to 1 when switching from bitmap font size 10 to TTF
- size resetting to 1 when incrementing spinbox from 8 to 9
- selection mode not being set on m_size_list_view selection change
2021-07-09 18:15:05 +02:00
Andreas Kling
e0a79efeae LibGfx: Make enclosing_int_rect(FloatRect) actually enclose the rect 2021-07-09 18:05:52 +02:00
Marcus Nilsson
c59c970363 PixelPaint: Don't deselect layers in LayerListWidget
There is really no reason to be able to deselect layers, so just ignore
when the user clicks outside of a layer gadget.
2021-07-09 18:04:01 +02:00
Marcus Nilsson
95710b0147 PixelPaint: Make sure that a layer is always selected
Make sure that a layer is selected after creating it, removing
one or creating a new image. Also make layer_properties_widget
update on tab change.
2021-07-09 18:04:01 +02:00
Marcus Nilsson
f3cdb9bfeb PixelPaint: Only scroll into view in LayerListWidget when needed
This makes sure that scroll_into_view is not called when not necessary,
or when m_layers is empty, which previously caused a crash upon
removing the last layer.
2021-07-09 18:04:01 +02:00
Daniel Bertalan
0e04f7cf1e LibVT: Always check intermediate bytes in CSI sequences
Previously, we only checked the intermediate bytes for those escape
sequences that performed different operations based on their
intermediate bytes. This lead to a crash when `CSI ?1001 r` was
incorrectly parsed as `CSI Pt ; Pb r` (note the missing question mark),
as seen in #8559.
2021-07-09 20:28:17 +04:30
Idan Horowitz
52aa777d49 LibJS: Add %TypedArray%.prototype.sort 2021-07-09 16:15:42 +01:00
Idan Horowitz
f98a98506f LibJS: Add %TypedArray%.prototype.subarray 2021-07-09 16:15:42 +01:00
Idan Horowitz
ff052a3241 LibJS: Add %TypedArray%.prototype.slice 2021-07-09 16:15:42 +01:00
Idan Horowitz
8127e30169 LibJS: Split detached buffer checking into validate_typed_array
Not all of the TypedArray prototype methods and accessors require
detached buffer validation (only the ones who call ValidateTypedArray)
so this behaviour was split from typed_array_from and the usage was
updated per the spec in each location.
2021-07-09 16:15:42 +01:00
Ali Mohammad Pur
727403746f LibC: Make makedev()/minor()/major() static
As we've opted to make these inline functions and not macros, let's at
least make sure that the users don't *observe* multiple definitions of
these functions.
2021-07-09 15:36:50 +02:00
Ali Mohammad Pur
e37f9fa7db LibPthread+Kernel: Add pthread_kill() and the thread_kill syscall 2021-07-09 15:36:50 +02:00
Linus Groh
ca71d99c66 LibJS: Implement Temporal.Instant.fromEpochNanoseconds() 2021-07-09 13:20:51 +01:00
Linus Groh
5872357b56 LibJS: Implement Temporal.Instant.fromEpochMicroseconds() 2021-07-09 13:20:51 +01:00
Linus Groh
66ff772254 LibJS: Implement Temporal.Instant.fromEpochMilliseconds() 2021-07-09 13:20:51 +01:00
Linus Groh
2401e45720 LibJS: Implement Temporal.Instant.fromEpochSeconds() 2021-07-09 13:20:51 +01:00
Linus Groh
9c9813c312 LibJS: Replace useless use of SignedBigInteger::create_from() with ctor
create_from() casts the value to a 64 bit integer and then creates two
words from it, which is not necessary if we only pass values to it that
fit into a single word (32 bit integer).
Also make them use UnsignedBigInteger as the previously missing SBI
divided_by() overload is now implemented.
2021-07-09 13:20:51 +01:00
Linus Groh
a216ea4c8d LibCrypto: Add missing implementation of SBI::divided_by(USBI) 2021-07-09 13:20:51 +01:00
Linus Groh
3014e529be LibJS: Tweak error message in the NumberToBigInt abstract operation
This is no longer specific to the BigInt() constructor, so it shouldn't
be mentioning an 'argument' that we might not have.
2021-07-09 13:20:51 +01:00
Linus Groh
9f2dd89446 LibJS/Tests: Add tests for Date.prototype.toTemporalInstant() 2021-07-09 13:20:51 +01:00
Andreas Kling
e5a1e535cc LibC: Re-run clang-format on malloc.cpp 2021-07-09 14:14:22 +02:00
Andreas Kling
19cb5ed97a LibC: Simplify locking in malloc
- Use a simple pthread_mutex_t instead of bringing in headers from
  LibThreading just to get a mutex.

- Use a normal mutex instead of a recursive one.

- Remove redundant locking in realloc().
2021-07-09 13:47:32 +02:00
Andreas Kling
b8a204c5b9 LibThreading: Rename Lock => Mutex 2021-07-09 11:15:50 +02:00
Andreas Kling
ce5d2b4f16 LibThreading: Remove unused "Lockable" class 2021-07-09 11:15:50 +02:00
Luke
1da06f9dfd LibJS: Add %TypedArray%.prototype.map 2021-07-09 10:15:45 +01:00
Luke
bc6f619344 LibJS: Add TypedArraySpeciesCreate and %TypedArray%.prototype.filter
I'm not too happy with how I get the default constructor in
typed_array_species_create, but it works for now.
2021-07-09 10:15:45 +01:00
Luke
53bc3f8e3b LibJS: Move typed_array_create to TypedArray.{h,cpp}
This is to make it accessible from TypedArrayPrototype, for use with
typed_array_species_create.
2021-07-09 10:15:45 +01:00
Aziz Berkay Yesilyurt
9b4729dd40 Userland: Add ability to capture rectangular region in shot
A click and drag selectable, transparent, fullscreen window is
displayed with the command line argument -r for screenshots.
2021-07-09 13:33:46 +04:30
Aziz Berkay Yesilyurt
dc833e49b0 WindowServer: Paint background when a fullscreen window is transparent
The windows in the background are ignored when the window is fullscreen.
However, we still would like to see the background if that window is
transparent.
2021-07-09 13:33:17 +04:30
Aziz Berkay Yesilyurt
6f594b36f5 LibGUI: Verify m_window_id is not-zero in set_maximized
Window::set_maximized requires non-zero window id to be a valid call,
i.e. calling Window::show beforehand. A verify statement before the
server call can help developers by hinting correct usage.
2021-07-09 13:32:30 +04:30
Ali Mohammad Pur
0459a111b2 Revert "Userland: Add ability to screenshot rectangular region in shot (#8515)"
This reverts commit 1c06d77262.
This was squashed by mistake, the rebased version will follow.
2021-07-09 13:27:56 +04:30
Aziz Berkay Yesilyurt
1c06d77262
Userland: Add ability to screenshot rectangular region in shot (#8515)
* LibGUI: Verify m_window_id is not-zero in set_maximized

Window::set_maximized requires non-zero window id to be a valid call,
i.e. calling Window::show beforehand. A verify statement before the
server call can help developers by hinting correct usage.

* LibGUI: Paint background when the fullscreen window is transparent

The windows in the background are ignored when the window is fullscreen.
However, we still would like to see the background if that window is
transparent.

* Userland: Add ability to capture rectangular region in shot

A click and drag selectable, transparent, fullscreen window is
displayed with the command line argument -r for screenshots.
2021-07-09 13:11:24 +04:30
Aziz Berkay Yesilyurt
ec389adaa6 ImageViewer: Use real path for the image path
By using the real path for the image, ImageViewer can iterate over the
images in the same directory. Before, this was not possible when
ImageViewer opened from Terminal with a path argument.
2021-07-09 10:22:26 +02:00
Aziz Berkay Yesilyurt
f62f53f723 ImageViewer: Use LexicalPath to grab current_dir 2021-07-09 10:22:26 +02:00
Aziz Berkay Yesilyurt
dd476c35cb ImageViewer: Don't resize the window after the first image is displayed 2021-07-09 10:22:26 +02:00
Linus Groh
6531485251 LibJS/Tests: Add tests for Temporal.Instant() constructor 2021-07-08 23:08:27 +01:00
Linus Groh
117323f2d9 LibJS: Implement Temporal.Instant.prototype.epochNanoseconds 2021-07-08 23:08:27 +01:00
Linus Groh
b5d0cdc97e LibJS: Implement Temporal.Instant.prototype.epochMicroseconds 2021-07-08 23:08:27 +01:00
Linus Groh
b157ab3f12 LibJS: Implement Temporal.Instant.prototype.epochMilliseconds 2021-07-08 23:08:27 +01:00
Linus Groh
5010e01223 LibJS: Implement Temporal.Instant.prototype.epochSeconds 2021-07-08 23:08:27 +01:00
Linus Groh
dad336c944 LibJS: Implement Temporal.Instant.prototype[@@toStringTag] 2021-07-08 23:08:27 +01:00
Linus Groh
439b35dc7d LibJS/Tests: Add tests for Temporal.TimeZone() constructor 2021-07-08 23:08:27 +01:00
Linus Groh
51c581f604 LibJS: Implement Temporal.TimeZone.prototype.id 2021-07-08 23:08:27 +01:00
Linus Groh
7f0fe352e2 LibJS: Implement Temporal.TimeZone.prototype.toJSON() 2021-07-08 23:08:27 +01:00
Linus Groh
8d00504ff2 LibJS: Implement Temporal.TimeZone.prototype.toString() 2021-07-08 23:08:27 +01:00
Linus Groh
2e968700aa LibJS: Implement Temporal.TimeZone.prototype[@@toStringTag] 2021-07-08 23:08:27 +01:00
Andrea Martinelli
ab1caad1e9 Taskbar: Make clicks at the edges and corners work as expected
This makes it easy for the user to just throw the mouse at the corner
of the screen and obtain the desired outcome (eg. opening the start
menu), without having to precisely position the cursor over one of the
buttons.
2021-07-08 22:45:40 +02:00
networkException
dac7b25b8a WindowServer: Add missing minimize check to highlighted window callback
This patch adds a missing minimize check for highligted windows in
WindowStack::for_each_visible_window_of_type_from_front_to_back().
Minimized windows should not be treated as visible in this context.

Previously, iterating through each visible Window when recomputing
occlusions in the Compositor would cause a crash if a highlighted
Window is also minimized at the same time. As the WindowSwitcher
currently highligts Windows even when they are minimized, opening
it while any Window is minimized would cause WindowServer to crash.
2021-07-08 22:31:21 +02:00
Marcus Nilsson
791a018c99 PixelPaint: Add method to merge visible layers
This adds a function that merges all visible layers to one, ignoring the
invisible.
2021-07-08 20:16:26 +02:00
Marcus Nilsson
0900e31fe0 PixelPaint: Scroll into view when reordering layers
Make LayerListWidget scroll into view when reordering layers.
2021-07-08 20:16:26 +02:00
Marcus Nilsson
618bb2d33e PixelPaint: Make brush draw on mousedown
This makes the brush tool start drawing a point before the user moves
the mouse, like in Photoshop and Gimp. The number of iterations of
draw_point makes for roughly 4 clicks to full opacity.
2021-07-08 20:16:26 +02:00
Marcus Nilsson
9be08e33ea PixelPaint: Add method to flatten image layers
This adds Image::flatten_all_layers() that allows the user to flatten
all the visible layers into one.
2021-07-08 20:16:26 +02:00
networkException
76a18e1172 WindowServer: Remove rect behind window icon in WindowSwitcher
This patch removes the background behind window icons
in the WindowSwitcher which looked like it was being
rendered incorrectly (without alpha) previously.
2021-07-08 20:15:23 +02:00
pancake
390d3e9fbe
LibVT: Ignore DECSTBM with invalid values (#8559)
Co-authored-by: pancake <pancake@nopcode.org>
2021-07-08 22:41:55 +04:30
Idan Horowitz
241f9f21d4 LibJS: Add %TypedArray%.prototype.reduceRight 2021-07-08 16:30:09 +01:00
Idan Horowitz
2356382938 LibJS: Add %TypedArray%.prototype.reduce 2021-07-08 16:30:09 +01:00
Idan Horowitz
f0abcde00c LibJS: Add %TypedArray%.prototype.lastIndexOf 2021-07-08 16:30:09 +01:00
Idan Horowitz
6343bfa9d7 LibJS: Add %TypedArray%.prototype.indexOf 2021-07-08 16:30:09 +01:00
Idan Horowitz
da49a7a9f8 LibJS: Add %TypedArray%.prototype.includes 2021-07-08 16:30:09 +01:00
Idan Horowitz
3b9886949f LibJS: Add %TypedArray%.prototype.fill 2021-07-08 16:30:09 +01:00
Idan Horowitz
a9de3b1d8f LibJS: Add missing a TypedArray excessive length limit check
These checks already existed for the 3 other TypedArray construction
methods. (This commit also fixes an incorrect type in one of them)
2021-07-08 16:30:09 +01:00
Luke
c7a839bb24 LibJS: Add %TypedArray%.prototype.copyWithin
This fixes 44 test262 cases.
2021-07-08 15:12:52 +01:00
Jan de Visser
23ad4bcdf7 Utilities: Teach sql utility to use the SQLClient class
This allows the utility to connect to databases and submit SQL
statements.
2021-07-08 17:55:59 +04:30
Jan de Visser
a034774e3a LibSQL+SQLServer: Build SQLServer system service
This patch introduces the SQLServer system server. This service is
supposed to be the only process/application talking to database storage.
This makes things like locking and caching more reliable, easier to
implement, and more efficient.

In LibSQL we added a client component that does the ugly IPC nitty-
gritty for you. All that's needed is setting a number of event handler
lambdas and you can connect to databases and execute statements on them.

Applications that wish to use this SQLClient class obviously need to
link LibSQL and LibIPC.
2021-07-08 17:55:59 +04:30
Jan de Visser
1037d6b0eb LibSQL: Invent statement execution machinery and CREATE SCHEMA statement
This patch introduces the ability execute parsed SQL statements. The
abstract AST Statement node now has a virtual 'execute' method. This
method takes a Database object as parameter and returns a SQLResult
object.

Also introduced here is the CREATE SCHEMA statement. Tables live in a
schema, and if no schema is present in a table reference the 'default'
schema is implied. This schema is created if it doesn't yet exist when
a Database object is created.

Finally, as a proof of concept, the CREATE SCHEMA and CREATE TABLE
statements received an 'execute' implementation. The CREATE TABLE
method is not able to create tables created from SQL queries yet.
2021-07-08 17:55:59 +04:30
Jan de Visser
30691549fd LibSQL: Move Order and Nulls enums from SQL::AST to SQL namespace
The Order enum is used in the Meta component of LibSQL. Using this enum
meant having to include the monster AST/AST.h include file. Furthermore,
they are sort of basic and therefore can live in the general SQL
namespace. Moved to LibSQL/Type.h.

Also introduced a new class, SQLResult, which is needed in future
patches.
2021-07-08 17:55:59 +04:30
Andrea Martinelli
5397845a41 WindowServer: Add a new IPC to set the cursor position 2021-07-08 14:15:07 +02:00
pancake
86a4d0694f FileManager: Add Open in Terminal on folder context menu 2021-07-08 16:15:55 +04:30
Tom
ad5d9d648b Kernel: Use PAE to allow accessing all physical memory beyond 4GB
We already use PAE for the NX bit, but this changes the PhysicalAddress
structure to be able to hold 64 bit physical addresses. This allows us
to use all the available physical memory.
2021-07-08 11:43:34 +02:00
Daniel Bertalan
5208bc05ce LibC: Don't include fenv.h from float.h
This fixes a build issue where `compiler-rt` tried to declare its own
version of the `FE_*` macros, and included `float.h` in order to get the
constants. `compiler-rt` tried to declare these as an enum, and failed
with a syntax error when the constant's literal values were substituted.
2021-07-08 10:11:00 +02:00
Daniel Bertalan
6f6b1b3ea1 ChessEngine: Don't call non-constexpr sqrt in a constexpr intiializer
GCC likely has a builtin intrinsic that evaluates the operation at
compile-time, even if the `LibM` is not declared as constexpr. Clang,
however, does not like it, and it failed to compile this code.
2021-07-08 10:11:00 +02:00
Daniel Bertalan
44b6f402ae Utilities/run-tests: Don't use using enum
`using enum` statements will only be supported by the upcoming Clang 13
compiler, so the current code can't be built with the almost-ready Clang
toolchain yet.
2021-07-08 10:11:00 +02:00
Daniel Bertalan
3bdefb4623 UserspaceEmulator: Use long double in FABS
`fpu_get` returns a long double and `fpu_set` expects a long double as
its parameter, and the X87 FPU uses long doubles as its internal
storage, meaning the `FABS` operates on them. This means the correct
intrinsic function for implementing it is `__builtin_fabsl`.
2021-07-08 10:11:00 +02:00
Daniel Bertalan
a36c37db47 LibIPC: Remove unnecessary template<>
This fixes a Clang warning.
2021-07-08 10:11:00 +02:00
Daniel Bertalan
2db4709c0c Everywhere: Add braces to aggregate initializers
This fixes a couple of warnings emitted by Clang.
2021-07-08 10:11:00 +02:00
Daniel Bertalan
98260c5862 LibC+Utilities: Add gnu::format attributes
Without these attributes present on these custom formatting functions,
Clang would warn use about nonliteral format strings. As an added bonus,
we now get type checking on these.
2021-07-08 10:11:00 +02:00
Daniel Bertalan
e8e628de57 Everywhere: Add Clang pragmas
We use these to prevent UB from being optimized away in `/bin/crash` and
to make the compiler not warn about the many implicit floating point
type promotions in LibM.
2021-07-08 10:11:00 +02:00
Daniel Bertalan
98a9a1d7f9 Everywhere: Add break after the last case label before default
We already do this in most places, so the style should be consistent.
Also, Clang does not like it, as this could cause an unexpected compile
error if some statements are added to the default label or a new label
is added above it.
2021-07-08 10:11:00 +02:00
Daniel Bertalan
b0208ce433 Everywhere: Forward declare structs as structs
While structs being forward declared as classes is not strictly an
issue, Clang complains as this is not portable code, since some ABIs
treat classes declared as `class` and `struct` differently.

It's easier to fix these than to reason about explicitly disabling
another warning.
2021-07-08 10:11:00 +02:00
Daniel Bertalan
e32692ea68 Shell: Use correct printf format string for size_t 2021-07-08 10:11:00 +02:00
Daniel Bertalan
714bd011e1 Everywhere: Use the correct literal suffixes
When performing arithmetic with long doubles/floats, we want to avoid
floating point promotion and narrowing.
2021-07-08 10:11:00 +02:00
Daniel Bertalan
b76ad3db90 IPCCompiler+WindowServer: Fix deleted function warning
It might be the case that we are passing non-movable/non-copyable things
through IPC. In this case, Clang will emit a warning as it can't
generate the requested default move/copy ctor for the IPC message.

To fix this, we use a `#pragma` to make the compiler silently ignore our
request.

The same was the case with the three-way comparison in `Screen`. Since
we don't use the three-way comparison operator anywhere else in our
codebase, we simply use the `==` operator instead.
2021-07-08 10:11:00 +02:00
Daniel Bertalan
f14a4994b0 Everywhere: Don't promote float to double where not needed
The `float => double => float` round trip seen in a couple of places
might pessimize the code. Even if it's truncated to an int in the end,
it's weird not to use the functions with the `f` suffixes when working
with single precision floats.
2021-07-08 10:11:00 +02:00
Daniel Bertalan
01a0aa6e0b HackStudio: Do not check NonnullRefPtr for null value 2021-07-08 10:11:00 +02:00
Daniel Bertalan
c6fafd3e90 AK+Userland: Add generic AK::abs() function and use it
Previously, in LibGFX's `Point` class, calculated distances were passed
to the integer `abs` function, even if the stored type was a float. This
caused the value to unexpectedly be truncated. Luckily, this API was not
used with floating point types, but that can change in the future, so
why not fix it now :^)

Since we are in C++, we can use function overloading to make things
easy, and to automatically use the right version.

This is even better than the LibC/LibM functions, as using a bit of
hackery, they are able to be constant-evaluated. They use compiler
intrinsics, so they do not depend on external code and the compiler can
emit the most optimized code by default.

Since we aren't using the C++ standard library's trick of importing
everything into the `AK` namespace, this `abs` function cannot be
exported to the global namespace, as the names would clash.
2021-07-08 10:11:00 +02:00
Daniel Bertalan
a2e0291172 WindowServer: Don't use old GNU-style designator
Since we use C++20, we can move to the new standardized designated
initializer syntax.
2021-07-08 10:11:00 +02:00
Daniel Bertalan
ca06fd658d Everywhere: Remove unused local variables and lambda captures 2021-07-08 10:11:00 +02:00
Daniel Bertalan
5f7f063919 Everywhere: Mark debug-only functions [[maybe_unused]]
These functions are only used from within `dbgln_if` calls, so in
certain build configurations, they go unused. Similarly to variables, we
now signal to the compiler that we understand that these are not always
in use.
2021-07-08 10:11:00 +02:00
Andrew January
5598f63d0f WindowServer: Make descending into submenu make the submenu current
This fixes a bug with menu keyboard navigation. If you pressed the right
arrow to enter a submenu, then the left arrow to exit the submenu, then
right and left again it would leave no menu item selected.

Because descending into the submenu wasn't making it the current menu,
when you press the left arrow it couldn't find the "current menu" in the
stack, so didn't know what menu to pop back to.

It was an accident that it worked the first time you navigated into the
menu. Selecting the parent item also opened the submenu, and opening
an already open menu sets it as the current menu. After closing the
submenu with the left arrow, it is no longer already open, so it wasn't
getting set as the current menu.
2021-07-08 09:13:24 +02:00
Idan Horowitz
eeb4c1eec9 LibJS: Reorder and add missing name & length properties to Built-ins
The specification dicatates that each built-in will have a length and
name property. (defined in that order)
2021-07-08 01:45:15 +01:00
Linus Groh
7e4b0681e1 LibJS: Implement Date.prototype.toTemporalInstant() 2021-07-08 01:25:49 +01:00
Linus Groh
cc64efac44 LibJS: Split out NumberToBigInt from the BigInt constructor
This is supposed to be its own AO, but since it was only used in one
place, we inlined it. Now that it's also being used in the Temporal
proposal (Date.prototype.toTemporalInstant() specifically), it makes
sense to have it as a standalone function.
A small difference is that we now construct the SignedBigInteger without
casting to i32 but instead take the (known to be integral) double and
cast it to i64. Not perfect, but slightly better.
Also clean up the BigInt constructor a bit while we're here and sprinkle
some spec comments.
2021-07-08 01:25:49 +01:00
Linus Groh
3e8574a9a8 LibCrypto: Add missing implementation of SBI::multiplied_by(USBI)
This only had a declaration and was creating linker errors when used.
Easily fixed!
2021-07-08 01:25:49 +01:00
Andreas Kling
f48e581eac WindowServer: When "flash flush" enabled, flash transparent rects green 2021-07-08 01:22:21 +02:00
Andreas Kling
32654b340a LibCore: Remove overly informal language in ArgsParser error message 2021-07-08 01:17:06 +02:00
Andreas Kling
432ab47053 WindowServer: Allow partial repaints in window frame & menubars
Before this change, invalidating any rect in a WindowFrame would cause
the entire window (including frame & drop shadow) to get invalidated,
leading to copious amounts of overdraw when mousing over menubars,
titlebars, and window buttons.

We now simply allow the partial frame invalidations through to the
window's dirty rects collection and the compositor takes care of it.
2021-07-08 01:17:06 +02:00
Andrew January
cad62230f6 WindowServer: Close submenus when hovering over separators
ec6debb changed item_index_at to return -1 when hovering over a
separator. The intent was to not send the separator to clients for
MenuItemEntered.

However, this had the unintented consequence of not closing the submenu
when you hover over a separator. Submenus ignore when the item index is
-1 in order to leave the menu open when you move the mouse outside. This
ends up leaving the submenu open without the highlight to show what menu
item the submenu belongs to.

A slightly less severe consequence is that pressing the up or down arrow
key in such a situation would now go the top or bottom of the menu
rather than the item above or below the separator.

We now push the special casing of separators into set_hovered_index so
that the rest of the code behaves as it did before ec6debb.
2021-07-08 01:17:02 +02:00
Timothy Flynn
35a2ba8ed8 LibJS: Implement RegExp.prototype [ @@search ]
String.prototype.search is already implemented, but relies on the well-
known Symbol.search, which was not implemented.
2021-07-08 00:01:20 +01:00
Timothy Flynn
aaf5339fae LibJS: Do not downcast from Object to RegExpObject unless needed
Several test262 tests rely on creating phony RegExp objects that do not
have the internal slots used to test for a valid RegExp object. To allow
these tests to run (and because the spec doesn't require real RegExp
objects in these methods), do not attempt to downcast where it isn't
needed.
2021-07-08 00:01:20 +01:00
Timothy Flynn
ce2651a320 LibJS: Remove RegExp 'do_match' helper
This was previously used as a wrapper for Regex::match when that method
was invoked by multiple RegExp.prototype implementations. But now all
implementations go through the RegExpExec abstraction, so this helper
is not needed. Remove it to discourage its usage.

Also update a comment about using dynamic properties for lastIndex; this
is no longer a FIXME.
2021-07-08 00:01:20 +01:00
Timothy Flynn
2d0589f93c LibJS: Implement global RegExp.prototype.match
Also rename the 'rx' variable to 'regexp_object' to match other RegExp
methods.
2021-07-08 00:01:20 +01:00
Timothy Flynn
b6b5adb47d LibJS: Implement RegExp.prototype.match with RegExpExec abstraction 2021-07-08 00:01:20 +01:00
Timothy Flynn
ec898a3370 LibJS: Implement RegExp.prototype.replace with RegExpExec abstraction
Also rename the 'rx' variable to 'regexp_object' to match other RegExp
methods.
2021-07-08 00:01:20 +01:00
Timothy Flynn
6c53475143 LibJS: Implement RegExp.prototype.test with RegExpExec abstraction 2021-07-08 00:01:20 +01:00
Timothy Flynn
a90d5cb622 LibJS: Extract RegExp.prototype.exec to RegExpExec and RegExpBuiltinExec
The RegExp specification dictates that the internal implementation of
RegExp.prototype.exec must go through the RegExpBuiltinExec abstraction.

Note there is currently no functional difference in this commit. However
this now allows other RegExp.prototype methods to use RegExpExec rather
than calling RegExp.prototype.exec. Then, if JavaScript in the wild has
overwritten exec, RegExpExec has some protections to defer to
RegExpBuiltinExec.
2021-07-08 00:01:20 +01:00
Hendi
0dc4e722e6 LibJS: Make FunctionExpression more spec-compliant 2021-07-07 23:31:51 +01:00
Aziz Berkay Yesilyurt
0da1353c80 Userland: Keep ImageViewer window size the same while zooming in
ImageViewer window kept growing while zooming in, which causes out of
memory error and crashes the application. Now, only the image content
is rescaled and the window size is preserved.

We also open the display window as the same size as the image, which may
cause a similar issue for very large image files. This is prevented by
limiting the maximum window size to be the screen size.
2021-07-08 00:21:31 +02:00
Andreas Kling
c0e20252da LibGUI: Don't repaint disabled scrollbars when mousing over them 2021-07-07 23:57:21 +02:00
Andreas Kling
b027466f41 WindowServer+wsctl: Add a simple utility for toggling "flash flush"
You can now put the WindowServer into "flash flush" mode by doing:

$ wsctl -f 1

To disable it, somewhat obviously:

$ wsctl -f 0
2021-07-07 22:56:46 +02:00
Andreas Kling
6032b2cb2b WindowServer: When "flash flush" is enabled, stretch flash to 10 ms
Previously, this mode would flash flush/repaint rects in yellow for
however it long it took for the compositor to replace the yellow with
the final image instead.

Now we usleep() for 10 ms when flashing, so you get a chance to see
the yellow. This immediately makes "flash flush" mode super useful. :^)
2021-07-07 22:56:46 +02:00
Idan Horowitz
795786387b LibJS: Remove the NativeProperty mechanism from LibJS
These were an ad-hoc way to implement special behaviour when reading or
writing to specific object properties. Because these were effectively
replaced by the abillity to override the internal methods of Object,
they are no longer needed.
2021-07-07 21:47:22 +01:00
Idan Horowitz
306d59276a LibJS: Stop using a native property for RegExp's lastIndex property
This is not a functional change, the exposed (incorrect) behaviour is
the same as it was before, this simply removes the last user of
NativeProperties, allowing us to remove them completely from LibJS.
2021-07-07 21:47:22 +01:00
Daniel Bertalan
64b1740913 LibELF: Fix syscall regions for .text segments with a non-zero offset
Previously, we assumed that the `.text` segment was loaded at vaddr 0 in
all dynamic libraries, so we used the dynamic object's base address with
`msyscall`. This did not work with the LLVM toolchain, as it likes to
shuffle these segments around.

This now also handles the case when there are multiple text segments for
some reason correctly.
2021-07-07 22:26:53 +02:00
davidot
ae8c4618b7 LibJS: Use as_object instead of as_array in flatten_into_array
Since is_array does not guarantee that it is<Array> we must use
as_object here.
2021-07-07 21:24:26 +01:00
davidot
4846c4a94e LibJS: Fix types and small spec discrepancy in ArrayPrototype::fill 2021-07-07 21:24:26 +01:00
davidot
6c47b77998 LibJS: Fix types and small spec discrepancy in ArrayPrototype::splice 2021-07-07 21:24:26 +01:00
davidot
7a41c758c0 LibJS: Fix types and small spec discrepancy in ArrayPrototype::includes 2021-07-07 21:24:26 +01:00
davidot
cb44fc528b LibJS: Add a way of constructing PropertyName with values above 2**32-1
This is often needed in ArrayPrototype when getting items with indices
above 2**32-1 is possible since length is at most 2**53-1.
This also fixes a number of these cases in ArrayPrototype where the type
was not big enough to hold the potential values.
2021-07-07 21:24:26 +01:00
davidot
a70033481d LibJS: Fix that length was sometimes cast to [ui]32
Since array-like objects can have much larger lengths even a u32 is not
sufficient.
2021-07-07 21:24:26 +01:00
davidot
7310713d11 LibJS: Remove fast array paths in ArrayPrototype::{pop, push}
Unfortunately this fast path leads to problems if Array.prototype is
changed. We probably need to find out some way to optimize these methods
by detecting changes to the prototype or other mechanisms.
2021-07-07 21:24:26 +01:00
Andreas Kling
092e5b75ba WindowServer: Add WindowFrame::invalidate_menubar() and use it
Clean up a FIXME about overly aggressive invalidation.
2021-07-07 21:06:15 +02:00
Linus Groh
b180e154aa LibJS: Add thousands separators to nanoseconds multiplier value
Increases readability. Thanks to @nico for noticing this!
2021-07-07 20:01:08 +01:00
LuK1337
6319796f58 LibGfx: BitmapFont: Handle '\r' and '\n' when calculating text width
Previously calculating multiline text width would return invalid value,
this change makes it so that we are returning the longest line width.

We are now also reusing same width() implementation for both UTF-8 and
UTF-32 strings.
2021-07-07 20:29:29 +02:00
Ralf Donau
6386c2d880 Userland: Add pledge to less 2021-07-07 20:27:40 +02:00
Linus Groh
96167e39e7 js: Implement pretty-printing of Temporal.Instant objects 2021-07-07 19:00:42 +01:00
Linus Groh
3a39ff8f40 LibJS: Implement Temporal.now.instant() 2021-07-07 19:00:42 +01:00
Linus Groh
47fb4286c7 LibJS: Start implementing Temporal.Instant
Just like the initial Temporal.TimeZone commit, this patch adds the
Instant object itself, its constructor and prototype (currently empty),
and two required abstract operations.
2021-07-07 19:00:42 +01:00
Linus Groh
d9cff591b6 LibJS: Add error message for invalid time zone in Temporal.TimeZone() 2021-07-07 19:00:42 +01:00