Commit graph

27985 commits

Author SHA1 Message Date
Brian Gianforcaro
925f21353e Meta: Exclude LibWasm Parser.cpp from Sonar Cloud Static Analysis
We need to exclude this file from analysis for now, as there is a bug in
the sonar-runner tool where it crashes when trying to understand the use
of AK::Variant in LibWasm/Parser/Parser.cpp

See #10122 for details + link to the bug report to Sonar Cloud.
2021-09-23 01:07:11 +02:00
Brian Gianforcaro
eddccf11da Meta: Remove unused caching from Sonar Cloud configuration
I was experimenting with using caching while doing the initial prototype
of the Sonar Cloud workflow. However the cache size for the static
analysis data ended up being large enough that it would put us over the
git hub actions limit. Given that we currently only run this pipeline
once a day, it seems reasonable to just remove caching.

If in the future we decide to run the pipeline on every PR, caching
would become crucial as the current un-cached analysis time is around
1 hour and 50 minutes. If we did this we would need to move the pipeline
to Azure DevOps where we have effectively infinite cache available.
2021-09-23 01:07:11 +02:00
Karol Kosek
620e4fd0d2 WebContent: Pass an empty bitmap object if the pointer is null
Prior this commit we were always dereferencing the image bitmap pointer,
even if it was null, which resulted in a crash when trying to open
the context menu when an image wasn't loaded.

Closes: #10178
2021-09-22 22:10:11 +02:00
Tobias Christiansen
a501a02851 LibWeb: Ignore negative margins for calculating height in a BFC
Negative margins are a headache anyways, and allowing them to be
negative lead to weird behavior.
This patch avoids vasty wrong height-calculations by limiting the
allowed margins to positive numbers when evaluating the height of a
block.
2021-09-22 22:06:52 +02:00
thankyouverycool
bbaebdcd00 FontEditor: Keep selected glyph in view on resize 2021-09-22 21:35:42 +02:00
thankyouverycool
efe44451ca FontEditor: Make update_{statusbar,preview} member functions
For use outside constructor. Renames demo to preview to make
the UI and code comport.
2021-09-22 21:35:42 +02:00
thankyouverycool
3159e548a5 LibGUI: Calculate unclamped_scrubber_size() as float
Large enough content ranges produced unclamped scrubbers sized zero,
effectively clamped by their integer type. This led to zero sized
page_increments and scrubbers which didn't budge on gutter events.
This fixes broken gutters in FontEditor and TextEditor for large
files.
2021-09-22 21:35:42 +02:00
thankyouverycool
e8f3fda3cf FontEditor: Remove reprobe_font()
This was used to update GlyphMapWidget on Type changes and is
no longer needed since removal of Type enumeration in bb592ae.
2021-09-22 21:35:42 +02:00
thankyouverycool
144d32d537 FontEditor: Sanitize RTL and control glyphs in Clipboard metadata
Fixes display issues in ClipboardHistory.
2021-09-22 21:35:42 +02:00
thankyouverycool
0a4640e892 FontEditor: Put glyph width changes on the undo stack
And select the restored glyph on undo/redo.
2021-09-22 21:35:42 +02:00
thankyouverycool
1ae4caca4b FontEditor: Set width to zero when deleting a glyph
Previously, Delete left a glyph's width maximized.
2021-09-22 21:35:42 +02:00
thankyouverycool
ca6cb6cec3 FontEditor: Simplify initialization by disabling widget callbacks
Reduces some complexity dealing with callback effects and fixes
redundant calls to update_title and erroneously set glyph widths.
2021-09-22 21:35:42 +02:00
thankyouverycool
92fffc3abc LibGUI: Rename CallOnChange => AllowCallback and implement elsewhere
This is a helpful option to prevent unwanted side effects, distinguish
between user and programmatic input, etc. Sliders and SpinBoxes were
implementing it idiosyncratically, so let's generalize the API and
give Buttons and TextEditors the same ability.
2021-09-22 21:35:42 +02:00
Luke Wilde
d47e431d54 LibWeb: Add getElementsByTagNameNS and add support for * in non-NS
This also moves getElementsByTagName to ParentNode to remove the code
duplication between Document and Element. This additionally fixes a bug
where getElementsByTagName did not check if the element was a
descendant, meaning it would also include the context element if the
condition matched.
2021-09-22 20:33:06 +02:00
Sam Atkins
5c7dca3526 LibWeb: Stop rejecting valid values for several CSS properties
In StyleResolver, we were rejecting single values for properties that
take 1-4: `border-color`, `border-style`, and `border-width`. Now, we
handle them correctly. I also added support for `calc()` and `var()` to
`padding` and `margin`.

