mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:47:36 +00:00
LibWeb: Port DocumentType from DeprecatedString to String
This commit is contained in:
parent
9117bcfd61
commit
ebdfe2e863
4 changed files with 18 additions and 17 deletions
|
@ -100,7 +100,7 @@ JS::NonnullGCPtr<Document> DOMImplementation::create_html_document(Optional<Stri
|
||||||
|
|
||||||
// 3. Append a new doctype, with "html" as its name and with its node document set to doc, to doc.
|
// 3. Append a new doctype, with "html" as its name and with its node document set to doc, to doc.
|
||||||
auto doctype = heap().allocate<DocumentType>(realm(), html_document);
|
auto doctype = heap().allocate<DocumentType>(realm(), html_document);
|
||||||
doctype->set_name("html");
|
doctype->set_name("html"_string);
|
||||||
MUST(html_document->append_child(*doctype));
|
MUST(html_document->append_child(*doctype));
|
||||||
|
|
||||||
// 4. Append the result of creating an element given doc, html, and the HTML namespace, to doc.
|
// 4. Append the result of creating an element given doc, html, and the HTML namespace, to doc.
|
||||||
|
@ -141,9 +141,9 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<DocumentType>> DOMImplementation::create_do
|
||||||
|
|
||||||
// 2. Return a new doctype, with qualifiedName as its name, publicId as its public ID, and systemId as its system ID, and with its node document set to the associated document of this.
|
// 2. Return a new doctype, with qualifiedName as its name, publicId as its public ID, and systemId as its system ID, and with its node document set to the associated document of this.
|
||||||
auto document_type = DocumentType::create(document());
|
auto document_type = DocumentType::create(document());
|
||||||
document_type->set_name(qualified_name.to_deprecated_string());
|
document_type->set_name(qualified_name);
|
||||||
document_type->set_public_id(public_id.to_deprecated_string());
|
document_type->set_public_id(public_id);
|
||||||
document_type->set_system_id(system_id.to_deprecated_string());
|
document_type->set_system_id(system_id);
|
||||||
return document_type;
|
return document_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <AK/DeprecatedFlyString.h>
|
#include <AK/DeprecatedFlyString.h>
|
||||||
|
#include <AK/String.h>
|
||||||
#include <LibWeb/DOM/ChildNode.h>
|
#include <LibWeb/DOM/ChildNode.h>
|
||||||
#include <LibWeb/DOM/Node.h>
|
#include <LibWeb/DOM/Node.h>
|
||||||
|
|
||||||
|
@ -24,23 +25,23 @@ public:
|
||||||
|
|
||||||
virtual DeprecatedFlyString node_name() const override { return "#doctype"; }
|
virtual DeprecatedFlyString node_name() const override { return "#doctype"; }
|
||||||
|
|
||||||
DeprecatedString const& name() const { return m_name; }
|
String const& name() const { return m_name; }
|
||||||
void set_name(DeprecatedString const& name) { m_name = name; }
|
void set_name(String const& name) { m_name = name; }
|
||||||
|
|
||||||
DeprecatedString const& public_id() const { return m_public_id; }
|
String const& public_id() const { return m_public_id; }
|
||||||
void set_public_id(DeprecatedString const& public_id) { m_public_id = public_id; }
|
void set_public_id(String const& public_id) { m_public_id = public_id; }
|
||||||
|
|
||||||
DeprecatedString const& system_id() const { return m_system_id; }
|
String const& system_id() const { return m_system_id; }
|
||||||
void set_system_id(DeprecatedString const& system_id) { m_system_id = system_id; }
|
void set_system_id(String const& system_id) { m_system_id = system_id; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit DocumentType(Document&);
|
explicit DocumentType(Document&);
|
||||||
|
|
||||||
virtual void initialize(JS::Realm&) override;
|
virtual void initialize(JS::Realm&) override;
|
||||||
|
|
||||||
DeprecatedString m_name;
|
String m_name;
|
||||||
DeprecatedString m_public_id;
|
String m_public_id;
|
||||||
DeprecatedString m_system_id;
|
String m_system_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#import <DOM/Node.idl>
|
#import <DOM/Node.idl>
|
||||||
|
|
||||||
// https://dom.spec.whatwg.org/#documenttype
|
// https://dom.spec.whatwg.org/#documenttype
|
||||||
[Exposed=Window]
|
[Exposed=Window, UseNewAKString]
|
||||||
interface DocumentType : Node {
|
interface DocumentType : Node {
|
||||||
readonly attribute DOMString name;
|
readonly attribute DOMString name;
|
||||||
readonly attribute DOMString publicId;
|
readonly attribute DOMString publicId;
|
||||||
|
|
|
@ -497,9 +497,9 @@ void HTMLParser::handle_initial(HTMLToken& token)
|
||||||
|
|
||||||
if (token.is_doctype()) {
|
if (token.is_doctype()) {
|
||||||
auto doctype = realm().heap().allocate<DOM::DocumentType>(realm(), document());
|
auto doctype = realm().heap().allocate<DOM::DocumentType>(realm(), document());
|
||||||
doctype->set_name(token.doctype_data().name);
|
doctype->set_name(String::from_deprecated_string(token.doctype_data().name).release_value());
|
||||||
doctype->set_public_id(token.doctype_data().public_identifier);
|
doctype->set_public_id(String::from_deprecated_string(token.doctype_data().public_identifier).release_value());
|
||||||
doctype->set_system_id(token.doctype_data().system_identifier);
|
doctype->set_system_id(String::from_deprecated_string(token.doctype_data().system_identifier).release_value());
|
||||||
MUST(document().append_child(*doctype));
|
MUST(document().append_child(*doctype));
|
||||||
document().set_quirks_mode(which_quirks_mode(token));
|
document().set_quirks_mode(which_quirks_mode(token));
|
||||||
m_insertion_mode = InsertionMode::BeforeHTML;
|
m_insertion_mode = InsertionMode::BeforeHTML;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue