Commit graph

17 commits

Author SHA1 Message Date
Linus Groh
6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
2022-12-06 08:54:33 +01:00
Andreas Kling
6e0f80fbe0 LibWeb: Make the HTMLParser GC-allocated
This prevents a reference cycle between a HTMLParser opened via
document.open() and the document. It was one of many things keeping
some documents alive indefinitely.
2022-10-20 15:16:23 +02:00
Luke Wilde
7b8a6b8e7a LibWeb: Set HTMLParser::m_scripting_enabled as according to the spec
This allows <noscript> elements to display their content as proper HTML
instead of raw text when scripting is disabled.
2022-09-23 22:25:09 +01:00
Andreas Kling
ab8432783e LibWeb: Implement aborting the HTML parser
This is roughly on-spec, although I had to invent a simple "aborted"
state for the tokenizer.
2022-09-20 23:44:59 +02:00
Andreas Kling
6f433c8656 LibWeb+LibJS: Make the EventTarget hierarchy (incl. DOM) GC-allocated
This is a monster patch that turns all EventTargets into GC-allocated
PlatformObjects. Their C++ wrapper classes are removed, and the LibJS
garbage collector is now responsible for their lifetimes.

There's a fair amount of hacks and band-aids in this patch, and we'll
have a lot of cleanup to do after this.
2022-09-06 00:27:09 +02:00
Andreas Kling
1956c52c68 LibWeb: Remove unused HTML::parse_html_document() 2022-04-06 19:35:07 +02:00
Idan Horowitz
086969277e Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
Andreas Kling
fda25f9505 LibWeb: Move HTML dimension value parsing from CSS to HTML namespace
These are part of HTML, not CSS, so let's not confuse things.
2022-03-26 17:31:01 +01:00
Simon Wanner
1d95745901 LibWeb: Implement the rest of the Adoption Agency Algorithm
This gets us 2 points on html5test.com :^)
- Before: https://html5te.st/4cf57659bc08272e (208)
- After: https://html5te.st/fb8a9259bda1c115 (210)
2022-03-20 02:52:37 +01:00
Luke Wilde
46c0d0f7ae LibWeb: Associate form elements with a form in parsing and dynamically
This makes it available for all form associated elements and not just
select and input elements. It also makes it more spec compliant,
especially around the form attribute.

The main thing missing is re-associating form elements with a form
attribute when the form attribute changes or an element with an ID
is inserted/removed or has its ID changed.
2022-03-01 23:19:41 +01:00
Andreas Kling
8b2499b112 LibWeb: Make document.write() work while document is parsing
This necessitated making HTMLParser ref-counted, and having it register
itself with Document when created. That makes it possible for scripts to
add new input at the current parser insertion point.

There is now a reference cycle between Document and HTMLParser. This
cycle is explicitly broken by calling Document::detach_parser() at the
end of HTMLParser::run().

This is a huge progression on ACID3, from 31% to 49%! :^)
2022-02-21 22:00:28 +01:00
Lorenz Steinert
db789813c9 LibWeb: Add basic support for dynamic markup insertion
This implements basic support for dynamic markup insertion, adding
 * Document::open()
 * Document::write(Vector<String> const&)
 * Document::writeln(Vector<String> const&)
 * Document::close()

The HTMLParser is modified to make it possible to create a
script-created parser which initially only contains a HTMLTokenizer
without any data. Aditionally the HTMLParser::run method gains an
overload which does not modify the Document and does not run
HTMLParser::the_end() so that we can reenter the parser at a later time.
Furthermore all FIXMEs that consern the insertion point are implemented
wich is defined in the HTMLTokenizer. Additionally the following
member-variables of the HTMLParser are now exposed by getter funcions:
 * m_tokenizer
 * m_aborted
 * m_script_nesting_level

The HTMLTokenizer is modified so that it contains an insertion
point which keeps track of where the next input from the Document::write
functions will be inserted. The insertion point is implemented as the
charakter offset into m_decoded_input and a boolean describing if the
insertion point is defined. Functions to update, check and {re}store the
insertion point are also added.
The function HTMLTokenizer::insert_eof is added to tell a script-created
parser that document::close was called and HTMLParser::the_end() should
be called.
Lastly an explicit default constructor is added to HTMLTokenizer to
create a empty HTMLTokenizer into which data can be inserted.
2022-02-21 18:26:43 +01:00
Linus Groh
892f6394b8 LibWeb: Implement state switch for "[CDATA[" in HTML parser 2022-02-15 23:24:34 +01:00
Linus Groh
9130ecfd5e LibWeb: Remove unused HTMLParser function declaration
There is no implementation of this function:
HTMLParser::stack_of_open_elements_has_element_with_tag_name_in_scope
2022-02-15 23:24:34 +01:00
Andreas Kling
8b1108e485 Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
Andreas Kling
e452550fda LibWeb: Split out "The end" from the HTML parsing spec to a function
Also add a spec link and some comments.
2021-09-26 00:04:33 +02:00
Andreas Kling
f67648f872 LibWeb: Rename HTMLDocumentParser => HTMLParser 2021-09-25 23:36:43 +02:00
Renamed from Userland/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.h (Browse further)