servo: Merge #11035 - Do not create stacking contexts for text fragments (from mrobinson:no-stacking-contexts-for-text-fragments); r=pcwalton
authorMartin Robinson <mrobinson@igalia.com>
Wed, 01 Jun 2016 19:22:22 -0500
changeset 338982 1c3053f2d8789617b1a1ca6616d9848f475f9e66
parent 338981 9a2701f4f1cc681b5ebd30c55ff356d8c2256500
child 338983 7ae00803f901d065de567f97d72a259a6e190b1f
push id31307
push usergszorc@mozilla.com
push dateSat, 04 Feb 2017 00:59:06 +0000
treeherdermozilla-central@94079d43835f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspcwalton
servo: Merge #11035 - Do not create stacking contexts for text fragments (from mrobinson:no-stacking-contexts-for-text-fragments); r=pcwalton Without this change, each text fragment in a block that establishes a stacking context will establish its own stacking context. This is unnecessary and increases the amount of work done during display list construction. This change should not change output, but should improve performance. Source-Repo: https://github.com/servo/servo Source-Revision: cc7953e25eaf6221a0e6e31af43214d0807185eb
servo/components/layout/fragment.rs
--- a/servo/components/layout/fragment.rs
+++ b/servo/components/layout/fragment.rs
@@ -2202,16 +2202,23 @@ impl Fragment {
         Rect::new(Point2D::new(stacking_relative_border_box.origin.x + border_padding.left,
                                stacking_relative_border_box.origin.y + border_padding.top),
                   Size2D::new(stacking_relative_border_box.size.width - border_padding.horizontal(),
                               stacking_relative_border_box.size.height - border_padding.vertical()))
     }
 
     /// Returns true if this fragment establishes a new stacking context and false otherwise.
     pub fn establishes_stacking_context(&self) -> bool {
+        // Text fragments shouldn't create stacking contexts.
+        match self.specific {
+            SpecificFragmentInfo::ScannedText(_) |
+            SpecificFragmentInfo::UnscannedText(_) => return false,
+            _ => {}
+        }
+
         if self.flags.contains(HAS_LAYER) {
             return true
         }
         if self.style().get_effects().opacity != 1.0 {
             return true
         }
         if !self.style().get_effects().filter.is_empty() {
             return true