Commit Graph

755 Commits

Author SHA1 Message Date
AnotherTest
0d17cf121c LibGUI: Handle some edge cases in the spanned text drawing algorithm
This commit makes it skip invalid ranges and whine about overlapping
spans before ignoring them (instead of crashing).
2021-03-04 11:21:43 +01:00
William McPherson
2479ead718 Everywhere: Remove unnecessary clang-format offs
Mostly due to the fact that clang-format allows aligned comments via
AlignTrailingComments.

We could also use raw string literals in inline asm, which clang-format
deals with properly (and would be nicer in a lot of places).
2021-03-04 11:01:48 +01:00
Itamar
c1c37cc5bd TextEditor: Don't attempt to stop the autocomplete timer if it is null
Closes #5567
2021-03-04 10:11:01 +01:00
Idan Horowitz
c12781a6a2 LibCore+LibHTTP+LibGfx: Switch to LibCompress
This commit removes the only 3rd party library (and its usages)
in serenity: puff, which is used for deflate decompression. and
replaces it with the existing original serenity implementation
in LibCompress. :^)
2021-03-03 23:42:32 +01:00
Andreas Kling
8fd69e9e56 LibJS: Fix a handful of clang-tidy complaints in AST.cpp 2021-03-03 22:57:45 +01:00
davidot
9fd9ce1f9e LibWeb: Stop scrolling above content in BlockBox 2021-03-03 21:48:51 +01:00
Linus Groh
585123127e LibJS: Support @@toPrimitive in ToPrimitive abstract operation
Fixes #3961.
2021-03-03 11:04:06 +01:00
Linus Groh
e7ef729db3 LibJS: Use Value::get_method() a bunch 2021-03-02 19:20:29 +01:00
Linus Groh
1b43a6ef2d LibJS: Implement the GetMethod abstract operation
https://tc39.es/ecma262/#sec-getmethod

We have bunch of duplicated on-demand versions of this, let's do it
properly.
2021-03-02 19:20:29 +01:00
Mart G
de9f458ff5 SpaceAnalyzer: Reduce thickness of black borders between cells.
-Adds take_from_{left,right,top,bottom} to Rect.
2021-03-02 14:46:06 +01:00
Angus Gibson
0e881bc5d7 LibWeb: Handle scrolling an OutOfProcessWebView
When a mousewheel scroll event isn't handled by the web content
itself (e.g. an overflowed box or similar), the event needs to get
passed back up to the OutOfProcessWebView.
2021-03-02 13:20:03 +01:00
Angus Gibson
e9c1d9c89a LibWeb: Return whether handle_mousewheel was handled
We try scrolling a Node with the handle_mousewheel event, but if it
isn't scrollable, the event should be passed back up to the page
host. This is the first step in that process.
2021-03-02 13:20:03 +01:00
Itamar
1d3b5dabc3 LibCpp: Parse ellipsis
We can now parse the printf function declaration :^)
2021-03-02 12:50:37 +01:00
Itamar
5c79297b2c LibCpp: Consume attribute specification when parsing
Consume __atribute__(...), without actually parsing its content.
2021-03-02 12:50:37 +01:00
Itamar
5a7abb8363 LibCpp: Parse type qualifiers 2021-03-02 12:50:37 +01:00
thankyouverycool
0443cd4eed LibGUI: Add word wrapping to Labels
Adds basic word wrap support to Label widgets. Doesn't yet
negotiate autosize or Center/Bottom TextAlignments perfectly.
2021-03-02 11:57:27 +01:00
Linus Groh
d8415520de LibJS: Put console dbgln() logging behind #ifdef __serenity__
No need to have duplicate output in the Lagom-built js REPL. :^)
2021-03-02 08:36:34 +01:00
Jean-Baptiste Boric
6f668ca3a4 LibJS: Fix crash due to AST node tracking inside call stack 2021-03-01 22:27:27 +01:00
Andreas Kling
9af1e1a3bf LibVT: New terminal cells should be filled with whitespace, not '\0' 2021-03-01 11:37:22 +01:00
Brian Gianforcaro
0a49877fdc LibTest + test-js: Add initial skelaton of LibTest and migrate code there.
The test-js reporter is arguably the nicest test runner / reporter that
exists in the serenity code base. To the goal of leveling up all the
other unit test environments, start a new LibTest library so that we
can share code and reporting utilities to make all the test systems
look and behave similarly.
2021-03-01 11:17:05 +01:00
speles
aa9c5d4418 LibGUI: Add possibility to search for exact match in model 2021-03-01 11:16:18 +01:00
Jean-Baptiste Boric
8dca96fb61 LibWeb: Provide file name to JavaScript interpreter 2021-03-01 11:14:36 +01:00
Jean-Baptiste Boric
6172cb3599 LibJS: Keep track of current AST node inside the call stack 2021-03-01 11:14:36 +01:00
Jean-Baptiste Boric
0039ecb189 LibJS: Keep track of file names, lines and columns inside the AST 2021-03-01 11:14:36 +01:00
Luke
152af3a297 LibAudio: Move format and BPS checks before VERIFYs in WAV loader
It was accidentally checking the format/bits per sample too late,
which would crash with the assertion.
2021-03-01 11:09:09 +01:00
Luke
69df86c1d6 LibAudio: Use handle_any_error in WAV loader
It was using has_any_error, which causes an assertion failure when
destroying the stream. Instead, use handle_any_error, as the
WAV loader does handle errors.
2021-03-01 11:09:09 +01:00
Torben Thaysen
a723a97750 LibGUI: Implemented line wrapping for new spanned text drawing 2021-03-01 09:16:07 +01:00
Torben Thaysen
b76d2450fa LibGUI: drawing spanned text no longer *horribly* inefficient
This makes drawing text with spans a lot faster.
The previous implentation went character by character and then
checked every span whether it contained the current character.

