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.
These will be useful for implementing various things. They don't do any
caching at the moment, but that might become valuable in the future.
To facilitate this change, I also made it possible to abort a tree walk
with for_each_in_subtree() by returning IterationDecision::Break from
the callback.
HtmlView will now invoke the on_link_hover hook when the cursor enters
or leaves a DOM node that has an enclosing link element.
This patch also updates the meaning of Node::enclosing_link_element()
to find the nearest HTMLAnchorElementAncestor *with an href attribute*.
Use a zero-timer to schedule a style update after invalidating style
on any node. Nodes now have a needs_style_update flag which helps us
batch and coalesce the work.
We also start style updates at the root and work our way through the
document, updating any node that has the needs_style_update flag set.
This is slower than what we were doing before, but far more correct.
There is a ton of room for improvement here. :^)
This patch makes it possible to call Node::invalidate_style() and have
that node and all of its ancestors recompute their style.
We then figure out if the new style is visually different from the old
style, and if so do a paint invalidation with set_needs_display().
Note that the "are they visually different" code is very incomplete!
Use this to make hover effects a lot more efficient. They no longer
cause a full relayout+repaint, but only a style invalidation.
Style invalidations are still quite heavy though, and there's a lot of
room for improvement there. :^)
These helpers return the next/previous sibling Node that's actually an
element. This will be useful in the CSS engine since CSS doesn't care
about text nodes.
Instead of branching on the Node type, let subclasses decide how their
layout nodes get constructed.
This will allow elements to create custom layout nodes if they want.
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.
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().
We now show a tooltip for the hovered node's enclosing HTML element's
title attribute, if one is present.
This patch also adds HTMLHeadingElement. The tags h1-h6 will now create
the right kind of objects.
This also fixes another bug with inline wrappers. Namely,
we should only add inline wrappers if a block node has
both non-block (inline or text) and block children.