Bug 1409856 - Update all the WebRender code to use LayoutDevice units instead of Layer units. r=jrmuizel

MozReview-Commit-ID: DP3hwlFWyZC
This commit is contained in:
Kartikaya Gupta 2017-10-18 22:25:11 -04:00
parent 9c3824dc0c
commit d8ac050c91
23 changed files with 93 additions and 157 deletions

View File

@ -507,8 +507,9 @@ APZCTreeManager::PushStateToWR(wr::WebRenderAPI* aWrApi,
// the scroll offset. Since we are effectively giving WR the async
// scroll delta here, we want to negate the translation.
ParentLayerPoint asyncScrollDelta = -layerTranslation;
// XXX figure out what zoom-related conversions need to happen here.
aWrApi->UpdateScrollPosition(lastPipelineId, apzc->GetGuid().mScrollId,
wr::ToLayoutPoint(asyncScrollDelta));
wr::ToLayoutPoint(LayoutDevicePoint::FromUnknownPoint(asyncScrollDelta.ToUnknownPoint())));
apzc->ReportCheckerboard(aSampleTime);
activeAnimations |= apzc->AdvanceAnimations(aSampleTime);

View File

@ -23,8 +23,7 @@ using mozilla::wr::FontKey from "mozilla/webrender/WebRenderTypes.h";
using mozilla::wr::ImageKey from "mozilla/webrender/WebRenderTypes.h";
using mozilla::wr::PipelineId from "mozilla/webrender/WebRenderTypes.h";
using mozilla::gfx::MaybeIntSize from "mozilla/gfx/Point.h";
using mozilla::LayerPoint from "Units.h";
using mozilla::layers::MaybeLayerRect from "mozilla/layers/LayersTypes.h";
using mozilla::LayoutDeviceRect from "Units.h";
using class mozilla::gfx::Matrix4x4 from "mozilla/gfx/Matrix.h";
using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
@ -54,7 +53,7 @@ struct OpAddCompositorAnimations {
struct OpUpdateAsyncImagePipeline {
PipelineId pipelineId;
LayerRect scBounds;
LayoutDeviceRect scBounds;
Matrix4x4 scTransform;
MaybeIntSize scaleToSize;
ImageRendering filter;

View File

@ -122,7 +122,7 @@ AsyncImagePipelineManager::RemoveAsyncImagePipeline(const wr::PipelineId& aPipel
void
AsyncImagePipelineManager::UpdateAsyncImagePipeline(const wr::PipelineId& aPipelineId,
const LayerRect& aScBounds,
const LayoutDeviceRect& aScBounds,
const gfx::Matrix4x4& aScTransform,
const gfx::MaybeIntSize& aScaleToSize,
const wr::ImageRendering& aFilter,
@ -293,9 +293,9 @@ AsyncImagePipelineManager::ApplyAsyncImages()
nsTArray<wr::WrFilterOp>(),
true);
LayerRect rect(0, 0, pipeline->mCurrentTexture->GetSize().width, pipeline->mCurrentTexture->GetSize().height);
LayoutDeviceRect rect(0, 0, pipeline->mCurrentTexture->GetSize().width, pipeline->mCurrentTexture->GetSize().height);
if (pipeline->mScaleToSize.isSome()) {
rect = LayerRect(0, 0, pipeline->mScaleToSize.value().width, pipeline->mScaleToSize.value().height);
rect = LayoutDeviceRect(0, 0, pipeline->mScaleToSize.value().width, pipeline->mScaleToSize.value().height);
}
if (pipeline->mUseExternalImage) {

View File

@ -73,7 +73,7 @@ public:
void RemoveAsyncImagePipeline(const wr::PipelineId& aPipelineId);
void UpdateAsyncImagePipeline(const wr::PipelineId& aPipelineId,
const LayerRect& aScBounds,
const LayoutDeviceRect& aScBounds,
const gfx::Matrix4x4& aScTransform,
const gfx::MaybeIntSize& aScaleToSize,
const wr::ImageRendering& aFilter,
@ -123,7 +123,7 @@ private:
bool mInitialised;
bool mIsChanged;
bool mUseExternalImage;
LayerRect mScBounds;
LayoutDeviceRect mScBounds;
gfx::Matrix4x4 mScTransform;
gfx::MaybeIntSize mScaleToSize;
wr::ImageRendering mFilter;

View File

@ -175,13 +175,11 @@ ScrollingLayersHelper::DefineAndPushScrollLayer(const FrameMetrics& aMetrics,
if (!aMetrics.IsScrollable()) {
return false;
}
LayerRect contentRect = ViewAs<LayerPixel>(
aMetrics.GetExpandedScrollableRect() * aMetrics.GetDevPixelsPerCSSPixel(),
PixelCastJustification::WebRenderHasUnitResolution);
LayoutDeviceRect contentRect =
aMetrics.GetExpandedScrollableRect() * aMetrics.GetDevPixelsPerCSSPixel();
// TODO: check coordinate systems are sane here
LayerRect clipBounds = ViewAs<LayerPixel>(
aMetrics.GetCompositionBounds(),
PixelCastJustification::MovingDownToChildren);
LayoutDeviceRect clipBounds =
LayoutDeviceRect::FromUnknownRect(aMetrics.GetCompositionBounds().ToUnknownRect());
// The content rect that we hand to PushScrollLayer should be relative to
// the same origin as the clipBounds that we hand to PushScrollLayer - that
// is, both of them should be relative to the stacking context `aStackingContext`.

View File

@ -61,23 +61,16 @@ StackingContextHelper::~StackingContextHelper()
}
void
StackingContextHelper::AdjustOrigin(const LayerPoint& aDelta)
StackingContextHelper::AdjustOrigin(const LayoutDevicePoint& aDelta)
{
mOrigin += aDelta;
}
wr::LayoutRect
StackingContextHelper::ToRelativeLayoutRect(const LayerRect& aRect) const
StackingContextHelper::ToRelativeLayoutRect(const LayoutDeviceRect& aRect) const
{
return wr::ToLayoutRect(RoundedToInt(aRect - mOrigin));
}
wr::LayoutRect
StackingContextHelper::ToRelativeLayoutRect(const LayoutDeviceRect& aRect) const
{
return wr::ToLayoutRect(RoundedToInt(ViewAs<LayerPixel>(aRect,
PixelCastJustification::WebRenderHasUnitResolution) - mOrigin));
}
} // namespace layers
} // namespace mozilla

View File

@ -19,8 +19,6 @@ class nsDisplayList;
namespace mozilla {
namespace layers {
class WebRenderLayer;
/**
* This is a helper class that pushes/pops a stacking context, and manages
* some of the coordinate space transformations needed.
@ -48,7 +46,7 @@ public:
// Pops the stacking context, if one was pushed during the constructor.
~StackingContextHelper();
void AdjustOrigin(const LayerPoint& aDelta);
void AdjustOrigin(const LayoutDevicePoint& aDelta);
// When this StackingContextHelper is in scope, this function can be used
// to convert a rect from the layer system's coordinate space to a LayoutRect
@ -60,10 +58,9 @@ public:
// same as the layer space. (TODO: try to make this more explicit somehow).
// We also round the rectangle to ints after transforming since the output
// is the final destination rect.
wr::LayoutRect ToRelativeLayoutRect(const LayerRect& aRect) const;
wr::LayoutRect ToRelativeLayoutRect(const LayoutDeviceRect& aRect) const;
// Same but for points
wr::LayoutPoint ToRelativeLayoutPoint(const LayerPoint& aPoint) const
wr::LayoutPoint ToRelativeLayoutPoint(const LayoutDevicePoint& aPoint) const
{
return wr::ToLayoutPoint(aPoint - mOrigin);
}
@ -76,7 +73,7 @@ public:
private:
wr::DisplayListBuilder* mBuilder;
LayerPoint mOrigin;
LayoutDevicePoint mOrigin;
gfx::Matrix4x4 mTransform;
gfx::Size mScale;
};

View File

@ -276,10 +276,8 @@ WebRenderCommandBuilder::CreateImageKey(nsDisplayItem* aItem,
bool snap;
nsRect bounds = aItem->GetBounds(nullptr, &snap);
int32_t appUnitsPerDevPixel = aItem->Frame()->PresContext()->AppUnitsPerDevPixel();
LayerRect rect = ViewAs<LayerPixel>(
LayoutDeviceRect::FromAppUnits(bounds, appUnitsPerDevPixel),
PixelCastJustification::WebRenderHasUnitResolution);
LayerRect scBounds(0, 0, rect.width, rect.Height());
LayoutDeviceRect rect = LayoutDeviceRect::FromAppUnits(bounds, appUnitsPerDevPixel);
LayoutDeviceRect scBounds(LayoutDevicePoint(0, 0), rect.Size());
gfx::MaybeIntSize scaleToSize;
if (!aContainer->GetScaleHint().IsEmpty()) {
scaleToSize = Some(aContainer->GetScaleHint());
@ -316,7 +314,7 @@ WebRenderCommandBuilder::PushImage(nsDisplayItem* aItem,
mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources,
const StackingContextHelper& aSc,
const LayerRect& aRect)
const LayoutDeviceRect& aRect)
{
gfx::IntSize size;
Maybe<wr::ImageKey> key = CreateImageKey(aItem, aContainer,
@ -342,7 +340,7 @@ static void
PaintItemByDrawTarget(nsDisplayItem* aItem,
gfx::DrawTarget* aDT,
const LayerRect& aImageRect,
const LayerPoint& aOffset,
const LayoutDevicePoint& aOffset,
nsDisplayListBuilder* aDisplayListBuilder,
RefPtr<BasicLayerManager>& aManager,
WebRenderLayerManager* aWrManager,
@ -427,7 +425,7 @@ WebRenderCommandBuilder::GenerateFallbackData(nsDisplayItem* aItem,
wr::IpcResourceUpdateQueue& aResources,
const StackingContextHelper& aSc,
nsDisplayListBuilder* aDisplayListBuilder,
LayerRect& aImageRect)
LayoutDeviceRect& aImageRect)
{
RefPtr<WebRenderFallbackData> fallbackData = CreateOrRecycleWebRenderUserData<WebRenderFallbackData>(aItem);
@ -450,19 +448,19 @@ WebRenderCommandBuilder::GenerateFallbackData(nsDisplayItem* aItem,
aItem->RecomputeVisibility(aDisplayListBuilder, &visibleRegion);
const int32_t appUnitsPerDevPixel = aItem->Frame()->PresContext()->AppUnitsPerDevPixel();
LayerRect bounds = ViewAs<LayerPixel>(
LayoutDeviceRect::FromAppUnits(clippedBounds, appUnitsPerDevPixel),
PixelCastJustification::WebRenderHasUnitResolution);
LayoutDeviceRect bounds = LayoutDeviceRect::FromAppUnits(clippedBounds, appUnitsPerDevPixel);
gfx::Size scale = aSc.GetInheritedScale();
// XXX not sure if paintSize should be in layer or layoutdevice pixels, it
// has some sort of scaling applied.
LayerIntSize paintSize = RoundedToInt(LayerSize(bounds.width * scale.width, bounds.height * scale.height));
if (paintSize.width == 0 || paintSize.height == 0) {
return nullptr;
}
bool needPaint = true;
LayerIntPoint offset = RoundedToInt(bounds.TopLeft());
aImageRect = LayerRect(offset, LayerSize(RoundedToInt(bounds.Size())));
LayoutDeviceIntPoint offset = RoundedToInt(bounds.TopLeft());
aImageRect = LayoutDeviceRect(offset, LayoutDeviceSize(RoundedToInt(bounds.Size())));
LayerRect paintRect = LayerRect(LayerPoint(0, 0), LayerSize(paintSize));
nsAutoPtr<nsDisplayItemGeometry> geometry = fallbackData->GetGeometry();
@ -563,9 +561,9 @@ WebRenderCommandBuilder::BuildWrMaskImage(nsDisplayItem* aItem,
wr::IpcResourceUpdateQueue& aResources,
const StackingContextHelper& aSc,
nsDisplayListBuilder* aDisplayListBuilder,
const LayerRect& aBounds)
const LayoutDeviceRect& aBounds)
{
LayerRect imageRect;
LayoutDeviceRect imageRect;
RefPtr<WebRenderFallbackData> fallbackData = GenerateFallbackData(aItem, aBuilder, aResources,
aSc, aDisplayListBuilder,
imageRect);
@ -587,7 +585,7 @@ WebRenderCommandBuilder::PushItemAsImage(nsDisplayItem* aItem,
const StackingContextHelper& aSc,
nsDisplayListBuilder* aDisplayListBuilder)
{
LayerRect imageRect;
LayoutDeviceRect imageRect;
RefPtr<WebRenderFallbackData> fallbackData = GenerateFallbackData(aItem, aBuilder, aResources,
aSc, aDisplayListBuilder,
imageRect);

View File

@ -65,14 +65,14 @@ public:
mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources,
const StackingContextHelper& aSc,
const LayerRect& aRect);
const LayoutDeviceRect& aRect);
Maybe<wr::WrImageMask> BuildWrMaskImage(nsDisplayItem* aItem,
wr::DisplayListBuilder& aBuilder,
wr::IpcResourceUpdateQueue& aResources,
const StackingContextHelper& aSc,
nsDisplayListBuilder* aDisplayListBuilder,
const LayerRect& aBounds);
const LayoutDeviceRect& aBounds);
bool PushItemAsImage(nsDisplayItem* aItem,
wr::DisplayListBuilder& aBuilder,
@ -91,7 +91,7 @@ public:
wr::IpcResourceUpdateQueue& aResources,
const StackingContextHelper& aSc,
nsDisplayListBuilder* aDisplayListBuilder,
LayerRect& aImageRect);
LayoutDeviceRect& aImageRect);
void RemoveUnusedAndResetWebRenderUserData();

View File

@ -128,8 +128,8 @@ void
WebRenderImageData::CreateAsyncImageWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
ImageContainer* aContainer,
const StackingContextHelper& aSc,
const LayerRect& aBounds,
const LayerRect& aSCBounds,
const LayoutDeviceRect& aBounds,
const LayoutDeviceRect& aSCBounds,
const gfx::Matrix4x4& aSCTransform,
const gfx::MaybeIntSize& aScaleToSize,
const wr::ImageRendering& aFilter,

View File

@ -89,8 +89,8 @@ public:
void CreateAsyncImageWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
ImageContainer* aContainer,
const StackingContextHelper& aSc,
const LayerRect& aBounds,
const LayerRect& aSCBounds,
const LayoutDeviceRect& aBounds,
const LayoutDeviceRect& aSCBounds,
const gfx::Matrix4x4& aSCTransform,
const gfx::MaybeIntSize& aScaleToSize,
const wr::ImageRendering& aFilter,

View File

@ -246,8 +246,7 @@ static inline wr::ColorF ToColorF(const gfx::Color& color)
return c;
}
template<class T>
static inline wr::LayoutPoint ToLayoutPoint(const gfx::PointTyped<T>& point)
static inline wr::LayoutPoint ToLayoutPoint(const mozilla::LayoutDevicePoint& point)
{
wr::LayoutPoint p;
p.x = point.x;
@ -255,14 +254,12 @@ static inline wr::LayoutPoint ToLayoutPoint(const gfx::PointTyped<T>& point)
return p;
}
template<class T>
static inline wr::LayoutPoint ToLayoutPoint(const gfx::IntPointTyped<T>& point)
static inline wr::LayoutPoint ToLayoutPoint(const mozilla::LayoutDeviceIntPoint& point)
{
return ToLayoutPoint(IntPointToPoint(point));
return ToLayoutPoint(LayoutDevicePoint(point));
}
template<class T>
static inline wr::LayoutVector2D ToLayoutVector2D(const gfx::PointTyped<T>& point)
static inline wr::LayoutVector2D ToLayoutVector2D(const mozilla::LayoutDevicePoint& point)
{
wr::LayoutVector2D p;
p.x = point.x;
@ -270,14 +267,12 @@ static inline wr::LayoutVector2D ToLayoutVector2D(const gfx::PointTyped<T>& poin
return p;
}
template<class T>
static inline wr::LayoutVector2D ToLayoutVector2D(const gfx::IntPointTyped<T>& point)
static inline wr::LayoutVector2D ToLayoutVector2D(const mozilla::LayoutDeviceIntPoint& point)
{
return ToLayoutVector2D(IntPointToPoint(point));
return ToLayoutVector2D(LayoutDevicePoint(point));
}
template<class T>
static inline wr::LayoutRect ToLayoutRect(const gfx::RectTyped<T>& rect)
static inline wr::LayoutRect ToLayoutRect(const mozilla::LayoutDeviceRect& rect)
{
wr::LayoutRect r;
r.origin.x = rect.x;
@ -297,14 +292,12 @@ static inline wr::LayoutRect ToLayoutRect(const gfxRect rect)
return r;
}
template<class T>
static inline wr::LayoutRect ToLayoutRect(const gfx::IntRectTyped<T>& rect)
static inline wr::LayoutRect ToLayoutRect(const mozilla::LayoutDeviceIntRect& rect)
{
return ToLayoutRect(IntRectToRect(rect));
}
template<class T>
static inline wr::LayoutSize ToLayoutSize(const gfx::SizeTyped<T>& size)
static inline wr::LayoutSize ToLayoutSize(const mozilla::LayoutDeviceSize& size)
{
wr::LayoutSize ls;
ls.width = size.width;
@ -316,17 +309,16 @@ static inline wr::ComplexClipRegion ToComplexClipRegion(const RoundedRect& rect)
{
wr::ComplexClipRegion ret;
ret.rect = ToLayoutRect(rect.rect);
ret.radii.top_left = ToLayoutSize(rect.corners.radii[mozilla::eCornerTopLeft]);
ret.radii.top_right = ToLayoutSize(rect.corners.radii[mozilla::eCornerTopRight]);
ret.radii.bottom_left = ToLayoutSize(rect.corners.radii[mozilla::eCornerBottomLeft]);
ret.radii.bottom_right = ToLayoutSize(rect.corners.radii[mozilla::eCornerBottomRight]);
ret.radii.top_left = ToLayoutSize(LayoutDeviceSize::FromUnknownSize(rect.corners.radii[mozilla::eCornerTopLeft]));
ret.radii.top_right = ToLayoutSize(LayoutDeviceSize::FromUnknownSize(rect.corners.radii[mozilla::eCornerTopRight]));
ret.radii.bottom_left = ToLayoutSize(LayoutDeviceSize::FromUnknownSize(rect.corners.radii[mozilla::eCornerBottomLeft]));
ret.radii.bottom_right = ToLayoutSize(LayoutDeviceSize::FromUnknownSize(rect.corners.radii[mozilla::eCornerBottomRight]));
return ret;
}
template<class T>
static inline wr::LayoutSize ToLayoutSize(const gfx::IntSizeTyped<T>& size)
static inline wr::LayoutSize ToLayoutSize(const mozilla::LayoutDeviceIntSize& size)
{
return ToLayoutSize(IntSizeToSize(size));
return ToLayoutSize(LayoutDeviceSize(size));
}
template<class S, class T>
@ -389,16 +381,6 @@ static inline wr::BorderSide ToBorderSide(const gfx::Color& color, const uint8_t
return bs;
}
static inline wr::BorderRadius ToUniformBorderRadius(const mozilla::LayerSize& aSize)
{
wr::BorderRadius br;
br.top_left = ToLayoutSize(aSize);
br.top_right = ToLayoutSize(aSize);
br.bottom_left = ToLayoutSize(aSize);
br.bottom_right = ToLayoutSize(aSize);
return br;
}
static inline wr::BorderRadius EmptyBorderRadius()
{
wr::BorderRadius br;
@ -406,9 +388,10 @@ static inline wr::BorderRadius EmptyBorderRadius()
return br;
}
template<class T>
static inline wr::BorderRadius ToBorderRadius(const gfx::SizeTyped<T>& topLeft, const gfx::SizeTyped<T>& topRight,
const gfx::SizeTyped<T>& bottomLeft, const gfx::SizeTyped<T>& bottomRight)
static inline wr::BorderRadius ToBorderRadius(const mozilla::LayoutDeviceSize& topLeft,
const mozilla::LayoutDeviceSize& topRight,
const mozilla::LayoutDeviceSize& bottomLeft,
const mozilla::LayoutDeviceSize& bottomRight)
{
wr::BorderRadius br;
br.top_left = ToLayoutSize(topLeft);
@ -494,22 +477,6 @@ static inline wr::WrOpacityProperty ToWrOpacityProperty(uint64_t id, const float
return prop;
}
static inline wr::ComplexClipRegion ToComplexClipRegion(const wr::LayoutRect& rect,
const mozilla::LayerSize& size)
{
wr::ComplexClipRegion complex_clip;
complex_clip.rect = rect;
complex_clip.radii = wr::ToUniformBorderRadius(size);
return complex_clip;
}
template<class T>
static inline wr::ComplexClipRegion ToComplexClipRegion(const gfx::RectTyped<T>& rect,
const mozilla::LayerSize& size)
{
return ToComplexClipRegion(wr::ToLayoutRect(rect), size);
}
// Whenever possible, use wr::ExternalImageId instead of manipulating uint64_t.
inline uint64_t AsUint64(const ExternalImageId& aId) {
return static_cast<uint64_t>(aId.mHandle);

View File

@ -55,12 +55,7 @@ enum class PixelCastJustification : uint8_t {
MultipleAsyncTransforms,
// We have reason to believe a layer doesn't have a local transform.
// Should only be used if we've already checked or asserted this.
NoTransformOnLayer,
// When building non-rasterized WebRender layers (e.g.
// WebRenderDisplayItemLayer, or anything else that doesn't deal in textures),
// there is no "resolution" and so the LayoutDevicePixel space is equal to the
// LayerPixel space.
WebRenderHasUnitResolution
NoTransformOnLayer
};
template <class TargetUnits, class SourceUnits>

View File

@ -241,9 +241,9 @@ nsDisplayButtonBoxShadowOuter::CreateWebRenderCommands(
gfx::Color shadowColor =
nsCSSRendering::GetShadowColor(shadow, mFrame, 1.0);
mozilla::gfx::Point shadowOffset;
shadowOffset.x = (shadow->mXOffset / appUnitsPerDevPixel);
shadowOffset.y = (shadow->mYOffset / appUnitsPerDevPixel);
LayoutDevicePoint shadowOffset = LayoutDevicePoint::FromAppUnits(
nsPoint(shadow->mXOffset, shadow->mYOffset),
appUnitsPerDevPixel);
float spreadRadius = float(shadow->mSpread) / float(appUnitsPerDevPixel);

View File

@ -68,8 +68,8 @@ public:
clip.GetClipRect(), appUnitsPerDevPixel);
}
mBoundsRect = aSc.ToRelativeLayoutRect(LayerRect::FromUnknownRect(layoutBoundsRect.ToUnknownRect()));
mClipRect = aSc.ToRelativeLayoutRect(LayerRect::FromUnknownRect(layoutClipRect.ToUnknownRect()));
mBoundsRect = aSc.ToRelativeLayoutRect(layoutBoundsRect);
mClipRect = aSc.ToRelativeLayoutRect(layoutClipRect);
mBackfaceVisible = !aItem->BackfaceIsHidden();
@ -125,7 +125,7 @@ public:
const gfx::Glyph& sourceGlyph = aBuffer.mGlyphs[i];
targetGlyph.index = sourceGlyph.mIndex;
targetGlyph.point = mSc.ToRelativeLayoutPoint(
LayerPoint::FromUnknownPoint(sourceGlyph.mPosition));
LayoutDevicePoint::FromUnknownPoint(sourceGlyph.mPosition));
}
mManager->WrBridge()->PushGlyphs(mBuilder, glyphs, aFont,

View File

@ -517,10 +517,8 @@ BulletRenderer::CreateWebRenderCommandsForText(nsDisplayItem* aItem,
const int32_t appUnitsPerDevPixel = aItem->Frame()->PresContext()->AppUnitsPerDevPixel();
bool dummy;
LayerRect destRect = ViewAs<LayerPixel>(
LayoutDeviceRect::FromAppUnits(
aItem->GetBounds(aDisplayListBuilder, &dummy), appUnitsPerDevPixel),
PixelCastJustification::WebRenderHasUnitResolution);
LayoutDeviceRect destRect = LayoutDeviceRect::FromAppUnits(
aItem->GetBounds(aDisplayListBuilder, &dummy), appUnitsPerDevPixel);
wr::LayoutRect wrDestRect = aSc.ToRelativeLayoutRect(destRect);
nsTArray<wr::GlyphInstance> wrGlyphs;
@ -532,7 +530,7 @@ BulletRenderer::CreateWebRenderCommandsForText(nsDisplayItem* aItem,
for (size_t j = 0; j < glyphs.Length(); j++) {
wrGlyphs[j].index = glyphs[j].mIndex;
wrGlyphs[j].point = aSc.ToRelativeLayoutPoint(
LayerPoint::FromUnknownPoint(glyphs[j].mPosition));
LayoutDevicePoint::FromUnknownPoint(glyphs[j].mPosition));
}
aManager->WrBridge()->PushGlyphs(aBuilder, wrGlyphs, mFont,

View File

@ -185,7 +185,7 @@ public:
}
MaybeIntSize scaleToSize;
LayerRect scBounds(0, 0, bounds.width, bounds.height);
LayoutDeviceRect scBounds(LayoutDevicePoint(0, 0), bounds.Size());
wr::ImageRendering filter = wr::ToImageRendering(nsLayoutUtils::GetSamplingFilterForFrame(mFrame));
wr::MixBlendMode mixBlendMode = wr::MixBlendMode::Normal;
aManager->WrBridge()->AddWebRenderParentCommand(OpUpdateAsyncImagePipeline(data->GetPipelineId().value(),

View File

@ -1722,9 +1722,8 @@ nsDisplayImage::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilde
const int32_t factor = mFrame->PresContext()->AppUnitsPerDevPixel();
const LayoutDeviceRect destRect(
LayoutDeviceIntRect::FromAppUnits(GetDestRect(), factor));
const LayerRect dest = ViewAs<LayerPixel>(destRect, PixelCastJustification::WebRenderHasUnitResolution);
return aManager->CommandBuilder().PushImage(this, container, aBuilder, aResources, aSc, dest);
LayoutDeviceRect::FromAppUnits(GetDestRect(), factor));
return aManager->CommandBuilder().PushImage(this, container, aBuilder, aResources, aSc, destRect);
}
DrawResult

View File

@ -1444,7 +1444,7 @@ nsPluginFrame::CreateWebRenderCommands(nsDisplayItem* aItem,
}
lm->AddDidCompositeObserver(mDidCompositeObserver.get());
LayerRect dest(r.x, r.y, size.width, size.height);
LayoutDeviceRect dest(r.x, r.y, size.width, size.height);
return aManager->CommandBuilder().PushImage(aItem, container, aBuilder, aResources, aSc, dest);
}

View File

@ -496,7 +496,7 @@ public:
SwapScaleWidthHeightForRotation(scaleHint, rotationDeg);
container->SetScaleHint(scaleHint);
LayerRect rect(destGFXRect.x, destGFXRect.y, destGFXRect.width, destGFXRect.height);
LayoutDeviceRect rect(destGFXRect.x, destGFXRect.y, destGFXRect.width, destGFXRect.height);
return aManager->CommandBuilder().PushImage(this, container, aBuilder, aResources, aSc, rect);
}

View File

@ -3613,10 +3613,10 @@ nsCSSBorderRenderer::CreateWebRenderCommands(wr::DisplayListBuilder& aBuilder,
side[i] = wr::ToBorderSide(ToDeviceColor(mBorderColors[i]), mBorderStyles[i]);
}
wr::BorderRadius borderRadius = wr::ToBorderRadius(LayerSize(mBorderRadii[0].width, mBorderRadii[0].height),
LayerSize(mBorderRadii[1].width, mBorderRadii[1].height),
LayerSize(mBorderRadii[3].width, mBorderRadii[3].height),
LayerSize(mBorderRadii[2].width, mBorderRadii[2].height));
wr::BorderRadius borderRadius = wr::ToBorderRadius(LayoutDeviceSize::FromUnknownSize(mBorderRadii[0]),
LayoutDeviceSize::FromUnknownSize(mBorderRadii[1]),
LayoutDeviceSize::FromUnknownSize(mBorderRadii[3]),
LayoutDeviceSize::FromUnknownSize(mBorderRadii[2]));
if (mLocalClip) {
LayoutDeviceRect clip = LayoutDeviceRect::FromUnknownRect(mLocalClip.value());
@ -3937,10 +3937,8 @@ nsCSSBorderImageRenderer::CreateWebRenderCommands(nsDisplayItem* aItem,
renderer.BuildWebRenderParameters(1.0, extendMode, stops, lineStart, lineEnd, gradientRadius);
if (gradientData->mShape == NS_STYLE_GRADIENT_SHAPE_LINEAR) {
LayerPoint startPoint = LayerPoint(dest.origin.x, dest.origin.y);
startPoint = startPoint + ViewAs<LayerPixel>(lineStart, PixelCastJustification::WebRenderHasUnitResolution);
LayerPoint endPoint = LayerPoint(dest.origin.x, dest.origin.y);
endPoint = endPoint + ViewAs<LayerPixel>(lineEnd, PixelCastJustification::WebRenderHasUnitResolution);
LayoutDevicePoint startPoint = LayoutDevicePoint(dest.origin.x, dest.origin.y) + lineStart;
LayoutDevicePoint endPoint = LayoutDevicePoint(dest.origin.x, dest.origin.y) + lineEnd;
aBuilder.PushBorderGradient(dest,
clip,

View File

@ -1065,8 +1065,6 @@ nsCSSGradientRenderer::BuildWebRenderDisplayItems(wr::DisplayListBuilder& aBuild
// Make the rects relative to the parent stacking context
wr::LayoutRect wrClipBounds = aSc.ToRelativeLayoutRect(clipBounds);
LayerSize layerFirstTileSize = ViewAs<LayerPixel>(firstTileBounds.Size(),
PixelCastJustification::WebRenderHasUnitResolution);
wr::LayoutRect wrGradientBounds = aSc.ToRelativeLayoutRect(gradientBounds);
// srcTransform is used for scaling the gradient to match aSrc
@ -1090,7 +1088,7 @@ nsCSSGradientRenderer::BuildWebRenderDisplayItems(wr::DisplayListBuilder& aBuild
mozilla::wr::ToLayoutPoint(lineEnd),
stops,
extendMode,
mozilla::wr::ToLayoutSize(layerFirstTileSize),
mozilla::wr::ToLayoutSize(firstTileBounds.Size()),
mozilla::wr::ToLayoutSize(tileSpacing));
} else {
gradientRadius.width *= srcTransform.width;
@ -1104,7 +1102,7 @@ nsCSSGradientRenderer::BuildWebRenderDisplayItems(wr::DisplayListBuilder& aBuild
mozilla::wr::ToLayoutSize(gradientRadius),
stops,
extendMode,
mozilla::wr::ToLayoutSize(layerFirstTileSize),
mozilla::wr::ToLayoutSize(firstTileBounds.Size()),
mozilla::wr::ToLayoutSize(tileSpacing));
}
}

View File

@ -5072,10 +5072,8 @@ nsDisplayBorder::CreateBorderImageWebRenderCommands(mozilla::wr::DisplayListBuil
renderer.BuildWebRenderParameters(1.0, extendMode, stops, lineStart, lineEnd, gradientRadius);
if (gradientData->mShape == NS_STYLE_GRADIENT_SHAPE_LINEAR) {
LayerPoint startPoint = LayerPoint(dest.origin.x, dest.origin.y);
startPoint = startPoint + ViewAs<LayerPixel>(lineStart, PixelCastJustification::WebRenderHasUnitResolution);
LayerPoint endPoint = LayerPoint(dest.origin.x, dest.origin.y);
endPoint = endPoint + ViewAs<LayerPixel>(lineEnd, PixelCastJustification::WebRenderHasUnitResolution);
LayoutDevicePoint startPoint = LayoutDevicePoint(dest.origin.x, dest.origin.y) + lineStart;
LayoutDevicePoint endPoint = LayoutDevicePoint(dest.origin.x, dest.origin.y) + lineEnd;
aBuilder.PushBorderGradient(dest,
clip,
@ -5396,9 +5394,9 @@ nsDisplayBoxShadowOuter::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder
// We don't move the shadow rect here since WR does it for us
// Now translate everything to device pixels.
nsRect shadowRect = frameRect;
Point shadowOffset;
shadowOffset.x = (shadow->mXOffset / appUnitsPerDevPixel);
shadowOffset.y = (shadow->mYOffset / appUnitsPerDevPixel);
LayoutDevicePoint shadowOffset = LayoutDevicePoint::FromAppUnits(
nsPoint(shadow->mXOffset, shadow->mYOffset),
appUnitsPerDevPixel);
LayoutDeviceRect deviceBox = LayoutDeviceRect::FromAppUnits(
shadowRect, appUnitsPerDevPixel);
@ -5567,14 +5565,14 @@ nsDisplayBoxShadowInner::CreateInsetBoxShadowWebRenderCommands(mozilla::wr::Disp
nsCSSRendering::GetShadowInnerRadii(aFrame, aBorderRect, innerRadii);
// Now translate everything to device pixels.
Rect deviceBoxRect = LayoutDeviceRect::FromAppUnits(
shadowRect, appUnitsPerDevPixel).ToUnknownRect();
LayoutDeviceRect deviceBoxRect = LayoutDeviceRect::FromAppUnits(
shadowRect, appUnitsPerDevPixel);
wr::LayoutRect deviceClipRect = aSc.ToRelativeLayoutRect(clipRect);
Color shadowColor = nsCSSRendering::GetShadowColor(shadowItem, aFrame, 1.0);
Point shadowOffset;
shadowOffset.x = (shadowItem->mXOffset / appUnitsPerDevPixel);
shadowOffset.y = (shadowItem->mYOffset / appUnitsPerDevPixel);
LayoutDevicePoint shadowOffset = LayoutDevicePoint::FromAppUnits(
nsPoint(shadowItem->mXOffset, shadowItem->mYOffset),
appUnitsPerDevPixel);
float blurRadius = float(shadowItem->mRadius) / float(appUnitsPerDevPixel);
// TODO: WR doesn't support non-uniform border radii
@ -7004,7 +7002,7 @@ nsDisplayStickyPosition::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder
WebRenderLayerManager* aManager,
nsDisplayListBuilder* aDisplayListBuilder)
{
LayerPoint scTranslation;
LayoutDevicePoint scTranslation;
StickyScrollContainer* stickyScrollContainer = StickyScrollContainer::GetStickyScrollContainerForFrame(mFrame);
if (stickyScrollContainer) {
float auPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
@ -7017,9 +7015,7 @@ nsDisplayStickyPosition::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder
nsIFrame* firstCont = nsLayoutUtils::FirstContinuationOrIBSplitSibling(mFrame);
nsPoint translation = stickyScrollContainer->ComputePosition(firstCont) - firstCont->GetNormalPosition();
itemBounds.MoveBy(-translation);
scTranslation = ViewAs<LayerPixel>(
LayoutDevicePoint::FromAppUnits(translation, auPerDevPixel),
PixelCastJustification::WebRenderHasUnitResolution);
scTranslation = LayoutDevicePoint::FromAppUnits(translation, auPerDevPixel);
LayoutDeviceRect bounds = LayoutDeviceRect::FromAppUnits(itemBounds, auPerDevPixel);
@ -9123,8 +9119,7 @@ nsDisplayMask::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder
bool snap;
float appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
nsRect displayBound = GetBounds(aDisplayListBuilder, &snap);
LayerRect bounds = ViewAs<LayerPixel>(LayoutDeviceRect::FromAppUnits(displayBound, appUnitsPerDevPixel),
PixelCastJustification::WebRenderHasUnitResolution);
LayoutDeviceRect bounds = LayoutDeviceRect::FromAppUnits(displayBound, appUnitsPerDevPixel);
Maybe<wr::WrImageMask> mask = aManager->CommandBuilder().BuildWrMaskImage(this, aBuilder, aResources,
aSc, aDisplayListBuilder,