summaryrefslogtreecommitdiff
path: root/Libraries/LibWeb
AgeCommit message (Collapse)Author
2020-03-26Base: Replace <!DOCTYPE> with <!DOCTYPE html> in a few files (#1511)Elisée Maurer
<!DOCTYPE> by itself is not a valid document type declaration.
2020-03-25LibWeb: Implement getting and setting element.innerHTMLAndreas Kling
Getting the innerHTML property will recurse through the subtree inside the element and serialize it into a string as it goes. Setting it will parse the set value as an HTML fragment. It will then remove all current children of the element and replace them with all the children inside the parsed fragment. Setting element.innerHTML will currently force a complete rebuild of the document's layout tree. This is pretty neat! :^)
2020-03-25LibWeb: Add ParentNode::remove_all_children()Andreas Kling
This safely removes all children from a Node.
2020-03-25LibWeb: Add Document::invalidate_layout()Andreas Kling
This function allows you to throw away the entire layout tree if that's something you want to do. It's certainly not super cheap to reconstruct, but hey, who am I to tell you what to do? :^)
2020-03-25LibWeb: Commit uncommitted text at the end of HTML parseAndreas Kling
If there's any text left in the parse buffer at the end of HTML parsing we now commit it as a Text node.
2020-03-25LibWeb: Make dump_tree() look okay for DocumentFragmentsAndreas Kling
2020-03-25LibWeb: Detach any LayoutNode from its parent if present in ~Node()Andreas Kling
2020-03-25LibWeb: Node::is_parent_node() should return true for DocumentFragmentsAndreas Kling
2020-03-25LibWeb: Remove debug spam about getting a 2D canvas contextAndreas Kling
2020-03-23 LibWeb: CSS: Add "position: absolute" with top and leftmyphs
This momentarily handles the CSS property "position: absolute;" in combination with the properties "top" and "left", so that elements can be placed anywhere on the page independently from their parents. Statically positioned elements ignore absolute positioned elements when calculating their position as they don't take up space.
2020-03-22LibWeb: Implement cancelAnimationFrame()Andreas Kling
These functions (rAF and cAF) should eventually stop using raw ID's from GUI::DisplayLink as their identifiers. That's a FIXME for now. :^)
2020-03-22LibWeb: Add basic support for requestAnimationFrame()Andreas Kling
We now support rAF, driven by GUI::DisplayLink callbacks. It's a bit strange how we keep registering new callbacks over and over. That's something we can definitely optimize. This allows you to update animations/whatever without doing it more often than the browser can display.
2020-03-22LibWeb: Use FlyString for DOM event namesAndreas Kling
2020-03-22LibWeb: Use FlyString for Element tag namesAndreas Kling
This makes selector matching a lot more efficient, and also reduces the number of strings on the heap.
2020-03-22LibWeb: Use FlyString for element attribute namesAndreas Kling
Attribute names occur again and again.
2020-03-22LibJS: Use FlyString for identifiersAndreas Kling
This makes variable and property lookups a lot faster since comparing two FlyStrings is O(1).
2020-03-22AK: Add FlyString, a simple flyweight string classAndreas Kling
FlyString is a flyweight string class that wraps a RefPtr<StringImpl> known to be unique among the set of FlyStrings. The class is very unoptimized at the moment. When to use FlyString: - When you want O(1) string comparison - When you want to deduplicate a lot of identical strings When not to use FlyString: - For strings that don't need either of the above features - For strings that are likely to be unique
2020-03-22LibWeb: Put selection-related debug spam behind an #ifdefAndreas Kling
2020-03-21LibWeb: Add a naive implementation of setInterval()Andreas Kling
This implementation leaks a Core::Timer whenever you call setInterval() so it will definitely need some improvements, but it does kinda work!
2020-03-21LibWeb: Silence some debug spam about JS event handler invocationsAndreas Kling
2020-03-21LibWeb: Give MouseEvents the correct offsetX and offsetY valuesAndreas Kling
2020-03-21LibWeb: Add a DOM Event class (instead of events being simple strings)Andreas Kling
This patch adds the Event base class, along with a MouseEvent subclass. We now dispatch MouseEvent objects for mousedown, mouseup and mousemove and these objects have the .offsetX and .offsetY properties. Both of those properties are hard-coded at the moment. This will be fixed in the next patch. :^)
2020-03-21LibWeb: Dispatch "mouseup" eventAndreas Kling
This is a very naive implementation that doesn't account for where the mousedown happened.
2020-03-21LibWeb: Add HTMLCanvasElement.{width,height} propertiesAndreas Kling
2020-03-21LibWeb: Make the "document" global a native propertyAndreas Kling
This defers construction of the document wrapper until actually needed.
2020-03-21LibJS+LibWeb: Fix some inconsistencies in NativeFunction callbacksAndreas Kling
These should always pass the arguments in a const Vector<JS::Value>&.
2020-03-20LibWeb: Add CSS property 'border'myphs
This makes it possible to write shorter CSS. Instead of writing .foo { border-width: 3px; border-style: solid; border-color: blue; } it is now possible to write .foo { border: 3px solid blue; } while the order of values is irrelevant. Currently only the basic values are supported. More values should be added in the future. Three more value specific parse functions were added: parse_line_width, parse_color, and parse_line_style Additionally a few test cases were added to borders.html.
2020-03-20LibWeb: Fix HTMLCanvasElement::preferred_height() default value (#1490)Elisée Maurer
The correct height is 150px rather than 300px.
2020-03-20LibWeb: Make hit testing better for blocks with inline childrenAndreas Kling
If we don't hit one of the inline children, we should still report that we've hit the block itself.
2020-03-19LibWeb: Add <canvas> element and start fleshing out CRC2DAndreas Kling
This patch adds HTMLCanvasElement along with a LayoutCanvas object. The DOM and layout parts are very similar to <img> elements. The <canvas> element holds a Gfx::Bitmap which is sized according to the "width" and "height" attributes on the element. Calling .getContext("2d") on a <canvas> element gives you a context object that draws into the underlying Gfx::Bitmap of the <canvas>. The context weakly points to the <canvas> which allows it to outlive the canvas element if needed. This is really quite cool. :^)
2020-03-18LibWeb: Add missing copyright headersAndreas Kling
2020-03-18LibWeb: Use a JS::Handle to keep the EventListener function aliveAndreas Kling
2020-03-18LibWeb: Fire "mousedown" and "mousemove" events in the DOM :^)Andreas Kling
2020-03-18LibWeb: Start working on DOM event supportAndreas Kling
This patch adds the EventTarget class and makes Node inherit from it. You can register event listeners on an EventTarget, and when you call dispatch_event() on it, the event listeners will get invoked. An event listener is basically a wrapper around a JS::Function*. This is pretty far from how DOM events should eventually work, but it's a place to start and we'll build more on top of this. :^)
2020-03-18LibWeb: Don't try to repaint frameless documents in CSSStyleValueAndreas Kling
2020-03-16LibJS: Add "Heap" and "Runtime" subdirectoriesAndreas Kling
Let's try to keep LibJS tidy as it expands. :^)
2020-03-15LibJS: Pass "this" as an Object* to NativeFunction callbacksAndreas Kling
Instead of every NativeFunction callback having to ask the Interpreter for the current "this" value and then converting it to an Object etc, just pass "this" as an Object* directly.
2020-03-15LibWeb: Add missing copyright headersAndreas Kling
2020-03-14LibWeb: Implement Document.getElementById()Andreas Kling
This was pleasantly simple! We don't have an ElementWrapper yet, so it just returns a NodeWrapper, but it still basically works. :^)
2020-03-14LibWeb: Start implementing basic JavaScript DOM bindingsAndreas Kling
This patch introduces the Wrapper and Wrappable classes. Node now inherits from Wrappable, and can be wrapped in a GC-allocated Bindings::NodeWrapper object. The only property we expose right now is the very simple nodeName property. When a Document's JS::Interpreter is first instantiated, we add a "document" property with a DocumentWrapper object to the global object. This is pretty cool! :^)
2020-03-14LibWeb: Parse <script> elements and run any JavaScript found insideAndreas Kling
This patch begins integrating LibJS into LibWeb. Document holds the JS::Interpreter for now, and it is created on demand when you first call Document::interpreter(). We also add a simple "alert()" function to the global object.
2020-03-11LibWeb: Skip non-font files when looking for fonts instead of assertingTibor Nagy
2020-03-07LibWeb: Cache the <body background> style image valueAndreas Kling
This way we don't refetch the background image every time style is recomputed (e.g when hovering different elements.)
2020-03-07LibWeb: Rename directory LibHTML => LibWebAndreas Kling
Let's rename this to LibWeb since it aims to provide more parts of the web platform than just HTML. :^)