From f815d2f9c68fc564ed3c2193c752becb853b55b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Fri, 30 Mar 2018 21:06:34 +0200 Subject: [PATCH] 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. --- components/style/gecko/wrapper.rs | 4 ++++ 1 file changed, 4 insertions(+) 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) };