--- a/gfx/layers/apz/src/APZCTreeManager.cpp
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -502,18 +502,19 @@ APZCTreeManager::PushStateToWR(wr::WebRe
ParentLayerPoint layerTranslation = apzc->GetCurrentAsyncTransform(
AsyncPanZoomController::eForCompositing).mTranslation;
// The positive translation means the painted content is supposed to
// move down (or to the right), and that corresponds to a reduction in
// 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);
});
// Now we iterate over the nodes again, and generate the transforms needed
// for scrollbar thumbs. Although we *could* do this as part of the previous
// iteration, it's cleaner and more efficient to do it as a separate pass
--- a/gfx/layers/ipc/WebRenderMessages.ipdlh
+++ b/gfx/layers/ipc/WebRenderMessages.ipdlh
@@ -18,18 +18,17 @@ using mozilla::wr::MaybeImageMask from "
using mozilla::wr::ExternalImageId from "mozilla/webrender/WebRenderTypes.h";
using mozilla::wr::MaybeFontInstanceOptions from "mozilla/webrender/WebRenderTypes.h";
using mozilla::wr::MaybeFontInstancePlatformOptions from "mozilla/webrender/WebRenderTypes.h";
using mozilla::wr::FontInstanceKey from "mozilla/webrender/WebRenderTypes.h";
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";
namespace mozilla {
namespace layers {
union OptionalTransform {
Matrix4x4;
@@ -49,17 +48,17 @@ struct OpAddExternalImage {
struct OpAddCompositorAnimations {
CompositorAnimations data;
OptionalTransform transform;
OptionalOpacity opacity;
};
struct OpUpdateAsyncImagePipeline {
PipelineId pipelineId;
- LayerRect scBounds;
+ LayoutDeviceRect scBounds;
Matrix4x4 scTransform;
MaybeIntSize scaleToSize;
ImageRendering filter;
MixBlendMode mixBlendMode;
};
union WebRenderParentCommand {
OpUpdateAsyncImagePipeline;
--- a/gfx/layers/wr/AsyncImagePipelineManager.cpp
+++ b/gfx/layers/wr/AsyncImagePipelineManager.cpp
@@ -117,17 +117,17 @@ AsyncImagePipelineManager::RemoveAsyncIm
mApi->UpdateResources(resources);
entry.Remove();
RemovePipeline(aPipelineId, wr::NewEpoch(mAsyncImageEpoch));
}
}
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,
const wr::MixBlendMode& aMixBlendMode)
{
if (mDestroyed) {
return;
}
@@ -288,19 +288,19 @@ AsyncImagePipelineManager::ApplyAsyncIma
&opacity,
pipeline->mScTransform.IsIdentity() ? nullptr : &pipeline->mScTransform,
wr::TransformStyle::Flat,
nullptr,
pipeline->mMixBlendMode,
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) {
MOZ_ASSERT(pipeline->mCurrentTexture->AsWebRenderTextureHost());
Range<wr::ImageKey> range_keys(&keys[0], keys.Length());
pipeline->mCurrentTexture->PushDisplayItems(builder,
wr::ToLayoutRect(rect),
wr::ToLayoutRect(rect),
--- a/gfx/layers/wr/AsyncImagePipelineManager.h
+++ b/gfx/layers/wr/AsyncImagePipelineManager.h
@@ -68,17 +68,17 @@ public:
TimeStamp GetCompositeUntilTime() const {
return mCompositeUntilTime;
}
void AddAsyncImagePipeline(const wr::PipelineId& aPipelineId, WebRenderImageHost* aImageHost);
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,
const wr::MixBlendMode& aMixBlendMode);
void ApplyAsyncImages();
void AppendImageCompositeNotification(const ImageCompositeNotificationInfo& aNotification)
{
@@ -118,17 +118,17 @@ private:
};
struct AsyncImagePipeline {
AsyncImagePipeline();
bool mInitialised;
bool mIsChanged;
bool mUseExternalImage;
- LayerRect mScBounds;
+ LayoutDeviceRect mScBounds;
gfx::Matrix4x4 mScTransform;
gfx::MaybeIntSize mScaleToSize;
wr::ImageRendering mFilter;
wr::MixBlendMode mMixBlendMode;
RefPtr<WebRenderImageHost> mImageHost;
CompositableTextureHostRef mCurrentTexture;
nsTArray<wr::ImageKey> mKeys;
};
--- a/gfx/layers/wr/ScrollingLayersHelper.cpp
+++ b/gfx/layers/wr/ScrollingLayersHelper.cpp
@@ -170,23 +170,21 @@ ScrollingLayersHelper::DefineAndPushChai
bool
ScrollingLayersHelper::DefineAndPushScrollLayer(const FrameMetrics& aMetrics,
const StackingContextHelper& aStackingContext)
{
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`.
// However, when we get the scrollable rect from the FrameMetrics, the origin
// has nothing to do with the position of the frame but instead represents
// the minimum allowed scroll offset of the scrollable content. While APZ
// uses this to clamp the scroll position, we don't need to send this to
// WebRender at all. Instead, we take the position from the composition
--- a/gfx/layers/wr/StackingContextHelper.cpp
+++ b/gfx/layers/wr/StackingContextHelper.cpp
@@ -56,28 +56,21 @@ StackingContextHelper::StackingContextHe
StackingContextHelper::~StackingContextHelper()
{
if (mBuilder) {
mBuilder->PopStackingContext();
}
}
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
--- a/gfx/layers/wr/StackingContextHelper.h
+++ b/gfx/layers/wr/StackingContextHelper.h
@@ -14,18 +14,16 @@
class nsDisplayListBuilder;
class nsDisplayItem;
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.
*/
class MOZ_RAII StackingContextHelper
{
public:
StackingContextHelper(const StackingContextHelper& aParentSC,
@@ -43,45 +41,44 @@ public:
// of the tree, so that we have a StackingContextHelper to pass down into
// the RenderLayer traversal, but don't actually want it to push a stacking
// context on the display list builder.
StackingContextHelper();
// 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
// that is relative to the stacking context. This is useful because most
// things that are pushed inside the stacking context need to be relative
// to the stacking context.
// We allow passing in a LayoutDeviceRect for convenience because in a lot of
// cases with WebRender display item generate the layout device space is the
// 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);
}
// Export the inherited scale
gfx::Size GetInheritedScale() const { return mScale; }
bool IsBackfaceVisible() const { return mTransform.IsBackfaceVisible(); }
private:
wr::DisplayListBuilder* mBuilder;
- LayerPoint mOrigin;
+ LayoutDevicePoint mOrigin;
gfx::Matrix4x4 mTransform;
gfx::Size mScale;
};
} // namespace layers
} // namespace mozilla
#endif /* GFX_STACKINGCONTEXTHELPER_H */
--- a/gfx/layers/wr/WebRenderCommandBuilder.cpp
+++ b/gfx/layers/wr/WebRenderCommandBuilder.cpp
@@ -271,20 +271,18 @@ WebRenderCommandBuilder::CreateImageKey(
{
RefPtr<WebRenderImageData> imageData = CreateOrRecycleWebRenderUserData<WebRenderImageData>(aItem);
MOZ_ASSERT(imageData);
if (aContainer->IsAsync()) {
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());
}
// TODO!
// We appear to be using the image bridge for a lot (most/all?) of
// layers-free image handling and that breaks frame consistency.
imageData->CreateAsyncImageWebRenderCommands(aBuilder,
@@ -311,17 +309,17 @@ WebRenderCommandBuilder::CreateImageKey(
}
bool
WebRenderCommandBuilder::PushImage(nsDisplayItem* aItem,
ImageContainer* aContainer,
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,
aBuilder, aResources,
aSc, size);
if (aContainer->IsAsync()) {
// Async ImageContainer does not create ImageKey, instead it uses Pipeline.
MOZ_ASSERT(key.isNothing());
@@ -337,17 +335,17 @@ WebRenderCommandBuilder::PushImage(nsDis
return true;
}
static void
PaintItemByDrawTarget(nsDisplayItem* aItem,
gfx::DrawTarget* aDT,
const LayerRect& aImageRect,
- const LayerPoint& aOffset,
+ const LayoutDevicePoint& aOffset,
nsDisplayListBuilder* aDisplayListBuilder,
RefPtr<BasicLayerManager>& aManager,
WebRenderLayerManager* aWrManager,
const gfx::Size& aScale)
{
MOZ_ASSERT(aDT);
aDT->ClearRect(aImageRect.ToUnknownRect());
@@ -422,17 +420,17 @@ PaintItemByDrawTarget(nsDisplayItem* aIt
}
already_AddRefed<WebRenderFallbackData>
WebRenderCommandBuilder::GenerateFallbackData(nsDisplayItem* aItem,
wr::DisplayListBuilder& aBuilder,
wr::IpcResourceUpdateQueue& aResources,
const StackingContextHelper& aSc,
nsDisplayListBuilder* aDisplayListBuilder,
- LayerRect& aImageRect)
+ LayoutDeviceRect& aImageRect)
{
RefPtr<WebRenderFallbackData> fallbackData = CreateOrRecycleWebRenderUserData<WebRenderFallbackData>(aItem);
bool snap;
nsRect itemBounds = aItem->GetBounds(aDisplayListBuilder, &snap);
nsRect clippedBounds = itemBounds;
const DisplayItemClip& clip = aItem->GetClip();
@@ -445,29 +443,29 @@ WebRenderCommandBuilder::GenerateFallbac
// nsDisplayItem::Paint() may refer the variables that come from ComputeVisibility().
// So we should call RecomputeVisibility() before painting. e.g.: nsDisplayBoxShadowInner
// uses mVisibleRegion in Paint() and mVisibleRegion is computed in
// nsDisplayBoxShadowInner::ComputeVisibility().
nsRegion visibleRegion(clippedBounds);
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();
// nsDisplayFilter is rendered via BasicLayerManager which means the invalidate
// region is unknown until we traverse the displaylist contained by it.
if (geometry && !fallbackData->IsInvalid() &&
aItem->GetType() != DisplayItemType::TYPE_FILTER &&
scale == fallbackData->GetScale()) {
@@ -558,19 +556,19 @@ WebRenderCommandBuilder::GenerateFallbac
}
Maybe<wr::WrImageMask>
WebRenderCommandBuilder::BuildWrMaskImage(nsDisplayItem* aItem,
wr::DisplayListBuilder& aBuilder,
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);
if (!fallbackData) {
return Nothing();
}
wr::WrImageMask imageMask;
@@ -582,17 +580,17 @@ WebRenderCommandBuilder::BuildWrMaskImag
bool
WebRenderCommandBuilder::PushItemAsImage(nsDisplayItem* aItem,
wr::DisplayListBuilder& aBuilder,
wr::IpcResourceUpdateQueue& aResources,
const StackingContextHelper& aSc,
nsDisplayListBuilder* aDisplayListBuilder)
{
- LayerRect imageRect;
+ LayoutDeviceRect imageRect;
RefPtr<WebRenderFallbackData> fallbackData = GenerateFallbackData(aItem, aBuilder, aResources,
aSc, aDisplayListBuilder,
imageRect);
if (!fallbackData) {
return false;
}
wr::LayoutRect dest = aSc.ToRelativeLayoutRect(imageRect);
--- a/gfx/layers/wr/WebRenderCommandBuilder.h
+++ b/gfx/layers/wr/WebRenderCommandBuilder.h
@@ -60,24 +60,24 @@ public:
WebRenderUserDataRefTable* GetWebRenderUserDataTable() { return &mWebRenderUserDatas; }
bool PushImage(nsDisplayItem* aItem,
ImageContainer* aContainer,
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,
wr::IpcResourceUpdateQueue& aResources,
const StackingContextHelper& aSc,
nsDisplayListBuilder* aDisplayListBuilder);
void CreateWebRenderCommandsFromDisplayList(nsDisplayList* aDisplayList,
@@ -86,17 +86,17 @@ public:
wr::DisplayListBuilder& aBuilder,
wr::IpcResourceUpdateQueue& aResources);
already_AddRefed<WebRenderFallbackData> GenerateFallbackData(nsDisplayItem* aItem,
wr::DisplayListBuilder& aBuilder,
wr::IpcResourceUpdateQueue& aResources,
const StackingContextHelper& aSc,
nsDisplayListBuilder* aDisplayListBuilder,
- LayerRect& aImageRect);
+ LayoutDeviceRect& aImageRect);
void RemoveUnusedAndResetWebRenderUserData();
// Those are data that we kept between transactions. We used to cache some
// data in the layer. But in layers free mode, we don't have layer which
// means we need some other place to cached the data between transaction.
// We store the data in frame's property.
template<class T> already_AddRefed<T>
--- a/gfx/layers/wr/WebRenderUserData.cpp
+++ b/gfx/layers/wr/WebRenderUserData.cpp
@@ -123,18 +123,18 @@ WebRenderImageData::GetImageClient()
RefPtr<ImageClient> imageClient = mImageClient;
return imageClient.forget();
}
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,
const wr::MixBlendMode& aMixBlendMode,
bool aIsBackfaceVisible)
{
MOZ_ASSERT(aContainer->IsAsync());
if (!mPipelineId) {
--- a/gfx/layers/wr/WebRenderUserData.h
+++ b/gfx/layers/wr/WebRenderUserData.h
@@ -84,18 +84,18 @@ public:
Maybe<wr::ImageKey> UpdateImageKey(ImageContainer* aContainer,
wr::IpcResourceUpdateQueue& aResources,
bool aForceUpdate = false);
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,
const wr::MixBlendMode& aMixBlendMode,
bool aIsBackfaceVisible);
void CreateImageClientIfNeeded();
--- a/gfx/webrender_bindings/WebRenderTypes.h
+++ b/gfx/webrender_bindings/WebRenderTypes.h
@@ -241,48 +241,43 @@ static inline wr::ColorF ToColorF(const
wr::ColorF c;
c.r = color.r;
c.g = color.g;
c.b = color.b;
c.a = color.a;
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;
p.y = point.y;
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;
p.y = point.y;
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;
r.origin.y = rect.y;
r.size.width = rect.Width();
r.size.height = rect.Height();
return r;
}
@@ -292,46 +287,43 @@ static inline wr::LayoutRect ToLayoutRec
wr::LayoutRect r;
r.origin.x = rect.x;
r.origin.y = rect.y;
r.size.width = rect.Width();
r.size.height = rect.Height();
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;
ls.height = size.height;
return ls;
}
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>
static inline wr::LayoutTransform ToLayoutTransform(const gfx::Matrix4x4Typed<S, T>& m)
{
wr::LayoutTransform transform;
transform.m11 = m._11;
transform.m12 = m._12;
@@ -384,36 +376,27 @@ static inline wr::BorderStyle ToBorderSt
static inline wr::BorderSide ToBorderSide(const gfx::Color& color, const uint8_t& style)
{
wr::BorderSide bs;
bs.color = ToColorF(color);
bs.style = ToBorderStyle(style);
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;
PodZero(&br);
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);
br.top_right = ToLayoutSize(topRight);
br.bottom_left = ToLayoutSize(bottomLeft);
br.bottom_right = ToLayoutSize(bottomRight);
return br;
}
@@ -489,32 +472,16 @@ static inline wr::WrTransformProperty To
static inline wr::WrOpacityProperty ToWrOpacityProperty(uint64_t id, const float opacity)
{
wr::WrOpacityProperty prop;
prop.id = id;
prop.opacity = opacity;
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);
}
static inline ExternalImageId ToExternalImageId(uint64_t aID)
{
ExternalImageId Id;
--- a/layout/base/UnitTransforms.h
+++ b/layout/base/UnitTransforms.h
@@ -50,22 +50,17 @@ enum class PixelCastJustification : uint
// ScreenIsParentLayerForRoot, which is how we're using it.
LayoutDeviceIsParentLayerForRCDRSF,
// Used to treat the product of AsyncTransformComponentMatrix objects
// as an AsyncTransformMatrix. See the definitions of these matrices in
// LayersTypes.h for details.
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>
gfx::CoordTyped<TargetUnits> ViewAs(const gfx::CoordTyped<SourceUnits>& aCoord, PixelCastJustification) {
return gfx::CoordTyped<TargetUnits>(aCoord.value);
}
template <class TargetUnits, class SourceUnits>
gfx::SizeTyped<TargetUnits> ViewAs(const gfx::SizeTyped<SourceUnits>& aSize, PixelCastJustification) {
--- a/layout/forms/nsButtonFrameRenderer.cpp
+++ b/layout/forms/nsButtonFrameRenderer.cpp
@@ -236,19 +236,19 @@ nsDisplayButtonBoxShadowOuter::CreateWeb
nsCSSShadowItem* shadow = shadows->ShadowAt(i - 1);
if (shadow->mInset) {
continue;
}
float blurRadius = float(shadow->mRadius) / float(appUnitsPerDevPixel);
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);
aBuilder.PushBoxShadow(deviceBoxRect,
deviceClipRect,
!BackfaceIsHidden(),
deviceBoxRect,
wr::ToLayoutVector2D(shadowOffset),
--- a/layout/generic/TextDrawTarget.h
+++ b/layout/generic/TextDrawTarget.h
@@ -63,18 +63,18 @@ public:
LayoutDeviceRect layoutClipRect = layoutBoundsRect;
auto clip = aItem->GetClip();
if (clip.HasClip()) {
layoutClipRect = LayoutDeviceRect::FromAppUnits(
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();
mBuilder.Save();
}
// Prevent this from being copied
TextDrawTarget(const TextDrawTarget& src) = delete;
@@ -120,17 +120,17 @@ public:
AutoTArray<wr::GlyphInstance, 170> glyphs;
glyphs.SetLength(aBuffer.mNumGlyphs);
for (size_t i = 0; i < aBuffer.mNumGlyphs; i++) {
wr::GlyphInstance& targetGlyph = glyphs[i];
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,
color, mSc, mBoundsRect, mClipRect,
mBackfaceVisible);
}
void
--- a/layout/generic/nsBulletFrame.cpp
+++ b/layout/generic/nsBulletFrame.cpp
@@ -512,32 +512,30 @@ BulletRenderer::CreateWebRenderCommandsF
nsDisplayListBuilder* aDisplayListBuilder)
{
MOZ_ASSERT(IsTextType());
MOZ_ASSERT(mFont);
MOZ_ASSERT(!mGlyphs.IsEmpty());
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;
for (layers::GlyphArray& glyphArray : mGlyphs) {
const auto& glyphs = glyphArray.glyphs();
wrGlyphs.SetLength(glyphs.Length());
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,
wr::ToColorF(glyphArray.color().value()),
aSc, wrDestRect, wrDestRect,
!aItem->BackfaceIsHidden());
}
}
--- a/layout/generic/nsHTMLCanvasFrame.cpp
+++ b/layout/generic/nsHTMLCanvasFrame.cpp
@@ -180,17 +180,17 @@ public:
gfxRect destGFXRect = mFrame->PresContext()->AppUnitsToGfxUnits(dest);
scTransform.PreScale(destGFXRect.Width() / canvasSizeInPx.width,
destGFXRect.Height() / canvasSizeInPx.height, 1.0f);
if (data->NeedsYFlip()) {
scTransform = scTransform.PreTranslate(0, data->GetSize().height, 0).PreScale(1, -1, 1);
}
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(),
scBounds,
scTransform,
scaleToSize,
filter,
mixBlendMode));
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -1717,19 +1717,18 @@ nsDisplayImage::CreateWebRenderCommands(
mImage->GetImageContainer(aManager, flags);
if (!container) {
return false;
}
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
nsImageFrame::PaintImage(gfxContext& aRenderingContext, nsPoint aPt,
const nsRect& aDirtyRect, imgIContainer* aImage,
uint32_t aFlags)
{
DrawTarget* drawTarget = aRenderingContext.GetDrawTarget();
--- a/layout/generic/nsPluginFrame.cpp
+++ b/layout/generic/nsPluginFrame.cpp
@@ -1439,17 +1439,17 @@ nsPluginFrame::CreateWebRenderCommands(n
#endif
RefPtr<LayerManager> lm = aDisplayListBuilder->GetWidgetLayerManager();
if (!mDidCompositeObserver || !mDidCompositeObserver->IsValid(lm)) {
mDidCompositeObserver = MakeUnique<PluginFrameDidCompositeObserver>(mInstanceOwner, lm);
}
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);
}
already_AddRefed<Layer>
nsPluginFrame::BuildLayer(nsDisplayListBuilder* aBuilder,
LayerManager* aManager,
nsDisplayItem* aItem,
--- a/layout/generic/nsVideoFrame.cpp
+++ b/layout/generic/nsVideoFrame.cpp
@@ -491,17 +491,17 @@ public:
VideoInfo::Rotation rotationDeg = element->RotationDegrees();
IntSize scaleHint(static_cast<int32_t>(destGFXRect.Width()),
static_cast<int32_t>(destGFXRect.Height()));
// scaleHint is set regardless of rotation, so swap w/h if needed.
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);
}
// It would be great if we could override GetOpaqueRegion to return nonempty here,
// but it's probably not safe to do so in general. Video frames are
// updated asynchronously from decoder threads, and it's possible that
// we might have an opaque video frame when GetOpaqueRegion is called, but
// when we come to paint, the video frame is transparent or has gone
--- a/layout/painting/nsCSSRenderingBorders.cpp
+++ b/layout/painting/nsCSSRenderingBorders.cpp
@@ -3608,20 +3608,20 @@ nsCSSBorderRenderer::CreateWebRenderComm
{
LayoutDeviceRect outerRect = LayoutDeviceRect::FromUnknownRect(mOuterRect);
wr::LayoutRect transformedRect = aSc.ToRelativeLayoutRect(outerRect);
wr::BorderSide side[4];
NS_FOR_CSS_SIDES(i) {
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());
wr::LayoutRect clipRect = aSc.ToRelativeLayoutRect(clip);
wr::WrClipId clipId = aBuilder.DefineClip(clipRect);
aBuilder.PushClip(clipId, true);
}
@@ -3932,20 +3932,18 @@ nsCSSBorderImageRenderer::CreateWebRende
wr::ExtendMode extendMode;
nsTArray<wr::GradientStop> stops;
LayoutDevicePoint lineStart;
LayoutDevicePoint lineEnd;
LayoutDeviceSize gradientRadius;
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,
!aItem->BackfaceIsHidden(),
wr::ToBorderWidths(widths[0], widths[1], widths[2], widths[3]),
wr::ToLayoutPoint(startPoint),
wr::ToLayoutPoint(endPoint),
stops,
--- a/layout/painting/nsCSSRenderingGradients.cpp
+++ b/layout/painting/nsCSSRenderingGradients.cpp
@@ -1060,18 +1060,16 @@ nsCSSGradientRenderer::BuildWebRenderDis
LayoutDeviceRect gradientBounds = LayoutDeviceRect(firstTileBounds.TopLeft(),
LayoutDeviceSize(tileToClip.x, tileToClip.y));
// Calculate the tile spacing, which is the repeat size minus the tile size
LayoutDeviceSize tileSpacing = tileRepeat - firstTileBounds.Size();
// 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
LayoutDeviceRect srcTransform = LayoutDeviceRect(mPresContext->CSSPixelsToAppUnits(aSrc.x),
mPresContext->CSSPixelsToAppUnits(aSrc.y),
aDest.width / ((float)mPresContext->CSSPixelsToAppUnits(aSrc.width)),
aDest.height / ((float)mPresContext->CSSPixelsToAppUnits(aSrc.height)));
@@ -1085,28 +1083,28 @@ nsCSSGradientRenderer::BuildWebRenderDis
aBuilder.PushLinearGradient(
wrGradientBounds,
wrClipBounds,
aIsBackfaceVisible,
mozilla::wr::ToLayoutPoint(lineStart),
mozilla::wr::ToLayoutPoint(lineEnd),
stops,
extendMode,
- mozilla::wr::ToLayoutSize(layerFirstTileSize),
+ mozilla::wr::ToLayoutSize(firstTileBounds.Size()),
mozilla::wr::ToLayoutSize(tileSpacing));
} else {
gradientRadius.width *= srcTransform.width;
gradientRadius.height *= srcTransform.height;
aBuilder.PushRadialGradient(
wrGradientBounds,
wrClipBounds,
aIsBackfaceVisible,
mozilla::wr::ToLayoutPoint(lineStart),
mozilla::wr::ToLayoutSize(gradientRadius),
stops,
extendMode,
- mozilla::wr::ToLayoutSize(layerFirstTileSize),
+ mozilla::wr::ToLayoutSize(firstTileBounds.Size()),
mozilla::wr::ToLayoutSize(tileSpacing));
}
}
} // namespace mozilla
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -5067,20 +5067,18 @@ nsDisplayBorder::CreateBorderImageWebRen
wr::ExtendMode extendMode;
nsTArray<wr::GradientStop> stops;
LayoutDevicePoint lineStart;
LayoutDevicePoint lineEnd;
LayoutDeviceSize gradientRadius;
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,
!BackfaceIsHidden(),
wr::ToBorderWidths(widths[0], widths[1], widths[2], widths[3]),
wr::ToLayoutPoint(startPoint),
wr::ToLayoutPoint(endPoint),
stops,
@@ -5391,19 +5389,19 @@ nsDisplayBoxShadowOuter::CreateWebRender
float blurRadius = float(shadow->mRadius) / float(appUnitsPerDevPixel);
gfx::Color shadowColor = nsCSSRendering::GetShadowColor(shadow,
mFrame,
mOpacity);
// 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);
wr::LayoutRect deviceBoxRect = aSc.ToRelativeLayoutRect(deviceBox);
wr::LayoutRect deviceClipRect = aSc.ToRelativeLayoutRect(clipRect);
// TODO: support non-uniform border radius.
float borderRadius = hasBorderRadius ? borderRadii.TopLeft().width
@@ -5562,24 +5560,24 @@ nsDisplayBoxShadowInner::CreateInsetBoxS
}
nsRect shadowRect =
nsCSSRendering::GetBoxShadowInnerPaddingRect(aFrame, aBorderRect);
RectCornerRadii innerRadii;
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
float borderRadius = innerRadii.TopLeft().width;
// NOTE: Any spread radius > 0 will render nothing. WR Bug.
float spreadRadius = float(shadowItem->mSpread) / float(appUnitsPerDevPixel);
aBuilder.PushBoxShadow(wr::ToLayoutRect(deviceBoxRect),
@@ -6999,32 +6997,30 @@ nsDisplayStickyPosition::BuildLayer(nsDi
bool
nsDisplayStickyPosition::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources,
const StackingContextHelper& aSc,
WebRenderLayerManager* aManager,
nsDisplayListBuilder* aDisplayListBuilder)
{
- LayerPoint scTranslation;
+ LayoutDevicePoint scTranslation;
StickyScrollContainer* stickyScrollContainer = StickyScrollContainer::GetStickyScrollContainerForFrame(mFrame);
if (stickyScrollContainer) {
float auPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
bool snap;
nsRect itemBounds = GetBounds(aDisplayListBuilder, &snap);
// The itemBounds here already take into account the main-thread
// position:sticky implementation, so we need to unapply that.
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);
Maybe<wr::StickySideConstraint> top;
Maybe<wr::StickySideConstraint> right;
Maybe<wr::StickySideConstraint> bottom;
Maybe<wr::StickySideConstraint> left;
@@ -9118,18 +9114,17 @@ nsDisplayMask::CreateWebRenderCommands(m
mozilla::wr::IpcResourceUpdateQueue& aResources,
const StackingContextHelper& aSc,
mozilla::layers::WebRenderLayerManager* aManager,
nsDisplayListBuilder* aDisplayListBuilder)
{
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,
bounds);
if (mask) {
wr::WrClipId clipId = aBuilder.DefineClip(
aSc.ToRelativeLayoutRect(bounds), nullptr, mask.ptr());
// Don't record this clip push in aBuilder's internal clip stack, because