Commit Graph

5781 Commits

Author SHA1 Message Date
kleines Filmröllchen
463a645d37 LibCore: Add InputFileStream::seek
As a file is able to seek(), InputFileStreams can delegate the seek()
easily. This allows for seeking to specific locations in the file.
2021-06-25 20:48:14 +04:30
Andreas Kling
57214268dd LibJS: Make sure to always initialize Reference::m_base_value 2021-06-25 17:25:55 +02:00
Andreas Kling
7b28fa99ba LibJS: Rename Reference methods to match the spec
- get -> get_value (GetValue in the spec)
- put -> put_value (PutValue in the spec)

Also add spec links. :^)
2021-06-25 17:20:23 +02:00
Andreas Kling
bce7fdba81 LibJS: Bring Reference records a bit closer to the ECMAScript spec
Our Reference class now has the same fields as the spec:

- Base (a non-nullish value, an environment record, or `unresolvable`)
- Referenced Name (the name of the binding)
- Strict (whether the reference originated in strict mode code)
- ThisValue (if non-empty, the reference represents a `super` keyword)

The main difference from before is that we now resolve the environment
record that a reference interacts with. Previously we simply resolved
to either "local variable" or "global variable".

The associated abstract operations are still largely non-conforming,
since we don't yet implement proper variable bindings. But this patch
should at least fix a handful of test262 cases. :^)

There's one minor regression: some TypeError message strings get
a little worse due to doing a RequireObjectCoercible earlier in the
evaluation of MemberExpression.
2021-06-25 16:58:36 +02:00
Andreas Kling
6e1932e8b2 LibJS: Evaluate this in terms of ResolveThisBinding 2021-06-25 16:58:36 +02:00
Andreas Kling
92ce4ac23f LibJS: Remove outdated FIXME in GetThisEnvironment 2021-06-25 16:58:36 +02:00
Andreas Kling
07acdc7be2 LibJS: Rename VM::get_reference() => resolve_binding()
This function maps to the ResolveBinding operation from the spec,
so let's rename it to match.
2021-06-25 16:58:36 +02:00
Paul Irwin
5eb65286b6 LibWeb: Support :active pseudo-class for hyperlinks, :focus possibly
Adds support for the :active pseudo-class for hyperlinks (<a> tags
only).

Also, since it was very similar to :focus and an element having a
focused state was already implemented, I went ahead and implemented
that pseudo-class too, although I cannot come up with a working
example to validate it.
2021-06-25 01:02:29 +02:00
Aatos Majava
457edaa4d2 Browser: Add alternate shortcut F6 for focusing the location box 2021-06-25 01:01:37 +02:00
Aatos Majava
d50ff2b422 LibGUI: Add alternate shortcut F5 to the "reload" common action 2021-06-25 01:01:37 +02:00
Aatos Majava
601dc8a128 LibGUI: Make Action::shortcut() return const&
Also do the same for Action::alternate_shortcut().
2021-06-25 01:01:37 +02:00
Aatos Majava
b05078b610 LibGUI: Add a new constructor to Action
This constructor allows you to omit the modifier keys.

Instead of doing "{ 0, Key_F5 }" you can now just do "Key_F5"
2021-06-25 01:01:37 +02:00
Aatos Majava
3e6a5af32b LibGUI: Actually use the Action alternate shortcut
This adds the actual functionality to Window and Application.
2021-06-25 01:01:37 +02:00
Aatos Majava
21a193ed5a LibGUI: Add support for an alternate keyboard shortcut in Action
This patch adds the alternate_shortcut member to LibGUI::Action, which
enables one Action to have two keyboard shortcuts.