This implentation asumes that the spans are sorted and goes span by
span drawing all the characters contained at once.
Any spans that are out of order will be ignored!

Note: text wrapping is not (yet) supported
2021-03-01 09:16:07 +01:00
Mițca Dumitru
00ef931f79 LibC: Implement fenv.h 2021-03-01 09:14:26 +01:00
Adam Hodgen
53c4be926b LibWeb: Set link cursor via the default CSS
This removes the custom handling of cursor for the link element, which
also allows overriding the cursor on a link element via CSS
2021-02-28 18:19:52 +01:00
Adam Hodgen
bedcd9cd88 LibWeb: Support setting the cursor in OutOfProcessWebView 2021-02-28 18:19:52 +01:00
Adam Hodgen
fc9225db33 LibWeb: Call page_did_request_cursor_change with CSS cursor 2021-02-28 18:19:52 +01:00
Adam Hodgen
e169e24104 LibWeb: Parese the CSS "cursor" property 2021-02-28 18:19:52 +01:00
Andrew Kaster
dc6485cfcb LibRegex: VERIFY that string builder in print_header is not null.
I don't know why g++ thinks this is the case with
ENABLE_ALL_DEBUG_MACROS when building for serenity. Adding an assert to
placate it seems reasonable
2021-02-28 18:19:37 +01:00
Andrew Kaster
e787738c24 Meta: Build AK and LibRegex tests in Lagom and for Serenity
These tests were never built for the serenity target. Move their Lagom
build steps to the Lagom CMakeLists.txt, and add serenity build steps
for them. Also, fix the build errors when building them with the
serenity cross-compiler :^)
2021-02-28 18:19:37 +01:00
Brandon Scott
0682af7b65 LibWeb: Add in all of the plumbing required to use the JS console over IPC 2021-02-28 15:30:17 +01:00
Sviatoslav Peleshko
183ebaee91 LibWeb: Add actual document loading for the CSS (at)import rule 2021-02-28 10:27:32 +01:00
Sviatoslav Peleshko
54617e1a91 LibWeb: Added simple parsing for (at)import rules
For now, the parsing is very crude, and parses only the document url.
The meta queries for the import are ignored.
2021-02-28 10:27:32 +01:00
Sviatoslav Peleshko
04d67d0239 LibWeb: Create base class CSSRule for all CSS rules
This is a foundation for handling other ("at") CSS rules.
2021-02-28 10:27:32 +01:00
Stephan Unverwerth
b807d51598 LibTTF: Fix glyph rasterizer coverage calculation 2021-02-28 10:01:41 +01:00
Andreas Kling
2c1f71055f LibVT: Put TerminalWidget in the VT namespace :^) 2021-02-27 17:49:08 +01:00
thankyouverycool
d8fa479d05 LibGUI: Remove ControlBoxButton widget
ComboBoxes and SpinBoxes were still relying on ascii-to-bitmap
icons instead of PNGs. This makes it easier to theme in the future.
2021-02-27 16:38:36 +01:00
Itamar
54bc9114b3 HackStudio: Support searching symbol declarations in the Locator
The Locator now keeps a cache of the declared symbol in a document.
The language client updates that cache whenever it gets an update from
the language server about declared symbols.

This allows searching for symbol declarations in the Locator, in
addition to file names.

Closes #5478
2021-02-27 16:37:35 +01:00
Itamar
a94b5376bc LanguageServers/Cpp: Update client asynchronously about symbols
As a document is parsed, the language server updates the client
asynchronously about symbol declarations it finds.
2021-02-27 16:37:35 +01:00
Itamar
71c7597130 LanguageServers/Cpp: Add type to Declarations 2021-02-27 16:37:35 +01:00
Itamar
4b483071fb LanguageServers: Add ProjectLoaction, Declaration types and use in IPC
With this we can avoid passing (name, line, column) tuples in many
different places.
2021-02-27 16:37:35 +01:00
Andreas Kling
b7c66233f6 LibVT: Make VT::Line use a Vector for storage
This is preparation for non-destructive terminal resizing which will
require more dynamic storage for lines.
2021-02-27 09:23:06 +01:00
speles
c58570ebaf LibGUI: Make empty TextRange invalid
Having TextRange which is empty doesn't make any sense. So it confuses
the functions that rely on having valid range, and causes them to do
no action.
Fixes #5341
2021-02-27 07:58:09 +01:00
Nick Vella
e241dba8d3 LibGUI: add a rudimentary framework for Wizards.
This patch provides the basic components needed for developers to create
consistent wizard interface experiences in their applications.
`WizardDialog` provides the dialog frame for the wizard, handling navigation
and presentation.
`AbstractWizardPage`s form the base class of Wizard pages, which are
pushed onto the `WizardDialog` page stack via `WizardDialog::push_page`.
`CoverWizardPage` and `WizardPage` are provided to ease the creation of
Wizard interfaces consistent with the Serenity visual language.
2021-02-27 07:31:55 +01:00
AnotherTest
610cec6e72 LibJS: Enable the BrowserExtended ECMA262 regexp flag by default
Fixes #5517.
2021-02-27 07:31:01 +01:00
AnotherTest
e0ac85288e LibRegex: Allow missing high bound in {x,y} quantifiers
Fixes #5518.
2021-02-27 07:31:01 +01:00
AnotherTest
91bf3dc7fe LibRegex: Match the escaped part of escaped syntax characters
Previously, `\^` would've matched `\`, not `^`.
2021-02-27 07:31:01 +01:00
AnotherTest
f05e518cbc LibRegex: Implement section B.1.4. of the ECMA262 spec
This allows the parser to deal with crazy patterns like the one
in #5517.
2021-02-27 07:31:01 +01:00
Luke
ce5fe2a6e8 LibGfx: Fix read buffer overflow in interlaced GIF decode
Unfortunately 10420dee7e didn't quite fix it,
as the buffer overflow was actually happening here:
af22204488/Userland/Libraries/LibGfx/GIFLoader.cpp (L402)

