Commit Graph

36156 Commits

Author SHA1 Message Date
Idan Horowitz
f0166efe8c Kernel: Use the whole kernel PD range when randomizing the KASLR offset
Now that we reclaim the memory range that is created by KASLR before
the start of the kernel image, there's no need to be conservative with
the KASLR offset.
2022-03-23 19:49:49 +02:00
Andreas Kling
e0c7727934 LibWeb: Fill the whole viewport with the correct background color
CSS2 tells us to use the HTML element's background color if not
transparent. Otherwise, the BODY element's background color.
2022-03-23 17:38:00 +01:00
Andreas Kling
ca85ac26d4 WebContent: Fill OOPWV with palette base color when there's no content 2022-03-23 17:27:20 +01:00
Andreas Kling
fb9ee26c43 LibWeb: Resolve numeric line-heights against element's own font size
For things like "line-height: 2" to work, the font size must be assigned
before resolving the line height. Previously, the line-height was
resolved first, which meant that numeric and other relative units were
resolved against the default font-size instead.
2022-03-23 15:57:05 +01:00
Andreas Kling
5118a4c1e7 LibWeb: Parse CSS "font-variant" as part of "font"
This allows us to parse CSS "font" values that contain e.g "small-caps"
or "normal", as used on Acid3.
2022-03-23 14:54:21 +01:00
Andreas Kling
632928a11e LibWeb: Pass font sizes in pt rather than px to Gfx::FontDatabase
Our font database uses point sizes for fonts, and we were passing it
px sizes. This caused all fonts to be 1.333x larger than they should
be on the web. Of course it wasn't always noticeable with bitmap fonts,
but noticeable everywhere with scalable fonts.
2022-03-23 14:13:15 +01:00
Timothy Flynn
bf7b51a569 LibWeb: Implement HTMLObjectElement's data URL according to the spec
There are a long list of conditions under which the HTMLObjectElement is
to queue an element task to load / determine an object's representation.
This handles the case where the data attribute has changed.

Much of the spec for determining the object's representation is not
implemented here. Namely, anything to do with XML documents or browser
plugins are left as FIXMEs.
2022-03-23 13:44:51 +01:00
Timothy Flynn
90829fe880 LibWeb: Allow HTMLObjectElement to convert a Resource to ImageResource
HTMLObjectElement, when implemented according to the spec, does not know
the resource type specified by the 'data' attribute until after it has
actually loaded (i.e. it may be an image, XML document, etc.). Currently
we always use ImageLoader within HTMLObjectElement to load the object,
but will need to use ResourceLoader instead to generically load data.

However, ImageLoader / ImageResource have image-specific functionality
that HTMLObjectElement still needs if the resource turns out to be an
image. This patch will allow (only) HTMLObjectElement to convert the
generic Resource to an ImageResource as needed.
2022-03-23 13:44:51 +01:00
Johannes Laudenberg
eb1d7e8076 LibWeb: Make margins in the main dimension work for flex items
The spec at https://www.w3.org/TR/css-flexbox-1/ states that when
calculating specific spaces and sizes inside a flex container, the outer
size of a flex item needs to be taken into account.

This patch adds the margins in the main dimension of a flex item to
these calculations such that their margins are actually painted in a lot
of common cases.

It makes our Github page look marginally better.
2022-03-23 11:59:07 +01:00
Jelle Raaijmakers
5882d891d0 LibGUI: Simplify AbstractZoomPanWidget code
No functional changes, just making things a bit easier to read.
2022-03-23 11:53:34 +01:00
Jelle Raaijmakers
b8a53e4a17 Applications: Round layer rect before drawing outline in PixelPaint
This fixes differences in drawing the layer and image outlines.
2022-03-23 11:53:34 +01:00
Jelle Raaijmakers
ab19b092ed LibGfx: Implement Rect::to_rounded<U>()
This replaces the usage of `rounded_int_rect`, whose name did not
accurately reflect the rounding operation happening. For example, the
position of the rect was not rounded but floored, and the size was
pulled through `roundf` before casting to `int` which could result in
inadvertent flooring if the resulting floating point could not exactly
represent the rounded value.
2022-03-23 11:53:34 +01:00
Jelle Raaijmakers
bec474d99b LibGfx: Calculate source rect once in do_draw_scaled_bitmap 2022-03-23 11:53:34 +01:00
Jelle Raaijmakers
f790a69431 LibGfx: Draw last row and column of scaled bitmaps in Painter
There was an off-by-one bug in `Painter::do_draw_scaled_bitmap` where
the last column and row of the source bitmap would be skipped. This was
especially visible in PixelPaint when zooming in and out on smaller
images.

