Commit graph

10734 commits

Author SHA1 Message Date
Peter Elliott af0b2d1d86 Kernel: Harvest randomness from various drivers
Random now gets entropy from the following drivers:
- KeyboardDevice
- PATAChannel
- PS2MouseDevice
- E1000NetworkAdapter
- RTL8139NetworkAdapter

Of these devices,  PS2MouseDevice and PATAChannel provide the vast
majority of the entropy.
2020-06-25 21:05:40 +02:00
Peter Elliott 2e8cfe5435 LibCrypto: Add CTR cipher mode
Kernel: Changed fortuna implementation to use CTR mode instead of
manually implementing a counter.
2020-06-25 21:05:40 +02:00
Peter Elliott 0f32155fa4 Kernel: Replace existing random implementation with Fortuna 2020-06-25 21:05:40 +02:00
Peter Elliott f2d51f13a6 Kernel: Implement the Fortuna PRNG algorithm 2020-06-25 21:05:40 +02:00
Peter Elliott 3de32f0a55 LibCrypto: Add missing <AK/StringView.h> include 2020-06-25 21:05:40 +02:00
Andreas Kling ebf326a98c LibWeb: Fix build after Specificity.h removal 2020-06-25 20:59:00 +02:00
Andreas Kling 4f7c7bbb09 LibWeb: Treat all HTTP 4xx codes as errors 2020-06-25 17:19:29 +02:00
Andreas Kling 505b133fda LibWeb: Don't allow more than one color sub-value in CSS 'background' 2020-06-25 16:55:43 +02:00
Andreas Kling 3fefc7f3e9 LibWeb: Tweak CSS parser to swallow backslash-escaped characters
This isn't the correct way of doing this, but at least it allows the
parsing to progress a bit further in some cases.
2020-06-25 16:52:38 +02:00
Andreas Kling 49dd4b7e8a LibWeb: Compress specificity into a 32-bit unsigned int
Instead of storing the three-part specificy for every selector,
just mash them together into a 32-bit value instead.
This saves both space and time, and matches the behavior of other
browser engines.
2020-06-25 16:43:49 +02:00
Andreas Kling 8be74ea65c LibWeb: Percentage 'height' should sometimes behave as 'auto'
Something like "height: 50%" is equivalent to "height: auto" unless the
containing block has explicitly specified height.
2020-06-25 16:04:57 +02:00
Andreas Kling afebbd1cd7 LibWeb: Serialize Length::Type::Percentage with a "%" suffix
"10 percentage" looked rather silly. :^)
2020-06-25 15:53:23 +02:00
Andreas Kling f650f18bd2 LibWeb: Make scroll-to-anchor zone in on the element's padding box
That seems to be what other engines do. This is a bit hackish but we'll
soon have to redo scroll-to-anchor anyway for the multi-process model.
2020-06-25 15:53:23 +02:00
Andreas Kling bab0143bb2 LibWeb: Place normal-flow blocks relative to non-absolute siblings
We could previously place a box next to a preceding sibling with
position:fixed, which is wrong since fixed-position elements are taken
out of the normal flow.
2020-06-25 15:53:23 +02:00
Andreas Kling b2f54be514 LibWeb: Draw the margin and padding boxes around the inspected node
When highlighting a node in the inspector, we now paint three overlays:

- The content box (magenta)
- The padding box (cyan)
- The margin box (yellow)

This makes it a lot easier to debug layout issues.
2020-06-25 15:53:23 +02:00
Andreas Kling 8f92ed957b LibWeb: Iterating more on placement of absolutely positioned elements 2020-06-25 15:53:23 +02:00
Andreas Kling ee1c241be9 LibWeb: Update the border metrics of absolutely positioned boxes
We were neglecting to populate the border parts of BoxModelMetrics for
absolutely positioned block descendants.
2020-06-25 15:53:23 +02:00
Andreas Kling 232e41a238 LibWeb: Remove empty trailing line boxes
Sometimes we end up with an empty line box at the bottom of a block.
Instead of worrying about this in all the places we split into lines,
just remove the trailing box (if any) after splitting is finshed.
2020-06-25 15:53:23 +02:00
Andreas Kling 58f76ed11f LibWeb: Avoid some redundant resolution of padding values during layout
Padding is not affected by the width constraining algorithm, so we can
just resolve it up front.
2020-06-25 15:53:23 +02:00
Linus Groh afcfea2001 LibJS: Handle "receiver" argument in Reflect.{get,set}() 2020-06-25 15:51:47 +02:00
Sergey Bugaev f08aa6324e Base: Mention that sendfd & recvfd were introduced in plan9port 2020-06-25 15:49:04 +02:00
Sergey Bugaev 6efbbcd4ba Kernel: Port mounts to reference inodes directly
...instead of going through their identifiers. See the previous commit for
reasoning.
2020-06-25 15:49:04 +02:00
Sergey Bugaev df66c28479 Kernel: Deemphasize inode identifiers
These APIs were clearly modeled after Ext2FS internals, and make perfect sense
in Ext2FS context. The new APIs are more generic, and map better to the
semantics exported to the userspace, where inode identifiers only appear in
stat() and readdir() output, but never in any input.

This will also hopefully reduce the potential for races (see commit c44b4d61f3).

