summaryrefslogtreecommitdiff
path: root/Libraries/LibHTML/Dump.cpp
AgeCommit message (Collapse)Author
2019-10-15LibHTML: Introduce LayoutBox and LayoutNodeWithStyleAndBoxModelMetricsAndreas Kling
To streamline the layout tree and remove irrelevant data from classes that don't need it, this patch adds two new LayoutNode subclasses. LayoutNodeWithStyleAndBoxModelMetrics should be inherited by any layout node that cares about box model metrics (margin, border, and padding.) LayoutBox should be inherited by any layout node that can have a rect. This makes LayoutText significantly smaller (from 140 to 40 bytes) and clarifies a lot of things about the layout tree. I'm also adding next_sibling() and previous_sibling() overloads to LayoutBlock that return a LayoutBlock*. This is okay since blocks only ever have block siblings. Do also note that the semantics of is<T> slightly change in this patch: is<T>(nullptr) now returns true, to facilitate allowing to<T>(nullptr).
2019-10-13LibHTML: Add some convenient geometry getters on LayoutNodeAndreas Kling
Add x(), y(), size() and position() and use them around the codebase.
2019-10-12LibHTML: Add Comment and CharacterData nodes and improve HTML parsingAndreas Kling
This patch adds the CharacterData subclass of Node, which is now the parent class of Text and a new Comment class. A Comment node is one of these in HTML: <!--hello friends--> Since these occur somewhat frequently on the web, we need to be able to parse them. This patch also adds a child rejection mechanism to the DOM tree. Nodes can now override is_child_allowed(Node) and return false if they don't want a particular Node to become a child of theirs. This is used to prevent Document from taking on unwanted children.
2019-10-09LibHTML: Add basic <!DOCTYPE> parsing and a DocumentType classAndreas Kling
Plus, Document::fixup() will now make sure that the document always starts with a doctype node, followed by an <html> element.
2019-10-08LibHTML: Use an enum for CSS property ID'sAndreas Kling
Instead of using string everywhere, have the CSS parser produce enum values, since they are a lot nicer to work with. In the future we should generate most of this code based on a list of supported CSS properties.
2019-10-06LibHTML: Add is<ElementType> and to<ElementType> helper functionsAndreas Kling
These will help us write node-type-aware template functions.
2019-10-06LibHTML: Add adjacent (+) and general (~) sibling combinatorsAndreas Kling
This patch implements two more selector features: - "div + p" matches the <p> sibling immediately after a <div>. - "div ~ p" matches all <p> siblings after a <div>.
2019-10-06LibHTML: Parse descendant relations in CSS selectorsAndreas Kling
"div p" now generates a Selector with two components where the second component is a type=TagName, value="p", relation=Descendant. We still don't handle matching of these, but at least we parse them.
2019-10-06LibHTML: Various little improvements to the CSS parserAndreas Kling
The parser now kinda recognizes immediate child selectors, !important, and various other little things. It's still extremely far from robust and/or correct. :^)
2019-10-04LibHTML: Rename LayoutNode::style_properties() to LayoutNode::style()Andreas Kling
2019-10-04LibHTML: Rename ComputedStyle to BoxModelMetricsAndreas Kling
There was nothing left in ComputedStyle except the box model metrics, so this patch gives it a more representative name. Note that style information is fetched directly from StyleProperties, which is basically the CSS property name/value pairs that apply to an element.
2019-10-03LibHTML: Rewrite inline and text layoutAndreas Kling
Inline layout is now done by LayoutBlock. Blocks with inline children will split them into line boxes during layout. A LayoutBlock can have zero or more LineBox objects. Each LineBox represents one visual line. A LineBox can have any number of LineBoxFragment children. A fragment is an offset+length into a specific LayoutNode. To paint a LayoutBlock with inline children, we walk its line boxes, and walk their fragments, painting each fragment at a time by calling LineBoxFragment::render(), which in turn calls the LayoutNode via LayoutText::render_fragment(). Hit testing works similarly. This is very incomplete and has many bugs, but should make it easier for us to move forward with this code.
2019-10-03LibHTML: Let's put debug output on the debugger streamAndreas Kling
2019-09-30LibHTML: Fix incorrect CSS object modelAndreas Kling
A StyleRule has a StyleDeclaration which has many StyleProperty. :^)
2019-09-28LibHTML: Implement LayoutTextSergey Bugaev
2019-09-28LibHTML: Get rid of the style treeSergey Bugaev
We now create a layout tree directly from the DOM tree. This way we don't actually lose text nodes ^)
2019-08-18LibHTML: Implement basic block height computationAndreas Kling
..and add vertical box properties to the layout tree dumps.
2019-08-18LibHTML: Finish the block width calculationAndreas Kling
Also add horizontal box values to the layout tree dump.
2019-07-04Libraries: Create top level directory for libraries.Andreas Kling
Things were getting a little crowded in the project root, so this patch moves the Lib*/ directories into Libraries/.