Commit Graph

59109 Commits

Author SHA1 Message Date
Matthew Olsson
35859c0467 LibWeb: Add helpers to convert between FillMode and Direction enums 2024-02-22 07:31:54 +01:00
Nico Weber
c9234f35f1 LibPDF/CFF: Clear stack after "endchar" commands
Both type 1 and type 2 spec tell us to do this.

I haven't observed a difference from this, but I noticed it in the
spec while I was touching this code. Probably good to do what the
spec tells us to do.
2024-02-22 06:59:28 +01:00
Nico Weber
020c00ede2 LibPDF/CFF: Use offset in accented_character() data
Without this, the dieresis above an a is all the way to the left
instead of over the letter.
2024-02-22 06:59:28 +01:00
Nico Weber
12859dfde5 LibPDF/CFF: Treat endchar in type 2 as type 2 "seac" when requested
With this, a character can be defined that uses two existing glyphs.
This is useful for umlauts and the like, which then just need to
reference e.g. the glyphs named "a" and "dieresis" and provide a
translation.

Makes umlauts appear on some PDFs using CFF type2 data in Type 1
fonts.
2024-02-22 06:59:28 +01:00
Jelle Raaijmakers
b2eaed43e9 Ports: Remove LibGL workarounds
Now that ports can find our OpenGL headers and shared library, remove
all configuration and patches that was previously needed to make ports
compile with LibGL.
2024-02-22 03:48:08 +01:00
Jelle Raaijmakers
857ab2e06d LibGL: Create symlinks for headers and shared library
This allows ports to access the OpenGL headers using `#include
<GL/gl.h>` and find the shared library at `/usr/lib/libGL.so` or
`/usr/lib/libGL.so.1`, removing the need for explicit include paths or
changed library names.
2024-02-22 03:48:08 +01:00
Jelle Raaijmakers
5cff59557e LibGL: Add all glPushAttrib bit flags
This is required to build the `sdl12-compat` port when it's using our
header files to compile.
2024-02-22 03:48:08 +01:00
Tim Ledbetter
3f6f3a90c1 HexEditor: Fix typo in parameter name 2024-02-21 23:32:15 +01:00
Tim Ledbetter
f742334b93 HexEditor: Prefer enum class to enum for FindDialog::OptionId 2024-02-21 23:32:15 +01:00
Tim Ledbetter
b330d83be4 HexEditor: Prefer ErrorOr to Result in FindDialog 2024-02-21 23:32:15 +01:00
ronak69
a42cf020ea LibTest: Return 0 if all test cases pass and 1 otherwise from TEST_MAIN
Before, TEST_MAIN used to return the return value of TestSuite::main()
function (which returns the number of test cases that did not pass, so
it can be >=256) directly.

The run-tests utility determines the success / failure of a test suite
binary by examining its (or i.e. TEST_MAIN's) exit status.

But as exit status values are supposed to be between 0 and 255, values
>=256 will get wrapped around (modulo 256), converting a return value of
256 to 0.

So, in a rare case where exactly 256 test cases are failing in your test
suite, run-tests utility will display that the test suite passed without
any failures.

Now, TEST_MAIN just returns 0 if all of the test cases pass and returns
1 otherwise.
2024-02-21 22:45:51 +01:00
Tim Ledbetter
1a223d07e1 LibGUI: Assert that most recently open file path isn't empty
Attempting to do this causes a crash. It's better to fail early in this
case, so that the cause of the failure is clear.
2024-02-21 22:37:34 +01:00
Tim Ledbetter
ad62e433f0 PixelPaint: Don't crash when cancel is pressed when saving a file
Previously, we were attempting to add an empty string to the most
recently open files list when no file was saved.
2024-02-21 22:37:34 +01:00
Sönke Holz
ecf41e13ad Kernel/Graphics: Probe PCI graphics adapters on all architectures 2024-02-21 22:36:00 +01:00
Jelle Raaijmakers
e54e2a5a4f Ports: Patch curl CMake issue
The CMake syntax was a bit too new for our toolchain's CMake. The
following patch was backported:

  b2497a8d15

Relevant issue:

  https://github.com/curl/curl/issues/12920

As soon as the fix lands in the next curl version, we can remove this
patch again. :^)
2024-02-21 22:24:42 +01:00
Sönke Holz
a203837b1f LibC: Save callee-saved floating-point registers in setjmp for riscv64 2024-02-21 21:59:01 +01:00
Julian Offenhäuser
420c54a21b Ports: Add app category hotkey for Milkytracker
Missing the & caused it to register as a different category entirely.
2024-02-21 21:53:42 +01:00
Dan Klishch
56d355a15e LibWeb: Properly round CSSPixels values in device_to_css_rect
Ceiling width or height of a chrome viewport (this function is only used
when a chrome notifies LibWeb about a new viewport size) is never
correct. If we do that, PageClient::page_did_layout will set content
size to be 1 larger than an actual physical width or height respectively
(it always ceils) and thus a spurious scrollbar will appear.

This prevents occasional scrollbar flickering in Ladybird/Qt on Wayland
with fractional scaling enabled on compositors supporting
wp-fractional-scale-v1.
2024-02-21 20:08:25 +01:00
Timothy Flynn
7bee1c9897 LibWeb: Store the input image button's selected coordinates as integers
The spec has prose which states, e.g., "The x-component must be a valid
integer".
2024-02-21 19:52:59 +01:00
Timothy Flynn
3f3db34587 LibWeb: Support setting dimensions on input image buttons
Users are allowed to specify the height and width of an image button
directly in the HTML.
2024-02-21 19:52:59 +01:00
Matthew Olsson
3ea26327c7 LibWeb: Implement Animatable::get_animations() 2024-02-21 19:52:35 +01:00
Matthew Olsson
145ae54718 LibWeb: Add a few Animation/AnimationEffect getters 2024-02-21 19:52:35 +01:00
Matthew Olsson
06a8674eec LibWeb: Simplify Animation::update_finished_state a bit
This removes the two boolean hack in favor of using the existing
mechanism to remove queued tasks. It also exposes the element
invalidation behavior for call sites that don't necessarily want to
update the finished state, but still need to invalidate the associated
target.
2024-02-21 19:52:35 +01:00
Matthew Olsson
1e37ba5515 LibWeb: Expose Animation::is_finished()
This will be required to handle forward-fill state in StyleComputer
2024-02-21 19:52:35 +01:00
Matthew Olsson
5eea53f27a LibWeb: Keep track of associated AnimationEffects in Animatable 2024-02-21 19:52:35 +01:00
Matthew Olsson
2ade834655 LibWeb: Add Animation::is_replaceable() 2024-02-21 19:52:35 +01:00
Matthew Olsson
4e6c74dcf6 LibWeb: Define the composite order between two animations 2024-02-21 19:52:35 +01:00
Matthew Olsson
ceb9d0f8dc LibWeb: Record position of Animations in global animation list
"position of an Animation in the global animation list" is a fancy way
of saying "which animation object was created first"
2024-02-21 19:52:35 +01:00
Matthew Olsson
c3b689488e LibWeb: Implement animation class-specific composite order
This is a part of determining the composite order of two animations
2024-02-21 19:52:35 +01:00
Nico Weber
78b3c552c2 LibGfx: Tweak semantics of some SkipTables enum values
It turns out that hmtx and OS/2 table values _are_ used when
rendering OpenType for PDFs: hmtx is used for the left-side bearing
value (which is read in `Painter::draw_glyph()`), and OS/2 is used
for the ascender, which Type0's CIDFontType2::draw_glyph()
and TrueTypeFont::draw_glyph() read.

So instead of not trying to read these tables, instead try to read
them but tolerate them failing to read and ignore them then.

Follow-up to #23276.

