diff --git a/gfx/layers/wr/WebRenderBridgeChild.cpp b/gfx/layers/wr/WebRenderBridgeChild.cpp index e5408a58f5b4..57fdaf29e514 100644 --- a/gfx/layers/wr/WebRenderBridgeChild.cpp +++ b/gfx/layers/wr/WebRenderBridgeChild.cpp @@ -178,7 +178,7 @@ WriteFontFileData(const uint8_t* aData, uint32_t aLength, uint32_t aIndex, void WebRenderBridgeChild::PushGlyphs(wr::DisplayListBuilder& aBuilder, const nsTArray& aGlyphs, - gfx::ScaledFont* aFont, const gfx::Point& aOffset, const gfx::Rect& aBounds, + gfx::ScaledFont* aFont, const LayerPoint& aOffset, const gfx::Rect& aBounds, const gfx::Rect& aClip) { MOZ_ASSERT(aFont); diff --git a/gfx/layers/wr/WebRenderBridgeChild.h b/gfx/layers/wr/WebRenderBridgeChild.h index 5ec981c93c20..e77c4975a7e6 100644 --- a/gfx/layers/wr/WebRenderBridgeChild.h +++ b/gfx/layers/wr/WebRenderBridgeChild.h @@ -92,7 +92,7 @@ public: } void PushGlyphs(wr::DisplayListBuilder& aBuilder, const nsTArray& aGlyphs, - gfx::ScaledFont* aFont, const gfx::Point& aOffset, const gfx::Rect& aBounds, + gfx::ScaledFont* aFont, const LayerPoint& aOffset, const gfx::Rect& aBounds, const gfx::Rect& aClip); wr::FontKey GetFontKeyForScaledFont(gfx::ScaledFont* aScaledFont); diff --git a/gfx/layers/wr/WebRenderCanvasLayer.cpp b/gfx/layers/wr/WebRenderCanvasLayer.cpp index dd57bade450d..f1c36c525985 100644 --- a/gfx/layers/wr/WebRenderCanvasLayer.cpp +++ b/gfx/layers/wr/WebRenderCanvasLayer.cpp @@ -60,7 +60,7 @@ WebRenderCanvasLayer::RenderLayer(wr::DisplayListBuilder& aBuilder) transform.PreTranslate(0, mBounds.height, 0).PreScale(1, -1, 1); } - gfx::Rect relBounds = GetWrRelBounds(); + LayerRect relBounds = GetWrRelBounds(); LayerRect rect = RelativeToVisible(LayerRect(0, 0, mBounds.width, mBounds.height)); LayerRect clipRect = GetWrClipRect(rect); diff --git a/gfx/layers/wr/WebRenderColorLayer.cpp b/gfx/layers/wr/WebRenderColorLayer.cpp index 3f51439ae3e2..0b5da695c6ee 100644 --- a/gfx/layers/wr/WebRenderColorLayer.cpp +++ b/gfx/layers/wr/WebRenderColorLayer.cpp @@ -20,7 +20,7 @@ void WebRenderColorLayer::RenderLayer(wr::DisplayListBuilder& aBuilder) { gfx::Matrix4x4 transform = GetTransform(); - gfx::Rect relBounds = GetWrRelBounds(); + LayerRect relBounds = GetWrRelBounds(); LayerRect rect = GetWrBoundsRect(); LayerRect clipRect = GetWrClipRect(rect); diff --git a/gfx/layers/wr/WebRenderContainerLayer.cpp b/gfx/layers/wr/WebRenderContainerLayer.cpp index 25e12e617fc8..e6c91c430415 100644 --- a/gfx/layers/wr/WebRenderContainerLayer.cpp +++ b/gfx/layers/wr/WebRenderContainerLayer.cpp @@ -21,7 +21,7 @@ WebRenderContainerLayer::RenderLayer(wr::DisplayListBuilder& aBuilder) gfx::Matrix4x4 transform = GetTransform(); float opacity = GetLocalOpacity(); - gfx::Rect relBounds = GetWrRelBounds(); + LayerRect relBounds = GetWrRelBounds(); gfx::Rect clip(0, 0, relBounds.width, relBounds.height); Maybe mask = BuildWrMaskLayer(true); diff --git a/gfx/layers/wr/WebRenderDisplayItemLayer.cpp b/gfx/layers/wr/WebRenderDisplayItemLayer.cpp index 0dab1c32f377..8d7f99a0f0b4 100644 --- a/gfx/layers/wr/WebRenderDisplayItemLayer.cpp +++ b/gfx/layers/wr/WebRenderDisplayItemLayer.cpp @@ -168,7 +168,7 @@ WebRenderDisplayItemLayer::PushItemAsImage(wr::DisplayListBuilder& aBuilder, return false; } - gfx::Rect dest = RelativeToParent(imageRect.ToUnknownRect()) + offset.ToUnknownPoint(); + LayerRect dest = RelativeToParent(imageRect) + offset; WrClipRegion clipRegion = aBuilder.BuildClipRegion(wr::ToWrRect(dest)); WrImageKey key = GetImageKey(); aParentCommands.AppendElement(layers::OpAddExternalImage( diff --git a/gfx/layers/wr/WebRenderImageLayer.cpp b/gfx/layers/wr/WebRenderImageLayer.cpp index 139cac62b333..9e2a1803159f 100644 --- a/gfx/layers/wr/WebRenderImageLayer.cpp +++ b/gfx/layers/wr/WebRenderImageLayer.cpp @@ -164,7 +164,7 @@ WebRenderImageLayer::RenderLayer(wr::DisplayListBuilder& aBuilder) } gfx::Matrix4x4 transform = GetTransform(); - gfx::Rect relBounds = GetWrRelBounds(); + LayerRect relBounds = GetWrRelBounds(); LayerRect rect(0, 0, size.width, size.height); if (mScaleMode != ScaleMode::SCALE_NONE) { diff --git a/gfx/layers/wr/WebRenderLayer.cpp b/gfx/layers/wr/WebRenderLayer.cpp index 789005cd12bb..039cecf95c3a 100644 --- a/gfx/layers/wr/WebRenderLayer.cpp +++ b/gfx/layers/wr/WebRenderLayer.cpp @@ -55,46 +55,49 @@ WebRenderLayer::RelativeToTransformedVisible(Rect aRect) return aRect; } -Rect +LayerRect WebRenderLayer::ParentStackingContextBounds() { // Walk up to find the parent stacking context. This will be created either // by the nearest scrollable metrics, or by the parent layer which must be a // ContainerLayer. - Layer* layer = GetLayer(); - if (layer->GetParent()) { - return IntRectToRect(layer->GetParent()->GetVisibleRegion().GetBounds().ToUnknownRect()); + if (Layer* parent = GetLayer()->GetParent()) { + return ToWebRenderLayer(parent)->Bounds(); } - return Rect(); + return LayerRect(); } -Rect -WebRenderLayer::RelativeToParent(Rect aRect) +LayerRect +WebRenderLayer::RelativeToParent(const LayerRect& aRect) { - Rect parentBounds = ParentStackingContextBounds(); - aRect.MoveBy(-parentBounds.x, -parentBounds.y); - return aRect; + return aRect - ParentStackingContextBounds().TopLeft(); } -Point +LayerRect +WebRenderLayer::RelativeToParent(const LayoutDeviceRect& aRect) +{ + return RelativeToParent(ViewAs( + aRect, PixelCastJustification::WebRenderHasUnitResolution)); +} + +LayerPoint WebRenderLayer::GetOffsetToParent() { - Rect parentBounds = ParentStackingContextBounds(); - return parentBounds.TopLeft(); + return ParentStackingContextBounds().TopLeft(); } -Rect +LayerRect WebRenderLayer::VisibleBoundsRelativeToParent() { - return RelativeToParent(IntRectToRect(GetLayer()->GetVisibleRegion().GetBounds().ToUnknownRect())); + return RelativeToParent(Bounds()); } -Rect +gfx::Rect WebRenderLayer::TransformedVisibleBoundsRelativeToParent() { IntRect bounds = GetLayer()->GetVisibleRegion().GetBounds().ToUnknownRect(); Rect transformed = GetLayer()->GetTransform().TransformBounds(IntRectToRect(bounds)); - return RelativeToParent(transformed); + return transformed - ParentStackingContextBounds().ToUnknownRect().TopLeft(); } Maybe @@ -178,10 +181,10 @@ WebRenderLayer::ClipRect() return Some(transform.Inverse().TransformBounds(clip)); } -gfx::Rect +LayerRect WebRenderLayer::GetWrRelBounds() { - return RelativeToParent(BoundsForStackingContext().ToUnknownRect()); + return RelativeToParent(BoundsForStackingContext()); } Maybe @@ -228,7 +231,7 @@ WebRenderLayer::DumpLayerInfo(const char* aLayerType, const LayerRect& aRect) Matrix4x4 transform = GetLayer()->GetTransform(); LayerRect clip = GetWrClipRect(aRect); - Rect relBounds = GetWrRelBounds(); + LayerRect relBounds = GetWrRelBounds(); Rect overflow(0, 0, relBounds.width, relBounds.height); WrMixBlendMode mixBlendMode = wr::ToWrMixBlendMode(GetLayer()->GetMixBlendMode()); diff --git a/gfx/layers/wr/WebRenderLayer.h b/gfx/layers/wr/WebRenderLayer.h index 364ecd4ac781..f0ce81533277 100644 --- a/gfx/layers/wr/WebRenderLayer.h +++ b/gfx/layers/wr/WebRenderLayer.h @@ -48,10 +48,11 @@ public: LayerRect RelativeToVisible(const LayerRect& aRect); gfx::Rect RelativeToTransformedVisible(gfx::Rect aRect); - gfx::Rect ParentStackingContextBounds(); - gfx::Rect RelativeToParent(gfx::Rect aRect); - gfx::Rect VisibleBoundsRelativeToParent(); - gfx::Point GetOffsetToParent(); + LayerRect ParentStackingContextBounds(); + LayerRect RelativeToParent(const LayerRect& aRect); + LayerRect RelativeToParent(const LayoutDeviceRect& aRect); + LayerRect VisibleBoundsRelativeToParent(); + LayerPoint GetOffsetToParent(); gfx::Rect TransformedVisibleBoundsRelativeToParent(); protected: LayerRect Bounds(); @@ -60,7 +61,7 @@ protected: Maybe ClipRect(); LayerRect GetWrBoundsRect(); - gfx::Rect GetWrRelBounds(); + LayerRect GetWrRelBounds(); LayerRect GetWrClipRect(const LayerRect& aRect); void DumpLayerInfo(const char* aLayerType, const LayerRect& aRect); Maybe BuildWrMaskLayer(bool aUnapplyLayerTransform); diff --git a/gfx/layers/wr/WebRenderPaintedLayer.cpp b/gfx/layers/wr/WebRenderPaintedLayer.cpp index 4005ff6f48ec..03dae3050040 100644 --- a/gfx/layers/wr/WebRenderPaintedLayer.cpp +++ b/gfx/layers/wr/WebRenderPaintedLayer.cpp @@ -95,7 +95,7 @@ WebRenderPaintedLayer::CreateWebRenderDisplayList(wr::DisplayListBuilder& aBuild LayerIntSize size = bounds.Size(); gfx::Matrix4x4 transform = GetTransform(); - gfx::Rect relBounds = GetWrRelBounds(); + LayerRect relBounds = GetWrRelBounds(); LayerRect rect(0, 0, size.width, size.height); LayerRect clipRect = GetWrClipRect(rect); diff --git a/gfx/layers/wr/WebRenderTextLayer.cpp b/gfx/layers/wr/WebRenderTextLayer.cpp index afc5608229be..22e39f475514 100644 --- a/gfx/layers/wr/WebRenderTextLayer.cpp +++ b/gfx/layers/wr/WebRenderTextLayer.cpp @@ -24,10 +24,12 @@ WebRenderTextLayer::RenderLayer(wr::DisplayListBuilder& aBuilder) return; } - gfx::Rect rect = RelativeToParent(GetTransform().TransformBounds(IntRectToRect(mBounds))); + gfx::Rect rect = GetTransform().TransformBounds(IntRectToRect(mBounds)) + - ParentStackingContextBounds().ToUnknownRect().TopLeft(); gfx::Rect clip; if (GetClipRect().isSome()) { - clip = RelativeToParent(IntRectToRect(GetClipRect().ref().ToUnknownRect())); + clip = IntRectToRect(GetClipRect().ref().ToUnknownRect()) + - ParentStackingContextBounds().ToUnknownRect().TopLeft(); } else { clip = rect; } diff --git a/layout/generic/nsBulletFrame.cpp b/layout/generic/nsBulletFrame.cpp index 55afea8c3f85..4ceda6a3572d 100644 --- a/layout/generic/nsBulletFrame.cpp +++ b/layout/generic/nsBulletFrame.cpp @@ -463,9 +463,9 @@ BulletRenderer::CreateWebRenderCommandsForImage(nsDisplayItem* aItem, } const int32_t appUnitsPerDevPixel = aItem->Frame()->PresContext()->AppUnitsPerDevPixel(); - Rect destRect = LayoutDeviceRect::FromAppUnits(mDest, appUnitsPerDevPixel).ToUnknownRect(); - Rect destRectTransformed = aLayer->RelativeToParent(destRect); - IntRect dest = RoundedToInt(destRectTransformed); + LayoutDeviceRect destRect = LayoutDeviceRect::FromAppUnits(mDest, appUnitsPerDevPixel); + LayerRect destRectTransformed = aLayer->RelativeToParent(destRect); + LayerIntRect dest = RoundedToInt(destRectTransformed); WrClipRegion clipRegion = aBuilder.BuildClipRegion(wr::ToWrRect(dest)); @@ -502,9 +502,9 @@ BulletRenderer::CreateWebRenderCommandsForText(nsDisplayItem* aItem, nsDisplayListBuilder* builder = layer->GetDisplayListBuilder(); const int32_t appUnitsPerDevPixel = aItem->Frame()->PresContext()->AppUnitsPerDevPixel(); bool dummy; - Rect destRect = LayoutDeviceRect::FromAppUnits( - aItem->GetBounds(builder, &dummy), appUnitsPerDevPixel).ToUnknownRect(); - Rect destRectTransformed = aLayer->RelativeToParent(destRect); + LayoutDeviceRect destRect = LayoutDeviceRect::FromAppUnits( + aItem->GetBounds(builder, &dummy), appUnitsPerDevPixel); + gfx::Rect destRectTransformed = aLayer->RelativeToParent(destRect).ToUnknownRect(); layer->WrBridge()->PushGlyphs(aBuilder, mGlyphs, mFont, aLayer->GetOffsetToParent(), destRectTransformed, destRectTransformed); diff --git a/layout/generic/nsCanvasFrame.cpp b/layout/generic/nsCanvasFrame.cpp index d849467b46cb..71be3ada5496 100644 --- a/layout/generic/nsCanvasFrame.cpp +++ b/layout/generic/nsCanvasFrame.cpp @@ -312,12 +312,10 @@ nsDisplayCanvasBackgroundColor::CreateWebRenderCommands(mozilla::wr::DisplayList nsRect bgClipRect = frame->CanvasArea() + offset; int32_t appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel(); - Rect devPxRect(Float(bgClipRect.x / appUnitsPerDevPixel), - Float(bgClipRect.y / appUnitsPerDevPixel), - Float(bgClipRect.width / appUnitsPerDevPixel), - Float(bgClipRect.height / appUnitsPerDevPixel)); + LayoutDeviceRect rect = LayoutDeviceRect::FromAppUnits( + bgClipRect, appUnitsPerDevPixel); - Rect transformedRect = aLayer->RelativeToParent(devPxRect); + LayerRect transformedRect = aLayer->RelativeToParent(rect); aBuilder.PushRect(wr::ToWrRect(transformedRect), aBuilder.BuildClipRegion(wr::ToWrRect(transformedRect)), wr::ToWrColor(ToDeviceColor(mColor))); diff --git a/layout/painting/nsCSSRenderingBorders.cpp b/layout/painting/nsCSSRenderingBorders.cpp index 7bb05df2b349..f78042d0ffb1 100644 --- a/layout/painting/nsCSSRenderingBorders.cpp +++ b/layout/painting/nsCSSRenderingBorders.cpp @@ -3554,7 +3554,8 @@ nsCSSBorderRenderer::CreateWebRenderCommands(wr::DisplayListBuilder& aBuilder, layers::WebRenderDisplayItemLayer* aLayer, gfx::Rect aClipRect) { - Rect transformedRect = aLayer->RelativeToParent(mOuterRect); + LayoutDeviceRect outerRect = LayoutDeviceRect::FromUnknownRect(mOuterRect); + LayerRect transformedRect = aLayer->RelativeToParent(outerRect); WrBorderSide side[4]; NS_FOR_CSS_SIDES(i) { side[i] = wr::ToWrBorderSide(ToDeviceColor(mBorderColors[i]), mBorderStyles[i]); diff --git a/layout/painting/nsCSSRenderingGradients.cpp b/layout/painting/nsCSSRenderingGradients.cpp index 8a3d63bc0b21..72d6e777a1f5 100644 --- a/layout/painting/nsCSSRenderingGradients.cpp +++ b/layout/painting/nsCSSRenderingGradients.cpp @@ -1062,9 +1062,9 @@ nsCSSGradientRenderer::BuildWebRenderDisplayItems(wr::DisplayListBuilder& aBuild LayoutDeviceSize tileSpacing = tileRepeat - firstTileBounds.Size(); // Make the rects relative to the parent stacking context - clipBounds = LayoutDeviceRect::FromUnknownRect(aLayer->RelativeToParent(clipBounds.ToUnknownRect())); - firstTileBounds = LayoutDeviceRect::FromUnknownRect(aLayer->RelativeToParent(firstTileBounds.ToUnknownRect())); - gradientBounds = LayoutDeviceRect::FromUnknownRect(aLayer->RelativeToParent(gradientBounds.ToUnknownRect())); + LayerRect layerClipBounds = aLayer->RelativeToParent(clipBounds); + LayerRect layerFirstTileBounds = aLayer->RelativeToParent(firstTileBounds); + LayerRect layerGradientBounds = aLayer->RelativeToParent(gradientBounds); // srcTransform is used for scaling the gradient to match aSrc LayoutDeviceRect srcTransform = LayoutDeviceRect(mPresContext->CSSPixelsToAppUnits(aSrc.x), @@ -1080,26 +1080,26 @@ nsCSSGradientRenderer::BuildWebRenderDisplayItems(wr::DisplayListBuilder& aBuild lineEnd.y = (lineEnd.y - srcTransform.y) * srcTransform.height; aBuilder.PushLinearGradient( - mozilla::wr::ToWrRect(gradientBounds), - aBuilder.BuildClipRegion(mozilla::wr::ToWrRect(clipBounds)), + mozilla::wr::ToWrRect(layerGradientBounds), + aBuilder.BuildClipRegion(mozilla::wr::ToWrRect(layerClipBounds)), mozilla::wr::ToWrPoint(lineStart), mozilla::wr::ToWrPoint(lineEnd), stops, extendMode, - mozilla::wr::ToWrSize(firstTileBounds.Size()), + mozilla::wr::ToWrSize(layerFirstTileBounds.Size()), mozilla::wr::ToWrSize(tileSpacing)); } else { gradientRadius.width *= srcTransform.width; gradientRadius.height *= srcTransform.height; aBuilder.PushRadialGradient( - mozilla::wr::ToWrRect(gradientBounds), - aBuilder.BuildClipRegion(mozilla::wr::ToWrRect(clipBounds)), + mozilla::wr::ToWrRect(layerGradientBounds), + aBuilder.BuildClipRegion(mozilla::wr::ToWrRect(layerClipBounds)), mozilla::wr::ToWrPoint(lineStart), mozilla::wr::ToWrSize(gradientRadius), stops, extendMode, - mozilla::wr::ToWrSize(firstTileBounds.Size()), + mozilla::wr::ToWrSize(layerFirstTileBounds.Size()), mozilla::wr::ToWrSize(tileSpacing)); } } diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp index 6e6bf7063a0c..76ede2ec9718 100644 --- a/layout/painting/nsDisplayList.cpp +++ b/layout/painting/nsDisplayList.cpp @@ -4511,16 +4511,16 @@ nsDisplayCaret::CreateWebRenderCommands(wr::DisplayListBuilder& aBuilder, mCaret->ComputeCaretRects(frame, contentOffset, &caretRect, &hookRect); gfx::Color color = ToDeviceColor(frame->GetCaretColorAt(contentOffset)); - Rect devCaretRect = LayoutDeviceRect::FromAppUnits( - caretRect + ToReferenceFrame(), appUnitsPerDevPixel).ToUnknownRect(); - Rect devHookRect = LayoutDeviceRect::FromAppUnits( - hookRect + ToReferenceFrame(), appUnitsPerDevPixel).ToUnknownRect(); + LayoutDeviceRect devCaretRect = LayoutDeviceRect::FromAppUnits( + caretRect + ToReferenceFrame(), appUnitsPerDevPixel); + LayoutDeviceRect devHookRect = LayoutDeviceRect::FromAppUnits( + hookRect + ToReferenceFrame(), appUnitsPerDevPixel); - Rect caretTransformedRect = aLayer->RelativeToParent(devCaretRect); - Rect hookTransformedRect = aLayer->RelativeToParent(devHookRect); + LayerRect caretTransformedRect = aLayer->RelativeToParent(devCaretRect); + LayerRect hookTransformedRect = aLayer->RelativeToParent(devHookRect); - IntRect caret = RoundedToInt(caretTransformedRect); - IntRect hook = RoundedToInt(hookTransformedRect); + LayerIntRect caret = RoundedToInt(caretTransformedRect); + LayerIntRect hook = RoundedToInt(hookTransformedRect); // Note, WR will pixel snap anything that is layout aligned. aBuilder.PushRect(wr::ToWrRect(caret), @@ -4769,16 +4769,16 @@ nsDisplayBorder::CreateBorderImageWebRenderCommands(mozilla::wr::DisplayListBuil outset[i] = (float)(mBorderImageRenderer->mImageOutset.Side(i)) / appUnitsPerDevPixel; } - Rect destRect = LayoutDeviceRect::FromAppUnits( - mBorderImageRenderer->mArea, appUnitsPerDevPixel).ToUnknownRect(); - Rect destRectTransformed = aLayer->RelativeToParent(destRect); - IntRect dest = RoundedToInt(destRectTransformed); + LayoutDeviceRect destRect = LayoutDeviceRect::FromAppUnits( + mBorderImageRenderer->mArea, appUnitsPerDevPixel); + LayerRect destRectTransformed = aLayer->RelativeToParent(destRect); + LayerIntRect dest = RoundedToInt(destRectTransformed); - IntRect clip = dest; + LayerIntRect clip = dest; if (!mBorderImageRenderer->mClip.IsEmpty()) { - Rect clipRect = LayoutDeviceRect::FromAppUnits( - mBorderImageRenderer->mClip, appUnitsPerDevPixel).ToUnknownRect(); - Rect clipRectTransformed = aLayer->RelativeToParent(clipRect); + LayoutDeviceRect clipRect = LayoutDeviceRect::FromAppUnits( + mBorderImageRenderer->mClip, appUnitsPerDevPixel); + LayerRect clipRectTransformed = aLayer->RelativeToParent(clipRect); clip = RoundedToInt(clipRectTransformed); } @@ -4829,10 +4829,10 @@ nsDisplayBorder::CreateBorderImageWebRenderCommands(mozilla::wr::DisplayListBuil renderer.BuildWebRenderParameters(1.0, extendMode, stops, lineStart, lineEnd, gradientRadius); if (gradientData->mShape == NS_STYLE_GRADIENT_SHAPE_LINEAR) { - Point startPoint = dest.TopLeft(); - startPoint = startPoint + Point(lineStart.x, lineStart.y); - Point endPoint = dest.TopLeft(); - endPoint = endPoint + Point(lineEnd.x, lineEnd.y); + LayerPoint startPoint = dest.TopLeft(); + startPoint = startPoint + ViewAs(lineStart, PixelCastJustification::WebRenderHasUnitResolution); + LayerPoint endPoint = dest.TopLeft(); + endPoint = endPoint + ViewAs(lineEnd, PixelCastJustification::WebRenderHasUnitResolution); aBuilder.PushBorderGradient(wr::ToWrRect(dest), aBuilder.BuildClipRegion(wr::ToWrRect(clip)), @@ -5155,8 +5155,8 @@ nsDisplayBoxShadowOuter::CreateWebRenderCommands(wr::DisplayListBuilder& aBuilde // Everything here is in app units, change to device units. for (uint32_t i = 0; i < rects.Length(); ++i) { - Rect clipRect = LayoutDeviceRect::FromAppUnits( - rects[i], appUnitsPerDevPixel).ToUnknownRect(); + LayoutDeviceRect clipRect = LayoutDeviceRect::FromAppUnits( + rects[i], appUnitsPerDevPixel); nsCSSShadowArray* shadows = mFrame->StyleEffects()->mBoxShadow; MOZ_ASSERT(shadows); @@ -5174,11 +5174,11 @@ nsDisplayBoxShadowOuter::CreateWebRenderCommands(wr::DisplayListBuilder& aBuilde shadowOffset.x = (shadow->mXOffset / appUnitsPerDevPixel); shadowOffset.y = (shadow->mYOffset / appUnitsPerDevPixel); - Rect deviceBoxRect = LayoutDeviceRect::FromAppUnits( - shadowRect, appUnitsPerDevPixel).ToUnknownRect(); - deviceBoxRect = aLayer->RelativeToParent(deviceBoxRect); + LayoutDeviceRect deviceBox = LayoutDeviceRect::FromAppUnits( + shadowRect, appUnitsPerDevPixel); + LayerRect deviceBoxRect = aLayer->RelativeToParent(deviceBox); deviceBoxRect.Round(); - Rect deviceClipRect = aLayer->RelativeToParent(clipRect); + LayerRect deviceClipRect = aLayer->RelativeToParent(clipRect); // TODO: support non-uniform border radius. float borderRadius = hasBorderRadius ? borderRadii.TopLeft().width @@ -5347,8 +5347,8 @@ nsDisplayBoxShadowInner::CreateInsetBoxShadowWebRenderCommands(mozilla::wr::Disp nsCSSShadowArray* shadows = aFrame->StyleEffects()->mBoxShadow; for (uint32_t i = 0; i < rects.Length(); ++i) { - Rect clipRect = LayoutDeviceRect::FromAppUnits( - rects[i], appUnitsPerDevPixel).ToUnknownRect(); + LayoutDeviceRect clipRect = LayoutDeviceRect::FromAppUnits( + rects[i], appUnitsPerDevPixel); for (uint32_t i = shadows->Length(); i > 0; --i) { nsCSSShadowItem* shadowItem = shadows->ShadowAt(i - 1); @@ -5364,7 +5364,7 @@ nsDisplayBoxShadowInner::CreateInsetBoxShadowWebRenderCommands(mozilla::wr::Disp // Now translate everything to device pixels. Rect deviceBoxRect = LayoutDeviceRect::FromAppUnits( shadowRect, appUnitsPerDevPixel).ToUnknownRect(); - Rect deviceClipRect = aLayer->RelativeToParent(clipRect); + LayerRect deviceClipRect = aLayer->RelativeToParent(clipRect); Color shadowColor = nsCSSRendering::GetShadowColor(shadowItem, aFrame, 1.0); Point shadowOffset; diff --git a/layout/painting/nsImageRenderer.cpp b/layout/painting/nsImageRenderer.cpp index 87ce3f311094..cb8efe64a730 100644 --- a/layout/painting/nsImageRenderer.cpp +++ b/layout/painting/nsImageRenderer.cpp @@ -621,15 +621,15 @@ nsImageRenderer::BuildWebRenderDisplayItems(nsPresContext* aPresContext, } const int32_t appUnitsPerDevPixel = mForFrame->PresContext()->AppUnitsPerDevPixel(); - Rect destRect = LayoutDeviceRect::FromAppUnits( - aDest, appUnitsPerDevPixel).ToUnknownRect(); - Rect dest = aLayer->RelativeToParent(destRect); + LayoutDeviceRect destRect = LayoutDeviceRect::FromAppUnits( + aDest, appUnitsPerDevPixel); + LayerRect dest = aLayer->RelativeToParent(destRect); - Rect fillRect = LayoutDeviceRect::FromAppUnits( - aFill, appUnitsPerDevPixel).ToUnknownRect(); - Rect fill = aLayer->RelativeToParent(fillRect); + LayoutDeviceRect fillRect = LayoutDeviceRect::FromAppUnits( + aFill, appUnitsPerDevPixel); + LayerRect fill = aLayer->RelativeToParent(fillRect); - Rect clip = fill; + LayerRect clip = fill; Size gapSize((aRepeatSize.width - aDest.width) / appUnitsPerDevPixel, (aRepeatSize.height - aDest.height) / appUnitsPerDevPixel); aBuilder.PushImage(wr::ToWrRect(fill), aBuilder.BuildClipRegion(wr::ToWrRect(clip)),