Found by oss-fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=30507
2021-02-27 07:30:39 +01:00
Itamar
85ea60b7f1 LibCpp: Don't fail when encountering #elif statements
However, we currently always treat the expression in #elif as true.
2021-02-26 21:14:41 +01:00
Linus Groh
e265054c12 Everywhere: Remove a bunch of redundant 'AK::' namespace prefixes
This is basically just for consistency, it's quite strange to see
multiple AK container types next to each other, some with and some
without the namespace prefix - we're 'using AK::Foo;' a lot and should
leverage that. :^)
2021-02-26 16:59:56 +01:00
speles
be9df404fd LibJS: Re-enable "reassignment to const" test
It passes now :^)
2021-02-26 16:59:37 +01:00
speles
f7d64e9fa8 LibJS: Set declared for-in and for-of variables as first time.
These declarations might be const, and now when we're handling it
properly, we have to set values to them correctly.
2021-02-26 16:59:37 +01:00
speles
913fd8de13 LibJS: Respect declaration kind for variables inside functions 2021-02-26 16:59:37 +01:00
Andreas Kling
79889ef052 LibELF: Consolidate main executable loading a bit
Merge the load_elf() and commit_elf() functions into a single
load_main_executable() function that takes care of both things.

Also split "stage 3" into two separate stages, keeping the lazy
relocations in stage 3, and adding a stage 4 for calling library
initialization functions.

We also make sure to map the main executable before dealing with
any of its dependencies, to ensure that non-PIE executables get
loaded at their desired address.
2021-02-26 14:49:55 +01:00
thankyouverycool
042152b346 LibGUI: Set correct open action for LinkLabel context menu
Replaces the Open... common action for files with more appropriate
Show in File Manager, as the desktop context menu uses
2021-02-26 13:50:00 +01:00
thankyouverycool
0c4fbcae76 LibGUI: Paint all widgets as toolbars in ToolBarContainer
Fixes missing shadow and highlight threeds for Bookmark bar
2021-02-25 19:23:12 +01:00
Tom
6cdb657493 LibGUI: Improve IconView rubberband performance
Rather than invalidating the entire window, which is very expensive on
the transparent desktop widget, just invalidate the areas that actually
need updating.
2021-02-25 18:04:06 +01:00
Tom
cd0a1fa5b0 LibGUI: Avoid needlessly copying vectors of rects 2021-02-25 18:04:06 +01:00
Tom
3907bacfcd LibGUI: Process pending invalidations when handling paint events
It's possible that pending invalidation rectangles haven't been
flushed when processing a paint event. Handle them right away,
which avoids another round trip.
2021-02-25 18:04:06 +01:00
Tom
35170715bc LibGUI: Constrain widgets to invalidating themselves only 2021-02-25 18:04:06 +01:00
Andreas Kling
eb08a0edd5 LibC: Make it compile on 64-bit
It won't actually work on 64-bit yet, but let's do our future selves
a favor and make it compile.
2021-02-25 16:27:12 +01:00
Andreas Kling
8714f389f9 LibC: Add x86_64 implementation of setjmp() and longjmp() 2021-02-25 16:27:12 +01:00
Andreas Kling
bb9cf083c4 LibC: Avoid double memory clearing in calloc()
calloc() was internally calling malloc_impl() which would scrub out
all the allocated memory with the scrub byte (0xdc). We would then
immediately zero-fill the memory.

This was obviously a waste of time, and our hash tables were doing
it all the time. :^)
2021-02-24 23:03:38 +01:00
Angus Gibson
0c44deeee2 LibGUI: Let cursor start a wrapped line
In line wrapping mode, the same column refers both to the end of a
visual line and the beginning of the subsequent visual line. This
meant that the cursor couldn't move to the beginning of a visual
line. Now, we only let the cursor go to the end of a physical line,
not the visual line.

Closes #4786
2021-02-24 22:30:08 +01:00
Angus Gibson
ae51dea524 LibGUI: Remove redundant cursor update 2021-02-24 22:30:08 +01:00
AnotherTest
ecc8e99a6b LibGUI: Account for the row and column headers when painting a TableView
Otherwise we'd be drawing all the rows, instead of the ones in view.
Fixes #5483.
2021-02-24 21:02:02 +01:00
Andreas Kling
7db8ccc0e4 LibC+DynamicLoader: Move "transactional memory" GCC stubs to LibC
Instead of having a special case in the dynamic loader where we ignore
TM-related GCC symbols, just stub them out in LibC like we already do
for various other things we don't support.
2021-02-24 14:54:26 +01:00
Brian Gianforcaro
069fd58381 LibELF: Convert more string literals to StringView literals.
Most of these won't have perf impact, but the optimization is
practically free, so no harm in fixing these up.
2021-02-24 14:45:34 +01:00
Brian Gianforcaro
141e6724d1 LibELF: Use StringView literal syntax to build section names. 2021-02-24 14:38:31 +01:00
AnotherTest
857cdee0d0 AK: Make dbgln_if() avoid evaluating the arguments when disabled
Naturally, this makes the `enabled` flag on dbgln() obsolete.
2021-02-24 13:07:28 +01:00
AnotherTest
71de5433f8 LibLine: Note that the search() call modifies the buffer
Fixes #5465.
2021-02-24 12:19:20 +01:00
AnotherTest
dd87b14f52 LibLine: Update the drawn cursor value when updating lazily 2021-02-24 12:19:20 +01:00
AnotherTest
21cbcdd7da LibLine: Properly update the main editor when clearing the search editor
This broke after the lazy update change :P
2021-02-24 12:19:20 +01:00
Linus Groh
7dd233b2b6 LibJS: Use const references to avoid some copies in the parser 2021-02-24 11:43:05 +01:00
Linus Groh
e640fdd395 LibJS: Let RegExpPrototype inherit from Object directly
https://tc39.es/ecma262/#sec-properties-of-the-regexp-prototype-object

