summaryrefslogtreecommitdiff
path: root/Libraries/LibWeb/DOM
AgeCommit message (Collapse)Author
2020-09-22LibJS: Move the current exception from Interpreter to VMAndreas Kling
This will allow us to throw exceptions even when there is no active interpreter in the VM.
2020-09-20LibJS+Clients: Add JS::VM object, separate Heap from InterpreterAndreas Kling
Taking a big step towards a world of multiple global object, this patch adds a new JS::VM object that houses the JS::Heap. This means that the Heap moves out of Interpreter, and the same Heap can now be used by multiple Interpreters, and can also outlive them. The VM keeps a stack of Interpreter pointers. We push/pop on this stack when entering/exiting execution with a given Interpreter. This allows us to make this change without disturbing too much of the existing code. There is still a 1-to-1 relationship between Interpreter and the global object. This will change in the future. Ultimately, the goal here is to make Interpreter a transient object that only needs to exist while you execute some code. Getting there will take a lot more work though. :^) Note that in LibWeb, the global JS::VM is called main_thread_vm(), to distinguish it from future worker VM's.
2020-09-20LibWeb: Add Bindings::ScriptExecutionContextAndreas Kling
This will be inherited by documents and workers, to provide a common abstraction for script execution. (We don't have workers yet, but we might as well make this little space for them now to simplify things down the road.)
2020-09-12LibWeb: Support window.alert() in multi-process contextAndreas Kling
Alerts are now delegated to the embedding GUI process.
2020-09-06LibWeb: Move DOM event dispatch to its own classAndreas Kling
For now, the new DOM::EventDispatcher is very simple, it just iterates over the set of listeners on an EventTarget and invokes the callbacks as it goes. This simplifies EventTarget subclasses since they no longer have to implement the callback mechanism themselves.
2020-08-31LibWeb: Implement document ready stateLuke
2020-08-26LibJS: Add a helper for calling JS::Function's with argumentsAnotherTest
The fact that a `MarkedValueList` had to be created was just annoying, so here's an alternative. This patchset also removes some (now) unneeded MarkedValueList.h includes.
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.