--- a/gfx/layers/LayersLogging.cpp
+++ b/gfx/layers/LayersLogging.cpp
@@ -65,39 +65,39 @@ AppendToString(std::stringstream& aStrea
aStream << pfx;
aStream << nsPrintfCString(
"(x=%d, y=%d, w=%d, h=%d)",
r.x, r.y, r.width, r.height).get();
aStream << sfx;
}
void
-AppendToString(std::stringstream& aStream, const wr::WrColor& c,
+AppendToString(std::stringstream& aStream, const wr::ColorF& c,
const char* pfx, const char* sfx)
{
aStream << pfx;
aStream << nsPrintfCString(
"rgba(%d, %d, %d, %f)",
uint8_t(c.r*255.f), uint8_t(c.g*255.f), uint8_t(c.b*255.f), c.a).get();
aStream << sfx;
}
void
-AppendToString(std::stringstream& aStream, const wr::WrRect& r,
+AppendToString(std::stringstream& aStream, const wr::LayoutRect& r,
const char* pfx, const char* sfx)
{
aStream << pfx;
aStream << nsPrintfCString(
"(x=%f, y=%f, w=%f, h=%f)",
- r.x, r.y, r.width, r.height).get();
+ r.origin.x, r.origin.y, r.size.width, r.size.height).get();
aStream << sfx;
}
void
-AppendToString(std::stringstream& aStream, const wr::WrSize& s,
+AppendToString(std::stringstream& aStream, const wr::LayoutSize& s,
const char* pfx, const char* sfx)
{
aStream << pfx;
aStream << nsPrintfCString(
"(w=%f, h=%f)",
s.width, s.height).get();
aStream << sfx;
}
--- a/gfx/layers/LayersLogging.h
+++ b/gfx/layers/LayersLogging.h
@@ -16,19 +16,19 @@
#include "nsAString.h"
#include "nsPrintfCString.h" // for nsPrintfCString
#include "nsRegion.h" // for nsRegion, nsIntRegion
#include "nscore.h" // for nsACString, etc
namespace mozilla {
namespace wr {
-struct WrColor;
-struct WrRect;
-struct WrSize;
+struct ColorF;
+struct LayoutRect;
+struct LayoutSize;
} // namespace wr
namespace gfx {
template <class units, class F> struct RectTyped;
} // namespace gfx
enum class ImageFormat;
@@ -90,25 +90,25 @@ AppendToString(std::stringstream& aStrea
aStream << pfx;
aStream << nsPrintfCString(
"(x=%d, y=%d, w=%d, h=%d)",
r.x, r.y, r.width, r.height).get();
aStream << sfx;
}
void
-AppendToString(std::stringstream& aStream, const wr::WrColor& c,
+AppendToString(std::stringstream& aStream, const wr::ColorF& c,
const char* pfx="", const char* sfx="");
void
-AppendToString(std::stringstream& aStream, const wr::WrRect& r,
+AppendToString(std::stringstream& aStream, const wr::LayoutRect& r,
const char* pfx="", const char* sfx="");
void
-AppendToString(std::stringstream& aStream, const wr::WrSize& s,
+AppendToString(std::stringstream& aStream, const wr::LayoutSize& s,
const char* pfx="", const char* sfx="");
void
AppendToString(std::stringstream& aStream, const nsRegion& r,
const char* pfx="", const char* sfx="");
void
AppendToString(std::stringstream& aStream, const nsIntRegion& r,
--- a/gfx/layers/apz/src/APZCTreeManager.cpp
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -502,17 +502,17 @@ 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;
aWrApi->UpdateScrollPosition(lastPipelineId, apzc->GetGuid().mScrollId,
- wr::ToWrPoint(asyncScrollDelta));
+ wr::ToLayoutPoint(asyncScrollDelta));
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/composite/GPUVideoTextureHost.cpp
+++ b/gfx/layers/composite/GPUVideoTextureHost.cpp
@@ -128,18 +128,18 @@ GPUVideoTextureHost::AddWRImage(wr::WebR
{
MOZ_ASSERT(mWrappedTextureHost);
mWrappedTextureHost->AddWRImage(aAPI, aImageKeys, aExtID);
}
void
GPUVideoTextureHost::PushExternalImage(wr::DisplayListBuilder& aBuilder,
- const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
+ const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aImageKeys)
{
MOZ_ASSERT(mWrappedTextureHost);
MOZ_ASSERT(aImageKeys.length() > 0);
mWrappedTextureHost->PushExternalImage(aBuilder,
aBounds,
--- a/gfx/layers/composite/GPUVideoTextureHost.h
+++ b/gfx/layers/composite/GPUVideoTextureHost.h
@@ -51,18 +51,18 @@ public:
virtual void GetWRImageKeys(nsTArray<wr::ImageKey>& aImageKeys,
const std::function<wr::ImageKey()>& aImageKeyAllocator) override;
virtual void AddWRImage(wr::WebRenderAPI* aAPI,
Range<const wr::ImageKey>& aImageKeys,
const wr::ExternalImageId& aExtID) override;
virtual void PushExternalImage(wr::DisplayListBuilder& aBuilder,
- const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
+ const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aImageKeys) override;
protected:
RefPtr<TextureHost> mWrappedTextureHost;
};
} // namespace layers
--- a/gfx/layers/composite/TextureHost.cpp
+++ b/gfx/layers/composite/TextureHost.cpp
@@ -619,18 +619,18 @@ BufferTextureHost::AddWRImage(wr::WebRen
aExtID,
wr::WrExternalImageBufferType::ExternalBuffer,
2);
}
}
void
BufferTextureHost::PushExternalImage(wr::DisplayListBuilder& aBuilder,
- const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
+ const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aImageKeys)
{
if (GetFormat() != gfx::SurfaceFormat::YUV) {
MOZ_ASSERT(aImageKeys.length() == 1);
aBuilder.PushImage(aBounds, aClip, aFilter, aImageKeys[0]);
} else {
MOZ_ASSERT(aImageKeys.length() == 3);
--- a/gfx/layers/composite/TextureHost.h
+++ b/gfx/layers/composite/TextureHost.h
@@ -638,18 +638,18 @@ public:
Range<const wr::ImageKey>& aImageKeys,
const wr::ExternalImageId& aExtID)
{
MOZ_ASSERT_UNREACHABLE("No AddWRImage() implementation for this TextureHost type.");
}
// Put all necessary WR commands into DisplayListBuilder for this textureHost rendering.
virtual void PushExternalImage(wr::DisplayListBuilder& aBuilder,
- const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
+ const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aKeys)
{
MOZ_ASSERT_UNREACHABLE("No PushExternalImage() implementation for this TextureHost type.");
}
protected:
void ReadUnlock();
@@ -744,18 +744,18 @@ public:
virtual void GetWRImageKeys(nsTArray<wr::ImageKey>& aImageKeys,
const std::function<wr::ImageKey()>& aImageKeyAllocator) override;
virtual void AddWRImage(wr::WebRenderAPI* aAPI,
Range<const wr::ImageKey>& aImageKeys,
const wr::ExternalImageId& aExtID) override;
virtual void PushExternalImage(wr::DisplayListBuilder& aBuilder,
- const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
+ const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aImageKeys) override;
protected:
bool Upload(nsIntRegion *aRegion = nullptr);
bool UploadIfNeeded();
bool MaybeUpload(nsIntRegion *aRegion);
bool EnsureWrappingTextureSource();
--- a/gfx/layers/d3d11/TextureD3D11.cpp
+++ b/gfx/layers/d3d11/TextureD3D11.cpp
@@ -979,18 +979,18 @@ DXGITextureHostD3D11::AddWRImage(wr::Web
Range<const wr::ImageKey>& aImageKeys,
const wr::ExternalImageId& aExtID)
{
MOZ_ASSERT_UNREACHABLE("No AddWRImage() implementation for this DXGITextureHostD3D11 type.");
}
void
DXGITextureHostD3D11::PushExternalImage(wr::DisplayListBuilder& aBuilder,
- const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
+ const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aImageKeys)
{
MOZ_ASSERT_UNREACHABLE("No PushExternalImage() implementation for this DXGITextureHostD3D11 type.");
}
DXGIYCbCrTextureHostD3D11::DXGIYCbCrTextureHostD3D11(TextureFlags aFlags,
const SurfaceDescriptorDXGIYCbCr& aDescriptor)
@@ -1146,18 +1146,18 @@ DXGIYCbCrTextureHostD3D11::AddWRImage(wr
Range<const wr::ImageKey>& aImageKeys,
const wr::ExternalImageId& aExtID)
{
MOZ_ASSERT_UNREACHABLE("No AddWRImage() implementation for this DXGIYCbCrTextureHostD3D11 type.");
}
void
DXGIYCbCrTextureHostD3D11::PushExternalImage(wr::DisplayListBuilder& aBuilder,
- const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
+ const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aImageKeys)
{
MOZ_ASSERT_UNREACHABLE("No PushExternalImage() implementation for this DXGIYCbCrTextureHostD3D11 type.");
}
bool
DXGIYCbCrTextureHostD3D11::AcquireTextureSource(CompositableTextureSourceRef& aTexture)
--- a/gfx/layers/d3d11/TextureD3D11.h
+++ b/gfx/layers/d3d11/TextureD3D11.h
@@ -326,18 +326,18 @@ public:
virtual void GetWRImageKeys(nsTArray<wr::ImageKey>& aImageKeys,
const std::function<wr::ImageKey()>& aImageKeyAllocator) override;
virtual void AddWRImage(wr::WebRenderAPI* aAPI,
Range<const wr::ImageKey>& aImageKeys,
const wr::ExternalImageId& aExtID) override;
virtual void PushExternalImage(wr::DisplayListBuilder& aBuilder,
- const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
+ const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aImageKeys) override;
protected:
bool LockInternal();
void UnlockInternal();
bool EnsureTextureSource();
@@ -387,18 +387,18 @@ public:
virtual void GetWRImageKeys(nsTArray<wr::ImageKey>& aImageKeys,
const std::function<wr::ImageKey()>& aImageKeyAllocator) override;
virtual void AddWRImage(wr::WebRenderAPI* aAPI,
Range<const wr::ImageKey>& aImageKeys,
const wr::ExternalImageId& aExtID) override;
virtual void PushExternalImage(wr::DisplayListBuilder& aBuilder,
- const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
+ const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aImageKeys) override;
private:
bool EnsureTextureSource();
protected:
RefPtr<ID3D11Device> GetDevice();
--- a/gfx/layers/ipc/PWebRenderBridge.ipdl
+++ b/gfx/layers/ipc/PWebRenderBridge.ipdl
@@ -50,20 +50,20 @@ parent:
async UpdateImage(ImageKey aImageKey, IntSize aSize,
SurfaceFormat aFormat, ByteBuffer aBytes);
async DeleteImage(ImageKey aImageKey);
async DeleteCompositorAnimations(uint64_t[] aIds);
async AddRawFont(FontKey aFontKey, ByteBuffer aBytes, uint32_t aFontIndex);
async DeleteFont(FontKey aFontKey);
async DPBegin(IntSize aSize);
async DPEnd(IntSize aSize, WebRenderParentCommand[] commands, OpDestroy[] toDestroy, uint64_t fwdTransactionId, uint64_t transactionId,
- WrSize aContentSize, ByteBuffer aDL, WrBuiltDisplayListDescriptor aDLDesc,
+ LayoutSize aContentSize, ByteBuffer aDL, WrBuiltDisplayListDescriptor aDLDesc,
WebRenderScrollData aScrollData, uint32_t idNameSpace);
sync DPSyncEnd(IntSize aSize, WebRenderParentCommand[] commands, OpDestroy[] toDestroy, uint64_t fwdTransactionId, uint64_t transactionId,
- WrSize aContentSize, ByteBuffer aDL, WrBuiltDisplayListDescriptor aDLDesc,
+ LayoutSize aContentSize, ByteBuffer aDL, WrBuiltDisplayListDescriptor aDLDesc,
WebRenderScrollData aScrollData, uint32_t idNameSpace);
async ParentCommands(WebRenderParentCommand[] commands);
sync DPGetSnapshot(PTexture texture);
async AddPipelineIdForAsyncCompositable(PipelineId aImageId, CompositableHandle aHandle);
async RemovePipelineIdForAsyncCompositable(PipelineId aPipelineId);
async AddExternalImageIdForCompositable(ExternalImageId aImageId, CompositableHandle aHandle);
async RemoveExternalImageId(ExternalImageId aImageId);
async SetLayerObserverEpoch(uint64_t layerObserverEpoch);
--- a/gfx/layers/ipc/WebRenderMessages.ipdlh
+++ b/gfx/layers/ipc/WebRenderMessages.ipdlh
@@ -4,17 +4,17 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
include LayersSurfaces;
include LayersMessages;
include protocol PTexture;
-using mozilla::wr::WrSize from "mozilla/webrender/webrender_ffi.h";
+using mozilla::wr::LayoutSize from "mozilla/webrender/webrender_ffi.h";
using mozilla::wr::WrImageRendering from "mozilla/webrender/webrender_ffi.h";
using mozilla::wr::WrMixBlendMode from "mozilla/webrender/webrender_ffi.h";
using mozilla::wr::MaybeImageMask from "mozilla/webrender/WebRenderTypes.h";
using mozilla::wr::ExternalImageId 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";
--- a/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp
+++ b/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp
@@ -219,18 +219,18 @@ MacIOSurfaceTextureHostOGL::AddWRImage(w
default: {
MOZ_ASSERT_UNREACHABLE("unexpected to be called");
}
}
}
void
MacIOSurfaceTextureHostOGL::PushExternalImage(wr::DisplayListBuilder& aBuilder,
- const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
+ const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aImageKeys)
{
switch (GetFormat()) {
case gfx::SurfaceFormat::R8G8B8X8:
case gfx::SurfaceFormat::R8G8B8A8:
case gfx::SurfaceFormat::B8G8R8A8:
case gfx::SurfaceFormat::B8G8R8X8: {
--- a/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.h
+++ b/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.h
@@ -70,18 +70,18 @@ public:
virtual void GetWRImageKeys(nsTArray<wr::ImageKey>& aImageKeys,
const std::function<wr::ImageKey()>& aImageKeyAllocator) override;
virtual void AddWRImage(wr::WebRenderAPI* aAPI,
Range<const wr::ImageKey>& aImageKeys,
const wr::ExternalImageId& aExtID) override;
virtual void PushExternalImage(wr::DisplayListBuilder& aBuilder,
- const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
+ const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aImageKeys) override;
protected:
GLTextureSource* CreateTextureSourceForPlane(size_t aPlane);
RefPtr<GLTextureSource> mTextureSource;
RefPtr<MacIOSurface> mSurface;
--- a/gfx/layers/wr/ScrollingLayersHelper.cpp
+++ b/gfx/layers/wr/ScrollingLayersHelper.cpp
@@ -66,18 +66,18 @@ ScrollingLayersHelper::ScrollingLayersHe
// 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
// bounds.
contentRect.MoveTo(clipBounds.TopLeft());
mBuilder->PushScrollLayer(fm.GetScrollId(),
- aStackingContext.ToRelativeWrRect(contentRect),
- aStackingContext.ToRelativeWrRect(clipBounds));
+ aStackingContext.ToRelativeLayoutRect(contentRect),
+ aStackingContext.ToRelativeLayoutRect(clipBounds));
}
// The scrolled clip on the layer is "inside" all of the scrollable metadatas
// on that layer. That is, the clip scrolls along with the content in
// child layers. So we need to apply this after pushing all the scroll layers,
// which we do above.
if (const Maybe<LayerClip>& scrolledClip = layer->GetScrolledClip()) {
PushLayerClip(scrolledClip.ref(), aStackingContext);
@@ -118,17 +118,17 @@ ScrollingLayersHelper::PushLayerLocalCli
// this layer has a mask, but no clip rect. so let's use the transformed
// visible bounds as the clip rect.
clip = Some(layer->GetLocalTransformTyped().TransformBounds(mLayer->Bounds()));
}
if (clip) {
Maybe<wr::WrImageMask> mask = mLayer->BuildWrMaskLayer(aStackingContext);
LayerRect clipRect = ViewAs<LayerPixel>(clip.ref(),
PixelCastJustification::MovingDownToChildren);
- mBuilder->PushClip(aStackingContext.ToRelativeWrRect(clipRect), mask.ptrOr(nullptr));
+ mBuilder->PushClip(aStackingContext.ToRelativeLayoutRect(clipRect), mask.ptrOr(nullptr));
mPushedLayerLocalClip = true;
}
}
void
ScrollingLayersHelper::PushLayerClip(const LayerClip& aClip,
const StackingContextHelper& aSc)
{
@@ -136,17 +136,17 @@ ScrollingLayersHelper::PushLayerClip(con
PixelCastJustification::MovingDownToChildren));
Maybe<wr::WrImageMask> mask;
if (Maybe<size_t> maskLayerIndex = aClip.GetMaskLayerIndex()) {
Layer* maskLayer = mLayer->GetLayer()->GetAncestorMaskLayerAt(maskLayerIndex.value());
WebRenderLayer* maskWrLayer = WebRenderLayer::ToWebRenderLayer(maskLayer);
// TODO: check this transform is correct in all cases
mask = maskWrLayer->RenderMaskLayer(aSc, maskLayer->GetTransform());
}
- mBuilder->PushClip(aSc.ToRelativeWrRect(clipRect), mask.ptrOr(nullptr));
+ mBuilder->PushClip(aSc.ToRelativeLayoutRect(clipRect), mask.ptrOr(nullptr));
}
ScrollingLayersHelper::~ScrollingLayersHelper()
{
Layer* layer = mLayer->GetLayer();
if (!mLayer->WrManager()->AsyncPanZoomEnabled()) {
if (mPushedLayerLocalClip) {
mBuilder->PopClip();
--- a/gfx/layers/wr/StackingContextHelper.cpp
+++ b/gfx/layers/wr/StackingContextHelper.cpp
@@ -22,17 +22,17 @@ StackingContextHelper::StackingContextHe
LayerRect aBoundForSC,
LayerPoint aOrigin,
uint64_t aAnimationsId,
float* aOpacityPtr,
gfx::Matrix4x4* aTransformPtr,
const nsTArray<wr::WrFilterOp>& aFilters)
: mBuilder(&aBuilder)
{
- wr::WrRect scBounds = aParentSC.ToRelativeWrRect(aBoundForSC);
+ wr::LayoutRect scBounds = aParentSC.ToRelativeLayoutRect(aBoundForSC);
if (aTransformPtr) {
mTransform = *aTransformPtr;
}
mBuilder->PushStackingContext(scBounds,
aAnimationsId,
aOpacityPtr,
aTransformPtr,
@@ -46,17 +46,17 @@ StackingContextHelper::StackingContextHe
StackingContextHelper::StackingContextHelper(const StackingContextHelper& aParentSC,
wr::DisplayListBuilder& aBuilder,
WebRenderLayer* aLayer,
const Maybe<gfx::Matrix4x4>& aTransform,
const nsTArray<wr::WrFilterOp>& aFilters)
: mBuilder(&aBuilder)
{
- wr::WrRect scBounds = aParentSC.ToRelativeWrRect(aLayer->BoundsForStackingContext());
+ wr::LayoutRect scBounds = aParentSC.ToRelativeLayoutRect(aLayer->BoundsForStackingContext());
Layer* layer = aLayer->GetLayer();
mTransform = aTransform.valueOr(layer->GetTransform());
float opacity = 1.0f;
mBuilder->PushStackingContext(scBounds, 0, &opacity,
mTransform.IsIdentity() ? nullptr : &mTransform,
wr::WrTransformStyle::Flat,
wr::ToWrMixBlendMode(layer->GetMixBlendMode()),
@@ -68,17 +68,17 @@ StackingContextHelper::StackingContextHe
wr::DisplayListBuilder& aBuilder,
WebRenderLayer* aLayer,
uint64_t aAnimationsId,
float* aOpacityPtr,
gfx::Matrix4x4* aTransformPtr,
const nsTArray<wr::WrFilterOp>& aFilters)
: mBuilder(&aBuilder)
{
- wr::WrRect scBounds = aParentSC.ToRelativeWrRect(aLayer->BoundsForStackingContext());
+ wr::LayoutRect scBounds = aParentSC.ToRelativeLayoutRect(aLayer->BoundsForStackingContext());
if (aTransformPtr) {
mTransform = *aTransformPtr;
}
mBuilder->PushStackingContext(scBounds,
aAnimationsId,
aOpacityPtr,
aTransformPtr,
@@ -90,34 +90,34 @@ StackingContextHelper::StackingContextHe
StackingContextHelper::~StackingContextHelper()
{
if (mBuilder) {
mBuilder->PopStackingContext();
}
}
-wr::WrRect
-StackingContextHelper::ToRelativeWrRect(const LayerRect& aRect) const
+wr::LayoutRect
+StackingContextHelper::ToRelativeLayoutRect(const LayerRect& aRect) const
{
- return wr::ToWrRect(aRect - mOrigin);
+ return wr::ToLayoutRect(aRect - mOrigin);
}
-wr::WrRect
-StackingContextHelper::ToRelativeWrRect(const LayoutDeviceRect& aRect) const
+wr::LayoutRect
+StackingContextHelper::ToRelativeLayoutRect(const LayoutDeviceRect& aRect) const
{
- return wr::ToWrRect(ViewAs<LayerPixel>(aRect, PixelCastJustification::WebRenderHasUnitResolution) - mOrigin);
+ return wr::ToLayoutRect(ViewAs<LayerPixel>(aRect, PixelCastJustification::WebRenderHasUnitResolution) - mOrigin);
}
-wr::WrPoint
-StackingContextHelper::ToRelativeWrPoint(const LayerPoint& aPoint) const
+wr::LayoutPoint
+StackingContextHelper::ToRelativeLayoutPoint(const LayerPoint& aPoint) const
{
- return wr::ToWrPoint(aPoint - mOrigin);
+ return wr::ToLayoutPoint(aPoint - mOrigin);
}
-wr::WrRect
-StackingContextHelper::ToRelativeWrRectRounded(const LayoutDeviceRect& aRect) const
+wr::LayoutRect
+StackingContextHelper::ToRelativeLayoutRectRounded(const LayoutDeviceRect& aRect) const
{
- return wr::ToWrRect(RoundedToInt(ViewAs<LayerPixel>(aRect, PixelCastJustification::WebRenderHasUnitResolution) - mOrigin));
+ 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
@@ -56,29 +56,29 @@ public:
// 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();
// When this StackingContextHelper is in scope, this function can be used
- // to convert a rect from the layer system's coordinate space to a WrRect
+ // 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).
- wr::WrRect ToRelativeWrRect(const LayerRect& aRect) const;
- wr::WrRect ToRelativeWrRect(const LayoutDeviceRect& aRect) const;
+ wr::LayoutRect ToRelativeLayoutRect(const LayerRect& aRect) const;
+ wr::LayoutRect ToRelativeLayoutRect(const LayoutDeviceRect& aRect) const;
// Same but for points
- wr::WrPoint ToRelativeWrPoint(const LayerPoint& aPoint) const;
+ wr::LayoutPoint ToRelativeLayoutPoint(const LayerPoint& aPoint) const;
// Same but rounds the rectangle to ints after transforming.
- wr::WrRect ToRelativeWrRectRounded(const LayoutDeviceRect& aRect) const;
+ wr::LayoutRect ToRelativeLayoutRectRounded(const LayoutDeviceRect& aRect) const;
private:
wr::DisplayListBuilder* mBuilder;
LayerPoint mOrigin;
gfx::Matrix4x4 mTransform;
};
} // namespace layers
--- a/gfx/layers/wr/WebRenderBridgeChild.cpp
+++ b/gfx/layers/wr/WebRenderBridgeChild.cpp
@@ -102,17 +102,17 @@ WebRenderBridgeChild::DPEnd(wr::DisplayL
bool aIsSync,
uint64_t aTransactionId,
const WebRenderScrollData& aScrollData)
{
MOZ_ASSERT(!mDestroyed);
MOZ_ASSERT(mIsInTransaction);
wr::BuiltDisplayList dl;
- wr::WrSize contentSize;
+ wr::LayoutSize contentSize;
aBuilder.Finalize(contentSize, dl);
ByteBuffer dlData(Move(dl.dl));
if (aIsSync) {
this->SendDPSyncEnd(aSize, mParentCommands, mDestroyedActors, GetFwdTransactionId(), aTransactionId,
contentSize, dlData, dl.dl_desc, aScrollData, mIdNamespace);
} else {
this->SendDPEnd(aSize, mParentCommands, mDestroyedActors, GetFwdTransactionId(), aTransactionId,
@@ -212,22 +212,22 @@ WebRenderBridgeChild::PushGlyphs(wr::Dis
GlyphArray glyph_array = aGlyphs[i];
nsTArray<gfx::Glyph>& glyphs = glyph_array.glyphs();
nsTArray<wr::WrGlyphInstance> wr_glyph_instances;
wr_glyph_instances.SetLength(glyphs.Length());
for (size_t j = 0; j < glyphs.Length(); j++) {
wr_glyph_instances[j].index = glyphs[j].mIndex;
- wr_glyph_instances[j].point = aSc.ToRelativeWrPoint(
+ wr_glyph_instances[j].point = aSc.ToRelativeLayoutPoint(
LayerPoint::FromUnknownPoint(glyphs[j].mPosition));
}
- aBuilder.PushText(aSc.ToRelativeWrRect(aBounds),
- aSc.ToRelativeWrRect(aClip),
+ aBuilder.PushText(aSc.ToRelativeLayoutRect(aBounds),
+ aSc.ToRelativeLayoutRect(aClip),
glyph_array.color().value(),
key,
Range<const wr::WrGlyphInstance>(wr_glyph_instances.Elements(), wr_glyph_instances.Length()),
aFont->GetSize());
}
}
--- a/gfx/layers/wr/WebRenderBridgeParent.cpp
+++ b/gfx/layers/wr/WebRenderBridgeParent.cpp
@@ -395,17 +395,17 @@ WebRenderBridgeParent::RecvDPBegin(const
}
void
WebRenderBridgeParent::HandleDPEnd(const gfx::IntSize& aSize,
InfallibleTArray<WebRenderParentCommand>&& aCommands,
InfallibleTArray<OpDestroy>&& aToDestroy,
const uint64_t& aFwdTransactionId,
const uint64_t& aTransactionId,
- const wr::WrSize& aContentSize,
+ const wr::LayoutSize& aContentSize,
const wr::ByteBuffer& dl,
const wr::WrBuiltDisplayListDescriptor& dlDesc,
const WebRenderScrollData& aScrollData,
const uint32_t& aIdNameSpace)
{
AutoProfilerTracing tracing("Paint", "DPTransaction");
UpdateFwdTransactionId(aFwdTransactionId);
AutoClearReadLocks clearLocks(mReadLocks);
@@ -508,17 +508,17 @@ WebRenderBridgeParent::GetScrollData() c
}
mozilla::ipc::IPCResult
WebRenderBridgeParent::RecvDPEnd(const gfx::IntSize& aSize,
InfallibleTArray<WebRenderParentCommand>&& aCommands,
InfallibleTArray<OpDestroy>&& aToDestroy,
const uint64_t& aFwdTransactionId,
const uint64_t& aTransactionId,
- const wr::WrSize& aContentSize,
+ const wr::LayoutSize& aContentSize,
const wr::ByteBuffer& dl,
const wr::WrBuiltDisplayListDescriptor& dlDesc,
const WebRenderScrollData& aScrollData,
const uint32_t& aIdNameSpace)
{
if (mDestroyed) {
return IPC_OK();
}
@@ -528,17 +528,17 @@ WebRenderBridgeParent::RecvDPEnd(const g
}
mozilla::ipc::IPCResult
WebRenderBridgeParent::RecvDPSyncEnd(const gfx::IntSize &aSize,
InfallibleTArray<WebRenderParentCommand>&& aCommands,
InfallibleTArray<OpDestroy>&& aToDestroy,
const uint64_t& aFwdTransactionId,
const uint64_t& aTransactionId,
- const wr::WrSize& aContentSize,
+ const wr::LayoutSize& aContentSize,
const wr::ByteBuffer& dl,
const wr::WrBuiltDisplayListDescriptor& dlDesc,
const WebRenderScrollData& aScrollData,
const uint32_t& aIdNameSpace)
{
if (mDestroyed) {
return IPC_OK();
}
@@ -651,17 +651,17 @@ WebRenderBridgeParent::ProcessWebRenderP
}
}
}
}
void
WebRenderBridgeParent::ProcessWebRenderCommands(const gfx::IntSize &aSize,
InfallibleTArray<WebRenderParentCommand>& aCommands, const wr::Epoch& aEpoch,
- const wr::WrSize& aContentSize, const wr::ByteBuffer& dl,
+ const wr::LayoutSize& aContentSize, const wr::ByteBuffer& dl,
const wr::WrBuiltDisplayListDescriptor& dlDesc,
const uint32_t& aIdNameSpace)
{
mCompositableHolder->SetCompositionTime(TimeStamp::Now());
ProcessWebRenderParentCommands(aCommands);
// The command is obsoleted.
// Do not set the command to webrender since it causes crash in webrender.
--- a/gfx/layers/wr/WebRenderBridgeParent.h
+++ b/gfx/layers/wr/WebRenderBridgeParent.h
@@ -93,27 +93,27 @@ public:
const uint32_t& aFontIndex) override;
mozilla::ipc::IPCResult RecvDeleteFont(const wr::FontKey& aFontKey) override;
mozilla::ipc::IPCResult RecvDPBegin(const gfx::IntSize& aSize) override;
mozilla::ipc::IPCResult RecvDPEnd(const gfx::IntSize& aSize,
InfallibleTArray<WebRenderParentCommand>&& aCommands,
InfallibleTArray<OpDestroy>&& aToDestroy,
const uint64_t& aFwdTransactionId,
const uint64_t& aTransactionId,
- const wr::WrSize& aContentSize,
+ const wr::LayoutSize& aContentSize,
const wr::ByteBuffer& dl,
const wr::WrBuiltDisplayListDescriptor& dlDesc,
const WebRenderScrollData& aScrollData,
const uint32_t& aIdNameSpace) override;
mozilla::ipc::IPCResult RecvDPSyncEnd(const gfx::IntSize& aSize,
InfallibleTArray<WebRenderParentCommand>&& aCommands,
InfallibleTArray<OpDestroy>&& aToDestroy,
const uint64_t& aFwdTransactionId,
const uint64_t& aTransactionId,
- const wr::WrSize& aContentSize,
+ const wr::LayoutSize& aContentSize,
const wr::ByteBuffer& dl,
const wr::WrBuiltDisplayListDescriptor& dlDesc,
const WebRenderScrollData& aScrollData,
const uint32_t& aIdNameSpace) override;
mozilla::ipc::IPCResult RecvParentCommands(nsTArray<WebRenderParentCommand>&& commands) override;
mozilla::ipc::IPCResult RecvDPGetSnapshot(PTextureParent* aTexture) override;
mozilla::ipc::IPCResult RecvAddPipelineIdForAsyncCompositable(const wr::PipelineId& aPipelineIds,
@@ -212,29 +212,29 @@ private:
virtual ~WebRenderBridgeParent();
uint64_t GetLayersId() const;
void DeleteOldImages();
void ProcessWebRenderParentCommands(InfallibleTArray<WebRenderParentCommand>& aCommands);
void ProcessWebRenderCommands(const gfx::IntSize &aSize,
InfallibleTArray<WebRenderParentCommand>& commands,
const wr::Epoch& aEpoch,
- const wr::WrSize& aContentSize,
+ const wr::LayoutSize& aContentSize,
const wr::ByteBuffer& dl,
const wr::WrBuiltDisplayListDescriptor& dlDesc,
const uint32_t& aIdNameSpace);
void ClearResources();
uint64_t GetChildLayerObserverEpoch() const { return mChildLayerObserverEpoch; }
bool ShouldParentObserveEpoch();
void HandleDPEnd(const gfx::IntSize& aSize,
InfallibleTArray<WebRenderParentCommand>&& aCommands,
InfallibleTArray<OpDestroy>&& aToDestroy,
const uint64_t& aFwdTransactionId,
const uint64_t& aTransactionId,
- const wr::WrSize& aContentSize,
+ const wr::LayoutSize& aContentSize,
const wr::ByteBuffer& dl,
const wr::WrBuiltDisplayListDescriptor& dlDesc,
const WebRenderScrollData& aScrollData,
const uint32_t& aIdNameSpace);
mozilla::ipc::IPCResult HandleShutdown();
void AdvanceAnimations();
void SampleAnimations(nsTArray<wr::WrOpacityProperty>& aOpacityArray,
--- a/gfx/layers/wr/WebRenderCanvasLayer.cpp
+++ b/gfx/layers/wr/WebRenderCanvasLayer.cpp
@@ -76,17 +76,17 @@ WebRenderCanvasLayer::RenderLayer(wr::Di
this->GetLayer(),
Stringify(filter).c_str());
}
wr::WrImageKey key = GetImageKey();
WrBridge()->AddWebRenderParentCommand(OpAddExternalImage(mExternalImageId.value(), key));
WrManager()->AddImageKeyForDiscard(key);
- wr::WrRect r = sc.ToRelativeWrRect(rect);
+ wr::LayoutRect r = sc.ToRelativeLayoutRect(rect);
aBuilder.PushImage(r, r, filter, key);
}
void
WebRenderCanvasLayer::AttachCompositable()
{
mCanvasClient->Connect();
}
--- a/gfx/layers/wr/WebRenderColorLayer.cpp
+++ b/gfx/layers/wr/WebRenderColorLayer.cpp
@@ -23,14 +23,14 @@ WebRenderColorLayer::RenderLayer(wr::Dis
const StackingContextHelper& aSc)
{
ScrollingLayersHelper scroller(this, aBuilder, aSc);
StackingContextHelper sc(aSc, aBuilder, this);
LayerRect rect = Bounds();
DumpLayerInfo("ColorLayer", rect);
- wr::WrRect r = sc.ToRelativeWrRect(rect);
- aBuilder.PushRect(r, r, wr::ToWrColor(mColor));
+ wr::LayoutRect r = sc.ToRelativeLayoutRect(rect);
+ aBuilder.PushRect(r, r, wr::ToColorF(mColor));
}
} // namespace layers
} // namespace mozilla
--- a/gfx/layers/wr/WebRenderCompositableHolder.cpp
+++ b/gfx/layers/wr/WebRenderCompositableHolder.cpp
@@ -259,57 +259,57 @@ WebRenderCompositableHolder::ApplyAsyncI
useExternalImage,
holder,
keys,
keysToDelete);
if (!updateDisplayList) {
continue;
}
- wr::WrSize contentSize { holder->mScBounds.width, holder->mScBounds.height };
+ wr::LayoutSize contentSize { holder->mScBounds.width, holder->mScBounds.height };
wr::DisplayListBuilder builder(pipelineId, contentSize);
if (!keys.IsEmpty()) {
MOZ_ASSERT(holder->mCurrentTexture.get());
float opacity = 1.0f;
- builder.PushStackingContext(wr::ToWrRect(holder->mScBounds),
+ builder.PushStackingContext(wr::ToLayoutRect(holder->mScBounds),
0,
&opacity,
holder->mScTransform.IsIdentity() ? nullptr : &holder->mScTransform,
wr::WrTransformStyle::Flat,
holder->mMixBlendMode,
nsTArray<wr::WrFilterOp>());
LayerRect rect(0, 0, holder->mCurrentTexture->GetSize().width, holder->mCurrentTexture->GetSize().height);
if (holder->mScaleToSize.isSome()) {
rect = LayerRect(0, 0, holder->mScaleToSize.value().width, holder->mScaleToSize.value().height);
}
if (useExternalImage) {
MOZ_ASSERT(holder->mCurrentTexture->AsWebRenderTextureHost());
Range<const wr::ImageKey> range_keys(&keys[0], keys.Length());
holder->mCurrentTexture->PushExternalImage(builder,
- wr::ToWrRect(rect),
- wr::ToWrRect(rect),
+ wr::ToLayoutRect(rect),
+ wr::ToLayoutRect(rect),
holder->mFilter,
range_keys);
HoldExternalImage(pipelineId, epoch, holder->mCurrentTexture->AsWebRenderTextureHost());
} else {
MOZ_ASSERT(keys.Length() == 1);
- builder.PushImage(wr::ToWrRect(rect),
- wr::ToWrRect(rect),
+ builder.PushImage(wr::ToLayoutRect(rect),
+ wr::ToLayoutRect(rect),
holder->mFilter,
keys[0]);
}
builder.PopStackingContext();
}
wr::BuiltDisplayList dl;
- wr::WrSize builderContentSize;
+ wr::LayoutSize builderContentSize;
builder.Finalize(builderContentSize, dl);
aApi->SetRootDisplayList(gfx::Color(0.f, 0.f, 0.f, 0.f), epoch, LayerSize(holder->mScBounds.width, holder->mScBounds.height),
pipelineId, builderContentSize,
dl.dl_desc, dl.dl.inner.data, dl.dl.inner.length);
}
DeleteOldAsyncImages(aApi);
mKeysToDelete.SwapElements(keysToDelete);
}
--- a/gfx/layers/wr/WebRenderContainerLayer.cpp
+++ b/gfx/layers/wr/WebRenderContainerLayer.cpp
@@ -145,14 +145,14 @@ WebRenderRefLayer::RenderLayer(wr::Displ
// we need to apply that transform to the bounds before we pass it on to WR.
// The conversion from ParentLayerPixel to LayerPixel below is a result of
// changing the reference layer from "this layer" to the "the layer that
// created aSc".
LayerRect rect = ViewAs<LayerPixel>(bounds,
PixelCastJustification::MovingDownToChildren);
DumpLayerInfo("RefLayer", rect);
- wr::WrRect r = aSc.ToRelativeWrRect(rect);
+ wr::LayoutRect r = aSc.ToRelativeLayoutRect(rect);
aBuilder.PushIFrame(r, wr::AsPipelineId(mId));
}
} // namespace layers
} // namespace mozilla
--- a/gfx/layers/wr/WebRenderDisplayItemLayer.cpp
+++ b/gfx/layers/wr/WebRenderDisplayItemLayer.cpp
@@ -29,17 +29,17 @@ WebRenderDisplayItemLayer::RenderLayer(w
{
if (mVisibleRegion.IsEmpty()) {
return;
}
ScrollingLayersHelper scroller(this, aBuilder, aSc);
if (mItem) {
- wr::WrSize contentSize; // this won't actually be used by anything
+ wr::LayoutSize contentSize; // this won't actually be used by anything
wr::DisplayListBuilder builder(WrBridge()->GetPipeline(), contentSize);
// We might have recycled this layer. Throw away the old commands.
mParentCommands.Clear();
mItem->CreateWebRenderCommands(builder, aSc, mParentCommands, WrManager(),
GetDisplayListBuilder());
builder.Finalize(contentSize, mBuiltDisplayList);
} else {
--- a/gfx/layers/wr/WebRenderImageLayer.cpp
+++ b/gfx/layers/wr/WebRenderImageLayer.cpp
@@ -154,17 +154,17 @@ WebRenderImageLayer::RenderLayer(wr::Dis
// context need to be done manually and pushed over to the parent side,
// where it will be done when we build the display list for the iframe.
// That happens in WebRenderCompositableHolder.
LayerRect rect = ViewAs<LayerPixel>(bounds,
PixelCastJustification::MovingDownToChildren);
DumpLayerInfo("Image Layer async", rect);
- wr::WrRect r = aSc.ToRelativeWrRect(rect);
+ wr::LayoutRect r = aSc.ToRelativeLayoutRect(rect);
aBuilder.PushIFrame(r, mPipelineId.ref());
gfx::Matrix4x4 scTransform = GetTransform();
// Translate is applied as part of PushIFrame()
scTransform.PostTranslate(-rect.x, -rect.y, 0);
// Adjust transform as to apply origin
LayerPoint scOrigin = Bounds().TopLeft();
scTransform.PreTranslate(-scOrigin.x, -scOrigin.y, 0);
@@ -218,17 +218,17 @@ WebRenderImageLayer::RenderLayer(wr::Dis
wr::ImageRendering filter = wr::ToImageRendering(mSamplingFilter);
DumpLayerInfo("Image Layer", rect);
if (gfxPrefs::LayersDump()) {
printf_stderr("ImageLayer %p texture-filter=%s \n",
GetLayer(),
Stringify(filter).c_str());
}
- wr::WrRect r = sc.ToRelativeWrRect(rect);
+ wr::LayoutRect r = sc.ToRelativeLayoutRect(rect);
aBuilder.PushImage(r, r, filter, mKey.value());
}
Maybe<wr::WrImageMask>
WebRenderImageLayer::RenderMaskLayer(const StackingContextHelper& aSc,
const gfx::Matrix4x4& aTransform)
{
if (!mContainer) {
@@ -273,15 +273,15 @@ WebRenderImageLayer::RenderMaskLayer(con
if (mKey.isNothing()) {
return Nothing();
}
gfx::IntSize size = image->GetSize();
wr::WrImageMask imageMask;
imageMask.image = mKey.value();
Rect maskRect = aTransform.TransformBounds(Rect(0, 0, size.width, size.height));
- imageMask.rect = aSc.ToRelativeWrRect(ViewAs<LayerPixel>(maskRect));
+ imageMask.rect = aSc.ToRelativeLayoutRect(ViewAs<LayerPixel>(maskRect));
imageMask.repeat = false;
return Some(imageMask);
}
} // namespace layers
} // namespace mozilla
--- a/gfx/layers/wr/WebRenderLayerManager.cpp
+++ b/gfx/layers/wr/WebRenderLayerManager.cpp
@@ -294,17 +294,17 @@ WebRenderLayerManager::PushImage(nsDispl
{
gfx::IntSize size;
Maybe<wr::ImageKey> key = CreateImageKey(aItem, aContainer, aBuilder, aSc, size);
if (!key) {
return false;
}
wr::ImageRendering filter = wr::ImageRendering::Auto;
- auto r = aSc.ToRelativeWrRect(aRect);
+ auto r = aSc.ToRelativeLayoutRect(aRect);
aBuilder.PushImage(r, r, filter, key.value());
return true;
}
static void
PaintItemByDrawTarget(nsDisplayItem* aItem,
DrawTarget* aDT,
@@ -421,17 +421,17 @@ WebRenderLayerManager::PushItemAsImage(n
}
// Update current bounds to fallback data
fallbackData->SetGeometry(Move(geometry));
fallbackData->SetBounds(clippedBounds);
MOZ_ASSERT(fallbackData->GetKey());
- wr::WrRect dest = aSc.ToRelativeWrRect(imageRect + offset);
+ wr::LayoutRect dest = aSc.ToRelativeLayoutRect(imageRect + offset);
aBuilder.PushImage(dest,
dest,
wr::ImageRendering::Auto,
fallbackData->GetKey().value());
return true;
}
void
@@ -465,17 +465,17 @@ WebRenderLayerManager::EndTransactionInt
mAnimationReadyTime = TimeStamp::Now();
LayoutDeviceIntSize size = mWidget->GetClientSize();
if (!WrBridge()->DPBegin(size.ToUnknownSize())) {
return false;
}
DiscardCompositorAnimations();
- wr::WrSize contentSize { (float)size.width, (float)size.height };
+ wr::LayoutSize contentSize { (float)size.width, (float)size.height };
wr::DisplayListBuilder builder(WrBridge()->GetPipeline(), contentSize);
if (mEndTransactionWithoutLayers) {
// aDisplayList being null here means this is an empty transaction following a layers-free
// transaction, so we reuse the previously built displaylist.
if (aDisplayList && aDisplayListBuilder) {
StackingContextHelper sc;
mParentCommands.Clear();
--- a/gfx/layers/wr/WebRenderMessageUtils.h
+++ b/gfx/layers/wr/WebRenderMessageUtils.h
@@ -110,67 +110,67 @@ struct ParamTraits<mozilla::wr::WrImageF
: public ContiguousEnumSerializer<
mozilla::wr::WrImageFormat,
mozilla::wr::WrImageFormat::Invalid,
mozilla::wr::WrImageFormat::Sentinel>
{
};
template<>
-struct ParamTraits<mozilla::wr::WrSize>
+struct ParamTraits<mozilla::wr::LayoutSize>
{
static void
- Write(Message* aMsg, const mozilla::wr::WrSize& aParam)
+ Write(Message* aMsg, const mozilla::wr::LayoutSize& aParam)
{
WriteParam(aMsg, aParam.width);
WriteParam(aMsg, aParam.height);
}
static bool
- Read(const Message* aMsg, PickleIterator* aIter, mozilla::wr::WrSize* aResult)
+ Read(const Message* aMsg, PickleIterator* aIter, mozilla::wr::LayoutSize* aResult)
{
return ReadParam(aMsg, aIter, &aResult->width)
&& ReadParam(aMsg, aIter, &aResult->height);
}
};
template<>
-struct ParamTraits<mozilla::wr::WrRect>
+struct ParamTraits<mozilla::wr::LayoutRect>
{
static void
- Write(Message* aMsg, const mozilla::wr::WrRect& aParam)
+ Write(Message* aMsg, const mozilla::wr::LayoutRect& aParam)
{
- WriteParam(aMsg, aParam.x);
- WriteParam(aMsg, aParam.y);
- WriteParam(aMsg, aParam.width);
- WriteParam(aMsg, aParam.height);
+ WriteParam(aMsg, aParam.origin.x);
+ WriteParam(aMsg, aParam.origin.y);
+ WriteParam(aMsg, aParam.size.width);
+ WriteParam(aMsg, aParam.size.height);
}
static bool
- Read(const Message* aMsg, PickleIterator* aIter, mozilla::wr::WrRect* aResult)
+ Read(const Message* aMsg, PickleIterator* aIter, mozilla::wr::LayoutRect* aResult)
{
- return ReadParam(aMsg, aIter, &aResult->x)
- && ReadParam(aMsg, aIter, &aResult->y)
- && ReadParam(aMsg, aIter, &aResult->width)
- && ReadParam(aMsg, aIter, &aResult->height);
+ return ReadParam(aMsg, aIter, &aResult->origin.x)
+ && ReadParam(aMsg, aIter, &aResult->origin.y)
+ && ReadParam(aMsg, aIter, &aResult->size.width)
+ && ReadParam(aMsg, aIter, &aResult->size.height);
}
};
template<>
-struct ParamTraits<mozilla::wr::WrPoint>
+struct ParamTraits<mozilla::wr::LayoutPoint>
{
static void
- Write(Message* aMsg, const mozilla::wr::WrPoint& aParam)
+ Write(Message* aMsg, const mozilla::wr::LayoutPoint& aParam)
{
WriteParam(aMsg, aParam.x);
WriteParam(aMsg, aParam.y);
}
static bool
- Read(const Message* aMsg, PickleIterator* aIter, mozilla::wr::WrPoint* aResult)
+ Read(const Message* aMsg, PickleIterator* aIter, mozilla::wr::LayoutPoint* aResult)
{
return ReadParam(aMsg, aIter, &aResult->x) &&
ReadParam(aMsg, aIter, &aResult->y);
}
};
template<>
struct ParamTraits<mozilla::wr::WrImageMask>
--- a/gfx/layers/wr/WebRenderPaintedLayer.cpp
+++ b/gfx/layers/wr/WebRenderPaintedLayer.cpp
@@ -98,17 +98,17 @@ WebRenderPaintedLayer::CreateWebRenderDi
LayerRect rect = Bounds();
DumpLayerInfo("PaintedLayer", rect);
wr::WrImageKey key = GetImageKey();
WrBridge()->AddWebRenderParentCommand(OpAddExternalImage(mExternalImageId.value(), key));
WrManager()->AddImageKeyForDiscard(key);
- wr::WrRect r = sc.ToRelativeWrRect(rect);
+ wr::LayoutRect r = sc.ToRelativeLayoutRect(rect);
aBuilder.PushImage(r, r, wr::ImageRendering::Auto, key);
}
void
WebRenderPaintedLayer::RenderLayer(wr::DisplayListBuilder& aBuilder,
const StackingContextHelper& aSc)
{
if (!SetupExternalImages()) {
--- a/gfx/layers/wr/WebRenderPaintedLayerBlob.cpp
+++ b/gfx/layers/wr/WebRenderPaintedLayerBlob.cpp
@@ -83,15 +83,15 @@ WebRenderPaintedLayerBlob::RenderLayer(w
mImageBounds = visibleRegion.GetBounds();
}
ScrollingLayersHelper scroller(this, aBuilder, aSc);
StackingContextHelper sc(aSc, aBuilder, this);
LayerRect rect = Bounds();
DumpLayerInfo("PaintedLayer", rect);
- aBuilder.PushImage(sc.ToRelativeWrRect(LayerRect(mImageBounds)),
- sc.ToRelativeWrRect(rect),
+ aBuilder.PushImage(sc.ToRelativeLayoutRect(LayerRect(mImageBounds)),
+ sc.ToRelativeLayoutRect(rect),
wr::ImageRendering::Auto, mImageKey.value());
}
} // namespace layers
} // namespace mozilla
--- a/gfx/layers/wr/WebRenderTextureHost.cpp
+++ b/gfx/layers/wr/WebRenderTextureHost.cpp
@@ -173,18 +173,18 @@ WebRenderTextureHost::AddWRImage(wr::Web
MOZ_ASSERT(mWrappedTextureHost);
MOZ_ASSERT(mExternalImageId == aExtID);
mWrappedTextureHost->AddWRImage(aAPI, aImageKeys, aExtID);
}
void
WebRenderTextureHost::PushExternalImage(wr::DisplayListBuilder& aBuilder,
- const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
+ const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aImageKeys)
{
MOZ_ASSERT(mWrappedTextureHost);
MOZ_ASSERT(aImageKeys.length() > 0);
mWrappedTextureHost->PushExternalImage(aBuilder,
aBounds,
--- a/gfx/layers/wr/WebRenderTextureHost.h
+++ b/gfx/layers/wr/WebRenderTextureHost.h
@@ -68,18 +68,18 @@ public:
virtual void GetWRImageKeys(nsTArray<wr::ImageKey>& aImageKeys,
const std::function<wr::ImageKey()>& aImageKeyAllocator) override;
virtual void AddWRImage(wr::WebRenderAPI* aAPI,
Range<const wr::ImageKey>& aImageKeys,
const wr::ExternalImageId& aExtID) override;
virtual void PushExternalImage(wr::DisplayListBuilder& aBuilder,
- const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
+ const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aImageKeys) override;
protected:
void CreateRenderTextureHost(const SurfaceDescriptor& aDesc, TextureHost* aTexture);
RefPtr<TextureHost> mWrappedTextureHost;
wr::ExternalImageId mExternalImageId;
--- a/gfx/layers/wr/WebRenderUserData.cpp
+++ b/gfx/layers/wr/WebRenderUserData.cpp
@@ -109,17 +109,17 @@ WebRenderImageData::CreateAsyncImageWebR
// Push IFrame for async image pipeline.
//
// We don't push a stacking context for this async image pipeline here.
// Instead, we do it inside the iframe that hosts the image. As a result,
// a bunch of the calculations normally done as part of that stacking
// context need to be done manually and pushed over to the parent side,
// where it will be done when we build the display list for the iframe.
// That happens in WebRenderCompositableHolder.
- wr::WrRect r = aSc.ToRelativeWrRect(aBounds);
+ wr::LayoutRect r = aSc.ToRelativeLayoutRect(aBounds);
aBuilder.PushIFrame(r, mPipelineId.ref());
WrBridge()->AddWebRenderParentCommand(OpUpdateAsyncImagePipeline(mPipelineId.value(),
aSCBounds,
aSCTransform,
aScaleToSize,
aFilter,
aMixBlendMode));
--- a/gfx/webrender_bindings/WebRenderAPI.cpp
+++ b/gfx/webrender_bindings/WebRenderAPI.cpp
@@ -177,17 +177,17 @@ WebRenderAPI::~WebRenderAPI()
task.Wait();
wr_api_delete(mWrApi);
}
void
WebRenderAPI::UpdateScrollPosition(const wr::WrPipelineId& aPipelineId,
const layers::FrameMetrics::ViewID& aScrollId,
- const wr::WrPoint& aScrollPosition)
+ const wr::LayoutPoint& aScrollPosition)
{
wr_scroll_layer_with_id(mWrApi, aPipelineId, aScrollId, aScrollPosition);
}
void
WebRenderAPI::GenerateFrame()
{
wr_api_generate_frame(mWrApi);
@@ -206,23 +206,23 @@ WebRenderAPI::GenerateFrame(const nsTArr
aTransformArray.Length());
}
void
WebRenderAPI::SetRootDisplayList(gfx::Color aBgColor,
Epoch aEpoch,
LayerSize aViewportSize,
wr::WrPipelineId pipeline_id,
- const WrSize& content_size,
+ const LayoutSize& content_size,
wr::WrBuiltDisplayListDescriptor dl_descriptor,
uint8_t *dl_data,
size_t dl_size)
{
wr_api_set_root_display_list(mWrApi,
- ToWrColor(aBgColor),
+ ToColorF(aBgColor),
aEpoch,
aViewportSize.width, aViewportSize.height,
pipeline_id,
content_size,
dl_descriptor,
dl_data,
dl_size);
}
@@ -513,17 +513,17 @@ WebRenderAPI::SetProfilerEnabled(bool aE
void
WebRenderAPI::RunOnRenderThread(UniquePtr<RendererEvent> aEvent)
{
auto event = reinterpret_cast<uintptr_t>(aEvent.release());
wr_api_send_external_event(mWrApi, event);
}
DisplayListBuilder::DisplayListBuilder(PipelineId aId,
- const wr::WrSize& aContentSize)
+ const wr::LayoutSize& aContentSize)
{
MOZ_COUNT_CTOR(DisplayListBuilder);
mWrState = wr_state_new(aId, aContentSize);
}
DisplayListBuilder::~DisplayListBuilder()
{
MOZ_COUNT_DTOR(DisplayListBuilder);
@@ -538,55 +538,55 @@ DisplayListBuilder::Begin(const LayerInt
void
DisplayListBuilder::End()
{
wr_dp_end(mWrState);
}
void
-DisplayListBuilder::Finalize(wr::WrSize& aOutContentSize,
+DisplayListBuilder::Finalize(wr::LayoutSize& aOutContentSize,
BuiltDisplayList& aOutDisplayList)
{
wr_api_finalize_builder(mWrState,
&aOutContentSize,
&aOutDisplayList.dl_desc,
&aOutDisplayList.dl.inner);
}
void
-DisplayListBuilder::PushStackingContext(const wr::WrRect& aBounds,
+DisplayListBuilder::PushStackingContext(const wr::LayoutRect& aBounds,
const uint64_t& aAnimationId,
const float* aOpacity,
const gfx::Matrix4x4* aTransform,
wr::WrTransformStyle aTransformStyle,
const wr::WrMixBlendMode& aMixBlendMode,
const nsTArray<wr::WrFilterOp>& aFilters)
{
- wr::WrMatrix matrix;
+ wr::LayoutTransform matrix;
if (aTransform) {
- matrix = ToWrMatrix(*aTransform);
+ matrix = ToLayoutTransform(*aTransform);
}
- const wr::WrMatrix* maybeTransform = aTransform ? &matrix : nullptr;
+ const wr::LayoutTransform* maybeTransform = aTransform ? &matrix : nullptr;
WRDL_LOG("PushStackingContext b=%s t=%s\n", Stringify(aBounds).c_str(),
aTransform ? Stringify(*aTransform).c_str() : "none");
wr_dp_push_stacking_context(mWrState, aBounds, aAnimationId, aOpacity,
maybeTransform, aTransformStyle, aMixBlendMode,
aFilters.Elements(), aFilters.Length());
}
void
DisplayListBuilder::PopStackingContext()
{
WRDL_LOG("PopStackingContext\n");
wr_dp_pop_stacking_context(mWrState);
}
void
-DisplayListBuilder::PushClip(const wr::WrRect& aClipRect,
+DisplayListBuilder::PushClip(const wr::LayoutRect& aClipRect,
const wr::WrImageMask* aMask)
{
uint64_t clip_id = wr_dp_push_clip(mWrState, aClipRect, nullptr, 0, aMask);
WRDL_LOG("PushClip id=%" PRIu64 " r=%s m=%p b=%s\n", clip_id,
Stringify(aClipRect).c_str(), aMask,
aMask ? Stringify(aMask->rect).c_str() : "none");
mClipIdStack.push_back(wr::WrClipId { clip_id });
}
@@ -604,18 +604,18 @@ DisplayListBuilder::PushBuiltDisplayList
{
wr_dp_push_built_display_list(mWrState,
dl.dl_desc,
&dl.dl.inner);
}
void
DisplayListBuilder::PushScrollLayer(const layers::FrameMetrics::ViewID& aScrollId,
- const wr::WrRect& aContentRect,
- const wr::WrRect& aClipRect)
+ const wr::LayoutRect& aContentRect,
+ const wr::LayoutRect& aClipRect)
{
WRDL_LOG("PushScrollLayer id=%" PRIu64 " co=%s cl=%s\n",
aScrollId, Stringify(aContentRect).c_str(), Stringify(aClipRect).c_str());
wr_dp_push_scroll_layer(mWrState, aScrollId, aContentRect, aClipRect);
if (!mScrollIdStack.empty()) {
auto it = mScrollParents.insert({aScrollId, mScrollIdStack.back()});
if (!it.second) { // aScrollId was already a key in mScrollParents
// so check that the parent value is the same.
@@ -646,92 +646,92 @@ DisplayListBuilder::PushClipAndScrollInf
void
DisplayListBuilder::PopClipAndScrollInfo()
{
WRDL_LOG("PopClipAndScroll\n");
wr_dp_pop_clip_and_scroll_info(mWrState);
}
void
-DisplayListBuilder::PushRect(const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
- const wr::WrColor& aColor)
+DisplayListBuilder::PushRect(const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
+ const wr::ColorF& aColor)
{
WRDL_LOG("PushRect b=%s cl=%s c=%s\n",
Stringify(aBounds).c_str(),
Stringify(aClip).c_str(),
Stringify(aColor).c_str());
wr_dp_push_rect(mWrState, aBounds, aClip, aColor);
}
void
-DisplayListBuilder::PushLinearGradient(const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
- const wr::WrPoint& aStartPoint,
- const wr::WrPoint& aEndPoint,
+DisplayListBuilder::PushLinearGradient(const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
+ const wr::LayoutPoint& aStartPoint,
+ const wr::LayoutPoint& aEndPoint,
const nsTArray<wr::WrGradientStop>& aStops,
wr::GradientExtendMode aExtendMode,
- const wr::WrSize aTileSize,
- const wr::WrSize aTileSpacing)
+ const wr::LayoutSize aTileSize,
+ const wr::LayoutSize aTileSpacing)
{
wr_dp_push_linear_gradient(mWrState,
aBounds, aClip,
aStartPoint, aEndPoint,
aStops.Elements(), aStops.Length(),
aExtendMode,
aTileSize, aTileSpacing);
}
void
-DisplayListBuilder::PushRadialGradient(const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
- const wr::WrPoint& aCenter,
- const wr::WrSize& aRadius,
+DisplayListBuilder::PushRadialGradient(const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
+ const wr::LayoutPoint& aCenter,
+ const wr::LayoutSize& aRadius,
const nsTArray<wr::WrGradientStop>& aStops,
wr::GradientExtendMode aExtendMode,
- const wr::WrSize aTileSize,
- const wr::WrSize aTileSpacing)
+ const wr::LayoutSize aTileSize,
+ const wr::LayoutSize aTileSpacing)
{
wr_dp_push_radial_gradient(mWrState,
aBounds, aClip,
aCenter, aRadius,
aStops.Elements(), aStops.Length(),
aExtendMode,
aTileSize, aTileSpacing);
}
void
-DisplayListBuilder::PushImage(const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
+DisplayListBuilder::PushImage(const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
wr::ImageRendering aFilter,
wr::ImageKey aImage)
{
- wr::WrSize size;
- size.width = aBounds.width;
- size.height = aBounds.height;
+ wr::LayoutSize size;
+ size.width = aBounds.size.width;
+ size.height = aBounds.size.height;
PushImage(aBounds, aClip, size, size, aFilter, aImage);
}
void
-DisplayListBuilder::PushImage(const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
- const wr::WrSize& aStretchSize,
- const wr::WrSize& aTileSpacing,
+DisplayListBuilder::PushImage(const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
+ const wr::LayoutSize& aStretchSize,
+ const wr::LayoutSize& aTileSpacing,
wr::ImageRendering aFilter,
wr::ImageKey aImage)
{
WRDL_LOG("PushImage b=%s cl=%s s=%s t=%s\n", Stringify(aBounds).c_str(),
Stringify(aClip).c_str(), Stringify(aStretchSize).c_str(),
Stringify(aTileSpacing).c_str());
wr_dp_push_image(mWrState, aBounds, aClip, aStretchSize, aTileSpacing, aFilter, aImage);
}
void
-DisplayListBuilder::PushYCbCrPlanarImage(const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
+DisplayListBuilder::PushYCbCrPlanarImage(const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
wr::ImageKey aImageChannel0,
wr::ImageKey aImageChannel1,
wr::ImageKey aImageChannel2,
wr::WrYuvColorSpace aColorSpace,
wr::ImageRendering aRendering)
{
wr_dp_push_yuv_planar_image(mWrState,
aBounds,
@@ -739,137 +739,137 @@ DisplayListBuilder::PushYCbCrPlanarImage
aImageChannel0,
aImageChannel1,
aImageChannel2,
aColorSpace,
aRendering);
}
void
-DisplayListBuilder::PushNV12Image(const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
+DisplayListBuilder::PushNV12Image(const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
wr::ImageKey aImageChannel0,
wr::ImageKey aImageChannel1,
wr::WrYuvColorSpace aColorSpace,
wr::ImageRendering aRendering)
{
wr_dp_push_yuv_NV12_image(mWrState,
aBounds,
aClip,
aImageChannel0,
aImageChannel1,
aColorSpace,
aRendering);
}
void
-DisplayListBuilder::PushYCbCrInterleavedImage(const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
+DisplayListBuilder::PushYCbCrInterleavedImage(const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
wr::ImageKey aImageChannel0,
wr::WrYuvColorSpace aColorSpace,
wr::ImageRendering aRendering)
{
wr_dp_push_yuv_interleaved_image(mWrState,
aBounds,
aClip,
aImageChannel0,
aColorSpace,
aRendering);
}
void
-DisplayListBuilder::PushIFrame(const wr::WrRect& aBounds,
+DisplayListBuilder::PushIFrame(const wr::LayoutRect& aBounds,
PipelineId aPipeline)
{
wr_dp_push_iframe(mWrState, aBounds, aPipeline);
}
void
-DisplayListBuilder::PushBorder(const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
+DisplayListBuilder::PushBorder(const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
const wr::WrBorderWidths& aWidths,
const Range<const wr::WrBorderSide>& aSides,
const wr::WrBorderRadius& aRadius)
{
MOZ_ASSERT(aSides.length() == 4);
if (aSides.length() != 4) {
return;
}
wr_dp_push_border(mWrState, aBounds, aClip,
aWidths, aSides[0], aSides[1], aSides[2], aSides[3], aRadius);
}
void
-DisplayListBuilder::PushBorderImage(const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
+DisplayListBuilder::PushBorderImage(const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
const wr::WrBorderWidths& aWidths,
wr::ImageKey aImage,
const wr::WrNinePatchDescriptor& aPatch,
- const wr::WrSideOffsets2Df32& aOutset,
+ const wr::SideOffsets2D_f32& aOutset,
const wr::WrRepeatMode& aRepeatHorizontal,
const wr::WrRepeatMode& aRepeatVertical)
{
wr_dp_push_border_image(mWrState, aBounds, aClip,
aWidths, aImage, aPatch, aOutset,
aRepeatHorizontal, aRepeatVertical);
}
void
-DisplayListBuilder::PushBorderGradient(const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
+DisplayListBuilder::PushBorderGradient(const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
const wr::WrBorderWidths& aWidths,
- const wr::WrPoint& aStartPoint,
- const wr::WrPoint& aEndPoint,
+ const wr::LayoutPoint& aStartPoint,
+ const wr::LayoutPoint& aEndPoint,
const nsTArray<wr::WrGradientStop>& aStops,
wr::GradientExtendMode aExtendMode,
- const wr::WrSideOffsets2Df32& aOutset)
+ const wr::SideOffsets2D_f32& aOutset)
{
wr_dp_push_border_gradient(mWrState, aBounds, aClip,
aWidths, aStartPoint, aEndPoint,
aStops.Elements(), aStops.Length(),
aExtendMode, aOutset);
}
void
-DisplayListBuilder::PushBorderRadialGradient(const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
+DisplayListBuilder::PushBorderRadialGradient(const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
const wr::WrBorderWidths& aWidths,
- const wr::WrPoint& aCenter,
- const wr::WrSize& aRadius,
+ const wr::LayoutPoint& aCenter,
+ const wr::LayoutSize& aRadius,
const nsTArray<wr::WrGradientStop>& aStops,
wr::GradientExtendMode aExtendMode,
- const wr::WrSideOffsets2Df32& aOutset)
+ const wr::SideOffsets2D_f32& aOutset)
{
wr_dp_push_border_radial_gradient(
mWrState, aBounds, aClip, aWidths, aCenter,
aRadius, aStops.Elements(), aStops.Length(),
aExtendMode, aOutset);
}
void
-DisplayListBuilder::PushText(const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
+DisplayListBuilder::PushText(const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
const gfx::Color& aColor,
wr::FontKey aFontKey,
Range<const wr::WrGlyphInstance> aGlyphBuffer,
float aGlyphSize)
{
wr_dp_push_text(mWrState, aBounds, aClip,
- ToWrColor(aColor),
+ ToColorF(aColor),
aFontKey,
&aGlyphBuffer[0], aGlyphBuffer.length(),
aGlyphSize);
}
void
-DisplayListBuilder::PushBoxShadow(const wr::WrRect& aRect,
- const wr::WrRect& aClip,
- const wr::WrRect& aBoxBounds,
- const wr::WrPoint& aOffset,
- const wr::WrColor& aColor,
+DisplayListBuilder::PushBoxShadow(const wr::LayoutRect& aRect,
+ const wr::LayoutRect& aClip,
+ const wr::LayoutRect& aBoxBounds,
+ const wr::LayoutVector2D& aOffset,
+ const wr::ColorF& aColor,
const float& aBlurRadius,
const float& aSpreadRadius,
const float& aBorderRadius,
const wr::WrBoxShadowClipMode& aClipMode)
{
wr_dp_push_box_shadow(mWrState, aRect, aClip,
aBoxBounds, aOffset, aColor,
aBlurRadius, aSpreadRadius, aBorderRadius,
--- a/gfx/webrender_bindings/WebRenderAPI.h
+++ b/gfx/webrender_bindings/WebRenderAPI.h
@@ -45,28 +45,28 @@ public:
layers::CompositorBridgeParentBase* aBridge,
RefPtr<widget::CompositorWidget>&& aWidget,
LayoutDeviceIntSize aSize);
wr::WindowId GetId() const { return mId; }
void UpdateScrollPosition(const wr::WrPipelineId& aPipelineId,
const layers::FrameMetrics::ViewID& aScrollId,
- const wr::WrPoint& aScrollPosition);
+ const wr::LayoutPoint& aScrollPosition);
void GenerateFrame();
void GenerateFrame(const nsTArray<wr::WrOpacityProperty>& aOpacityArray,
const nsTArray<wr::WrTransformProperty>& aTransformArray);
void SetWindowParameters(LayoutDeviceIntSize size);
void SetRootDisplayList(gfx::Color aBgColor,
Epoch aEpoch,
LayerSize aViewportSize,
wr::WrPipelineId pipeline_id,
- const wr::WrSize& content_size,
+ const wr::LayoutSize& content_size,
wr::WrBuiltDisplayListDescriptor dl_descriptor,
uint8_t *dl_data,
size_t dl_size);
void ClearRootDisplayList(Epoch aEpoch,
wr::WrPipelineId pipeline_id);
void SetRootPipeline(wr::PipelineId aPipeline);
@@ -133,156 +133,156 @@ protected:
};
/// This is a simple C++ wrapper around WrState defined in the rust bindings.
/// We may want to turn this into a direct wrapper on top of WebRenderFrameBuilder
/// instead, so the interface may change a bit.
class DisplayListBuilder {
public:
explicit DisplayListBuilder(wr::PipelineId aId,
- const wr::WrSize& aContentSize);
+ const wr::LayoutSize& aContentSize);
DisplayListBuilder(DisplayListBuilder&&) = default;
~DisplayListBuilder();
void Begin(const LayerIntSize& aSize);
void End();
- void Finalize(wr::WrSize& aOutContentSize,
+ void Finalize(wr::LayoutSize& aOutContentSize,
wr::BuiltDisplayList& aOutDisplayList);
- void PushStackingContext(const wr::WrRect& aBounds, // TODO: We should work with strongly typed rects
+ void PushStackingContext(const wr::LayoutRect& aBounds, // TODO: We should work with strongly typed rects
const uint64_t& aAnimationId,
const float* aOpacity,
const gfx::Matrix4x4* aTransform,
wr::WrTransformStyle aTransformStyle,
const wr::WrMixBlendMode& aMixBlendMode,
const nsTArray<wr::WrFilterOp>& aFilters);
void PopStackingContext();
- void PushClip(const wr::WrRect& aClipRect,
+ void PushClip(const wr::LayoutRect& aClipRect,
const wr::WrImageMask* aMask);
void PopClip();
void PushBuiltDisplayList(wr::BuiltDisplayList &dl);
void PushScrollLayer(const layers::FrameMetrics::ViewID& aScrollId,
- const wr::WrRect& aContentRect, // TODO: We should work with strongly typed rects
- const wr::WrRect& aClipRect);
+ const wr::LayoutRect& aContentRect, // TODO: We should work with strongly typed rects
+ const wr::LayoutRect& aClipRect);
void PopScrollLayer();
void PushClipAndScrollInfo(const layers::FrameMetrics::ViewID& aScrollId,
const wr::WrClipId* aClipId);
void PopClipAndScrollInfo();
- void PushRect(const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
- const wr::WrColor& aColor);
+ void PushRect(const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
+ const wr::ColorF& aColor);
- void PushLinearGradient(const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
- const wr::WrPoint& aStartPoint,
- const wr::WrPoint& aEndPoint,
+ void PushLinearGradient(const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
+ const wr::LayoutPoint& aStartPoint,
+ const wr::LayoutPoint& aEndPoint,
const nsTArray<wr::WrGradientStop>& aStops,
wr::GradientExtendMode aExtendMode,
- const wr::WrSize aTileSize,
- const wr::WrSize aTileSpacing);
+ const wr::LayoutSize aTileSize,
+ const wr::LayoutSize aTileSpacing);
- void PushRadialGradient(const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
- const wr::WrPoint& aCenter,
- const wr::WrSize& aRadius,
+ void PushRadialGradient(const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
+ const wr::LayoutPoint& aCenter,
+ const wr::LayoutSize& aRadius,
const nsTArray<wr::WrGradientStop>& aStops,
wr::GradientExtendMode aExtendMode,
- const wr::WrSize aTileSize,
- const wr::WrSize aTileSpacing);
+ const wr::LayoutSize aTileSize,
+ const wr::LayoutSize aTileSpacing);
- void PushImage(const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
+ void PushImage(const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
wr::ImageRendering aFilter,
wr::ImageKey aImage);
- void PushImage(const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
- const wr::WrSize& aStretchSize,
- const wr::WrSize& aTileSpacing,
+ void PushImage(const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
+ const wr::LayoutSize& aStretchSize,
+ const wr::LayoutSize& aTileSpacing,
wr::ImageRendering aFilter,
wr::ImageKey aImage);
- void PushYCbCrPlanarImage(const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
+ void PushYCbCrPlanarImage(const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
wr::ImageKey aImageChannel0,
wr::ImageKey aImageChannel1,
wr::ImageKey aImageChannel2,
wr::WrYuvColorSpace aColorSpace,
wr::ImageRendering aFilter);
- void PushNV12Image(const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
+ void PushNV12Image(const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
wr::ImageKey aImageChannel0,
wr::ImageKey aImageChannel1,
wr::WrYuvColorSpace aColorSpace,
wr::ImageRendering aFilter);
- void PushYCbCrInterleavedImage(const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
+ void PushYCbCrInterleavedImage(const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
wr::ImageKey aImageChannel0,
wr::WrYuvColorSpace aColorSpace,
wr::ImageRendering aFilter);
- void PushIFrame(const wr::WrRect& aBounds,
+ void PushIFrame(const wr::LayoutRect& aBounds,
wr::PipelineId aPipeline);
// XXX WrBorderSides are passed with Range.
// It is just to bypass compiler bug. See Bug 1357734.
- void PushBorder(const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
+ void PushBorder(const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
const wr::WrBorderWidths& aWidths,
const Range<const wr::WrBorderSide>& aSides,
const wr::WrBorderRadius& aRadius);
- void PushBorderImage(const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
+ void PushBorderImage(const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
const wr::WrBorderWidths& aWidths,
wr::ImageKey aImage,
const wr::WrNinePatchDescriptor& aPatch,
- const wr::WrSideOffsets2Df32& aOutset,
+ const wr::SideOffsets2D_f32& aOutset,
const wr::WrRepeatMode& aRepeatHorizontal,
const wr::WrRepeatMode& aRepeatVertical);
- void PushBorderGradient(const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
+ void PushBorderGradient(const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
const wr::WrBorderWidths& aWidths,
- const wr::WrPoint& aStartPoint,
- const wr::WrPoint& aEndPoint,
+ const wr::LayoutPoint& aStartPoint,
+ const wr::LayoutPoint& aEndPoint,
const nsTArray<wr::WrGradientStop>& aStops,
wr::GradientExtendMode aExtendMode,
- const wr::WrSideOffsets2Df32& aOutset);
+ const wr::SideOffsets2D_f32& aOutset);
- void PushBorderRadialGradient(const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
+ void PushBorderRadialGradient(const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
const wr::WrBorderWidths& aWidths,
- const wr::WrPoint& aCenter,
- const wr::WrSize& aRadius,
+ const wr::LayoutPoint& aCenter,
+ const wr::LayoutSize& aRadius,
const nsTArray<wr::WrGradientStop>& aStops,
wr::GradientExtendMode aExtendMode,
- const wr::WrSideOffsets2Df32& aOutset);
+ const wr::SideOffsets2D_f32& aOutset);
- void PushText(const wr::WrRect& aBounds,
- const wr::WrRect& aClip,
+ void PushText(const wr::LayoutRect& aBounds,
+ const wr::LayoutRect& aClip,
const gfx::Color& aColor,
wr::FontKey aFontKey,
Range<const wr::WrGlyphInstance> aGlyphBuffer,
float aGlyphSize);
- void PushBoxShadow(const wr::WrRect& aRect,
- const wr::WrRect& aClip,
- const wr::WrRect& aBoxBounds,
- const wr::WrPoint& aOffset,
- const wr::WrColor& aColor,
+ void PushBoxShadow(const wr::LayoutRect& aRect,
+ const wr::LayoutRect& aClip,
+ const wr::LayoutRect& aBoxBounds,
+ const wr::LayoutVector2D& aOffset,
+ const wr::ColorF& aColor,
const float& aBlurRadius,
const float& aSpreadRadius,
const float& aBorderRadius,
const wr::WrBoxShadowClipMode& aClipMode);
// Returns the clip id that was most recently pushed with PushClip and that
// has not yet been popped with PopClip. Return Nothing() if the clip stack
// is empty.
--- a/gfx/webrender_bindings/WebRenderTypes.h
+++ b/gfx/webrender_bindings/WebRenderTypes.h
@@ -188,109 +188,145 @@ static inline MixBlendMode ToWrMixBlendM
return MixBlendMode::Color;
case gfx::CompositionOp::OP_LUMINOSITY:
return MixBlendMode::Luminosity;
default:
return MixBlendMode::Normal;
}
}
-static inline wr::WrColor ToWrColor(const gfx::Color& color)
+static inline wr::ColorF ToColorF(const gfx::Color& color)
{
- wr::WrColor c;
+ 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::WrPoint ToWrPoint(const gfx::PointTyped<T>& point)
+static inline wr::LayoutPoint ToLayoutPoint(const gfx::PointTyped<T>& point)
{
- wr::WrPoint p;
+ wr::LayoutPoint p;
p.x = point.x;
p.y = point.y;
return p;
}
template<class T>
-static inline wr::WrPoint ToWrPoint(const gfx::IntPointTyped<T>& point)
+static inline wr::LayoutPoint ToLayoutPoint(const gfx::IntPointTyped<T>& point)
{
- return ToWrPoint(IntPointToPoint(point));
+ return ToLayoutPoint(IntPointToPoint(point));
}
-static inline wr::WrPoint ToWrPoint(const gfx::Point& point)
+static inline wr::LayoutPoint ToLayoutPoint(const gfx::Point& point)
{
- wr::WrPoint p;
+ wr::LayoutPoint p;
+ p.x = point.x;
+ p.y = point.y;
+ return p;
+}
+
+template<class T>
+static inline wr::LayoutVector2D ToLayoutVector2D(const gfx::PointTyped<T>& point)
+{
+ wr::LayoutVector2D p;
p.x = point.x;
p.y = point.y;
return p;
}
template<class T>
-static inline wr::WrRect ToWrRect(const gfx::RectTyped<T>& rect)
+static inline wr::LayoutVector2D ToLayoutVector2D(const gfx::IntPointTyped<T>& point)
+{
+ return ToLayoutVector2D(IntPointToPoint(point));
+}
+
+static inline wr::LayoutVector2D ToLayoutVector2D(const gfx::Point& point)
{
- wr::WrRect r;
- r.x = rect.x;
- r.y = rect.y;
- r.width = rect.width;
- r.height = rect.height;
+ wr::LayoutVector2D p;
+ p.x = point.x;
+ p.y = point.y;
+ return p;
+}
+
+template<class T>
+static inline wr::LayoutRect ToLayoutRect(const gfx::RectTyped<T>& 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;
}
-static inline wr::WrRect ToWrRect(const gfxRect rect)
+static inline wr::LayoutRect ToLayoutRect(const gfxRect rect)
{
- wr::WrRect r;
- r.x = rect.x;
- r.y = rect.y;
- r.width = rect.width;
- r.height = rect.height;
+ 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::WrRect ToWrRect(const gfx::IntRectTyped<T>& rect)
+static inline wr::LayoutRect ToLayoutRect(const gfx::IntRectTyped<T>& rect)
{
- return ToWrRect(IntRectToRect(rect));
+ return ToLayoutRect(IntRectToRect(rect));
}
template<class T>
-static inline wr::WrSize ToWrSize(const gfx::SizeTyped<T>& size)
+static inline wr::LayoutSize ToLayoutSize(const gfx::SizeTyped<T>& size)
{
- wr::WrSize ls;
+ wr::LayoutSize ls;
ls.width = size.width;
ls.height = size.height;
return ls;
}
static inline wr::WrComplexClipRegion ToWrComplexClipRegion(const RoundedRect& rect)
{
wr::WrComplexClipRegion ret;
- ret.rect = ToWrRect(rect.rect);
- ret.radii.top_left = ToWrSize(rect.corners.radii[mozilla::eCornerTopLeft]);
- ret.radii.top_right = ToWrSize(rect.corners.radii[mozilla::eCornerTopRight]);
- ret.radii.bottom_left = ToWrSize(rect.corners.radii[mozilla::eCornerBottomLeft]);
- ret.radii.bottom_right = ToWrSize(rect.corners.radii[mozilla::eCornerBottomRight]);
+ 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]);
return ret;
}
template<class T>
-static inline wr::WrSize ToWrSize(const gfx::IntSizeTyped<T>& size)
+static inline wr::LayoutSize ToLayoutSize(const gfx::IntSizeTyped<T>& size)
{
- return ToWrSize(IntSizeToSize(size));
+ return ToLayoutSize(IntSizeToSize(size));
}
template<class S, class T>
-static inline wr::WrMatrix ToWrMatrix(const gfx::Matrix4x4Typed<S, T>& m)
+static inline wr::LayoutTransform ToLayoutTransform(const gfx::Matrix4x4Typed<S, T>& m)
{
- wr::WrMatrix transform;
- static_assert(sizeof(m.components) == sizeof(transform.values),
- "Matrix components size mismatch!");
- memcpy(transform.values, m.components, sizeof(transform.values));
+ wr::LayoutTransform transform;
+ transform.m11 = m._11;
+ transform.m12 = m._12;
+ transform.m13 = m._13;
+ transform.m14 = m._14;
+ transform.m21 = m._21;
+ transform.m22 = m._22;
+ transform.m23 = m._23;
+ transform.m24 = m._24;
+ transform.m31 = m._31;
+ transform.m32 = m._32;
+ transform.m33 = m._33;
+ transform.m34 = m._34;
+ transform.m41 = m._41;
+ transform.m42 = m._42;
+ transform.m43 = m._43;
+ transform.m44 = m._44;
return transform;
}
static inline wr::WrBorderStyle ToWrBorderStyle(const uint8_t& style)
{
switch (style) {
case NS_STYLE_BORDER_STYLE_NONE:
return wr::WrBorderStyle::None;
@@ -316,75 +352,75 @@ static inline wr::WrBorderStyle ToWrBord
MOZ_ASSERT(false);
}
return wr::WrBorderStyle::None;
}
static inline wr::WrBorderSide ToWrBorderSide(const gfx::Color& color, const uint8_t& style)
{
wr::WrBorderSide bs;
- bs.color = ToWrColor(color);
+ bs.color = ToColorF(color);
bs.style = ToWrBorderStyle(style);
return bs;
}
static inline wr::WrBorderRadius ToWrUniformBorderRadius(const LayerSize& aSize)
{
wr::WrBorderRadius br;
- br.top_left = ToWrSize(aSize);
- br.top_right = ToWrSize(aSize);
- br.bottom_left = ToWrSize(aSize);
- br.bottom_right = ToWrSize(aSize);
+ 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::WrBorderRadius ToWrBorderRadius(const LayerSize& topLeft, const LayerSize& topRight,
const LayerSize& bottomLeft, const LayerSize& bottomRight)
{
wr::WrBorderRadius br;
- br.top_left = ToWrSize(topLeft);
- br.top_right = ToWrSize(topRight);
- br.bottom_left = ToWrSize(bottomLeft);
- br.bottom_right = ToWrSize(bottomRight);
+ br.top_left = ToLayoutSize(topLeft);
+ br.top_right = ToLayoutSize(topRight);
+ br.bottom_left = ToLayoutSize(bottomLeft);
+ br.bottom_right = ToLayoutSize(bottomRight);
return br;
}
static inline wr::WrBorderWidths ToWrBorderWidths(float top, float right, float bottom, float left)
{
wr::WrBorderWidths bw;
bw.top = top;
bw.right = right;
bw.bottom = bottom;
bw.left = left;
return bw;
}
static inline wr::WrNinePatchDescriptor ToWrNinePatchDescriptor(uint32_t width, uint32_t height,
- const wr::WrSideOffsets2Du32& slice)
+ const wr::SideOffsets2D_u32& slice)
{
WrNinePatchDescriptor patch;
patch.width = width;
patch.height = height;
patch.slice = slice;
return patch;
}
-static inline wr::WrSideOffsets2Du32 ToWrSideOffsets2Du32(uint32_t top, uint32_t right, uint32_t bottom, uint32_t left)
+static inline wr::SideOffsets2D_u32 ToSideOffsets2D_u32(uint32_t top, uint32_t right, uint32_t bottom, uint32_t left)
{
- WrSideOffsets2Du32 offset;
+ SideOffsets2D_u32 offset;
offset.top = top;
offset.right = right;
offset.bottom = bottom;
offset.left = left;
return offset;
}
-static inline wr::WrSideOffsets2Df32 ToWrSideOffsets2Df32(float top, float right, float bottom, float left)
+static inline wr::SideOffsets2D_f32 ToSideOffsets2D_f32(float top, float right, float bottom, float left)
{
- WrSideOffsets2Df32 offset;
+ SideOffsets2D_f32 offset;
offset.top = top;
offset.right = right;
offset.bottom = bottom;
offset.left = left;
return offset;
}
static inline wr::WrRepeatMode ToWrRepeatMode(uint8_t repeatMode)
@@ -406,42 +442,42 @@ static inline wr::WrRepeatMode ToWrRepea
}
template<class S, class T>
static inline wr::WrTransformProperty ToWrTransformProperty(uint64_t id,
const gfx::Matrix4x4Typed<S, T>& transform)
{
wr::WrTransformProperty prop;
prop.id = id;
- prop.transform = ToWrMatrix(transform);
+ prop.transform = ToLayoutTransform(transform);
return prop;
}
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::WrComplexClipRegion ToWrComplexClipRegion(const wr::WrRect& rect,
+static inline wr::WrComplexClipRegion ToWrComplexClipRegion(const wr::LayoutRect& rect,
const LayerSize& size)
{
wr::WrComplexClipRegion complex_clip;
complex_clip.rect = rect;
complex_clip.radii = wr::ToWrUniformBorderRadius(size);
return complex_clip;
}
template<class T>
static inline wr::WrComplexClipRegion ToWrComplexClipRegion(const gfx::RectTyped<T>& rect,
const LayerSize& size)
{
- return ToWrComplexClipRegion(wr::ToWrRect(rect), size);
+ return ToWrComplexClipRegion(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)
--- a/gfx/webrender_bindings/cbindgen.toml
+++ b/gfx/webrender_bindings/cbindgen.toml
@@ -12,20 +12,22 @@ braces = "SameLine"
line_length = 100
tab_width = 2
language = "C++"
namespaces = ["mozilla", "wr"]
[parse]
parse_deps = true
include = ["webrender", "webrender_api"]
+expand = ["euclid"]
[fn]
prefix = "WR_INLINE"
postfix = "WR_FUNC"
args = "Vertical"
rename_args = "GeckoCase"
[struct]
derive_eq = true
+generic_template_specialization = false
[enum]
add_sentinel = true
--- a/gfx/webrender_bindings/src/bindings.rs
+++ b/gfx/webrender_bindings/src/bindings.rs
@@ -8,33 +8,30 @@ use gleam::gl;
use webrender_api::*;
use webrender::renderer::{ReadPixelsFormat, Renderer, RendererOptions};
use webrender::renderer::{ExternalImage, ExternalImageHandler, ExternalImageSource};
use webrender::{ApiRecordingReceiver, BinaryRecorder};
use thread_profiler::register_thread_with_profiler;
use moz2d_renderer::Moz2dImageRenderer;
use app_units::Au;
-use euclid::{TypedPoint2D, TypedSize2D, TypedRect, TypedTransform3D, SideOffsets2D};
-use euclid::TypedVector2D;
use rayon;
+use euclid::SideOffsets2D;
extern crate webrender_api;
type WrAPI = RenderApi;
type WrBorderStyle = BorderStyle;
type WrBoxShadowClipMode = BoxShadowClipMode;
type WrBuiltDisplayListDescriptor = BuiltDisplayListDescriptor;
type WrImageFormat = ImageFormat;
type WrImageRendering = ImageRendering;
type WrMixBlendMode = MixBlendMode;
type WrTransformStyle = TransformStyle;
type WrRenderer = Renderer;
-type WrSideOffsets2Du32 = WrSideOffsets2D<u32>;
-type WrSideOffsets2Df32 = WrSideOffsets2D<f32>;
/// cbindgen:field-names=[mNamespace, mHandle]
type WrExternalImageBufferType = ExternalImageType;
/// cbindgen:field-names=[mHandle]
/// cbindgen:derive-lt=true
/// cbindgen:derive-lte=true
type WrEpoch = Epoch;
@@ -156,199 +153,69 @@ impl Into<ExtendMode> for WrGradientExte
WrGradientExtendMode::Clamp => ExtendMode::Clamp,
WrGradientExtendMode::Repeat => ExtendMode::Repeat,
}
}
}
#[repr(C)]
#[derive(Debug, Clone, Copy)]
-pub struct WrPoint {
- x: f32,
- y: f32,
-}
-
-impl<U> Into<TypedPoint2D<f32, U>> for WrPoint {
- fn into(self) -> TypedPoint2D<f32, U> {
- TypedPoint2D::new(self.x, self.y)
- }
-}
-
-impl<U> Into<TypedVector2D<f32, U>> for WrPoint {
- fn into(self) -> TypedVector2D<f32, U> {
- TypedVector2D::new(self.x, self.y)
- }
-}
-
-#[repr(C)]
-#[derive(Debug, Clone, Copy)]
-pub struct WrSize {
- width: f32,
- height: f32,
-}
-
-impl WrSize {
- fn new(width: f32, height: f32) -> WrSize {
- WrSize { width: width, height: height }
- }
-
- fn zero() -> WrSize {
- WrSize { width: 0.0, height: 0.0 }
- }
-}
-
-impl<U> Into<TypedSize2D<f32, U>> for WrSize {
- fn into(self) -> TypedSize2D<f32, U> {
- TypedSize2D::new(self.width, self.height)
- }
-}
-
-#[repr(C)]
-#[derive(Debug, Clone, Copy)]
-pub struct WrRect {
- x: f32,
- y: f32,
- width: f32,
- height: f32,
-}
-
-impl<U> Into<TypedRect<f32, U>> for WrRect {
- fn into(self) -> TypedRect<f32, U> {
- TypedRect::new(TypedPoint2D::new(self.x, self.y),
- TypedSize2D::new(self.width, self.height))
- }
-}
-impl<U> From<TypedRect<f32, U>> for WrRect {
- fn from(rect: TypedRect<f32, U>) -> Self {
- WrRect {
- x: rect.origin.x,
- y: rect.origin.y,
- width: rect.size.width,
- height: rect.size.height,
- }
- }
-}
-
-#[repr(C)]
-#[derive(Debug, Clone, Copy)]
-pub struct WrMatrix {
- values: [f32; 16],
-}
-
-impl<'a, U, E> Into<TypedTransform3D<f32, U, E>> for &'a WrMatrix {
- fn into(self) -> TypedTransform3D<f32, U, E> {
- TypedTransform3D::row_major(self.values[0],
- self.values[1],
- self.values[2],
- self.values[3],
- self.values[4],
- self.values[5],
- self.values[6],
- self.values[7],
- self.values[8],
- self.values[9],
- self.values[10],
- self.values[11],
- self.values[12],
- self.values[13],
- self.values[14],
- self.values[15])
- }
-}
-impl<U, E> Into<TypedTransform3D<f32, U, E>> for WrMatrix {
- fn into(self) -> TypedTransform3D<f32, U, E> {
- TypedTransform3D::row_major(self.values[0],
- self.values[1],
- self.values[2],
- self.values[3],
- self.values[4],
- self.values[5],
- self.values[6],
- self.values[7],
- self.values[8],
- self.values[9],
- self.values[10],
- self.values[11],
- self.values[12],
- self.values[13],
- self.values[14],
- self.values[15])
- }
-}
-
-#[repr(C)]
-#[derive(Debug, Clone, Copy)]
-pub struct WrColor {
- r: f32,
- g: f32,
- b: f32,
- a: f32,
-}
-
-impl Into<ColorF> for WrColor {
- fn into(self) -> ColorF {
- ColorF::new(self.r, self.g, self.b, self.a)
- }
-}
-
-#[repr(C)]
-#[derive(Debug, Clone, Copy)]
pub struct WrGlyphInstance {
index: u32,
- point: WrPoint,
+ point: LayoutPoint,
}
impl<'a> Into<GlyphInstance> for &'a WrGlyphInstance {
fn into(self) -> GlyphInstance {
GlyphInstance {
index: self.index,
point: self.point.into(),
}
}
}
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct WrGradientStop {
offset: f32,
- color: WrColor,
+ color: ColorF,
}
impl<'a> Into<GradientStop> for &'a WrGradientStop {
fn into(self) -> GradientStop {
GradientStop {
offset: self.offset,
color: self.color.into(),
}
}
}
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct WrBorderSide {
- color: WrColor,
+ color: ColorF,
style: WrBorderStyle,
}
impl Into<BorderSide> for WrBorderSide {
fn into(self) -> BorderSide {
BorderSide {
color: self.color.into(),
style: self.style,
}
}
}
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct WrBorderRadius {
- pub top_left: WrSize,
- pub top_right: WrSize,
- pub bottom_left: WrSize,
- pub bottom_right: WrSize,
+ pub top_left: LayoutSize,
+ pub top_right: LayoutSize,
+ pub bottom_left: LayoutSize,
+ pub bottom_right: LayoutSize,
}
impl Into<BorderRadius> for WrBorderRadius {
fn into(self) -> BorderRadius {
BorderRadius {
top_left: self.top_left.into(),
top_right: self.top_right.into(),
bottom_left: self.bottom_left.into(),
@@ -377,44 +244,29 @@ impl Into<BorderWidths> for WrBorderWidt
}
}
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct WrNinePatchDescriptor {
width: u32,
height: u32,
- slice: WrSideOffsets2Du32,
+ slice: SideOffsets2D<u32>,
}
impl Into<NinePatchDescriptor> for WrNinePatchDescriptor {
fn into(self) -> NinePatchDescriptor {
NinePatchDescriptor {
width: self.width,
height: self.height,
slice: self.slice.into(),
}
}
}
-#[repr(C)]
-#[derive(Debug, Clone, Copy)]
-pub struct WrSideOffsets2D<T> {
- top: T,
- right: T,
- bottom: T,
- left: T,
-}
-
-impl<T: Copy> Into<SideOffsets2D<T>> for WrSideOffsets2D<T> {
- fn into(self) -> SideOffsets2D<T> {
- SideOffsets2D::new(self.top, self.right, self.bottom, self.left)
- }
-}
-
#[repr(u32)]
pub enum WrRepeatMode {
Stretch,
Repeat,
Round,
Space,
}
@@ -428,17 +280,17 @@ impl Into<RepeatMode> for WrRepeatMode {
}
}
}
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct WrImageMask {
image: WrImageKey,
- rect: WrRect,
+ rect: LayoutRect,
repeat: bool,
}
impl Into<ImageMask> for WrImageMask {
fn into(self) -> ImageMask {
ImageMask {
image: self.image,
rect: self.rect.into(),
@@ -463,17 +315,17 @@ impl From<ImageMask> for WrImageMask {
repeat: image_mask.repeat,
}
}
}
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct WrComplexClipRegion {
- rect: WrRect,
+ rect: LayoutRect,
radii: WrBorderRadius,
}
impl<'a> Into<ComplexClipRegion> for &'a WrComplexClipRegion {
fn into(self) -> ComplexClipRegion {
ComplexClipRegion {
rect: self.rect.into(),
radii: self.radii.into(),
@@ -612,17 +464,17 @@ pub extern "C" fn wr_vec_u8_free(v: WrVe
v.to_vec();
}
/// cbindgen:derive-eq=false
#[repr(C)]
#[derive(Debug)]
pub struct WrTransformProperty {
pub id: u64,
- pub transform: WrMatrix,
+ pub transform: LayoutTransform,
}
#[repr(C)]
#[derive(Copy, Clone, Debug)]
pub struct WrOpacityProperty {
pub id: u64,
pub opacity: f32,
}
@@ -987,22 +839,22 @@ pub extern "C" fn wr_api_set_window_para
width: i32,
height: i32) {
let size = DeviceUintSize::new(width as u32, height as u32);
api.set_window_parameters(size, DeviceUintRect::new(DeviceUintPoint::new(0, 0), size));
}
#[no_mangle]
pub unsafe extern "C" fn wr_api_set_root_display_list(api: &mut WrAPI,
- color: WrColor,
+ color: ColorF,
epoch: WrEpoch,
viewport_width: f32,
viewport_height: f32,
pipeline_id: WrPipelineId,
- content_size: WrSize,
+ content_size: LayoutSize,
dl_descriptor: WrBuiltDisplayListDescriptor,
dl_data: *mut u8,
dl_size: usize) {
let color = if color.a == 0.0 {
None
} else {
Some(color.into())
};
@@ -1024,17 +876,17 @@ pub unsafe extern "C" fn wr_api_set_root
preserve_frame_state);
}
#[no_mangle]
pub unsafe extern "C" fn wr_api_clear_root_display_list(api: &mut WrAPI,
epoch: WrEpoch,
pipeline_id: WrPipelineId) {
let preserve_frame_state = true;
- let frame_builder = WebRenderFrameBuilder::new(pipeline_id, WrSize::zero());
+ let frame_builder = WebRenderFrameBuilder::new(pipeline_id, LayoutSize::zero());
api.set_display_list(None,
epoch,
LayoutSize::new(0.0, 0.0),
frame_builder.dl_builder.finalize(),
preserve_frame_state);
}
@@ -1132,33 +984,33 @@ pub unsafe extern "C" fn wr_api_get_name
pub struct WebRenderFrameBuilder {
pub root_pipeline_id: WrPipelineId,
pub dl_builder: webrender_api::DisplayListBuilder,
pub scroll_clips_defined: HashSet<ClipId>,
}
impl WebRenderFrameBuilder {
pub fn new(root_pipeline_id: WrPipelineId,
- content_size: WrSize) -> WebRenderFrameBuilder {
+ content_size: LayoutSize) -> WebRenderFrameBuilder {
WebRenderFrameBuilder {
root_pipeline_id: root_pipeline_id,
dl_builder: webrender_api::DisplayListBuilder::new(root_pipeline_id, content_size.into()),
scroll_clips_defined: HashSet::new(),
}
}
}
pub struct WrState {
pipeline_id: WrPipelineId,
frame_builder: WebRenderFrameBuilder,
}
#[no_mangle]
pub extern "C" fn wr_state_new(pipeline_id: WrPipelineId,
- content_size: WrSize) -> *mut WrState {
+ content_size: LayoutSize) -> *mut WrState {
assert!(unsafe { !is_in_render_thread() });
let state = Box::new(WrState {
pipeline_id: pipeline_id,
frame_builder: WebRenderFrameBuilder::new(pipeline_id,
content_size),
});
@@ -1199,20 +1051,20 @@ pub extern "C" fn wr_dp_begin(state: &mu
#[no_mangle]
pub extern "C" fn wr_dp_end(state: &mut WrState) {
assert!(unsafe { !is_in_render_thread() });
state.frame_builder.dl_builder.pop_stacking_context();
}
#[no_mangle]
pub extern "C" fn wr_dp_push_stacking_context(state: &mut WrState,
- bounds: WrRect,
+ bounds: LayoutRect,
animation_id: u64,
opacity: *const f32,
- transform: *const WrMatrix,
+ transform: *const LayoutTransform,
transform_style: WrTransformStyle,
mix_blend_mode: WrMixBlendMode,
filters: *const WrFilterOp,
filter_count: usize) {
assert!(unsafe { !is_in_render_thread() });
let bounds = bounds.into();
@@ -1238,17 +1090,17 @@ pub extern "C" fn wr_dp_push_stacking_co
}
} else {
filters.push(FilterOp::Opacity(PropertyBinding::Binding(PropertyBindingKey::new(animation_id))));
}
let transform = unsafe { transform.as_ref() };
let transform_binding = match animation_id {
0 => match transform {
- Some(transform) => Some(PropertyBinding::Value(transform.into())),
+ Some(transform) => Some(PropertyBinding::Value(transform.clone())),
None => None,
},
_ => Some(PropertyBinding::Binding(PropertyBindingKey::new(animation_id))),
};
state.frame_builder
.dl_builder
.push_stacking_context(webrender_api::ScrollPolicy::Scrollable,
@@ -1263,17 +1115,17 @@ pub extern "C" fn wr_dp_push_stacking_co
#[no_mangle]
pub extern "C" fn wr_dp_pop_stacking_context(state: &mut WrState) {
assert!(unsafe { !is_in_render_thread() });
state.frame_builder.dl_builder.pop_stacking_context();
}
#[no_mangle]
pub extern "C" fn wr_dp_push_clip(state: &mut WrState,
- rect: WrRect,
+ rect: LayoutRect,
complex: *const WrComplexClipRegion,
complex_count: usize,
mask: *const WrImageMask)
-> u64 {
assert!(unsafe { is_in_main_thread() });
let clip_rect: LayoutRect = rect.into();
let complex_slice = make_slice(complex, complex_count);
let complex_iter = complex_slice.iter().map(|x| x.into());
@@ -1296,18 +1148,18 @@ pub extern "C" fn wr_dp_push_clip(state:
pub extern "C" fn wr_dp_pop_clip(state: &mut WrState) {
assert!(unsafe { !is_in_render_thread() });
state.frame_builder.dl_builder.pop_clip_id();
}
#[no_mangle]
pub extern "C" fn wr_dp_push_scroll_layer(state: &mut WrState,
scroll_id: u64,
- content_rect: WrRect,
- clip_rect: WrRect) {
+ content_rect: LayoutRect,
+ clip_rect: LayoutRect) {
assert!(unsafe { is_in_main_thread() });
let clip_id = ClipId::new(scroll_id, state.pipeline_id);
// Avoid defining multiple scroll clips with the same clip id, as that
// results in undefined behaviour or assertion failures.
if !state.frame_builder.scroll_clips_defined.contains(&clip_id) {
let content_rect: LayoutRect = content_rect.into();
let clip_rect: LayoutRect = clip_rect.into();
@@ -1322,17 +1174,17 @@ pub extern "C" fn wr_dp_pop_scroll_layer
assert!(unsafe { is_in_main_thread() });
state.frame_builder.dl_builder.pop_clip_id();
}
#[no_mangle]
pub extern "C" fn wr_scroll_layer_with_id(api: &mut WrAPI,
pipeline_id: WrPipelineId,
scroll_id: u64,
- new_scroll_origin: WrPoint) {
+ new_scroll_origin: LayoutPoint) {
assert!(unsafe { is_in_compositor_thread() });
let clip_id = ClipId::new(scroll_id, pipeline_id);
api.scroll_node_with_id(new_scroll_origin.into(), clip_id, ScrollClamping::NoClamping);
}
#[no_mangle]
pub extern "C" fn wr_dp_push_clip_and_scroll_info(state: &mut WrState,
scroll_id: u64,
@@ -1352,41 +1204,41 @@ pub extern "C" fn wr_dp_push_clip_and_sc
#[no_mangle]
pub extern "C" fn wr_dp_pop_clip_and_scroll_info(state: &mut WrState) {
assert!(unsafe { is_in_main_thread() });
state.frame_builder.dl_builder.pop_clip_id();
}
#[no_mangle]
pub extern "C" fn wr_dp_push_iframe(state: &mut WrState,
- rect: WrRect,
+ rect: LayoutRect,
pipeline_id: WrPipelineId) {
assert!(unsafe { is_in_main_thread() });
state.frame_builder.dl_builder.push_iframe(rect.into(), None, pipeline_id);
}
#[no_mangle]
pub extern "C" fn wr_dp_push_rect(state: &mut WrState,
- rect: WrRect,
- clip: WrRect,
- color: WrColor) {
+ rect: LayoutRect,
+ clip: LayoutRect,
+ color: ColorF) {
assert!(unsafe { !is_in_render_thread() });
state.frame_builder.dl_builder.push_rect(rect.into(),
Some(LocalClip::Rect(clip.into())),
color.into());
}
#[no_mangle]
pub extern "C" fn wr_dp_push_image(state: &mut WrState,
- bounds: WrRect,
- clip: WrRect,
- stretch_size: WrSize,
- tile_spacing: WrSize,
+ bounds: LayoutRect,
+ clip: LayoutRect,
+ stretch_size: LayoutSize,
+ tile_spacing: LayoutSize,
image_rendering: WrImageRendering,
key: WrImageKey) {
assert!(unsafe { is_in_main_thread() || is_in_compositor_thread() });
state.frame_builder
.dl_builder
.push_image(bounds.into(),
Some(LocalClip::Rect(clip.into())),
@@ -1394,18 +1246,18 @@ pub extern "C" fn wr_dp_push_image(state
tile_spacing.into(),
image_rendering,
key);
}
/// Push a 3 planar yuv image.
#[no_mangle]
pub extern "C" fn wr_dp_push_yuv_planar_image(state: &mut WrState,
- bounds: WrRect,
- clip: WrRect,
+ bounds: LayoutRect,
+ clip: LayoutRect,
image_key_0: WrImageKey,
image_key_1: WrImageKey,
image_key_2: WrImageKey,
color_space: WrYuvColorSpace,
image_rendering: WrImageRendering) {
assert!(unsafe { is_in_main_thread() || is_in_compositor_thread() });
state.frame_builder
@@ -1415,18 +1267,18 @@ pub extern "C" fn wr_dp_push_yuv_planar_
YuvData::PlanarYCbCr(image_key_0, image_key_1, image_key_2),
color_space,
image_rendering);
}
/// Push a 2 planar NV12 image.
#[no_mangle]
pub extern "C" fn wr_dp_push_yuv_NV12_image(state: &mut WrState,
- bounds: WrRect,
- clip: WrRect,
+ bounds: LayoutRect,
+ clip: LayoutRect,
image_key_0: WrImageKey,
image_key_1: WrImageKey,
color_space: WrYuvColorSpace,
image_rendering: WrImageRendering) {
assert!(unsafe { is_in_main_thread() || is_in_compositor_thread() });
state.frame_builder
.dl_builder
@@ -1435,37 +1287,37 @@ pub extern "C" fn wr_dp_push_yuv_NV12_im
YuvData::NV12(image_key_0, image_key_1),
color_space,
image_rendering);
}
/// Push a yuv interleaved image.
#[no_mangle]
pub extern "C" fn wr_dp_push_yuv_interleaved_image(state: &mut WrState,
- bounds: WrRect,
- clip: WrRect,
+ bounds: LayoutRect,
+ clip: LayoutRect,
image_key_0: WrImageKey,
color_space: WrYuvColorSpace,
image_rendering: WrImageRendering) {
assert!(unsafe { is_in_main_thread() || is_in_compositor_thread() });
state.frame_builder
.dl_builder
.push_yuv_image(bounds.into(),
Some(LocalClip::Rect(clip.into())),
YuvData::InterleavedYCbCr(image_key_0),
color_space,
image_rendering);
}
#[no_mangle]
pub extern "C" fn wr_dp_push_text(state: &mut WrState,
- bounds: WrRect,
- clip: WrRect,
- color: WrColor,
+ bounds: LayoutRect,
+ clip: LayoutRect,
+ color: ColorF,
font_key: WrFontKey,
glyphs: *const WrGlyphInstance,
glyph_count: u32,
glyph_size: f32) {
assert!(unsafe { is_in_main_thread() });
let glyph_slice = make_slice(glyphs, glyph_count as usize);
let glyph_vector: Vec<_> = glyph_slice.iter().map(|x| x.into()).collect();
@@ -1481,18 +1333,18 @@ pub extern "C" fn wr_dp_push_text(state:
font_key,
colorf,
Au::from_f32_px(glyph_size),
glyph_options);
}
#[no_mangle]
pub extern "C" fn wr_dp_push_border(state: &mut WrState,
- rect: WrRect,
- clip: WrRect,
+ rect: LayoutRect,
+ clip: LayoutRect,
widths: WrBorderWidths,
top: WrBorderSide,
right: WrBorderSide,
bottom: WrBorderSide,
left: WrBorderSide,
radius: WrBorderRadius) {
assert!(unsafe { is_in_main_thread() });
@@ -1508,22 +1360,22 @@ pub extern "C" fn wr_dp_push_border(stat
.push_border(rect.into(),
Some(LocalClip::Rect(clip.into())),
widths.into(),
border_details);
}
#[no_mangle]
pub extern "C" fn wr_dp_push_border_image(state: &mut WrState,
- rect: WrRect,
- clip: WrRect,
+ rect: LayoutRect,
+ clip: LayoutRect,
widths: WrBorderWidths,
image: WrImageKey,
patch: WrNinePatchDescriptor,
- outset: WrSideOffsets2Df32,
+ outset: SideOffsets2D<f32>,
repeat_horizontal: WrRepeatMode,
repeat_vertical: WrRepeatMode) {
assert!(unsafe { is_in_main_thread() });
let border_details =
BorderDetails::Image(ImageBorder {
image_key: image,
patch: patch.into(),
fill: false,
@@ -1536,25 +1388,25 @@ pub extern "C" fn wr_dp_push_border_imag
.push_border(rect.into(),
Some(LocalClip::Rect(clip.into())),
widths.into(),
border_details);
}
#[no_mangle]
pub extern "C" fn wr_dp_push_border_gradient(state: &mut WrState,
- rect: WrRect,
- clip: WrRect,
+ rect: LayoutRect,
+ clip: LayoutRect,
widths: WrBorderWidths,
- start_point: WrPoint,
- end_point: WrPoint,
+ start_point: LayoutPoint,
+ end_point: LayoutPoint,
stops: *const WrGradientStop,
stops_count: usize,
extend_mode: WrGradientExtendMode,
- outset: WrSideOffsets2Df32) {
+ outset: SideOffsets2D<f32>) {
assert!(unsafe { is_in_main_thread() });
let stops_slice = make_slice(stops, stops_count);
let stops_vector = stops_slice.iter().map(|x| x.into()).collect();
let border_details = BorderDetails::Gradient(GradientBorder {
gradient:
state.frame_builder
@@ -1570,25 +1422,25 @@ pub extern "C" fn wr_dp_push_border_grad
.push_border(rect.into(),
Some(LocalClip::Rect(clip.into())),
widths.into(),
border_details);
}
#[no_mangle]
pub extern "C" fn wr_dp_push_border_radial_gradient(state: &mut WrState,
- rect: WrRect,
- clip: WrRect,
+ rect: LayoutRect,
+ clip: LayoutRect,
widths: WrBorderWidths,
- center: WrPoint,
- radius: WrSize,
+ center: LayoutPoint,
+ radius: LayoutSize,
stops: *const WrGradientStop,
stops_count: usize,
extend_mode: WrGradientExtendMode,
- outset: WrSideOffsets2Df32) {
+ outset: SideOffsets2D<f32>) {
assert!(unsafe { is_in_main_thread() });
let stops_slice = make_slice(stops, stops_count);
let stops_vector = stops_slice.iter().map(|x| x.into()).collect();
let border_details =
BorderDetails::RadialGradient(RadialGradientBorder {
gradient:
@@ -1605,25 +1457,25 @@ pub extern "C" fn wr_dp_push_border_radi
.push_border(rect.into(),
Some(LocalClip::Rect(clip.into())),
widths.into(),
border_details);
}
#[no_mangle]
pub extern "C" fn wr_dp_push_linear_gradient(state: &mut WrState,
- rect: WrRect,
- clip: WrRect,
- start_point: WrPoint,
- end_point: WrPoint,
+ rect: LayoutRect,
+ clip: LayoutRect,
+ start_point: LayoutPoint,
+ end_point: LayoutPoint,
stops: *const WrGradientStop,
stops_count: usize,
extend_mode: WrGradientExtendMode,
- tile_size: WrSize,
- tile_spacing: WrSize) {
+ tile_size: LayoutSize,
+ tile_spacing: LayoutSize) {
assert!(unsafe { is_in_main_thread() });
let stops_slice = make_slice(stops, stops_count);
let stops_vector = stops_slice.iter().map(|x| x.into()).collect();
let gradient = state.frame_builder
.dl_builder
.create_gradient(start_point.into(),
@@ -1636,25 +1488,25 @@ pub extern "C" fn wr_dp_push_linear_grad
Some(LocalClip::Rect(clip.into())),
gradient,
tile_size.into(),
tile_spacing.into());
}
#[no_mangle]
pub extern "C" fn wr_dp_push_radial_gradient(state: &mut WrState,
- rect: WrRect,
- clip: WrRect,
- center: WrPoint,
- radius: WrSize,
+ rect: LayoutRect,
+ clip: LayoutRect,
+ center: LayoutPoint,
+ radius: LayoutSize,
stops: *const WrGradientStop,
stops_count: usize,
extend_mode: WrGradientExtendMode,
- tile_size: WrSize,
- tile_spacing: WrSize) {
+ tile_size: LayoutSize,
+ tile_spacing: LayoutSize) {
assert!(unsafe { is_in_main_thread() });
let stops_slice = make_slice(stops, stops_count);
let stops_vector = stops_slice.iter().map(|x| x.into()).collect();
let gradient = state.frame_builder
.dl_builder
.create_radial_gradient(center.into(),
@@ -1667,50 +1519,50 @@ pub extern "C" fn wr_dp_push_radial_grad
Some(LocalClip::Rect(clip.into())),
gradient,
tile_size.into(),
tile_spacing.into());
}
#[no_mangle]
pub extern "C" fn wr_dp_push_box_shadow(state: &mut WrState,
- rect: WrRect,
- clip: WrRect,
- box_bounds: WrRect,
- offset: WrPoint,
- color: WrColor,
+ rect: LayoutRect,
+ clip: LayoutRect,
+ box_bounds: LayoutRect,
+ offset: LayoutVector2D,
+ color: ColorF,
blur_radius: f32,
spread_radius: f32,
border_radius: f32,
clip_mode: WrBoxShadowClipMode) {
assert!(unsafe { is_in_main_thread() });
state.frame_builder
.dl_builder
.push_box_shadow(rect.into(),
Some(LocalClip::Rect(clip.into())),
box_bounds.into(),
- offset.into(),
+ offset,
color.into(),
blur_radius,
spread_radius,
border_radius,
clip_mode);
}
#[no_mangle]
pub unsafe extern "C" fn wr_api_finalize_builder(state: &mut WrState,
- content_size: &mut WrSize,
+ content_size: &mut LayoutSize,
dl_descriptor: &mut WrBuiltDisplayListDescriptor,
dl_data: &mut WrVecU8) {
let frame_builder = mem::replace(&mut state.frame_builder,
WebRenderFrameBuilder::new(state.pipeline_id,
- WrSize::zero()));
+ LayoutSize::zero()));
let (_, size, dl) = frame_builder.dl_builder.finalize();
- *content_size = WrSize::new(size.width, size.height);
+ *content_size = LayoutSize::new(size.width, size.height);
let (data, descriptor) = dl.into_data();
*dl_data = WrVecU8::from_vec(data);
*dl_descriptor = descriptor;
}
#[no_mangle]
pub extern "C" fn wr_dp_push_built_display_list(state: &mut WrState,
dl_descriptor: WrBuiltDisplayListDescriptor,
--- a/gfx/webrender_bindings/webrender_ffi_generated.h
+++ b/gfx/webrender_bindings/webrender_ffi_generated.h
@@ -1,13 +1,13 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-/* Generated with cbindgen:0.1.14 */
+/* Generated with cbindgen:0.1.16 */
/* DO NOT MODIFY THIS MANUALLY! This file was generated using cbindgen.
* To generate this file:
* 1. Get the latest cbindgen using `cargo install --force cbindgen`
* a. Alternatively, you can clone `https://github.com/rlhunt/cbindgen` and use a tagged release
* 2. Run `cbindgen toolkit/library/rust/ --crate webrender_bindings -o gfx/webrender_bindings/webrender_ffi_generated.h`
*/
@@ -137,16 +137,18 @@ enum class WrTransformStyle : uint32_t {
enum class WrYuvColorSpace : uint32_t {
Rec601 = 0,
Rec709 = 1,
Sentinel /* this must be last for serialization purposes. */
};
+struct LayerPixel;
+
struct WrAPI;
struct WrRenderedEpochs;
struct WrRenderer;
struct WrState;
@@ -225,21 +227,21 @@ struct WrPipelineId {
uint32_t mHandle;
bool operator==(const WrPipelineId& aOther) const {
return mNamespace == aOther.mNamespace &&
mHandle == aOther.mHandle;
}
};
-struct WrSize {
+struct LayoutSize {
float width;
float height;
- bool operator==(const WrSize& aOther) const {
+ bool operator==(const LayoutSize& aOther) const {
return width == aOther.width &&
height == aOther.height;
}
};
struct WrBuiltDisplayListDescriptor {
uint64_t builder_start_time;
uint64_t builder_finish_time;
@@ -267,178 +269,238 @@ struct WrOpacityProperty {
float opacity;
bool operator==(const WrOpacityProperty& aOther) const {
return id == aOther.id &&
opacity == aOther.opacity;
}
};
-struct WrMatrix {
- float values[16];
+struct LayoutTransform {
+ float m11;
+ float m12;
+ float m13;
+ float m14;
+ float m21;
+ float m22;
+ float m23;
+ float m24;
+ float m31;
+ float m32;
+ float m33;
+ float m34;
+ float m41;
+ float m42;
+ float m43;
+ float m44;
+
+ bool operator==(const LayoutTransform& aOther) const {
+ return m11 == aOther.m11 &&
+ m12 == aOther.m12 &&
+ m13 == aOther.m13 &&
+ m14 == aOther.m14 &&
+ m21 == aOther.m21 &&
+ m22 == aOther.m22 &&
+ m23 == aOther.m23 &&
+ m24 == aOther.m24 &&
+ m31 == aOther.m31 &&
+ m32 == aOther.m32 &&
+ m33 == aOther.m33 &&
+ m34 == aOther.m34 &&
+ m41 == aOther.m41 &&
+ m42 == aOther.m42 &&
+ m43 == aOther.m43 &&
+ m44 == aOther.m44;
+ }
};
struct WrTransformProperty {
uint64_t id;
- WrMatrix transform;
+ LayoutTransform transform;
};
struct WrIdNamespace {
uint32_t mHandle;
bool operator==(const WrIdNamespace& aOther) const {
return mHandle == aOther.mHandle;
}
bool operator<(const WrIdNamespace& aOther) const {
return mHandle < aOther.mHandle;
}
bool operator<=(const WrIdNamespace& aOther) const {
return mHandle <= aOther.mHandle;
}
};
-struct WrColor {
+struct ColorF {
float r;
float g;
float b;
float a;
- bool operator==(const WrColor& aOther) const {
+ bool operator==(const ColorF& aOther) const {
return r == aOther.r &&
g == aOther.g &&
b == aOther.b &&
a == aOther.a;
}
};
-struct WrRect {
+struct TypedPoint2D_f32__LayerPixel {
float x;
float y;
+
+ bool operator==(const TypedPoint2D_f32__LayerPixel& aOther) const {
+ return x == aOther.x &&
+ y == aOther.y;
+ }
+};
+
+struct TypedSize2D_f32__LayerPixel {
float width;
float height;
- bool operator==(const WrRect& aOther) const {
- return x == aOther.x &&
- y == aOther.y &&
- width == aOther.width &&
+ bool operator==(const TypedSize2D_f32__LayerPixel& aOther) const {
+ return width == aOther.width &&
height == aOther.height;
}
};
+struct LayoutRect {
+ TypedPoint2D_f32__LayerPixel origin;
+ TypedSize2D_f32__LayerPixel size;
+
+ bool operator==(const LayoutRect& aOther) const {
+ return origin == aOther.origin &&
+ size == aOther.size;
+ }
+};
+
struct WrBorderWidths {
float left;
float top;
float right;
float bottom;
bool operator==(const WrBorderWidths& aOther) const {
return left == aOther.left &&
top == aOther.top &&
right == aOther.right &&
bottom == aOther.bottom;
}
};
struct WrBorderSide {
- WrColor color;
+ ColorF color;
WrBorderStyle style;
bool operator==(const WrBorderSide& aOther) const {
return color == aOther.color &&
style == aOther.style;
}
};
struct WrBorderRadius {
- WrSize top_left;
- WrSize top_right;
- WrSize bottom_left;
- WrSize bottom_right;
+ LayoutSize top_left;
+ LayoutSize top_right;
+ LayoutSize bottom_left;
+ LayoutSize bottom_right;
bool operator==(const WrBorderRadius& aOther) const {
return top_left == aOther.top_left &&
top_right == aOther.top_right &&
bottom_left == aOther.bottom_left &&
bottom_right == aOther.bottom_right;
}
};
-struct WrPoint {
+struct LayoutPoint {
float x;
float y;
- bool operator==(const WrPoint& aOther) const {
+ bool operator==(const LayoutPoint& aOther) const {
return x == aOther.x &&
y == aOther.y;
}
};
struct WrGradientStop {
float offset;
- WrColor color;
+ ColorF color;
bool operator==(const WrGradientStop& aOther) const {
return offset == aOther.offset &&
color == aOther.color;
}
};
-struct WrSideOffsets2Df32 {
- float top;
- float right;
- float bottom;
- float left;
+struct SideOffsets2D_u32 {
+ uint32_t top;
+ uint32_t right;
+ uint32_t bottom;
+ uint32_t left;
- bool operator==(const WrSideOffsets2Df32& aOther) const {
+ bool operator==(const SideOffsets2D_u32& aOther) const {
return top == aOther.top &&
right == aOther.right &&
bottom == aOther.bottom &&
left == aOther.left;
}
};
-struct WrSideOffsets2Du32 {
- uint32_t top;
- uint32_t right;
- uint32_t bottom;
- uint32_t left;
+struct SideOffsets2D_f32 {
+ float top;
+ float right;
+ float bottom;
+ float left;
- bool operator==(const WrSideOffsets2Du32& aOther) const {
+ bool operator==(const SideOffsets2D_f32& aOther) const {
return top == aOther.top &&
right == aOther.right &&
bottom == aOther.bottom &&
left == aOther.left;
}
};
struct WrNinePatchDescriptor {
uint32_t width;
uint32_t height;
- WrSideOffsets2Du32 slice;
+ SideOffsets2D_u32 slice;
bool operator==(const WrNinePatchDescriptor& aOther) const {
return width == aOther.width &&
height == aOther.height &&
slice == aOther.slice;
}
};
+struct LayoutVector2D {
+ float x;
+ float y;
+
+ bool operator==(const LayoutVector2D& aOther) const {
+ return x == aOther.x &&
+ y == aOther.y;
+ }
+};
+
struct WrComplexClipRegion {
- WrRect rect;
+ LayoutRect rect;
WrBorderRadius radii;
bool operator==(const WrComplexClipRegion& aOther) const {
return rect == aOther.rect &&
radii == aOther.radii;
}
};
struct WrImageMask {
WrImageKey image;
- WrRect rect;
+ LayoutRect rect;
bool repeat;
bool operator==(const WrImageMask& aOther) const {
return image == aOther.image &&
rect == aOther.rect &&
repeat == aOther.repeat;
}
};
@@ -450,17 +512,17 @@ struct WrFilterOp {
bool operator==(const WrFilterOp& aOther) const {
return filter_type == aOther.filter_type &&
argument == aOther.argument;
}
};
struct WrGlyphInstance {
uint32_t index;
- WrPoint point;
+ LayoutPoint point;
bool operator==(const WrGlyphInstance& aOther) const {
return index == aOther.index &&
point == aOther.point;
}
};
struct MutByteSlice {
@@ -587,17 +649,17 @@ WR_FUNC;
WR_INLINE
void wr_api_delete_image(WrAPI *aApi,
WrImageKey aKey)
WR_FUNC;
WR_INLINE
void wr_api_finalize_builder(WrState *aState,
- WrSize *aContentSize,
+ LayoutSize *aContentSize,
WrBuiltDisplayListDescriptor *aDlDescriptor,
WrVecU8 *aDlData)
WR_FUNC;
WR_INLINE
void wr_api_generate_frame(WrAPI *aApi)
WR_FUNC;
@@ -615,22 +677,22 @@ WR_FUNC;
WR_INLINE
void wr_api_send_external_event(WrAPI *aApi,
size_t aEvt)
WR_DESTRUCTOR_SAFE_FUNC;
WR_INLINE
void wr_api_set_root_display_list(WrAPI *aApi,
- WrColor aColor,
+ ColorF aColor,
WrEpoch aEpoch,
float aViewportWidth,
float aViewportHeight,
WrPipelineId aPipelineId,
- WrSize aContentSize,
+ LayoutSize aContentSize,
WrBuiltDisplayListDescriptor aDlDescriptor,
uint8_t *aDlData,
size_t aDlSize)
WR_FUNC;
WR_INLINE
void wr_api_set_root_pipeline(WrAPI *aApi,
WrPipelineId aPipelineId)
@@ -672,199 +734,199 @@ void wr_dp_pop_scroll_layer(WrState *aSt
WR_FUNC;
WR_INLINE
void wr_dp_pop_stacking_context(WrState *aState)
WR_FUNC;
WR_INLINE
void wr_dp_push_border(WrState *aState,
- WrRect aRect,
- WrRect aClip,
+ LayoutRect aRect,
+ LayoutRect aClip,
WrBorderWidths aWidths,
WrBorderSide aTop,
WrBorderSide aRight,
WrBorderSide aBottom,
WrBorderSide aLeft,
WrBorderRadius aRadius)
WR_FUNC;
WR_INLINE
void wr_dp_push_border_gradient(WrState *aState,
- WrRect aRect,
- WrRect aClip,
+ LayoutRect aRect,
+ LayoutRect aClip,
WrBorderWidths aWidths,
- WrPoint aStartPoint,
- WrPoint aEndPoint,
+ LayoutPoint aStartPoint,
+ LayoutPoint aEndPoint,
const WrGradientStop *aStops,
size_t aStopsCount,
WrGradientExtendMode aExtendMode,
- WrSideOffsets2Df32 aOutset)
+ SideOffsets2D_f32 aOutset)
WR_FUNC;
WR_INLINE
void wr_dp_push_border_image(WrState *aState,
- WrRect aRect,
- WrRect aClip,
+ LayoutRect aRect,
+ LayoutRect aClip,
WrBorderWidths aWidths,
WrImageKey aImage,
WrNinePatchDescriptor aPatch,
- WrSideOffsets2Df32 aOutset,
+ SideOffsets2D_f32 aOutset,
WrRepeatMode aRepeatHorizontal,
WrRepeatMode aRepeatVertical)
WR_FUNC;
WR_INLINE
void wr_dp_push_border_radial_gradient(WrState *aState,
- WrRect aRect,
- WrRect aClip,
+ LayoutRect aRect,
+ LayoutRect aClip,
WrBorderWidths aWidths,
- WrPoint aCenter,
- WrSize aRadius,
+ LayoutPoint aCenter,
+ LayoutSize aRadius,
const WrGradientStop *aStops,
size_t aStopsCount,
WrGradientExtendMode aExtendMode,
- WrSideOffsets2Df32 aOutset)
+ SideOffsets2D_f32 aOutset)
WR_FUNC;
WR_INLINE
void wr_dp_push_box_shadow(WrState *aState,
- WrRect aRect,
- WrRect aClip,
- WrRect aBoxBounds,
- WrPoint aOffset,
- WrColor aColor,
+ LayoutRect aRect,
+ LayoutRect aClip,
+ LayoutRect aBoxBounds,
+ LayoutVector2D aOffset,
+ ColorF aColor,
float aBlurRadius,
float aSpreadRadius,
float aBorderRadius,
WrBoxShadowClipMode aClipMode)
WR_FUNC;
WR_INLINE
void wr_dp_push_built_display_list(WrState *aState,
WrBuiltDisplayListDescriptor aDlDescriptor,
WrVecU8 *aDlData)
WR_FUNC;
WR_INLINE
uint64_t wr_dp_push_clip(WrState *aState,
- WrRect aRect,
+ LayoutRect aRect,
const WrComplexClipRegion *aComplex,
size_t aComplexCount,
const WrImageMask *aMask)
WR_FUNC;
WR_INLINE
void wr_dp_push_clip_and_scroll_info(WrState *aState,
uint64_t aScrollId,
const uint64_t *aClipId)
WR_FUNC;
WR_INLINE
void wr_dp_push_iframe(WrState *aState,
- WrRect aRect,
+ LayoutRect aRect,
WrPipelineId aPipelineId)
WR_FUNC;
WR_INLINE
void wr_dp_push_image(WrState *aState,
- WrRect aBounds,
- WrRect aClip,
- WrSize aStretchSize,
- WrSize aTileSpacing,
+ LayoutRect aBounds,
+ LayoutRect aClip,
+ LayoutSize aStretchSize,
+ LayoutSize aTileSpacing,
WrImageRendering aImageRendering,
WrImageKey aKey)
WR_FUNC;
WR_INLINE
void wr_dp_push_linear_gradient(WrState *aState,
- WrRect aRect,
- WrRect aClip,
- WrPoint aStartPoint,
- WrPoint aEndPoint,
+ LayoutRect aRect,
+ LayoutRect aClip,
+ LayoutPoint aStartPoint,
+ LayoutPoint aEndPoint,
const WrGradientStop *aStops,
size_t aStopsCount,
WrGradientExtendMode aExtendMode,
- WrSize aTileSize,
- WrSize aTileSpacing)
+ LayoutSize aTileSize,
+ LayoutSize aTileSpacing)
WR_FUNC;
WR_INLINE
void wr_dp_push_radial_gradient(WrState *aState,
- WrRect aRect,
- WrRect aClip,
- WrPoint aCenter,
- WrSize aRadius,
+ LayoutRect aRect,
+ LayoutRect aClip,
+ LayoutPoint aCenter,
+ LayoutSize aRadius,
const WrGradientStop *aStops,
size_t aStopsCount,
WrGradientExtendMode aExtendMode,
- WrSize aTileSize,
- WrSize aTileSpacing)
+ LayoutSize aTileSize,
+ LayoutSize aTileSpacing)
WR_FUNC;
WR_INLINE
void wr_dp_push_rect(WrState *aState,
- WrRect aRect,
- WrRect aClip,
- WrColor aColor)
+ LayoutRect aRect,
+ LayoutRect aClip,
+ ColorF aColor)
WR_FUNC;
WR_INLINE
void wr_dp_push_scroll_layer(WrState *aState,
uint64_t aScrollId,
- WrRect aContentRect,
- WrRect aClipRect)
+ LayoutRect aContentRect,
+ LayoutRect aClipRect)
WR_FUNC;
WR_INLINE
void wr_dp_push_stacking_context(WrState *aState,
- WrRect aBounds,
+ LayoutRect aBounds,
uint64_t aAnimationId,
const float *aOpacity,
- const WrMatrix *aTransform,
+ const LayoutTransform *aTransform,
WrTransformStyle aTransformStyle,
WrMixBlendMode aMixBlendMode,
const WrFilterOp *aFilters,
size_t aFilterCount)
WR_FUNC;
WR_INLINE
void wr_dp_push_text(WrState *aState,
- WrRect aBounds,
- WrRect aClip,
- WrColor aColor,
+ LayoutRect aBounds,
+ LayoutRect aClip,
+ ColorF aColor,
WrFontKey aFontKey,
const WrGlyphInstance *aGlyphs,
uint32_t aGlyphCount,
float aGlyphSize)
WR_FUNC;
WR_INLINE
void wr_dp_push_yuv_NV12_image(WrState *aState,
- WrRect aBounds,
- WrRect aClip,
+ LayoutRect aBounds,
+ LayoutRect aClip,
WrImageKey aImageKey0,
WrImageKey aImageKey1,
WrYuvColorSpace aColorSpace,
WrImageRendering aImageRendering)
WR_FUNC;
WR_INLINE
void wr_dp_push_yuv_interleaved_image(WrState *aState,
- WrRect aBounds,
- WrRect aClip,
+ LayoutRect aBounds,
+ LayoutRect aClip,
WrImageKey aImageKey0,
WrYuvColorSpace aColorSpace,
WrImageRendering aImageRendering)
WR_FUNC;
WR_INLINE
void wr_dp_push_yuv_planar_image(WrState *aState,
- WrRect aBounds,
- WrRect aClip,
+ LayoutRect aBounds,
+ LayoutRect aClip,
WrImageKey aImageKey0,
WrImageKey aImageKey1,
WrImageKey aImageKey2,
WrYuvColorSpace aColorSpace,
WrImageRendering aImageRendering)
WR_FUNC;
WR_INLINE
@@ -918,26 +980,26 @@ WR_FUNC;
WR_INLINE
void wr_renderer_update(WrRenderer *aRenderer)
WR_FUNC;
WR_INLINE
void wr_scroll_layer_with_id(WrAPI *aApi,
WrPipelineId aPipelineId,
uint64_t aScrollId,
- WrPoint aNewScrollOrigin)
+ LayoutPoint aNewScrollOrigin)
WR_FUNC;
WR_INLINE
void wr_state_delete(WrState *aState)
WR_DESTRUCTOR_SAFE_FUNC;
WR_INLINE
WrState *wr_state_new(WrPipelineId aPipelineId,
- WrSize aContentSize)
+ LayoutSize aContentSize)
WR_FUNC;
WR_INLINE
void wr_thread_pool_delete(WrThreadPool *aThreadPool)
WR_DESTRUCTOR_SAFE_FUNC;
WR_INLINE
WrThreadPool *wr_thread_pool_new()
--- a/layout/generic/nsBulletFrame.cpp
+++ b/layout/generic/nsBulletFrame.cpp
@@ -467,17 +467,17 @@ BulletRenderer::CreateWebRenderCommandsF
gfx::IntSize size;
Maybe<wr::ImageKey> key = aManager->CreateImageKey(aItem, container, aBuilder, aSc, size);
if (key.isNothing()) {
return;
}
const int32_t appUnitsPerDevPixel = aItem->Frame()->PresContext()->AppUnitsPerDevPixel();
LayoutDeviceRect destRect = LayoutDeviceRect::FromAppUnits(mDest, appUnitsPerDevPixel);
- wr::WrRect dest = aSc.ToRelativeWrRectRounded(destRect);
+ wr::LayoutRect dest = aSc.ToRelativeLayoutRectRounded(destRect);
aBuilder.PushImage(dest,
dest,
wr::WrImageRendering::Auto,
key.value());
}
void
--- a/layout/generic/nsCanvasFrame.cpp
+++ b/layout/generic/nsCanvasFrame.cpp
@@ -322,20 +322,20 @@ nsDisplayCanvasBackgroundColor::CreateWe
nsCanvasFrame *frame = static_cast<nsCanvasFrame *>(mFrame);
nsPoint offset = ToReferenceFrame();
nsRect bgClipRect = frame->CanvasArea() + offset;
int32_t appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
LayoutDeviceRect rect = LayoutDeviceRect::FromAppUnits(
bgClipRect, appUnitsPerDevPixel);
- wr::WrRect transformedRect = aSc.ToRelativeWrRect(rect);
+ wr::LayoutRect transformedRect = aSc.ToRelativeLayoutRect(rect);
aBuilder.PushRect(transformedRect,
transformedRect,
- wr::ToWrColor(ToDeviceColor(mColor)));
+ wr::ToColorF(ToDeviceColor(mColor)));
return true;
}
#ifdef MOZ_DUMP_PAINTING
void
nsDisplayCanvasBackgroundColor::WriteDebugInfo(std::stringstream& aStream)
{
aStream << " (rgba "
--- a/layout/painting/nsCSSRenderingBorders.cpp
+++ b/layout/painting/nsCSSRenderingBorders.cpp
@@ -3550,17 +3550,17 @@ nsCSSBorderRenderer::CanCreateWebRenderC
return true;
}
void
nsCSSBorderRenderer::CreateWebRenderCommands(wr::DisplayListBuilder& aBuilder,
const layers::StackingContextHelper& aSc)
{
LayoutDeviceRect outerRect = LayoutDeviceRect::FromUnknownRect(mOuterRect);
- wr::WrRect transformedRect = aSc.ToRelativeWrRect(outerRect);
+ wr::LayoutRect transformedRect = aSc.ToRelativeLayoutRect(outerRect);
wr::WrBorderSide side[4];
NS_FOR_CSS_SIDES(i) {
side[i] = wr::ToWrBorderSide(ToDeviceColor(mBorderColors[i]), mBorderStyles[i]);
}
wr::WrBorderRadius borderRadius = wr::ToWrBorderRadius(LayerSize(mBorderRadii[0].width, mBorderRadii[0].height),
LayerSize(mBorderRadii[1].width, mBorderRadii[1].height),
LayerSize(mBorderRadii[3].width, mBorderRadii[3].height),
--- a/layout/painting/nsCSSRenderingGradients.cpp
+++ b/layout/painting/nsCSSRenderingGradients.cpp
@@ -1059,20 +1059,20 @@ nsCSSGradientRenderer::BuildWebRenderDis
LayoutDevicePoint tileToClip = clipBounds.BottomRight() - firstTileBounds.TopLeft();
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::WrRect wrClipBounds = aSc.ToRelativeWrRect(clipBounds);
+ wr::LayoutRect wrClipBounds = aSc.ToRelativeLayoutRect(clipBounds);
LayerSize layerFirstTileSize = ViewAs<LayerPixel>(firstTileBounds.Size(),
PixelCastJustification::WebRenderHasUnitResolution);
- wr::WrRect wrGradientBounds = aSc.ToRelativeWrRect(gradientBounds);
+ 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)));
lineStart.x = (lineStart.x - srcTransform.x) * srcTransform.width;
@@ -1080,31 +1080,31 @@ nsCSSGradientRenderer::BuildWebRenderDis
if (mGradient->mShape == NS_STYLE_GRADIENT_SHAPE_LINEAR) {
lineEnd.x = (lineEnd.x - srcTransform.x) * srcTransform.width;
lineEnd.y = (lineEnd.y - srcTransform.y) * srcTransform.height;
aBuilder.PushLinearGradient(
wrGradientBounds,
wrClipBounds,
- mozilla::wr::ToWrPoint(lineStart),
- mozilla::wr::ToWrPoint(lineEnd),
+ mozilla::wr::ToLayoutPoint(lineStart),
+ mozilla::wr::ToLayoutPoint(lineEnd),
stops,
extendMode,
- mozilla::wr::ToWrSize(layerFirstTileSize),
- mozilla::wr::ToWrSize(tileSpacing));
+ mozilla::wr::ToLayoutSize(layerFirstTileSize),
+ mozilla::wr::ToLayoutSize(tileSpacing));
} else {
gradientRadius.width *= srcTransform.width;
gradientRadius.height *= srcTransform.height;
aBuilder.PushRadialGradient(
wrGradientBounds,
wrClipBounds,
- mozilla::wr::ToWrPoint(lineStart),
- mozilla::wr::ToWrSize(gradientRadius),
+ mozilla::wr::ToLayoutPoint(lineStart),
+ mozilla::wr::ToLayoutSize(gradientRadius),
stops,
extendMode,
- mozilla::wr::ToWrSize(layerFirstTileSize),
- mozilla::wr::ToWrSize(tileSpacing));
+ mozilla::wr::ToLayoutSize(layerFirstTileSize),
+ mozilla::wr::ToLayoutSize(tileSpacing));
}
}
} // namespace mozilla
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -4171,21 +4171,21 @@ nsDisplayBackgroundColor::CreateWebRende
}
if (mColor == Color()) {
return true;
}
LayoutDeviceRect bounds = LayoutDeviceRect::FromAppUnits(
mBackgroundRect, mFrame->PresContext()->AppUnitsPerDevPixel());
- wr::WrRect transformedRect = aSc.ToRelativeWrRect(bounds);
+ wr::LayoutRect transformedRect = aSc.ToRelativeLayoutRect(bounds);
aBuilder.PushRect(transformedRect,
transformedRect,
- wr::ToWrColor(ToDeviceColor(mColor)));
+ wr::ToColorF(ToDeviceColor(mColor)));
return true;
}
void
nsDisplayBackgroundColor::Paint(nsDisplayListBuilder* aBuilder,
gfxContext* aCtx)
{
@@ -4685,28 +4685,28 @@ nsDisplayCaret::CreateWebRenderCommands(
mCaret->ComputeCaretRects(frame, contentOffset, &caretRect, &hookRect);
gfx::Color color = ToDeviceColor(frame->GetCaretColorAt(contentOffset));
LayoutDeviceRect devCaretRect = LayoutDeviceRect::FromAppUnits(
caretRect + ToReferenceFrame(), appUnitsPerDevPixel);
LayoutDeviceRect devHookRect = LayoutDeviceRect::FromAppUnits(
hookRect + ToReferenceFrame(), appUnitsPerDevPixel);
- wr::WrRect caret = aSc.ToRelativeWrRectRounded(devCaretRect);
- wr::WrRect hook = aSc.ToRelativeWrRectRounded(devHookRect);
+ wr::LayoutRect caret = aSc.ToRelativeLayoutRectRounded(devCaretRect);
+ wr::LayoutRect hook = aSc.ToRelativeLayoutRectRounded(devHookRect);
// Note, WR will pixel snap anything that is layout aligned.
aBuilder.PushRect(caret,
caret,
- wr::ToWrColor(color));
+ wr::ToColorF(color));
if (!devHookRect.IsEmpty()) {
aBuilder.PushRect(hook,
hook,
- wr::ToWrColor(color));
+ wr::ToColorF(color));
}
return true;
}
LayerState
nsDisplayCaret::GetLayerState(nsDisplayListBuilder* aBuilder,
LayerManager* aManager,
const ContainerLayerParameters& aParameters)
@@ -4964,23 +4964,23 @@ nsDisplayBorder::CreateBorderImageWebRen
NS_FOR_CSS_SIDES(i) {
slice[i] = (float)(mBorderImageRenderer->mSlice.Side(i)) / appUnitsPerDevPixel;
widths[i] = (float)(mBorderImageRenderer->mWidths.Side(i)) / appUnitsPerDevPixel;
outset[i] = (float)(mBorderImageRenderer->mImageOutset.Side(i)) / appUnitsPerDevPixel;
}
LayoutDeviceRect destRect = LayoutDeviceRect::FromAppUnits(
mBorderImageRenderer->mArea, appUnitsPerDevPixel);
- wr::WrRect dest = aSc.ToRelativeWrRectRounded(destRect);
-
- wr::WrRect clip = dest;
+ wr::LayoutRect dest = aSc.ToRelativeLayoutRectRounded(destRect);
+
+ wr::LayoutRect clip = dest;
if (!mBorderImageRenderer->mClip.IsEmpty()) {
LayoutDeviceRect clipRect = LayoutDeviceRect::FromAppUnits(
mBorderImageRenderer->mClip, appUnitsPerDevPixel);
- clip = aSc.ToRelativeWrRectRounded(clipRect);
+ clip = aSc.ToRelativeLayoutRectRounded(clipRect);
}
switch (mBorderImageRenderer->mImageRenderer.GetType()) {
case eStyleImageType_Image:
{
uint32_t flags = aDisplayListBuilder->ShouldSyncDecodeImages() ?
imgIContainer::FLAG_SYNC_DECODE :
imgIContainer::FLAG_NONE;
@@ -4999,18 +4999,18 @@ nsDisplayBorder::CreateBorderImageWebRen
aBuilder.PushBorderImage(dest,
clip,
wr::ToWrBorderWidths(widths[0], widths[1], widths[2], widths[3]),
key.value(),
wr::ToWrNinePatchDescriptor(
(float)(mBorderImageRenderer->mImageSize.width) / appUnitsPerDevPixel,
(float)(mBorderImageRenderer->mImageSize.height) / appUnitsPerDevPixel,
- wr::ToWrSideOffsets2Du32(slice[0], slice[1], slice[2], slice[3])),
- wr::ToWrSideOffsets2Df32(outset[0], outset[1], outset[2], outset[3]),
+ wr::ToSideOffsets2D_u32(slice[0], slice[1], slice[2], slice[3])),
+ wr::ToSideOffsets2D_f32(outset[0], outset[1], outset[2], outset[3]),
wr::ToWrRepeatMode(mBorderImageRenderer->mRepeatModeHorizontal),
wr::ToWrRepeatMode(mBorderImageRenderer->mRepeatModeVertical));
break;
}
case eStyleImageType_Gradient:
{
RefPtr<nsStyleGradient> gradientData = mBorderImageRenderer->mImageRenderer.GetGradientData();
nsCSSGradientRenderer renderer =
@@ -5020,38 +5020,38 @@ nsDisplayBorder::CreateBorderImageWebRen
wr::WrGradientExtendMode extendMode;
nsTArray<wr::WrGradientStop> 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.x, dest.y);
+ LayerPoint startPoint = LayerPoint(dest.origin.x, dest.origin.y);
startPoint = startPoint + ViewAs<LayerPixel>(lineStart, PixelCastJustification::WebRenderHasUnitResolution);
- LayerPoint endPoint = LayerPoint(dest.x, dest.y);
+ LayerPoint endPoint = LayerPoint(dest.origin.x, dest.origin.y);
endPoint = endPoint + ViewAs<LayerPixel>(lineEnd, PixelCastJustification::WebRenderHasUnitResolution);
aBuilder.PushBorderGradient(dest,
clip,
wr::ToWrBorderWidths(widths[0], widths[1], widths[2], widths[3]),
- wr::ToWrPoint(startPoint),
- wr::ToWrPoint(endPoint),
+ wr::ToLayoutPoint(startPoint),
+ wr::ToLayoutPoint(endPoint),
stops,
extendMode,
- wr::ToWrSideOffsets2Df32(outset[0], outset[1], outset[2], outset[3]));
+ wr::ToSideOffsets2D_f32(outset[0], outset[1], outset[2], outset[3]));
} else {
aBuilder.PushBorderRadialGradient(dest,
clip,
wr::ToWrBorderWidths(widths[0], widths[1], widths[2], widths[3]),
- wr::ToWrPoint(lineStart),
- wr::ToWrSize(gradientRadius),
+ wr::ToLayoutPoint(lineStart),
+ wr::ToLayoutSize(gradientRadius),
stops,
extendMode,
- wr::ToWrSideOffsets2Df32(outset[0], outset[1], outset[2], outset[3]));
+ wr::ToSideOffsets2D_f32(outset[0], outset[1], outset[2], outset[3]));
}
break;
}
default:
MOZ_ASSERT_UNREACHABLE("Unsupport border image type");
}
}
@@ -5345,29 +5345,29 @@ nsDisplayBoxShadowOuter::CreateWebRender
// Now translate everything to device pixels.
nsRect shadowRect = frameRect;
Point shadowOffset;
shadowOffset.x = (shadow->mXOffset / appUnitsPerDevPixel);
shadowOffset.y = (shadow->mYOffset / appUnitsPerDevPixel);
LayoutDeviceRect deviceBox = LayoutDeviceRect::FromAppUnits(
shadowRect, appUnitsPerDevPixel);
- wr::WrRect deviceBoxRect = aSc.ToRelativeWrRectRounded(deviceBox);
- wr::WrRect deviceClipRect = aSc.ToRelativeWrRect(clipRect);
+ wr::LayoutRect deviceBoxRect = aSc.ToRelativeLayoutRectRounded(deviceBox);
+ wr::LayoutRect deviceClipRect = aSc.ToRelativeLayoutRect(clipRect);
// TODO: support non-uniform border radius.
float borderRadius = hasBorderRadius ? borderRadii.TopLeft().width
: 0.0;
float spreadRadius = float(shadow->mSpread) / float(appUnitsPerDevPixel);
aBuilder.PushBoxShadow(deviceBoxRect,
deviceClipRect,
deviceBoxRect,
- wr::ToWrPoint(shadowOffset),
- wr::ToWrColor(shadowColor),
+ wr::ToLayoutVector2D(shadowOffset),
+ wr::ToColorF(shadowColor),
blurRadius,
spreadRadius,
borderRadius,
wr::WrBoxShadowClipMode::Outset);
}
}
return true;
@@ -5498,34 +5498,34 @@ 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();
- wr::WrRect deviceClipRect = aSc.ToRelativeWrRect(clipRect);
+ 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);
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::ToWrRect(deviceBoxRect),
+ aBuilder.PushBoxShadow(wr::ToLayoutRect(deviceBoxRect),
deviceClipRect,
- wr::ToWrRect(deviceBoxRect),
- wr::ToWrPoint(shadowOffset),
- wr::ToWrColor(shadowColor),
+ wr::ToLayoutRect(deviceBoxRect),
+ wr::ToLayoutVector2D(shadowOffset),
+ wr::ToColorF(shadowColor),
blurRadius,
spreadRadius,
borderRadius,
wr::WrBoxShadowClipMode::Inset
);
}
}
}
--- a/layout/painting/nsImageRenderer.cpp
+++ b/layout/painting/nsImageRenderer.cpp
@@ -646,24 +646,24 @@ nsImageRenderer::BuildWebRenderDisplayIt
nsPoint firstTilePos = nsLayoutUtils::GetBackgroundFirstTilePos(aDest.TopLeft(),
aFill.TopLeft(),
aRepeatSize);
LayoutDeviceRect fillRect = LayoutDeviceRect::FromAppUnits(
nsRect(firstTilePos.x, firstTilePos.y,
aFill.XMost() - firstTilePos.x, aFill.YMost() - firstTilePos.y),
appUnitsPerDevPixel);
- wr::WrRect fill = aSc.ToRelativeWrRect(fillRect);
- wr::WrRect clip = aSc.ToRelativeWrRect(
+ wr::LayoutRect fill = aSc.ToRelativeLayoutRect(fillRect);
+ wr::LayoutRect clip = aSc.ToRelativeLayoutRect(
LayoutDeviceRect::FromAppUnits(aFill, appUnitsPerDevPixel));
LayoutDeviceSize gapSize = LayoutDeviceSize::FromAppUnits(
aRepeatSize - aDest.Size(), appUnitsPerDevPixel);
aBuilder.PushImage(fill, clip,
- wr::ToWrSize(destRect.Size()), wr::ToWrSize(gapSize),
+ wr::ToLayoutSize(destRect.Size()), wr::ToLayoutSize(gapSize),
wr::ImageRendering::Auto, key.value());
break;
}
default:
break;
}
return DrawResult::SUCCESS;
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -7439,32 +7439,32 @@ BCBlockDirSeg::CreateWebRenderCommands(B
if (param.isNothing()) {
return;
}
//TODO: Currently, we don't support border with m{Start,End}Bevel{Side,Offset} attributes.
LayoutDeviceRect borderRect = LayoutDeviceRect::FromUnknownRect(NSRectToRect(param->mBorderRect + aOffset,
param->mAppUnitsPerDevPixel));
- wr::WrRect transformedRect = aSc.ToRelativeWrRect(borderRect);
+ wr::LayoutRect transformedRect = aSc.ToRelativeLayoutRect(borderRect);
wr::WrBorderSide wrSide[4];
NS_FOR_CSS_SIDES(i) {
wrSide[i] = wr::ToWrBorderSide(ToDeviceColor(param->mBorderColor), NS_STYLE_BORDER_STYLE_NONE);
}
wrSide[eSideLeft] = wr::ToWrBorderSide(ToDeviceColor(param->mBorderColor), param->mBorderStyle);
wr::WrBorderRadius borderRadii = wr::ToWrBorderRadius( {0, 0}, {0, 0}, {0, 0}, {0, 0} );
// All border style is set to none except left side. So setting the widths of
// each side to width of rect is fine.
- wr::WrBorderWidths borderWidths = wr::ToWrBorderWidths(transformedRect.width,
- transformedRect.width,
- transformedRect.width,
- transformedRect.width);
- transformedRect.width *= 2.0f;
+ wr::WrBorderWidths borderWidths = wr::ToWrBorderWidths(transformedRect.size.width,
+ transformedRect.size.width,
+ transformedRect.size.width,
+ transformedRect.size.width);
+ transformedRect.size.width *= 2.0f;
Range<const wr::WrBorderSide> wrsides(wrSide, 4);
aBuilder.PushBorder(transformedRect,
transformedRect,
borderWidths,
wrsides,
borderRadii);
}
@@ -7697,32 +7697,32 @@ BCInlineDirSeg::CreateWebRenderCommands(
if (param.isNothing()) {
return;
}
//TODO: Currently, we don't support border with m{Start,End}Bevel{Side,Offset} attributes.
LayoutDeviceRect borderRect = LayoutDeviceRect::FromUnknownRect(NSRectToRect(param->mBorderRect + aPt,
param->mAppUnitsPerDevPixel));
- wr::WrRect transformedRect = aSc.ToRelativeWrRect(borderRect);
+ wr::LayoutRect transformedRect = aSc.ToRelativeLayoutRect(borderRect);
wr::WrBorderSide wrSide[4];
NS_FOR_CSS_SIDES(i) {
wrSide[i] = wr::ToWrBorderSide(ToDeviceColor(param->mBorderColor), NS_STYLE_BORDER_STYLE_NONE);
}
wrSide[eSideTop] = wr::ToWrBorderSide(ToDeviceColor(param->mBorderColor), param->mBorderStyle);
wr::WrBorderRadius borderRadii = wr::ToWrBorderRadius( {0, 0}, {0, 0}, {0, 0}, {0, 0} );
// All border style is set to none except top side. So setting the widths of
// each side to height of rect is fine.
- wr::WrBorderWidths borderWidths = wr::ToWrBorderWidths(transformedRect.height,
- transformedRect.height,
- transformedRect.height,
- transformedRect.height);
- transformedRect.height *= 2.0f;
+ wr::WrBorderWidths borderWidths = wr::ToWrBorderWidths(transformedRect.size.height,
+ transformedRect.size.height,
+ transformedRect.size.height,
+ transformedRect.size.height);
+ transformedRect.size.height *= 2.0f;
Range<const wr::WrBorderSide> wrsides(wrSide, 4);
aBuilder.PushBorder(transformedRect,
transformedRect,
borderWidths,
wrsides,
borderRadii);
}
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -2109,18 +2109,18 @@ nsChildView::AddWindowOverlayWebRenderCo
mTitlebarImageSize = size;
updatedTitlebarRegion.SetEmpty();
}
if (!updatedTitlebarRegion.IsEmpty()) {
aWrBridge->SendUpdateImage(*mTitlebarImageKey, size, format, buffer);
}
- wr::WrRect rect = wr::ToWrRect(mTitlebarRect);
- aBuilder.PushImage(wr::WrRect{ 0, 0, float(size.width), float(size.height) },
+ wr::LayoutRect rect = wr::ToLayoutRect(mTitlebarRect);
+ aBuilder.PushImage(wr::LayoutRect{ 0, 0, float(size.width), float(size.height) },
rect, wr::ImageRendering::Auto, *mTitlebarImageKey);
}
}
void
nsChildView::CleanupWebRenderWindowOverlay(layers::WebRenderBridgeChild* aWrBridge)
{
if (mTitlebarImageKey) {