This fixes the orange border on Acid2, which now correctly appears
black. :^)
2021-09-22 20:32:35 +02:00
Andreas Kling
635ab6db0b LibWeb: Expose the GlobalEventHandlers mixin on the Window object
We now expose all the `onfoo` event handler attributes on the window
object. This makes `window.onload = ...` actually work. :^)
2021-09-22 16:40:24 +02:00
Andreas Kling
fb2f7c7b9c LibWeb: Remove unnecessary WindowObject.h include in DOMException.h 2021-09-22 15:37:50 +02:00
Andreas Kling
1884e2caf1 LibWeb: Add DOM::ExceptionOr<T> to forwarding header 2021-09-22 15:37:21 +02:00
Andreas Kling
fccf0a466b LibWeb: Log resource load success before invoking success callback
The success callback may trigger JavaScript execution, causing resource
load times to appear much longer than they actually are. :^)
2021-09-22 14:35:13 +02:00
Andreas Kling
784ab75d2d LibCoredump: Don't copy uncompressed coredumps into a ByteBuffer
This was completely unnecessary and accounted for 6% of the total time
spent when loading a WebContent coredump into CrashReporter.
2021-09-22 00:40:07 +02:00
Idan Horowitz
1da8faebf5 LibJS: Convert perform_eval to ThrowCompletionOr 2021-09-21 23:28:38 +03:00
Idan Horowitz
e24d4c346d LibJS: Add VM::throw_completion helper for throwing custom Strings 2021-09-21 23:28:38 +03:00
Idan Horowitz
f302b114f3 LibJS: Convert get_substitution to ThrowCompletionOr 2021-09-21 23:28:38 +03:00
Idan Horowitz
69430855e0 LibJS: Remove non-specification compliant exception check 2021-09-21 23:28:38 +03:00
Idan Horowitz
e90e4ac1e2 LibJS: Convert length_of_array_like to ThrowCompletionOr 2021-09-21 23:28:38 +03:00
Idan Horowitz
02a88c5063 LibJS: Convert make_super_property_reference to ThrowCompletionOr 2021-09-21 23:28:38 +03:00
Andreas Kling
9d7fe39640 CrashReporter: Show coredump loading progress in the Taskbar :^) 2021-09-21 20:52:29 +02:00
Andreas Kling
f6f9599899 CrashReporter+LibCoredump: Show progress window while loading coredump
Some coredumps take a long time to symbolicate, so let's show a simple
window with a progress bar while they are loading.

I'm not super happy with the factoring of this feature, but it's an
absolutely kickass feature that makes crashing feel 100% more responsive
than before, since you now get GUI feedback almost immediately after a
crash occurs. :^)
2021-09-21 20:52:29 +02:00
Andreas Kling
4f224b15ed CrashDaemon+CrashReporter: Streamline crash reporting a little bit
Before this patch, this is what would happen after something crashed:

1. CrashDaemon finds a new coredump in /tmp
2. CrashDaemon compresses the new coredump (gzip)
3. CrashDaemon parses the uncompressed coredump and prints a backtrace
4. CrashDaemon launches CrashReporter
5. CrashReporter parses the uncompressed coredump (again)
6. CrashReporter unlinks the uncompressed coredump
7. CrashReporter displays a GUI

