summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb
AgeCommit message (Collapse)Author
2022-02-12LibWeb: Implement XMLHttpRequest.overrideMimeTypeLuke Wilde
This allows you to ignore the Content-Type returned by the server and always parse the content as if it's the given MIME type. This will currently be used for allowing you to override the charset of text responses.
2022-02-12LibWeb: Implement spec-compliant MIME type struct and parserLuke Wilde
This will be used by XHR to extract the Content-Type MIME type to retrieve the charset.
2022-02-12LibWeb: Add support for 'arraybuffer' message types on WebSocketsserenitydev
2022-02-12LibWeb: Ignore malformed at-rules in CSS parserGuilherme Gonçalves
Fixes #12405.
2022-02-11LibWeb: Rename Layout::Box absolute rect helpersAndreas Kling
- padded_rect() -> absolute_padding_box_rect() - bordered_rect() -> absolute_border_box_rect()
2022-02-11LibWeb: Remove unused functions from Layout::BoxAndreas Kling
2022-02-11LibWeb: Clear the path of a SVGPathElement if the attribute changesSam Atkins
Otherwise, modifying the `d` attribute would not cause any visual changes to the path.
2022-02-11LibWeb: Make SVG AttributeParser::parse_path_data() staticSam Atkins
This is mostly a style thing, but it matches the other APIs.
2022-02-11LibWeb: Use StringView instead of String in SVG::AttributeParserSam Atkins
This saves copying the string data, since the AttributeParser is always temporary.
2022-02-11LibWeb: Add SVG `<polygon>` element and test case :^)Sam Atkins
2022-02-11LibWeb: Add SVG `<polyline>` element and test case :^)Sam Atkins
2022-02-11LibWeb: Add SVG `<line>` element and test case :^)Sam Atkins
2022-02-11LibWeb: Add SVG `<ellipse>` element and test case :^)Sam Atkins
2022-02-11LibWeb: Add SVG `<circle>` element and test case :^)Sam Atkins
2022-02-11LibWeb: Add SVG `<rect>` element and test case :^)Sam Atkins
2022-02-11LibWeb: Expose SVG length/coordinate parsing methodsSam Atkins
This is all still quite ad-hoc. Eventually these will both need to support units (like with CSS Lengths) but for now we can continue only using numbers.
2022-02-11LibWeb: Move SVG::PathDataParser into its own file and rename itSam Atkins
I've chosen the name `AttributeParser` since it parses data from attributes. Rather than duplicate the parsing of numbers and other basic types, let's make use of this existing parsing code for parsing the data for `<line>`, `<polyline>`, etc.
2022-02-11LibWeb: Rename SVGPathBox -> SVGGeometryBoxSam Atkins
This fits better since it's now used by all SVGGeometryElements.
2022-02-11LibWeb: Move SVGPathElement methods into SVGGeometryElementSam Atkins
From the spec: > Interface SVGGeometryElement represents SVG elements whose rendering > is defined by geometry with an equivalent path, and which can be > filled and stroked. This includes paths and the basic shapes. - https://svgwg.org/svg2-draft/types.html#InterfaceSVGGeometryElement Making them all create an SVGPathBox, and return a Path from get_path(), means we can implement the "basic shapes" using the path system we already have. :^)
2022-02-11LibWeb: Add const versions of SVGBox::dom_node() and friendsSam Atkins
2022-02-11LibWeb: Remove CascadeOrigin::Any enum valueAndreas Kling
Looks like I removed all uses of this value, but not the value itself! Thanks to Idan for pointing that out. :^)
2022-02-11LibWeb: Remove unused CascadeOrigin::AnyAndreas Kling
This was an ad-hoc concept from before we implemented the CSS cascade.
2022-02-10LibWeb: Make :root selector match <html> element onlyAndreas Kling
We were matching every HTML element, instead of just the root (<html>)
2022-02-10LibWeb: Add "tag name" buckets to StyleComputer::RuleCacheAndreas Kling
We can skip rules that require a specific tag name when matching against any element with a different tag name. :^)
2022-02-10LibWeb: Add "ID" buckets to StyleComputer::RuleCacheAndreas Kling
We can skip rules that require a specific ID when matching against any element that doesn't have that ID.
2022-02-10LibWeb: Cache CSS rules in buckets to reduce number of rules checkedAndreas Kling
This patch introduces the StyleComputer::RuleCache, which divides all of our (author) CSS rules into buckets. Currently, there are two buckets: - Rules where a specific class must be present. - All other rules. This allows us to check a significantly smaller set of rules for each element, since we can skip over any rule that requires a class attribute not present on the element. This takes the typical numer of rules tested per element on Discord from ~16000 to ~550. :^) We can definitely improve the cache invalidation. It currently happens too often due to media queries. And we also need to make sure we invalidate when mutating style through CSSOM APIs.
2022-02-10LibWeb: Perform CSS custom property cascade once instead of per-propertyAndreas Kling
Previously we would re-run the entire CSS selector machinery for each property resolved. Instead of doing that, we now resolve a final set of custom property key/value pairs at the start of the cascade.
2022-02-10LibWeb: Fix a bunch of trivial clang-tidy warnings in StyleComputerAndreas Kling
- Replace "auto" with "auto const" where appropriate. - Remove an unused struct. - Make sort_matching_rules() a file-local static function. - Remove some unnecessary includes.
2022-02-10LibWeb: Rename a CascadeOrigin parameter in StyleComputerAndreas Kling
2022-02-09LibWeb: Paint box-shadows more efficientlySam Atkins
Our previous code roughly did this: 1. Generate a bitmap as large as the shadow would end up. 2. Paint a rectangle onto it. 3. Blur the whole bitmap. 4. Split it up and render each section. This patch takes advantage of the fact that (aside from corners) each horizontal or vertical strip of a box-shadow is identical to the others, to generate and blur a much smaller bitmap - only large enough for the four corners and 1px of central "side" in each direction. This greatly reduces the memory footprint, and should also speed things up, since there is much less to blur.
2022-02-09LibWeb: Add initial implementation for WorkerGlobalScopeAndrew Kaster
This initial implementation stubs out the WorkerGlobalScope, WorkerLocation and WorkerNavigator classes. It doesn't take into account all the things that actually need passed into the constructors for these objects, nor the extra abstract operations that need to be performed on them by the rest of the Browser infrastructure. However, it does create bindings that compile and link :^)
2022-02-09LibWeb: Do not set Content-Length headers twice for POST requestsBrian Gianforcaro
While trying to get http://lite.duckduckgo.com to work in the Browser I noticed that we kept on getting 400 (Bad Request) errors when you click the "Search" button for a request. After turning on `JOB_DEBUG` to see what headers we were sending it turned out that we were actually setting `Content-Length` twice once in LibWeb, and again when the request is handled by LibHTTP. Since LibHTTP transparently handles this now, we can avoid it in LibWeb.
2022-02-09LibWeb: Don't fill or stroke SVG <path> with transparent colorAndreas Kling
Before this, we were filling and stroking every <path>, whether they had a fill/stroke color or not. We can avoid a bunch of unnecessary work by checking if the color is transparent (also the case if unset) before doing the painting work. If there is no fill color, we also avoid making a copy of the path to ensure that it's closed.
2022-02-09LibJS: Replace uses of MarkedValueList with MarkedVector<Value>Linus Groh
This is effectively a drop-in replacement.
2022-02-08LibWeb: Implement EventHandler::focus_previous_element()Kenneth Myhra
This implements EventHandler::focus_previous_element() so we can cycle backwards through focusable elements on a web page with Shift+Tab.
2022-02-08Browser+LibWeb: Add "Dump Local Storage" item to Browser's Debug menuAndreas Kling
2022-02-08LibWeb: Add Storage interface and window.localStorageAndreas Kling
This is a naive-but-somewhat-functional initial implementation of HTML Storage. Note that there is no persistence yet, everything is in-process only, and one local Storage object per origin.
2022-02-08LibWeb: Allow using Origin as a HashMap keyAndreas Kling
2022-02-08LibWeb: Implement the JS host hooks for promises, job callbacks and moreLuke Wilde
This overrides the JS host hooks to follow the spec for queuing promises, making/calling job callbacks, unhandled promise rejection handling and FinalizationRegistry queuing. This also allows us to drop the on_call_stack_emptied hook in Document::interpreter().
2022-02-08LibWeb: Rewrite EventTarget to more closely match the specLuke Wilde
This isn't perfect (especially the global object situation in activate_event_handler), but I believe it's in a much more complete state now :^) This fixes the issue of crashing in prepare_for_ordinary_call with the `i < m_size` crash, as it now uses the IDL callback functions which requires the Environment Settings Object. The environment settings object for the callback is fetched at the time the callback is created, for example, WrapperGenerator gets the incumbent settings object for the callback at the time of wrapping. This allows us to remove passing in ScriptExecutionContext into EventTarget's constructor. With this, we can now drop ScriptExecutionContext.
2022-02-08LibWeb: Make FormAssociatedElement inherit from HTMLElementLuke Wilde
The new event target implementation requires us to downcast an EventTarget to a FormAssociatedElement to check if the current Element EventTarget has a form owner to setup a with scope for the form owner. This also makes all form associated elements inherit from FormAssociatedElement where it was previously missing. https://html.spec.whatwg.org/#form-associated-element
2022-02-08LibWeb: Introduce the Environment Settings ObjectLuke Wilde
The environment settings object is effectively the context a piece of script is running under, for example, it contains the origin, responsible document, realm, global object and event loop for the current context. This effectively replaces ScriptExecutionContext, but it cannot be removed in this commit as EventTarget still depends on it. https://html.spec.whatwg.org/multipage/webappapis.html#environment-settings-object
2022-02-08LibWeb: Support passing more parameter types to HTML::report_exception()Andreas Kling
We now allow any JS::ThrowCompletion<T>, as well as JS::Completion directly (although we'll VERIFY() that it's a throw completion.)
2022-02-08LibWeb: Fixed disabled checkbox input behaviourRafał Babiarz
Previously disabled checkbox could be checked by clicking on it's label
2022-02-08LibWeb: Incorporate spread-distance into box-shadow renderingSam Atkins
We also pass whether the shadow goes inside or outside the element. Only outer shadows are rendered currently, and inner ones may want to be handled separately from them, as they will never interfere with each other.
2022-02-08LibWeb: Render multiple box-shadowsSam Atkins
Because why not? :^)
2022-02-08LibWeb: Parse multiple box-shadows :^)Sam Atkins
Again, we don't yet render these (we render nothing) but this gets rid of a decent amount of CSS spam on Discord.
2022-02-08LibWeb: Parse spread-distance and `inset` parts of box-shadowSam Atkins
We do not actually use these when rendering the shadow yet.
2022-02-08LibWeb: Reorganize box-shadow parsing codeSam Atkins
The pattern we've adopted for other multi-value properties is to run in a loop like this, since that makes it easier to cater for values appearing in different orders.
2022-02-08LibJS+Everywhere: Remove all VM::clear_exception() callsdavidot
Since VM::exception() no longer exists this is now useless. All of these calls to clear_exception were just to clear the VM state after some (potentially) failed evaluation and did not use the exception itself.