summaryrefslogtreecommitdiff
path: root/Libraries/LibWeb/DOM
AgeCommit message (Collapse)Author
2020-08-21LibWeb: Implement <template> parsingLuke
Note that there is currently no way to display them as we can't currently clone nodes. Adds special case for templates for dumping to console. Doesn't add it to the DOM inspector as I'm not sure how to do it.
2020-08-18LibWeb: Implement Element.innerTextNico Weber
Reading the property has a few warts (see FIXMEs in the included tests), but with this the timestamps on http://45.33.8.238/ get localized :^) Since the Date() constructor currently ignores all arguments, they don't get localized correctly but are all set to the current time, but hey, it's still progress from a certain point of view.
2020-08-18LibWeb: Simplify Node::text_content()Nico Weber
2020-08-17LibWeb: Add more document tests, add comment, text and mixin testsLuke
Also adds a TypeScript definition file for the test runner object.
2020-08-17LibWeb: Add Comment and DocumentFragment bindings, move querySelector...Luke
...{All} to ParentNode. Exposes createDocumentFragment and createComment on Document. Stubs out the document.body setter. Also adds ParentNode back :^).
2020-08-17LibWeb: Add Node.textContentNico Weber
This requires moving remove_all_children() from ParentNode to Node, which makes ParentNode.cpp empty, so remove it. It also co-opts the existing Node::text_content() method and tweaks it slightly to fit the semantics of Node.textContent.
2020-08-17LibWeb: Rename PageView => InProcessWebViewAndreas Kling
2020-08-15LibWeb: Allow focusing individual (focusable) elements with Tab keyAndreas Kling
You can now cycle through focusable elements (currently only hyperlinks are focusable) with the Tab key. The focus outline is rendered in a new FocusOutline paint phase.
2020-08-15LibWeb: Add NonDocumentTypeChildNode::next_element_in_pre_order()Andreas Kling
This is handy for traversing only the elements in a document.
2020-08-14LibJS+LibWeb: Clear exceptions after call'ing JavaScript functionsAndreas Kling
Decorated Interpreter::call() with [[nodiscard]] to provoke thinking about the returned value at each call site. This is definitely not perfect and we should really start thinking about slimming down the public-facing LibJS interpreter API. Fixes #3136.
2020-08-12LibWeb: Fix #include <LibWeb/{DOM => HTML}/AttributeNames.h>Linus Groh
This file has been moved from DOM/ to HTML/ in a784090b91139776b26fbac2a8426de3abdea308.
2020-08-12LibWeb: Move HTML::AttributeNames file into HTML/ directoryAndreas Kling
2020-08-12LibWeb: Initialize tag/attribute name globals in init-time constructorsAndreas Kling
2020-08-11LibWeb: Clear exceptions in each Document::run_javascript() callLinus Groh
We don't want to carry over exceptions across multiple Document::run_javascript() calls as Interpreter::run() and every of its exception checks will get confused - in this case there would be an exception, but not because a certain action failed. Real-life example: <script>var a = {}; a.test()</script> <script>alert("It worked!")</script> The above HTML will invoke Document::run_javascript() twice, the first call will result in a TypeError, which is still stored during the second call. The interpreter will eventually call the following functions (in order) for the alert() invocation: - Identifier::execute() - Interpreter::get_variable() - Object::get() (on the global object) That last Object::get() call has an exception check which is triggered as we still carry around the exception from earlier - and eventually returns an empty value. Long story short, the second script will wrongly fail with "ReferenceError, 'alert' is not defined". Fixes #3091.
2020-08-10LibWeb: Move tree iteration helpers from Node/LayoutNode to TreeNodeAndreas Kling
Since these are generally useful in our trees, let's just keep them in TreeNode instead of duplicating the helpers in subclasses.
2020-08-09LibWeb: Add HTML elements to factories, add missing tags and attributesLuke
This is mostly to get the grunt work of the way. This is split up into multiple commits to hopefully make it more manageable to review. Note that these are not full implementations, and the bindings mostly get the low hanging fruit. Also implements some attributes that I kept out because they had dashes in them. Therefore, this closes #2905.
2020-08-04LibWeb: Make sure that head and body always get the HTML elementLuke
Now that document element returns a generic DOM element, we need to make sure head and body get a html element. The spec just says to check if the document element is a html element, so let's do that.
2020-08-03LibWeb: Add CharacterData and Text IDL interfacesAndreas Kling
2020-08-03LibWeb: Add Element.{next,previous}ElementSibling IDL attributesAndreas Kling
2020-08-03LibWeb: Move "element sibling" getters to NonDocumentTypeChildNodeAndreas Kling
Here's another CRTP mixin since that's the best we can do with C++. This prepares exposing these via IDL on Element and CharacterData.
2020-08-03LibWeb: Add the Document.documentElement APIAndreas Kling
Also change DOM::Document::document_element() to return an Element* and not an HTML::HTMLHtmlElement since that's not the only kind of documentElement we might encounter.
2020-08-03LibWeb: Move contentEditable from Element to HTMLElementLuke
HTMLElement is the only interface that includes ElementContentEditable in the HTML specification. This makes sense, as Element is also a base class for elements in other specifications such as SVG, which definitely shouldn't be editable. Also adds a test for the attribute based on what Andreas did in the video that added it.
2020-08-02LibWeb: Implement the Element.contentEditable IDL attributeAndreas Kling
2020-08-02LibWeb: Only allow editing of elements with contenteditable="true"Andreas Kling
We now respect the contenteditable HTML attribute and only let you edit content inside explicitly editable elements.
2020-08-02LibWeb: Allow inserting text at the cursor by typing characters :^)Andreas Kling
This works everywhere right now, but it's obviously not going to stay that way forever. :^) Note that this does not advance the cursor correctly for whitespace since the cursor is DOM-based and doesn't take whitespace collapsing into account yet.
2020-08-02LibWeb: Add a basic DOM::Position classAndreas Kling
This will be used for editable content. :^)
2020-07-28LibWeb: Add UIEvent class (base of MouseEvent, and others)Andreas Kling
2020-07-28LibWeb: Move the Page/Frame/EventHandler classes into Page/Andreas Kling
2020-07-28LibWeb: Move the CSS parser into CSS/Parser/Andreas Kling
2020-07-28LibWeb: Move the HTML parser into HTML/Parser/Andreas Kling
2020-07-28LibWeb: Move HTML classes into the Web::HTML namespaceAndreas Kling
2020-07-28LibWeb: Move MouseEvent into the UIEvents namespaceAndreas Kling
Named after the UIEvents specification that houses MouseEvent.
2020-07-27LibWeb: Add a whole bunch of HTML DOM bindingsLuke
Note that these aren't full implementations of the bindings. This mostly implements the low hanging fruit (namely, basic reflections) There are some attributes that should be USVString instead of DOMString. However, USVString is a slightly different definition of DOMString, so it should suffice for now.
2020-07-26LibWeb: Move CSS classes into the Web::CSS namespaceAndreas Kling
2020-07-26LibWeb: Move DOM classes into the Web::DOM namespaceAndreas Kling
LibWeb keeps growing and the Web namespace is filling up fast. Let's put DOM stuff into Web::DOM, just like we already started doing with SVG stuff in Web::SVG.
2020-07-26LibWeb: Simplify type traits for SVGGraphicsElementAndreas Kling
2020-07-26LibWeb: Switch to using AK::is and AK::downcastAndreas Kling
2020-07-26LibWeb: Move HTML object model stuff into LibWeb/HTML/Andreas Kling
Take a hint from SVG and more all the HTML classes into HTML instead of mixing them with the DOM classes.
2020-07-26LibWeb: Refactor SVG files into their own directory; follow spec layoutMatthew Olsson
2020-07-26LibWeb: Abstract common operations of graphical SVG elementsMatthew Olsson
2020-07-26LibGfx: Add FloatPoint methodsMatthew Olsson
Adds some conversion constructors, as well as the missing arithmetic operations.
2020-07-26LibWeb: Add elliptical curve support to svg path elementsMatthew Olsson
2020-07-26LibWeb: Begin SVG element supportMatthew Olsson
This commit starts adding a basic SVG element. Currently, svg elements have support for the width and height properties, as well as the stroke, stroke-width, and fill properties. The only child element supported is the path element, as most other graphical elements are just shorthand for paths.
2020-07-24LibWeb: Use [Reflect] for Element.id and Element.className :^)Andreas Kling
2020-07-24LibWeb: Add HTMLElement.lang (and make HTMLElement.title reflecting)Andreas Kling
2020-07-24LibWeb: Add HTMLImageElement.src and HTMLImageElement.altAndreas Kling
These are reflecting attributes! :^)
2020-07-23LibWeb: Rename Element::tag_name() => local_name()Andreas Kling
To prepare for fully qualified tag names, let's call this local_name. Note that we still keep an Element::tag_name() around since that's what the JS bindings end up calling into for the Element.tagName property.
2020-07-22LibWeb: Parse "width" and "height" presentation attributes on <img>Andreas Kling
These are HTML lengths that map to CSS width and height respectively.
2020-07-22LibWeb: Add a dedicated function for parsing HTML length valuesAndreas Kling
Presentation attribute lengths (width, height, etc.) can always be unit-less (e.g "400") so going via the normal CSS parsing path only works when the document is in quirks mode. Add a separate parse_html_length() that always allows unit-less values.
2020-07-21LibWeb: Implement quirks mode detectionLuke
This allows us to determine which mode to render the page in. Exposes "doctype" and "compatMode" on Document. Exposes "name", "publicId" and "systemId" on DocumentType.