The RegExp prototype object:
- is an ordinary object.
- is not a RegExp instance and does not have a [[RegExpMatcher]]
  internal slot or any of the other internal slots of RegExp instance
  objects.

In other words: no need to have RegExpPrototype inherit from
RegExpObject (we weren't even calling its initialize()).
2021-02-24 10:22:17 +01:00
Linus Groh
a72276407b LibJS: Make ArrayPrototype an Array object
https://tc39.es/ecma262/#sec-properties-of-the-array-prototype-object

The Array prototype object: [...] is an Array exotic object and has the
internal methods specified for such objects.

NOTE: The Array prototype object is specified to be an Array exotic
object to ensure compatibility with ECMAScript code that was created
prior to the ECMAScript 2015 specification.
2021-02-24 10:22:17 +01:00
Andreas Kling
679cc154e6 Everywhere: Remove unused RELEASE_ASSERT macro 2021-02-23 21:11:53 +01:00
Andreas Kling
5d180d1f99 Everywhere: Rename ASSERT => VERIFY
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED)

Since all of these checks are done in release builds as well,
let's rename them to VERIFY to prevent confusion, as everyone is
used to assertions being compiled out in release.

We can introduce a new ASSERT macro that is specifically for debug
checks, but I'm doing this wholesale conversion first since we've
accumulated thousands of these already, and it's not immediately
obvious which ones are suitable for ASSERT.
2021-02-23 20:56:54 +01:00
Andreas Kling
b33a6a443e LibELF: Inline DynamicObject::hash_section()
This was high up in profiles and gets almost entirely optimized out
when inlined, so let's do that.
2021-02-23 20:33:32 +01:00
Andreas Kling
4ed85e9b9e LibELF: Don't build barely-used section lookup table in ELF::Image
The name-to-section lookup table was only used in a handful of places,
and none of them were calling it nearly enough to justify building
a cache for it in the first place. So let's get rid of it and reduce
startup time by a little bit. :^)
2021-02-23 19:45:29 +01:00
Andreas Kling
4172a46fb5 LibDebug: Fix build with -O2
It turns out that LibDebug was the only thing that couldn't be built
with -O2. We were neglecting to deal with some stream read errors.
2021-02-23 19:43:44 +01:00
Andreas Kling
22b8110554 LibELF: Avoid doing strlen() on everything while iterating GNU hash
It's a lot faster to iterate the GNU hash tables if we don't have to
compute the length of every symbol name before rejecting it anyway while
comparing the first character. :^)
2021-02-23 19:43:44 +01:00
Andreas Kling
46a94a9a9e LibELF: Rename lookup_elf_symbol() => lookup_sysv_symbol()
We have two kinds of lookup, SYSV and GNU hash. Both are ELF lookups.
2021-02-23 19:43:44 +01:00
Andreas Kling
cc00df0f0f LibELF: Avoid calling strlen() in DynamicObject::hash_section()
The long-term fix here is to make StringView recognize compile-time
string literals and do the right thing automatically.
2021-02-23 19:43:44 +01:00
Andreas Kling
d6af3302e8 LibELF: Don't recompute the same ELF hashes over and over
When performing a global symbol lookup, we were recomputing the symbol
hashes once for every dynamic object searched. The hash function was
at the very top of a profile (15%) of program startup.

With this change, the hash function is no longer visible among the top
stacks in the profile. :^)
2021-02-23 19:43:44 +01:00
Andreas Kling
af6a633468 LibELF: Remove an ungodly amount of DYNAMIC_LOAD_DEBUG logging
This logging mode was unusable anyway since it spams way too much.
The dynamic loader is in a pretty good place now anyway, so I think
it's okay for us to drop some of the bring-up debug logging. :^)

Also, we have to be careful with dbgln_if(FOO_DEBUG, "{}", foo())
where foo() is something expensive, since it might get evaluated
even if !FOO_DEBUG.
2021-02-23 19:43:44 +01:00
Andreas Kling
37420f1baf LibELF: Move ELF hash functions to their own file (and make constexpr) 2021-02-23 19:43:44 +01:00
Brandon Scott
2f56a86a4e LibWeb: Added get source functionality and hook event 2021-02-23 16:23:56 +01:00
AnotherTest
c989e55195 LibWeb: Fix a tiny appendff() format issue
This would've just left the colour on for a few characters, nothing _too_ bad.
2021-02-23 13:59:33 +01:00
Andreas Kling
82278d632f LibWeb: Only scroll BlockBox on wheel event if overflow==scroll
We implement this by adding a BlockBox::is_scrollable() helper,
and then ignoring wheel events for non-scrollable boxes.

