summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp
AgeCommit message (Collapse)Author
2023-05-15LibWeb: Cache state of the contenteditable attribute on HTMLElementAndreas Kling
Instead of recomputing the state whenever someone asks for it, we now cache it when the attribute is added/changed/removed. Before this change, HTMLElement::is_editable() was 6.5% of CPU time when furiously resizing Hacker News. After, it's less than 0.5%. :^)
2023-04-20LibWeb/DOM: Rename Node::{paint => paintable}_box()Linus Groh
It returns a PaintableBox, not a 'PaintBox'.
2023-04-19LibWeb: Rename BrowsingContextContainer => NavigableContainerAndreas Kling
The "browsing context container" concept in the HTML spec has been replaced with "navigable container". Renaming this is the first step of many towards implementing the new world. Co-authored-by: Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
2023-04-09LibWeb: Port fire_a_synthetic_pointer_event() to new FlySringKenneth Myhra
2023-04-09LibWeb: Port EventTarget to new {Fly}StringKenneth Myhra
2023-04-07LibWeb: Port {Mouse,UI,Wheel,}Event to new StringKenneth Myhra
This ports MouseEvent, UIEvent, WheelEvent, and Event to new String. They all had a dependency to T::create() in WebDriverConnection::fire_an_event() and therefore had to be ported in the same commit.
2023-04-06LibWeb: Port {HTML,UIEvents,XHR}::EventNames to new StringKenneth Myhra
2023-03-10Everywhere: Rename equals_ignoring_case => equals_ignoring_ascii_caseAndreas Kling
Let's make it clear that these functions deal with ASCII case only.
2023-02-18LibWeb: Make factory method of HTML::DOMStringMap fallibleKenneth Myhra
2023-02-18LibWeb: Make factory methods of DOM::Event fallibleKenneth Myhra
Because of interdependencies between DOM::Event and UIEvents::MouseEvent to template function fire_an_event() in WebDriverConnection.cpp, the commit: 'LibWeb: Make factory methods of UIEvents::MouseEvent fallible' have been squashed into this commit.
2023-01-29LibWeb: Move ARIA-related code into the Web::ARIA namespaceLinus Groh
ARIA has its own spec and is not part of the DOM spec, which is what the Web::DOM namespace is for (https://www.w3.org/TR/wai-aria-1.2/). This allows us to stay closer to the spec with function names and don't have to add the word "ARIA" to identifiers constantly - the namespace now provides that clarity.
2023-01-29LibJS+Everywhere: Allow Cell::initialize overrides to throw OOM errorsTimothy Flynn
Note that as of this commit, there aren't any such throwers, and the call site in Heap::allocate will drop exceptions on the floor. This commit only serves to change the declaration of the overrides, make sure they return an empty value, and to propagate OOM errors frm their base initialize invocations.
2023-01-28LibWeb: Replace ARIA role static FlyStrings with an enumMacDue
This replaces the FlyStrings for ARIA roles that were constructed in a [[gnu::constructor]] with a single enum. I came across this as the DOM inspector was crashing due to a null FlyString for an ARIA role. After fixing that, I was confused as to why these roles were not an enum. Looking at the spec there's a fixed list of roles and switching from references to static strings to an enum was pretty much an exercise in find and replace :). No functional changes (outside of fixing the mentioned crash).
2023-01-10LibWeb: Move setting of Web object prototypes to initialize()Timothy Flynn
This needs to happen before prototype/constructor intitialization can be made lazy. Otherwise, GC could run during the C++ constructor and try to collect the object currently being created.
2023-01-09AK+Everywhere: Rename FlyString to DeprecatedFlyStringTimothy Flynn
DeprecatedFlyString relies heavily on DeprecatedString's StringImpl, so let's rename it to A) match the name of DeprecatedString, B) write a new FlyString class that is tied to String.
2023-01-07LibWeb: Add Support for the ARIA Element PropertiesJonah
Element now supports getting and setting ARIA properties from JS and HTML.
2023-01-05LibWeb: Convert Layout::Node to new pixel unitsSam Atkins
2022-12-14LibWeb: Convert Paintable coordinates to new pixel unitsSam Atkins
This fixes a few sizing issues too. The page size is now correct in most cases! \o/ We get to remove some of the `to_type<>()` shenanigans, though it reappears in some other places.
2022-12-06Everywhere: Rename to_{string => deprecated_string}() where applicableLinus Groh
This will make it easier to support both string types at the same time while we convert code, and tracking down remaining uses. One big exception is Value::to_string() in LibJS, where the name is dictated by the ToString AO.
2022-12-06AK+Everywhere: Rename String to DeprecatedStringLinus Groh
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
2022-11-23LibWeb: Avoid including LibJS/Parser.h in a handful of cpp filesAndreas Kling
2022-11-13LibWeb: Implement bare-bones `HTMLElement.dir`Igor Pissolati
2022-11-07LibWeb: Extract the (un)focus steps out of HTMLElementLuke Wilde
The (un)focus steps have no dependency on HTMLElement, thus we can extract them into their own file. This allows them to be called anywhere.
2022-10-31LibWeb: Handle currently ignored `WebIDL::ExceptionOr<T>`sLinus Groh
2022-10-10LibWeb: Don't include DOMStringMap.h quite so muchAndreas Kling
This file was being included everywhere via HTMLElement and SVGElement, but we don't actually need to do that.
2022-10-07LibWeb: Add initial implementation of Element.blur()Andrew Kaster
This implementation includes a first cut at run the unfocusing steps from the spec, with many things left unimplemented. The viewport related spec steps in particular don't seem to map to LibWeb concepts, which makes figuring out if things are properly focused much more difficult.
2022-10-01LibWeb: Remove unecessary dependence on Window from UIEvents classesAndrew Kaster
These classes only needed Window to get at its realm. Pass a realm directly to construct UIEvents classes.
2022-10-01LibWeb: Remove unecessary dependence on Window from HTML classesAndrew Kaster
These classes only needed Window to get at its realm. Pass a realm directly to construct HTML classes.
2022-09-25LibWeb: Move DOMException from DOM/ to WebIDL/Linus Groh
2022-09-25LibWeb: Move ExceptionOr from DOM/ to WebIDL/Linus Groh
This is a concept fully defined in the Web IDL spec and doesn't belong in the DOM directory/namespace - not even DOMException, despite the name :^)
2022-09-18LibWeb: Check document fully active status in "element cannot navigate"Andreas Kling
This resolves a FIXME and brings us closer to spec.
2022-09-17LibWeb: Update layout in HTMLElement.offset{Top,Left}Andreas Kling
We can't report layout-dependent metrics without first ensuring that layout is up-to-date.
2022-09-06LibWeb: Make DOMException GC-allocatedAndreas Kling
2022-09-06LibWeb: Use target's global object when creating focus/blur eventsAndreas Kling
2022-09-06LibWeb: Don't allocate DOMStringMap in HTMLElement constructorAndreas Kling
Allocations go in initialize().
2022-09-06LibWeb: Use cached_web_prototype() as much as possibleAndreas Kling
Unlike ensure_web_prototype<T>(), the cached version doesn't require the prototype type to be fully formed, so we can use it without including the FooPrototype.h header. It's also a bit less verbose. :^)
2022-09-06LibWeb+LibJS: Make the EventTarget hierarchy (incl. DOM) GC-allocatedAndreas Kling
This is a monster patch that turns all EventTargets into GC-allocated PlatformObjects. Their C++ wrapper classes are removed, and the LibJS garbage collector is now responsible for their lifetimes. There's a fair amount of hacks and band-aids in this patch, and we'll have a lot of cleanup to do after this.
2022-09-06LibWeb: Make DOM::Event and all its subclasses GC-allocatedAndreas Kling
2022-09-06LibWeb: Make DOMStringMap GC-allocatedAndreas Kling
2022-07-12Everywhere: Add sv suffix to strings relying on StringView(char const*)sin-ack
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
2022-04-10LibWeb: Update layout in HTMLElement.offset{Width,Height}Andreas Kling
If we don't do this, we may be returning stale values.
2022-04-09LibWeb: Bring MouseEvent a bit closer to specIgor Pissolati
2022-04-01Everywhere: Run clang-formatIdan Horowitz
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