Commit Graph

35287 Commits

Author SHA1 Message Date
Linus Groh
1422bd45eb LibWeb: Move Window from DOM directory & namespace to HTML
The Window object is part of the HTML spec. :^)
https://html.spec.whatwg.org/multipage/window-object.html
2022-03-08 00:30:30 +01:00
Andreas Kling
2dfb617c5b LibWeb: Make InlineLevelIterator emit absolutely positioned items
Note that we don't put absolutely positioned items on a line! This is
just so that IFC can discover boxes and pass them along to BFC.

This fixes an issue where only direct children of the IFC containing
block were considered for absolute positioning. Now we pick up
absolutely positioned children of nested inline nodes as well.
2022-03-08 00:19:49 +01:00
Andreas Kling
6354a9a030 Kernel: Mark sys$fsync() as not needing the big lock
This syscall doesn't access any data that was implicitly protected by
the big lock.
2022-03-08 00:19:49 +01:00
Andreas Kling
ef45ff4703 Kernel: Mark sys$readlink() as not needing the big lock
This syscall doesn't access any data that was implicitly protected by
the big lock.
2022-03-08 00:19:49 +01:00
Andreas Kling
2688ee28ff Kernel: Mark sys$stat() as not needing the big lock
This syscall doesn't access any data that was implicitly protected by
the big lock.
2022-03-08 00:19:49 +01:00
Andreas Kling
be7ec52ed0 Kernel: Mark sys$fstat() as not needing the big lock
This syscall doesn't access any data that was implicitly protected by
the big lock.
2022-03-08 00:19:49 +01:00
Andreas Kling
23822febd2 Kernel: Mark sys$fchdir() as not needing the big lock
This syscall doesn't access any data that was implicitly protected by
the big lock.
2022-03-08 00:19:49 +01:00
Andreas Kling
156ab0c47d Kernel: Mark sys$chdir() as not needing the big lock
This syscall doesn't access any data that was implicitly protected by
the big lock.
2022-03-08 00:19:49 +01:00
Andreas Kling
7597bef771 Kernel: Mark sys$getcwd() as not needing the big lock
This syscall doesn't access any data that was implicitly protected by
the big lock.
2022-03-08 00:19:49 +01:00
Andreas Kling
f630d0f095 Kernel: Mark sys$realpath() as not needing the big lock
This syscall doesn't access any data that was implicitly protected by
the big lock.
2022-03-08 00:19:49 +01:00
Andreas Kling
580d89f093 Kernel: Put Process unveil state in a SpinlockProtected container
This makes path resolution safe to perform without holding the big lock.
2022-03-08 00:19:49 +01:00
Andreas Kling
24f02bd421 Kernel: Put Process's current directory in a SpinlockProtected
Also let's call it "current_directory" instead of "cwd" everywhere.
2022-03-08 00:19:49 +01:00
Andreas Kling
71792e4b3f Kernel: Make SpinlockProtected constructor forward all arguments
This allows you to instantiate SpinlockProtected<T> where T requires
constructor arguments.
2022-03-08 00:19:49 +01:00
Andreas Kling
7543c34d07 Kernel: Mark sys$anon_create() as not needing the big lock
This syscall is already safe for no-big-lock since it doesn't access any
unprotected data.
2022-03-08 00:19:49 +01:00
Stephan Unverwerth
8165346ae4 LibSoftGPU: Choose correct texture filter based on scale factor
Previously the test determining whether to use texture maginifaction or
texture minification was reversed. This commit fixes the test and also
provides an early out of the sampler in case of texture magnification
since magnification does not make use of mipmaps.
2022-03-08 00:49:31 +02:00
Idan Horowitz
29eee390ec Kernel: Implement kmalloc_good_size for the new kmalloc
This lets kmalloc-aware data structures like Vector and HashTable use
up the extra wasted space we allocate in the slab heaps & heap chunks.
2022-03-08 00:46:25 +02:00
ForLoveOfCats
c204885a94 LibGUI: Animated smooth scroll interpolation 2022-03-07 22:24:24 +01:00
Maciej
86c0961240 LibWeb: Make TextNode::ChunkIterator::try_commit_chunk() const 2022-03-07 21:49:36 +01:00
Andreas Kling
baa6ff5649 Kernel: Wrap HIDManagement keymap data in SpinlockProtected
This serializes access to the current keymap data everywhere in the
kernel, allowing to mark sys$setkeymap() as not needing the big lock.
2022-03-07 16:35:23 +01:00
Andreas Kling
ff60e8ffc6 LibJS: Use Vector instead of HashMap in DeclarativeEnvironment
Constructing the HashMap in DeclarativeEnvironment was by far the most
expensive thing when making JavaScript function calls.

As it turns out, we don't really need this to be a HashMap in the first
place, as lookups are cached (by EnvironmentCoordinate) after the first
access, so after that we were not even looking in the HashMap, going
directly to the bindings Vector instead.

This reduces function_declaration_instantiation() from 16% to 9% when
idling in "Biolab Disaster". It also reduces has_binding() from 3% to
1% on the same content.

With these changes, we now actually get to idle a little bit between
game frames on my machine. :^)
2022-03-07 14:49:21 +01:00
Sam Atkins
2dad3dca9a Base: Add ratio tests to media-query test page
Note that only the first test actually functions currently.
Single-number ratios instead get parsed as a `<number>`, and will do
until the parser gets smarter. (The alternative, where all
single-numbers get parsed as `<ratio>`, does make the tests succeed,
but numbers are more common than ratios so I have given numbers
preference for now.)

Also simplified the styling and text a bit. Now, red = fail, green =
success. No more "unstyled = fail" stuff.
2022-03-07 13:42:25 +01:00
Sam Atkins
deea129b8c LibWeb: Add Ratio type to MediaFeatureValue
As noted, the Parser can't handle the `<number>` syntax for this - it
gets parsed instead by the `<number>` branch. We can't actually resolve
the ambiguity without making the Parser aware of what type each
media-feature is, but I will get to that soon. :^)
2022-03-07 13:42:25 +01:00
Sam Atkins
5f93f1c161 LibWeb: Introduce and parse CSS Ratio type
This is only used by media-queries, so for now we can skip
adding/parsing a StyleValue for these.
2022-03-07 13:42:25 +01:00
Sam Atkins
e30bfabbca LibWeb: Correct "color" media-feature value
This is bits per color channel, not bits per pixel, so 32 was a little
over-optimistic. :^)
2022-03-07 13:42:25 +01:00
dotjpg3141
24a98b888a Documentation: Improve VS Code settings
- Set commit message length to 72 according to CONTRIBUTING.md
  - Format trailing new lines according to check-newlines-at-eof.py
2022-03-07 11:01:27 +01:00
Jelle Raaijmakers
62ffe67a9f LibGfx: Reimplement Vector::length() as a loop
This more generic loop supports arbitrary values of `N` and also gets
rid of that strange single argument `AK::hypot` invocation.
2022-03-07 11:00:45 +01:00
Jelle Raaijmakers
d75135663b LibGfx+LibSoftGPU: Add and use Vector.xy()
Also use `.xyz()` where appropriate.
2022-03-07 11:00:45 +01:00
Jelle Raaijmakers
439617cf6f LibSoftGPU: Use lroundf instead of roundf in rasterization rect
Casting a `float` to `int` might still inadvertently floor the value,
while `lroundf` will return a properly rounded `long`.
2022-03-07 11:00:45 +01:00
Jelle Raaijmakers
37dd10fbbe LibSoftGPU: Use float instead of int for triangle screen coords
This replaces the fixed point subpixel precision logic.

GLQuake now effectively renders artifact-free. Previously white/gray
pixels would sometimes be visible at triangle edges, caused by slightly
misaligned triangle edges as a result of converting the vertex window
coordinates to `int`. These artifacts were reduced by the introduction
of subpixel precision, but not completely eliminated.

Some interesting changes in this commit:

* Applying the top-left rule for our counter-clockwise vertices is now
  done with simpler conditions: every vertex that has a Y coordinate
  lower than or equal to the previous vertex' Y coordinate is counted
  as a top or left edge. A float epsilon is used to emulate a switch
  between `> 0` and `>= 0` comparisons.

* Fog depth calculation into a `f32x4` is now done once per triangle
  instead of once per fragment, and only if fog is enabled.

* The `one_over_area` value was previously calculated as `1.0f / area`,
  where `area` was an `int`. This resulted in a lower quality
  reciprocal value whereas we can now retain floating point precision.
  The effect of this can be seen in Tux Racer, where the ice reflection
  is noticeably smoother.
2022-03-07 11:00:45 +01:00
Matthew Olsson
6133acb8c0 LibPDF: Allow newlines between xref table and "trailer" keyword 2022-03-07 10:53:57 +01:00
Matthew Olsson
4d509ff365 LibPDF: Fix "incorrect" matrix multiplication in Renderer
Incorrect is in quotes because the spec (both 1.7 and 2.0) specify this
multiplication as it was originally! However, flipping the order of
operations here makes the text in all of my test cases render in the
correct position.

