Commit graph

36348 commits

Author SHA1 Message Date
Linus Groh
8b2361e362 AK: Add non-const DistinctNumeric::value() getter 2022-03-27 18:54:56 +02:00
Linus Groh
76e85ebbfc AK: Remove unused String.h include from UFixedBigInt.h
This makes it usable in the Kernel. :^)
2022-03-27 18:54:56 +02:00
Linus Groh
4727b5bd4d Meta: Fix path to GCC's addr2line in serenity.sh
I'm not sure when this changed, but the path is wildly different now.
2022-03-27 18:54:56 +02:00
Michael Manganiello
f421addc50 Ports: Add Free Heroes of Might and Magic II (fheroes2) port
`fheroes2` is a recreation of HoMM2 game engine. This port is set with
`GET_HOMM2_DEMO=ON` for a free demo version to be automatically
downloaded and used, without requiring the user to provide game
resources from the original game.

Besides the provided patches, we set `CXXFLAGS="'-D_GNU_SOURCE'"` to
build the port, for SerenityOS' `LibC/endian.h` to provide required
endianness functions and constants.

**Considerations**:
* In-game custom cursor is not working, game logs show:
  `Cursors are not currently supported` [0].
* Game is still unplayable, as it commonly raises a Kernel panic when
  trying to start a new game (reported at SerenityOS/serenity#9401).

[0] ae3bc94772/src/events/SDL_mouse.c (L952)
2022-03-27 18:31:10 +02:00
Jelle Raaijmakers
8a3242cb83 LibGL+LibSoftGPU+LibGfx: Reimplement normal transformation
We now support generating top-left submatrices from a `Gfx::Matrix`
and we move the normal transformation calculation into
`SoftGPU::Device`. No functional changes.
2022-03-27 09:19:43 -07:00
Jelle Raaijmakers
74de8e4224 LibGL: Always normalize vertex attribute data
We were normalizing data read from vertex attribute pointers based on
their usage, but there is nothing written about this behavior in the
spec or in man pages.

When we implement `glVertexAttribPointer` however, the user can
optionally enable normalization per vertex attribute pointer. This
refactors the `VertexAttribPointer` to have a `normalize` field so we
can support that future implementation.
2022-03-27 09:19:43 -07:00
Jelle Raaijmakers
bc5e5afc7b LibSoftGPU+LibGfx: Transform and normalize normals before lighting
We were transforming the vertices' normals twice (bug 1) and
normalizing them after lighting (bug 2). In the lighting code, we were
then diverting from the spec to deal with the normal situation, which
is now no longer needed.

This fixes the lighting of Tux in Tux Racer.
2022-03-27 09:19:43 -07:00
Jelle Raaijmakers
23476dac64 LibSoftGPU: Clean up Material initial value style 2022-03-27 09:19:43 -07:00
Jelle Raaijmakers
284a629ab4 LibGL+LibSoftGPU: Implement more of GL_LIGHT_MODEL_COLOR_CONTROL
This gets rid of a place where OpenGL was leaking into LibSoftGPU.
2022-03-27 09:19:43 -07:00
Jelle Raaijmakers
4b6b9f272f LibGL: Use correct GLbyte range in glColor4b
We were only setting half the color intensity that we should have set.
2022-03-27 09:19:43 -07:00
Jelle Raaijmakers
ae88c642c6 LibSoftGPU: Test for 1.f equality in determining the scale factor
We are still not doing the right thing here, but using `<=` instead of
`<` at least gets rid of artifacts in Grim Fandango.
2022-03-27 09:19:43 -07:00
Andreas Kling
27c68624b6 LibWeb: Resolve top/bottom inset properties for position:relative
This patch reimplements inset property resolution based on the new
CSS Positioned Layout specification. Nothing should change for
left/right insets, but we gain support for top/bottom. :^)
2022-03-27 18:16:09 +02:00
Andreas Kling
fa71401bec LibWeb: Rename ComputedValues::offset() => inset() 2022-03-27 18:16:08 +02:00
Andreas Kling
d77dfc6b48 LibWeb: Rename FormattingContext::compute_position() => compute_inset()
This function computes the used inset properties, not the position of a
box per se, so let's call it something more accurate.
2022-03-27 18:16:08 +02:00
Andreas Kling
c49c036c84 LibWeb: Stop allowing position:relative to affect layout
Relatively positioned boxes should not affect the *layout* of their
siblings. So instead of applying relative inset as a layout-time
translation on the box, we now perform the adjustment at the paintable
level instead.

