summaryrefslogtreecommitdiff
path: root/Libraries/LibHTML/Dump.cpp
AgeCommit message (Collapse)Author
2020-01-18Meta: Add license header to source filesAndreas Kling
As suggested by Joshua, this commit adds the 2-clause BSD license as a comment block to the top of every source file. For the first pass, I've just added myself for simplicity. I encourage everyone to add themselves as copyright holders of any file they've added or modified in some significant way. If I've added myself in error somewhere, feel free to replace it with the appropriate copyright holder instead. Going forward, all new source files should include a license header.
2019-11-27LibHTML: Implement compound selectorsAndreas Kling
This patch moves the Selector object model closer to the specification objects in Selectors Level 4. A "Selector" in LibHTML is now a { Vector<ComplexSelector> }, which is a { Relation, CompoundSelector }. A CompoundSelector is really just a Vector<SimpleSelector>, and SimpleSelector is "Component" renamed. This makes a lot more selectors actually match on the Ubuntu Apache2 default homepage. :^)
2019-11-21LibHTML: Implement some attribute selector supportAndreas Kling
This patch adds a[foo] and a[foo=bar] attribute selectors. Note that an attribute selector is an optional part of a selector component, and not a component on its own.
2019-11-19LibHTML: Use LayoutText::text_for_rendering() in layout tree dumpsAndreas Kling
This way the fragment offsets make a lot more sense, since they assume whitespace has already been collapsed.
2019-11-19LibHTML: Implement the universal selector ("*")Andreas Kling
2019-11-18LibHTML: Update tree dumping code now that everything is floating pointAndreas Kling
2019-11-18LibHTML: Start building a simple code generator for CSS propertiesAndreas Kling
Code for parsing and stringifying CSS properties is now generated based on LibHTML/CSS/Properties.json At the moment, the file tells us three things: - The name of a property - Its initial value - Whether it's inherited Also, for shorthand properties, it provides a list of all the longhand properties it may expand too. This is not actually used in the engine yet though. This *finally* makes layout tree dumps show the names of CSS properties in effect, instead of "CSS::PropertyID(32)" and such. :^)
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/.