summaryrefslogtreecommitdiff
path: root/Libraries/LibWeb/DOM
AgeCommit message (Collapse)Author
2020-05-15LibJS: Let parser keep track of errorsLinus Groh
Rather than printing them to stderr directly the parser now keeps a Vector<Error>, which allows the "owner" of the parser to consume them individually after parsing. The Error struct has a message, line number, column number and a to_string() helper function to format this information into a meaningful error message. The Function() constructor will now include an error message when throwing a SyntaxError.
2020-05-12LibGUI: Include keyboard modifier state with button on_click callsAndreas Kling
This will allow you us to implement special behavior when Ctrl+clicking a button.
2020-05-10LibWeb: Add Document create_element() and create_text_node() helpersAndreas Kling
2020-05-09Meta: Delete empty .cpp filesLinus Groh
2020-05-09LibWeb: Implicitly close all subpaths when canvas.fill() is calledAnotherTest
2020-05-09LibWeb: Add support for animated images to HTMLImageElementPeter Nelson
Uses a Core::Timer (similar to HTMLBlinkElement) to transition between frames of an animated image. Also keeps track of the number of animation loops.
2020-05-06LibWeb: Add canvas.fillAnotherTest
This implements only one of the two forms of this function, ctx.fill(winding_rule). Also tweaks the quadratic curve demo to have a nice looking filled shape.
2020-05-05LibWeb: Add support for "display: inline-block"Andreas Kling
This display type is implemented using a LayoutBlock that is_inline(). Basically it behaves like a block internally, and its children are laid out in the normal block layout fashion. Externally however, it behaves like an atomic inline-level box. Layout of inline-block boxes happens in three stages: 1. The outer dimensions of the block are computed during the recursive normal layout pass. We skip positioning, but lay out children. 2. Later on, during line layout in the *containing block*, the inline block now contributes a linebox fragment. When linebox fragments are positioned, we learn the final position of the inline block. That's when we set the inline block's position. 3. We re-layout the inline block's children once again. This is done to make sure they end up in the right position. The layout tree doesn't use relative offsets, so after we position the inline block in (2), its children will not have its positions updated. Relayout moves all children of inline blocks to the right place. This is a rather naive approach but it does get the basic behavior into place so we can iterate on it. :^)
2020-05-05LibWeb: Fall back to LayoutInline for any unrecognized CSS displayAndreas Kling
Let's at least try to keep going and see what we can render.
2020-05-05LibWeb: Add basic URL encoder for individual values and param listsShadowfacts
2020-05-05LibWeb: When creating form action URL, only include value for the submitShadowfacts
that was used to submit the form
2020-05-05LibWeb: Improve <form> submit method handlingShadowfacts
The spec defines the only valid methods to be get, post, and dialog. Post and dialog are currently unhandled and do nothing, any other value (or no value specified) is defined by the spec to use the get method.
2020-05-05LibWeb: Add canvas.quadraticCurveTo()AnotherTest
Also adds a test, and removes debug spam :tm:
2020-05-04LibWeb: Respect the <input size> attribute a bit more :^)Andreas Kling
We now use the size attribute to determine the width of a text input.
2020-05-04LibWeb: Don't generate a layout node for <input type="hidden">Andreas Kling
2020-05-03ProtocolServer: Pass HTTP response headers to the clientAndreas Kling
We now store the response headers in a download object on the protocol server side and pass it to the client when finishing up a download. Response headers are passed as an IPC::Dictionary. :^)
2020-04-29LibJS: Pass JS::Function around by reference moreAndreas Kling
2020-04-29LibWeb: Make EventListener::function() return a referenceAndreas Kling
2020-04-24LibWeb: Pass link target to HtmlView's on_link_click callbackLinus Groh
2020-04-23LibWeb: Add XMLHttpRequest.readyState and constantsLinus Groh
2020-04-22LibWeb: Invalidate the canvas element after put_image_data()Andreas Kling
This makes sure we repaint it right away so we can see the changes.
2020-04-21LibWeb: Add ImageData objects and implement 2D context putImageData()Andreas Kling
An ImageData is a wrapper around a Bitmap wrapper around a JS::Uint8ClampedArray.
2020-04-21LibWeb: Hack requestAnimationFrame() to provide a (very fake) timestampAndreas Kling
2020-04-19LibJS: Add MarkedValueList and use it for argument passingAndreas Kling
A MarkedValueList is basically a Vector<JS::Value> that registers with the Heap and makes sure that the stored values don't get GC'd. Before this change, we were unsafely keeping Vector<JS::Value> in some places, which is out-of-reach for the live reference finding logic since Vector puts its elements on the heap by default. We now pass all the JavaScript tests even when running with "js -g", which does a GC on every heap allocation.
2020-04-17LibWeb: Implement JS confirm()Nick Tiberi
2020-04-16LibWeb: Implement CanvasRenderingContext2D::stroke_rect() with linesAndreas Kling
Stroking rects by drawing individual lines gives us line width support without having to extend the Painter::draw_rect() code. :^)
2020-04-16LibWeb: Add some basic path drawing functionality to the canvas elementAndreas Kling
This patch adds the following methods to CanvasRenderingContext2D: - beginPath() - moveTo(x, y) - lineTo(x, y) - closePath() - stroke() We also add the lineWidth property. :^)
2020-04-15LibWeb: Use Checked<T> when creating <canvas> bitmap buffersAndreas Kling
2020-04-15LibWeb: Limit the maximum size of <canvas> bitmap buffersAndreas Kling
We will no longer create bitmap buffers for canvases that exceed a total area of (16384 * 16384) pixels. This matches what some other browser do. Thanks to @itamar8910 for finding this! :^)
2020-04-14LibWeb: Add CanvasRenderingContext2D.drawImage(image, x, y)Andreas Kling
This function allows you to draw a loaded <img> element into a canvas.
2020-04-14LibWeb: Add a JavaScript wrapper for HTMLImageElement :^)Andreas Kling
2020-04-14LibWeb: Add is<HTMLImageElement>()Andreas Kling
2020-04-14LibWeb: Dispatch a "load" event on HTMLImageElementAndreas Kling
2020-04-13LibJS: Do not execute scripts with parse errorsStephan Unverwerth
This adds missing checks in several LibJS consumers.
2020-04-12LibWeb: Use an AffineTransform for CanvasRenderingContext2D :^)Andreas Kling
This will allow us to support complex 2D transforms.
2020-04-11LibWeb: Prevent http:// URLs loading scripts sourced from file:// URLsBrendan Coles
Fixes #1616
2020-04-08LibWeb: Support relative URL's in XMLHttpRequestAndreas Kling
In order to complete a relative URL, we need a Document. Fix this by giving XMLHttpRequest a pointer to its window object. Then we can go from the window to the document, and then we're home free. :^)
2020-04-08LibWeb: Add XMLHttpRequest object :^)Andreas Kling
This patch adds very basic XMLHttpRequest support to LibWeb. Here's an example that currently works: var callback = function() { alert(this.responseText); } var xhr = new XMLHttpRequest(); xhr.addEventListener("load", callback); xhr.open("GET", "http://serenityos.org/~kling/test/example.txt"); xhr.send(); There are many limitations and bugs, but it's pretty dang awesome that we have XHR. :^)
2020-04-08LibWeb: Make CanvasRenderingContext2D use floats instead of intsAndreas Kling
This matches what we already do for the layout tree and things are expected to work this way regardless.
2020-04-08LibWeb: Add canvas.strokeRect(), and fix scale & translateBrian Gianforcaro
Add an implementation of CanvasRenderingContext2DWrapper.strokeRect(). While implementing this I fixed fillRect() and the new strokeRect() to honor the .scale() and .translate() values that had previously been plumbed. Also enhance the canvas.html demo to utilize strokeRect(), scale(), and translate().
2020-04-07LibWeb: Add Origin concept (protocol, host, port tuple)Andreas Kling
Every Document now has an Origin, found via Document::origin(). It's based on the URL of the document. This will be used to implement things like the same-origin policy.
2020-04-07LibCore: Add Core::Timer::create_single_shot()Andreas Kling
This is just a convenience function for creating single-shot timers.
2020-04-06Meta: Add missing copyright headersAndreas Kling
2020-04-05AK: Stop allowing implicit downcast with RefPtr and NonnullRefPtrAndreas Kling
We were allowing this dangerous kind of thing: RefPtr<Base> base; RefPtr<Derived> derived = base; This patch changes the {Nonnull,}RefPtr constructors so this is no longer possible. To downcast one of these pointers, there is now static_ptr_cast<T>: RefPtr<Derived> derived = static_ptr_cast<Derived>(base); Fixing this exposed a ton of cowboy-downcasts in various places, which we're now forced to fix. :^)
2020-04-05LibWeb: Add window.setTimeout()Andreas Kling
This also leaks the timer just like setInterval() (FIXME).
2020-04-04LibWeb: Add CanvasRenderingContext2D scale() and translate() stubsAndreas Kling
These don't do anything for now.
2020-04-04LibWeb: Handle javascript: URLs inside LibWeb :^)Andreas Kling
This patch makes it possible to execute JavaScript by clicking on an anchor element with href="javascript:your_script_here()".
2020-04-03LibWeb: Implement <script src> support for synchronous scriptsAndreas Kling
Scripts loaded in this way will block the parser until they finish executing. This means that they see the DOM before the whole document has been fully parsed. This is all normal, of course. To make this work, I changed the way we notify DOM nodes about tree insertion. The inserted_into() callbacks are now incrementally invoked during parse, as each node is appended to its parent. To accomodate inline scripts and inline style sheets, we now also have a children_changed() callback which is invoked on any parent when it has children added/removed.
2020-04-01LibJS: Add Interpreter::create<GlobalObjectType>()Andreas Kling
Force Interpreter construction to go via a create() helper that takes the global object type as a template parameter.
2020-04-01LibWeb+LibJS: Move DOM Window object to dedicated classesAndreas Kling
LibWeb now creates a WindowObject which inherits from GlobalObject. Allocation of the global object is moved out of the Interpreter ctor to allow for specialized construction. The existing Window interfaces are moved to WindowObject with their implementation code in the new Window class.