summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb
AgeCommit message (Collapse)Author
2022-03-21LibWeb: Implement Range.surroundContents(newParent)Andreas Kling
Here goes another Acid3 point :^)
2022-03-21LibWeb: Translate table cells by their top left borderKarol Kosek
2022-03-21LibWeb: Include table cell border widths when calculating cell rectsKarol Kosek
Previously, table cells would overlap when they had CSS border or padding properties defined.
2022-03-21LibWeb: Fix two spec transcription mistakes in live range updatingAndreas Kling
This scores us another point on Acid3. :^)
2022-03-21LibWeb: Begin implementing SVGRectElement's SVGAnimatedLength attributesTimothy Flynn
2022-03-21LibWeb: Implement the SVGAnimatedLength typeTimothy Flynn
2022-03-21LibWeb: Begin implementing the SVGLength typeTimothy Flynn
There are a few unimplemented features for this type: 1. The value setter should throw a DOMException if it is invoked on an SVGLength that was declared readonly in another IDL file. 2. SVG::AttributeParser does not parse unit types when it parses lengths so all SVGLength will have an "unknown" unit for now. 3. Due to (2), methods which convert between units are unimplemented.
2022-03-21LibWeb: Fix spec transcription mistake in Range.extractContents()Andreas Kling
The spec text and code didn't match up. Thanks to Tim for spotting this! :^)
2022-03-21LibWeb: Don't allow setting Range start/end to document being destroyedAndreas Kling
2022-03-21LibWeb: Update live ranges on Node insertion and removalAndreas Kling
Taking care of some old FIXMEs :^)
2022-03-21LibWeb: Update live DOM ranges on Text and CharacterData mutationsAndreas Kling
Taking care of the FIXMEs I added in earlier patches. :^)
2022-03-21LibWeb: Implement Range.insertNode(node)Andreas Kling
2022-03-21LibWeb: Implement Text.splitText(offset)Andreas Kling
With FIXMEs about updating live ranges, but still.
2022-03-21LibWeb: Fix logic mistakes in Range stringificationAndreas Kling
We were passing the wrong length argument to substring() when stringifying a range where start and end are the same text node. Also, make sure we visit all the contained text nodes when appending them to the output. This was caught by an Acid3 subtest.
2022-03-21LibWeb: Implement Range.extractContents()Andreas Kling
Another point on Acid3 coming through! :^)
2022-03-21LibWeb: Add CharacterData.replaceData(offset, count, data)Andreas Kling
Note that we don't queue mutation records or update live ranges yet, I've left those as FIXMEs.
2022-03-21LibWeb: Add CharacterData.substringData(offset, count)Andreas Kling
2022-03-21LibWeb: Implement stringifier for DOM Range :^)Andreas Kling
2022-03-21LibWeb: Implement HTMLTableRowElement.{rowIndex,sectionRowIndex}Andreas Kling
Another point on Acid3. :^)
2022-03-21LibWeb: Make parse_html_length() accept floating point numbersAndreas Kling
This makes stuff like <img width="12.5"> work. This code is not great, so I've left a FIXME about improving it.
2022-03-21LibWeb: Ignore invisible boxes and stacking contexts during hit testingAndreas Kling
2022-03-21LibWeb: Pick up the CSS "visibility" property an honor it when paintingAndreas Kling
2022-03-21LibWeb: Remove now-unused PaintableBox::for_each_child_in_paint_order()Andreas Kling
2022-03-21LibWeb: Don't compute fragment absolute rect twice while hit testingAndreas Kling
2022-03-21LibWeb: Fix O(n^2) traversal in hit testingAndreas Kling
We already walk the entire paint tree within each stacking context in the main hit testing function (StackingContext::hit_test()), so there's no need for each individual paintable to walk its own children again. By not doing that, we remove a source of O(n^2) traversal which made hit testing on deeply nested web pages unbearably slow.
2022-03-21LibWeb: Add Paintable::dom_node() convenience accessorAndreas Kling
2022-03-21LibWeb: Add Painting::HitTestResult::dom_node()Andreas Kling
This is a convenience accessor to avoid having to say this everywhere: result.paintable->layout_node().dom_node() Instead, you can now do: result.dom_node()
2022-03-21LibWeb: Make hit testing functions return Optional<HitTestResult>Andreas Kling
Using "HitTestResult with null paintable" as a way to signal misses was unnecessarily confusing. Let's use Optional instead. :^)
2022-03-21LibWeb: Only invalidate stacking context tree for opacity/z-index changeAndreas Kling
I came across some websites that change an elements CSS "opacity" in their :hover selectors. That caused us to relayout on hover, which we'd like to avoid. With this patch, we now check if a property only affects the stacking context tree, and if nothing layout-affecting has changed, we only invalidate the stacking context tree, causing it to be rebuilt on next paint or hit test. This makes :hover { opacity: ... } rules much faster. :^)
2022-03-21LibWeb: Build stacking context tree lazilyAndreas Kling
There's no actual need to build the stacking context tree before performing layout. Instead, make it lazy and build the tree when it's actually needed for something. This avoids a bunch of work in situations where multiple synchronous layouts are forced (typically by JavaScript) without painting or hit testing taking place in between. It also opens up for style invalidations that only target the stacking context tree.
2022-03-21LibWeb: Fix constness of return type from StyleRule::block()Hendiadyoin1
We want to return a view to a constant object, not a constant view, which we can implicitly copy to get a mutable reference to the object. Clang-Tidy helpfully pointed this out.
2022-03-21LibWeb: Use llround in CSS::Token::to_closest_integerHendiadyoin1
This should be equivalent, and much shorter than a clamp and static_cast
2022-03-21LibWeb: Pull out larger parsing parts from Parser::parse_simple_selectorHendiadyoin1
This lowers its cognitive complexity from 271 to under 100. The new `parse_pseudo_simple_selector` still has a complexity of 114.
2022-03-21LibWeb: Use a switch-statement on the delimiter for MatchType selectionHendiadyoin1
... in Parser::parse_simple_selector
2022-03-21LibWeb: Condense Delim checks in Parser::parse_simple_selectorHendiadyoin1
This also removes some else-after-returns and adds some const qualifiers
2022-03-21LibWeb: Add StyleComponentValueRule::is_token() helperHendiadyoin1
2022-03-21LibWeb: Use a u32 for a delim tokens valueHendiadyoin1
The spec says: > <delim-token> has a value composed of a single code point. So using StringView is a bit overkill. This also allows us to use switch statements in the future.
2022-03-21LibWeb: Don't copy Tokens twice on StyleBlockRule initializationHendiadyoin1
2022-03-21LibWeb: Move passed string in MimeType constructorHendiadyoin1
This was pointed out by Clang-Tidy and should avoid an allocation.
2022-03-21LibTextCodec: Don't allocate Strings on encoding normalisationHendiadyoin1
This ripples down to LibWeb's HTML and XHR decoders, which therefore become less allocation heavy.
2022-03-21LibWeb: Implement "has element in select scope" per-specSimon Wanner
The HTML Specification is quite tricky in this case. Usually "have a particular element in <x> scope" mentions "consisting of the following element types:", but in this case it's "consisting of all element types except the following:" Thanks to @AtkinsSJ for spotting this difference
2022-03-21LibWeb: Ignore invalid encodings in Content-Type headersSimon Wanner
2022-03-20LibWeb: Tweak our User-Agent stringAndreas Kling
- Switch from "Mozilla/4.0" to "Mozilla/5.0" to match other browsers. - Remove references to KHTML and Gecko. - Identify ourselves as "LibWeb+LibJS/1.0 Browser/1.0" New UA: "Mozilla/5.0 (SerenityOS; x86_64) LibWeb+LibJS/1.0 Browser/1.0"
2022-03-20LibWeb: Avoid some layouts in getComputedStyle() property getterAndreas Kling
For CSS properties that are known to not affect layout, we can avoid doing a layout before returning their current resolved value. It should be enough to only update style for the target element here, but we don't currently have a mechanism for that.
2022-03-20LibWeb: Grey out invisible nodes in the DOM inspectorSimon Wanner
This makes it easier to navigate large DOM trees where some nodes have display: none
2022-03-20LibWeb: Always call Layout::Box::did_set_rect()Andreas Kling
Since paintables have a default content size of 0x0, we were neglecting to notify the corresponding layout node about size changes, if the used content size came out to 0x0. This fixes an issue where resizing an iframe to 0x0 didn't take effect.
2022-03-20LibWeb: Layout browsing context parent before its childrenAndreas Kling
When updating layout inside a nested browsing context, try first to perform layout in the parent document (the nested browsing context's container's document). This ensures that nested browsing contexts have the right viewport dimensions in case the parent layout changes them somehow.
2022-03-20LibWeb: Don't crash in BrowsingContextContainer::content_document()Andreas Kling
Instead of choking on the VERIFY(document), let's just return null if there's no active document for now. This is incorrect, but sidesteps a frequent crash that happens on content with iframes. I've left a FIXME about removing the hack once it's no longer needed.
2022-03-20LibWeb: Always defer callbacks in ResourceClient::set_resource()Andreas Kling
Previously, we'd invoke the load/fail callbacks synchronously for resources that were already loaded and cached. This patch uses deferred_invoke() in the already-loaded case to ensure that we always invoke these callbacks in a consistent manner. This isn't to fix a specific issue, but rather because I kept seeing these callbacks being invoked synchronously on top of an already-tall call stack, and it was hard to reason about what was going on.
2022-03-20LibWeb: Implement the :focus-within selectorSam Atkins
This matches if it has focus, or any nodes inside it do.