Commit graph

9198 commits

Author SHA1 Message Date
Linus Groh
e333b60064 LibJS: Add Array.of() 2020-05-08 20:06:49 +02:00
Linus Groh
ca22476d9d LibJS: Add Array.isArray() 2020-05-08 20:06:49 +02:00
Linus Groh
01fd6ce045 LibJS: Support multiple arguments in Array constructor 2020-05-08 20:06:49 +02:00
Linus Groh
8137f40b73 LibJS: Add Value::is_integer() 2020-05-08 20:06:49 +02:00
AnotherTest
88738aefa3 LibGfx: Revert #2154 and properly handle simple polygons
The existing scanline method works just fine, and only needs the points
to be available as floats.
This commit reverts the complex polygon mitigation, and instead fixes
the rasterization process to avoid generating complex polygons because
of precision issues.
2020-05-08 19:39:38 +02:00
Andreas Kling
0f0d73d1b5 LibGUI: Make the "enabled" widget state propagate to child widgets
This simplifies building composite widgets by not having to worry about
updating widget subtrees.
2020-05-08 13:49:58 +02:00
AnotherTest
677568e3d4 LibGfx: Handle filling complex shapes better
This allows the painter to render filled complex shapes better, by
constructing a path graph for (interesting) intersecting lines and
omitting lines from the containing segments if they are detected
to take no part in defining the edges of a shape.

This approach would still fail if there are multiple logical shapes
that are confined to the collection of lines.
For instance, two polygons intersecting each other in a way that one
vertex of polygon A ends up inside polygon B.
we would detect that polygon A's edges are part of the shape
(technically correct) even though they are not a part of polygon B at
all.
2020-05-08 12:49:15 +02:00
Itamar
14ee090f25 HackStudio: Support variable inspection in nested scopes 2020-05-08 12:16:10 +02:00
Itamar
f0cbaf453c HackStudio: Close the debug tab when debugged program exits 2020-05-08 12:16:10 +02:00
Hüseyin ASLITÜRK
a3367cf4fa LibCore: DesktopServices, open fonts with FontEditor 2020-05-08 09:49:41 +02:00
Hüseyin ASLITÜRK
39a8db936a Applications: Replace SystemMenu name to hi voltage emoji 2020-05-08 09:49:41 +02:00
Hüseyin ASLITÜRK
cef2dce9a1 Base: Add emoji files for 26A1, 2B06 and 2B07 2020-05-08 09:49:41 +02:00
Hüseyin ASLITÜRK
f0f98de5d8 LibGUI: Fix for disable state of SpinBox 2020-05-08 09:49:41 +02:00
Matthew Olsson
532d4bc0ab LibJS: Spec-compliant equality comparisons
The ECMAScript spec defines multiple equality operations which are used
all over the spec; this patch introduces them. Of course, the two
primary equality operations are AbtractEquals ('==') and StrictEquals
('==='), which have been renamed to 'abstract_eq' and 'strict_eq' in
this patch.

