summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb
AgeCommit message (Collapse)Author
2022-03-31LibWeb: Flex fix minimum main size in min/max violations calculationEnver Balalic
While calculating the minimum size for main min/max size violations we were flooring the min size to 0 if the item doesn't have a min main size. Instead of that determine the intrinsic min main size of that element. This fixes the flex: 80% 0 4/1/0 test case in the flex.html test page. This case was missed in a previous commit that added the determine_min_main_size_of_child function
2022-03-31LibWeb: Add 'is scripting enabled' concept to EnvironmentSettingsObjectLinus Groh
This is now the source of truth for 'user enabled/disabled scripting', but it has to ask the window's page, which actually stores the setting. Also use this new functionality in two places where it was previously marked as a FIXME.
2022-03-31LibWeb: Remove Document::is_scripting_enabled() and use Node'sLinus Groh
There's no need to have a custom is_scripting_enabled() for the Document class, as it (indirectly) inherits from Node. Also, let's not hardcode false here :^)
2022-03-31LibWeb: Add the HTMLOrSVGElement IDL interface mixinIdan Horowitz
2022-03-31LibWeb: Use a callback function in ResizeObserver IDLIdan Horowitz
2022-03-31LibWeb: Use a callback function in IntersectionObserver IDLIdan Horowitz
2022-03-31LibWeb: Replace ad-hoc EventHandler type with callback function typedefIdan Horowitz
2022-03-30LibWeb: Consolidate mouse handling + only trigger event on left clicksin-ack
This commit moves a couple more special cases in mouse event handling to handle_mouseup. Additionally, it gets rid of the special casing with should_dispatch_event and only fires a click event to the EventTarget when the left mouse button is clicked. Finally it restores the link context menu callback that was lost during 0fc8c65.
2022-03-30LibWeb: Fix sizing of flex child that has flex-basis 0Enver Balalic
Before if an element didn't have a main min size we would clamp it to a literal zero. If that element also had a flex-basis 0 it's width would end up being 0. This patch adds a determine_min_main_size_of_child function that will calculate the minimum main size for the box based on the content of the box. We use the result of that function now instead of clamping the element main min size to 0. This also adds one more box to the flex.html test page, which is the same flex: 0 0 0 box but with flex-direction: column.
2022-03-30LibWeb: Fix calculating the intrinsic height of a boxEnver Balalic
For computing height in FormattingContext::calculate_intrinsic_sizes we were calling into BlockFormattingContext::compute_theoretical_height which will check if the CSS height property was defined and calculate the height based on that instead of calculating the intrinsic height This patch adds a new function calculate_intrinsic_height, which will call into compute_auto_height_for_block_level_element for a block element, or into compute_height_for_replaced_element for a replaced element.
2022-03-30LibWeb: Add Crypto.randomUUID()stelar7
2022-03-30LibWeb: Remove redundant `[[nodiscard]]` from CSS Parser methodsSam Atkins
Optional and smart-pointers are already `[[nodiscard]]` so functions returning them do not need to be declared as such.
2022-03-30LibWeb: Implement and use `parse_a_style_blocks_contents()`Sam Atkins
2022-03-30LibWeb: Tidy up StyleRule APISam Atkins
Constantly accessing private `m_foo` fields feels uncomfortable and doesn't fit well with our code style.
2022-03-30LibWeb: Spec-comment `consume_a_function()`Sam Atkins
2022-03-30LibWeb: Spec-comment `consume_a_simple_block()`Sam Atkins
2022-03-30LibWeb: Comment discrepancy from spec in `consume_a_declaration()`Sam Atkins
We're calling this in a way that is incorrect, and so the algorithm's assumption that the next token is an `<ident-token>` is wrong, and we have to handle that failing. Ideally we would just stop calling this incorrectly, but until then, let's actually document what is happening.
2022-03-30LibWeb: Spec-comment `consume_a_component_value()`Sam Atkins
2022-03-30LIbWeb: Spec-comment `consume_a_list_of_declarations()`Sam Atkins
2022-03-30LibWeb: Spec-comment `consume_a_qualified_rule()`Sam Atkins
2022-03-30LibWeb: Spec-comment `consume_an_at_rule()`Sam Atkins
2022-03-30LibWeb: Spec-comment `consume_a_list_of_rules()`Sam Atkins
2022-03-30LibWeb: Spec-comment `parse_a_comma_separated_list_of_component_values`Sam Atkins
The code had to change a bit to match. Previously, we appended an empty sub-list immediately, but now we append it at the end. The difference is that if there are no tokens, we now correctly return an empty list-of-lists, instead of a list containing an empty list.
2022-03-30LibWeb: Spec-comment `parse_a_list_of_component_values()`Sam Atkins
2022-03-30LibWeb: Spec-comment `parse_a_component_value()`Sam Atkins
2022-03-30LibWeb: Spec-comment `parse_a_list_of_declarations()`Sam Atkins
The `parse_as_list_of_declarations()` public method is unused and will not be used by any user code so has been removed.
2022-03-30LibWeb: Bring `parse_a_declaration()` to spec and add commentsSam Atkins
User code now calls `parse_as_supports_condition()` which actually does the conversion to a StyleProperty.
2022-03-30LibWeb: Spec-comment `parse_a_rule()`Sam Atkins
We now correctly call convert_to_rule() outside of this function. As before, I've renamed `parse_as_rule()` -> `parse_as_css_rule()` to match the free function that calls it.
2022-03-30LibWeb: Use parse_a_list_of_rules() for `@media` and `@supports`Sam Atkins
From the spec: > "Parse a list of rules" is intended for the content of at-rules such > as @media. It differs from "Parse a stylesheet" in the handling of > <CDO-token> and <CDC-token>. - https://www.w3.org/TR/css-syntax-3/#ref-for-parse-a-list-of-rules
2022-03-30LibWeb: Bring `parse_a_list_of_rules()` to specSam Atkins
This is not actually used by anything currently, but it should be used for `@media` and other at-rules. Removed the public parse_as_list_of_rules() because public functions should be things that outside classes actually need to use.
2022-03-30LibWeb: Implement and use "parse a CSS stylesheet" algorithmSam Atkins
`parse_a_stylesheet()` should not do any conversion on its rules. This change corrects that. There are other places where we get this wrong, but one thing at a time. :^)
2022-03-30LibWeb: Use an enum class for the "top-level flag"Sam Atkins
2022-03-30LibWeb: Spec-comment `parse_a_stylesheet()`Sam Atkins
Also introduce a `location` parameter when parsing a CSSStyleSheet. This is not provided by anyone yet.
2022-03-30LibWeb: Rename `parse_css()` -> `parse_css_stylesheet()`Sam Atkins
2022-03-30LibWeb: Implement Element.toggleAttribute()Elisée Maurer
2022-03-30LibWeb: Make WebSocket::close() arguments optional to match IDLIdan Horowitz
2022-03-30LibWeb: Add basic support for the attr() CSS functionSimon Wanner
CSS Values and Units Module Level 5 defines attr as: `attr(<q-name> <attr-type>?, <declaration-value>?)` This implementation does not contain support for the type argument, effectively supporting `attr(<q-name>, <declaration-value>?)`
2022-03-30LibWeb: Use more precise font metrics when doing inline layoutAndreas Kling
We now position inline-level boxes based on ascent and descent metrics from the font in use. This makes our basic text layouts look a lot more like those produced by other browsers. :^) I've tried to match the terminology used by the CSS Inline Layout spec. This will regress Acid2 a little bit, and probably various other sites, but on the whole it's the direction we should be heading, so let's go.
2022-03-30LibWeb: Draw inspector overlay label with default fontAndreas Kling
2022-03-30LibWeb: Only set children-are-not-inline when inserting in-flow childAndreas Kling
We were marking block boxes as having non-inline children when inserting any child box, even if the child was out-of-flow.
2022-03-30LibWeb: Use the new Gfx::Painter::draw_text_run() API for drawing textAndreas Kling
This avoids a bunch of unnecessary work in Painter which not only took time, but sometimes also led to alignment issues. draw_text_run() will draw the text where we tell it, and that's it.
2022-03-30LibWeb: Use font-derived metrics for "line-height:normal"Andreas Kling
Instead of multiplying the font-size with 1.4f because reasons, we now ask the font for its preferred line spacing.
2022-03-30LibGfx: Rename FontMetrics => FontPixelMetricsAndreas Kling
Let's make it clear in the type name that this contains pixel metrics. Also rename Font::metrics() => Font::pixel_metrics().
2022-03-30LibGfx: Make Gfx::FontMetrics include the advance of '0' instead of 'M'Andreas Kling
CSS actually wants the advance of the ASCII '0' character for its "ch" units, so let's include that instead of the arbitrarily chosen 'M'.
2022-03-30LibGfx: Remove code point parameter from Gfx::Font::MetricsAndreas Kling
Everyone was asking for the glyph width of 'M' anyway. We can just make that request implicit and simplify the API.
2022-03-30LibWeb: Add fast_is<T>() for some common DOM Node subclassesAndreas Kling
2022-03-29LibWeb: Ignore empty anonymous block children in height:auto calculationAndreas Kling
This fixes a regression on GitHub from 5da7ebb806cd3be5b126ec22bfda926c7319e4f7. Thanks to Simon for reporting it! :^)
2022-03-29LibWeb: Ignore list-item marker boxes in height:auto calculationAndreas Kling
2022-03-29LibWeb: Make height:auto for non-BFC-root blocks more correctAndreas Kling
Unlike BFC root blocks with height:auto, when the block *isn't* a BFC root, we don't have to look for the "bottommost" block-level child and determine the width from that. Instead, we should just look at the last in-flow block-level child. This was already indicated in the spec comment next to the code, but the code itself was wrong. This makes the body element on Acid3 have the correct height. It also introduces a small regression on Acid2 that we'll have to track down.
2022-03-29LibWeb: Don't round numbers too early when painting backgroundsAndreas Kling
Preserve floating point precision and delay rounding until the last moment when figuring out where to paint background layers. This fixes an issue on Acid3 where a thin sliver of red was visible because the background X position was incorrectly rounded by 1px.