Commit Graph

24089 Commits

Author SHA1 Message Date
Marcus Nilsson
22611ca136 WidgetGallery: Pledge thread
This is needed to use the file picker dialog.
2021-07-17 23:30:58 +02:00
Marcus Nilsson
57fc6eb9be WidgetGallery: Remove unused include 2021-07-17 23:30:58 +02:00
Andreas Kling
b8d6c3722d Kernel: Remove Inode::directory_entry_count()
This was only used in one place: VirtualFileSystem::rmdir(), and that
has now been converted to a simple directory traversal.
2021-07-17 22:36:04 +02:00
Andreas Kling
d1bbe8b652 Kernel: Count remaining children in VirtualFileSystem::rmdir() manually
To count the remaining children, we simply need to traverse the
directory and increment a counter. No need for a custom virtual that
all file systems have to implement. :^)
2021-07-17 22:34:43 +02:00
Andreas Kling
a3f58a5003 Kernel/DevFS: Use KString for DevFSDeviceInode::m_name 2021-07-17 22:17:07 +02:00
Andreas Kling
0d89cfcd9a Kernel/DevFS: Use KString for DevFSLinkInode::m_link 2021-07-17 22:11:41 +02:00
Andreas Kling
cd4d73e19e Kernel: Add an API for turning a UserOrKernelBuffer into a KString 2021-07-17 22:07:49 +02:00
Andreas Kling
dd37d0a327 Kernel/DevFS: Use KString for DevFSLinkInode::m_name 2021-07-17 21:40:32 +02:00
Andreas Kling
61c1937d02 Kernel/DevFS: Make DevFSInode::name() return StringView 2021-07-17 21:36:54 +02:00
Andreas Kling
6766efff9c Kernel: Make Inode::create_child() take the name as a StringView
No sense in forcing callers to construct a String. One more small step
towards not using String in the kernel.
2021-07-17 21:32:59 +02:00
Andreas Kling
9359f7801f Kernel/DevFS: Remove some unnecessary inode locking
Unless we're accessing mutex-guarded metadata, there's no need to
acquire the inode lock.

The file system ID or inode index of a constructed inode will never
change, for example.
2021-07-17 21:26:47 +02:00
Andreas Kling
3b805a57e6 Kernel: Rename Inode::m_lock => m_inode_lock
This makes file system code much easier to read since it was hard when
both the file system and inode locks were called "m_lock".
2021-07-17 21:17:39 +02:00
Andreas Kling
63e1423830 Kernel: Remove unused Inode::is_shared_vmobject() 2021-07-17 21:11:12 +02:00
Andreas Kling
cee9528168 Kernel: Rename Lock to Mutex
Let's be explicit about what kind of lock this is meant to be.
2021-07-17 21:10:32 +02:00
Andreas Kling
a803c4026c Kernel: Make FileSystem::class_name() return a StringView 2021-07-17 20:59:48 +02:00
Timothy Flynn
a2e734d202 LibJS: Report string length as the code point length, not byte length
For example, U+180E is 3 bytes, but should have a string length of 1.
2021-07-17 16:59:59 +01:00
Timothy Flynn
87848cdf7d AK: Track byte length, rather than code point length, in Utf8View::trim
Utf8View::trim uses Utf8View::substring_view to return its result, which
requires the input to be a byte offset/length rather than code point
length.
2021-07-17 16:59:59 +01:00
Peter Bindels
660a8982e7 LibM: Turn off builtins, fix tests & implementation
While trying to port to Clang we found that the functions as
implemented didn't actually work, and replacing them with a blatantly
broken function also did not break the tests on the GCC build. It
turns out we've been testing GCC's builtins by many tests. This
removes the use of builtins for LibM's tests (so we test the whole
function). It turns off the denormal test for scalbn (which was not
implemented) and comments out the tgamma(0.5) test which is too
inaccurate to be usable (and too complicated for me to fix). The gamma
function was made accurate for all other test cases, and asin received
two more layers of Taylor expansion to bring it within error margin
for the tests.
2021-07-17 17:37:20 +02:00
Brian Gianforcaro
c0987453e6 Kernel: Remove double RedBlackTree lookup in VM/Space region removal
We should never request a regions removal that we don't currently
own. We currently assert this everywhere else by all callers.

Instead lets just push the assert down into the RedBlackTree removal
and assume that we will always successfully remove the region.
2021-07-17 16:22:59 +02:00
Brian Gianforcaro
d879709ec7 Kernel: Convert the PhysicalPage bool parameter to an enum 2021-07-17 18:38:28 +04:30
Karol Kosek
399be9bcc3 FileManager+Spreadsheet: Unify cut-copy-paste order
File Manager and Spreadsheet had an inconsistent order relative
to other apps (they had a copy-cut-paste order, where every other app
had a cut-copy-paste order).
2021-07-17 18:30:37 +04:30
Brian Gianforcaro
cfef3040fb Profiler: Configure the TimelineContainer to be shrink to fit
Today the profile viewer timeline view has a static size, which is
computed as half the height of the window given it has two root widgets.

Instead the timeline view should shrink to only consume the size that
each process timeline consumes.
2021-07-17 18:24:54 +04:30
Brian Gianforcaro
a2a5af9745 AK: Restrict timespec comparison operator overloads in AK::Time
The previous implementation was too generic, and would cause conflicting
operator overload errors when included in certain code paths. Fix this
by restricting the template parameters to types which have the same
member names as `struct timespec`.
2021-07-17 17:39:12 +04:30
Max Wipfli
ccae0cae45 LibWeb: Rename HTMLToken::doctype_data() => ensure_doctype_data()
This renames the accessor to better reflect what it does, as this will
allocate a DoctypeData struct if there is none.
2021-07-17 16:24:57 +04:30
Max Wipfli
519a1cdc22 LibWeb: Change HTMLToken storage architecture
This completely changes how HTMLTokens store their data. Previously,
space was allocated for all token types separately. Now, the HTMLToken's
data is stored in just a String, two booleans and a Variant.

This change reduces sizeof(HTMLToken) from 68 to 32. Also, this reduces
raw tokenization time by around 20 to 50 percent, depending on the page.
Full document parsing time (with HTMLDocumentParser, on a local HTML
page without any dependency files) is reduced by between 4 and 20
percent, depending on the page.

