summaryrefslogtreecommitdiff
path: root/Libraries/LibHTML/Parser
AgeCommit message (Collapse)Author
2020-02-13AK: Move escape_html_entities() from LibHTML to AKAndreas Kling
This sort of thing can be useful to things that don't want to link with all of LibHTML.
2020-01-18Meta: Add license header to source filesAndreas Kling
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.
2019-12-30LibHTML: Ignore all CSS rules starting with "@" for nowAndreas Kling
2019-12-26LibHTML: Remove fixed FIXMEShannon Booth
2019-12-16LibHTML: Support the :only-child pseudo classAndreas Kling
2019-12-16LibHTML: Support the :empty pseudo classAndreas Kling
2019-12-16LibHTML: Support the :first-child and :last-child pseudo classesAndreas Kling
2019-12-09AK: Use size_t for the length of stringsAndreas Kling
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.
2019-11-28LibHTML: Just swallow :not selectors for nowAndreas Kling
2019-11-28LibHTML: CSS parser should accept "foo>bar", not just "foo > bar"Andreas Kling
If we peek a combinator at the start of a simple selector, we're seeing the start of a new complex selector.
2019-11-28LibHTML: Update CSS parser with terminology from Selectors Level 4Andreas Kling
2019-11-27LibHTML: Implement compound selectorsAndreas Kling
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. :^)
2019-11-25LibHTML: Improve CSS parser's handling of values somewhatAndreas Kling
Now we just skip over url() and rgb() instead of crashing on them.
2019-11-25LibHTML: Store the HTML parser input along with the created DocumentAndreas Kling
This will allow us to "view source" later on, long after parsing has finished and turned it into a DOM.
2019-11-21LibHTML: Handle stand-alone attribute selectorsAndreas Kling
A selector like "[foo]" is now parsed as a universal selector component with an attribute match type. Pretty neat :^)
2019-11-21LibHTML: Parse <element attribute=value> correctlyAndreas Kling
We were not committing the attribute at all in this case.
2019-11-21LibHTML: Implement some attribute selector supportAndreas Kling
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.
2019-11-21LibHTML: Make the HTML parser handle <div attr> and <div attr="">Andreas Kling
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.)
2019-11-19LibHTML: Tolerate empty CSS rulesAndreas Kling
A rule that contains nothing but whitespace is still a valid rule.
2019-11-19LibHTML: Implement the universal selector ("*")Andreas Kling
2019-11-18LibHTML: Implement some basic floating point CSS value parsingAndreas Kling
2019-11-18LibHTML: Use floating point numbers throughout the layout treeAndreas Kling
2019-11-18LibHTML: Tolerate "px" suffix on CSS lengthsAndreas Kling
We only support "px" units (and "auto") but we shouldn't choke just because someone actually says "10px" instead of just "10"
2019-11-18LibHTML: Implement the "margin" shorthand propertyAndreas Kling
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.
2019-11-18LibHTML: Start building a simple code generator for CSS propertiesAndreas Kling
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. :^)
2019-11-07LibHTML: Ignore case in <!DOCTYPE> tags :^)Andreas Kling
2019-11-07LibHTML: Don't swallow '}' as part of CSS property valuesAndreas Kling
2019-11-07LibHTML: Turn "&mdash;" into "-" in the parser for nowAndreas Kling
Ultimately we should deal with all the various HTML entitites.
2019-11-07LibHTML: Make the CSS parser return RefPtr'sAndreas Kling
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. :^)
2019-11-06LibHTML+IRCClient: Add an escape_html_entities() helperAndreas Kling
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 :^)
2019-11-06LibHTML: Make parse_html_document() return a RefPtrAndreas Kling
Parsing might not always succeed, so let's have a way to signal errors.
2019-11-06LibHTML: Rename parse_html() => parse_html_document()Andreas Kling
2019-11-06Revert "LibHTML: Rename parse_html() => parse_html_document()"Andreas Kling
This reverts commit f6439789db9c02216baabb197017c7a79a63ba04. Oops, I committed unrelated changes here, let me clean that up..
2019-11-06LibHTML: Rename parse_html() => parse_html_document()Andreas Kling
2019-11-06LibHTML: Add parse_html_fragment()Andreas Kling
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.
2019-10-20LibHTML: The CSS parser should tolerate whitespace-only stylesheetsAndreas Kling
2019-10-19LibHTML: Do DOM tree fixup before firing insertion callbacksAndreas Kling
There's no reason to run the callbacks before fixing up the tree.
2019-10-19LibHTML: Skip over CSS @media rules for nowAndreas Kling
2019-10-18LibHTML: CSS parser should trim whitespace from valuesAndreas Kling
This makes sure that values like "auto !important" don't have a space character after "auto".
2019-10-14LibHTML: Parse the :link and :hover CSS pseudo-classesAndreas Kling
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. :^)
2019-10-13LibHTML: Handle comments in the CSS parserAndreas Kling
Turn consume_whitespace() into consume_whitespace_or_comments() and have it swallow /* comments */ as well.
2019-10-12LibHTML: Add Comment and CharacterData nodes and improve HTML parsingAndreas Kling
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.
2019-10-12LibHTML: Move Element construction to a separate fileAndreas Kling
We now have create_element(document, tag_name) in ElementFactory. This will be useful for constructing new elements outside of parsing.
2019-10-09LibHTML: Implement the <blink> elementAndreas Kling
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.)
2019-10-09LibHTML: Add basic <!DOCTYPE> parsing and a DocumentType classAndreas Kling
Plus, Document::fixup() will now make sure that the document always starts with a doctype node, followed by an <html> element.
2019-10-09LibHTML: Rename Document::normalize() to fixup() and always do itAndreas Kling
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.
2019-10-09LibHTML: Handle CSS declarations that don't end in ';'Andreas Kling
2019-10-08LibHTML: Use an enum for CSS property ID'sAndreas Kling
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.
2019-10-07LibHTML: Make the CSS and HTML parsers take StringViewsAndreas Kling
This allows us to avoid unnecessary making unnecessary String copies of all the source text.
2019-10-07LibHTML: Start adding support for <link rel="stylesheet">Andreas Kling
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. :^)