summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp
AgeCommit message (Collapse)Author
2022-03-24LibWeb: Add missing spec comment in focusing logicNukiloco
2022-03-17Libraries: Use default constructors/destructors in LibWebLenny Maiorani
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules "The compiler is more likely to get the default semantics right and you cannot implement these functions better than the compiler."
2022-03-16LibWeb: Fire a UIEvents::MouseEvent for HTMLElement.click()sin-ack
This still is not perfectly correct but it's enough to trigger the activation behavior of elements and gain us a point on Acid3. :^)
2022-03-11LibWeb: Move PaintingBox to its own .cpp and .h filesAndreas Kling
2022-03-11LibWeb: Rename Painting::Box => PaintableAndreas Kling
Calling this "Box" made it very confusing to look at code that used both Layout::Box and Painting::Box. Let's try calling it Paintable instead.
2022-03-11LibWeb: Add Painting::Box and move things from Layout::Box into itAndreas Kling
The "paintable" state in Layout::Box was actually not safe to access until after layout had been performed. As a first step towards making this harder to mess up accidentally, this patch moves painting information from Layout::Box to a new class: Painting::Box. Every layout can have a corresponding paint box, and it holds the final used metrics determined by layout. The paint box is created and populated by FormattingState::commit(). I've also added DOM::Node::paint_box() as a convenient way to access the paint box (if available) of a given DOM node. Going forward, I believe this will allow us to better separate data that belongs to layout vs painting, and also open up opportunities for naturally invalidating caches in the paint box (since it's reconstituted by every layout.)
2022-03-09LibWeb: Use reverse iterator for reverse loop into NonnullRefPtrVectorFederico Guerinoni
2022-03-08LibWeb: Move Window from DOM directory & namespace to HTMLLinus Groh
The Window object is part of the HTML spec. :^) https://html.spec.whatwg.org/multipage/window-object.html
2022-02-25LibWeb: Improve HTMLElement.click()Andreas Kling
This API now follows the spec a bit more closely, with regards to the event being dispatched. There are still FIXME's but this is already an improvement. 2% progression on ACID3. :^)
2022-02-19LibWeb: Move QualifiedName into the Web::DOM namespaceAndreas Kling
2022-02-16LibWeb: Separate "event listener" from "EventListener"Andreas Kling
I can't imagine how this happened, but it seems we've managed to conflate the "event listener" and "EventListener" concepts from the DOM specification in some parts of the code. We previously had two things: - DOM::EventListener - DOM::EventTarget::EventListenerRegistration DOM::EventListener was roughly the "EventListener" IDL type, and DOM::EventTarget::EventListenerRegistration was roughly the "event listener" concept. However, they were used interchangeably (and incorrectly!) in many places. After this patch, we now have: - DOM::IDLEventListener - DOM::DOMEventListener DOM::IDLEventListener is the "EventListener" IDL type, and DOM::DOMEventListener is the "event listener" concept. This patch also updates the addEventListener() and removeEventListener() functions to follow the spec more closely, along with the "inner invoke" function in our EventDispatcher.
2022-02-15LibWeb: Implement HTMLElement.click()Andreas Kling
This doesn't send the correct type of click event, but it does send something, so it's already somewhat useful. :^)
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-07LibWeb: Fix broken step 4.3 implementation in run_focus_update_steps()Andreas Kling
Some over-eager copy-pasting led to incorrect code for the new chain.
2022-02-07LibWeb: Use NonnullRefPtrVector<DOM::Node> for focus chainsAndreas Kling
Let's just use reference-counting pointers for this, even if it seems safe not to.
2022-02-07LibWeb: Improve step 3 of "focus chain" from the HTML specAndreas Kling
This function was unnecessarily nested, which created a scenario where we could get stuck in an infinite loop without advancing the current_object pointer up the browsing context container chain.
2022-02-07LibWeb: Fix inverted null check in run_focusing_steps()Andreas Kling
Thanks to U9G for catching this! :^)
2022-02-07LibWeb: Add a proper FocusEvent interface for "focus" and "blur" eventsAndreas Kling
2022-02-06LibWeb: Implement (most of) HTMLElement.focus()Andreas Kling
The main deviation from the spec is that we don't have a straightforward representation of the spec's "focusable area" concept. I've left a bunch of FIXME's around for our future selves. :^)
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-09-30LibWeb: Support HTMLElement.offset{Width,Height}Andreas Kling
2021-09-26LibWeb: Add support for HTMLOrSVGElement.datasetLuke Wilde
2021-07-31LibWeb: Fix regression of "contenteditable" attributeTheFightingCatfish
2021-07-28LibWeb: Fix incompatibility of attribute "contenteditable"SeekingBlues
The previous behavior of mapping a missing value to the "inherit" state is incompatible. Now, a missing value maps to the "true" state, which is the expected behavior.
2021-06-24AK: Rename downcast<T> => verify_cast<T>Andreas Kling
This makes it much clearer what this cast actually does: it will VERIFY that the thing we're casting is a T (using is<T>()).
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-15LibWeb: Expose the HTMLElement::{offsetLeft, offsetTop} attributesIdan Horowitz
These describe the border box of an element relative to their parent.
2021-02-23Everywhere: Rename ASSERT => VERIFYAndreas Kling
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
2021-02-20LibWeb: Use DOMException in HTMLElement::set_content_editable()Linus Groh
2021-02-07LibWeb: Use move semantics for QualifiedName more oftenAndreas Kling
2021-02-03LibWeb: Basic implementation of global event handlers :^)Andreas Kling
Document and HTMLElement now inherit from HTML::GlobalEventHandlers which allows them to support "onfoo" event handler attributes. These are assignable both via IDL attributes and content attributes. Event listeners constructed this way get a special "attribute" flag on them so we know which one to replace if you reassign them. This also allows them to coexist with EventTarget.addEventListener(). This is all a bit sloppy, but it works decently for a first cut. The Window object should also inherit GlobalEventHandlers, but since we don't generate it from IDL, I haven't taken that step here. Also this would be a lot nicer if we supported IDL mixins.
2021-01-12Libraries: Move to Userland/Libraries/Andreas Kling