summaryrefslogtreecommitdiff
path: root/Libraries/LibWeb/DOM
AgeCommit message (Collapse)Author
2021-01-09LibWeb: Convert a bunch of dbg() to dbgln()Andreas Kling
2021-01-07LibWeb: Specialize is<DOM::Element>() and is<Layout::Box>()Andreas Kling
These two show up in profiles, so let's add specializations for them.
2021-01-07LibWeb: Allow anonymous table, table-row and table-cell layout nodesAndreas Kling
2021-01-07LibWeb: Move remove_all_children() from Node to TreeNode<T>Andreas Kling
This is useful in all tree types.
2021-01-06LibWeb: Make DOM::Node::create_layout_node() not need parent's styleAndreas Kling
The StyleResolver can find the specified CSS values for the parent element via the DOM. Forcing everyone to locate specified values for their parent was completely unnecessary.
2021-01-06LibWeb: Remove specified style from layout nodesAndreas Kling
Layout nodes now only carry CSS computer values with them. The main idea here is to give them only what they need to perform layout, and leave the rest back in the DOM.
2021-01-06LibWeb: Use the specified CSS values from element in more placesAndreas Kling
Instead of using the specified style stored on Layout::Node, use the specified CSS values kept by the DOM::Element in more places.
2021-01-06LibWeb: Rename Element::resolved_style() => specified_css_values()Andreas Kling
This object represents the specified CSS values, so let's call it that.
2021-01-06LibWeb: Copy some properties from specified style into layout nodeAndreas Kling
Another step towards not having to carry the full specified style with us everywhere. This isn't the ideal final layout, since we're mixing computed and used values a bit randomly here, but one step at a time.
2021-01-06LibWeb: Rename LayoutStyle => CSS::ComputedValuesAndreas Kling
This object represents the CSS "computed values" so let's call it that.
2021-01-01LibWeb: Remove hand-rolled is_foo() helpers in Layout::Node classesAndreas Kling
2021-01-01LibWeb: Remove more hand-rolled type information :^)Andreas Kling
Hoo boy, we've really accumulated a lot of this stuff.
2021-01-01AK+LibGUI+LibWeb: Remove AK::TypeTraits in favor of RTTI-based helpersAndreas Kling
Now that we have RTTI in userspace, we can do away with all this manual hackery and use dynamic_cast. We keep the is<T> and downcast<T> helpers since they still provide good readability improvements. Note that unlike dynamic_cast<T>, downcast<T> does not fail in a recoverable way, but will assert if the object being casted is not a T.
2020-12-30ProtocolServer: Stream the downloaded data if possibleAnotherTest
This patchset makes ProtocolServer stream the downloads to its client (LibProtocol), and as such changes the download API; a possible download lifecycle could be as such: notation = client->server:'>', server->client:'<', pipe activity:'*' ``` > StartDownload(GET, url, headers, {}) < Response(0, fd 8) * {data, 1024b} < HeadersBecameAvailable(0, response_headers, 200) < DownloadProgress(0, 4K, 1024) * {data, 1024b} * {data, 1024b} < DownloadProgress(0, 4K, 2048) * {data, 1024b} < DownloadProgress(0, 4K, 1024) < DownloadFinished(0, true, 4K) ``` Since managing the received file descriptor is a pain, LibProtocol implements `Download::stream_into(OutputStream)`, which can be used to stream the download into any given output stream (be it a file, or memory, or writing stuff with a delay, etc.). Also, as some of the users of this API require all the downloaded data upfront, LibProtocol also implements `set_should_buffer_all_input()`, which causes the download instance to buffer all the data until the download is complete, and to call the `on_buffered_download_finish` hook.
2020-12-29LibWeb: Expose three more attribute methods on ElementLuke
Exposes removeAttribute, hasAttribute and hasAttributes.
2020-12-21Everywhere: Switch from (void) to [[maybe_unused]] (#4473)Lenny Maiorani
Problem: - `(void)` simply casts the expression to void. This is understood to indicate that it is ignored, but this is really a compiler trick to get the compiler to not generate a warning. Solution: - Use the `[[maybe_unused]]` attribute to indicate the value is unused. Note: - Functions taking a `(void)` argument list have also been changed to `()` because this is not needed and shows up in the same grep command.
2020-12-17LibWeb: Escape text nodes in innerHTML getterLinus Groh
2020-12-17LibWeb: Include element attributes in innerHTML getterLinus Groh
2020-12-15LibWeb: Actually apply recomputed style to element's layout nodeAndreas Kling
Otherwise fetching stuff via LayoutNode::style() will have stale values since we were only updating the specified_style() here. LayoutNode::specified_style() should eventually go away since there's no need to carry those uncooked values around with the layout tree.
2020-12-15LibWeb: Add hack to disable StyleInvalidator while parsing documentAndreas Kling
Running a StyleInvalidator for every attribute set in a new document was making it impossible to load larger sites. :^)
2020-12-15LibWeb: Remove unused Element::set_attributes()Andreas Kling
2020-12-15LibWeb: Put final foreground/background colors in LayoutStyleAndreas Kling
This way we don't have to look them up in the CSS::StyleProperties every time we want to paint with them.
2020-12-14LibWeb: Add a simple StyleInvalidator classLinus Groh
This patch adds a simple, naive & inefficient class for document-wide style invalidation, e.g. after element attribute updates. During construction it collects a HashMap of a document's elements and their matching rules, during destruction it does the same and then compares the results; dirtying all elements that have a different number or order of matching rules afterwards. Much room for improvement, but it solves the problem of stale element styling after attribute updates for now :^) Fixes #4404.
2020-12-14LibWeb: Add a little assertion in Document::detach_from_frame()Andreas Kling
Let's just assert that we're detaching from the frame we thought we were in.. just in case.
2020-12-14LibWeb: Simplify <iframe> content frame constructionAndreas Kling
Now that documents are attached to their frame *before* parsing, we can create the content frame of <iframe> elements right away, instead of waiting for the host frame attachment. Fixes #4408.
2020-12-14LibWeb: Limit style update tree traversal to dirty subtreesAndreas Kling
This patch adds a second style dirty bit that tracks whether a DOM node has one or more children with dirty style. This allows the style update to skip over entire subtrees where all nodes are clean.
2020-12-14LibWeb: Merge Document::layout() and Document::update_layout()Andreas Kling
There is now only Document::update_layout().
2020-12-13LibWeb: Update stale #includes for HTML/TagNames.* moveAndreas Kling
2020-12-13LibWeb: Move DOM/TagNames.* => HTML/TagNames.*Andreas Kling
2020-12-13LibWeb: Mark element style dirty on style/id attribute change tooAndreas Kling
2020-12-13LibWeb: Mark element style dirty when class attribute changesAndreas Kling
Fixes #4403.
2020-12-13LibWeb: Make DOM::Node::set_needs_style_update() schedule the updateAndreas Kling
After you mark a node as needing new style, there's no situation in which we don't want a style update to happen, so just take care of scheduling it automatically.
2020-12-10LibWeb: Replace IDL 'void' return type with 'undefined'Linus Groh
From the Web IDL spec: https://heycam.github.io/webidl/#idl-undefined [...] undefined constant values in IDL are represented with the `undefined` token. [...] Note: This value was previously spelled `void`, and more limited in how it was allowed to be used.
2020-12-10LibWeb: Expect IDL namespace to end with semicolonLinus Groh
From the Web IDL spec: https://heycam.github.io/webidl/#prod-Namespace Namespace :: namespace identifier { NamespaceMembers } ;
2020-12-09LibWeb: Expose DOM::Range to JavaScript.asynts
2020-12-09LibWeb: Make DOM::Range more suitable for JS.asynts
2020-12-09LibWeb: Add support for range deletion.asynts
2020-12-09LibWeb: Move editing stuff into EditEventHandler.asynts
2020-12-07LibWeb: Cache parsed inline style of DOM elementsAndreas Kling
Instead of invoking the CSS parser every time we compute the style for an element that has a "style" attribute, we now cache the result of parsing the inline style whenever the "style" attribute is set. This is a nice boost to relayout performance since we no longer hit the CSS parser at all.
2020-12-06LibWeb: Make document.title accessible from JavaScript :^)Andreas Kling
2020-12-06LibWeb: Strip and collapse whitespace in document.titleAndreas Kling
I didn't generalize this into a helper since the HTML spec doesn't seem to use this particular algorithm for anything else. This makes the ACID1 test title show up correctly. :^)
2020-12-06LibWeb: Pass current target box to BFC::run()Andreas Kling
The BFC "context box" is now the outer box of the block formatting context. Previously the context box was always the current target box, which made it hard to reason about who was really the containing block of whom in various places. Note that IFC still has the containing block as its context box, this change only affects BFC. However, to clarify the situation in IFC, I've added a containing_block() getter than returns the context_box().
2020-12-04LibWeb: Expose Document.getElementsByName() to JavaScriptAndreas Kling
2020-12-02LibWeb: Complete the URL in href_setter() before trying to load itAnotherTest
Also note that setting an invalid URL here should raise a JS exception (and not navigate away). Fixes #4301.
2020-12-01LibWeb: Implement Document.getElementsByClassName()Andreas Kling
Note that we're taking a shortcut here and returning the elements as an Array instead of HTMLCollection. One day we'll have to bite the bullet and deal with HTMLCollection, but not today.
2020-11-30LibWeb: Deallocate DOM timer ID's when the timer goes awayAndreas Kling
I left a page open overnight and it had run out of timer ID's. :^)
2020-11-29LibJS+LibWeb: Log JavaScript exceptions raised by web contentAndreas Kling
Instead of hiding JS exceptions raised on the web, we now print them to the debug log. This will make it a bit easier to work out why some web pages aren't working right. :^)
2020-11-25LibWeb: Rename Layout::LayoutTreeBuilder => Layout::TreeBuilderAndreas Kling
2020-11-25LibWeb: Keep track of the parent of each formatting contextAndreas Kling
This will allow us to find the containing block formatting context when needed later on.
2020-11-22LibWeb: Add HTML::EventNames and UIEvents::EventNamesLuke