In support of the two operations mentioned above, the following have
also been added: SameValue, SameValueZero, and SameValueNonNumeric.
These are important to have, because they are used elsewhere in the spec
aside from the two primary equality comparisons.
2020-05-08 09:49:20 +02:00
Devashish Jaiswal
cc01933840
AK: Declare LogStream::operator<<(const LogStream&, long) (#2155)
LogStream::operator<<(const LogStream&, long) was implemented in
AK/LogStream.cpp but the declaration was missing from the header.
2020-05-08 09:35:23 +02:00
Itamar
b931771d24 HackStudio: Gracefully handle unfound source files 2020-05-07 23:32:11 +02:00
Itamar
5fd64045b1 LibDebug: Miscellaneous fixes from #2097 2020-05-07 23:32:11 +02:00
Itamar
42b61cfe2c LibELF: Add Image::Section::wrapping_byte_buffer
This can be used to get a ByteBuffer that wrapps the section's data.
2020-05-07 23:32:11 +02:00
Itamar
dca0483e9a LibC: Log calls to getrusage 2020-05-07 23:32:11 +02:00
Yonatan Goldschmidt
b184f12aaf LibJS: Limit scope of 'for' loop variables
This required 2 changes:
1. In the parser, create a new variable scope, so the variable is
   declared in it instead of the scope in which the 'for' is found.
2. On execute, push the variable into the newly created block. Existing
   code created an empty block (no variables, no arguments) which
   allows Interpreter::enter_scope() to skip the creation of a new
   environment, therefore when the variable initializer is executed, it
   sets the variable to the outer scope. By attaching the variable to
   the new block, the block gets a new environment.

This is only needed for 'let' / 'const' declarations, since 'var'
declarations are expected to leak.

Fixes: #2103
2020-05-07 23:31:49 +02:00
Matthew Olsson
ab652fa1ee LibJS: Add String.raw 2020-05-07 23:05:55 +02:00
Matthew Olsson
b5f1df57ed LibJS: Add raw strings to tagged template literals
When calling a function with a tagged template, the first array that is
passed in now contains a "raw" property with the raw, escaped strings.
2020-05-07 23:05:55 +02:00
Nick Tiberi
9d0c6a32bd Browser: Show line numbers when viewing page source 2020-05-07 22:59:40 +02:00
Ben Wiederhake
124cbea347 WindowServer: Fix 'Maximize' Button
When a window is maximized by clicking the 'maximize' button in the window frame,
the WindowFrame *is* invalidated and repainted properly. However, the internal
state of the WindowServer::Button does not get updated until the next mouse
movement. This means that the 'maximize' button is erroneously highlighted until
the mouse moves again. This is very visible.

Ideally, a patch should compute the actual new m_hovered. However, this requires
knowledge of the new rect, or calling something on the Button after the new rect
has been determined. Until someone can figure out a good way around this,
setting m_hovered to false is a solution that 'usually' works.

Note that this does *not* work when after maximizing/restoring, the maximize
button falls exactly under the mouse again. The button functions properly, but
is erroneously not highlighted.

At least a *missing* highlight is less noticable than a highlight too many.
2020-05-07 22:15:16 +02:00
Ben Wiederhake
cc67671d95 WindowServer: Don't block child-windows of modal windows
ComboBox creates a regular (non-modal) window; I believe this is fine.
A Dialog (modal window) can contain a ComboBox; I believe this is fine.
A non-modal child window of a modal window (e.g. a ComboBox pop-out within
a Dialog) wasn't clickable, and was blocked in the WindowManager.
I want to change this behavior.

This edge case occurs when trying to select a month in the "Calendar"
Application.
2020-05-07 22:15:16 +02:00
Linus Groh
c1a6841cb2 Base: Add "`" to GB keymap 2020-05-07 22:13:46 +02:00
DexesTTP
b478c5f86c LibGUI: Properly draw the background of the selected TreeView line
In the TreeView, the background of the selected line (or any background,
really) was only drawn until the frame's width. When the text was larger
than the frame's width, this caused the end of the text to be displayed
without background, making it unreadable if it was white (which is the
default text color for selected lines).

To compute the background width, we have a choice between :
- The inner frame width (the current behaviour which causes the issue)
- The total width of all columns (which causes the background to end
  early if the columns don't cover the full width)

The new algorithm uses the biggest of the above values, which gives us
exactly what we want in all cases :^)

Fixes #2134
2020-05-07 22:13:25 +02:00
Linus Groh
8d01fd9863 HackStudio: Apply INI syntax highlighter when opening a .ini file 2020-05-07 22:04:56 +02:00
Linus Groh
7571e9e460 LibGUI: Rename SyntaxLanguage::{Javascript -> JavaScript} 2020-05-07 22:04:56 +02:00
Linus Groh
520d464865 HackStudio: Rename ProjectType::{Javascript -> JavaScript} 2020-05-07 22:04:56 +02:00
Linus Groh
85b69e54e4 Browser: Escape percent sign in download progress format string
Otherwise the following is printed:

printf_internal: Unimplemented format specifier   (fmt: 0% of %s)
2020-05-07 16:01:03 +02:00
Andreas Kling
444b6c8407 LibCrypto: Cache the "trimmed length" of UnsignedBigIntegers
This avoids repeated traversals of the underlying words and gives a
30% speed-up on "test-crypto -t pk" :^)
2020-05-07 12:23:09 +02:00
Linus Groh
57f68ac5d7 LibX86: Rename build0FSlash() to build_0f_slash()
As spotted by @heavyk this was missed in 57b2b96.
2020-05-07 12:22:36 +02:00
pierre
662e47e140 MouseDemo: A more visual approach for MouseEvents :^) 2020-05-07 12:21:52 +02:00
Emanuele Torre
21712ed0a3 Meta: We don't need to ignore run-tests in lint-shell-scripts.sh 2020-05-07 12:20:41 +02:00
Emanuele Torre
6bbd0a18a1 LibJS: Fix shellcheck warnings in Tests/run-tests 2020-05-07 12:20:41 +02:00
Maciej Sobaczewski
8989300851
Browser: Assume http:// when no protocol is provided in the location bar (#2142) 2020-05-07 11:57:53 +02:00
AnotherTest
af1ce6c33d LibTLS: Verify server certificate expiry date 2020-05-07 10:23:58 +02:00
AnotherTest
d051fffe25 LibCore: Add a primitive comparison function to DateTime
This should go away when we get the ability to parse strings to
DateTime's.
2020-05-07 10:23:58 +02:00
Yonatan Goldschmidt
3df3ab4598 Build: Support building in Docker
Add missing installations to instructions, and use genext2fs instead
of mounting.
2020-05-07 10:23:26 +02:00
Andreas Kling
beaec6bd2d Kernel: Memory purging was incorrectly "purging" the shared zero page
This caused us to report one purged page per occurrence of the shared
zero page in a purgeable memory region, despite it being a no-op.