Instead of the top/left of the pixel, we now use the bottom/right side
of the pixel as a threshold to stop drawing.
2022-03-23 11:53:34 +01:00
Andreas Kling
fd7a059e09 LibWeb: Make NodeIterator behave like other browser engines
If invoking a NodeFilter ends up deleting a node from the DOM, it's not
enough to only adjust the NodeIterator reference nodes in the
pre-removing steps. We must also adjust the current traversal pointer.

This is not in the spec, but it's how other engines behave, so let's do
the same.

I've encapsulated the Node + before-or-after-flag in a struct called
NodePointer so that we can use the same pre-removing steps for both the
traversal pointer and for the NodeIterator's reference node.

Note that when invoking the NodeFilter, we have to remember the node we
passed to the filter function, so that we can return it if accepted by
the filter.

This gets us another point on Acid3. :^)
2022-03-23 00:22:36 +01:00
Andreas Kling
a0b0b29fa1 LibWeb: Minor cleanups in NodeIterator and TreeWalker
- Use TRY() when invoking the NodeFilter
- Say "nullptr" instead of "RefPtr<Node> {}"
2022-03-23 00:19:57 +01:00
Sam Atkins
ccee8953d0 LibWeb: Expose SVGEllipseElement attributes to JS 2022-03-22 22:33:17 +01:00
Sam Atkins
1a3d6c68ef LibWeb: Expose SVGCircleElement attributes to JS 2022-03-22 22:33:17 +01:00
Sam Atkins
b51ea3a67c LibWeb: Expose SVGLineElement attributes to JS 2022-03-22 22:33:17 +01:00
Liav A
b5ef900ccd Kernel: Don't assume paths of TTYs and pseudo terminals anymore
The obsolete ttyname and ptsname syscalls are removed.
LibC doesn't rely on these anymore, and it helps simplifying the Kernel
in many places, so it's an overall an improvement.

In addition to that, /proc/PID/tty node is removed too as it is not
needed anymore by userspace to get the attached TTY of a process, as
/dev/tty (which is already a character device) represents that as well.
2022-03-22 20:26:05 +01:00
Liav A
de7566c2c4 LibC: Don't rely on ptsname and ttyname syscalls
Instead, to determine these values (both the pts name and tty name), use
other methods. For determining the new name of the allocated psuedo
terminal, use ioctl on a file descriptor we got after opening /dev/ptmx
with the TIOCGPTN option.
For determining the name of TTY, we enumerate both /dev/pts and /dev
directories to find matching inode number and matching device mode.
2022-03-22 20:26:05 +01:00
Liav A
5ffe2f117c Kernel/TTY: Implement TIOCGPTN ioctl for MasterPTY
This ioctl operation will allow userspace to determine the index number
of a MasterPTY after opening /dev/ptmx and actually getting an internal
file descriptor of MasterPTY.
2022-03-22 20:26:05 +01:00
Liav A
e508073168 SystemServer: Create /dev/tty as a character device instead of a symlink
The new device has major number 5, minor number 0, and is represented by
the SelfTTYDevice class in the Kernel.
2022-03-22 20:26:05 +01:00
Liav A
12867d60ad Kernel: Create SelfTTYDevice class to help replace /dev/tty symlink
This will replace the /dev/tty symlink created by SystemServer, so
instead of a symlink, a character device will be created. When doing
read(2), write(2) and ioctl(2) on this device, it will "redirect" these
operations to the attached TTY of the current process.
2022-03-22 20:26:05 +01:00
Andreas Kling
2fb9eb5257 LibWeb: Implement Range.deleteContents()
And here's another point on Acid3. :^)
2022-03-22 20:17:52 +01:00
Andreas Kling
e1c71b3f91 LibWeb: Implement Range.cloneContents() 2022-03-22 20:03:09 +01:00
Andreas Kling
de6f7f0029 LibWeb: Support CSS floats in inline flow
CSS floats are now emitted by the InlineLevelIterator. When this
happens, IFC coordinates with the parent BFC to float the box to the
side, using the current LineBuilder state for vertical placement.

This makes the "instructions" text on Acid3 render as a single
contiguous flow of inline content.
2022-03-22 19:26:51 +01:00
Andreas Kling
fa64a7f6cc LibWeb: Relax "all children must be either inline or block" invariant
This was implemented too rigidly, which made it impossible to place
floats correctly when they occurred in inline flow.