Thanks to FireFox317 for pointing this out! :^)
2021-02-22 23:44:51 +01:00
Andreas Kling
cd79b807dd LibWeb: Allow scrolling overflowed content with the mouse wheel :^)
This is rather crude, but you can now use the mouse wheel to scroll up
and down in block-level boxes with clipped overflowing content.
There's no limit to how far you can scroll in either direction, since
we don't yet track how much overflow there is. But it's a start. :^)
2021-02-22 21:47:00 +01:00
Andreas Kling
ded8c728d2 LibWeb: Plumb wheel events from widget layer to EventHandler 2021-02-22 21:46:54 +01:00
Andreas Kling
53081226e9 LibWeb: Clip overflowing inline children when overflow != "visible"
We now apply a paint-time clip to the padding rect of a BlockBox before
painting its inline-level children. This covers some of the behavior
we want from "overflow: hidden" etc but is far from a complete solution.
2021-02-22 21:46:46 +01:00
Andreas Kling
be2b45b215 LibGfx: Make Painter::draw_physical_pixel() clip with scaling in mind 2021-02-22 21:46:39 +01:00
Andreas Kling
2c3376f9d4 LibWeb: Respect explicitly specified CSS "height" on block elements
Don't size blocks to fit their contents if they have an explicit
(non-auto) height specified.
2021-02-22 18:56:48 +01:00
Andreas Kling
543dd54a1d LibWeb: Add bordered_rect() and padded_rect() helpers in Layout::Box 2021-02-22 18:52:58 +01:00
Andreas Kling
21371bf6ee LibWeb: Add parsing and application of CSS "overflow" property
We don't actually do anything with the values yet, but now they are
available for layout nodes once we are ready to implement them.
2021-02-22 15:21:42 +01:00
Andreas Kling
b126ead34e LibWeb: Support assigning to document.body when it is null 2021-02-22 14:00:47 +01:00
Andreas Kling
9100a1fde9 LibGfx: Don't color outside the lines in Painter::draw_physical_pixel()
Fixes #5422.
2021-02-22 11:44:57 +01:00
Andreas Kling
e405a8f730 LibWeb: Defer the handling of WebContent process crashes
Handling crashes synchronously is finicky since we're modifying the
m_client_state struct while in a callback lambda owned by it.
Let's avoid all the footguns here by simply using deferred_invoke()
and handling the crash on next event loop iteration instead.
2021-02-22 11:28:34 +01:00
thankyouverycool
bbbcddb252 LibGUI: Ignore glyph dimensions when painting a titleless GroupBox 2021-02-22 09:21:30 +01:00
thankyouverycool
3e987eba2b TextEditor+LibGUI: Add case matching and wrap around optionality
Adds simple ASCII case matching and wrap around toggles to
TextEditor's find/replace widget and reorganizes its layout
2021-02-22 09:21:30 +01:00
Andreas Kling
9194a97cbe LibWeb: Add Document.createRange()
Also tidy up DOM::Range a little bit while we're here, and unify the
way we create them to use a delegating constructors.
2021-02-21 23:48:01 +01:00
Mițca Dumitru
8d6525fc50 LibGUI: Show context menu when right-clicking a LinkLabel
Fixes #4794
2021-02-21 23:47:05 +01:00
Tom
2677e24a99 LibGUI: Copy alpha channel as-is when keeping backing bitmaps in sync 2021-02-21 23:45:04 +01:00
Ben Wiederhake
3084291625 LibGUI: Fix crash when previewing palette images
For example, navigating File Manager to a directory that contains a vaild BMP file that
uses a palette, this code would end up trying to create an indexed thumbnail.
However, Painter asserts that the thumbnail that we paint on is *not* indexed,
usually crashing File Manager.

Partially fixes #5299, as it now crashes somewhere else.
2021-02-21 22:34:09 +01:00
Andreas Kling
bd830c2dfe LibCpp: Fix yet another broken outln() invocation..
Fixes #5463
2021-02-21 22:13:32 +01:00
Andreas Kling
15cfde7233 LibWeb: Expose the Window object as Document.defaultView
This should really be a WindowProxy? but since we don't have anything
representing that concept yet, let's just expose the Window object
directly so document.defaultView.foo works. :^)
2021-02-21 21:32:16 +01:00
Andreas Kling
7f66a4e3ba LibJS: Print console.{debug,error,info,log,warn} to system debug log 2021-02-21 21:32:16 +01:00
Andreas Kling
0bb2729423 LibCpp: Fix busted outln() invocations 2021-02-21 21:32:16 +01:00
Linus Groh
a4f80ee658 LibWeb: Replace WrapperGenerator's snake_name() with String::to_snakecase()
This now turns "createHTMLDocument" into "create_html_document", that's
another FIXME gone. :^)
2021-02-21 19:47:47 +01:00
AnotherTest
43948aee51 LibC: Don't #define away __{BEGIN,END}_DECLS in stdarg.h
That would force anything that includes this to have language-specific
linkage, and absolutely break `sys/cdefs.h`.

Fixes #5452.
2021-02-21 18:27:50 +01:00
Mițca Dumitru
919492945e LibCore: Add file management helpers to reduce code duplication
FileManager, cp, mv, rm had some duplicated code, implementing basic
file management operations. This patch creates adds functions that try
to provide an interface suited for all these programs, but this patch
does not make them be used throughout the Userland.