Lastly, this makes it way more viable to implement a filesystem that only
synthesizes its inodes lazily when queried, and destroys them when they are no
longer in use. With inode identifiers being used to reference inodes, the only
choice for such a filesystem is to persist any inode it has given out the
identifier for, because it might be queried at any later time. With direct
references to inodes, the filesystem will know when the last reference is
dropped and the inode can be safely destroyed.
2020-06-25 15:49:04 +02:00
Andreas Kling c689be0dbc Base: Add "sendfd" and "recvfd" promises to pledge(2)
And as it turns out, these are not even extensions! :^)
2020-06-25 10:58:37 +02:00
Andreas Kling 55a22b50c9 Base: Fix wording in recvfd(2)
recvfd() returns a *non-negative* integer on success. 0 is a valid fd.
2020-06-25 10:58:37 +02:00
Andreas Kling 28bfd73b68 Kernel: Minor cleanups in sendfd/recvfd
Applying some nice suggestions by @bugaevc. :^)
2020-06-25 10:58:37 +02:00
AnotherTest d1d01897a3 Terminal: Ignore cell background when visual beep is active
Fixes #2621
2020-06-25 10:57:58 +02:00
Andreas Kling 1a7ccc1569 Base: Add man pages for recvfd(2) and sendfd(2) :^) 2020-06-24 23:08:18 +02:00
Andreas Kling d4195672b7 Kernel+LibC: Add sys$recvfd() and sys$sendfd() for fd passing
These new syscalls allow you to send and receive file descriptors over
a local domain socket. This will enable various privilege separation
techniques and other good stuff. :^)
2020-06-24 23:08:09 +02:00
Andreas Kling cd02144a06 Base: Update motd since it was a little outdated :^) 2020-06-24 22:55:45 +02:00
Andreas Kling 8960c6f8fe LibWeb: Use the cached white-space from LayoutStyle in text_for_style() 2020-06-24 21:44:11 +02:00
Andreas Kling 440b4ece22 LibWeb: Move border width and color into LayoutStyle
To make this possible, I also had to give each LayoutNode a Document&
so it can resolve document-specific colors correctly. There's probably
ways to avoid having this extra member by resolving colors later, but
this works for now.
2020-06-24 19:43:27 +02:00
Andreas Kling 4b2ac34725 LibWeb: Move the offset, margin and padding boxes into LayoutStyle 2020-06-24 18:06:21 +02:00
Andreas Kling 6b334e02e6 LibWeb: Move white-space into LayoutStyle 2020-06-24 18:06:21 +02:00
Andreas Kling bc178ee743 LibWeb: Add CSS::Display enum and StyleProperties::display()
The display property is not interesting after we've built the layout
tree, so we don't have to move it into LayoutStyle.
2020-06-24 18:06:21 +02:00
Andreas Kling 5d86305a72 LibWeb: Move height, min-height and max-height into LayoutStyle 2020-06-24 16:49:51 +02:00
Andreas Kling ec466c0385 LibWeb: Move min-width and max-width into LayoutStyle 2020-06-24 16:49:51 +02:00
Andreas Kling ecacab8618 LibWeb: Move width into LayoutStyle
This patch also adds the ability for Length to contain percentage
values. This is a little off-spec, but will make storing and dealing
with lengths a lot easier.

To resolve a Length to a px-or-auto Length, there are now helpers
for that. After calling them, you no longer have to think about
em, rem, %, and such things.
2020-06-24 16:49:51 +02:00
Andreas Kling 959464fce4 LibWeb: Move position and text-align to LayoutStyle 2020-06-24 16:49:51 +02:00
Andreas Kling 6f28f08096 LibWeb: Add LayoutStyle, a place to store style info for layout & paint
StyleProperties is really only the specified "input" to what eventually
becomes the used/computed style we use for layout and painting.

Unlike StyleProperties, LayoutStyle will have strongly typed values for
everything it contains (i.e no CSS::ValueID or strings, etc.)

This first patch moves z-index into LayoutStyle.
2020-06-24 16:49:51 +02:00
Andreas Kling 5e83a97fa2 LibWeb: Rename LayoutNode::style() => specified_style()
Let's make way for a slightly-more-cooked style() that will eventually
replace the raw specified_style() for layout and paint purposes.
2020-06-24 13:54:31 +02:00
Andreas Kling 90edaabc4b LibWeb: Add an "undefined" state to Length
A default-constructed Length now gives you an undefined length value,
which can be used to signify the absence of a value.
2020-06-24 11:24:00 +02:00
Andreas Kling f742b245b7 LibWeb: Turn BoxModelMetrics into a simple struct
Using getters for this thing was just cumbersome and didn't achieve
anything of value so just turn it into a plain struct.
2020-06-24 11:22:34 +02:00
Andreas Kling 5744dd43c5 LibWeb: Remove default Length constructor and add make_auto()/make_px()
To prepare for adding an undefined/empty state for Length, let's first
move away from Length() creating an auto value.
2020-06-24 11:08:46 +02:00
Andreas Kling 26eef65017 LibWeb: Use the cached text-align value in LineBox::add_fragment() 2020-06-24 00:09:45 +02:00
Andreas Kling f4ecb5362f LibWeb: Cache the used CSS text-align property on LayoutNodeWithStyle 2020-06-23 23:28:40 +02:00
Andreas Kling ae181e1573 LibWeb: Always inline absolute Length to_px() conversion
Only do the relative Length units out of line.
2020-06-23 23:21:58 +02:00
Andreas Kling 5f0a1ef21b LibWeb: Always inline is<LayoutBox>() and is<LayoutBlock>() 2020-06-23 23:21:39 +02:00
Andreas Kling 9b8464f455 LibWeb: Cache the used CSS 'position' value on LayoutNodeWithStyle
This avoids having to query the StyleProperties hash map whenever we
need to know if an element is absolutely positioned. This was extremely
hot in interactive window resize profiles.
2020-06-23 23:15:23 +02:00
Andreas Kling d0312f6208 LibWeb: Handle empty inputs to the CSS parser
Empty inputs -> empty outputs.
2020-06-23 20:06:45 +02:00