Commit graph

36073 commits

Author SHA1 Message Date
Brian Gianforcaro
fbceebb717 ping: Utilize TRY + Core::System wrappers 2022-03-22 11:39:20 +01:00
Brian Gianforcaro
08d65e8c38 traceroute: Port to LibMain 2022-03-22 11:39:20 +01:00
Brian Gianforcaro
6eebd69b70 LibCore: Add Core::System::drop_privileges()
In a few places we intentionally drop privileges to reduce the potential
security surface area of networked program, with the pattern of:

```
if (setgid(getgid()) || setuid(getuid()) {
    return 1;
}
```

We can make this a bit nicer to use by creating a wrapper.
2022-03-22 11:39:20 +01:00
Brian Gianforcaro
7403342387 true: Port to LibMain 2022-03-22 11:39:20 +01:00
Brian Gianforcaro
544609b40f printf: Port to LibMain 2022-03-22 11:39:20 +01:00
Brian Gianforcaro
dba23c55dd matroska: Port to LibMain 2022-03-22 11:39:20 +01:00
Andreas Kling
b6e767f953 Kernel: Disable KASLR on i686
The 32-bit CI runners don't seem to happy with KASLR, so let's make it
x86-64 only for now.
2022-03-22 02:47:27 +01:00
Jamie Mansfield
9b9d32dfb2 LibWeb: Fix crash when removing event listeners 2022-03-22 02:35:07 +01:00
Timothy Flynn
27eb70cbba LibWeb: Implement HTMLSelectElement.add()
HTMLSelectElement simply defers to its HTMLOptionsCollection.
2022-03-22 02:08:15 +01:00
Timothy Flynn
ff9856a214 LibWeb: Implement HTMLOptionsCollection.add() 2022-03-22 02:08:15 +01:00
Timothy Flynn
5133491714 LibWeb: Expose HTMLCollection's root element to its subclasses
For example, HTMLOptionsCollection will need to access its root
HTMLSelectElement.
2022-03-22 02:08:15 +01:00
Timothy Flynn
324f709d29 LibWeb: Support IDL default values of "null" for optional arguments
This is a bit strange in the IDL syntax, but e.g., in HTMLSelectElement,
we have (simplified):

    undefined add(optional (HTMLElement or long)? before = null)

This could instead become:

    undefined add(optional (HTMLElement or long) before)

This change generates code for the former as if it were the latter.
2022-03-22 02:08:15 +01:00
Simon Wanner
dc94879b83 LibWeb: Support transform: translate(...) by percentage 2022-03-22 02:06:21 +01:00
Simon Wanner
bc5d39493b Base: Add a test page for CSS transforms
This also acts as a little stress test for flexbox layout :^)
2022-03-22 02:06:21 +01:00
Simon Wanner
4f348f1733 LibGfx: Clip away coordinates outside the source bitmap
This prevents accessing the source pixels out of bounds.
2022-03-22 02:06:21 +01:00
Simon Wanner
145efbe07a LibWeb: Apply the CSS transform-origin property
We don't have transform-box yet, so this applies to the border-box
for now.

This also makes us pass a couple Web Platform Tests as well :^)
For example:
https://wpt.live/css/css-transforms/css3-transform-scale-002.html
2022-03-22 02:06:21 +01:00
Simon Wanner
63055ff5ad LibWeb: Parse the CSS transform-origin property
This is almost a PositionStyleValue, but it's serialized differently,
so let's use a StyleValueList with 2 length-percentage values.
2022-03-22 02:06:21 +01:00
Idan Horowitz
1ad0e05ea1 Kernel: Add an extremely primitive version of KASLR
This initial (and very basic) implementation of KASLR simply randomizes
the kernel base VA in the 256 MiB range following the default load base.
2022-03-21 23:33:42 +01:00
Idan Horowitz
a9764dabee Kernel: Add helpers for rdrand and rdseed 2022-03-21 23:33:42 +01:00
Andreas Kling
8ab25f8d8c LibWeb: Implement Range.surroundContents(newParent)
Here goes another Acid3 point :^)
2022-03-21 23:28:46 +01:00
Karol Kosek
686507a38f LibWeb: Translate table cells by their top left border 2022-03-21 21:55:21 +01:00
Karol Kosek
20730c164c LibWeb: Include table cell border widths when calculating cell rects
Previously, table cells would overlap when they had CSS border or
padding properties defined.
2022-03-21 21:55:21 +01:00
Andreas Kling
68f3feb1d1 LibWeb: Fix two spec transcription mistakes in live range updating
This scores us another point on Acid3. :^)
2022-03-21 21:11:38 +01:00
Timothy Flynn
57296393ed LibWeb: Begin implementing SVGRectElement's SVGAnimatedLength attributes 2022-03-21 21:04:39 +01:00
Timothy Flynn
7a6b4e33ba LibWeb: Implement the SVGAnimatedLength type 2022-03-21 21:04:39 +01:00
Timothy Flynn
ebf3829f1c LibWeb: Begin implementing the SVGLength type
There are a few unimplemented features for this type:

1. The value setter should throw a DOMException if it is invoked on an
   SVGLength that was declared readonly in another IDL file.

2. SVG::AttributeParser does not parse unit types when it parses lengths
   so all SVGLength will have an "unknown" unit for now.