Note that the string used in menus and tooltips only shows the main
shortcut, which is the same behaviour as in Firefox and Chrome.
2021-06-25 01:01:37 +02:00
Spencer Dixon
5b79d53c89 LibGUI: Add update() when changing widget color or palette 2021-06-24 23:32:38 +02:00
Alexander
a2a3f5228a WindowServer: Scale Mouse movements
This fixes a bug where if the current screen was using scaling, the
mouse would be twice as fast as normal.
2021-06-25 01:49:07 +04:30
Andreas Kling
e59bf87374 Userland: Replace VERIFY(is<T>) with verify_cast<T>
Instead of doing a VERIFY(is<T>(x)) and *then* casting it to T, we can
just do the cast right away with verify_cast<T>. :^)
2021-06-24 21:13:09 +02:00
Andreas Kling
7fef8c5648 LibJS: Protect execution context variable environments from GC
At the moment these environments are always the same as the lexical
ones, so this didn't cause any trouble. Once we start separating them
we have to make sure both environments are protected.
2021-06-24 20:10:31 +02:00
Andreas Kling
ee3a73ddbb AK: Rename downcast<T> => verify_cast<T>
This makes it much clearer what this cast actually does: it will
VERIFY that the thing we're casting is a T (using is<T>()).
2021-06-24 19:57:01 +02:00
Andreas Kling
6215a9c2cb LibJS: Rename ExecutionContext::callee => function
This matches what ECMAScript calls it. Also make it a JS::Function*
instead of a generic Value, since it will always either be a function
object or null.
2021-06-24 19:28:00 +02:00
Andreas Kling
c2ad599783 LibJS: Rename CallFrame => ExecutionContext
This struct represents what the ECMAScript specification calls an
"execution context" so let's use the same terminology. :^)
2021-06-24 19:28:00 +02:00
Ali Mohammad Pur
7c88caf99f LibVT: Only resize the line after all rewrapping is done
Otherwise we would end up inserting empty cells into the wrapped lines.
Fixes #8227.
2021-06-24 18:50:45 +02:00
Daniel Bertalan
2d2747cb15 LibCore+AK: Use proper atomics in Singleton 2021-06-24 17:35:49 +04:30
Daniel Bertalan
e364845456 LibGfx: Don't constexpr functions returning Strings
Since strings don't have a constexpr constructor, these won't have any
effect anyways. Furthermore, this is explicitly disallowed by the
standard, and makes Clang tools freak out.
2021-06-24 17:35:49 +04:30
Daniel Bertalan
f28f00c654 Userland: Disambiguate dependent types
Clang produced an error on these pieces of code without the `typename`
keyword.
2021-06-24 17:35:49 +04:30
Daniel Bertalan
f820917a76 Everywhere: Use nothrow new with adopt_{ref,own}_if_nonnull
This commit converts naked `new`s to `AK::try_make` and `AK::try_create`
wherever possible. If the called constructor is private, this can not be
done, so we instead now use the standard-defined and compiler-agnostic
`new (nothrow)`.
2021-06-24 17:35:49 +04:30
brapru
4c0c4f3102 Utilities: Validate user with Core::Account in userdel
Previously the remove home directory option never actually removed the
user's home directory because it was not properly unveiled. By
validating the user with Core::Account, we can identify the user's home
directory earlier in the program and unveil as necessary.

Additionally, by identifying if the user does not exist much earlier in
the program, this elimates depending on getpwent to validate the user
and creating unneccessary temp files.
2021-06-24 17:33:14 +04:30
Andreas Kling
bc1930e0e0 LibJS: Fix clang-tidy warnings in AST.h
- Add/remove `move()` as suggested.
- Add missing `explicit` on single-parameter constructors.
2021-06-24 13:38:21 +02:00
Andreas Kling
0eeb7f67a7 LibJS: Don't use m_ prefix for argument name in ScriptFunction 2021-06-24 13:29:25 +02:00
Andreas Kling
ce2747692d LibJS: Remove unused DeclarativeEnvironmentRecord::type()
Nothing was using this, and we now have separate classes for the
different types of environment records instead.
2021-06-24 13:28:15 +02:00
Andreas Kling
0cd65b55bd LibJS: Add ObjectEnvironmentRecord.[[IsWithEnvironment]] field
This is true for environments created by `with` statements, and false
for other (global) object environments.

Also add the WithBaseObject abstract operation while we're here.
2021-06-24 13:26:00 +02:00
Jamie Mansfield
3f8857cd21 Games: Add Spider
Scoring is designed to mimic Microsoft's implementation - starting at
500, decreasing by 1 every move, and increasing by 100 for every full
stack.

Fixes GH-5319.
2021-06-24 10:32:53 +02:00
Jamie Mansfield
b7e806e15e LibCards: Support non-alternating colour patience games
This introduces a new MovementType concept to LibCards, starting the
process to allow other patience games to be implemented using it - that
differ more substantially from Klondike in logic.

This is currently used for two purposes: 1. to verify that the
'grabbed' stack of cards is valid* (sequential and correct colours) and
2. to allow 'grabbed' stacks to be pushed onto same-colour,
either-colour, or alternating-colour stacks

* Klondike doesn't need this logic, as per how the game works any
  'grabbed' selection is guaranteed to be valid.
