mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Implement declarative shadow dom (#34964)
* Implement declarative shadow dom Signed-off-by: batu_hoang <longvatrong111@gmail.com> * Set allowDeclarativeShadowRoots false for innerHTML Signed-off-by: batu_hoang <longvatrong111@gmail.com> * Enable allowDeclarativeShadowRoots for Document Signed-off-by: batu_hoang <longvatrong111@gmail.com> * Expose HTMLTemplateElement to js Signed-off-by: batu_hoang <longvatrong111@gmail.com> * Implemenet setHTMLUnsafe and add more test cases Signed-off-by: batu_hoang <longvatrong111@gmail.com> * Declarative shadow dom: minor updates and expected test result update Signed-off-by: batu_hoang <longvatrong111@gmail.com> * Shadow-dom: add more test cases Signed-off-by: batu_hoang <longvatrong111@gmail.com> * Update comments according to the spec Signed-off-by: batu_hoang <longvatrong111@gmail.com> * Bump html5ever version Signed-off-by: batu_hoang <longvatrong111@gmail.com> --------- Signed-off-by: batu_hoang <longvatrong111@gmail.com>
This commit is contained in:
parent
f483a3d34b
commit
28c8c1df0c
44 changed files with 360 additions and 1965 deletions
|
@ -513,6 +513,8 @@ pub(crate) struct Document {
|
|||
status_code: Option<u16>,
|
||||
/// <https://html.spec.whatwg.org/multipage/#is-initial-about:blank>
|
||||
is_initial_about_blank: Cell<bool>,
|
||||
/// <https://dom.spec.whatwg.org/#document-allow-declarative-shadow-roots>
|
||||
allow_declarative_shadow_roots: Cell<bool>,
|
||||
/// <https://w3c.github.io/webappsec-upgrade-insecure-requests/#insecure-requests-policy>
|
||||
#[no_trace]
|
||||
inherited_insecure_requests_policy: Cell<Option<InsecureRequestsPolicy>>,
|
||||
|
@ -3590,6 +3592,7 @@ impl Document {
|
|||
status_code: Option<u16>,
|
||||
canceller: FetchCanceller,
|
||||
is_initial_about_blank: bool,
|
||||
allow_declarative_shadow_roots: bool,
|
||||
inherited_insecure_requests_policy: Option<InsecureRequestsPolicy>,
|
||||
) -> Document {
|
||||
let url = url.unwrap_or_else(|| ServoUrl::parse("about:blank").unwrap());
|
||||
|
@ -3740,6 +3743,7 @@ impl Document {
|
|||
visibility_state: Cell::new(DocumentVisibilityState::Hidden),
|
||||
status_code,
|
||||
is_initial_about_blank: Cell::new(is_initial_about_blank),
|
||||
allow_declarative_shadow_roots: Cell::new(allow_declarative_shadow_roots),
|
||||
inherited_insecure_requests_policy: Cell::new(inherited_insecure_requests_policy),
|
||||
intersection_observer_task_queued: Cell::new(false),
|
||||
}
|
||||
|
@ -3874,6 +3878,7 @@ impl Document {
|
|||
status_code: Option<u16>,
|
||||
canceller: FetchCanceller,
|
||||
is_initial_about_blank: bool,
|
||||
allow_declarative_shadow_roots: bool,
|
||||
inherited_insecure_requests_policy: Option<InsecureRequestsPolicy>,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<Document> {
|
||||
|
@ -3893,6 +3898,7 @@ impl Document {
|
|||
status_code,
|
||||
canceller,
|
||||
is_initial_about_blank,
|
||||
allow_declarative_shadow_roots,
|
||||
inherited_insecure_requests_policy,
|
||||
can_gc,
|
||||
)
|
||||
|
@ -3915,6 +3921,7 @@ impl Document {
|
|||
status_code: Option<u16>,
|
||||
canceller: FetchCanceller,
|
||||
is_initial_about_blank: bool,
|
||||
allow_declarative_shadow_roots: bool,
|
||||
inherited_insecure_requests_policy: Option<InsecureRequestsPolicy>,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<Document> {
|
||||
|
@ -3934,6 +3941,7 @@ impl Document {
|
|||
status_code,
|
||||
canceller,
|
||||
is_initial_about_blank,
|
||||
allow_declarative_shadow_roots,
|
||||
inherited_insecure_requests_policy,
|
||||
)),
|
||||
window,
|
||||
|
@ -4066,6 +4074,7 @@ impl Document {
|
|||
None,
|
||||
Default::default(),
|
||||
false,
|
||||
self.allow_declarative_shadow_roots(),
|
||||
Some(self.insecure_requests_policy()),
|
||||
can_gc,
|
||||
);
|
||||
|
@ -4598,6 +4607,15 @@ impl Document {
|
|||
pub(crate) fn is_initial_about_blank(&self) -> bool {
|
||||
self.is_initial_about_blank.get()
|
||||
}
|
||||
|
||||
/// <https://dom.spec.whatwg.org/#document-allow-declarative-shadow-roots>
|
||||
pub fn allow_declarative_shadow_roots(&self) -> bool {
|
||||
self.allow_declarative_shadow_roots.get()
|
||||
}
|
||||
|
||||
pub fn set_allow_declarative_shadow_roots(&self, value: bool) {
|
||||
self.allow_declarative_shadow_roots.set(value)
|
||||
}
|
||||
}
|
||||
|
||||
impl ProfilerMetadataFactory for Document {
|
||||
|
@ -4636,6 +4654,7 @@ impl DocumentMethods<crate::DomTypeHolder> for Document {
|
|||
None,
|
||||
Default::default(),
|
||||
false,
|
||||
doc.allow_declarative_shadow_roots(),
|
||||
Some(doc.insecure_requests_policy()),
|
||||
can_gc,
|
||||
))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue