Bug 1360246 - Remove the ParentBounds and TransformedVisibleBoundsRelativeToParent functions. r=nical
authorKartikaya Gupta <kgupta@mozilla.com>
Wed, 03 May 2017 08:48:08 -0400
changeset 357034 7cb3c4963a3fda3a9ed8fc4ef3e08296c693a53d
parent 357033 0f0a5f78c75c6f3be940f20c710b65103401bf20
child 357035 ee8156686174a5943a63d825e797be091df9f550
push id31780
push userkwierso@gmail.com
push dateMon, 08 May 2017 20:34:47 +0000
treeherdermozilla-central@bab7046ee2d8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical
bugs1360246
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1360246 - Remove the ParentBounds and TransformedVisibleBoundsRelativeToParent functions. r=nical These functions also have built-in assumptions about the stacking context structure mapping to the layer tree structure which are not necessarily valid. So we remove these functions and update code that uses them. MozReview-Commit-ID: UkXXAF59qv
gfx/layers/wr/WebRenderDisplayItemLayer.cpp
gfx/layers/wr/WebRenderLayer.cpp
gfx/layers/wr/WebRenderLayer.h
--- a/gfx/layers/wr/WebRenderDisplayItemLayer.cpp
+++ b/gfx/layers/wr/WebRenderDisplayItemLayer.cpp
@@ -35,17 +35,18 @@ WebRenderDisplayItemLayer::RenderLayer(w
 {
   if (mVisibleRegion.IsEmpty()) {
     return;
   }
 
   Maybe<WrImageMask> mask = BuildWrMaskLayer(false);
   WrImageMask* imageMask = mask.ptrOr(nullptr);
   if (imageMask) {
-    gfx::Rect rect = TransformedVisibleBoundsRelativeToParent();
+    gfx::Rect rect = GetTransform().TransformBounds(Bounds().ToUnknownRect());
+    // XXX: this is probably not correct, see bug 1361357
     gfx::Rect clip(0.0, 0.0, rect.width, rect.height);
     aBuilder.PushClip(wr::ToWrRect(clip), imageMask);
   }
 
   if (mItem) {
     wr::DisplayListBuilder builder(WrBridge()->GetPipeline());
     // We might have recycled this layer. Throw away the old commands.
     mParentCommands.Clear();
--- a/gfx/layers/wr/WebRenderLayer.cpp
+++ b/gfx/layers/wr/WebRenderLayer.cpp
@@ -35,35 +35,16 @@ WrImageKey
 WebRenderLayer::GetImageKey()
 {
   WrImageKey key;
   key.mNamespace = WrBridge()->GetNamespace();
   key.mHandle = WrBridge()->GetNextResourceId();
   return key;
 }
 
-LayerRect
-WebRenderLayer::ParentBounds()
-{
-  // Walk up to find the parent stacking context. This will be created by the
-  // parent layer which must be a ContainerLayer if it exists.
-  if (Layer* parent = GetLayer()->GetParent()) {
-    return ToWebRenderLayer(parent)->Bounds();
-  }
-  return LayerRect();
-}
-
-gfx::Rect
-WebRenderLayer::TransformedVisibleBoundsRelativeToParent()
-{
-  IntRect bounds = GetLayer()->GetVisibleRegion().GetBounds().ToUnknownRect();
-  Rect transformed = GetLayer()->GetTransform().TransformBounds(IntRectToRect(bounds));
-  return transformed - ParentBounds().ToUnknownRect().TopLeft();
-}
-
 Maybe<WrImageMask>
 WebRenderLayer::BuildWrMaskLayer(bool aUnapplyLayerTransform)
 {
   if (GetLayer()->GetMaskLayer()) {
     WebRenderLayer* maskLayer = ToWebRenderLayer(GetLayer()->GetMaskLayer());
 
     // The size of mask layer is transformed, and we may set the layer transform
     // to wr stacking context. So we should apply inverse transform for mask layer
--- a/gfx/layers/wr/WebRenderLayer.h
+++ b/gfx/layers/wr/WebRenderLayer.h
@@ -47,21 +47,18 @@ public:
   WebRenderLayerManager* WrManager();
   WebRenderBridgeChild* WrBridge();
   WrImageKey GetImageKey();
 
   LayerRect Bounds();
   LayerRect BoundsForStackingContext();
 protected:
   BoundsTransformMatrix BoundsTransform();
-  LayerRect ParentBounds();
   Maybe<LayerRect> ClipRect();
 
-  gfx::Rect TransformedVisibleBoundsRelativeToParent();
-
   void DumpLayerInfo(const char* aLayerType, const LayerRect& aRect);
   Maybe<WrImageMask> BuildWrMaskLayer(bool aUnapplyLayerTransform);
 };
 
 } // namespace layers
 } // namespace mozilla
 
 #endif /* GFX_WEBRENDERLAYER_H */