aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-08-22 05:48:37 -0500
committerGitHub <noreply@github.com>2017-08-22 05:48:37 -0500
commit1059ef4fdeb5c76102c3da22293d836942740033 (patch)
tree966e2af39045e505f0f60e8f89c0ee6f07f14a46
parent10779f02519b193f07df997ab013ce7ca45cf656 (diff)
parentfcd6e79659301539bf1a138dca26d8af2d8f1af7 (diff)
downloadservo-1059ef4fdeb5c76102c3da22293d836942740033.tar.gz
servo-1059ef4fdeb5c76102c3da22293d836942740033.zip
Auto merge of #18184 - emilio:inline, r=upsuper
style: Inline a bunch of trivial stuff we're paying function calls for in Geckolib. Reviewed by Xidorn in https://bugzilla.mozilla.org/show_bug.cgi?id=1392170. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18184) <!-- Reviewable:end -->
-rw-r--r--components/style/data.rs7
-rw-r--r--components/style/gecko/restyle_damage.rs4
-rw-r--r--components/style/gecko/wrapper.rs9
-rw-r--r--components/style/traversal.rs2
-rw-r--r--components/style/traversal_flags.rs1
5 files changed, 23 insertions, 0 deletions
diff --git a/components/style/data.rs b/components/style/data.rs
index 35f75b10b3d..ff4a214ef5a 100644
--- a/components/style/data.rs
+++ b/components/style/data.rs
@@ -72,6 +72,7 @@ impl RestyleData {
///
/// FIXME(bholley): The only caller of this should probably just assert that
/// the hint is empty and call clear_flags_and_damage().
+ #[inline]
fn clear_restyle_state(&mut self) {
self.clear_restyle_flags_and_damage();
self.hint = RestyleHint::empty();
@@ -83,6 +84,7 @@ impl RestyleData {
/// set to the correct value on each traversal. There's no reason anyone
/// needs to clear it, and clearing it accidentally mid-traversal could
/// cause incorrect style sharing behavior.
+ #[inline]
fn clear_restyle_flags_and_damage(&mut self) {
self.damage = RestyleDamage::empty();
self.flags = self.flags & TRAVERSED_WITHOUT_STYLING;
@@ -124,6 +126,7 @@ impl RestyleData {
}
/// Returns true if this element was restyled.
+ #[inline]
pub fn is_restyle(&self) -> bool {
self.flags.contains(WAS_RESTYLED)
}
@@ -140,6 +143,7 @@ impl RestyleData {
}
/// Returns whether this element has been part of a restyle.
+ #[inline]
pub fn contains_restyle_data(&self) -> bool {
self.is_restyle() || !self.hint.is_empty() || !self.damage.is_empty()
}
@@ -353,6 +357,7 @@ impl ElementData {
}
/// Returns true if this element has styles.
+ #[inline]
pub fn has_styles(&self) -> bool {
self.styles.primary.is_some()
}
@@ -429,11 +434,13 @@ impl ElementData {
}
/// Drops any restyle state from the element.
+ #[inline]
pub fn clear_restyle_state(&mut self) {
self.restyle.clear_restyle_state();
}
/// Drops restyle flags and damage from the element.
+ #[inline]
pub fn clear_restyle_flags_and_damage(&mut self) {
self.restyle.clear_restyle_flags_and_damage();
}
diff --git a/components/style/gecko/restyle_damage.rs b/components/style/gecko/restyle_damage.rs
index 67a4366718e..caea907eea6 100644
--- a/components/style/gecko/restyle_damage.rs
+++ b/components/style/gecko/restyle_damage.rs
@@ -18,21 +18,25 @@ pub struct GeckoRestyleDamage(nsChangeHint);
impl GeckoRestyleDamage {
/// Trivially construct a new `GeckoRestyleDamage`.
+ #[inline]
pub fn new(raw: nsChangeHint) -> Self {
GeckoRestyleDamage(raw)
}
/// Get the inner change hint for this damage.
+ #[inline]
pub fn as_change_hint(&self) -> nsChangeHint {
self.0
}
/// Get an empty change hint, that is (`nsChangeHint(0)`).
+ #[inline]
pub fn empty() -> Self {
GeckoRestyleDamage(nsChangeHint(0))
}
/// Returns whether this restyle damage represents the empty damage.
+ #[inline]
pub fn is_empty(&self) -> bool {
self.0 == nsChangeHint(0)
}
diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs
index ee2210fa2f0..341d7687247 100644
--- a/components/style/gecko/wrapper.rs
+++ b/components/style/gecko/wrapper.rs
@@ -294,6 +294,7 @@ impl<'ln> TNode for GeckoNode<'ln> {
unimplemented!()
}
+ #[inline]
fn as_element(&self) -> Option<GeckoElement<'ln>> {
if self.is_element() {
unsafe { Some(GeckoElement(&*(self.0 as *const _ as *const RawGeckoElement))) }
@@ -1019,10 +1020,12 @@ impl<'le> TElement for GeckoElement<'le> {
Gecko_ClassOrClassList)
}
+ #[inline]
fn has_snapshot(&self) -> bool {
self.flags() & (ELEMENT_HAS_SNAPSHOT as u32) != 0
}
+ #[inline]
fn handled_snapshot(&self) -> bool {
self.flags() & (ELEMENT_HANDLED_SNAPSHOT as u32) != 0
}
@@ -1032,6 +1035,7 @@ impl<'le> TElement for GeckoElement<'le> {
self.set_flags(ELEMENT_HANDLED_SNAPSHOT as u32)
}
+ #[inline]
fn has_dirty_descendants(&self) -> bool {
self.flags() & (ELEMENT_HAS_DIRTY_DESCENDANTS_FOR_SERVO as u32) != 0
}
@@ -1046,6 +1050,7 @@ impl<'le> TElement for GeckoElement<'le> {
self.unset_flags(ELEMENT_HAS_DIRTY_DESCENDANTS_FOR_SERVO as u32)
}
+ #[inline]
fn has_animation_only_dirty_descendants(&self) -> bool {
self.flags() & (ELEMENT_HAS_ANIMATION_ONLY_DIRTY_DESCENDANTS_FOR_SERVO as u32) != 0
}
@@ -1064,11 +1069,13 @@ impl<'le> TElement for GeckoElement<'le> {
NODE_DESCENDANTS_NEED_FRAMES as u32)
}
+ #[inline]
fn is_visited_link(&self) -> bool {
use element_state::IN_VISITED_STATE;
self.get_state().intersects(IN_VISITED_STATE)
}
+ #[inline]
fn is_native_anonymous(&self) -> bool {
use gecko_bindings::structs::NODE_IS_NATIVE_ANONYMOUS;
self.flags() & (NODE_IS_NATIVE_ANONYMOUS as u32) != 0
@@ -1096,6 +1103,7 @@ impl<'le> TElement for GeckoElement<'le> {
panic!("Atomic child count not implemented in Gecko");
}
+ #[inline(always)]
fn get_data(&self) -> Option<&AtomicRefCell<ElementData>> {
unsafe { self.0.mServoData.get().as_ref() }
}
@@ -1127,6 +1135,7 @@ impl<'le> TElement for GeckoElement<'le> {
}
}
+ #[inline]
fn skip_root_and_item_based_display_fixup(&self) -> bool {
// We don't want to fix up display values of native anonymous content.
// Additionally, we want to skip root-based display fixup for document
diff --git a/components/style/traversal.rs b/components/style/traversal.rs
index 29e36eb29d4..5379f0cdee8 100644
--- a/components/style/traversal.rs
+++ b/components/style/traversal.rs
@@ -57,6 +57,7 @@ impl TraversalDriver {
}
#[cfg(feature = "servo")]
+#[inline]
fn is_servo_nonincremental_layout() -> bool {
use servo_config::opts;
@@ -64,6 +65,7 @@ fn is_servo_nonincremental_layout() -> bool {
}
#[cfg(not(feature = "servo"))]
+#[inline]
fn is_servo_nonincremental_layout() -> bool {
false
}
diff --git a/components/style/traversal_flags.rs b/components/style/traversal_flags.rs
index 473b576a456..341f21016a9 100644
--- a/components/style/traversal_flags.rs
+++ b/components/style/traversal_flags.rs
@@ -77,6 +77,7 @@ pub fn assert_traversal_flags_match() {
impl TraversalFlags {
/// Returns true if the traversal is for animation-only restyles.
+ #[inline]
pub fn for_animation_only(&self) -> bool {
self.contains(AnimationOnly)
}