(I've seen weird glyph positioning from not reading the hmtx table.
I haven't seen any problems caused by not reading the OS/2 table yet,
but since the PDF code does use the ascender value, let's read that
too.)
2024-02-21 19:52:03 +01:00
Tim Ledbetter
1560bfc6c9 LibWeb: Ensure DOMRect top, bottom, left and right handle NaN correctly 2024-02-21 19:38:17 +01:00
Tim Ledbetter
b03c94c26e Tests/LibWeb: Add tests for DOMRect construction 2024-02-21 19:38:17 +01:00
Tim Ledbetter
fe66aeb225 LibWeb: Validate arguments when creating DOMPoint from matrix transform
Previously, it was possible to create a DOMPoint from a matrix
transform with inconsistent arguments. A TypeError is now thrown in
this case.
2024-02-21 19:38:17 +01:00
Tim Ledbetter
c5d1ec4dea LibWeb/CSS: Ensure length is absolute before converting to pixels
Previously, creating a DOMMatrix with a transform that contained
non-absolute units would cause a crash.
2024-02-21 19:38:17 +01:00
Tim Ledbetter
5136b495a6 LibWeb: Use NaN safe min() and max() functions to compute DOMQuad bounds 2024-02-21 19:38:17 +01:00
Nico Weber
607880cbd3 LibGfx/JPEGLoader: Add dbgln_if() when hitting unsupported marker 2024-02-21 17:54:53 +01:00
Nico Weber
95391fafcb LibGfx/JPEGLoader: Print offset in an error dbgln() in hex 2024-02-21 17:54:53 +01:00
Nico Weber
24a469f521 Everywhere: Prefer {:#x} over 0x{:x} in format strings
The former automatically adapts the prefix to binary and octal
output, and is what we already use in the majority of cases.

Patch generated by:

    rg -l '0x\{' | xargs sed -i '' -e 's/0x{:/{:#/'

I ran it 4 times (until it stopped changing things) since each
invocation only converted one instance per line.

No behavior change.
2024-02-21 17:54:38 +01:00
Andreas Kling
f963bb4f36 LibWeb: Don't mark heights as definite in set_content_height()
Height definiteness is now preserved as intended by CSS-SIZING-3
(assuming I've understood it correctly) and not implicitly granted by
layout algorithms when they assign height.

For the specific special/magical cases where some sizes become definite
during layout, the preceding commits have made them explicit in code.

This fixes a number of flex layout issues where we were previously
resolving percentage values against post-layout flex container heights,
but other browsers don't.
2024-02-21 17:54:05 +01:00
Andreas Kling
0dd8458683 LibWeb: Add FIXME about definiteness to UsedValues::set_content_width()
Fixing this function will be quite an undertaking since a *lot* of code
relies on set_content_width() implicitly flipping the definiteness of
the width. It is wrong though, so we do need to fix it eventually.
2024-02-21 17:54:05 +01:00
Andreas Kling
221650f3cd LibWeb: Mark fixed-length abspos element sizes as definite
In particular, these two interesting cases:

- The containing block of an abspos box is always definite from the
  perspective of the abspos box.

- When resolving abspos box sizes from two opposing fixed insets,
  we now mark those sizes as definite (since no layout was required
  to resolve them).
2024-02-21 17:54:05 +01:00
Andreas Kling
70ce77fc72 LibWeb: Make SVGFormattingContext treat all sizes as definite for now
The whole way we lay out SVG content is ad-hoc, so this doesn't follow
any particular spec. However, our viewport transform logic depends on
having definite sizes, so let's just mark them as such for now.
2024-02-21 17:54:05 +01:00
Andreas Kling
f0269b0a94 LibWeb: Mark root element height as definite when affected by quirk
This will be required for percentages to resolve against it correctly
after we make set_content_height() not automatically mark heights as
definite sizes.
2024-02-21 17:54:05 +01:00
Andreas Kling
b079f4d590 LibWeb: Make flexbox special definite size cases explicit
The CSS-FLEXBOX-1 spec has a bunch of special cases where sizes are
considered definite after reaching a specific point of the layout
algorithm.

Before this change, we were relying on set_content_width/height also
implicitly marking those content sizes as definite.

To prepare for that implicit behavior going away, this patch makes
the special cases explicit.
2024-02-21 17:54:05 +01:00
Andreas Kling
5a995e95e3 LibWeb: Add UsedValues::set_has_definite_width/height()
These will be used to explicitly mark some box geometry as definite
at various stages of layout. It's gonna get finicky.
2024-02-21 17:54:05 +01:00
Andreas Kling
b83e41c9b5 LibWeb: Only assign block container heights during BFC intrinsic sizing
Before this change, we were always assigning the calculated height to
each block container after laying it out in BFC.

This should really only happen during intrinsic sizing, since that is
how measurements are communicated to the client there.
2024-02-21 17:54:05 +01:00
auipc
6a662e0d43 LibWeb: Add various window transformation methods 2024-02-21 15:53:27 +00:00
Simon Wanner
81d1b129f7 Ladybird/QT: Avoid incorrect round trip via QUrl
QUrl::toString reverses the Unicode->ASCII conversion that already
occurred here. The text of m_location_edit is already in the format we
expect, so let's just convert QString->AK::URL directly, instead of
taking the detour QString->QUrl->AK::URL
2024-02-21 09:25:12 -05:00
Simon Wanner
cac23820c5 Ladybird/QT: Avoid constructing AK String types from char* without size
While QByteArray::data does return a null-terminated char* it's nicer to
avoid strlen() when we already know the size
2024-02-21 09:25:12 -05:00
Shannon Booth
d18f7145ad patch: Remove empty files after patching 2024-02-21 14:11:49 +01:00