Age | Commit message (Collapse) | Author |
|
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).
|
|
Add x(), y(), size() and position() and use them around the codebase.
|
|
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.
|
|
Plus, Document::fixup() will now make sure that the document always
starts with a doctype node, followed by an <html> element.
|
|
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.
|
|
These will help us write node-type-aware template functions.
|
|
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>.
|
|
"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.
|
|
The parser now kinda recognizes immediate child selectors, !important,
and various other little things.
It's still extremely far from robust and/or correct. :^)
|
|
|
|
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.
|
|
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.
|
|
|
|
A StyleRule has a StyleDeclaration which has many StyleProperty. :^)
|
|
|
|
We now create a layout tree directly from the DOM tree.
This way we don't actually lose text nodes ^)
|
|
..and add vertical box properties to the layout tree dumps.
|
|
Also add horizontal box values to the layout tree dump.
|
|
Things were getting a little crowded in the project root, so this patch
moves the Lib*/ directories into Libraries/.
|