They are added to Core::File following the example of functions such as
read_link/real_path_for.
2021-02-21 18:14:29 +01:00
Andreas Kling
1e3a6ba572 LibVT: Avoid double relayout during interactive resize
Don't fire the on_terminal_size hook while we're in relayout.
This fixes the terminal window flopping around during interactive
resizing. (It was mostly noticeable if something else was hogging
the CPU at the same time.)
2021-02-21 16:52:22 +01:00
Andreas Kling
df8f074cf6 LibJS: Make TypedArray::data() return a Span<T>
This inserts bounds checking assertions whenever we're reading/writing
a typed array from JS.
2021-02-21 14:21:26 +01:00
Tom
1c31bcb24e WindowServer: Allow changing frameless state after a window is created 2021-02-21 10:33:28 +01:00
Linus Groh
368fe0f7f8 LibVT: Don't paint selection with opacity
Fixes #5442.
2021-02-21 10:33:22 +01:00
AnotherTest
d8a3285d78 LibLine: Move the search editor exactly after the last line
Previously, we'd always put it right after the prompt.
2021-02-21 09:01:00 +01:00
AnotherTest
9790ee4649 LibLine: Make clear_lines() work when only clearing the current line 2021-02-21 09:01:00 +01:00
AnotherTest
6472e5239c LibLine: Update the lazy refresh data and flags in some more places
These were forgotten in the last LibLine commit, any changes to m_buffer
not going through insert() and remove_at_index() should also be updating
these.

Fixes #5440.
2021-02-21 09:01:00 +01:00
Tom
a0cbb9068b LibGUI: Let ScrollableWidget handle the wheel events of its ScrollBars
Route the ScrollBar's wheel event to the ScrollableWidget so it can
handle it itself. This allows it to handle it consistently (e.g.
speed) when the cursor is hovering the scroll bars rather than the
widget's contents.

Fixes #5419
2021-02-21 01:06:17 +01:00
Andreas Kling
cb2db3710b LibELF: Fix build with ELF_IMAGE_DEBUG 2021-02-21 00:48:00 +01:00
Andreas Kling
f23b29f605 LibELF: Move DynamicObject::lookup_symbol() to DynamicLoader
Also simplify it by removing an unreachable code path.
2021-02-21 00:29:52 +01:00
Andreas Kling
a43910acc3 LibELF: Make SymbolLookupResult::address a VirtualAddress
Let's use a stronger type than void* for this since we're talking
specifically about a virtual address and not necessarily a pointer
to something actually in memory (yet).
2021-02-21 00:02:21 +01:00
Andreas Kling
c5d93e55d0 LibELF: Simplify DynamicObject::Symbol class a bit
We no longer need the create_undefined() helper function.
Also we don't need a member field for is_undefined().
2021-02-21 00:02:21 +01:00
Andreas Kling
1997d5de1a LibELF: Make symbol lookup functions return Optional<Symbol>
It was very confusing how these functions used the "undefined" state
of Symbol to signal lookup failure. Let's use Optional<T> to make things
a bit more understandable.
2021-02-21 00:02:21 +01:00
Andreas Kling
46c3ff2acf LibELF: Remove "always bind now" global flag
This looked like someone's forgotten debug mechanism.
2021-02-21 00:02:21 +01:00
Andreas Kling
ba1eea9898 LibELF+DynamicLoader: Rename DynamicObject::construct() => create() 2021-02-21 00:02:21 +01:00
Andreas Kling
01f1e480e5 LibELF: Fix various clang-tidy warnings
Remove a bunch of unused code, unnecessary const, and make some
non-object-specific member functions static.
2021-02-21 00:02:21 +01:00
Andreas Kling
0c0127dc3f LibELF: Use StringView instead of "const char*" in dynamic linker code
There's no reason to use C strings more than absolutely necessary.
2021-02-20 22:29:12 +01:00
AnotherTest
074e2ffdfd LibLine: Avoid refreshing the entire line when inserting at the end
This patchset allows the editor to avoid redrawing the entire line when
the changes cause no unrecoverable style updates, and are at the end of
the line (this applies to most normal typing situations).
Cases that this does not resolve:
- When the cursor is not at the end of the buffer
- When a display refresh changes the styles on the already-drawn parts
  of the line
- When the prompt has not yet been drawn, or has somehow changed

