Commit Graph

53904 Commits

Author SHA1 Message Date
Zaggy1024
5b8895fff0 LibAudio: Create MP3 seek table first and then seek sample 0 to play
The seek table must locate the first MP3 frame in the file, so it makes
sense to locate the samples for the sample table first, then that
information to seek to the first frame.
2023-08-26 18:43:23 -04:00
Zaggy1024
49be09e5b2 LibAudio: Skip ID3 tags before synchronizing to MP3 frames
Previously, we would just start from byte 0 and check individual bytes
of the file until we find two bytes starting with `FF F`, and then
assume that that was the MP3 frame sync code. However, some ID3v2 tags
do not have to be what is referred to as "unsynchronized", meaning that
they can contain that `FF F` sequence and cause our decoder to think it
has found a frame.

To avoid this happening, we can read a minimal amount of the ID3 header
to determine how many bytes to skip before attempting to find the MP3
frames.

This allows the recent podcast with Andreas to play here:

https://changelog.com/podcast/554
2023-08-26 18:43:23 -04:00
Zaggy1024
2dc75a37d2 LibAudio: Set MP3 seek points to their frame's first sample
Seek points were being created after adding to the sample count in
`build_seek_table()`, meaning that they would be offset forward by
`MP3::frame_size` samples.

This also allows us to remove the hardcoded sample 0 seek point that
was previously added, since a seek point at sample 0 will now be added
by the loop.
2023-08-26 18:43:23 -04:00
Zaggy1024
89fb4af429 LibAudio: Default-initizalize all types in MP3Types.h 2023-08-26 18:43:23 -04:00
MacDue
71baa8c31a LibWeb: Add CSSPixels::nearest_value_for(FloatingPoint)
This is intended to annotate conversions from unknown floating-point
values to CSSPixels, and make it more obvious the fp value will be
rounded to the nearest fixed-point value.
2023-08-26 23:53:45 +02:00
MacDue
360c0eb509 LibWeb: Remove implicit conversion from float and double to CSSPixels
In general it is not safe to convert any arbitrary floating-point value
to CSSPixels. CSSPixels has a resolution of 0.015625, which for small
values (e.g. scale factors between 0 and 1), can produce bad results
if converted to CSSPixels then scaled back up. In the worst case values
can underflow to zero and produce incorrect results.
2023-08-26 23:53:45 +02:00
Timothy Flynn
0f9c088302 Ladybird: Install the native style sheet into the JS console web view
Without this, we are unable to render the web view in dark mode.
2023-08-26 15:32:36 -04:00
Timothy Flynn
3f122b7335 LibWebView: Allow using native/user style sheets on Lagom
Move the methods to set the native/user style sheets to the base
ViewImplementation class. We must also generate the native style sheet
explicitly for now, as LibWebView on Lagom isn't able to include the
main LibWebView CMakeLists.txt file yet.
2023-08-26 15:32:36 -04:00
Timothy Flynn
7df48756d6 LibWeb: Use SystemColor::button_text for ButtonText CSS values 2023-08-26 19:24:22 +02:00
Aliaksandr Kalenik
0060fe3095 LibWeb: Account for float intrusions in list marker x offset 2023-08-26 19:07:56 +02:00
Sam Atkins
240ec9aeed LibWeb: Treat invalid StyleValues that included var() as unset
This means StyleComputer::resolve_unresolved_style_value() always
returns a value, so we can change its return type.

However, it does still return an UnresolvedStyleValue sometimes, so we
can't remove those checks from the user code.
2023-08-26 15:33:45 +01:00
Sam Atkins
6b66e80fb8 LibWeb: Sort Ref/mainfest.json entries 2023-08-26 15:33:45 +01:00
Liav A
4177e6be8b Kernel: Remove KDSETMODE and KDGETMODE ioctl options from the TTY class
These options are not relevant and are actually meaningless on pure TTY
devices, as they are meant to be effective only for the VirtualConsole
devices.

This also removes the virtual marking from two methods because they're
no longer declared in the TTY class as well.
2023-08-26 16:29:28 +02:00
Adam Harald Jørgensen
258af88b29 LibGUI: Fix search highlighting so that it matches the search query
There is a bug in the "search by typing" feature of
AbstractView, where the highlighted text shown in items' title won't
match the search query if the search query contains whitespace.
This commit fixes that bug.

The bug is caused by a bad assumption made in
AbstractView::draw_item_text about the Painter::draw_text API.
Specifically that the function passed to it will be called for each
code point of the string instead of for each drawable glyph.

