aboutsummaryrefslogtreecommitdiffstats
path: root/components/script_plugins/webidl_must_inherit.rs
diff options
context:
space:
mode:
authorkrk <keremkat@gmail.com>2019-04-16 21:30:29 +0200
committerkrk <keremkat@gmail.com>2019-04-20 22:39:38 +0200
commit0e3ee8b60bc0b60db5327cddb8adb8bc42a425cf (patch)
tree1266107bd38552c951fcffc985ce22774e1f0831 /components/script_plugins/webidl_must_inherit.rs
parentef59009aa1dfd496e51199b1396858c01aa8cd33 (diff)
downloadservo-0e3ee8b60bc0b60db5327cddb8adb8bc42a425cf.tar.gz
servo-0e3ee8b60bc0b60db5327cddb8adb8bc42a425cf.zip
Allow Reflector as a parent and special case PaintRenderingContext2D.
Diffstat (limited to 'components/script_plugins/webidl_must_inherit.rs')
-rw-r--r--components/script_plugins/webidl_must_inherit.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/components/script_plugins/webidl_must_inherit.rs b/components/script_plugins/webidl_must_inherit.rs
index 61fabf0ddf8..1d5f3b4e49c 100644
--- a/components/script_plugins/webidl_must_inherit.rs
+++ b/components/script_plugins/webidl_must_inherit.rs
@@ -111,6 +111,23 @@ fn check_inherits(code: &str, name: &str, parent_name: &str) -> Result<(), Box<E
if inherits == parent_name {
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 {
name: name.to_string(),
rust_parent: parent_name.to_string(),