This was taking quite a long time when dealing with large programs
crashing (like Browser's WebContent processes.)

The new flow:

1. CrashDaemon finds a new coredump in /tmp
2. CrashDaemon mmap()'s the (uncompressed) coredump
3. CrashDaemon launches CrashReporter
4. CrashDaemon goes to sleep for 3 seconds (hack alert!)
5. CrashReporter parses the (uncompressed) coredump
6. CrashReporter unlinks the (uncompressed) coredump
7. CrashReporter displays a GUI
8. CrashDaemon wakes up (after step 4)
9. CrashDaemon compresses the coredump (gzip)

TL;DR: we no longer parse the coredumps twice, and we also prioritize
launching the CrashReporter GUI immediately when a new coredump shows
up, instead of compressing and parsing it in CrashDaemon first.

The net effect of this is that you get a backtrace on screen much
sooner. That's pretty nice. :^)
2021-09-21 20:52:29 +02:00
Andreas Kling
38b0200151 LibCoredump: Make Backtrace getters return const references 2021-09-21 20:52:29 +02:00
Idan Horowitz
e12a707ca1 checksum: Stop reusing the same Core::File for multiple files
Since we were just repeatedly calling `->open()` on the same Core::File
no one was clearing it's internal buffer, which means hashing multiple
files in one go would result in different hashes than hashing each file
separately.
2021-09-21 20:36:19 +03:00
Linus Groh
d792869799 LibJS: Update spec comment to convert mathematical to number value
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/d2ae357
2021-09-21 19:13:22 +02:00
Andreas Kling
ca45d34055 LibWeb: Don't add shorthand CSS properties to cascaded values
We already expand shorthands in the cascade, so there's no need to
preserve them in the output.

This patch reorganizes the CSS::PropertyID enum values so that we can
easily iterate over all shorthand or longhand properties.
2021-09-21 16:54:28 +02:00
Sam Atkins
e07cf6f41b LibWeb: Paint bitmaps with rounded_int_rect(), not enclosing_int_rect()
This fixes the issue where an `<img>` set to its native size would
sometimes still appear blurry, because it had a fractional position,
causing `enclosing_int_rect()` to expand by 1px.
2021-09-21 16:53:46 +02:00
Sam Atkins
0b7eefd4e5 LibGfx: Add rounded_int_rect() function for Rects
We were seeing a problem in LibWeb, where layout elements would be 1px
larger than they should be, due to layout positions using float values,
and then converting using `enclosing_int_rect()`. `rounded_int_rect()`
replaces that use, by maintaining the original rect's size.
2021-09-21 16:53:46 +02:00
Sam Atkins
8817ea83d6 LibWeb: Display actual (float) values when dumping layout 2021-09-21 16:53:46 +02:00
Ben Wiederhake
ac00d8b4eb LibWeb: Use AK::Variant default initialization in one more place 2021-09-21 15:25:17 +02:00
Timothy Flynn
8084957e88 CI: Create a secondary ccache for the Clang toolchain build
We bust the prebuilt cache when any header in e.g. LibC changes. Doing a
full toolchain rebuild probably isn't necessary, so this adds a separate
ccache to speed up toolchain builds.
2021-09-21 15:39:17 +03:00
Timothy Flynn
4a4e614387 CI: Set ccache path based on template parameter
Currently, the templated steps in Caches.yml rely on the environment
variable CCACHE_DIR being set to configure the ccache location. To
prepare for multiple ccache paths, do not rely on this environment
variable because only one ccache can use it at a time. Instead, pass
the path into the template as a parameter.
2021-09-21 15:39:17 +03:00
Timothy Flynn
5a2f41fff0 Toolchain: Add --ci option to BuildClang to enable ccache 2021-09-21 15:39:17 +03:00
Andreas Kling
aa7c590130 Base: Add 0x00A0 (non-breaking space) glyph to all our bitmap fonts
This is frequently used in web content (&nbsp;) so this change makes us
display it properly as whitespace. :^)
2021-09-21 13:04:02 +02:00
Andreas Kling
d965a9552f LibWeb: Start implementing the CSS cascade
The 'C' in "CSS" is for Cascade, so let's actually implement the cascade
in LibWeb. :^)

StyleResolver::resolve_style() now begins by collecting all the matching
CSS rules for the given DOM::Element. Rules are then processed in the
spec's cascade order (instead of in the order we encounter them.)

With this, "!important" is now honored on CSS properties.

After performing the cascade, we do another pass of what the spec calls
"defaulting" where we resolve "inherit" and "initial" values.
I've left a FIXME about supporting correct "initial" values for every
property, since we're currently lacking some coverage there.

Note that this mechanism now resolves every known CSS property. This is
*not* space-efficient and we'll eventually need to come up with some
strategies to reduce memory usage around this. However, this will do
fine until we have more of the engine working correctly. :^)
2021-09-21 12:49:28 +02:00
Andreas Kling
c55909f175 LibWeb: Add a specialized BorderRadiusStyleValue::equals()
This allows fast comparison of two BorderRadiusStyleValues.
2021-09-21 12:33:15 +02:00
Andreas Kling
ae7bbd93b8 LibWeb: Add a specialized NumericStyleValue::equals()
This allows fast comparison of two NumericStyleValues.
2021-09-21 12:33:15 +02:00
Andreas Kling
3e4fffec26 LibWeb: Make DOM::Element::resolve_custom_property() const 2021-09-21 12:33:15 +02:00
Andreas Kling
56710fab34 LibWeb: Include the "important" flag in CSS dumps 2021-09-21 12:33:15 +02:00
Andreas Kling
7ed49e954f LibWeb: Don't print debug spam when looking up missing initial values
I'm about to look up a lot of missing values, and the spam was getting
out of hand.
2021-09-21 12:33:15 +02:00
Andreas Kling
720d494799 LibWeb: Make CSS::Length::m_calculated_style a RefPtr
Let's now have CSS::Length holding raw pointers to things.
2021-09-21 12:33:15 +02:00
Ben Wiederhake
32e98d0924 Libraries: Use AK::Variant default initialization where appropriate 2021-09-21 04:22:52 +04:30
Ben Wiederhake
98a0f9c0bd LibPDF: Rely on default-constructor of Variant 2021-09-21 04:22:52 +04:30