Age | Commit message (Collapse) | Author |
|
|
|
Add x(), y(), size() and position() and use them around the codebase.
|
|
The layout root is now kept alive via Document::m_layout_root.
This will allow us to do more layout-related things inside the inner
layer of LibHTML without reaching out to the HtmlView.
I'd like to keep HtmlView at a slightly higher level, to prevent it
from getting too complex.
This patch also fixes accidental disconnection of the layout tree from
the DOM after doing a layout tree rebuild. ~LayoutNode() now only
unsets the DOM node's layout_node() if it's itself.
|
|
Just in time for Serenity's 1st birthday, here is the <blink> element!
This patch adds a bunch of different mechanisms to enable partial
repaints of the layout tree (LayoutNode::set_needs_display()))
It also adds LayoutNode::is_visible(), which can be toggled to prevent
a LayoutNode from rendering anything (it still takes up space though.)
|
|
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.
|
|
Since LayoutText always inherits style, it shouldn't store any style of
its own. This patch adds a LayoutNodeWithStyle class to sit between
LayoutNode and everyone who wants to inherit from LayoutNode except
LayoutText :^)
Since LayoutText can never have children, we also know that the parent
of any LayoutNode is always going to be a LayoutNodeWithStyle.
So this patch makes LayoutNode::parent() return LayoutNodeWithStyle*.
|
|
|
|
The default style for "a" tags now has { color: -libhtml-link; }.
We implement this vendor-specific property by querying the containing
document for the appropriate link color.
Currently we only use the basic link color, but in the future this can
be extended to remember visited links, etc.
|
|
LayoutReplaced objects can now participate in inline layout.
It's very hackish, but basically LayoutReplaced will just add itself to
the last line in the containing block.
This patch gets rid of the idea that only LayoutInline subclasses can
be split into lines, by moving the split_into_lines() virtual up to
LayoutNode and overriding it in LayoutReplaced.
|
|
This patch implements basic support for presentational hints, which are
old-school HTML attributes that affect style.
You add support for a presentational hint attribute by overriding
Element::apply_presentational_hints(StyleProperties&) and setting all
of the corresponding CSS properties as appropriate.
To make the background color fill the entire document, not just the
bounds of the <body> element's LayoutNode, we special-case it in the
HtmlView::paint_event() code for now. I'm not entirely sure what the
nicest solution would be, but I'm sure we'll discover it eventually.
|
|
|
|
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.
|
|
This patch makes StyleProperties heap-allocated and ref-counted so that
a LayoutNode can be without one. The ref-counting also allows anonymous
blocks to share style with their parent block.
LayoutText never needs a StyleProperties, since text always inherits
style from its parent element. This is handled by style_properties().
|
|
This also meant I had to implement basic support for the border-styles
"inset" and "outset". If it's neither of those, we default to "solid".
|
|
We currently assume the border-style is solid, and simply draw a box
around the padded LayoutNode rect. :^)
|
|
|
|
|
|
This gets set from HtmlView::mousemove_event() at the moment.
|
|
Every LayoutNode indirectly belongs to some Document. For anonymous
LayoutNodes, we simply traverse the parent chain until we find someone
with a Node from which we can get a Document&.
|
|
LayoutText can't simply rely on its LayoutNode::rect() for hit testing.
Instead, we have to iterate over the individual runs and see if we're
hitting any of them.
Also, LayoutNode::hit_test() now always recurses into children, since
we can't trust the rect() to tell the truth (inline rects are wrong.)
|
|
We don't have proper line boxes yet, so we can't easily hit test
inline text.
|
|
|
|
We now create a layout tree directly from the DOM tree.
This way we don't actually lose text nodes ^)
|
|
|
|
Things were getting a little crowded in the project root, so this patch
moves the Lib*/ directories into Libraries/.
|