summaryrefslogtreecommitdiff
path: root/Libraries/LibWeb
AgeCommit message (Collapse)Author
2020-06-21LibJS+LibWeb: Add JS::Object::inherits(class_name)Andreas Kling
To allow implementing the DOM class hierarchy in JS bindings, this patch adds an inherits() function that can be used to ask an Object if it inherits from a specific C++ class (by name). The necessary overrides are baked into each Object subclass by the new JS_OBJECT macro, which works similarly to C_OBJECT in LibCore. Thanks to @Dexesttp for suggesting this approach. :^)
2020-06-21LibWeb: Add HTMLElement wrapperAndreas Kling
Expose the "title" attribute just to expose something. :^)
2020-06-21LibWeb: Add EventTarget.removeEventListener()Andreas Kling
2020-06-21LibWeb: Generate EventTarget bindings from IDL :^)Andreas Kling
2020-06-21LibWeb: Add Element.tagName and Element.classNameAndreas Kling
2020-06-21LibWeb: Generate Element bindings from IDL :^)Andreas Kling
Had to do a bunch more hacking on WrapperGenerator to support this. We now support attribute setters as well.
2020-06-21LibWeb: Update parser with more insertion modes :^)stelar7
Implements handling of InHeadNoScript, InSelectInTable, InTemplate, InFrameset, AfterFrameset, and AfterAfterFrameset.
2020-06-21LibGfx: Add BMP loaderMatthew Olsson
Adds an *almost fully featured BMP loader to process .bmp files. Features: - All header formats are supported - Full RLE4/8/24 support - Color scaling (e.g. distributing a 5-bit color throughout the 8-bit color spectrum, so 5-bit white is still 0xffffff) - Full BITMASK/ALPHABITMASK support *Not included: - 1D Huffman compression. Good luck actually finding a bmp in the wild that uses this - Use of any field in the V4/V5 header. Color spaces? Endpoints? No thanks :) This loader was tested with the images at https://entropymine.com/jason/bmpsuite/bmpsuite/html/bmpsuite.html. This loader correctly displays 81 out of the 90 total images (for reference, firefox displays 64 correctly). Note that not rendering the images at the bottom is counted as displaying correctly.
2020-06-21LibWeb: Assume URLs ending in / serve html content :^)stelar7
2020-06-21LibWeb: Respect display:none on <input> elementsMaciej Sobaczewski
2020-06-21LibWeb: Fix build after atob/btoa changesAndreas Kling
2020-06-21LibWeb: Expose Node.appendChild() to the webAndreas Kling
This is a very barebones implementation of appendChild() that doesn't take any of the idiosyncratic DOM behaviors into account yet. Also teach the wrapper generator how to turn an Interpreter argument into a Node&.
2020-06-21LibWeb: Expose Document.body to the webAndreas Kling
Also, make it return a HTMLElement since Document.body should actually return the frameset element in a frame-based document.
2020-06-21LibWeb: Expose Document.createElement() to the webAndreas Kling
2020-06-21LibWeb: Fix missing snake_case-ificiation of function parameter namesAndreas Kling
2020-06-21LibWeb: Add Node.parentNode and Node.parentElement to DOM API :^)Andreas Kling
2020-06-21LibWeb+LibJS: Add a naive way to check if a wrapper "is" a certain typeAndreas Kling
Instead of only checking the class_name(), we now generate an is_foo() virtual in the wrapper generator. (It's currently something we override on Bindings::Wrapper, which is not really scalable.) Longer term we'll need to think up something smarter for verifying that one wrapper "is" another type of wrapper.
2020-06-21LibWeb: Start generating JS wrappers from (simplified) WebIDL :^)Andreas Kling
This patch introduces a hackish but functional IDL parser and uses it to generate the JS bindings for Node and Document. We'll see how far this simple parser takes us. The important thing right now is generating code, not being a perfect IDL parser. :^)
2020-06-20LibWeb: Add atob/btoa to WindowObjectJoel Puig Rubio
2020-06-20LibWeb: Add some missing wrapper calls to base class initialize()Andreas Kling
This is easy to forget, but the problem will go away once we start to auto-generate this code.
2020-06-20LibWeb: Give the DOM Window object a (weak) pointer to its JS wrapperAndreas Kling
2020-06-20LibWeb: JS wrappers need to call base class initialize()Andreas Kling
2020-06-20LibWeb: Split JS wrapper constructors into construct/initializeAndreas Kling
2020-06-20LibJS: Make Value::to_object() take a GlobalObject&Andreas Kling
2020-06-20LibJS: Move native objects towards two-pass constructionAndreas Kling
To make sure that everything is set up correctly in objects before we start adding properties to them, we split cell allocation into 3 steps: 1. Allocate a cell of appropriate size from the Heap 2. Call the C++ constructor on the cell 3. Call initialize() on the constructed object The job of initialize() is to define all the initial properties. Doing it in a second pass guarantees that the Object has a valid Shape and can find its own GlobalObject.
2020-06-20LibJS: Pass GlobalObject& to native functions and property accessorsAndreas Kling
More work towards supporting multiple global objects. Native C++ code now get a GlobalObject& and don't have to ask the Interpreter for it. I've added macros for declaring and defining native callbacks since this was pretty tedious and this makes it easier next time we want to change any of these signatures.
2020-06-18LibWeb: Fix broken #include after moving files aroundAndreas Kling
2020-06-18LibWeb: Move StackingContext from Layout/ to Painting/Andreas Kling
The stacking context tree doesn't affect layout at all, so let's move it into the Painting/ directory. I'm not sure yet if it's worth going for a fullly separate painting tree. So far I'm thinking a stacking context tree with pointers into the layout tree might be enough.
2020-06-18LibWeb: Rename LayoutNode::render() to paint()Andreas Kling
"Paint" matches what we call this in the rest of the system. Let's not confuse things by mixing paint/render/draw all the time. I'm guilty of this in more places.. Also rename RenderingContext => PaintContext.
2020-06-18LibWeb: Respect min-width and max-width on position:absolute elementsAndreas Kling
2020-06-18LibWeb: More work on width of position:absolute elementsAndreas Kling
The shrink-to-fit width algorithm actually works a little bit different in the absolute positioning context, so it can't share all of its code with non-absolute positioning. Also, inline-block elements were always inserting unnecessary line breaks when splitting, which caused the preferred width to be smaller than it should be. This patch fixes that as well, by just not breaking after inline-block elements in LayoutMode::OnlyRequiredLineBreaks.
2020-06-18LibWeb: Separate layout tree rendering into phasesAndreas Kling
CSS defines a very specific paint order. This patch starts steering us towards respecting that by introducing the PaintPhase enum with values: - Background - Border - Foreground - Overlay (internal overlays used by inspector) Basically, to get the right visual result, we have to render the page multiple times, going one phase at a time.
2020-06-18LibWeb: Better width computation for position:absolute blocksAndreas Kling
This patch basically translates the CSS2.2 spec language into C++ for computing the width of absolutely positioned non-replaced elements.
2020-06-17LibWeb: Add PageClient::palette() for view-agnostic palette accessAndreas Kling
2020-06-17LibWeb: Make RenderingContext use Gfx::Painter instead of GUI::PainterAndreas Kling
2020-06-16LibWeb: Make Element::tag_name() return a const FlyString&Andreas Kling
The more generic virtual variant is renamed to node_name() and now only Element has tag_name(). This removes a huge amount of String ctor/dtor churn in selector matching.
2020-06-15LibWeb: Fix broken parsing of </form> during "in body" insertionAndreas Kling
2020-06-15LibWeb: Don't load stylesheets with rel="alternate"Andreas Kling
We're not supposed to load these by default. Alternate stylesheets can be offered in a menu or something, if the user is interested.
2020-06-15LibWeb: Fix broken parsing of </select> during "in select" insertionAndreas Kling
2020-06-15LibWeb: Just ignore <script> elements that failed to load the scriptAndreas Kling
We're never gonna be able to run them if we can't load them so just let it go.
2020-06-15LibWeb: Use the URL encoder from AK instead of rolling a custom oneAndreas Kling
2020-06-15LibWeb: Force a full relayout if an element's CSS display changesAndreas Kling
Not doing this was causing the wrong kind of LayoutNode to stay around even though we had the final "display" value.
2020-06-15LibWeb: Allow block children of inlinesAndreas Kling
Hey, why not. We did all the hard work for display:inline-block already and now we can just allow this. This makes <a><h1>Hello friends!</h1></a> work :^)
2020-06-15LibWeb: Respect CSS z-index property while paintingAndreas Kling
To support z-ordering when painting, the layout tree now has a parallel sparse tree of stacking contexts. The rules for which layout boxes establish a stacking context are a bit complex, but the intent is to encapsulate the decision making into establishes_stacking_context(). When we paint, we start from the ICB (LayoutDocument) who always has a StackingContext and then paint the tree of StackingContexts where each node has its children sorted by z-index. This is pretty crude, but gets the basic job done. Note that this does not yet support hit testing; hit testing is still done using a naive treewalk from the root.
2020-06-15LibWeb: Layout nodes without own style can't be absolutely positionedAndreas Kling
The only layout nodes that don't have their own style are LayoutText (they inherit the style from their parent element since text cannot be styled by CSS.) However, it never makes sense for text nodes to have absolute position so don't claim it.
2020-06-14LibWeb: Make the specificity sort comparator a bit more readableAndreas Kling
2020-06-14LibWeb: Don't assert when containing block doesn't know how to placeAndreas Kling
We can just log that we don't know what to do for now.
2020-06-14LibWeb: Don't animate images outside the visible viewport :^)Andreas Kling
2020-06-14LibWeb: Move "visible in viewport" state tracking to ImageLoaderAndreas Kling
This should technically apply to any LayoutImage, so let's just move it to ImageLoader.
2020-06-14LibWeb: Move bitmap animation from HTMLImageElement to ImageLoaderAndreas Kling
Since ImageLoader manages the image decoder anyway, let it manage animation as well.