Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] svg: support <circle> element #17681

Closed
wants to merge 10 commits into from

script: Implement SVGGeometryElement

Add SVGGeometryElement implementation.
  • Loading branch information
stshine committed Sep 11, 2017
commit cbeef7d6dea9cc9dec7bfff4ba3b8b172bb8a39c
@@ -430,6 +430,7 @@ pub mod stylepropertymapreadonly;
pub mod stylesheet;
pub mod stylesheetlist;
pub mod svgelement;
pub mod svggeometryelement;
pub mod svggraphicselement;
pub mod svgsvgelement;
pub mod testbinding;
@@ -0,0 +1,34 @@
use dom::bindings::inheritance::Castable;
use dom::document::Document;
use dom::svggraphicselement::SVGGraphicsElement;
use dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use html5ever::{LocalName, Prefix};
use style::element_state::ElementState;

#[dom_struct]
pub struct SVGGeometryElement {
graphicselement: SVGGraphicsElement
}

impl SVGGeometryElement {
pub fn new_inherited(tag_name: LocalName, prefix: Option<Prefix>,
document: &Document) -> Self {
SVGGeometryElement::new_inherited_with_state(ElementState::empty(), tag_name, prefix, document)
}

pub fn new_inherited_with_state(state: ElementState, tag_name: LocalName,
prefix: Option<Prefix>, document: &Document)
-> Self {
SVGGeometryElement {
graphicselement:
SVGGraphicsElement::new_inherited_with_state(state, tag_name, prefix, document),
}
}
}

impl VirtualMethods for SVGGeometryElement {
fn super_type(&self) -> Option<&VirtualMethods> {
Some(self.upcast::<SVGGraphicsElement>() as &VirtualMethods)
}
}
@@ -0,0 +1,9 @@
[Pref="dom.svg.enabled"]
interface SVGGeometryElement : SVGGraphicsElement {
// [SameObject] readonly attribute SVGAnimatedNumber pathLength;

// boolean isPointInFill(DOMPoint point);
// boolean isPointInStroke(DOMPoint point);
// float getTotalLength();
// DOMPoint getPointAtLength(float distance);
};
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.