mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Allow Reflector as a parent and special case PaintRenderingContext2D.
This commit is contained in:
parent
ef59009aa1
commit
0e3ee8b60b
1 changed files with 17 additions and 0 deletions
|
@ -111,6 +111,23 @@ fn check_inherits(code: &str, name: &str, parent_name: &str) -> Result<(), Box<E
|
||||||
if inherits == parent_name {
|
if inherits == parent_name {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If there is no parent, first field must be of type Reflector.
|
||||||
|
if inherits == "" && parent_name == "Reflector" {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
|
if inherits == "" &&
|
||||||
|
name == "PaintRenderingContext2D" &&
|
||||||
|
parent_name == "CanvasRenderingContext2D"
|
||||||
|
{
|
||||||
|
// PaintRenderingContext2D embeds a CanvasRenderingContext2D
|
||||||
|
// instead of a Reflector as an optimization,
|
||||||
|
// but this is fine since CanvasRenderingContext2D
|
||||||
|
// also has a reflector
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
Err(boxed::Box::from(WebIdlError::ParentMismatch {
|
Err(boxed::Box::from(WebIdlError::ParentMismatch {
|
||||||
name: name.to_string(),
|
name: name.to_string(),
|
||||||
rust_parent: parent_name.to_string(),
|
rust_parent: parent_name.to_string(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue