Skip to content

Commit

Permalink
load useragent stylesheet again
Browse files Browse the repository at this point in the history
  • Loading branch information
Sharktheone committed Sep 29, 2024
1 parent d3f0c51 commit 8338cc9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
6 changes: 5 additions & 1 deletion crates/gosub_css3/src/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::matcher::property_definitions::get_css_definitions;
use crate::matcher::shorthands::FixList;
use crate::matcher::styling::{match_selector, CssProperties, CssProperty, DeclarationProperty};
use crate::stylesheet::{CssDeclaration, CssValue, Specificity};
use crate::Css3;
use crate::{load_default_useragent_stylesheet, Css3};
use gosub_shared::document::DocumentHandle;
use gosub_shared::errors::CssResult;
use gosub_shared::node::NodeId;
Expand Down Expand Up @@ -97,6 +97,10 @@ impl CssSystem for Css3System {
fn inheritance<T: RenderTree<Self>>(tree: &mut T) {
Self::resolve_inheritance(tree, tree.root(), &Vec::new());
}

fn load_default_useragent_stylesheet() -> Self::Stylesheet {
load_default_useragent_stylesheet()
}
}

impl Css3System {
Expand Down
4 changes: 3 additions & 1 deletion crates/gosub_render_utils/src/render_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,9 @@ impl<L: Layouter, D: Document<C>, C: CssSystem> RenderTree<L, D, C> {
else {
//we need to remove it from the parent in the render tree and from the document

todo!("unrenderable node");
// todo!("unrenderable node");

continue;
};

let data = node.data();
Expand Down
6 changes: 3 additions & 3 deletions crates/gosub_renderer/src/render_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ pub(crate) fn load_html_rendertree<L: Layouter, P: Html5Parser<C>, C: CssSystem>
eprintln!("Parse error: {:?}", error);
}

_ = doc_handle.get_mut();
let mut doc = doc_handle.get_mut();

// doc.add_stylesheet(C::load_default_useragent_stylesheet()?);
doc.add_stylesheet(C::load_default_useragent_stylesheet());

// drop(doc);
drop(doc);

generate_render_tree(DocumentHandle::clone(&doc_handle))
}
2 changes: 2 additions & 0 deletions crates/gosub_shared/src/traits/css3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ pub trait CssSystem: Clone {
) -> Option<Self::PropertyMap>;

fn inheritance<T: RenderTree<Self>>(tree: &mut T);

fn load_default_useragent_stylesheet() -> Self::Stylesheet;
}

pub trait CssStylesheet: PartialEq {
Expand Down

0 comments on commit 8338cc9

Please sign in to comment.