The new invariant is "all in-flow children must be either inline or
block". Out-of-flow children like floating and absolutely positioned
boxes are ignored when deciding when to generate anonymous boxes.
2022-03-22 19:26:51 +01:00
Andreas Kling
74927fd218 LibWeb: Move Layout::Box::is_out_of_flow() to Layout::Node
I want to use this function in inline layout, where we're not just
dealing with boxes.
2022-03-22 19:26:51 +01:00
Hendiadyoin1
150e6a59c0 Kernel: Add and use bitwise operators to CPUFeature 2022-03-22 18:20:01 +00:00
Linus Groh
cd6896d343 LibWeb: Convert URL to use TRY for error propagation 2022-03-22 18:05:25 +00:00
Linus Groh
2219eef250 LibWeb: Convert Text to use TRY for error propagation 2022-03-22 18:05:25 +00:00
Linus Groh
46bb547dd6 LibWeb: Convert ShadowRoot to use TRY for error propagation 2022-03-22 18:05:25 +00:00
Linus Groh
a68d31debd LibWeb: Convert ParentNode to use TRY for error propagation 2022-03-22 18:05:25 +00:00
Linus Groh
8d20fb1e94 LibWeb: Convert NodeOperations to use TRY for error propagation 2022-03-22 18:05:25 +00:00
Linus Groh
3861396fe4 LibWeb: Convert Node to use TRY for error propagation 2022-03-22 18:05:25 +00:00
Linus Groh
07a2c58da0 LibWeb: Convert InnerHTML to use TRY for error propagation 2022-03-22 18:05:25 +00:00
Linus Groh
3cb7c463a7 LibWeb: Convert Element to use TRY for error propagation 2022-03-22 18:05:25 +00:00
Linus Groh
b6f09aaef2 LibWeb: Convert DOMTokenList to use TRY for error propagation 2022-03-22 18:05:25 +00:00
Linus Groh
91d0088a5b LibWeb: Convert DOMImplementation to use TRY for error propagation 2022-03-22 18:05:25 +00:00
Linus Groh
e758bd303f LibWeb: Convert Document to use TRY for error propagation 2022-03-22 18:05:25 +00:00
Linus Groh
ab0a354bb4 LibWeb: Convert ChildNode to use TRY for error propagation 2022-03-22 18:05:25 +00:00
Linus Groh
9ca10c9347 LibWeb: Convert CRC2D to use TRY for error propagation 2022-03-22 18:05:25 +00:00
Idan Horowitz
e18632660f Kernel: Use the pre-image kernel memory range introduced by KASLR
This ensures we don't just waste the memory range between the default
base load address and the actual load address that was shifted by the
KASLR offset.
2022-03-22 16:46:51 +01:00
Idan Horowitz
d850e483f7 Kernel: Keep kernel base load address 2 MiB aligned
This requirement comes from the fact the Prekernel mapping logic only
uses 2 MiB pages.
This unfortunately reduces the bits of entropy in kernel addresses from
16 bits to 7, but it could be further improved in the future by making
the Prekernel mapping logic a bit more dynamic.
2022-03-22 16:46:51 +01:00
Lady Gegga
025cfacd46 Base: Add Slovakian and Ukrainian flags
Slovakian flags:
Banská Bystrica, Bratislava, Košice, Nitra, Prešov, Trnava, Trenčín,
Žilina
Ukrainian flags:
Vinnychchyna, Volyn, Luhanshchyna, Dnipropetrovshchyna,
Zhytomyrshchyna, Zakarpattia, Zaporizhzhya, Prykarpattia,
Kiev, Kyivshchyna, Kirovohradschyna, Sevastopol, Lvivshchyna,
Mykolayivschyna, Odeshchyna, Poltavshchyna, Rivnenshchyna,
Sumshchyna, Ternopilshchyna, Kharkivshchyna, Khersonshchyna,
Khmelnychchyna, Cherkashchyna, Chernihivshchyna, Chernivtsi Oblast
2022-03-22 15:35:42 +00:00
Timothy Flynn
859a75fd4c LibWeb: Handle input element value setting & getting closer to the spec
We should not set the 'value' attribute when an input element's value is
changed (by the user or programmatically). Instead, we should track the
value internally and mark it with a dirty flag when it is changed.
2022-03-22 16:06:38 +01:00
Sam Atkins
31b24c2b29 LibWeb: Remove now-unused null values from Selector enums
Now that we use a Variant for the SimpleSelector's data, we don't need
to instantiate empty structs or variables for the types that aren't
used, and so we can remove `PseudoElement::None`,
`PsuedoClass::Type::None` and `Attribute::MatchType::None`.

Also, we now always initialize a SimpleSelector with a type, so
`SimpleSelector::Type::Invalid` can go too.
2022-03-22 15:47:36 +01:00
Sam Atkins
cbe2eaebab LibWeb: Tidy up CSS::Token::to_debug_string()
The ifs below the switch no longer functioned, so let's move everything
into the switch cases. This also means we can replace the StringBuilder
usage with String::formatted().
2022-03-22 15:47:36 +01:00
Sam Atkins
13e1232d79 LibWeb: Remove separate Token::m_unit field
Dimension tokens don't make use of the m_value string for anything else,
so we can sneak the unit string in there.

- Token goes from 72 to 64 bytes
- StyleComponentValueRule goes from 80 to 72 bytes
2022-03-22 15:47:36 +01:00