Commit graph

17123 commits

Author SHA1 Message Date
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
06919d189b Kernel: Enable three missing KUBSAN options :^)
With the kernel command line issue fixed, we can now enable these
KUBSAN options without getting triple faults on startup:

* alignment
* null
* pointer-overflow
2021-02-23 19:43:44 +01:00
Andreas Kling
bc029a6314 Everywhere: Build with -O2 :^)
Let's try going faster instead of smaller.
2021-02-23 19:43:44 +01:00
Andreas Kling
5100dabb96 Kernel: Copy the kernel command line to a good location at boot
When building the kernel with -O2, we somehow ended up with the kernel
command line outside of the lower 8MB of physical memory. Since we don't
map that area in our initial page table setup, we would triple fault
when trying to parse the command line.

This patch sidesteps the issue by copying the (first 4KB of) the kernel
command line to a buffer in a known safe location at boot.
2021-02-23 19:43:44 +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
Andreas Kling
145923bdc9 AK: Slap Optional with the ALWAYS_INLINE stick
I saw some Optional constructors when profiling the dynamic loader
and that seemed silly since we can inline them at no/little cost.
2021-02-23 17:42:05 +01:00
Andreas Kling
de52fe6156 Kernel: Only build with -fsanitize=* if using GCC
Clangd (CLion) was choking on some of the -fsanitize options, and since
we're not building the kernel with Clang anyway, let's just disable
the options for non-GCC compilers for now.
2021-02-23 17:41:34 +01:00
Andreas Kling
31ac93d051 AK: Optimize StringView::operator==(const char*) a little bit
Don't compute the strlen() of the string we're comparing against first.
This can save a lot of time if we're comparing against something that
already fails to match in the first few characters.
2021-02-23 17:41:18 +01:00
Andreas Kling
87bb00f6ab Build: Only use -fstack-clash-protection with GCC
This is not yet supported by Clang, so let's disable it for non-GCC
compilers for now. (CLion was whining about it.)
2021-02-23 17:41:03 +01:00
Brandon Scott
99e6c9b23d Browser: Implement view source for out of process mode
Implemented view source functionality for out of process mode
and moved view source dialog creation into seperate static
method.
2021-02-23 16:23:56 +01:00
Brandon Scott
2f56a86a4e LibWeb: Added get source functionality and hook event 2021-02-23 16:23:56 +01:00
Brandon Scott
306501fd4a WebContent: Added IPC calls for getting source 2021-02-23 16:23:56 +01:00
Brendan Coles
a032c836c4 HexEditor: Add menu icons for search menu items 2021-02-23 15:56:11 +01:00
AnotherTest
7c2754c3a6 AK+Kernel+Userland: Enable some more compiletime format string checks
This enables format string checks for three more functions:
- String::formatted()
- Builder::appendff()
- KBufferBuilder::appendff()
2021-02-23 13:59:33 +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
AnotherTest
347d741afb AK+Userland: Extend the compiletime format string check to other functions
Thanks to @trflynn89 for the neat implicit consteval ctor trick!
This allows us to basically slap `CheckedFormatString` on any
formatting function, and have its format argument checked at compiletime.

Note that there is a validator bug where it doesn't parse inner replaced
fields like `{:~>{}}` correctly (what should be 'left align with next
argument as size' is parsed as `{:~>{` following a literal closing
brace), so the compiletime checks are disabled on these temporarily by
forcing them to be StringViews.

This commit also removes the now unused `AK::StringLiteral` type (which
was introduced for use with NTTP strings).
2021-02-23 13:59:33 +01:00
AnotherTest
29c8d34be7 HackStudio: Fix a misuse of dbgln() intended as dbgln_if()
This currently works accidentally, just because there's an overload for
`dbgln<bool>(...)` - it just bypasses the compiletime checks.
2021-02-23 13:59:33 +01:00
AnotherTest
644d981b2b AK: Untangle TestSuite assertions a bit 2021-02-23 13:59:33 +01:00
AnotherTest
531d72fdfd Kernel: Fix a dmesgln() format error 2021-02-23 13:59:33 +01:00
AnotherTest
1c4e15117d UserspaceEmulator: Fix an outln() format bug 2021-02-23 13:59:33 +01:00
Brendan Coles
501834ba45 Inspector: Add help documentation 2021-02-23 13:52:16 +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
Ivan Hansgaard Hansen
c9cd96894b
HackStudio: Fix opened files appearing empty (#5480)
When files where placed in outside of the project root, they would
appear empty because the label in the tree would differ from the
actual file path relative to the root.

Fixes #5471.
2021-02-22 23:00:57 +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
42f582bf8b DisplaySettings: Tweak UI, call it "1x/2x scale" instead of "100%/200%" 2021-02-22 14:13:00 +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
TheMorc
38781cb131 Base: Add Slovak keymap 2021-02-22 09:46:02 +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
Tom
b4c0314f1d WindowServer: Don't close context menus when hovering over menu bar 2021-02-22 09:09:26 +01:00
Tom
35363a972a WindowServer: Reset menu position when opened by the menu bar
Also, only mark the menu bar item as opened if a menu was actually
opened through the menu bar.

These changes allow a menu to be used both in the menu bar as well
as a context menu.

Fixes #5469
2021-02-22 09:09:26 +01:00
AnotherTest
bd318dcdcd Toolchain: Always remove the previous artifacts when building 2021-02-21 23:50:34 +01:00
Jorropo
7b156a7add
Documentation: Combine two "cd" commands in build instructions (#5457) 2021-02-21 23:49:56 +01:00
Kevin Kuehler
c909f7001c keymaps: Add dvorak-programmer
I left the numpad the same as qwerty because I don't have a keyborad
with a numpad and don't know if those keys change or not.
2021-02-21 23:48:57 +01:00