aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2018-03-30 21:06:34 +0200
committerEmilio Cobos Álvarez <emilio@crisal.io>2018-03-30 21:06:34 +0200
commitf815d2f9c68fc564ed3c2193c752becb853b55b8 (patch)
treeb8d5d4a539bb613af4b260fa49eb6e470598d19a
parentd232705106478e0a2e5de78f8b40144408879c36 (diff)
downloadservo-f815d2f9c68fc564ed3c2193c752becb853b55b8.tar.gz
servo-f815d2f9c68fc564ed3c2193c752becb853b55b8.zip
style: Add a fast path to each_anonymous_content_child.
If we know that we don't have anon children it is pointless to go through FFI.
-rw-r--r--components/style/gecko/wrapper.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs
index ae8612fa490..6902093be7d 100644
--- a/components/style/gecko/wrapper.rs
+++ b/components/style/gecko/wrapper.rs
@@ -1121,6 +1121,10 @@ impl<'le> TElement for GeckoElement<'le> {
where
F: FnMut(Self),
{
+ if !self.may_have_anonymous_children() {
+ return;
+ }
+
let array: *mut structs::nsTArray<*mut nsIContent> =
unsafe { bindings::Gecko_GetAnonymousContentForElement(self.0) };