summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML
AgeCommit message (Collapse)Author
2021-04-23AK: Rename adopt() to adopt_ref()Andreas Kling
This makes it more symmetrical with adopt_own() (which is used to create a NonnullOwnPtr from the result of a naked new.)
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-20LibWeb: Register FormAssociatedElement with their owner formAndreas Kling
This will eventually allow us to implement HTMLFormControlsCollection.
2021-04-20LibWeb: Make HTMLSelectElement a FormAssociatedElementAndreas Kling
2021-04-20LibWeb: Use correct event name for the onmousemove global event handlerIdan Horowitz
The current event name was accidentally set for the onmousedown event.
2021-04-20LibWeb: Add basic support for HTMLInputElement.formAndreas Kling
HTMLInputElement now inherits from FormAssociatedElement, which will be a common base for the handful of elements that need to track their owner form (and register with it for the form.elements collection.) At the moment, the owner form is assigned during DOM insertion/removal of an HTMLInputElement. I didn't implement any of the legacy behaviors defined by the HTML parsing spec yet.
2021-04-19LibWeb: Add basic support for HTMLCanvasElement.toDataURL() :^)Andreas Kling
This allows you to serialize a <canvas> element's bitmap into a data: URI. Pretty neat! :^)
2021-04-17LibWeb: Don't load anything for <iframe> without src attributeAndreas Kling
Completing an empty URL string from the document base URL will just return the document URL, so any document that had an "<iframe>" would endlessly load itself in recursive iframes.
2021-04-16Everywhere: Add `-Wdouble-promotion` warningNicholas-Baron
This warning informs of float-to-double conversions. The best solution seems to be to do math *either* in 32-bit *or* in 64-bit, and only to cross over when absolutely necessary.
2021-04-15LibWeb: Expose the HTMLElement::{offsetLeft, offsetTop} attributesIdan Horowitz
These describe the border box of an element relative to their parent.
2021-04-15LibWeb: Check radius sign in CanvasRenderingContext2D::{arc, ellipse}Idan Horowitz
As required by the specification: 'If either radiusX or radiusY are negative, then throw an "IndexSizeError" DOMException.'
2021-04-15LibWeb: Add a naive implemention of CanvasRenderingContext2D::fill_textIdan Horowitz
This doesnt actually account for several unimplemented attributes (like ltr/rtl, alignment, etc) yet, so this should be expanded in the future.
2021-04-15LibGfx+LibWeb: Wire up CanvasRenderingContext2D.ellipse()AnotherTest
Note that this is *extremely* naive, and not very good at being correct.
2021-04-15LibWeb: Set Cookie header on <img> and <object> resource requestsTimothy Flynn
This required passing a reference to the owning HTML*Element to ImageLoader, the same way that CSSLoader has a reference to its owner.
2021-04-15LibWeb: Set Cookie header on <script> resource requestsTimothy Flynn
This required changing the load_sync API to take a LoadRequest instead of just a URL. Since HTMLScriptElement was the only (non-test) user of this API, it didn't seem useful to instead add an overload of load_sync for this.
2021-04-14LibWeb: Implement the CanvasRenderingContext2D::rect path methodIdan Horowitz
This method adds a rectangle to the current 2D path.
2021-04-14LibWeb: Make CanvasRenderingContext2D::fill's fillRule argument optionalIdan Horowitz
As defined by the specification (and used by the website i am testing): interface mixin CanvasDrawPath { undefined fill(optional CanvasFillRule fillRule = "nonzero"); }
2021-04-14LibWeb: Request repaint on canvas path finalizaiton via fill/strokeIdan Horowitz
Since these were not requesting a repaint the drawn path was not being rendered until a repaint was forced in some other way (window resize).
2021-04-13LibWeb: Fix a TODO in the adoption agency algorithmLinus Groh
There's still a much bigger one at the end of the function though. :^)
2021-04-06LibWeb: Implement "select" portion of reset_the_insertion_mode_appropriatelyLuke
Required by Dromaeo. With this, it no longer crashes.
2021-04-06LibWeb: Use the new "ensure_pre_insertion_validity" in the HTML document parserLuke
Previously we didn't check if we could insert the element in the adjusted insertion location's parent. Also makes the return type NonnullRefPtr, as that's what element is.
2021-04-06LibWeb: Rename "for_each_in_subtree(_of_type)" to ↵Luke
"for_each_in_inclusive_subtree(_of_type)" This is because it includes the initial node that the function was called on, which makes it "inclusive" as according to the spec. This is important as there are non-inclusive variants, particularly used in the node mutation algorithms.
2021-04-06LibWeb: Only prepare scripts on insertion if they're not parser insertedLuke
Also updates the "inserted_into" function as per the previous commit. Changes the FIXME, as according to the spec there is no notification system to be notified of things such as the node becoming connected. Instead, "becomes connected" means when the insertion steps are run, the element is now connected when it previously wasn't. https://html.spec.whatwg.org/multipage/infrastructure.html#becomes-connected This is done in this PR because the insertion steps are run when the start tag is inserted. This made it try to prepare the script too early for inline scripts. The order of operations in the HTML document parser ensures that the parser document is set before the insertion steps are run.
2021-04-06LibWeb: Make the node mutation event functions spec compliantLuke
This particularly affects the insertion steps and the removed steps. The insertion steps no longer take into the parent that the node was inserted to, as per the spec. Due to this, I have renamed the function from "inserted_into" to simply "inserted". None of the users of the insertion steps was using it anyway. The removed steps now take a pointer to the old parent instead of a reference. This is because it is optional according to the spec and old parent is null when running the removal steps for the descendants of a node that just got removed. This commit does not affect HTMLScriptElement as there is a bit more to that, which is better suited for a separate commit. Also adds in the adopted steps as they will be used later.
2021-04-04LibWeb: Add "Label" to be the layout node for HTMLLabelElementTimothy Flynn
The HTML <label> element is special in that it may be associated with some other <input> element. When the label element is clicked, the input element should be activated. To achieve this, a LableableNode base class is introduced to provide an interface for "labelable" elements to handle mouse events on their associated labels. This not only allows clicking the label to activate the input, but dragging the mouse from the label to the input (and vice- versa) while the mouse is clicked will also active the label. As of this commit, this infrastructure is not hooked up to any elements.
2021-04-03LibWeb: Defer creation of subframes until host element is connectedAndreas Kling
This allows parsing of document fragments with "<iframe>" to construct the iframe element without requiring that the fragment have a frame.
2021-04-03LibWeb: Pass optional status code to ResourceLoader callbacksLinus Groh
This is needed for XMLHttpRequest, and will certainly be useful for other things, too.
2021-04-03LibWeb: Add support for HTML input type=radioTimothy Flynn
2021-04-03LibWeb: Add a FrameHostElement for frame/iframe common functionalityAndreas Kling
A FrameHostElement is an HTML element (<frame> or <iframe>) that may have a content frame that participates in the frame tree. This basically just moves code from <iframe> to a separate base class so we can share it with <frame> once we implement <frame>.
2021-03-21LibWeb: Only call page_did_change_title() from main frameLinus Groh
Otherwise an embedded iframe will override the page title in the browser, for example.
2021-03-16LibWeb: Use Gfx::Bitmap::RGBA8888 for ImageData bitmapsAndreas Kling
This makes the colors show up correctly when using putImageData() to draw an ImageData onto a CanvasRenderingContext2D. :^)
2021-03-16LibGfx: Rename 32-bit BitmapFormats to BGRA8888 and BGRx888xAndreas Kling
The previous names (RGBA32 and RGB32) were misleading since that's not the actual byte order in memory. The new names reflect exactly how the color values get laid out in bitmap data.
2021-03-15LibWeb: Make sure <script> elements get prepared when connectedAndreas Kling
There's a bit more nuance to how this should really work, but let's at least make sure we execute <script> elements if you insert them into the document.
2021-03-15LibWeb: Add CanvasRenderingContext2D.clearRect()Andreas Kling
Similar to fillRect, except this API fills with transparent black.
2021-03-11LibWeb: Remove FIXME in is_javascript_mime_type_essence_matchLuke
This was misleading. The spec just wants us to check a string matches a string in the JavaScript MIME type essence list. It doesn't want us to parse the string as a MIME type to then use its essence for the check. Renames "mime_type" to "string" to make this less misleading.
2021-03-09LibWeb: Rename CSSParser => DeprecatedCSSParserAndreas Kling
2021-03-08LibWeb: Give CSSLoader a backpointer to its owner elementAndreas Kling
This allows CSSLoader to set up the style sheet owner node internally, and avoids an awkward weak link between CSSLoader and Document.
2021-03-08LibWeb: Implement StyleSheet.ownerNode :^)Andreas Kling
2021-03-07LibWeb: Split CSS::StyleSheet into StyleSheet and CSSStyleSheetAndreas Kling
This is a little convoluted but matches the CSSOM specification.
2021-03-01LibWeb: Provide file name to JavaScript interpreterJean-Baptiste Boric
2021-02-28LibWeb: Add actual document loading for the CSS (at)import ruleSviatoslav Peleshko
2021-02-26Everywhere: Remove a bunch of redundant 'AK::' namespace prefixesLinus Groh
This is basically just for consistency, it's quite strange to see multiple AK container types next to each other, some with and some without the namespace prefix - we're 'using AK::Foo;' a lot and should leverage that. :^)
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-10LibWeb: Start implementing <input type=text> using a shadow DOMAndreas Kling
Text <input> fields will now generate a basic shadow DOM and attach it to the input element. The shadow DOM contains a <div> with some inline style, and an always- editable text node inside it. Accessing the "value" attribute on such an input element will get/set the value from that text node. This is really cool, although not super stable since HTML editing is not super stable. But it's a start! :^)
2021-02-10LibWeb: Respect the bgcolor attribute on <marquee> elementsAndreas Kling
We don't yet animate marquees, but we can at least fill them with the right background color.
2021-02-10LibWeb: Remove WidgetBox layout nodeAndreas Kling
The approach of attaching sub-widgets to the web view widget was only ever going to work in single-process mode, and that's not what we're about anymore, so let's just get rid of WidgetBox so we don't have the dead-end architecture hanging over us. The next step here is to re-implement <input type=text> using LibWeb primitives.
2021-02-10LibWeb: Remove low-hanging LibGUI fruit from LibWebAndreas Kling
We'll want to remove the LibGUI dependency from the WebContent process. This is the first basic step of removing unnecessary LibGUI includes and swapping out GUI::Painter for Gfx::Painter.
2021-02-10LibWeb: Remove a whole bunch of unnecessary #includesAndreas Kling
2021-02-08Everywhere: Replace dbgln<flag>(...) with dbgln_if(flag, ...)AnotherTest
Replacement made by `find Kernel Userland -name '*.h' -o -name '*.cpp' | sed -i -Ee 's/dbgln\b<(\w+)>\(/dbgln_if(\1, /g'`