Thanks to Sergey for spotting the bad assertion removal that led to
this being found!
2020-05-07 09:44:41 +02:00
Andreas Kling
6fe83b0ac4 Kernel: Crash the current process on OOM (instead of panicking kernel)
This patch adds PageFaultResponse::OutOfMemory which informs the fault
handler that we were unable to allocate a necessary physical page and
cannot continue.

In response to this, the kernel will crash the current process. Because
we are OOM, we can't symbolicate the crash like we normally would
(since the ELF symbolication code needs to allocate), so we also
communicate to Process::crash() that we're out of memory.

Now we can survive "allocate 300 MB" (only the allocate process dies.)
This is definitely not perfect and can easily end up killing a random
innocent other process who happened to allocate one page at the wrong
time, but it's a *lot* better than panicking on OOM. :^)
2020-05-06 22:28:23 +02:00
Andreas Kling
c633c1c2ea Kernel: Assert on OOM in Region::commit()
This function has a lot of callers that don't bother checking if it
returns successfully or not. We'll need to handle failure in a bunch
of places and then we can remove this assertion.
2020-05-06 22:28:23 +02:00
Andreas Kling
43593455db Kernel: Don't assert on OOM in allocate_user_physical_page()
We now give callers a chance to react to OOM situations.
2020-05-06 22:28:23 +02:00
Andreas Kling
bf7b77e252 AK: Fix Bitmap not finding unset ranges at the end of the map
When we switched the Bitmap code to operating 32 bits at a time,
we neglected to look in the trailing remainder bits after the last
full 32-bit word.

This patch fixes that and adds a couple of tests for Bitmap that I
hacked up while tracking down this bug.

I found this bug when noticing that the kernel would OOM while there
were still some pages left in the physical page allocator.
2020-05-06 22:28:23 +02:00
FalseHonesty
8182a709e3 Browser: Open links in a new tab when middle clicked 2020-05-06 21:59:29 +02:00
FalseHonesty
0e048f3c4c LibWeb: Add hook when a link is middle clicked 2020-05-06 21:59:29 +02:00
Linus Groh
9dbab2d05e Misc: Replace "String(string_view)" with "string_view.to_string()"
StringView::to_string() was added in 917ccb1 but not actually used
anywhere yet.
2020-05-06 19:28:59 +02:00
Matthew Olsson
107ca2e4ba LibJS: Add function call spreading
Adds support for the following syntax:

    myFunction(...x, ...[1, 2, 3], ...o.foo, ...'abcd')
2020-05-06 19:19:02 +02:00
Emanuel Sprung
8fe821fae2 AK: Add to_string() method to StringView
This allows easy creation of a new string from an existing StringView.
Can be used e.g. for output with printf(..., view.to_string().characters())
instead of writing printf(..., String{view}.characters()).
2020-05-06 19:07:22 +02:00