Bug 1267438 - Use IntersectMaybeRects() in Layer::GetCombinedClipRect(). r=mstange
authorBotond Ballo <botond@mozilla.com>
Fri, 29 Apr 2016 15:44:08 -0400
changeset 365130 1065434be718ec94d30480100f1c409cc446c6ac
parent 365129 f4b3c6c334e9bacbd278dfb4cd5aeee59098ef9d
child 365131 b802e4ef209948f307565f2ba750b2fbd340bcb6
push id17650
push usermartin.thomson@gmail.com
push dateTue, 10 May 2016 05:06:10 +0000
reviewersmstange
bugs1267438
milestone49.0a1
Bug 1267438 - Use IntersectMaybeRects() in Layer::GetCombinedClipRect(). r=mstange MozReview-Commit-ID: 5DkpzyFrDQ0
gfx/layers/Layers.cpp
--- a/gfx/layers/Layers.cpp
+++ b/gfx/layers/Layers.cpp
@@ -1096,26 +1096,17 @@ Layer::GetVisibleRegionRelativeToRootLay
 }
 
 Maybe<ParentLayerIntRect>
 Layer::GetCombinedClipRect() const
 {
   Maybe<ParentLayerIntRect> clip = GetClipRect();
 
   for (size_t i = 0; i < mScrollMetadata.Length(); i++) {
-    if (!mScrollMetadata[i].HasClipRect()) {
-      continue;
-    }
-
-    const ParentLayerIntRect& other = mScrollMetadata[i].ClipRect();
-    if (clip) {
-      clip = Some(clip.value().Intersect(other));
-    } else {
-      clip = Some(other);
-    }
+    clip = IntersectMaybeRects(clip, mScrollMetadata[i].GetClipRect());
   }
 
   return clip;
 }
 
 ContainerLayer::ContainerLayer(LayerManager* aManager, void* aImplData)
   : Layer(aManager, aImplData),
     mFirstChild(nullptr),