create scafolding for the shadow dom

This commit is contained in:
Evan Almloff committed 2023-04-06 16:59:25 -05:00
1 parent 8b5f2cb02f
commit b2c87f5c47
10 files changed
+186 -137

No files matched your search

+12
View File
@@ -17,6 +17,7 @@ use crate::node_ref::{NodeMask, NodeMaskBuilder};
use crate::node_watcher::{AttributeWatcher, NodeWatcher};
use crate::passes::{DirtyNodeStates, TypeErasedState};
use crate::prelude::AttributeMaskBuilder;
use crate::shadow_dom::ShadowDom;
use crate::tree::{TreeMut, TreeMutView, TreeRef, TreeRefView};
use crate::NodeId;
use crate::{FxDashSet, SendAnyMap};
@@ -139,6 +140,7 @@ impl<V: FromAnyValue + Send + Sync> RealDom<V> {
namespace: Some("Root".to_string()),
attributes: FxHashMap::default(),
listeners: FxHashSet::default(),
shadow: None,
});
let root_id = world.add_entity(root_node);
{
@@ -1056,6 +1058,16 @@ impl<V: FromAnyValue + Send + Sync> ElementNodeMut<'_, V> {
pub fn listeners(&self) -> &FxHashSet<String> {
&self.element().listeners
}
/// Get the shadow root of the element
pub fn shadow_root(&self) -> Option<&ShadowDom<V>> {
self.element().shadow.as_deref()
}
/// Get the shadow root of the element
pub fn shadow_root_mut(&mut self) -> &mut Option<Box<ShadowDom<V>>> {
&mut self.element_mut().shadow
}
}
// Create a workload from all of the passes. This orders the passes so that each pass will only run at most once.