Age | Commit message (Collapse) | Author |
|
This sort of thing can be useful to things that don't want to link with
all of LibHTML.
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
Using int was a mistake. This patch changes String, StringImpl,
StringView and StringBuilder to use size_t instead of int for lengths.
Obviously a lot of code needs to change as a result of this.
|
|
|
|
If we peek a combinator at the start of a simple selector, we're seeing
the start of a new complex selector.
|
|
|
|
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. :^)
|
|
Now we just skip over url() and rgb() instead of crashing on them.
|
|
This will allow us to "view source" later on, long after parsing has
finished and turned it into a DOM.
|
|
A selector like "[foo]" is now parsed as a universal selector component
with an attribute match type. Pretty neat :^)
|
|
We were not committing the attribute at all in this case.
|
|
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.
|
|
We were not producing the correct DOM attribute in either of those
cases. "<div attr>" would produce no attribute, and the other would
produce an attribute with null value (instead of an empty value.)
|
|
A rule that contains nothing but whitespace is still a valid rule.
|
|
|
|
|
|
|
|
We only support "px" units (and "auto") but we shouldn't choke just
because someone actually says "10px" instead of just "10"
|
|
This is a very bulky way of doing this, and doesn't seem sustainable to
implement every shorthand property this way, but it's a place to start.
The "margin" CSS property now expands into its four longhands as far as
my understanding of the specs.
Note that shorthand expansion happens when we *resolve* style, not when
we parse CSS. I'm not sure this is correct anymore, I think other UA's
may actually expand shorthands into the declaration directly at parse
these days. If so, we should do this at parsing as well.
|
|
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. :^)
|
|
|
|
|
|
Ultimately we should deal with all the various HTML entitites.
|
|
It should be possible for the CSS parser to fail, and we'll know it
failed if it returns nullptr. Returning RefPtr's makes it actually
possible to return nullptr. :^)
|
|
This simple helper escapes '<', '>' and '&' so they can be used in HTML
text without interfering with the parser.
Use this in IRCClient to prevent incoming messages from messing with
the DOM :^)
|
|
Parsing might not always succeed, so let's have a way to signal errors.
|
|
|
|
This reverts commit f6439789db9c02216baabb197017c7a79a63ba04.
Oops, I committed unrelated changes here, let me clean that up..
|
|
|
|
This function parses a partial DOM and returns it wrapped in a document
fragment node (DocumentFragment.)
There are now two entrances into the HTML parser, one for parsing full
documents, and one for parsing fragments. Internally the both wrap the
same parsing function.
|
|
|
|
There's no reason to run the callbacks before fixing up the tree.
|
|
|
|
This makes sure that values like "auto !important" don't have a space
character after "auto".
|
|
We don't actually do anything with these yet, but now the values will
be there for the selector engine to look at when it feels ready. :^)
|
|
Turn consume_whitespace() into consume_whitespace_or_comments() and
have it swallow /* comments */ as well.
|
|
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.
|
|
We now have create_element(document, tag_name) in ElementFactory.
This will be useful for constructing new elements outside of parsing.
|
|
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.)
|
|
Plus, Document::fixup() will now make sure that the document always
starts with a doctype node, followed by an <html> element.
|
|
Node.normalize() is a standard DOM API that coalesces Text nodes.
To avoid clashing with that, rename it to fixup().
This patch also makes it happen automagically as part of parsing.
|
|
|
|
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 allows us to avoid unnecessary making unnecessary String copies of
all the source text.
|
|
This patch adds basic support for external stylesheets. It currently
only works with file:// URLs.
We do a synchronous full relayout after loading a stylesheet, which is
definitely on the aggressive side, but it gives us something to work
on improving. :^)
|