Fixes #5296.
2021-02-20 22:28:23 +01:00
thankyouverycool
ef61a963e9 LibGUI: Always set tree column content width to widest open node
Fixes hidable horizontal scrollbars remaining visible even after
collapsing their responsible nodes. Tree column width defaults to
column header width if wider than current content.
2021-02-20 22:27:52 +01:00
thankyouverycool
2df219d608 LibGUI: Recheck size excesses when scrollbars become visible
Fixes edge cases in which hidden scrollbars could become visible
and obscure content or fail to hide when no longer needed
2021-02-20 22:27:52 +01:00
thankyouverycool
8789a91a4e LibGUI: Set IconView content width to actual content only
Fixes incorrect excess size reporting when updating scrollbars
and allows horizontal scrolling if IconView is resized smaller
than a single column
2021-02-20 22:27:52 +01:00
Andreas Kling
08476e7fe7 DynamicLoader: Always make .data segment read+write
Let's just ignore the program header and always go with read+write.
Nothing else makes sense anyway.
2021-02-20 19:02:48 +01:00
Andreas Kling
8d98051551 AK+LibC: Remove dbgprintf() :^)
Everything has been moved to dbgln() or other AK::Format-based APIs.
We can finally get rid of this old thing.
2021-02-20 17:17:30 +01:00
Andreas Kling
542d8591e0 LibVT: Oops, fix dbgln() invocation mistake 2021-02-20 17:16:33 +01:00
Andreas Kling
68406fc0ef LibCpp: Replace dbgprintf() with outln() 2021-02-20 17:12:25 +01:00
Andreas Kling
b1a705d7d8 LibTLS: Replace dbgprintf() with dbgln() 2021-02-20 17:06:39 +01:00
Andreas Kling
499a59ed86 LibVT: Put "unimplemented escape" whining on debug log
I'm not sure why we were injecting these debug messages into the
terminal output, but it makes a big mess for no benefit.
2021-02-20 17:04:46 +01:00
Andreas Kling
81b21504a7 LibVT: Implement switching between 80/132 column modes (DECCOLM)
This gets us past a few more screens in vttest. :^)
2021-02-20 17:04:46 +01:00
Andreas Kling
8c9ae4e537 Terminal+LibVT: Resize Terminal app window when requested by VT
This will allow us to react to things like DECCOLM.
2021-02-20 17:04:46 +01:00
Andreas Kling
bb6d6dce7b LibVT: Give proper names to remaining VTxxx control functions 2021-02-20 17:04:46 +01:00
Andreas Kling
a59d96e461 LibVT: Give proper names to SD and SU 2021-02-20 17:04:46 +01:00
Andreas Kling
75084d3b3f LibVT: Move control function doc comments to Terminal.h header
Putting the little documentation comment about what each VTxxx control
function does in the header allows them to be picked up by IDE's.
2021-02-20 17:04:46 +01:00
Andreas Kling
6c7c6de52b LibVT: Give proper names to SCOSC and SCORC 2021-02-20 17:04:46 +01:00
Itamar
d3ff82ba80 LibCpp: Store filename in ASTNodes
As part of the position information, we now also store the filename the
ASTNode belongs to.
2021-02-20 15:53:37 +01:00
Andreas Kling
85271a4dd8 LibGUI: Allow setting a tooltip on BreadcrumbBar segments 2021-02-20 14:23:21 +01:00
Andreas Kling
4853576db7 LibGUI: Ignore keydown events with Alt modifier in AbstractView
AbstractView doesn't actually do anything with them anyway, but they
would get swallowed by the cursor logic and not bubble up the widget
parent chain.
2021-02-20 13:27:21 +01:00
Andreas Kling
d9212bb2f4 LibGUI: Parent FilePicker toolbar buttons to the window
This makes the shortcuts actually work since unparented actions are
considered application-global, and we disable application-global
shortcuts while a modal dialog (like FilePicker) is up. This is pretty
counter-intuitive so I think there's room for API improvement here
but let's at least make Alt+Up work in FilePicker for now. :^)
2021-02-20 13:27:21 +01:00
Andreas Kling
716dc5bec9 LibGUI: Use delegating constructors in GUI::Action 2021-02-20 13:25:04 +01:00
Andreas Kling
1bc17d2870 LibGUI: Tidy up Action constructors and factory functions a bit 2021-02-20 13:25:04 +01:00
Linus Groh
a1a625b565 LibWeb: Move ExceptionOr bindings utils into own header 2021-02-20 13:10:55 +01:00
Linus Groh
5e07c27e25 LibWeb: Implement Window.prompt() 2021-02-20 12:19:46 +01:00
Linus Groh
f10967e364 LibGUI: Set InputBox initial value to text_value string 2021-02-20 12:19:46 +01:00
Linus Groh
3583b62ad3 LibGUI: Swap order of InputBox value and parent window args
This is now consistent with the other dialog classes.
2021-02-20 12:19:46 +01:00
Andreas Kling
3b9f110161 LibWeb+LibImageDecoderClient: Reuse ImageDecoder service process
The overhead from spawning a new ImageDecoder for every decoding job is
way too large and causing other problems as well (#5421)

Let's keep the same decoder open and reuse it as long as it's working.
2021-02-20 11:37:55 +01:00
Andreas Kling
8fb9d1fd1d LibImageDecoderClient: Gracefully recover from decoder crashes :^)
If the ImageDecoder service crashes while decoding an image for us,
we now recover gracefully and simply return null.

This shields the browser from bugs in our image decoders.
2021-02-20 11:37:55 +01:00
Andreas Kling
a446cea759 LibIPC: Add Connection::send_sync_but_allow_failure()
Instead of asserting that the peer responds successfully, this API
allows for the peer to die/crash/whatever happens on the other side
while handling a synchronous request.

This will be useful when using process separation to parse untrusted
data from the web.
2021-02-20 11:37:55 +01:00
Linus Groh
14058b6858 LibWeb: Use DOMException in XMLHttpRequest::send() 2021-02-20 09:14:19 +01:00
Linus Groh
70878290b9 LibWeb: Use DOMException in XMLHttpRequest::open() 2021-02-20 09:14:19 +01:00
Linus Groh
c4d8cce9a2 LibWeb: Use DOMException in XMLHttpRequest::set_request_header() 2021-02-20 09:14:19 +01:00
Linus Groh
4e1de09340 LibWeb: Use DOMException in HTMLElement::set_content_editable() 2021-02-20 09:14:19 +01:00
Linus Groh
dd621cc650 LibWeb: Use DOMException in Document::set_body() 2021-02-20 09:14:19 +01:00
Linus Groh
e064194061 LibWeb: Return InvalidCharacterError from Element::set_attribute() for empty attr
This is the first user of the new DOMException, using ExceptionOr. :^)
2021-02-20 00:09:11 +01:00
Linus Groh
3da2b51d74 LibWeb: Generate code for throwing DOMExceptions based on ExceptionOr<T>
There's a little bit of template magic involved here to make it work,
but this seems alright. Very cool! :^)

Co-authored-by: AnotherTest <ali.mpfard@gmail.com>
2021-02-20 00:09:11 +01:00
Linus Groh
e708f1c3a2 LibWeb: Add DOM::ExceptionOr<T> container
Much like AK::Result this carries either a DOM::DOMException or regular
return value and will be used by DOM functions for exceptions that
should be thrown.
2021-02-20 00:09:11 +01:00
Linus Groh
ada71dc71b LibWeb: Add DOM::DOMException class and bindings 2021-02-20 00:09:11 +01:00
Andreas Kling
4f0be55770 LibGUI: Remove GUI::FilePicker::file_exists()
I have no idea why this existed but everyone should just use
Core::File::exists() instead. :^)
2021-02-19 23:46:54 +01:00
Andreas Kling
a8e0671344 LibGUI: Port GUI::FilePicker to GML and improve the layout
Also remove the image preview feature as it was rather ugly.
If we bring it back we should it should look good.
2021-02-19 23:03:47 +01:00
Andreas Kling
cda3c5df59 LibGUI: Register GUI::MultiView 2021-02-19 23:03:47 +01:00
Andreas Kling
1e6d04c746 LibC: Remove text relocation
Tweak the PLT trampoline to avoid generating textrels in LibC.
This allows us to share all the LibC mappings, reducing per-process
memory consumption by ~200 KB. :^)

