Commit graph

8868 commits

Author SHA1 Message Date
Andreas Kling
698652a548 LibJS: Make Value::as_string() return a PrimitiveString reference 2020-04-29 12:35:39 +02:00
Andreas Kling
75f246dde8 LibJS: Make StringObject::primitive_string() return a reference 2020-04-29 12:33:28 +02:00
Andreas Kling
7dadb75e28 WindowServer: Pop up the window menu at bottom left of window icon
When clicking the window icon, we now pop up the window menu at the
bottom left of the icon, no matter where you clicked it.

Right-clicking the title bar still pops up at the event position.
2020-04-29 12:07:40 +02:00
Andreas Kling
f0cde70c18 LibGUI: Simplify submenu construction
The API for adding a submenu to a menu is now:

auto& submenu = menu.add_submenu("Name");
submenu.add_action(my_action);
2020-04-29 11:48:11 +02:00
Andreas Kling
13dcd9a037 WindowServer: Fix build after FBResolution changes 2020-04-29 11:41:34 +02:00
Linus Groh
d4ec38097f LibJS: Return undefined in Array.prototype.{pop,shift} for empty values 2020-04-29 09:38:25 +02:00
Emanuele Torre
a220236cde Browser: Add missing #pragma once in Tab.h 2020-04-29 09:38:11 +02:00
Andreas Kling
385dacce05 Kernel: Fix integer overflow in framebuffer resolution handling
This made it possible to map the E1000 MMIO range into userspace and
mess with the registers.

Thanks to @grigoritchy for finding this!

Fixes #2015.
2020-04-29 09:37:36 +02:00
mattco98
18cfb9218a LibJS: Set Array length attributes to "Configurable | Writable" 2020-04-29 09:02:29 +02:00
Linus Groh
da0ab16f01 LibJS: Don't handle arrays separately in Value::to_number()
Now that Array.prototype.join() is producing the correct results we
can remove the separate code path for arrays in Value::to_number()
and treat them like all other objects - using to_primitive() with
number as the preferred type and then calling to_number() on the
result.

This is how the spec descibes it.

This also means we don't crash anymore when trying to coerce
[<empty>] to a number - it now does the following:

[<empty>] - to string - "" - to number - 0
[<empty>, <empty>] - to string - "," - to number - NaN
2020-04-29 01:30:59 +02:00
Linus Groh
6d6cd64689 LibJS: Skip undefined and null in join_array_with_separator()
This it being used in Array.prototype.{join,toString}() - and now
adhering to the spec: [undefined, null].join() === ","
2020-04-29 01:30:59 +02:00
Andreas Kling
86810a4b02 LibLine: Actually fix build :^) 2020-04-29 00:03:19 +02:00
AnotherTest
a6fcf70e25 LibLine: Properly mark the result of read() as ignored
Unbreaks the build.
2020-04-28 23:48:38 +02:00
AnotherTest
e83300dc27 LibLine: Drop stray input before doing vt_dsr
This patch fixes the issue where some data would be buffered while the
editor is not editing, and vt_dsr would read them, resulting in the
cursor to jump to (1,1)
2020-04-28 23:29:07 +02:00
AnotherTest
9473733d7a LibLine: Handle initialize() internally
This patch makes initialize() transparent to the users, but exposes it
publicly, as the users might need a copy of the default termios (i.e.
Shell)
2020-04-28 23:29:07 +02:00
AnotherTest
7ecf29f206 LibLine: Ignore interrupts unless actively editing
It does not make much sense to receive an interrupt and process it
*much later*.
Also patches Userland/js to only create exceptions while some code is
actually running.
2020-04-28 23:29:07 +02:00
Linus Groh
8b195d1211 TextEditor: Fix typo in comment 2020-04-28 23:12:16 +02:00
Linus Groh
8ad11df89f LibJS: Handle exception in for loop test execution 2020-04-28 23:11:18 +02:00
Andreas Kling
5eaa7ff406 TextEditor: Add live preview when editing markdown :^)
This works by hooking into the change notifications from the TextEditor
widget and parsing the document content as markdown, and generating an
HTML document from it which is displayed using LibWeb.

This will make it a bit easier to write man pages! :^)
2020-04-28 21:46:43 +02:00
Andreas Kling
ea204ef05b LibMarkdown: Drop MD prefixes and move into "Markdown" namespace :^) 2020-04-28 21:04:25 +02:00
mattco98
104969a9f5 LibJS: Add spreading in object literals
Supports spreading strings, arrays, and other objects within object
literals.
2020-04-28 20:37:21 +02:00
Andreas Kling
3cc31ff3f3 Browser: Make Ctrl+L select the location bar again
..by making sure the Tab actions are scoped to the Tab.
2020-04-28 20:36:08 +02:00
Andreas Kling
5b4b72e699 Browser: Don't put favicons as the window icon
It's nicer to always use the browser's own app icon instead. :^)
2020-04-28 20:31:51 +02:00
Andreas Kling
463c2e3768 Kernel: Be a little more defensive when indexing E1000 Rx/Tx buffers 2020-04-28 20:31:51 +02:00
Hüseyin ASLITÜRK
b3bdab8cf7 Application: Fix for reboot on PowerDialog close button click 2020-04-28 20:30:48 +02:00
Linus Groh
3152559422 LibJS: Call Array.prototype.findIndex() callback for empty elements
If the array value at the current index is empty, the callback will
be called with undefined as value.
2020-04-28 20:15:38 +02:00
Linus Groh
823cc7bc1c LibJS: Call Array.prototype.find() callback for empty elements
If the array value at the current index is empty, the callback will
be called with undefined as value.
2020-04-28 20:15:38 +02:00
Linus Groh
ad8abce8a5 LibJS: Let Array.prototype.map() resize new array before loop
Currently we would create an empty array of size 0 and appening results
of the callback function while skipping empty values.

This is incorrect, we should be initializing a full array of the correct
size beforehand and then inserting the results while still skipping
empty values.

Wrong: new Array(5).map(() => {}) // []
Right: new Array(5).map(() => {}) // [<empty> * 5]
2020-04-28 20:15:38 +02:00
Linus Groh
0a0ba64383 LibJS: Handle Object.prototype.hasOwnProperty() with no arg correctly
I.e. the same as hasOwnProperty(undefined) or
hasOwnProperty("undefined") :^)
2020-04-28 20:03:50 +02:00
Andreas Kling
4419685b7e Kernel: Leave VMObject alone on OOM during CoW fault
If we OOM during a CoW fault and fail to allocate a new page for the
writing process, just leave the original VMObject alone so everyone
else can keep using it.
2020-04-28 17:05:14 +02:00
Andreas Kling
9c856811b2 Kernel: Add Region helpers for accessing underlying physical pages
Since a Region is basically a view into a potentially larger VMObject,
it was always necessary to include the Region starting offset when
accessing its underlying physical pages.

Until now, you had to do that manually, but this patch adds a simple
Region::physical_page() for read-only access and a physical_page_slot()
when you want a mutable reference to the RefPtr<PhysicalPage> itself.

A lot of code is simplified by making use of this.
2020-04-28 17:05:14 +02:00
Andres Vieira
8a417c311f WindowServer: Change the desktop background colour on theme change 2020-04-28 17:04:21 +02:00
Linus Groh
30fe1b5d58 LibJS: Support spreading of strings and string objects 2020-04-28 15:35:24 +02:00
Andres Vieira
bcd5e97286 DisplayProperties: Allow going from a wallpaper to a background colour
Before this patch DisplayProperties couldn't handle correctly going from
a set wallpaper to a background color.

This patch adds a new "Use background color" as a first option for the
Wallpaper combobox as well as correct handling of setting an invalid
bitmap, thus making the WindowManager draw the background color
2020-04-28 15:22:22 +02:00
Andres Vieira
19c744ab82 WindowManager: Allow compositor to have an empty bitmap as a wallpaper
This will make the compositor draw our colour wallpaper, instead
2020-04-28 15:22:22 +02:00
Andres Vieira
711bcff0da LibGUI: Paint CheckBox background same as widget's if it's not enabled 2020-04-28 15:14:02 +02:00
Andres Vieira
b9df3c3318 FileManager: Disable PropertiesDialog custom rename disabling logic
TextBox already handles well its disabled state so it's no use to have a
way to prevent it from PropertiesDialog, too.
2020-04-28 15:14:02 +02:00
Andres Vieira
be8dc41b9c LibGUI: Paint TextEditor background same as widget's if it's not enabled
Now TextEditor draws it's background as a colour that does not make the
user think it can be writed into. This also affects TextBox.
2020-04-28 15:14:02 +02:00
Andreas Kling
24cce3674b LibJS: Support o.f++ :^)
This patch teaches UpdateExpression how to use a Reference. Some other
changes were necessary to keep tests working:
A Reference can now also refer to a local or global variable. This is
not fully aligned with the spec since we don't have a Record concept.
2020-04-28 15:07:08 +02:00
Andreas Kling
ee0bf55127 LibJS: Make AssignmentExpression assign through a Reference
Reference now has assign(Interpreter&, Value) which is used to write
transparently through a Reference into whatever location it refers to.
2020-04-28 15:07:08 +02:00
Andreas Kling
3c4a9e421f LibJS: Allow "delete someGlobalVariable"
This is solved by allowing Identifier nodes to produce a Reference with
the global object as base.
2020-04-28 15:07:08 +02:00
Andreas Kling
67b8e6fc5b LibJS: Add Reference class to represent a base.property reference
Expression nodes can now be asked to produce a Reference. We then use
this to implement the "delete" operator without downcasting the child
node to a MemberExpression manually.
2020-04-28 15:07:08 +02:00
Linus Groh
3a12a8a348 LibJS: Make Number.isInteger() test pass on Serenity
The parser doesn't like many decimals, an issue with our strtod()
implementation. Let's use division instead - all tests green again :^)
2020-04-28 14:49:43 +02:00
Kesse Jones
1c4d776ccc LibJS: Add Array.prototype.some 2020-04-28 13:11:10 +02:00
Linus Groh
c14fedd562 LibJS: Add bounds check to Array.prototype.{find,findIndex}
The number of iterations is limited to the initial array size, but we
still need to check if the array did shrink since then before accessing
each element.

Fixes #1992.
2020-04-28 13:08:19 +02:00
Linus Groh
92671be906 Ports: Add neofetch 2020-04-28 10:18:58 +02:00
Andres Vieira
092e275633 FileManager: Disable permission checkboxes if user is not owner of path 2020-04-28 10:00:12 +02:00
Andres Vieira
cb118111b6 FileManager: Deny rename in PropertiesDialog if user can't write in path
The FileManager PropertiesDialog always let the user change the name of
files and folders to then be prompted with  write permissions error.

Now it checks for write permissions on the containing folder so it can
"disable" the TextBox input. We can't really disable TextBox right now,
hence the quotes.
2020-04-28 10:00:12 +02:00
Andres Vieira
1d874c03af FileManager: Disable delete action if user can't write in current path
Before this the delete action would be enabled in whenever was the case
in which the user had some selection made. This patch forces a check
to access() with the current folder path to see if the user actually can
delete nodes in it.
2020-04-28 10:00:12 +02:00
Andres Vieira
42f493ec9d FileManager: Add folder-specific paste action
This action is a bit different to the regular paste action because it
takes into account the folder in which the context menu was opened,
so it can be enabled/disabled whether that folder is writable or not for
the current user.

Both paste action use the same logic, now moved to the function
do_action(const GUI::Action&), but in the case of the folder being
right clicked, it pastes inside of it.
2020-04-28 10:00:12 +02:00