Skip to content

Commit

Permalink
Merge pull request #722 from Sharktheone/interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Sharktheone authored Dec 22, 2024
2 parents 7d048c0 + 42adbcb commit e9203de
Show file tree
Hide file tree
Showing 124 changed files with 387 additions and 346 deletions.
20 changes: 20 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ harness = false

[dependencies]
gosub_shared = { path = "./crates/gosub_shared", features = [] }
gosub_interface = { path = "./crates/gosub_interface", features = [] }
gosub_config = { path = "./crates/gosub_config", features = [] }
gosub_html5 = { path = "./crates/gosub_html5", features = [] }
gosub_css3 = { path = "./crates/gosub_css3", features = [] }
Expand Down
6 changes: 3 additions & 3 deletions benches/tree_iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ use gosub_html5::document::builder::DocumentBuilderImpl;
use gosub_html5::document::document_impl::{DocumentImpl, TreeIterator};
use gosub_html5::document::fragment::DocumentFragmentImpl;
use gosub_html5::parser::Html5Parser;
use gosub_interface::config::{HasCssSystem, HasDocument, HasHtmlParser};
use gosub_interface::document::DocumentBuilder;
use gosub_interface::document_handle::DocumentHandle;
use gosub_shared::byte_stream::{ByteStream, Encoding};
use gosub_shared::document::DocumentHandle;
use gosub_shared::node::NodeId;
use gosub_shared::traits::config::{HasCssSystem, HasDocument, HasHtmlParser};
use gosub_shared::traits::document::DocumentBuilder;

#[derive(Clone, Debug, PartialEq)]
struct Config;
Expand Down
1 change: 1 addition & 0 deletions crates/gosub_cairo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ license = "MIT"