Patch originally by @nico.
2021-02-19 09:04:05 +01:00
Andreas Kling
713b3b36be DynamicLoader+Userland: Enable RELRO for shared libraries as well :^)
To support this, I had to reorganize the "load_elf" function into two
passes. First we map all the dynamic objects, to get their symbols
into the global lookup table. Then we link all the dynamic objects.

So many read-only GOT's! :^)
2021-02-19 00:03:03 +01:00
Andreas Kling
fa4c249425 LibELF+Userland: Enable RELRO for all userland executables :^)
The dynamic loader will now mark RELRO segments read-only after
performing relocations. This is pretty cool!

Note that this only applies to main executables so far,.
RELRO support for shared libraries will require some reorganizing
of the dynamic loader.
2021-02-18 18:55:19 +01:00
Andreas Kling
0d3866e84c DynamicLoader: Some ELF data segments were allocated too small
For a data segment that starts at a non-zero offset into a 4KB page and
crosses a 4KB page boundary, we were failing to pad the VM allocation,
which would cause the memcpy() to fail.

Make sure we round the segment bases down, and segment ends up, and the
issue goes away.
2021-02-18 18:14:59 +01:00
Linus Groh
edec5e29a3 LibC: Remove serenity.h.rej 2021-02-18 09:23:11 +01:00
Brendan Coles
0f084e0531 LibChess: SetOptionCommand: Set provided option name and value 2021-02-18 08:00:02 +01:00
Breno Silva
cfb0f3309d LibJS: Implement tests for Array.prototype.flat 2021-02-18 00:22:45 +01:00
Kesse Jones
3940635ed3 LibJS: Implement Array.prototype.flat 2021-02-18 00:22:45 +01:00
jonno85uk
83d880180e
LibC: Use "static inline" for inline functions in arpa/inet.h (#5392)
This makes it work when compiling as C.
2021-02-18 00:02:47 +01:00
Andreas Kling
8aec1cd232 LibTTF: ScaledFont should have a NonnullRefPtr<TTF::Font>
A ScaledFont without an underlying TTF::Font would not be valid.
2021-02-17 23:45:21 +01:00
Linus Groh
13867600c3 LibWeb: Add constructor to XMLHttpRequest IDL interface 2021-02-17 23:45:07 +01:00
Linus Groh
8f8f7bfd0f LibWeb: Add constructor to Range IDL interface 2021-02-17 23:45:07 +01:00
Linus Groh
0ac07c7351 LibWeb: Add constructor to Event IDL interface 2021-02-17 23:45:07 +01:00
Linus Groh
0f1da7d40c LibWeb: Add constructor to Document IDL interface 2021-02-17 23:45:07 +01:00
Linus Groh
8c7d1986b8 LibWeb: Actually construct impl and wrapper in construct() :^)
FooConstructor::construct() is no longer a dummy but now generates
either code to throw an exception (for interfaces without constructor)
or code to construct the wrapper and its impl object.

Constructor overloads are not currenly handled, but that's not something
we need right now anyway. Instead of  regular create() this uses a new
static function create_with_global_object() and passes the WindowObject,
which may be needed - e.g. for XMLHttpRequest, which has an IDL and
JavaScript constructor with no arguments, but needs a DOM::Window in its
create().
2021-02-17 23:45:07 +01:00
Linus Groh
e3577f871b LibWeb: Parse IDL interface constructors
WrapperGenerator will now parse and store IDL interface constructors,
including parameters and overloads.
See https://heycam.github.io/webidl/#idl-constructors.
2021-02-17 23:45:07 +01:00
Linus Groh
ff324fe989 LibWeb: Fix .length of functions generated from IDL
Function::length() is computing the right function length based on its
parameters, but we never called it - instead the *function name length*
was being used, which is obviously wrong. How silly! :^)
2021-02-17 23:45:07 +01:00
Nick Vella
05914d2e9a LibGUI: Correctly handle ComboBox list windows of less than three items (~50px) in height.
By default, a Window has a minimum size of 50x50 - ComboBox lists aren't
always this tall. We now set the minimum height of the ComboBox Window
according to the height of three items, or the total height of all the
items in the list, whichever is smaller.
This means there is no longer any unpainted space in the list window
due to the shortfall between the ListBox widget and Window heights,
and the ComboBox list window always remains a comfortable height for
viewing. :^)
2021-02-17 23:06:19 +01:00
Andreas Kling
2d64ba7b9d LibWeb: Convert dbgprintf() => dbgln() 2021-02-17 15:59:13 +01:00
Andreas Kling
403b34d38e LibC: Convert dbgprintf() => dbgln() in SSP handler 2021-02-17 15:48:55 +01:00
Andreas Kling
304f0fe5ee LibGUI: Convert dbgprintf() => dbgln() 2021-02-17 15:47:00 +01:00
Andreas Kling
25a69d2b18 LibPthread: Convert dbgprintf() => dbgln_if() 2021-02-17 15:46:21 +01:00
Andreas Kling
c1dd5553a8 LibCore: Convert dbgprintf() => dbgln() 2021-02-17 15:40:52 +01:00