summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML
AgeCommit message (Collapse)Author
2021-12-27LibWeb: Implement CanvasRenderingContext2D.isContextLost()Linus Groh
Note that we don't implement the "context lost steps" yet, so this will always return the initial value (false).
2021-12-27LibWeb: Implement CanvasRenderingContext2D.reset()Linus Groh
2021-12-27LibWeb: Implement CanvasRenderingContext2D.restore()Linus Groh
2021-12-27LibWeb: Implement CanvasRenderingContext2D.save()Linus Groh
2021-12-27LibWeb: Encapsulate canvas drawing state in a structLinus Groh
This will allow us to easily add copies of the relevant canvas drawing state to a stack, and likewise replace the current drawing state with an entry from that stack.
2021-12-27LibWeb: Let canvas {fill,stroke}Style default to black, not transparentLinus Groh
I don't know if the original author simply missed this or thought the default color of Gfx::Color is black, but this meant that drawing on a canvas without explicitly setting a fillStyle or strokeStyle first would be drawn in transparent color and therefore be invisible. In the spec this is indicated by a small comment in the IDL definition: attribute ... strokeStyle; // (default black) attribute ... fillStyle; // (default black) I'm starting to question whether Gfx::Color actually *should* have a default constructor.
2021-12-27LibWeb: Fix copy/paste typo in CanvasRenderingContext2D::stroke_style()Linus Groh
This returned the fill style, not the stroke style!
2021-12-21LibWeb: Fix null-deref in <table> delete_row with index = -1 and no rowsLuke Wilde
This wasn't quite following what the spec says for step 2: "If index is −1, then remove the last element in the rows collection from its parent, or do nothing if the rows collection is empty." It was behaving like: "If index is −1 and the rows collection is not empty, then remove the last element in the rows collection from its parent." Which is not the same, as it will fall into the "Otherwise" if `index == -1` and the rows collection is empty and try and get the -2nd element of the rows. Found with Domato.
2021-12-21LibWeb: Capture <script> element's node document on executionLuke Wilde
Step 1 of the spec is to capture the <script> element's node document into a local variable. When I originally implemented this, I thought this was not necessary. However, I realised that the script that runs can adopt the current script element into a different document, meaning step 5.4 and 6 then operate on the incorrect document. Covered by this WPT: https://github.com/web-platform-tests/wpt/blob/7b0ebaccc62b566a1965396e5be7bb2bc06f841f/html/semantics/scripting-1/the-script-element/moving-between-documents-during-evaluation.html
2021-12-10LibWeb: Fix off-by-one error when highlighting unquoted HTML attributesSam Atkins
This fixes #11166
2021-12-05LibWeb: Cast unused smart-pointer return values to voidSam Atkins
2021-12-04LibWeb: Stop sending "load" event twice to iframesAndreas Kling
The "completely finish loading" algorithm (from the HTML spec) is responsible for sending a "load" event to nested browsing context containers (iframes). This patch removes the old mechanism for sending "load" events, which we had mistakenly kept around, causing two events to be sent instead of one. :^)
2021-11-24LibWeb: Add JSON serialization for nested browsing contextsVyacheslav Pukhanov
This changes allows for nested browser contexts to be embedded in the serialized JSON of their container element (like `iframe`) and enables their inspection in the DOM Inspector.
2021-11-18LibWeb: Move BrowsingContext into HTML/Andreas Kling
Browsing contexts are defined by the HTML specification, so let's move them into the HTML directory. :^)
2021-11-18LibWeb: Make HTMLLinkElement responsible for its own loadingSam Atkins
This is the last use of CSSLoader, which can now be deleted.
2021-11-17LibWeb: Remove background_image from NodeWithStyleSam Atkins
We now entirely use the background-layers to check images.
2021-11-13LibWeb: Allow setting the width & height properties on <canvas> elementsAndreas Kling
2021-11-11Everywhere: Pass AK::StringView by valueAndreas Kling
2021-11-08LibGfx: Use ErrorOr<T> for Bitmap::try_create()Andreas Kling
Another one that was used in a fajillion places.
2021-11-08LibGfx: Use ErrorOr<T> for Bitmap::try_create_wrapper()Andreas Kling
2021-10-28LibWeb: Properly handle the <td align> attributeAndreas Kling
When valid, this attribute needs to result in an IdentifierStyleValue. Before this change we were turning it into a StringStyleValue, which then defaulted to left alignment for all values. For "center" and "middle", we turn it into -libweb-center. All other values are passed verbatim to the CSS parser.
2021-10-27LibWeb: Add fast_is<T>() for HTML::HTMLHtmlElementAndreas Kling
Another one spotted in a scroll-up-and-down profile.
2021-10-23LibWeb: Syntax-highlight CSS within HTML :^)Sam Atkins
2021-10-23LibWeb: Move image resource request out of ImageStyleValue constructorSam Atkins
This always felt awkward to me, and required a few other hacks to make it work. Now, the request is only started when `load_bitmap()` is called, which we do inside `NodeWithStyle::apply_style()`.
2021-10-18LibWeb: Update <object> style on resource load/failureAndreas Kling
2021-10-18LibWeb: Update <img> style on resource load/failureAndreas Kling
2021-10-17LibWeb: Implement Attribute closer to the spec and with an IDL fileTimothy Flynn
Note our Attribute class is what the spec refers to as just "Attr". The main differences between the existing implementation and the spec are just that the spec defines more fields. Attributes can contain namespace URIs and prefixes. However, note that these are not parsed in HTML documents unless the document content-type is XML. So for now, these are initialized to null. Web pages are able to set the namespace via JavaScript (setAttributeNS), so these fields may be filled in when the corresponding APIs are implemented. The main change to be aware of is that an attribute is a node. This has implications on how attributes are stored in the Element class. Nodes are non-copyable and non-movable because these constructors are deleted by the EventTarget base class. This means attributes cannot be stored in a Vector or HashMap as these containers assume copyability / movability. So for now, the Vector holding attributes is changed to hold RefPtrs to attributes instead. This might change when attribute storage is implemented according to the spec (by way of NamedNodeMap).
2021-10-15LibWeb: Use W3C urls for CSSOM spec linksSam Atkins
https://www.w3.org/TR/cssom/ is the more permanent home of the CSSOM specification's latest version, and is up to date with the draft spec. Also, https://drafts.csswg.org/ has been down multiple times recently which made looking things up a pain.
2021-10-12LibWeb: Add missing upcalls in HTMLSelectElementAndreas Kling
2021-10-12LibWeb: Add missing upcalls in HTMLInputElementAndreas Kling
We need to call the base class in overrides of inserted() and removed_from(), or things like style invalidation will break.
2021-10-11LibWeb: Implement PromiseRejectionEventLinus Groh
This paves the way for the rejectionhandled and unhandledrejection events. It's also used by core-js (in browsers, at least) to check whether Promise needs to be polyfilled, so adding it should allow more websites to leverage LibJS's native Promise implementation :^)
2021-10-10LibWeb: Remove dead "outer loop" code in adoption agency algorithmBrian Gianforcaro
2021-10-06LibWeb: Rename Layout::BlockBox => BlockContainerAndreas Kling
There's a subtle difference here. A "block box" in the spec is a block-level box, while a "block container" is a box whose children are either all inline-level boxes in an IFC, or all block-level boxes participating in a BFC. Notably, an "inline-block" box is a "block container" but not a "block box" since it is itself inline-level.
2021-10-06LibWeb: Start work towards modern CSS "display" valuesAndreas Kling
Until now, we've internally thought of the CSS "display" property as a single-value property. In practice, "display" is a much more complex property that comes in a number of configurations. The most interesting one is the two-part format that describes the outside and inside behavior of a box. Switching our own internal representation towards this model will allow for much cleaner abstractions around layout and the various formatting contexts. Note that we don't *parse* two-part "display" yet, this is only about changing the internal representation of the property. Spec: https://drafts.csswg.org/css-display
2021-10-06LibWeb: Make CSS layout lazierAndreas Kling
Instead of doing layout synchronously whenever something changes, we now use a basic event loop timer to defer and coalesce relayouts. If you did something that requires a relayout of the page, make sure to call Document::set_needs_layout() and it will get coalesced with all the other layout updates. There's lots of room for improvement here, but this already makes many web pages significantly snappier. :^) Also, note that this exposes a number of layout bugs where we have been relying on multiple relayouts to calculate the correct dimensions for things. Now that we only do a single layout in many cases, these kind of problems are much more noticeable. That should also make them easier to figure out and fix. :^)
2021-10-05LibWeb: Fire MediaQueryListEvents when an MQL's match-state changesSam Atkins
The HTML event loop does a check for MQL match-state changes and dispatches the events. This requires us to keep a list of MQLs on the Document.
2021-10-03LibWeb: Run clang-format on HTMLAreaElement.cppLinus Groh
2021-10-03LibWeb: Implement the HTMLHyperlinkElementUtils mixinAndreas Kling
This is used by HTMLAnchorElement and HTMLAreaElement to share functionality related to their href attribute.
2021-10-03LibWeb: Only auto-reschedule HTML::EventLoop when there are runnablesAndreas Kling
HTML::EventLoop tries to reschedule itself when there are more tasks in any of its queues, but let's not do it if none of them are runnable.
2021-10-03LibWeb: Don't update rendering in BrowsingContexts without opportunityAndreas Kling
This patch adds the "has a rendering opportunity" concept from the spec to BrowsingContext and uses it to filter out contexts that are unable to render right now when doing the event loop's rendering updates. Note that we actually consider all contexts to have a rendering opportunity at all times right now. Coming up with reasons to avoid rendering is left as a FIXME. :^)
2021-10-03LibWeb: Let HTML::EventLoop drive the firing of `resize` eventsAndreas Kling
2021-10-03LibWeb: Let HTML::EventLoop drive animation frame callbacksAndreas Kling
2021-10-03LibWeb: Let HTML::EventLoop keep track of live DOM::Document objectsAndreas Kling
This will be used by the event loop processing model.
2021-10-03LibWeb: Only take runnable tasks from the HTML task queueAndreas Kling
We were previously willing to execute tasks before they had become runnable.
2021-10-03LibWeb: Improve HTML::EventLoop::spin_until()Andreas Kling
This algorithm now saved and restores the JavaScript execution context stack while performing a microtask checkpoint, as the spec mandates.
2021-10-03LibWeb: Run setTimeout() and setInterval() callbacks as HTML tasksAndreas Kling
We now invoke DOM timer callbacks via HTML tasks. This brings callback sequencing closer to the spec, although there are still many imperfections in this area.
2021-10-01LibWeb: Add the missing PageTransitionEvent IDL constructorIdan Horowitz
2021-10-01LibWeb: Add the missing SubmitEvent IDL constructorIdan Horowitz
This commit also removes the SubmitEvent.cpp file, as all of the method implementations were trivial and could be inlined into the header file.
2021-10-01LibWeb: Add the missing MessageEvent IDL constructorIdan Horowitz
2021-10-01LibWeb: Add the lastEventId IDL attribute to MessageEventIdan Horowitz