Since tokenizing HTML pages can easily generated 50'000 tokens and more,
the storage has been designed in a way that avoids heap allocations
where possible, while trying to reduce the size of the tokens. The only
tokens which need to allocate on the heap are thus DOCTYPE tokens (max.
1 per document), and tag tokens (but only if they have attributes). This
way, only around 5 percent of all tokens generated need to allocate on
the heap (except for StringImpl allocations).
2021-07-17 16:24:57 +04:30
Max Wipfli
8a4c44db8c LibWeb: Make HTMLTokens non-copyable 2021-07-17 16:24:57 +04:30
Max Wipfli
7eb294df0d LibWeb: Move HTMLToken in HTMLDocumentParser
This replaces a copy construction of an HTMLToken with a move(). This
allows HTMLToken to be made non-copyable in a further commit.
2021-07-17 16:24:57 +04:30
Max Wipfli
b6e995ca3c Tests: Use pointers in TestHTMLTokenizer to avoid copying HTMLTokens 2021-07-17 16:24:57 +04:30
Max Wipfli
2532bdfabf LibWeb: Remove friend class declarations from HTMLToken
Since all interaction with the HTMLToken class now happens over getters
and setters, there is no more need for HTMLTokenizer and
HTMLDocumentParser to have direct access to the members.
2021-07-17 16:24:57 +04:30
Max Wipfli
25cba4387b LibWeb: Add HTMLToken(Type) constructor and use it 2021-07-17 16:24:57 +04:30
Max Wipfli
f2e3c770f9 LibWeb: Use setter for HTMLToken::m_{start,end}_position 2021-07-17 16:24:57 +04:30
Max Wipfli
8b31e41692 LibWeb: Change HTMLToken::m_doctype into named DoctypeData struct
This is in preparation for an upcoming storage change of HTMLToken. In
contrast to the other token types, the accessor can hand out a mutable
reference to allow users to change parts of the DoctypeData easily.
2021-07-17 16:24:57 +04:30
Max Wipfli
918bde98b1 LibWeb: Hide implementation details of HTMLToken attribute list
Previously, HTMLToken would expose the Vector<Attribute> directly to
its users. In preparation for a future change, all users now use
implementation-agnostic APIs which do not expose the Vector directly.
2021-07-17 16:24:57 +04:30
Max Wipfli
15d8635afc LibWeb: User getter+setter for HTMLToken tag name and self-closing flag 2021-07-17 16:24:57 +04:30
Max Wipfli
1aeafcc58b LibWeb: Use getter and setter for Character type HTMLTokens
While storing the code point in a UTF-8 encoded String in horrendously
inefficient, this problem will be addressed at a later stage.
2021-07-17 16:24:57 +04:30
Max Wipfli
e8e9426b4f LibWeb: User getter and setter for Comment type HTMLTokens 2021-07-17 16:24:57 +04:30
Max Wipfli
f886aa15b8 LibWeb: Rename HTMLToken::AttributeBuilder struct to Attribute
This does not contain StringBuilders anymore, so it can do with a
simpler name: Attribute.
2021-07-17 16:24:57 +04:30
Max Wipfli
d82f3eb085 LibWeb: Make HTMLToken::{Position,AttributeBuilder} structs public
There was and is no reason for those to be private. Making them public
also allows us to explicitly specify the return type of some getters.
2021-07-17 16:24:57 +04:30
Brian Gianforcaro
eb282ad410 Kernel: Declare VM/RangeAllocator trivial destructor as default
This is a clang tidy recommendation.
2021-07-17 13:02:09 +02:00
Brian Gianforcaro
24bd664980 Kernel: Remove stale include from VM/RangeAllocator.cpp
This was left over after the latest big refactor of the VM subsystem.
2021-07-17 13:02:09 +02:00
Brian Gianforcaro
6059d69249 AK: Mark RedBlackTree functions as [[nodiscard]] 2021-07-17 13:02:09 +02:00
Brian Gianforcaro
af65c4d8b7 AK: Mark AK::IntrusiveRedBlackTree as final 2021-07-17 13:02:09 +02:00
Brian Gianforcaro
9a6e065b36 AK: Mark AK::IntrusiveList Non copyable and movable 2021-07-17 13:02:09 +02:00
Brian Gianforcaro
deda32628a AK: Mark RedBlackTree as final 2021-07-17 13:02:09 +02:00
Brian Gianforcaro
86b02a678c AK: Mark RedBlackTree find APIs as [[nodiscard]] 2021-07-17 13:02:09 +02:00
Jean-Baptiste Boric
ad6c385c9e LibC: Fix grp.h includes
That header file uses FILE*, which is defined in bits/FILE.h.

Fixes #8827.
2021-07-17 13:00:33 +02:00
Brian Gianforcaro
dbc77148c9 Kernel: Convert RangeAllocator VERIFY to proper error handling
If a user allocates above 0x0 and below the allowable usermode
virtual address space, we need to return error instead of asserting.

Fixes: #8484
2021-07-17 13:00:21 +02:00
Peter Bindels
a5a62f99c5 LibC: Use 64-bit stack smash value for 64-bit mode
Otherwise it'll use the first 32 bits that happen to come after,
leading to very weird bugs. Fixes #8601
2021-07-17 01:45:20 +02:00
Marcus Nilsson
205c8a12ed ThemeEditor: Disable focus for demo widgets
Pressing tab would focus on the demo widgets instead of switching
between the combo box and color input field. Instead set the focus
policy to NoFocus for all the widgets.
2021-07-17 01:30:33 +02:00
Hediadyoin1
432a34a496 Kernel: Make PAGE_MASK architecture independent 2021-07-17 01:12:15 +02:00