Commit graph

35269 commits

Author SHA1 Message Date
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
Linus Groh
bccbad003f LibWeb: Implement the IsPlatformObjectSameOrigin AO 2022-03-06 23:27:39 +01:00
Linus Groh
34fed7bfcc LibWeb: Implement the CrossOriginPropertyFallback AO 2022-03-06 23:27:39 +01:00
Linus Groh
78938d933a LibWeb: Implement the CrossOriginProperties AO 2022-03-06 23:27:39 +01:00
Linus Groh
8b4e5220aa LibWeb: Implement the [[CrossOriginPropertyDescriptorMap]] internal slot 2022-03-06 23:27:39 +01:00
Linus Groh
11d0e37d8e LibWeb: Implement the 'Relevant realm/{settings,global} object' concepts 2022-03-06 23:27:39 +01:00
Linus Groh
db983b469d LibWeb: Implement the 'Current {settings,global} object' concepts 2022-03-06 23:27:39 +01:00
Linus Groh
bc1b33eb22 LibWeb: Add border style for iframe to default UA stylesheet
Wouldn't be the true <iframe> experience if you didn't have to get rid
of the default inset border :^)
2022-03-06 23:05:18 +01:00
Karol Kosek
7e599aa1e5 LibWeb: Implement missing text-decoration styles
This commit will draw appropriate line styles for the Double, Dashed
and Dotted values.
2022-03-06 22:04:41 +01:00
Karol Kosek
b6b116d5f2 LibWeb: Compute text-decoration-thickness values 2022-03-06 22:04:41 +01:00
Karol Kosek
0f7156ed81 LibWeb: Parse CSS text-decoration-thickness property 2022-03-06 22:04:41 +01:00
Karol Kosek
727e69fe11 LibWeb: Paint text decoration in front of the text
Previously, the decoration was painted behind the text. This probably
wasn't noticed before, as we didn't compute `text-decoration-color`
values yet and the decoration had the same color anyway.
2022-03-06 22:04:41 +01:00
Karol Kosek
f9d66bef5d LibWeb: Compute text-decoration-color values
Previosly, we used only the text color as a line decoration color.

The FIXME comment has been directly copy-pasted from the border color
note a few lines below.
2022-03-06 22:04:41 +01:00
Idan Horowitz
e74b0b14ed Keymaps: Add Hebrew keymap 2022-03-06 21:18:42 +02:00
Luke Wilde
8d05c4a675 LibWeb: Fire resize event at the Window instead of Document
The spec says "fire an event named resize at the Window object
associated with doc."

However, we were accidentally firing it at `doc` instead of the Window.
2022-03-06 15:35:10 +01:00
Ali Mohammad Pur
dbc2b746b8 LibLine: Reset suggestion index back to zero when fetching new ones 2022-03-06 15:34:27 +01:00
Ali Mohammad Pur
941550e601 LibLine: Make sure suggestions have their *_views set correctly 2022-03-06 15:34:27 +01:00
Ali Mohammad Pur
a76730823a Shell: Be more smart with pasted stuff
Shell can now use LibLine's `on_paste` hook to more intelligently escape
pasted data, with the following heuristics:
- If the current command is invalid, just pile the pasted string on top
- If the cursor is *after* a command node, escape the pasted data,
  whichever way yields a smaller encoding
- If the cursor is at the start of or in the middle of a command name,
  paste the data as-is, assuming that the user wants to paste code
- If the cursor is otherwise in some argument, escape the pasted data
  according to which kind of string the cursor is in the middle of
  (double-quoted, single-quoted or a simple bareword)
2022-03-06 13:20:41 +01:00
Ali Mohammad Pur
c4d9377477 Shell: Implement leftmost_trivial_literal() for Sequence nodes 2022-03-06 13:20:41 +01:00