The CTM is a transformation matrix between the text coordinate system
and the device coordinate system. However, being on the right-side of
the multiplication means that the CTM scale parameters don't have any
influence on the translation component of the left-side matrix. This
oddity is what originally led to me just trying this change to see if
it worked.
2022-03-07 10:53:57 +01:00
Matthew Olsson
6f1cfcf217 LibPDF: Implement marked renderer operations as nops 2022-03-07 10:53:57 +01:00
Matthew Olsson
544e44eec1 LibPDF: Fix bad hex string parsing logic 2022-03-07 10:53:57 +01:00
Matthew Olsson
3cfecc3d3b LibPDF: Remove useless hex string substring call 2022-03-07 10:53:57 +01:00
Matthew Olsson
e9342183f0 LibPDF: Support all Dest types 2022-03-07 10:53:57 +01:00
Matthew Olsson
b240d23a87 LibPDF: Propagate errors in Renderer/PDFViewer 2022-03-07 10:53:57 +01:00
Matthew Olsson
d82bd885ce LibPDF: Propagate ColorSpace errors 2022-03-07 10:53:57 +01:00
Matthew Olsson
73cf8205b4 LibPDF: Propagate errors in Parser and Document 2022-03-07 10:53:57 +01:00
Matthew Olsson
7e1c823725 LibPDF: Fix the zoom-related text scaling issue
Previously, text spacing on a page would only look correct on very
zoomed-in pages. When the page was zoomed out, the spacing between
characters was very large. The cause for this was incorrect initial
values for the Tc (character spacing) and Tw (word spacing) text
parameters. The initial values were too large, but they were only
about 3-5 pixels, which is why the error was only observable for
smaller pages.

The text placement still isn't perfect, but it is _much_ better!
2022-03-07 10:53:57 +01:00
Matthew Olsson
c1aa8c4a44 LibPDF: Remove unused function in Parser 2022-03-07 10:53:57 +01:00
Andreas Kling
455224d476 AK: Add test for unbounded HashTable capacity leak 2022-03-07 00:08:22 +01:00
Andreas Kling
9d8da1697e AK: Automatically shrink HashTable when removing entries
If the utilization of a HashTable (size vs capacity) goes below 20%,
we'll now shrink the table down to capacity = (size * 2).

This fixes an issue where tables would grow infinitely when inserting
and removing keys repeatedly. Basically, we would accumulate deleted
buckets with nothing reclaiming them, and eventually deciding that we
needed to grow the table (because we grow if used+deleted > limit!)

I found this because HashTable iteration was taking a suspicious amount
of time in Core::EventLoop::get_next_timer_expiration(). Turns out the
timer table kept growing in capacity over time. That made iteration
slower and slower since HashTable iterators visit every bucket.
2022-03-07 00:08:22 +01:00
Andreas Kling
eb829924da AK: Remove return value from HashTable::remove() and HashMap::remove()
This was only used by remove_all_matching(), where it's no longer used.
2022-03-07 00:08:22 +01:00
Andreas Kling
623bdd8b6a AK: Simplify HashTable::remove_all_matching()
Just walk the table from start to finish, deleting buckets as we go.
This removes the need for remove() to return an iterator, which is
preventing me from implementing hash table auto-shrinking.
2022-03-07 00:08:22 +01:00
Andreas Kling
6d1a9672a4 LibWeb: Support more CSS image-rendering values
This patch adds support for "crisp-edges", "high-quality" and "smooth"
for the CSS image-rendering property.

"crisp-edges" maps to nearest-neighbor scaling for <canvas> and <img>
elements, while "high-quality" and "smooth" both use bilinear blending.
2022-03-07 00:08:22 +01:00
Linus Groh
fe52ee2f8e LibWeb: Implement the remaining LocationObject internal methods 2022-03-06 23:27:39 +01:00
Linus Groh
5dabdcccf7 LibWeb: Implement the CrossOriginOwnPropertyKeys AO 2022-03-06 23:27:39 +01:00
Linus Groh
c8a2fc09b8 LibWeb: Implement the CrossOriginSet AO 2022-03-06 23:27:39 +01:00
Linus Groh
245ec99813 LibWeb: Implement the CrossOriginGet AO 2022-03-06 23:27:39 +01:00
Linus Groh
c7b977547d LibWeb: Implement the CrossOriginGetOwnPropertyHelper AO 2022-03-06 23:27:39 +01:00