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.
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.