3. Due to (2), methods which convert between units are unimplemented.
2022-03-21 21:04:39 +01:00
Timothy Flynn
3ebc5cc58e LibWeb: Support generating IDL float types
The float type is used quite a bit in the SVG spec.
2022-03-21 21:04:39 +01:00
Andreas Kling
4d49c607f8 LibWeb: Fix spec transcription mistake in Range.extractContents()
The spec text and code didn't match up.

Thanks to Tim for spotting this! :^)
2022-03-21 21:01:47 +01:00
Andreas Kling
ac8a8459d0 LibWeb: Don't allow setting Range start/end to document being destroyed 2022-03-21 20:37:49 +01:00
Andreas Kling
3b6323340a LibWeb: Update live ranges on Node insertion and removal
Taking care of some old FIXMEs :^)
2022-03-21 20:26:35 +01:00
Andreas Kling
1254758b00 LibWeb: Update live DOM ranges on Text and CharacterData mutations
Taking care of the FIXMEs I added in earlier patches. :^)
2022-03-21 20:06:59 +01:00
Andreas Kling
c74b1b6d65 LibWeb: Implement Range.insertNode(node) 2022-03-21 19:14:50 +01:00
Andreas Kling
d2f9f8bd4f LibWeb: Implement Text.splitText(offset)
With FIXMEs about updating live ranges, but still.
2022-03-21 19:14:50 +01:00
Andreas Kling
8bc3f4c186 LibWeb: Fix logic mistakes in Range stringification
We were passing the wrong length argument to substring() when
stringifying a range where start and end are the same text node.

Also, make sure we visit all the contained text nodes when appending
them to the output.

This was caught by an Acid3 subtest.
2022-03-21 19:14:50 +01:00
Andreas Kling
16f4c76da6 LibWeb: Implement Range.extractContents()
Another point on Acid3 coming through! :^)
2022-03-21 18:06:28 +01:00
Andreas Kling
24e25fe3d0 LibWeb: Add CharacterData.replaceData(offset, count, data)
Note that we don't queue mutation records or update live ranges yet,
I've left those as FIXMEs.
2022-03-21 18:05:20 +01:00
Andreas Kling
e50c7de1b2 LibWeb: Add CharacterData.substringData(offset, count) 2022-03-21 17:20:42 +01:00
Andreas Kling
394cd77467 LibWeb: Implement stringifier for DOM Range :^) 2022-03-21 16:29:19 +01:00
Andreas Kling
c8bdac8736 LibWeb: Implement HTMLTableRowElement.{rowIndex,sectionRowIndex}
Another point on Acid3. :^)
2022-03-21 16:15:33 +01:00
Andreas Kling
1206dd2215 LibWeb: Make parse_html_length() accept floating point numbers
This makes stuff like <img width="12.5"> work. This code is not great,
so I've left a FIXME about improving it.
2022-03-21 15:58:21 +01:00
Andreas Kling
196a3eb239 LibWeb: Ignore invisible boxes and stacking contexts during hit testing 2022-03-21 15:43:37 +01:00
Andreas Kling
df8ef03957 LibWeb: Pick up the CSS "visibility" property an honor it when painting 2022-03-21 15:42:57 +01:00
Andreas Kling
01662b2320 LibWeb: Remove now-unused PaintableBox::for_each_child_in_paint_order() 2022-03-21 14:57:00 +01:00
Andreas Kling
a779ace6a1 LibWeb: Don't compute fragment absolute rect twice while hit testing 2022-03-21 13:03:33 +01:00
Andreas Kling
996f3228a2 LibWeb: Fix O(n^2) traversal in hit testing
We already walk the entire paint tree within each stacking context in
the main hit testing function (StackingContext::hit_test()), so there's
no need for each individual paintable to walk its own children again.

By not doing that, we remove a source of O(n^2) traversal which made hit
testing on deeply nested web pages unbearably slow.
2022-03-21 13:03:33 +01:00
Andreas Kling
f7cfd47b48 LibWeb: Add Paintable::dom_node() convenience accessor 2022-03-21 13:03:33 +01:00
Andreas Kling
b64b5fa8bd LibWeb: Add Painting::HitTestResult::dom_node()
This is a convenience accessor to avoid having to say this everywhere:

    result.paintable->layout_node().dom_node()

Instead, you can now do:

    result.dom_node()
2022-03-21 13:03:33 +01:00
Andreas Kling
0ba785894c LibWeb: Make hit testing functions return Optional<HitTestResult>
Using "HitTestResult with null paintable" as a way to signal misses was
unnecessarily confusing. Let's use Optional instead. :^)
2022-03-21 13:03:33 +01:00
Andreas Kling
8c88ee1165 LibWeb: Only invalidate stacking context tree for opacity/z-index change
I came across some websites that change an elements CSS "opacity" in
their :hover selectors. That caused us to relayout on hover, which we'd
like to avoid.

With this patch, we now check if a property only affects the stacking
context tree, and if nothing layout-affecting has changed, we only
invalidate the stacking context tree, causing it to be rebuilt on next
paint or hit test.

This makes :hover { opacity: ... } rules much faster. :^)
2022-03-21 13:03:33 +01:00
Andreas Kling
59afdb959f LibWeb: Build stacking context tree lazily
There's no actual need to build the stacking context tree before
performing layout. Instead, make it lazy and build the tree when it's
actually needed for something.

This avoids a bunch of work in situations where multiple synchronous
layouts are forced (typically by JavaScript) without painting or hit
testing taking place in between.

It also opens up for style invalidations that only target the stacking
context tree.
2022-03-21 13:03:33 +01:00