Commit graph

10757 commits

Author SHA1 Message Date
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
Andreas Kling
86098505ec LibWeb: Handle position:absolute with both left and right specified
In this case, we need to undo the right-side offsetting, since the
width computation algorithm will already have stretched the width to
accomodate both the side constraints.
2020-06-23 20:05:35 +02:00
Andreas Kling
72eb13d8e4 AK: Inline the basics of VectorIterator
Inlining these allows the compiler to optimize out the assertions in
favor of a static range check in many cases.
2020-06-23 19:48:02 +02:00
Andreas Kling
5ac19ca4fd Meta: Add Hüseyin to contributors list :^)
He recently passed 100 commits in the projects!
2020-06-23 19:35:16 +02:00
Andreas Kling
8d235d0e2f LibWeb: Make sure BoxModelMetrics are set for position:absolute boxes
This is all very redundant and we should find a way to share this code
between at least some of the positioning modes.
2020-06-23 19:21:04 +02:00
Andreas Kling
7c848645c3 LibWeb: Take margin into account when positioning absolute descendants 2020-06-23 19:20:06 +02:00
Andreas Kling
aeeaf33638 LibWeb: Respect specified width when computing shrink-to-fit candidates
Previously we would always just use the combined content width as the
shrunken width in shrink-to-fit width calculations, but if the element
has a non-auto specified width, we should just let that take over.

This is far from perfect and doesn't take stuff like min/max-width
into account. Will need more work, this just covers the basic case.
2020-06-23 18:55:25 +02:00
Andreas Kling
675e7c0e6f LibJS: Explicitly invoke Cell constructor in Object(Object& prototype) 2020-06-23 18:28:28 +02:00
Andreas Kling
78f10942ba LibWeb: Update PageView content size on page relayout
If the layout changes and the page becomes taller or shorter for some
reason, we need to update the PageView's scrollable content size.
2020-06-23 18:02:08 +02:00
Andreas Kling
0166a1fa74 LibJS: Make NativeProperty a plain Cell instead of an Object
This removes the need for NativeProperty objects to have a prototype,
which just made things confusing.
2020-06-23 17:56:57 +02:00
Andreas Kling
ba641e97d9 LibJS: Clarify Object (base class) construction somewhat
Divide the Object constructor into three variants:

- The regular one (takes an Object& prototype)
- One for use by GlobalObject
- One for use by objects without a prototype (e.g ObjectPrototype)
2020-06-23 17:21:53 +02:00
Andreas Kling
fc4ed8d444 LibWeb: Make wrapper factory functions take JS::GlobalObject&
Instead of taking the JS::Heap&. This allows us to get rid of some
calls to JS::Interpreter::global_object(). We're getting closer and
closer to multiple global objects. :^)
2020-06-23 16:57:39 +02:00
Andreas Kling
c24f5585b2 LibWeb: Let HTMLScriptElement call Document::run_javascript()
The fewer places we invoke the JS parser the better. Unless we have
some specific reason to parse manually, we can just call Document.
2020-06-23 16:45:01 +02:00
Andreas Kling
3a5af6ef61 LibWeb: Remove hacky old ways of running <script> element contents
Now that we're using the new HTML parser, we don't have to do the weird
"run the script when inserted into the document, uhh, or when the text
content of the script element changes" dance.

Instead, we just follow the spec, and scripts run the way they should.
2020-06-23 16:45:01 +02:00
Andreas Kling
c33d17d363 LibWeb: Fix tokenization of attributes with URL query strings in them
<a href="/foo&amp=bar"> was being tokenized into <a href="/foo&=bar">.
The spec mentions this but I had overlooked it. The bug happens because
we interpreted the "&amp" as a named character reference.
2020-06-23 16:45:01 +02:00
Ruairidh MacLeod
6400122760
SystemServer: Fix typo (exist -> exit) (#2615)
Small typo that I noticed on the latest OS hacking video!
2020-06-23 14:52:15 +02:00
Andreas Kling
c74b5fd798 WebContent: Unveil access to the ImageDecoder service :^) 2020-06-23 14:28:45 +02:00
Andreas Kling
fbd760379a LibWeb: Remove Gfx::ImageDecoder from ImageLoader
We still use a Gfx::ImageDecoder for GIF images, but there's no need
for the ImageLoader object to have its own pointer to it. Just grab
the ImageDecoder from the ImageResource when needed.
2020-06-23 14:28:45 +02:00
Andreas Kling
9ef5d46277 LibWeb: Use ImageLoader::has_image() in HTMLObjectElement
This makes ACID2 load the eyes image again. :^)
2020-06-23 14:28:45 +02:00
Andreas Kling
4c00cae4b9 LibWeb: Decode CSS image values out-of-process as well 2020-06-23 14:28:45 +02:00
Andreas Kling
805123ab3d LibWeb: Give ImageResource::bitmap(frame_index) default frame_index = 0 2020-06-23 14:28:45 +02:00
Nico Weber
afb03dd249 Ports: Make ninja use ppoll instead of pselect 2020-06-23 14:12:20 +02:00
Nico Weber
d2684a8645 LibC+Kernel: Implement ppoll
ppoll() is similar() to poll(), but it takes its timeout
as timespec instead of as int, and it takes an additional
sigmask parameter.

Change the sys$poll parameters to match ppoll() and implement
poll() in terms of ppoll().
2020-06-23 14:12:20 +02:00
devashish
4b19b99b36 JPGLoader: Move JPGLoader internal structs and #defines to JPGLoader.cpp 2020-06-23 13:51:19 +02:00
devashish
a8b00780a8 LibGfx: Integrate JPEG decoder with rest of the system
This patch adds functions like `load_jpeg` to JPGLoader to make the
JPEG decoder conform to the API that bitmap loader uses :^)
2020-06-23 13:51:19 +02:00
Devashish
8b71b839fa LibGfx+LibWeb: Add JPEG decoder and integrate with LibWeb
This patch adds support for JPEG decoding. The JPEG decoder is capable
of handling standard 2x1 horizontal, 2x1 vertical and quartered chroma
subsampling. The implemented Inverse DCT performs with a decent speed.

As of interchange formats, since we tend to ignore the metadata in APPn
markers, the decoder can handle any format compatible with JFIF, which
includes EXIFs and sometimes WebMs too. The decoder does not support
progressive JPEGs yet.
2020-06-23 13:51:19 +02:00
Andreas Kling
10255bc5c6 LibWeb+Browser: Decode non-animated images out-of-process :^)
We now use the ImageDecoder service in LibWeb for everything except
GIF images (we'll have to deal with them later, ofc.)

This has a little bit of overhead but we should be able to optimize
it until it becomes negligible.
2020-06-22 21:47:01 +02:00
Andreas Kling
b273b31c7d LibIPC: Silence some debug spam 2020-06-22 21:47:01 +02:00