summaryrefslogtreecommitdiff
path: root/Userland
AgeCommit message (Collapse)Author
2022-07-12Everywhere: Split Error::from_string_literal and Error::from_string_viewsin-ack
Error::from_string_literal now takes direct char const*s, while Error::from_string_view does what Error::from_string_literal used to do: taking StringViews. This change will remove the need to insert `sv` after error strings when returning string literal errors once StringView(char const*) is removed. No functional changes.
2022-07-12Everywhere: Explicitly specify the size in StringView constructorssin-ack
This commit moves the length calculations out to be directly on the StringView users. This is an important step towards the goal of removing StringView(char const*), as it moves the responsibility of calculating the size of the string to the user of the StringView (which will prevent naive uses causing OOB access).
2022-07-12LibC: Convert getopt and getopt_long to new StringView usagesin-ack
2022-07-12LibCore: Add convenience templates for System::{unveil,pledge}sin-ack
These convenience templates allow the following to be written as before: TRY(Core::System::pledge("promises...")); TRY(Core::System::pledge("promises...", "execpromises...")); TRY(Core::System::unveil("path", "permissions")); TRY(Core::System::unveil(nullptr, nullptr)); Other uses must now append sv to any literal string passed to pledge and unveil.
2022-07-12LibX86: Convert register names to StringViewssin-ack
2022-07-12Userland: Remove erroneous String -> char* -> StringView conversionssin-ack
These were accidental (or leftover) uses of String::characters() to construct StringViews through its StringView(char const*) constructor. Since this constructor is due to be removed, this will no longer work. Plus this prevents strlen from being run on these strings unnecessarily.
2022-07-12Userland: Convert command line arguments to String/StringViewsin-ack
StringView was used where possible. Some utilities still use libc functions which expect null-terminated strings, so String objects were used there instead.
2022-07-12LibJS: Emit StringViews for ErrorType instancessin-ack
This removes the need for calculating each string's length during ErrorType use at the cost of storing it within the binary.
2022-07-12LibChess: Add convenience constructor for Chess::Squaresin-ack
It didn't feel right to add sv suffixes to 2-character strings, so I added this convenience constructor.
2022-07-12Meta+Userland: Simplify some formatterssin-ack
These are mostly minor mistakes I've encountered while working on the removal of StringView(char const*). The usage of builder.put_string over Format<FormatString>::format is preferrable as it will avoid the indirection altogether when there's no formatting to be done. Similarly, there is no need to do format(builder, "{}", number) when builder.put_u64(number) works equally well. Additionally a few Strings where only constant strings were used are replaced with StringViews.
2022-07-12AK: Explicitly calculate length of char* when printingsin-ack
This moves out the calculation of the char* out to the formatter. Additionally, we now print (null) when a null pointer is passed.
2022-07-12LibWeb: Add missing break to avoid fallthrough in FlexFormattingContextIdan Horowitz
This silences a Clang warning.
2022-07-12LibWeb: Remove unused variable in FlexFormattingContextIdan Horowitz
2022-07-12LibWeb: Express flex item cross axis alignment as offsets-from-centerAndreas Kling
This allows us to perform cross axis alignment without knowing the final cross size of the flex container.
2022-07-12LibWeb: Actually clamp flex line cross size to min/max-sizeAndreas Kling
We were dropping the result of css_clamp() on the floor, oops! Let's also mark it [[nodiscard]] so it won't happen again.
2022-07-12LibWeb: Don't crash when failing to create WebGL context on non-SerenityAndreas Kling
This makes Ladybird stop panicking on websites that try to use WebGL.
2022-07-12DevTools/HackStudio: Fix 'enabled' property of 'build' and 'run' buttonsferhatgec
2022-07-12DevTools/HackStudio: Add verify_make_is_installed()ferhatgec
2022-07-12LibWeb: Set up both containing block sizes before intrinsic sizingAndreas Kling
When calculating e.g the min-content height of some box, we would only set its containing block's height to 0 in the temporary formatting state. The containing block width was not touched at all. This patch aims to do a bit better by resolving indefinite containing block sizes to INFINITY before performing intrinsic sizing. We should probably also find a way to resolve definite containing block sizes, but I'll leave that for our future selves.
2022-07-12LibWeb: Floor scaled flex shrink factor at 1 when spec asks us toAndreas Kling
2022-07-12LibWeb: Take margin box into account when justifying flex itemsAndreas Kling
Before this patch, we were justifying based on the content box only, which led to misalignments along the main axis when items had non-zero padding, borders or margins.
2022-07-12LibWeb: Add safety mechanism to guard against non-finite layout sizesAndreas Kling
Due to some yet-to-be-found bug(s) in intrinsic sizing, we can sometimes end up deciding that some box has a non-finite intrinsic size. This will create unpleasant results, and may lead to some layout algorithms looping infinitely, so this patch adds a safeguard where we simply turn non-finite intrinsic sizes into zero (and complain a little bit in the debug log.)
2022-07-12LibWeb: Honor `align-self` over `align-items` when non-auto on flex itemAndreas Kling
2022-07-12LibJS: Add test case for %TypedArray%.prototype.toSplicedObinna Ikeh
2022-07-12LibJS: Add %TypedArray%.prototype.toSplicedObinna Ikeh
2022-07-12LibJS: Implement Intl.PluralRules.prototype.selectRangeTimothy Flynn
2022-07-12LibUnicode: Parse and generate per-locale plural rangesTimothy Flynn
2022-07-11LibWeb: Implement all "attributes" mutation records for MutationObserverLuke Wilde
2022-07-11LibWeb: Implement "characterData" mutation record for MutationObserverLuke Wilde
2022-07-11LibWeb: Implement all "childList" mutation records for MutationObserverLuke Wilde
2022-07-11LibWeb: Introduce Mutation{Record,Observer} and observer microtasksLuke Wilde
2022-07-11LibWeb: Wrap DOM::Attribute in NodeWrapperFactoryLuke Wilde
2022-07-11LibWeb: Implement CharacterData.{append,insert,delete}DataLuke Wilde
2022-07-11LibWeb: Implement CharacterData::set_data in terms of replace_dataLuke Wilde
This makes it so that it always queues a mutation record, even if `data` is set to the same value. It also makes it follow the spec steps.
2022-07-11LibWeb: Allow creating a StaticNodeList without an r-value VectorLuke Wilde
It must accept taking a copy for DocumentFragment mutation records and empty vectors created in-place.
2022-07-11LibWeb: Honor preferred size as intrinsic cross size of flex itemsAndreas Kling
I'm not 100% sure this is on-spec, but it seems to me that flex items that have a specified non-auto cross size should honor that value in its min-content and max-contribution.
2022-07-11LibWeb: Implement step 9.2.3 of the flexbox layout algorithmAndreas Kling
When sizing the flex container under a min-content or a max-content constraint, flex items with a used flex basis of "content" should be sized under the same constraint.
2022-07-11LibWeb: Stop putting the FormattingState nodes in a slow hash mapAndreas Kling
Instead, put them in a Vector<OwnPtr<NodeState>>. Each layout node has a unique index into the vector. It's a simple serial ID assigned during layout tree construction. Every new layout restarts the sequence at 0 for the next ICB. This is a huge layout speed improvement on all content.
2022-07-11LibWeb: Tweak padding on button elements match other enginesAndreas Kling
2022-07-11LibWeb: Bring sizing of replaced elements closer to specAndreas Kling
We were prematurely resolving the computed size values, which meant that `auto` values were swallowed before we could resolve them via the intrinsic aspect ratio (if present)
2022-07-11LibWeb: Match WebKit and Blink re: absence of width/height on <svg>Andreas Kling
2022-07-11LibWeb: Try to work out the intrinsic size of <svg> elementsAndreas Kling
If the `width` and `height` attributes are provided, we derive the intrinsic size and ratio from them. Otherwise, we trace a rectangle around the geometry elements inside the SVG and use the size of that as the intrinsic size. This is definitely far from correct, but is still a much better guess at the intrinsic size than nothing.
2022-07-11LibWeb: Set 1:1 intrinsic aspect ratio for radio buttonsAndreas Kling
2022-07-11LibWeb: Cache reference to <svg> element in SVGFormattingContextAndreas Kling
2022-07-11LibWeb: Use the *outer* flex base size in intrinsic size calculationAndreas Kling
2022-07-11LibWeb: Use the "scaled flex shrink factor" where noted by the specAndreas Kling
2022-07-11LibWeb: Treat "flex-basis: 0px" like any other definite basis valueAndreas Kling
2022-07-11LibWeb: More specialization of intrinsic sizing layoutAndreas Kling
This patch adds a separate entry point for this kind of layout. We override it in BFC to set up initial width/height values for the BFC root block. Resulting dimensions are assigned as content_width and content_height at the end of intrinsic sizing, for each axis, if it's either "auto" or there's a min-content or max-content constraint in effect.
2022-07-11LibWeb: Don't iterate over text content inside replaced elementsAndreas Kling
This fixes an issue where whitespace inside embedded <svg> elements would create unexpected whitespace text content on the page. When combined with something like `white-space: pre-wrap`, it ended up generating a lot of surprising vertical offsets.
2022-07-11LibWeb: Use max-content main size for flex items w/ definite cross sizeAndreas Kling
If the main size is indefinite, that is.