2021-06-24 10:32:53 +02:00
Gunnar Beutner
1ae7d68885 LibSymbolication: Fix incorrect argument type for symbolicate() 2021-06-24 09:27:13 +02:00
Gunnar Beutner
f2eb759901 Profiler: Use u32 when constructing InstructionData
When constructing values of the InstructionData type we assume that
the event_count field is a size_t while it actually is a u32. On x86_64
this fails because those are different types.
2021-06-24 09:27:13 +02:00
Gunnar Beutner
c9a8dfa1bf Userland: Add more TODO()s for arch-specific code
This enables building more of the userspace applications for x86_64.
2021-06-24 09:27:13 +02:00
Sam Atkins
f2d6cac692
Solitaire: Maybe fix rare crash from completing a game with TAB (#8217)
The crash happens very rarely and is hard to reproduce so it is
hard to know for certain, but I am confident this fixes it.

I previously delayed the start of the game-over animation by one
frame, but neglected to check m_start_game_over_animation_next_frame
wasn't set. This means multiple calls to start_game_over_animation()
on the same frame (or rather, before the first timer_event) would
each call Object::start_timer(). Now that we do check the flag,
that should no longer be possible.

Fixes #8122.
2021-06-24 09:25:01 +02:00
Gunnar Beutner
ac650d2362 Userland: Remove dummy IPC methods
They're not used anywhere and are unnecessary boilerplate code. So let's
remove them and update IPCCompiler to allow for empty endpoint
declarations.
2021-06-24 00:38:58 +02:00
Hendiadyoin1
37253ebcae LibELF: Fix missing include
A few files are expecting that someone brings PAGE_SIZE from possibly
the Kernel with them
2021-06-24 00:38:23 +02:00
Jan de Visser
5c4890411b LibSQL: Make lexer and parser more standard SQL compliant
SQL was standardized before there was consensus on sane language syntax
constructs had evolved. The language is mostly case-insensitive, with
unquoted text converted to upper case. Identifiers can include lower
case characters and other 'special' characters by enclosing the
identifier with double quotes. A double quote is escaped by doubling it.
Likewise, a single quote in a literal string is escaped by doubling it.

All this means that the strategy used in the lexer, where a token's
value is a StringView 'window' on the source string, does not work,
because the value needs to be massaged before being handed to the
parser. Therefore a token now has a String containing its value. Given
the limited lifetime of a token, this is acceptable overhead.

Not doing this means that for example quote removal and double quote
escaping would need to be done in the parser or in AST node
construction, which would spread lexing basically all over the place.
Which would be suboptimal.

There was some impact on the sql utility and SyntaxHighlighter component
which was addressed by storing the token's end position together with
the start position in order to properly highlight it.

Finally, reviewing the tests for parsing numeric literals revealed an
inconsistency in which tokens we accept or reject: `1a` is accepted but
`1e` is rejected. Related to this is the fate of `0x`. Added a FIXME
reminding us to address this.
2021-06-24 00:36:53 +02:00
Jan de Visser
4198f7e1af LibSQL: Move Lexer and Parser machinery to AST directory
The SQL engine is expected to be a fairly sizeable piece of software.
Therefore we're starting to restructure the codebase for growth.
2021-06-24 00:36:53 +02:00
Federico Guerinoni
e0f1c237d2 HackStudio: Make TODO entries clickable
Now you can click a TODO entry to set focus on that position of that
file.
2021-06-23 19:00:11 +01:00
Federico Guerinoni
935c7b2f4b HackStudio: Add TODO entries widget 2021-06-23 19:00:11 +01:00
Federico Guerinoni
26a7356e90 LanguageServers: Add function to collect TODO entries in a document 2021-06-23 19:00:11 +01:00
Federico Guerinoni
c397e030f4 LibCpp: Add function for retrieving TODO comments from the parser
Now `get_todo_entries` collects all TODO found within a comment
statement.
2021-06-23 19:00:11 +01:00
Ali Mohammad Pur
fcef84c461 LibVT: Rewrap the terminal history along with the normal buffer 2021-06-23 19:04:08 +02:00
Ali Mohammad Pur
4bf14715a1 LibLine: Recalculate the origin on resize 2021-06-23 19:04:08 +02:00
Ali Mohammad Pur
2f2b7814d1 LibVT+Terminal: Implement line wrapping
This commit implements line wrapping in the terminal, and tries its best
to move the cursor to the "correct" position.
2021-06-23 19:04:08 +02:00
Ali Mohammad Pur
424965954f LibVT: Keep track of the 'true' line endings 2021-06-23 19:04:08 +02:00
Aatos Majava
3b2a528b33 LibTextCodec: Add Turkish (aka ISO-8859-9, Windows-1254) encoding 2021-06-23 16:32:47 +01:00