summaryrefslogtreecommitdiff
path: root/Userland
AgeCommit message (Collapse)Author
2022-09-16LibWeb: Improve inline flow around floating boxesAndreas Kling
This patch combines a number of techniques to make inline content flow more correctly around floats: - During inline layout, BFC now lets LineBuilder decide the Y coordinate when inserting a new float. LineBuilder has more information about the currently accumulated line, and can make better breaking decisions. - When inserting a float on one side, and the top of the newly inserted float is below the bottommost float on the opposite side, we now reset the opposite side back to the start of that edge. This improves breaking behavior between opposite-side floats. - After inserting a float during inline layout, we now recalculate the available space on the line, but don't adjust X offsets of already existing fragments. This is handled by update_last_line() anyway, so it was pointless busywork. - When measuring whether a line can fit at a given Y coordinate, we now consider both the top and bottom Y values of the line. This fixes an issue where the bottom part of a line would bleed over other content (since we had only checked that the top Y coordinate of that line would fit.) There are some pretty brain-dead algorithms in here that we need to make smarter, but I didn't want to complicate this any further so I've left FIXMEs about them instead.
2022-09-16LibWeb: Repaint the page immediately when using the mouse to selectAndreas Kling
Otherwise we'd repaint the next time our "caret blink" timer would fire (or something else caused a repaint). This made selection feel sluggish.
2022-09-16LibGfx: Recurse TrueType composite glyphs until a simple glyph is foundEnver Balalic
This fixes a bug in ladybird where it was crashing while rendering characters like őčćž in the Noto Sans Regular font. That font renders those characters as a composite where the caret has numberOfContours = -1. When using the rasterize_impl simple path for that, it would negatively overflow the offsets.
2022-09-16LibWeb: Paint `backdrop-filter` effects!MacDue
This implements all the filters other than `saturate()`, `hue-rotate()`, and `drop-shadow()`. There are still a lot of FIXMEs to handle in the actual implementation though, particularly around supporting transforms, but this handles the most common use cases :^)
2022-09-16LibGfx: Support getting a bitmap for a region of painterMacDue
This will be needed so we can apply filter effects to the backdrop of an element in LibWeb. This now also allows getting a crop of a bitmap in a different format than the source bitmap. This is for if the painter's bitmap does not have an alpha channel, but you want to ensure the cropped bitmap does.
2022-09-16LibGfx: Add `BrightnessFilter`, `ContrastFilter`, and `OpacityFilter`MacDue
These filters are based off the ones defined in: https://drafts.fxtf.org/filter-effects-1/#supported-filter-functions
2022-09-16LibGfx: Allow applying all color filters with an amountMacDue
This amount can be handled in the filter's implementation or if not it will default to mixing between the new and previous pixel. This behaviour is used for implementing CSS filters that allow stuff like grayscale(70%).
2022-09-16LibWeb+LibGfx: Move premultiplied alpha mixing to color.mixed_with()MacDue
This will be needed for mixing filters in LibGfx (and may be generally useful elsewhere).
2022-09-16LibWeb: Plumb style/computed values for `backdrop-filter`MacDue
2022-09-16LibWeb+Meta: Parse the `backdrop-filter` CSS propertyMacDue
Note: The parsing and style value completely ignores the SVG filters part of the spec for now... That's a yak for another day :^)
2022-09-16LibWeb: Add FilterValueListStyleValueMacDue
This style value holds a list of CSS filter function calls e.g. blur(10px) invert() grayscale() It will be used to implement backdrop-filter, but the same style value can be used for the image filter property. (The name is a little awkward but it's referenced to as filter-value-list in the spec too).
2022-09-16LibWeb: Add operator== to CSS::NumberMacDue
This will be needed for the .equals() function of the backdrop-filter style value.
2022-09-16LibWeb: Add NumberPercentage CSS typeMacDue
This type is used quite a bit in CSS filters.
2022-09-16LibWeb: Pass values by reference in style value operator== functionsMacDue
2022-09-16LibC: Remove `_aligned_malloc` and `_aligned_free`Tim Schumacher
We now have a proper aligned allocation implementation, and the toolchain patch to make Clang use the intermediary implementation has already been removed in an earlier iteration.
2022-09-16LibJS: Supress an unused bind when wrapping float atomic operationsTim Schumacher
2022-09-16Everywhere: Remove a bunch of dead write-only variablesTim Schumacher
LLVM 15 now warns (and thus errors) about this, and there is really no point in keeping them.
2022-09-16Shell: Fix 'Command:' output for built-in 'time' commandBen Wiederhake
2022-09-15LibWeb: Don't set initial font+color on both HTML and BODY elementsAndreas Kling
It's enough to set it on the HTML element. That way, it doesn't get reset in content that sets its own font on HTML but not on BODY.
2022-09-15LibWeb: Cache lowercased names in SimpleSelectorAndreas Kling
When matching selectors in HTML documents, we know that all the elements have lowercase local names already (the parser makes sure of this.) Style sheets still need to remember the original name strings, in case we want to match against non-HTML content like XML/SVG. To make the common HTML case faster, we now cache a lowercase version of the name with each type/class/id SimpleSelector. This makes tag type checks O(1) instead of O(n).
2022-09-15LibWeb: Hoist case sensitivity check out of loop in Element::has_class()Andreas Kling
2022-09-15LibWeb: Resolve cyclic declaration/definitions involving LengthBen Wiederhake
This remained undetected for a long time as HeaderCheck is disabled by default. This commit makes the following file compile again: // file: compile_me.cpp #include <LibWeb/CSS/GridTrackSize.h> // That's it, this was enough to cause a compilation error.
2022-09-15Calculator: Change internal representation to support perfect divisionLucas CHOLLET
The purpose of this patch is to support addition, subtraction, multiplication and division without using conversion to double. To this end, we use the BigFraction class of LibCrypto. With this solution, we can store values without any losses and forward rounding as the last step before displaying.
2022-09-15LibCrypto: Fix -0 and 0 non-equalityLucas CHOLLET
SignedBigInteger::operator==(const UnsignedBigInteger&) was rejecting all negative value before testing for equality. It now accepts negative zero and test for a value equality with the UnsignedBigInteger.
2022-09-15LibCrypto: Add BigFractionLucas CHOLLET
This new abstraction allows the user to store rational numbers with infinite precision.
2022-09-15LibCrypto: Add SignedBigInteger::negated_value()Lucas CHOLLET
Return the negated value of the current number.
2022-09-15LibWeb: Don't ignore data: URLs in @font-face srcAndreas Kling
Since data: URLs don't have a path, we shouldn't be checking for a TTF or WOFF extension. Thanks Timon for pointing this out! :^)
2022-09-15LibGfx: Cache vector fonts by family nameAndreas Kling
Instead of just keeping them in an unsorted Vector, which led to increasingly noticeable O(n) lookups, we now cache a list of Typefaces per family name.
2022-09-15LibCore: Rewrite Core::Stream::read_all_implsin-ack
The previous version relied on manually setting the amount of data to read for the next chunk and was overall unclear. The new version uses the Bytes API to vastly improve readability, and fixes a bug where reading from files where a single read that wasn't of equal size to the block size would cause the byte buffer to be incorrectly resized causing corrupted output.
2022-09-15LibCore: Add documentation to Stream functions + make parameter clearersin-ack
file_size was not very clear about what it was being used for, so I switched it to say expected_file_size to make it clear that it's just a heuristic.
2022-09-15LibWeb: Implement document.domain getterLuke Wilde
The document.domain setter is currently stubbed as that is a doozy to implement, given how much restrictions there are in place to try and prevent use of it and potential multi-process implications. This was the only thing preventing us from being able to start displaying ads delivered via Google Syndication.
2022-09-15LibJS: Do not invoke Cell::vm in constructors before Cell is constructedTimothy Flynn
In a subclass of Cell, we cannot use Cell::vm() before the base Cell object itself is constructed. Use the Realm's VM instead. This was caught by UBSAN with vptr sanitation enabled.
2022-09-15LibJS: Do not assume that IsArray means the object type is an ArrayTimothy Flynn
IsArray returns true if the object is an Array *or* if it is a ProxyObject whose target is an Array. Therefore, we cannot downcast to an Array based on IsArray. Luckily, we don't actually need an Array here; SerializeJSONArray only needs an Object. This was caught by UBSAN with vptr sanitation enabled.
2022-09-15LibJS: Use correct include + object class for Function{Object,Prototype}Timothy Flynn
Not causing any real issue, just noticed while debugging vptr sanitation errors.
2022-09-15LibWeb: Fix bogus condition when checking CSS font file extensionsAndreas Kling
Thanks Idan for pointing this out! :^)
2022-09-14LibWeb: Be slightly better at @font-face rules with multiple sourcesAndreas Kling
This patch improves @font-face loading when there are multiple src values in two ways: - Invalid/empty URLs are ignored - Fonts with unsupported file extensions are ignored This makes us load and display the emblem font on modern Reddit, which is pretty neat! :^)
2022-09-14LibWeb: Allow CSS at-rules to have an empty preludeAndreas Kling
I don't see any indication in the spec that an empty prelude should be disallowed. This fixes rules like `@font-face{...}` (note the absence of whitespace before the `{`.)
2022-09-14LibWeb: Invalidate layout whenever a CSS font is loadedAndreas Kling
It's not enough to invalidate only the style, we have to do a full layout invalidation since new fonts might mean new metrics, etc.
2022-09-14LibWeb: Schedule a layout update in Document::invalidate_layout()Andreas Kling
Otherwise, nothing will repaint until someone else decides to trigger an update.
2022-09-14LibWeb: Allow data: URLs with `font/` MIME type in @font-face CSS rulesAndreas Kling
2022-09-14LibWeb: Account for float's container offsets in BFC root auto heightAndreas Kling
When calculating the automatic height of a BFC root, we stretch it to contain the bottommost margin edge of floating boxes. Before this change, we assumed that floating boxes had coordinates relative to the BFC root, when they're actually relative to the floating box's containing block. This may or may not be the BFC root, so we have to use margin_box_in_ancestor_coordinate_space() to apply offsets from all boxes in the containing block chain (up to the BFC root).
2022-09-14LibSoftGPU: Return a `const&` texel in `Image` to prevent copyingJelle Raaijmakers
On every texel access, some floating point instructions involved in copying 4 floats popped up. Let `Image::texel() const` return a `FloatVector4 const&` to prevent these operations. This results in a ~7% FPS increase in GLQuake on my machine.
2022-09-14LibSoftGPU: Use `memcpy` instead of a loop to blit the color bufferJelle Raaijmakers
Looking at `Tubes` before and after this change, comparing the original loop to the one using `memcpy`, including the time for `memcpy` itself, resulted in ~15% fewer samples in profiles on my machine.
2022-09-14LibGfx: Use `memcpy` instead of `fast_u32_copy` for blittingJelle Raaijmakers
In some artificial full screen blitting profiling, I've seen `memcpy` take up about 4% fewer samples each time I measure. It seems like `fast_u32_copy` is not as fast as it'd like to believe.
2022-09-14LibWeb: Don't show pointer (hand) cursor over non-linked a elementsAndreas Kling
This is already handled by the :link and :visited style.
2022-09-14LibWeb: Account for containing block padding when placing abspos boxesAndreas Kling
Unlike the other positioning schemes, absolute positioning is relative to the *padding* edge of the containing block.
2022-09-14LibWeb: Replace most of our default UA stylesheet with spec rulesAndreas Kling
The HTML spec provides a set of suitable default CSS rules for our UA stylesheet, so let's use those instead of inventing our own. :^) Note that I had to replace "foo-block-start" properties with "foo-top" since we don't support the block/inline direction based properties yet.
2022-09-14LibWeb: Make :link selector behave according to specAndreas Kling
It should match any `a` or `area` element that has an `href` attribute, not any element *inside* an enclosing linked element.
2022-09-14LibWeb: Don't re-resolve "auto" flex item sizes after definitizing themAndreas Kling
This is rather subtle and points to our architecture around definite sizes not being exactly right, but... At some points during flexbox layout, the spec tells us that the sizes of certain flex items are considered definite from this point on. We implement this by marking each item's associated UsedValues as "has-definite-width/height". However, this breaks code that tries to resolve computed "auto" sizes by taking the corresponding size from the containing block. The end result was that the 1st sizing pass in flexbox would find the right size for an "auto" sized item, but the 2nd pass would override the correct size with the containing block's content size in that axis instead. To work around the issue, FFC now remembers when it "definitizes" an item, and future attempts to resolve an "auto" computed size for that value will bypass the computed-auto-is-resolved-against-containing-block step of the algorithm. It's not perfect, and we'll need to think more about how to really represent these intermediate states relating to box sizes being definite..
2022-09-14LibWeb: Use PercentageOr<T>::contains_percentage() in CSS layoutAndreas Kling
By asking if the value *contains* a percentage rather than whether it *is* one, we cover many more cases where e.g `width: calc(100% - 10px)` should be "treated as auto" etc.