mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
initial stubs
Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
This commit is contained in:
parent
d18000fee8
commit
db41081c9f
7 changed files with 180 additions and 0 deletions
|
@ -545,9 +545,12 @@ pub(crate) mod stylesheet;
|
||||||
pub(crate) mod stylesheetlist;
|
pub(crate) mod stylesheetlist;
|
||||||
pub(crate) mod submitevent;
|
pub(crate) mod submitevent;
|
||||||
pub(crate) mod subtlecrypto;
|
pub(crate) mod subtlecrypto;
|
||||||
|
pub(crate) mod svganimatednumber;
|
||||||
pub(crate) mod svgelement;
|
pub(crate) mod svgelement;
|
||||||
|
pub(crate) mod svggeometryelement;
|
||||||
pub(crate) mod svggraphicselement;
|
pub(crate) mod svggraphicselement;
|
||||||
pub(crate) mod svgimageelement;
|
pub(crate) mod svgimageelement;
|
||||||
|
pub(crate) mod svgpathelement;
|
||||||
pub(crate) mod svgsvgelement;
|
pub(crate) mod svgsvgelement;
|
||||||
#[cfg(feature = "testbinding")]
|
#[cfg(feature = "testbinding")]
|
||||||
pub(crate) mod testbinding;
|
pub(crate) mod testbinding;
|
||||||
|
|
36
components/script/dom/svganimatednumber.rs
Normal file
36
components/script/dom/svganimatednumber.rs
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use std::cell::Cell;
|
||||||
|
|
||||||
|
use dom_struct::dom_struct;
|
||||||
|
use crate::dom::virtualmethods::VirtualMethods;
|
||||||
|
|
||||||
|
#[dom_struct]
|
||||||
|
pub(crate) struct SVGAnimatedNumber {
|
||||||
|
anim_val: f32,
|
||||||
|
base_val: Cell<f32>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl SVGAnimatedNumber {
|
||||||
|
// attribute float baseVal;
|
||||||
|
pub fn base_val(&self) -> f32 {
|
||||||
|
self.base_val.get()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn set_base_val(&self, value: f32) {
|
||||||
|
self.base_val.set(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// readonly attribute float animVal;
|
||||||
|
pub fn anim_val(&self) -> f32 {
|
||||||
|
self.anim_val
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl VirtualMethods for SVGAnimatedNumber {
|
||||||
|
fn super_type(&self) -> Option<&dyn VirtualMethods> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
55
components/script/dom/svggeometryelement.rs
Normal file
55
components/script/dom/svggeometryelement.rs
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use dom_struct::dom_struct;
|
||||||
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use stylo_dom::ElementState;
|
||||||
|
|
||||||
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
|
use crate::dom::document::Document;
|
||||||
|
use crate::dom::svggraphicselement::SVGGraphicsElement;
|
||||||
|
use crate::dom::svganimatednumber::SVGAnimatedNumber;
|
||||||
|
use crate::dom::virtualmethods::VirtualMethods;
|
||||||
|
|
||||||
|
#[dom_struct]
|
||||||
|
pub(crate) struct SVGGeometryElement {
|
||||||
|
svggraphicelement: SVGGraphicsElement,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl SVGGeometryElement {
|
||||||
|
pub(crate) fn new_inherited(
|
||||||
|
tag_name: LocalName,
|
||||||
|
prefix: Option<Prefix>,
|
||||||
|
document: &Document,
|
||||||
|
) -> SVGGeometryElement {
|
||||||
|
SVGGeometryElement::new_inherited_with_state(
|
||||||
|
ElementState::empty(),
|
||||||
|
tag_name,
|
||||||
|
prefix,
|
||||||
|
document,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn new_inherited_with_state(
|
||||||
|
state: ElementState,
|
||||||
|
tag_name: LocalName,
|
||||||
|
prefix: Option<Prefix>,
|
||||||
|
document: &Document,
|
||||||
|
) -> SVGGeometryElement {
|
||||||
|
SVGGeometryElement {
|
||||||
|
svggraphicelement: SVGGraphicsElement::new_inherited_with_state(
|
||||||
|
state,
|
||||||
|
tag_name,
|
||||||
|
prefix,
|
||||||
|
document,
|
||||||
|
),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl VirtualMethods for SVGGeometryElement {
|
||||||
|
fn super_type(&self) -> Option<&dyn VirtualMethods> {
|
||||||
|
Some(self.upcast::<SVGGraphicsElement>() as &dyn VirtualMethods)
|
||||||
|
}
|
||||||
|
}
|
54
components/script/dom/svgpathelement.rs
Normal file
54
components/script/dom/svgpathelement.rs
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use dom_struct::dom_struct;
|
||||||
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use stylo_dom::ElementState;
|
||||||
|
|
||||||
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
|
use crate::dom::document::Document;
|
||||||
|
use crate::dom::svggeometryelement::SVGGeometryElement;
|
||||||
|
use crate::dom::virtualmethods::VirtualMethods;
|
||||||
|
|
||||||
|
#[dom_struct]
|
||||||
|
pub(crate) struct SVGPathElement {
|
||||||
|
svggeometryelement: SVGGeometryElement,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl SVGPathElement {
|
||||||
|
pub(crate) fn new_inherited(
|
||||||
|
tag_name: LocalName,
|
||||||
|
prefix: Option<Prefix>,
|
||||||
|
document: &Document,
|
||||||
|
) -> SVGPathElement {
|
||||||
|
SVGPathElement::new_inherited_with_state(
|
||||||
|
ElementState::empty(),
|
||||||
|
tag_name,
|
||||||
|
prefix,
|
||||||
|
document,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn new_inherited_with_state(
|
||||||
|
state: ElementState,
|
||||||
|
tag_name: LocalName,
|
||||||
|
prefix: Option<Prefix>,
|
||||||
|
document: &Document,
|
||||||
|
) -> SVGPathElement {
|
||||||
|
SVGPathElement {
|
||||||
|
svggeometryelement: SVGGeometryElement::new_inherited_with_state(
|
||||||
|
state,
|
||||||
|
tag_name,
|
||||||
|
prefix,
|
||||||
|
document,
|
||||||
|
),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl VirtualMethods for SVGPathElement {
|
||||||
|
fn super_type(&self) -> Option<&dyn VirtualMethods> {
|
||||||
|
Some(self.upcast::<SVGGeometryElement>() as &dyn VirtualMethods)
|
||||||
|
}
|
||||||
|
}
|
10
components/script_bindings/webidls/SVGAnimatedNumber.webidl
Normal file
10
components/script_bindings/webidls/SVGAnimatedNumber.webidl
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
// https://www.w3.org/TR/SVG/types.html#InterfaceSVGAnimatedNumber
|
||||||
|
[Exposed=Window, Pref="dom_svg_enabled"]
|
||||||
|
interface SVGAnimatedNumber {
|
||||||
|
attribute float baseVal;
|
||||||
|
readonly attribute float animVal;
|
||||||
|
};
|
14
components/script_bindings/webidls/SVGGeometryElement.webidl
Normal file
14
components/script_bindings/webidls/SVGGeometryElement.webidl
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
// https://www.w3.org/TR/SVG/types.html#InterfaceSVGGeometryElement
|
||||||
|
[Exposed=Window, Pref="dom_svg_enabled"]
|
||||||
|
interface SVGGeometryElement : SVGGraphicsElement {
|
||||||
|
// [SameObject] readonly attribute SVGAnimatedNumber pathLength;
|
||||||
|
|
||||||
|
// boolean isPointInFill(optional DOMPointInit point);
|
||||||
|
// boolean isPointInStroke(optional DOMPointInit point);
|
||||||
|
// float getTotalLength();
|
||||||
|
// DOMPoint getPointAtLength(float distance);
|
||||||
|
};
|
8
components/script_bindings/webidls/SVGPathElement.webidl
Normal file
8
components/script_bindings/webidls/SVGPathElement.webidl
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
// https://www.w3.org/TR/SVG/paths.html#InterfaceSVGPathElement
|
||||||
|
[Exposed=Window, Pref="dom_svg_enabled"]
|
||||||
|
interface SVGPathElement : SVGGeometryElement {
|
||||||
|
};
|
Loading…
Add table
Add a link
Reference in a new issue