diff --git a/gfx/layers/LayerMetricsWrapper.h b/gfx/layers/LayerMetricsWrapper.h index 6ed82fd6296f..1e7ada0970a8 100644 --- a/gfx/layers/LayerMetricsWrapper.h +++ b/gfx/layers/LayerMetricsWrapper.h @@ -372,10 +372,14 @@ public: Maybe result; - // The layer can have a clip rect, which is considered to apply - // only to the bottommost LayerMetrics. + // The layer can have a clip rect and a scrolled clip, which are considered + // to apply only to the bottommost LayerMetricsWrapper. + // TODO: These actually apply in a different coordinate space than the + // scroll clip of the bottommost metrics, so we shouldn't be intersecting + // them with the scroll clip; bug 1269537 tracks fixing this. if (AtBottomLayer()) { result = mLayer->GetClipRect(); + result = IntersectMaybeRects(result, mLayer->GetScrolledClipRect()); } // The scroll metadata can have a clip rect as well. diff --git a/gfx/layers/Layers.cpp b/gfx/layers/Layers.cpp index fa02445cffaa..22e7186335f8 100644 --- a/gfx/layers/Layers.cpp +++ b/gfx/layers/Layers.cpp @@ -851,6 +851,12 @@ Layer::CalculateScissorRect(const RenderTargetIntRect& aCurrentScissorRect) return currentClip.Intersect(scissor); } +Maybe +Layer::GetScrolledClipRect() const +{ + return mScrolledClip ? Some(mScrolledClip->GetClipRect()) : Nothing(); +} + const ScrollMetadata& Layer::GetScrollMetadata(uint32_t aIndex) const { diff --git a/gfx/layers/Layers.h b/gfx/layers/Layers.h index 459a1ee33061..1a63b17346b6 100644 --- a/gfx/layers/Layers.h +++ b/gfx/layers/Layers.h @@ -1302,6 +1302,7 @@ public: gfx::CompositionOp GetMixBlendMode() const { return mMixBlendMode; } const Maybe& GetClipRect() const { return mClipRect; } const Maybe& GetScrolledClip() const { return mScrolledClip; } + Maybe GetScrolledClipRect() const; uint32_t GetContentFlags() { return mContentFlags; } const gfx::IntRect& GetLayerBounds() const { return mLayerBounds; } const LayerIntRegion& GetVisibleRegion() const { return mVisibleRegion; }