This is fixed by not relying on looking at the length of the highlight
string, but instead looking at its content.
2023-08-26 09:09:47 -04:00
Shannon Booth
f115e44066 LibWeb: Implement value attribute of RadioNodeList 2023-08-26 13:51:18 +02:00
Shannon Booth
708263790a LibWeb: Implement LiveNodeList::first_matching
This function returns the first element which matches both the filter
for the LiveNodeList collection itself, and a further filter that is
supplied as an argument to this function.
2023-08-26 13:51:18 +02:00
Shannon Booth
191c87f1cd LibWeb: Handle 'default' value state for input elements
For buttons and the hidden state the value IDL call must return the
empty string if there is no value, and the elements value attribute
otherwise.
2023-08-26 13:51:18 +02:00
Shannon Booth
0f374afc8f LibWeb: Handle radio/checkbox default-or-on value attribute state
If the value attribute is missing, these input elements should be
returning 'on' as their value in their IDL.
2023-08-26 13:51:18 +02:00
Shannon Booth
fc4fd6cb02 LibWeb: Fix empty value attribute for 'file' input returning fakepath
It should be returning the empty string for this case.
2023-08-26 13:51:18 +02:00
Aliaksandr Kalenik
c03e025a32 LibWeb: Disambiguate GridTrackPlacement API
- Ambiguous `raw_value()` method is replaced with `line_number()` and
  `span()`.
- `line_name()` that before returned either line name or area name is
  replaced with `line_name()` and `area_name()`.
- `Position` type is replaced with `Line` and `Area` type so we don't
   have to guess while doing layout.

Affected test expectations:
- `template-lines-and-areas` - improvement over what we had before.
- `named-tracks` - rebaseline a giant test. will have to split it into
  smaller tests in the future.
2023-08-26 13:16:17 +02:00
Andi Gallo
29352f570a LibWeb: Fix table column constrainedness
Adjust implementation to reflect the CSS 2.1 definition of width.
2023-08-26 13:10:45 +02:00
Andreas Kling
c6cb876851 LibWeb: Use a serif font in the default UA style sheet
This matches how most/all other browsers behave today.
2023-08-26 12:13:00 +02:00
Andrew Kaster
587cfa7739 LibWeb: Don't assert when calling navigation properties
The invariants for these property getters are supposed to be checked by
the has_entries_and_events_disabled AO, but we don't have all the
plumbing hooked up between Navigables and Navigation yet.

Add a test to make sure that these methods don't assert when calling
them on a fresh page.
2023-08-26 07:35:50 +01:00
Sam Atkins
aae7905369 Applications: Use native style sheet for WebViews where appropriate 2023-08-25 20:30:20 +01:00
Sam Atkins
7436f4fec2 LibWebView: Add a standard "look like the OS" style sheet
It's quite common to want the web-view to match the native OS widgets,
so let's make that easy to do.
2023-08-25 20:30:20 +01:00
Sam Atkins
84a5c67d6b LibWeb: Use system colors in more places 2023-08-25 20:30:20 +01:00
Sam Atkins
cd273f2312 LibWeb: Use system-color keywords in Default.css 2023-08-25 20:30:20 +01:00
Sam Atkins
848ec538c6 LibWeb: Implement <system-color> and <deprecated-color> keywords
The spec allows for these either to be based on the OS, or to be defined
by the browser. Looking at the other browser engines, there's a mix of
the two options. Since we've had issues with using OS colors as
defaults, let's use hard-coded colors for now. Some of these are based
on the definitions in
https://html.spec.whatwg.org/multipage/rendering.html
2023-08-25 20:30:20 +01:00
Sam Atkins
1dcd63be05 LibWeb: Deduplicate "ident is color" check
Reuse the check from IdentifierStyleValue in the CSS Parser, instead of
duplicating it. This might not be the ideal place to put it, but it
works for now.
2023-08-25 20:30:20 +01:00
Andreas Kling
da8692572a LibWeb: Support media queries with the resolution feature
The resolution is simply 1dppx * device pixel ratio.

This makes high resolution images show up on https://apple.com/
when running on a high-DPI display. :^)
2023-08-25 20:10:47 +02:00
Andreas Kling
b63e393cef LibWeb: Fix broken conversion of CSS <resolution> dpi/dpcm to dppx
Also add a basic test that documents how these media features currently
get serialized, even if they're not identical to other browsers yet.
2023-08-25 20:10:47 +02:00
Andreas Kling
b256e52586 AK: Make Formatter for NonnullOwnPtr<T> format the T
This mirrors the behavior of NonnullRefPtr<T>. If you want to format
the pointer address, call .ptr() on it.
2023-08-25 20:10:47 +02:00
Andrew Kaster
f8e5df7a99 LibWeb: Implement navigation.navigate()
The implementation is incomplete, because our Navigable::navigate
implementation is missing the navigationAPIState parameter. We also
don't have Navigables hooked up completely enough to guarantee that a
fully active document that is not being unloaded always has a Navigable.
2023-08-25 19:51:13 +02:00
Andrew Kaster
34ea470d4f LibWeb: Add AO for navigation_must_be_a_replace to Navigable
This is used by both Navigable and Navigation, so let's put it in
Navigable. Also add a missing AK/String include to make clangd happier
with the Navigable file.
2023-08-25 19:51:13 +02:00
Andrew Kaster
7ad45d9e71 LibWeb: Expose a getter for Document's unload_counter
We need to check this value from the Navigation APIs.
2023-08-25 19:51:13 +02:00
Andrew Kaster
268fd93352 LibWeb: Use correct dictionary semantics for NavigateEvent
Every property in an IDL dictionary is implied to be optional, unless it
is marked as required. If a dictionary is passed to a method with
optional, but it has at least one required or defaulted member, the
bindings will skip the optionality of the parameter and always pass a
struct with the required parameters filled in.
2023-08-25 19:51:13 +02:00
Aliaksandr Kalenik
d8cfe79a20 LibWeb: Call process_the_iframe_attributes if iframe attribute changed
Replaces `load_src()` with `process_the_iframe_attributes()`. Both load
document of iframe but the latter is defined in spec.
2023-08-25 19:50:53 +02:00
Timothy Flynn
5291d516c0 LibWeb: Ensure layout/text/ref tests run with the desired default theme
Without setting the --resources flag, headless-browser defaults to /res
for all resources it tries to find, including the theme. It will not
find this path on Lagom, so our attempt to load the default theme does
not accomplish anything.
2023-08-25 19:48:55 +02:00
Timothy Flynn
4fc88aa17b Kernel: Run clang-format on a couple of FileSystem sources
Fixes bad formatting in commit abcf05801a.
2023-08-25 08:34:21 -04:00
Zak-K-Abdi
abcf05801a Kernel: Allow Ext2FS::flush_writes() to return ErrorOr<void> 2023-08-25 11:36:57 +01:00
Torstennator
28cda85f1f PixelPaint: Editing mask optimization
This patch introduces a new function "Layer::editin_mask_bounding_rect"
that is used within the LevelsDialog, Luminosity and Colormasking to
process only the area where a mask was applied. Therefore we can
greatly reduce the amount of processed pixels if only a small portion
of the image was masked.
2023-08-25 11:14:03 +01:00
Torstennator
b3a6ccc45b PixelPaint: Optimize color masking performance
This patch adds a small performance tweak when accsessing pixels for
color-masking. Despite of that the most time is spent in
Color::to_hsv()
2023-08-25 11:14:03 +01:00
Torstennator
60b72b8033 PixelPaint: Calculate histogram and vectorscope data only when needed
With this patch the histogram and vectorscope data for the image is
only computed when the widgets are visible to the user and therefore
saves some processing time when this information is not required
to be computed.
2023-08-25 11:14:03 +01:00
Liav A
1c0aa51684 Kernel+Userland: Remove the {get,set}_thread_name syscalls
These syscalls are not necessary on their own, and they give the false
impression that a caller could set or get the thread name of any process
in the system, which is not true.

Therefore, move the functionality of these syscalls to be options in the
prctl syscall, which makes it abundantly clear that these operations
could only occur from a running thread in a process that sees other
threads in that process only.
2023-08-25 11:51:52 +02:00
Liav A
1458849850 Kernel: Remove FixedStringBuffer template argument in prctl.cpp
This template argument can be inferred automatically and is not needed.
2023-08-25 11:51:52 +02:00
Liav A
72231b405a AK+Kernel: Introduce StdLib function to copy FixedStringBuffer to user
This new Kernel StdLib function will be used to copy contents of a
FixedStringBuffer with a null character to a user process.

The first user of this new function is the prctl option of
PR_GET_PROCESS_NAME which would copy a process name including a null
character to a user provided buffer.
2023-08-25 11:51:52 +02:00
Liav A
6cb88e224e Kernel: Remove checks for signed numbers in the prctl syscall
When doing PR_{SET,GET}_PROCESS_NAME, it's not expected to pass a signed
integer for the buffer size (in arg2). Therefore, cast it immediately to
a size_t integer type, and let the FixedStringBuffer StdLib memory copy
functions in such cases to worry about possible overflows.
2023-08-25 11:51:52 +02:00
Andreas Kling
13e2ca6b59 LibWeb: Parse src: local(...) in CSS @font-face rules
Note that we don't load the local font as specified, but at least we no
longer reject such src properties in the CSS parser.

This makes the custom fonts used on http://apple.com/ actually load. :^)
2023-08-25 11:51:28 +02:00
Andreas Kling
e924ea002f LibWeb: Add Referer HTTP header to CSS font requests
If we don't do this, we just get 404 Not Found for all fonts used by
https://apple.com/
2023-08-25 11:51:28 +02:00
Tim Ledbetter
d730cd89f5 Ports/gnuplot: Update formatting to be consistent with other ports 2023-08-25 10:33:30 +02:00