[dependencies]
gosub_shared = { path = "../gosub_shared" }
gosub_interface = { path = "../gosub_interface", features = [] }
gosub_svg = { path = "../gosub_svg", features = ["resvg"] }
image = "0.25.2"
smallvec = "1.13.2"
Expand Down
2 changes: 1 addition & 1 deletion crates/gosub_cairo/src/debug/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::elements::brush::GsBrush;
use crate::elements::color::GsColor;
use crate::elements::transform::GsTransform;
use crate::Scene;
use gosub_shared::render_backend::{Brush as _, Color as _, Transform as _};
use gosub_interface::render_backend::{Brush as _, Color as _, Transform as _};
use gosub_shared::types::Point;
use gosub_shared::ROBOTO_FONT;
use peniko::{Blob, Font};
Expand Down
4 changes: 2 additions & 2 deletions crates/gosub_cairo/src/elements/border.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ use smallvec::SmallVec;
use crate::elements::brush::GsBrush;
use crate::elements::transform::GsTransform;
use crate::{CairoBackend, Scene};
use gosub_shared::render_backend::geo::FP;
use gosub_shared::render_backend::{
use gosub_interface::render_backend::{
Border as TBorder, BorderRadius as TBorderRadius, BorderSide as TBorderSide, BorderStyle, Radius, RenderBorder,
};
use gosub_shared::geo::FP;

#[derive(Clone, Debug)]
pub struct GsBorder {
Expand Down
2 changes: 1 addition & 1 deletion crates/gosub_cairo/src/elements/brush.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::elements::color::GsColor;
use crate::elements::gradient::GsGradient;
use crate::elements::image::GsImage;
use crate::CairoBackend;
use gosub_shared::render_backend::Brush as TBrush;
use gosub_interface::render_backend::Brush as TBrush;

#[derive(Clone, Debug)]
pub enum GsBrush {
Expand Down
2 changes: 1 addition & 1 deletion crates/gosub_cairo/src/elements/color.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use gosub_shared::render_backend::Color as TColor;
use gosub_interface::render_backend::Color as TColor;

#[derive(Clone, Copy, Debug, PartialEq)]
pub struct GsColor {
Expand Down
4 changes: 2 additions & 2 deletions crates/gosub_cairo/src/elements/gradient.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::CairoBackend;
use gosub_shared::render_backend::geo::{Point, FP};
use gosub_shared::render_backend::{ColorStops, Gradient as TGradient};
use gosub_interface::render_backend::{ColorStops, Gradient as TGradient};
use gosub_shared::geo::{Point, FP};
use peniko::{Color as ExtColor, ColorStop as ExtColorStop, ColorStops as ExtColorStops, Gradient as ExtGradient};

#[allow(unused)]
Expand Down
4 changes: 2 additions & 2 deletions crates/gosub_cairo/src/elements/image.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use image::{DynamicImage, GenericImageView};
use std::sync::Arc;

use gosub_shared::render_backend::geo::FP;
use gosub_shared::render_backend::Image as TImage;
use gosub_interface::render_backend::Image as TImage;
use gosub_shared::geo::FP;

#[derive(Clone, Debug)]
pub enum GsFormat {
Expand Down
4 changes: 2 additions & 2 deletions crates/gosub_cairo/src/elements/rect.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::elements::border::GsBorderRadius;
use crate::elements::brush::GsBrush;
use crate::CairoBackend;
use gosub_shared::render_backend::geo::{Point, Size, FP};
use gosub_shared::render_backend::{Rect as TRect, RenderRect};
use gosub_interface::render_backend::{Rect as TRect, RenderRect};
use gosub_shared::geo::{Point, Size, FP};

#[derive(Clone, Debug)]
pub struct GsRect {
Expand Down
6 changes: 3 additions & 3 deletions crates/gosub_cairo/src/elements/text.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::CairoBackend;
use gosub_interface::layout::{Decoration, TextLayout};
use gosub_interface::render_backend::{RenderText, Text as TText};
use gosub_shared::font::{Glyph, GlyphID};
use gosub_shared::render_backend::geo::FP;
use gosub_shared::render_backend::layout::{Decoration, TextLayout};
use gosub_shared::render_backend::{RenderText, Text as TText};
use gosub_shared::geo::FP;
use peniko::Font;
use skrifa::instance::NormalizedCoord;
use std::cell::RefCell;
Expand Down
4 changes: 2 additions & 2 deletions crates/gosub_cairo/src/elements/transform.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::ops::{Mul, MulAssign};

use gosub_shared::render_backend::geo::{Point, FP};
use gosub_shared::render_backend::Transform as TTransform;
use gosub_interface::render_backend::Transform as TTransform;
use gosub_shared::geo::{Point, FP};

#[derive(Debug, Clone, Copy, PartialEq)]
pub struct GsTransform {
Expand Down
4 changes: 2 additions & 2 deletions crates/gosub_cairo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use crate::elements::rect::GsRect;
use crate::elements::text::GsText;
use crate::elements::transform::GsTransform;
use crate::render::window::{ActiveWindowData, WindowData};
use gosub_shared::render_backend::geo::SizeU32;
use gosub_shared::render_backend::{RenderBackend, RenderRect, RenderText, Scene as _, WindowHandle};
use gosub_interface::render_backend::{RenderBackend, RenderRect, RenderText, Scene as _, WindowHandle};
use gosub_shared::geo::SizeU32;
use gosub_shared::types::Result;
pub use image::*;
use log::info;
Expand Down
2 changes: 1 addition & 1 deletion crates/gosub_cairo/src/scene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::elements::rect::GsRect;
use crate::elements::text::GsText;
use crate::elements::transform::GsTransform;
use crate::CairoBackend;
use gosub_shared::render_backend::{
use gosub_interface::render_backend::{
Point, Radius, RenderBackend, RenderRect, RenderText, Scene as TScene, Transform as TTransform, FP,
};
use std::fmt::{Debug, Formatter};
Expand Down
1 change: 1 addition & 0 deletions crates/gosub_css3/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ license = "MIT"

[dependencies]
gosub_shared = { path = "../gosub_shared", features = [] }
gosub_interface = { path = "../gosub_interface", features = [] }
lazy_static = "1.5.0"
log = "0.4.22"
simple_logger = "5.0.0"
Expand Down
4 changes: 2 additions & 2 deletions crates/gosub_css3/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use crate::stylesheet::{
AttributeSelector, Combinator, CssDeclaration, CssRule, CssSelector, CssSelectorPart, CssStylesheet, CssValue,
MatcherType,
};
use gosub_interface::css3::CssOrigin;
use gosub_shared::errors::{CssError, CssResult};
use gosub_shared::traits::css3::CssOrigin;

/*
Expand Down Expand Up @@ -223,7 +223,7 @@ pub fn convert_ast_to_stylesheet(css_ast: &CssNode, origin: CssOrigin, url: &str
mod tests {
use super::*;
use crate::Css3;
use gosub_shared::traits::ParserConfig;
use gosub_shared::config::ParserConfig;

#[test]
fn convert_font_family() {
Expand Down
4 changes: 2 additions & 2 deletions crates/gosub_css3/src/functions/attr.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::stylesheet::CssValue;
use gosub_shared::traits::config::HasDocument;
use gosub_shared::traits::node::{ElementDataType, Node};
use gosub_interface::config::HasDocument;
use gosub_interface::node::{ElementDataType, Node};

// Probably this shouldn't quite be in gosub_css3
#[allow(dead_code)]
Expand Down
2 changes: 1 addition & 1 deletion crates/gosub_css3/src/functions/var.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::stylesheet::CssValue;
use gosub_shared::traits::config::HasDocument;
use gosub_interface::config::HasDocument;
use std::collections::HashMap;

#[allow(dead_code)]
Expand Down
6 changes: 3 additions & 3 deletions crates/gosub_css3/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ use crate::ast::convert_ast_to_stylesheet;
use crate::stylesheet::CssStylesheet;
use crate::tokenizer::Tokenizer;

use gosub_interface::css3::CssOrigin;
use gosub_shared::byte_stream::{ByteStream, Encoding, Location};
use gosub_shared::config::Context;
use gosub_shared::config::ParserConfig;
use gosub_shared::errors::{CssError, CssResult};
use gosub_shared::traits::css3::CssOrigin;
use gosub_shared::traits::Context;
use gosub_shared::traits::ParserConfig;
use gosub_shared::{timing_start, timing_stop};

pub mod ast;
Expand Down
2 changes: 1 addition & 1 deletion crates/gosub_css3/src/matcher/shorthands.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::stylesheet::{CssValue, Specificity};
use gosub_shared::traits::css3::CssOrigin;
use gosub_interface::css3::CssOrigin;
use std::collections::hash_map::Entry;

use crate::matcher::property_definitions::CssDefinitions;
Expand Down
16 changes: 8 additions & 8 deletions crates/gosub_css3/src/matcher/styling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ use std::cmp::Ordering;
use std::collections::HashMap;
use std::fmt::Display;

use gosub_shared::document::DocumentHandle;
use gosub_interface::config::HasDocument;
use gosub_interface::css3;
use gosub_interface::css3::{CssOrigin, CssPropertyMap};
use gosub_interface::document::Document;
use gosub_interface::document_handle::DocumentHandle;
use gosub_interface::node::ClassList;
use gosub_interface::node::ElementDataType;
use gosub_interface::node::Node;
use gosub_shared::node::NodeId;
use gosub_shared::traits::config::HasDocument;
use gosub_shared::traits::css3;
use gosub_shared::traits::css3::{CssOrigin, CssPropertyMap};
use gosub_shared::traits::document::Document;
use gosub_shared::traits::node::ClassList;
use gosub_shared::traits::node::ElementDataType;
use gosub_shared::traits::node::Node;

use crate::matcher::property_definitions::get_css_definitions;
use crate::stylesheet::{Combinator, CssSelector, CssSelectorPart, CssValue, MatcherType, Specificity};
Expand Down
4 changes: 2 additions & 2 deletions crates/gosub_css3/src/parser/anplusb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,9 @@ impl Css3<'_> {
#[cfg(test)]
mod test {
use super::*;
use gosub_interface::css3::CssOrigin;
use gosub_shared::byte_stream::{ByteStream, Encoding};
use gosub_shared::traits::css3::CssOrigin;
use gosub_shared::traits::ParserConfig;
use gosub_shared::config::ParserConfig;

macro_rules! test {
($func:ident, $input:expr, $expected:expr) => {
Expand Down
6 changes: 3 additions & 3 deletions crates/gosub_css3/src/stylesheet.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use core::fmt::Debug;
use core::slice;
use gosub_interface::css3::CssOrigin;
use gosub_shared::byte_stream::Location;
use gosub_shared::errors::CssError;
use gosub_shared::errors::CssResult;
use gosub_shared::traits::css3::CssOrigin;
use std::cmp::Ordering;
use std::fmt::Display;

Expand Down Expand Up @@ -108,7 +108,7 @@ pub struct CssStylesheet {
pub parse_log: Vec<CssLog>,
}

impl gosub_shared::traits::css3::CssStylesheet for CssStylesheet {
impl gosub_interface::css3::CssStylesheet for CssStylesheet {
fn origin(&self) -> CssOrigin {
self.origin
}
Expand Down Expand Up @@ -553,7 +553,7 @@ impl CssValue {
}
}

impl gosub_shared::traits::css3::CssValue for CssValue {
impl gosub_interface::css3::CssValue for CssValue {
fn new_string(value: &str) -> Self {
CssValue::String(value.to_string())
}
Expand Down
12 changes: 6 additions & 6 deletions crates/gosub_css3/src/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ use crate::matcher::shorthands::FixList;
use crate::matcher::styling::{match_selector, CssProperties, CssProperty, DeclarationProperty};
use crate::stylesheet::{CssDeclaration, CssValue, Specificity};
use crate::{load_default_useragent_stylesheet, Css3};
use gosub_shared::document::DocumentHandle;
use gosub_interface::config::{HasDocument, HasRenderTree};
use gosub_interface::css3::{CssOrigin, CssPropertyMap, CssSystem};
use gosub_interface::document_handle::DocumentHandle;
use gosub_interface::node::{ElementDataType, Node, TextDataType};
use gosub_interface::render_tree::{RenderTree, RenderTreeNode};
use gosub_shared::config::ParserConfig;
use gosub_shared::errors::CssResult;
use gosub_shared::node::NodeId;
use gosub_shared::traits::config::{HasDocument, HasRenderTree};
use gosub_shared::traits::css3::{CssOrigin, CssPropertyMap, CssSystem};
use gosub_shared::traits::node::{ElementDataType, Node, TextDataType};
use gosub_shared::traits::render_tree::{RenderTree, RenderTreeNode};
use gosub_shared::traits::ParserConfig;
use log::warn;
use std::slice;

Expand Down
1 change: 1 addition & 0 deletions crates/gosub_html5/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ license = "MIT"

[dependencies]
gosub_shared = { path = "../gosub_shared", features = [] }
gosub_interface = { path = "../gosub_interface", features = [] }
gosub_css3 = { path = "../gosub_css3", features = [] }
derive_more = { version = "1", features = ["from", "display"] }
phf = { version = "0.11.2", features = ["macros"] }
Expand Down
2 changes: 1 addition & 1 deletion crates/gosub_html5/benches/tree_construction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use gosub_html5::document::fragment::DocumentFragmentImpl;
use gosub_html5::parser::Html5Parser;
use gosub_html5::testing::tree_construction;
use gosub_html5::testing::tree_construction::Harness;
use gosub_shared::traits::config::{HasCssSystem, HasDocument, HasHtmlParser};
use gosub_interface::config::{HasCssSystem, HasDocument, HasHtmlParser};

#[derive(Clone, Debug, PartialEq)]
struct Config;
Expand Down
Loading

0 comments on commit e9203de

Please sign in to comment.