This makes position:relative actually work as expected, and exposes some
new bugs we need to take care of for Acid2. :^)
2022-03-27 18:16:08 +02:00
djwisdom
153370e7f4 Base: Update Basic Latin 0020 char to font SatoriMonoRegular 2022-03-27 09:16:03 -07:00
djwisdom
a6e91caf5b Base: Update Basic Latin 0020 char to font SatoriBold 2022-03-27 09:16:03 -07:00
djwisdom
6f58aecd8b Base: Update Basic Latin 0020 char to font SatoriRegular 2022-03-27 09:16:03 -07:00
djwisdom
cc3eb3d7d8 Base: Update Basic Latin 004F char to font SatoriMonoBold 2022-03-27 09:16:03 -07:00
djwisdom
050bc99d56 Base: Add Latin-1 Supplement chars to font Ataraxia
00A1-00FF
https://www.unicode.org/charts/PDF/U0080.pdf
2022-03-27 09:16:03 -07:00
Karol Kosek
813b9c400d Base: Add Multilingual layout to Colemak
This commit will add additional key combinations from the Colemak
Multilingual page, except of the dead keys.

https://colemak.com/Multilingual
2022-03-27 09:12:50 -07:00
Pankaj Raghav
e40d4b2677 Kernel: Remove hardcoded values for block size in IDEChannel 2022-03-27 08:54:32 -07:00
Pankaj Raghav
6d3a7fabeb Kernel: Remove hardcoded values for block size in Ramdisk
Instead of using the hardcoded 512 in Ramdisk, retrieve the block size
value from the AsyncBlockDeviceRequest struct.
2022-03-27 08:54:32 -07:00
Pankaj Raghav
2786a71bc0 Kernel: Expose block size in AsyncBlockDeviceRequest struct
Expose the block size variable via a member function in the
AsyncBlockDeviceRequest so that the driver doesn't need to assume any
value such as 512 bytes.
2022-03-27 08:54:32 -07:00
Pankaj Raghav
4b2094506b Kernel: Use buffer_size from AsyncBlockDevice struct
The underlying driver does not need to recalculate the buffer size as
it is passed in the AsyncBlockDevice struct anyway. This also helps in
removing any assumptions of the underlying block size of the device.
2022-03-27 08:54:32 -07:00
Enver Balalic
4ecc695a65 LibWeb: Take borders and padding into account when doing Flex layout
Before this the flex layout didn't take into account the applied
borders or padding while laying out the items.

The child's top and left borders would get painted over the
parent's borders, also due to it not taking borders into account,
children with borders would overlap each other.

Due to it not taking padding into account, the children would get
drawn outside the parent element.
2022-03-27 17:43:47 +02:00
Timur Sultanov
46710d9efa LookupServer: Use case-insensitive comparison for domain names
Some ISPs may MITM DNS requests coming from clients, changing the case
of domain name in response. LookupServer will refuse responses from
any DNS server in that case. This commit changes the behaviour to
perform a case-insensitive equality check.
2022-03-27 17:36:13 +02:00
Kenneth Myhra
f38076e596 disk_benchmark: TRY more stuff :^) 2022-03-27 08:33:24 -04:00
Kenneth Myhra
c0f15ebcbb disk_benchmark: Core::ArgsParser to parse arguments 2022-03-27 08:33:24 -04:00
Kenneth Myhra
23a87a41ff LibCore: Add Vector<size_t> variant of add_option()
This adds a Vector<size_t> variant of add_option(). The signature
includes a separator parameter which defaults to ','.
2022-03-27 08:33:24 -04:00
Andreas Kling
269f9c6863 LibWeb: Add fast-paths for wrapping already-wrapped C++ objects
If a C++ object already has a JS wrapper, we don't need to go through
the expensive type checks to figure out which kind of wrapper to create.
Instead, just return the wrapper we already have!

This gives a noticeable increase in smoothness on Acid3, where ~10% of
CPU time was previously spent doing RTTI type checks in wrap(). With
these changes, it's down to ~1%.
2022-03-27 03:21:29 +02:00
Andreas Kling
5c5e4b5ae5 Revert "LibGfx: Remove bogus baseline adjustment in Painter's draw_text_line()"
This reverts commit 2b2915656d.

While this adjustment is bogus, it is currently responsible for putting
CenterLeft aligned scalable text in the right position.

This is going to take a bunch of work to get right.
2022-03-27 03:01:09 +02:00
Andreas Kling
2b2915656d LibGfx: Remove bogus baseline adjustment in Painter's draw_text_line()
This didn't achieve anything other than a slight vertical misalignment
for scalable fonts.
2022-03-27 01:14:56 +01:00
Andreas Kling
b0208f38f6 LibWeb: Use Gfx::Font::pixel_size() when we want pixel metrics
This gives us consistent results with both bitmap and scalable fonts.
2022-03-27 01:14:56 +01:00
Andreas Kling
65629d26fe LibGfx: Use Font::pixel_size() instead of glyph_height() when painting
This gives us correct height metrics for both bitmap and scalable fonts.
2022-03-27 01:14:56 +01:00
Andreas Kling
ff951c89fe LibGfx: Add Font::pixel_size() and Font::point_size()
We've gotten ourselves into a bit of a mess by mixing pixel and point
sizes in multiple places. Step one towards getting out of this mess
is adding explicit accessors for the unit you're trying to fetch.

The core of the issue comes from bitmap fonts storing integer pixel
sizes and scaled (TTF) fonts storing float point sizes.
2022-03-27 01:14:56 +01:00
Andreas Kling
d5bba91a16 LibWeb: Don't round font sizes when looking them up
We previously had a rounding error which sometimes led to asking LibGfx
for fonts with slightly wrong sizes.
2022-03-27 01:14:56 +01:00
Andreas Kling
ee883372f6 LibGfx: Make FontDatabase lookups take font (point) sizes as float
This will allow web content to ask for fractional sizes, which becomes
important when converting between px/pt.
2022-03-27 01:14:56 +01:00
circl
eeeaf410fb WindowServer+LibGUI: Expose raw scroll wheel values to applications
This is useful, for instance, in games in which you can switch held
items using the scroll wheel. In order to implement this, they
previously would have to either add a hard-coded division by 4, or look
up your mouse settings to adjust correctly.

This commit adds an MouseEvent.wheel_raw_delta_x() and
MouseEvent.wheel_raw_delta_y().
2022-03-27 01:11:27 +01:00
Lenny Maiorani
148f8169a4 LibWeb: Use date constants
Make the code DRY (Don't Repeat Yourself) by using the `AK`-provided
month name constants instead of copying them.
2022-03-27 00:45:12 +01:00
Andreas Kling
83a2aa1832 LibWeb: Include negative margins in height:auto computation for BFC root
...but never allow the resulting height to become negative. This solves
an issue seen on Acid3 where elements with negative vertical margins
expanded the size of their height:auto container instead of shrinking
it, which is the correct behavior. This now works :^)
2022-03-26 22:51:10 +01:00
Andreas Kling
0d9c28add9 LibWeb: Don't collapse horizontal margins between floating boxes
CSS 2.2 says "Horizontal margins never collapse."

So instead of collapsing them, we now add them together, which makes
negative margins between floating boxes work beautifully.
2022-03-26 22:12:21 +01:00
Andreas Kling
80f1749196 Browser: Make the main browser window a little bit bigger by default 2022-03-26 20:49:42 +01:00
Andreas Kling
1883efe010 Base: Add Acid3 to default Browser bookmarks 2022-03-26 20:47:52 +01:00
Andreas Kling
516fbad408 LibWeb: Remove debug spam about not executing empty script elements 2022-03-26 20:35:49 +01:00
Andreas Kling
d8be441978 LibWeb: Fix typo in SVGSVGElement::apply_presentational_hints()
Regressed in 7df62c64b7.

Thanks to Dex for spotting this! :^)
2022-03-26 20:10:36 +01:00
Andreas Kling
fa99259412 LibWeb: Simplify text chunk iteration a little bit
Instead of TextNode::ChunkIterator having two bool members to remember
things across calls to next(), this patch reorganizes the loop in next()
so that preserved newline/whitespace chunks are emitted right away
instead of in an awkward deferred way.
2022-03-26 20:04:56 +01:00
Andreas Kling
dd6a0dd0f7 LibWeb: Remove unused declarations from Layout::TextNode 2022-03-26 20:04:56 +01:00
Andreas Kling
aefe1727fc LibWeb: Make text newlines in "pre" mode emit a ForcedBreak item
Instead of emitting a Text item with the "should_force_break" flag set
to true, newlines in newline-preserving text content now timply turn
into ForcedBreak items. This makes the <pre> element work again.
2022-03-26 20:04:56 +01:00
Andreas Kling
d32630e17b LibWeb: Don't append collapsible whitespace to start of new line
After performing a required line break, and the next text chunk is
all collapsible whitespace, simply discard the whitespace.
2022-03-26 20:04:56 +01:00