|
@@ -0,0 +1,1312 @@
|
|
|
+# HG changeset patch
|
|
|
+# User Ryan Hunt <rhunt@eqrion.net>
|
|
|
+# Date 1530652558 18000
|
|
|
+# Node ID bd8c8fb537cf56f21f10810f53a7f00ac027f516
|
|
|
+# Parent 0ed4f121eb2c61c9bccf3958d275b2ae31b4eaa0
|
|
|
+Bug 1473301 - Remove BorderLayer. r=mattwoodrow
|
|
|
+
|
|
|
+MozReview-Commit-ID: KGXW2lYBZ3c
|
|
|
+
|
|
|
+diff --git a/gfx/layers/LayerTreeInvalidation.cpp b/gfx/layers/LayerTreeInvalidation.cpp
|
|
|
+--- a/gfx/layers/LayerTreeInvalidation.cpp
|
|
|
++++ b/gfx/layers/LayerTreeInvalidation.cpp
|
|
|
+@@ -601,62 +601,16 @@ public:
|
|
|
+ AddTransformedRegion(aOutRegion, boundsDiff, mTransform);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ Color mColor;
|
|
|
+ IntRect mBounds;
|
|
|
+ };
|
|
|
+
|
|
|
+-struct BorderLayerProperties : public LayerPropertiesBase
|
|
|
+-{
|
|
|
+- explicit BorderLayerProperties(BorderLayer *aLayer)
|
|
|
+- : LayerPropertiesBase(aLayer)
|
|
|
+- , mColors(aLayer->GetColors())
|
|
|
+- , mRect(aLayer->GetRect())
|
|
|
+- , mCorners(aLayer->GetCorners())
|
|
|
+- , mWidths(aLayer->GetWidths())
|
|
|
+- { }
|
|
|
+-
|
|
|
+-protected:
|
|
|
+- BorderLayerProperties(const BorderLayerProperties& a) = delete;
|
|
|
+- BorderLayerProperties& operator=(const BorderLayerProperties& a) = delete;
|
|
|
+-
|
|
|
+-public:
|
|
|
+- bool ComputeChangeInternal(const char* aPrefix,
|
|
|
+- nsIntRegion& aOutRegion,
|
|
|
+- NotifySubDocInvalidationFunc aCallback) override
|
|
|
+- {
|
|
|
+- BorderLayer* border = static_cast<BorderLayer*>(mLayer.get());
|
|
|
+-
|
|
|
+- if (!border->GetLocalVisibleRegion().ToUnknownRegion().IsEqual(mVisibleRegion)) {
|
|
|
+- IntRect result = NewTransformedBoundsForLeaf();
|
|
|
+- result = result.Union(OldTransformedBoundsForLeaf());
|
|
|
+- aOutRegion = result;
|
|
|
+- return true;
|
|
|
+- }
|
|
|
+-
|
|
|
+- if (!PodEqual(&mColors[0], &border->GetColors()[0], 4) ||
|
|
|
+- !PodEqual(&mWidths[0], &border->GetWidths()[0], 4) ||
|
|
|
+- !PodEqual(&mCorners[0], &border->GetCorners()[0], 4) ||
|
|
|
+- !mRect.IsEqualEdges(border->GetRect())) {
|
|
|
+- LTI_DUMP(NewTransformedBoundsForLeaf(), "bounds");
|
|
|
+- aOutRegion = NewTransformedBoundsForLeaf();
|
|
|
+- return true;
|
|
|
+- }
|
|
|
+-
|
|
|
+- return true;
|
|
|
+- }
|
|
|
+-
|
|
|
+- BorderColors mColors;
|
|
|
+- LayerRect mRect;
|
|
|
+- BorderCorners mCorners;
|
|
|
+- BorderWidths mWidths;
|
|
|
+-};
|
|
|
+-
|
|
|
+ static ImageHost* GetImageHost(Layer* aLayer)
|
|
|
+ {
|
|
|
+ HostLayer* compositor = aLayer->AsHostLayer();
|
|
|
+ if (compositor) {
|
|
|
+ return static_cast<ImageHost*>(compositor->GetCompositableHost());
|
|
|
+ }
|
|
|
+ return nullptr;
|
|
|
+ }
|
|
|
+@@ -781,18 +735,16 @@ CloneLayerTreePropertiesInternal(Layer*
|
|
|
+ case Layer::TYPE_REF:
|
|
|
+ return MakeUnique<ContainerLayerProperties>(aRoot->AsContainerLayer());
|
|
|
+ case Layer::TYPE_COLOR:
|
|
|
+ return MakeUnique<ColorLayerProperties>(static_cast<ColorLayer*>(aRoot));
|
|
|
+ case Layer::TYPE_IMAGE:
|
|
|
+ return MakeUnique<ImageLayerProperties>(static_cast<ImageLayer*>(aRoot), aIsMask);
|
|
|
+ case Layer::TYPE_CANVAS:
|
|
|
+ return MakeUnique<CanvasLayerProperties>(static_cast<CanvasLayer*>(aRoot));
|
|
|
+- case Layer::TYPE_BORDER:
|
|
|
+- return MakeUnique<BorderLayerProperties>(static_cast<BorderLayer*>(aRoot));
|
|
|
+ case Layer::TYPE_DISPLAYITEM:
|
|
|
+ case Layer::TYPE_READBACK:
|
|
|
+ case Layer::TYPE_SHADOW:
|
|
|
+ case Layer::TYPE_PAINTED:
|
|
|
+ return MakeUnique<LayerPropertiesBase>(aRoot);
|
|
|
+ }
|
|
|
+
|
|
|
+ MOZ_ASSERT_UNREACHABLE("Unexpected root layer type");
|
|
|
+diff --git a/gfx/layers/Layers.cpp b/gfx/layers/Layers.cpp
|
|
|
+--- a/gfx/layers/Layers.cpp
|
|
|
++++ b/gfx/layers/Layers.cpp
|
|
|
+@@ -2102,28 +2102,16 @@ ColorLayer::DumpPacket(layerscope::Layer
|
|
|
+ Layer::DumpPacket(aPacket, aParent);
|
|
|
+ // Get this layer data
|
|
|
+ using namespace layerscope;
|
|
|
+ LayersPacket::Layer* layer = aPacket->mutable_layer(aPacket->layer_size()-1);
|
|
|
+ layer->set_type(LayersPacket::Layer::ColorLayer);
|
|
|
+ layer->set_color(mColor.ToABGR());
|
|
|
+ }
|
|
|
+
|
|
|
+-void
|
|
|
+-BorderLayer::PrintInfo(std::stringstream& aStream, const char* aPrefix)
|
|
|
+-{
|
|
|
+- Layer::PrintInfo(aStream, aPrefix);
|
|
|
+-}
|
|
|
+-
|
|
|
+-void
|
|
|
+-BorderLayer::DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent)
|
|
|
+-{
|
|
|
+- Layer::DumpPacket(aPacket, aParent);
|
|
|
+-}
|
|
|
+-
|
|
|
+ CanvasLayer::CanvasLayer(LayerManager* aManager, void* aImplData)
|
|
|
+ : Layer(aManager, aImplData)
|
|
|
+ , mSamplingFilter(SamplingFilter::GOOD)
|
|
|
+ {
|
|
|
+ }
|
|
|
+
|
|
|
+ CanvasLayer::~CanvasLayer() = default;
|
|
|
+
|
|
|
+diff --git a/gfx/layers/Layers.h b/gfx/layers/Layers.h
|
|
|
+--- a/gfx/layers/Layers.h
|
|
|
++++ b/gfx/layers/Layers.h
|
|
|
+@@ -87,17 +87,16 @@ class Layer;
|
|
|
+ class LayerMetricsWrapper;
|
|
|
+ class PaintedLayer;
|
|
|
+ class ContainerLayer;
|
|
|
+ class ImageLayer;
|
|
|
+ class ColorLayer;
|
|
|
+ class CompositorAnimations;
|
|
|
+ class CompositorBridgeChild;
|
|
|
+ class CanvasLayer;
|
|
|
+-class BorderLayer;
|
|
|
+ class ReadbackLayer;
|
|
|
+ class ReadbackProcessor;
|
|
|
+ class RefLayer;
|
|
|
+ class HostLayer;
|
|
|
+ class FocusTarget;
|
|
|
+ class KnowsCompositor;
|
|
|
+ class ShadowableLayer;
|
|
|
+ class ShadowLayerForwarder;
|
|
|
+@@ -420,21 +419,16 @@ public:
|
|
|
+ virtual already_AddRefed<ImageLayer> CreateImageLayer() = 0;
|
|
|
+ /**
|
|
|
+ * CONSTRUCTION PHASE ONLY
|
|
|
+ * Create a ColorLayer for this manager's layer tree.
|
|
|
+ */
|
|
|
+ virtual already_AddRefed<ColorLayer> CreateColorLayer() = 0;
|
|
|
+ /**
|
|
|
+ * CONSTRUCTION PHASE ONLY
|
|
|
+- * Create a BorderLayer for this manager's layer tree.
|
|
|
+- */
|
|
|
+- virtual already_AddRefed<BorderLayer> CreateBorderLayer() = 0;
|
|
|
+- /**
|
|
|
+- * CONSTRUCTION PHASE ONLY
|
|
|
+ * Create a CanvasLayer for this manager's layer tree.
|
|
|
+ */
|
|
|
+ virtual already_AddRefed<CanvasLayer> CreateCanvasLayer() = 0;
|
|
|
+ /**
|
|
|
+ * CONSTRUCTION PHASE ONLY
|
|
|
+ * Create a ReadbackLayer for this manager's layer tree.
|
|
|
+ */
|
|
|
+ virtual already_AddRefed<ReadbackLayer> CreateReadbackLayer() { return nullptr; }
|
|
|
+@@ -787,17 +781,16 @@ class Layer {
|
|
|
+ public:
|
|
|
+ // Keep these in alphabetical order
|
|
|
+ enum LayerType {
|
|
|
+ TYPE_CANVAS,
|
|
|
+ TYPE_COLOR,
|
|
|
+ TYPE_CONTAINER,
|
|
|
+ TYPE_DISPLAYITEM,
|
|
|
+ TYPE_IMAGE,
|
|
|
+- TYPE_BORDER,
|
|
|
+ TYPE_READBACK,
|
|
|
+ TYPE_REF,
|
|
|
+ TYPE_SHADOW,
|
|
|
+ TYPE_PAINTED
|
|
|
+ };
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Returns the LayerManager this Layer belongs to. Note that the layer
|
|
|
+@@ -1507,22 +1500,16 @@ public:
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Dynamic cast to a Color. Returns null if this is not a
|
|
|
+ * ColorLayer.
|
|
|
+ */
|
|
|
+ virtual ColorLayer* AsColorLayer() { return nullptr; }
|
|
|
+
|
|
|
+ /**
|
|
|
+- * Dynamic cast to a Border. Returns null if this is not a
|
|
|
+- * ColorLayer.
|
|
|
+- */
|
|
|
+- virtual BorderLayer* AsBorderLayer() { return nullptr; }
|
|
|
+-
|
|
|
+- /**
|
|
|
+ * Dynamic cast to a Canvas. Returns null if this is not a
|
|
|
+ * ColorLayer.
|
|
|
+ */
|
|
|
+ virtual CanvasLayer* AsCanvasLayer() { return nullptr; }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Dynamic cast to an Image. Returns null if this is not a
|
|
|
+ * ColorLayer.
|
|
|
+@@ -2410,96 +2397,16 @@ protected:
|
|
|
+
|
|
|
+ virtual void DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent) override;
|
|
|
+
|
|
|
+ gfx::IntRect mBounds;
|
|
|
+ gfx::Color mColor;
|
|
|
+ };
|
|
|
+
|
|
|
+ /**
|
|
|
+- * A Layer which renders a rounded rect.
|
|
|
+- */
|
|
|
+-class BorderLayer : public Layer {
|
|
|
+-public:
|
|
|
+- virtual BorderLayer* AsBorderLayer() override { return this; }
|
|
|
+-
|
|
|
+- /**
|
|
|
+- * CONSTRUCTION PHASE ONLY
|
|
|
+- * Set the color of the layer.
|
|
|
+- */
|
|
|
+-
|
|
|
+- // Colors of each side as in css::Side
|
|
|
+- virtual void SetColors(const BorderColors& aColors)
|
|
|
+- {
|
|
|
+- MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) Colors", this));
|
|
|
+- PodCopy(&mColors[0], &aColors[0], 4);
|
|
|
+- Mutated();
|
|
|
+- }
|
|
|
+-
|
|
|
+- virtual void SetRect(const LayerRect& aRect)
|
|
|
+- {
|
|
|
+- MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) Rect", this));
|
|
|
+- mRect = aRect;
|
|
|
+- Mutated();
|
|
|
+- }
|
|
|
+-
|
|
|
+- // Size of each rounded corner as in css::Corner, 0.0 means a
|
|
|
+- // rectangular corner.
|
|
|
+- virtual void SetCornerRadii(const BorderCorners& aCorners)
|
|
|
+- {
|
|
|
+- MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) Corners", this));
|
|
|
+- PodCopy(&mCorners[0], &aCorners[0], 4);
|
|
|
+- Mutated();
|
|
|
+- }
|
|
|
+-
|
|
|
+- virtual void SetWidths(const BorderWidths& aWidths)
|
|
|
+- {
|
|
|
+- MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) Widths", this));
|
|
|
+- PodCopy(&mWidths[0], &aWidths[0], 4);
|
|
|
+- Mutated();
|
|
|
+- }
|
|
|
+-
|
|
|
+- virtual void SetStyles(const BorderStyles& aBorderStyles)
|
|
|
+- {
|
|
|
+- MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) Widths", this));
|
|
|
+- PodCopy(&mBorderStyles[0], &aBorderStyles[0], 4);
|
|
|
+- Mutated();
|
|
|
+- }
|
|
|
+-
|
|
|
+- MOZ_LAYER_DECL_NAME("BorderLayer", TYPE_BORDER)
|
|
|
+-
|
|
|
+- virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) override
|
|
|
+- {
|
|
|
+- gfx::Matrix4x4 idealTransform = GetLocalTransform() * aTransformToSurface;
|
|
|
+- mEffectiveTransform = SnapTransformTranslation(idealTransform, nullptr);
|
|
|
+- ComputeEffectiveTransformForMaskLayers(aTransformToSurface);
|
|
|
+- }
|
|
|
+-
|
|
|
+- const BorderColors& GetColors() { return mColors; }
|
|
|
+- const LayerRect& GetRect() { return mRect; }
|
|
|
+- const BorderCorners& GetCorners() { return mCorners; }
|
|
|
+- const BorderWidths& GetWidths() { return mWidths; }
|
|
|
+-
|
|
|
+-protected:
|
|
|
+- BorderLayer(LayerManager* aManager, void* aImplData)
|
|
|
+- : Layer(aManager, aImplData)
|
|
|
+- {}
|
|
|
+-
|
|
|
+- virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) override;
|
|
|
+-
|
|
|
+- virtual void DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent) override;
|
|
|
+-
|
|
|
+- BorderColors mColors;
|
|
|
+- LayerRect mRect;
|
|
|
+- BorderCorners mCorners;
|
|
|
+- BorderWidths mWidths;
|
|
|
+- BorderStyles mBorderStyles;
|
|
|
+-};
|
|
|
+-
|
|
|
+-/**
|
|
|
+ * A Layer for HTML Canvas elements. It's backed by either a
|
|
|
+ * gfxASurface or a GLContext (for WebGL layers), and has some control
|
|
|
+ * for intelligent updating from the source if necessary (for example,
|
|
|
+ * if hardware compositing is not available, for reading from the GL
|
|
|
+ * buffer into an image surface that we can layer composite.)
|
|
|
+ *
|
|
|
+ * After Initialize is called, the underlying canvas Surface/GLContext
|
|
|
+ * must not be modified during a layer transaction.
|
|
|
+diff --git a/gfx/layers/basic/BasicBorderLayer.cpp b/gfx/layers/basic/BasicBorderLayer.cpp
|
|
|
+deleted file mode 100644
|
|
|
+--- a/gfx/layers/basic/BasicBorderLayer.cpp
|
|
|
++++ /dev/null
|
|
|
+@@ -1,84 +0,0 @@
|
|
|
+-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
+-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
+-/* 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 "BasicLayersImpl.h" // for FillRectWithMask, etc
|
|
|
+-#include "Layers.h" // for ColorLayer, etc
|
|
|
+-#include "BasicImplData.h" // for BasicImplData
|
|
|
+-#include "BasicLayers.h" // for BasicLayerManager
|
|
|
+-#include "gfxContext.h" // for gfxContext, etc
|
|
|
+-#include "gfxRect.h" // for gfxRect
|
|
|
+-#include "gfx2DGlue.h"
|
|
|
+-#include "mozilla/mozalloc.h" // for operator new
|
|
|
+-#include "nsCOMPtr.h" // for already_AddRefed
|
|
|
+-#include "nsDebug.h" // for NS_ASSERTION
|
|
|
+-#include "nsISupportsImpl.h" // for Layer::AddRef, etc
|
|
|
+-#include "nsRect.h" // for mozilla::gfx::IntRect
|
|
|
+-#include "nsRegion.h" // for nsIntRegion
|
|
|
+-#include "mozilla/gfx/PathHelpers.h"
|
|
|
+-
|
|
|
+-using namespace mozilla::gfx;
|
|
|
+-
|
|
|
+-namespace mozilla {
|
|
|
+-namespace layers {
|
|
|
+-
|
|
|
+-class BasicBorderLayer : public BorderLayer, public BasicImplData {
|
|
|
+-public:
|
|
|
+- explicit BasicBorderLayer(BasicLayerManager* aLayerManager) :
|
|
|
+- BorderLayer(aLayerManager, static_cast<BasicImplData*>(this))
|
|
|
+- {
|
|
|
+- MOZ_COUNT_CTOR(BasicBorderLayer);
|
|
|
+- }
|
|
|
+-
|
|
|
+-protected:
|
|
|
+- virtual ~BasicBorderLayer()
|
|
|
+- {
|
|
|
+- MOZ_COUNT_DTOR(BasicBorderLayer);
|
|
|
+- }
|
|
|
+-
|
|
|
+-public:
|
|
|
+- virtual void SetVisibleRegion(const LayerIntRegion& aRegion) override
|
|
|
+- {
|
|
|
+- NS_ASSERTION(BasicManager()->InConstruction(),
|
|
|
+- "Can only set properties in construction phase");
|
|
|
+- BorderLayer::SetVisibleRegion(aRegion);
|
|
|
+- }
|
|
|
+-
|
|
|
+- virtual void Paint(DrawTarget* aDT,
|
|
|
+- const gfx::Point& aDeviceOffset,
|
|
|
+- Layer* aMaskLayer) override
|
|
|
+- {
|
|
|
+- if (IsHidden()) {
|
|
|
+- return;
|
|
|
+- }
|
|
|
+-
|
|
|
+- // We currently assume that we never have rounded corners,
|
|
|
+- // and that all borders have the same width and color.
|
|
|
+-
|
|
|
+- ColorPattern color(mColors[0]);
|
|
|
+- StrokeOptions strokeOptions(mWidths[0]);
|
|
|
+-
|
|
|
+- Rect rect = mRect.ToUnknownRect();
|
|
|
+- rect.Deflate(mWidths[0] / 2.0);
|
|
|
+- aDT->StrokeRect(rect, color, strokeOptions);
|
|
|
+- }
|
|
|
+-
|
|
|
+-protected:
|
|
|
+- BasicLayerManager* BasicManager()
|
|
|
+- {
|
|
|
+- return static_cast<BasicLayerManager*>(mManager);
|
|
|
+- }
|
|
|
+-};
|
|
|
+-
|
|
|
+-already_AddRefed<BorderLayer>
|
|
|
+-BasicLayerManager::CreateBorderLayer()
|
|
|
+-{
|
|
|
+- NS_ASSERTION(InConstruction(), "Only allowed in construction phase");
|
|
|
+- RefPtr<BorderLayer> layer = new BasicBorderLayer(this);
|
|
|
+- return layer.forget();
|
|
|
+-}
|
|
|
+-
|
|
|
+-} // namespace layers
|
|
|
+-} // namespace mozilla
|
|
|
+diff --git a/gfx/layers/basic/BasicLayers.h b/gfx/layers/basic/BasicLayers.h
|
|
|
+--- a/gfx/layers/basic/BasicLayers.h
|
|
|
++++ b/gfx/layers/basic/BasicLayers.h
|
|
|
+@@ -109,17 +109,16 @@ public:
|
|
|
+
|
|
|
+ virtual void SetRoot(Layer* aLayer) override;
|
|
|
+
|
|
|
+ virtual already_AddRefed<PaintedLayer> CreatePaintedLayer() override;
|
|
|
+ virtual already_AddRefed<ContainerLayer> CreateContainerLayer() override;
|
|
|
+ virtual already_AddRefed<ImageLayer> CreateImageLayer() override;
|
|
|
+ virtual already_AddRefed<CanvasLayer> CreateCanvasLayer() override;
|
|
|
+ virtual already_AddRefed<ColorLayer> CreateColorLayer() override;
|
|
|
+- virtual already_AddRefed<BorderLayer> CreateBorderLayer() override;
|
|
|
+ virtual already_AddRefed<ReadbackLayer> CreateReadbackLayer() override;
|
|
|
+ virtual ImageFactory *GetImageFactory();
|
|
|
+
|
|
|
+ virtual LayersBackend GetBackendType() override { return LayersBackend::LAYERS_BASIC; }
|
|
|
+ virtual void GetBackendName(nsAString& name) override { name.AssignLiteral("Basic"); }
|
|
|
+
|
|
|
+ bool InConstruction() { return mPhase == PHASE_CONSTRUCTION; }
|
|
|
+ #ifdef DEBUG
|
|
|
+diff --git a/gfx/layers/client/ClientBorderLayer.cpp b/gfx/layers/client/ClientBorderLayer.cpp
|
|
|
+deleted file mode 100644
|
|
|
+--- a/gfx/layers/client/ClientBorderLayer.cpp
|
|
|
++++ /dev/null
|
|
|
+@@ -1,75 +0,0 @@
|
|
|
+-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
+-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
+-/* 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 "ClientLayerManager.h" // for ClientLayerManager, etc
|
|
|
+-#include "Layers.h" // for ColorLayer, etc
|
|
|
+-#include "mozilla/layers/LayersMessages.h" // for ColorLayerAttributes, etc
|
|
|
+-#include "mozilla/mozalloc.h" // for operator new
|
|
|
+-#include "nsCOMPtr.h" // for already_AddRefed
|
|
|
+-#include "nsDebug.h" // for NS_ASSERTION
|
|
|
+-#include "nsISupportsImpl.h" // for Layer::AddRef, etc
|
|
|
+-#include "nsRegion.h" // for nsIntRegion
|
|
|
+-
|
|
|
+-namespace mozilla {
|
|
|
+-namespace layers {
|
|
|
+-
|
|
|
+-using namespace mozilla::gfx;
|
|
|
+-
|
|
|
+-class ClientBorderLayer : public BorderLayer,
|
|
|
+- public ClientLayer {
|
|
|
+-public:
|
|
|
+- explicit ClientBorderLayer(ClientLayerManager* aLayerManager) :
|
|
|
+- BorderLayer(aLayerManager, static_cast<ClientLayer*>(this))
|
|
|
+- {
|
|
|
+- MOZ_COUNT_CTOR(ClientBorderLayer);
|
|
|
+- }
|
|
|
+-
|
|
|
+-protected:
|
|
|
+- virtual ~ClientBorderLayer()
|
|
|
+- {
|
|
|
+- MOZ_COUNT_DTOR(ClientBorderLayer);
|
|
|
+- }
|
|
|
+-
|
|
|
+-public:
|
|
|
+- virtual void SetVisibleRegion(const LayerIntRegion& aRegion) override
|
|
|
+- {
|
|
|
+- NS_ASSERTION(ClientManager()->InConstruction(),
|
|
|
+- "Can only set properties in construction phase");
|
|
|
+- BorderLayer::SetVisibleRegion(aRegion);
|
|
|
+- }
|
|
|
+-
|
|
|
+- virtual void RenderLayer() override
|
|
|
+- {
|
|
|
+- RenderMaskLayers(this);
|
|
|
+- }
|
|
|
+-
|
|
|
+- virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs) override
|
|
|
+- {
|
|
|
+- aAttrs = BorderLayerAttributes(mRect, mColors, mCorners, mWidths);
|
|
|
+- }
|
|
|
+-
|
|
|
+- virtual Layer* AsLayer() override { return this; }
|
|
|
+- virtual ShadowableLayer* AsShadowableLayer() override { return this; }
|
|
|
+-
|
|
|
+-protected:
|
|
|
+- ClientLayerManager* ClientManager()
|
|
|
+- {
|
|
|
+- return static_cast<ClientLayerManager*>(mManager);
|
|
|
+- }
|
|
|
+-};
|
|
|
+-
|
|
|
+-already_AddRefed<BorderLayer>
|
|
|
+-ClientLayerManager::CreateBorderLayer()
|
|
|
+-{
|
|
|
+- NS_ASSERTION(InConstruction(), "Only allowed in construction phase");
|
|
|
+- RefPtr<ClientBorderLayer> layer =
|
|
|
+- new ClientBorderLayer(this);
|
|
|
+- CREATE_SHADOW(Border);
|
|
|
+- return layer.forget();
|
|
|
+-}
|
|
|
+-
|
|
|
+-} // namespace layers
|
|
|
+-} // namespace mozilla
|
|
|
+diff --git a/gfx/layers/client/ClientLayerManager.h b/gfx/layers/client/ClientLayerManager.h
|
|
|
+--- a/gfx/layers/client/ClientLayerManager.h
|
|
|
++++ b/gfx/layers/client/ClientLayerManager.h
|
|
|
+@@ -101,17 +101,16 @@ public:
|
|
|
+
|
|
|
+ virtual already_AddRefed<PaintedLayer> CreatePaintedLayer() override;
|
|
|
+ virtual already_AddRefed<PaintedLayer> CreatePaintedLayerWithHint(PaintedLayerCreationHint aHint) override;
|
|
|
+ virtual already_AddRefed<ContainerLayer> CreateContainerLayer() override;
|
|
|
+ virtual already_AddRefed<ImageLayer> CreateImageLayer() override;
|
|
|
+ virtual already_AddRefed<CanvasLayer> CreateCanvasLayer() override;
|
|
|
+ virtual already_AddRefed<ReadbackLayer> CreateReadbackLayer() override;
|
|
|
+ virtual already_AddRefed<ColorLayer> CreateColorLayer() override;
|
|
|
+- virtual already_AddRefed<BorderLayer> CreateBorderLayer() override;
|
|
|
+ virtual already_AddRefed<RefLayer> CreateRefLayer() override;
|
|
|
+
|
|
|
+ virtual void UpdateTextureFactoryIdentifier(const TextureFactoryIdentifier& aNewIdentifier) override;
|
|
|
+ virtual TextureFactoryIdentifier GetTextureFactoryIdentifier() override
|
|
|
+ {
|
|
|
+ return AsShadowForwarder()->GetTextureFactoryIdentifier();
|
|
|
+ }
|
|
|
+
|
|
|
+diff --git a/gfx/layers/composite/LayerManagerComposite.cpp b/gfx/layers/composite/LayerManagerComposite.cpp
|
|
|
+--- a/gfx/layers/composite/LayerManagerComposite.cpp
|
|
|
++++ b/gfx/layers/composite/LayerManagerComposite.cpp
|
|
|
+@@ -1228,60 +1228,16 @@ LayerManagerComposite::HandlePixelsTarge
|
|
|
+ GLContext* gl = compositor->gl();
|
|
|
+ MOZ_ASSERT(gl);
|
|
|
+ gl->fReadPixels(0, 0, bufferWidth, bufferHeight, LOCAL_GL_RGBA, LOCAL_GL_UNSIGNED_BYTE, mem.get<uint8_t>());
|
|
|
+ Unused << mScreenPixelsTarget->SendScreenPixels(mem, ScreenIntSize(bufferWidth, bufferHeight));
|
|
|
+ mScreenPixelsTarget = nullptr;
|
|
|
+ }
|
|
|
+ #endif
|
|
|
+
|
|
|
+-class BorderLayerComposite : public BorderLayer,
|
|
|
+- public LayerComposite
|
|
|
+-{
|
|
|
+-public:
|
|
|
+- explicit BorderLayerComposite(LayerManagerComposite *aManager)
|
|
|
+- : BorderLayer(aManager, nullptr)
|
|
|
+- , LayerComposite(aManager)
|
|
|
+- {
|
|
|
+- MOZ_COUNT_CTOR(BorderLayerComposite);
|
|
|
+- mImplData = static_cast<LayerComposite*>(this);
|
|
|
+- }
|
|
|
+-
|
|
|
+-protected:
|
|
|
+- ~BorderLayerComposite()
|
|
|
+- {
|
|
|
+- MOZ_COUNT_DTOR(BorderLayerComposite);
|
|
|
+- Destroy();
|
|
|
+- }
|
|
|
+-
|
|
|
+-public:
|
|
|
+- // LayerComposite Implementation
|
|
|
+- virtual Layer* GetLayer() override { return this; }
|
|
|
+-
|
|
|
+- virtual void SetLayerManager(HostLayerManager* aManager) override
|
|
|
+- {
|
|
|
+- LayerComposite::SetLayerManager(aManager);
|
|
|
+- mManager = aManager;
|
|
|
+- }
|
|
|
+-
|
|
|
+- virtual void Destroy() override { mDestroyed = true; }
|
|
|
+-
|
|
|
+- virtual void RenderLayer(const gfx::IntRect& aClipRect,
|
|
|
+- const Maybe<gfx::Polygon>& aGeometry) override {}
|
|
|
+- virtual void CleanupResources() override {};
|
|
|
+-
|
|
|
+- virtual void GenEffectChain(EffectChain& aEffect) override {}
|
|
|
+-
|
|
|
+- CompositableHost* GetCompositableHost() override { return nullptr; }
|
|
|
+-
|
|
|
+- virtual HostLayer* AsHostLayer() override { return this; }
|
|
|
+-
|
|
|
+- virtual const char* Name() const override { return "BorderLayerComposite"; }
|
|
|
+-};
|
|
|
+-
|
|
|
+ already_AddRefed<PaintedLayer>
|
|
|
+ LayerManagerComposite::CreatePaintedLayer()
|
|
|
+ {
|
|
|
+ if (mDestroyed) {
|
|
|
+ NS_WARNING("Call on destroyed layer manager");
|
|
|
+ return nullptr;
|
|
|
+ }
|
|
|
+ return RefPtr<PaintedLayer>(new PaintedLayerComposite(this)).forget();
|
|
|
+@@ -1332,26 +1288,16 @@ LayerManagerComposite::CreateRefLayer()
|
|
|
+ {
|
|
|
+ if (LayerManagerComposite::mDestroyed) {
|
|
|
+ NS_WARNING("Call on destroyed layer manager");
|
|
|
+ return nullptr;
|
|
|
+ }
|
|
|
+ return RefPtr<RefLayer>(new RefLayerComposite(this)).forget();
|
|
|
+ }
|
|
|
+
|
|
|
+-already_AddRefed<BorderLayer>
|
|
|
+-LayerManagerComposite::CreateBorderLayer()
|
|
|
+-{
|
|
|
+- if (LayerManagerComposite::mDestroyed) {
|
|
|
+- NS_WARNING("Call on destroyed layer manager");
|
|
|
+- return nullptr;
|
|
|
+- }
|
|
|
+- return RefPtr<BorderLayer>(new BorderLayerComposite(this)).forget();
|
|
|
+-}
|
|
|
+-
|
|
|
+ LayerManagerComposite::AutoAddMaskEffect::AutoAddMaskEffect(Layer* aMaskLayer,
|
|
|
+ EffectChain& aEffects)
|
|
|
+ : mCompositable(nullptr), mFailed(false)
|
|
|
+ {
|
|
|
+ if (!aMaskLayer) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+diff --git a/gfx/layers/composite/LayerManagerComposite.h b/gfx/layers/composite/LayerManagerComposite.h
|
|
|
+--- a/gfx/layers/composite/LayerManagerComposite.h
|
|
|
++++ b/gfx/layers/composite/LayerManagerComposite.h
|
|
|
+@@ -299,17 +299,16 @@ public:
|
|
|
+ virtual bool CanUseCanvasLayerForSize(const gfx::IntSize &aSize) override;
|
|
|
+
|
|
|
+ virtual void ClearCachedResources(Layer* aSubtree = nullptr) override;
|
|
|
+
|
|
|
+ virtual already_AddRefed<PaintedLayer> CreatePaintedLayer() override;
|
|
|
+ virtual already_AddRefed<ContainerLayer> CreateContainerLayer() override;
|
|
|
+ virtual already_AddRefed<ImageLayer> CreateImageLayer() override;
|
|
|
+ virtual already_AddRefed<ColorLayer> CreateColorLayer() override;
|
|
|
+- virtual already_AddRefed<BorderLayer> CreateBorderLayer() override;
|
|
|
+ virtual already_AddRefed<CanvasLayer> CreateCanvasLayer() override;
|
|
|
+ virtual already_AddRefed<RefLayer> CreateRefLayer() override;
|
|
|
+
|
|
|
+ virtual bool AreComponentAlphaLayersEnabled() override;
|
|
|
+
|
|
|
+ virtual already_AddRefed<DrawTarget>
|
|
|
+ CreateOptimalMaskDrawTarget(const IntSize &aSize) override;
|
|
|
+
|
|
|
+diff --git a/gfx/layers/ipc/LayerTransactionParent.cpp b/gfx/layers/ipc/LayerTransactionParent.cpp
|
|
|
+--- a/gfx/layers/ipc/LayerTransactionParent.cpp
|
|
|
++++ b/gfx/layers/ipc/LayerTransactionParent.cpp
|
|
|
+@@ -231,27 +231,16 @@ LayerTransactionParent::RecvUpdate(const
|
|
|
+ RefPtr<ColorLayer> layer = mLayerManager->CreateColorLayer();
|
|
|
+ if (!BindLayer(layer, edit.get_OpCreateColorLayer())) {
|
|
|
+ return IPC_FAIL_NO_REASON(this);
|
|
|
+ }
|
|
|
+
|
|
|
+ UpdateHitTestingTree(layer, "CreateColorLayer");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+- case Edit::TOpCreateBorderLayer: {
|
|
|
+- MOZ_LAYERS_LOG(("[ParentSide] CreateBorderLayer"));
|
|
|
+-
|
|
|
+- RefPtr<BorderLayer> layer = mLayerManager->CreateBorderLayer();
|
|
|
+- if (!BindLayer(layer, edit.get_OpCreateBorderLayer())) {
|
|
|
+- return IPC_FAIL_NO_REASON(this);
|
|
|
+- }
|
|
|
+-
|
|
|
+- UpdateHitTestingTree(layer, "CreateBorderLayer");
|
|
|
+- break;
|
|
|
+- }
|
|
|
+ case Edit::TOpCreateCanvasLayer: {
|
|
|
+ MOZ_LAYERS_LOG(("[ParentSide] CreateCanvasLayer"));
|
|
|
+
|
|
|
+ RefPtr<CanvasLayer> layer = mLayerManager->CreateCanvasLayer();
|
|
|
+ if (!BindLayer(layer, edit.get_OpCreateCanvasLayer())) {
|
|
|
+ return IPC_FAIL_NO_REASON(this);
|
|
|
+ }
|
|
|
+
|
|
|
+@@ -596,29 +585,16 @@ LayerTransactionParent::SetLayerAttribut
|
|
|
+ ColorLayer* colorLayer = layer->AsColorLayer();
|
|
|
+ if (!colorLayer) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ colorLayer->SetColor(specific.get_ColorLayerAttributes().color().value());
|
|
|
+ colorLayer->SetBounds(specific.get_ColorLayerAttributes().bounds());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+- case Specific::TBorderLayerAttributes: {
|
|
|
+- MOZ_LAYERS_LOG(("[ParentSide] border layer"));
|
|
|
+-
|
|
|
+- BorderLayer* borderLayer = layer->AsBorderLayer();
|
|
|
+- if (!borderLayer) {
|
|
|
+- return false;
|
|
|
+- }
|
|
|
+- borderLayer->SetRect(specific.get_BorderLayerAttributes().rect());
|
|
|
+- borderLayer->SetColors(specific.get_BorderLayerAttributes().colors());
|
|
|
+- borderLayer->SetCornerRadii(specific.get_BorderLayerAttributes().corners());
|
|
|
+- borderLayer->SetWidths(specific.get_BorderLayerAttributes().widths());
|
|
|
+- break;
|
|
|
+- }
|
|
|
+ case Specific::TCanvasLayerAttributes: {
|
|
|
+ MOZ_LAYERS_LOG(("[ParentSide] canvas layer"));
|
|
|
+
|
|
|
+ CanvasLayer* canvasLayer = layer->AsCanvasLayer();
|
|
|
+ if (!canvasLayer) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ canvasLayer->SetSamplingFilter(specific.get_CanvasLayerAttributes().samplingFilter());
|
|
|
+diff --git a/gfx/layers/ipc/LayersMessages.ipdlh b/gfx/layers/ipc/LayersMessages.ipdlh
|
|
|
+--- a/gfx/layers/ipc/LayersMessages.ipdlh
|
|
|
++++ b/gfx/layers/ipc/LayersMessages.ipdlh
|
|
|
+@@ -41,19 +41,16 @@ using mozilla::layers::EventRegions from
|
|
|
+ using mozilla::layers::EventRegionsOverride from "mozilla/layers/LayersTypes.h";
|
|
|
+ using mozilla::layers::DiagnosticTypes from "mozilla/layers/CompositorTypes.h";
|
|
|
+ using mozilla::layers::FocusTarget from "mozilla/layers/FocusTarget.h";
|
|
|
+ using struct mozilla::layers::ScrollMetadata from "FrameMetrics.h";
|
|
|
+ using mozilla::layers::FrameMetrics::ViewID from "FrameMetrics.h";
|
|
|
+ using mozilla::layers::LayersBackend from "mozilla/layers/LayersTypes.h";
|
|
|
+ using mozilla::layers::MaybeLayerClip from "FrameMetrics.h";
|
|
|
+ using mozilla::gfx::Glyph from "Layers.h";
|
|
|
+-using mozilla::layers::BorderColors from "mozilla/layers/LayersTypes.h";
|
|
|
+-using mozilla::layers::BorderCorners from "mozilla/layers/LayersTypes.h";
|
|
|
+-using mozilla::layers::BorderWidths from "mozilla/layers/LayersTypes.h";
|
|
|
+ using mozilla::layers::LayerHandle from "mozilla/layers/LayersTypes.h";
|
|
|
+ using mozilla::layers::CompositableHandle from "mozilla/layers/LayersTypes.h";
|
|
|
+ using mozilla::layers::SimpleLayerAttributes from "mozilla/layers/LayerAttributes.h";
|
|
|
+ using mozilla::CrossProcessSemaphoreHandle from "mozilla/ipc/CrossProcessSemaphore.h";
|
|
|
+ using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
|
|
|
+ using mozilla::layers::LayersId from "mozilla/layers/LayersTypes.h";
|
|
|
+
|
|
|
+ namespace mozilla {
|
|
|
+@@ -66,17 +63,16 @@ struct TargetConfig {
|
|
|
+ nsIntRegion clearRegion;
|
|
|
+ };
|
|
|
+
|
|
|
+ // Create a shadow layer for |layer|
|
|
|
+ struct OpCreatePaintedLayer { LayerHandle layer; };
|
|
|
+ struct OpCreateContainerLayer { LayerHandle layer; };
|
|
|
+ struct OpCreateImageLayer { LayerHandle layer; };
|
|
|
+ struct OpCreateColorLayer { LayerHandle layer; };
|
|
|
+-struct OpCreateBorderLayer { LayerHandle layer; };
|
|
|
+ struct OpCreateCanvasLayer { LayerHandle layer; };
|
|
|
+ struct OpCreateRefLayer { LayerHandle layer; };
|
|
|
+
|
|
|
+ struct OpAttachCompositable {
|
|
|
+ LayerHandle layer;
|
|
|
+ CompositableHandle compositable;
|
|
|
+ };
|
|
|
+
|
|
|
+@@ -305,32 +301,25 @@ struct GlyphArray
|
|
|
+
|
|
|
+ struct ColorLayerAttributes { LayerColor color; IntRect bounds; };
|
|
|
+ struct CanvasLayerAttributes { SamplingFilter samplingFilter; IntRect bounds; };
|
|
|
+ struct RefLayerAttributes {
|
|
|
+ LayersId id;
|
|
|
+ EventRegionsOverride eventRegionsOverride;
|
|
|
+ };
|
|
|
+ struct ImageLayerAttributes { SamplingFilter samplingFilter; IntSize scaleToSize; ScaleMode scaleMode; };
|
|
|
+-struct BorderLayerAttributes {
|
|
|
+- LayerRect rect;
|
|
|
+- BorderColors colors;
|
|
|
+- BorderCorners corners;
|
|
|
+- BorderWidths widths;
|
|
|
+-};
|
|
|
+
|
|
|
+ union SpecificLayerAttributes {
|
|
|
+ null_t;
|
|
|
+ PaintedLayerAttributes;
|
|
|
+ ContainerLayerAttributes;
|
|
|
+ ColorLayerAttributes;
|
|
|
+ CanvasLayerAttributes;
|
|
|
+ RefLayerAttributes;
|
|
|
+ ImageLayerAttributes;
|
|
|
+- BorderLayerAttributes;
|
|
|
+ };
|
|
|
+
|
|
|
+ struct LayerAttributes {
|
|
|
+ CommonLayerAttributes common;
|
|
|
+ SpecificLayerAttributes specific;
|
|
|
+ };
|
|
|
+
|
|
|
+ struct OpSetSimpleLayerAttributes {
|
|
|
+@@ -483,17 +472,16 @@ struct CompositableOperation {
|
|
|
+ // A unit of a changeset; a set of these comprise a changeset
|
|
|
+ // If adding a new edit type that requires the hit testing tree to be updated,
|
|
|
+ // set the updateHitTestingTree flag to true in RecvUpdate()
|
|
|
+ union Edit {
|
|
|
+ OpCreatePaintedLayer;
|
|
|
+ OpCreateContainerLayer;
|
|
|
+ OpCreateImageLayer;
|
|
|
+ OpCreateColorLayer;
|
|
|
+- OpCreateBorderLayer;
|
|
|
+ OpCreateCanvasLayer;
|
|
|
+ OpCreateRefLayer;
|
|
|
+
|
|
|
+ OpSetDiagnosticTypes;
|
|
|
+ OpWindowOverlayChanged;
|
|
|
+
|
|
|
+ OpSetRoot;
|
|
|
+ OpInsertAfter;
|
|
|
+diff --git a/gfx/layers/ipc/ShadowLayers.cpp b/gfx/layers/ipc/ShadowLayers.cpp
|
|
|
+--- a/gfx/layers/ipc/ShadowLayers.cpp
|
|
|
++++ b/gfx/layers/ipc/ShadowLayers.cpp
|
|
|
+@@ -318,21 +318,16 @@ ShadowLayerForwarder::CreatedImageLayer(
|
|
|
+ CreatedLayer<OpCreateImageLayer>(mTxn, aImage);
|
|
|
+ }
|
|
|
+ void
|
|
|
+ ShadowLayerForwarder::CreatedColorLayer(ShadowableLayer* aColor)
|
|
|
+ {
|
|
|
+ CreatedLayer<OpCreateColorLayer>(mTxn, aColor);
|
|
|
+ }
|
|
|
+ void
|
|
|
+-ShadowLayerForwarder::CreatedBorderLayer(ShadowableLayer* aBorder)
|
|
|
+-{
|
|
|
+- CreatedLayer<OpCreateBorderLayer>(mTxn, aBorder);
|
|
|
+-}
|
|
|
+-void
|
|
|
+ ShadowLayerForwarder::CreatedCanvasLayer(ShadowableLayer* aCanvas)
|
|
|
+ {
|
|
|
+ CreatedLayer<OpCreateCanvasLayer>(mTxn, aCanvas);
|
|
|
+ }
|
|
|
+ void
|
|
|
+ ShadowLayerForwarder::CreatedRefLayer(ShadowableLayer* aRef)
|
|
|
+ {
|
|
|
+ CreatedLayer<OpCreateRefLayer>(mTxn, aRef);
|
|
|
+diff --git a/gfx/layers/ipc/ShadowLayers.h b/gfx/layers/ipc/ShadowLayers.h
|
|
|
+--- a/gfx/layers/ipc/ShadowLayers.h
|
|
|
++++ b/gfx/layers/ipc/ShadowLayers.h
|
|
|
+@@ -172,17 +172,16 @@ public:
|
|
|
+ * the compositing process.
|
|
|
+ */
|
|
|
+ void CreatedPaintedLayer(ShadowableLayer* aThebes);
|
|
|
+ void CreatedContainerLayer(ShadowableLayer* aContainer);
|
|
|
+ void CreatedImageLayer(ShadowableLayer* aImage);
|
|
|
+ void CreatedColorLayer(ShadowableLayer* aColor);
|
|
|
+ void CreatedCanvasLayer(ShadowableLayer* aCanvas);
|
|
|
+ void CreatedRefLayer(ShadowableLayer* aRef);
|
|
|
+- void CreatedBorderLayer(ShadowableLayer* aRef);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * At least one attribute of |aMutant| has changed, and |aMutant|
|
|
|
+ * needs to sync to its shadow layer. This initial implementation
|
|
|
+ * forwards all attributes when any of the appropriate attribute
|
|
|
+ * set is mutated.
|
|
|
+ */
|
|
|
+ void Mutated(ShadowableLayer* aMutant);
|
|
|
+diff --git a/gfx/layers/mlgpu/LayerManagerMLGPU.cpp b/gfx/layers/mlgpu/LayerManagerMLGPU.cpp
|
|
|
+--- a/gfx/layers/mlgpu/LayerManagerMLGPU.cpp
|
|
|
++++ b/gfx/layers/mlgpu/LayerManagerMLGPU.cpp
|
|
|
+@@ -152,23 +152,16 @@ LayerManagerMLGPU::CreatePaintedLayer()
|
|
|
+ }
|
|
|
+
|
|
|
+ already_AddRefed<ImageLayer>
|
|
|
+ LayerManagerMLGPU::CreateImageLayer()
|
|
|
+ {
|
|
|
+ return MakeAndAddRef<ImageLayerMLGPU>(this);
|
|
|
+ }
|
|
|
+
|
|
|
+-already_AddRefed<BorderLayer>
|
|
|
+-LayerManagerMLGPU::CreateBorderLayer()
|
|
|
+-{
|
|
|
+- MOZ_ASSERT_UNREACHABLE("Not yet implemented");
|
|
|
+- return nullptr;
|
|
|
+-}
|
|
|
+-
|
|
|
+ already_AddRefed<CanvasLayer>
|
|
|
+ LayerManagerMLGPU::CreateCanvasLayer()
|
|
|
+ {
|
|
|
+ return MakeAndAddRef<CanvasLayerMLGPU>(this);
|
|
|
+ }
|
|
|
+
|
|
|
+ TextureFactoryIdentifier
|
|
|
+ LayerManagerMLGPU::GetTextureFactoryIdentifier()
|
|
|
+diff --git a/gfx/layers/mlgpu/LayerManagerMLGPU.h b/gfx/layers/mlgpu/LayerManagerMLGPU.h
|
|
|
+--- a/gfx/layers/mlgpu/LayerManagerMLGPU.h
|
|
|
++++ b/gfx/layers/mlgpu/LayerManagerMLGPU.h
|
|
|
+@@ -41,17 +41,16 @@ public:
|
|
|
+ void BeginTransactionWithDrawTarget(gfx::DrawTarget* aTarget, const gfx::IntRect& aRect) override;
|
|
|
+ void SetRoot(Layer* aLayer) override;
|
|
|
+ already_AddRefed<PaintedLayer> CreatePaintedLayer() override;
|
|
|
+ already_AddRefed<ContainerLayer> CreateContainerLayer() override;
|
|
|
+ already_AddRefed<ImageLayer> CreateImageLayer() override;
|
|
|
+ already_AddRefed<ColorLayer> CreateColorLayer() override;
|
|
|
+ already_AddRefed<CanvasLayer> CreateCanvasLayer() override;
|
|
|
+ already_AddRefed<RefLayer> CreateRefLayer() override;
|
|
|
+- already_AddRefed<BorderLayer> CreateBorderLayer() override;
|
|
|
+
|
|
|
+ bool AreComponentAlphaLayersEnabled() override;
|
|
|
+ bool BlendingRequiresIntermediateSurface() override;
|
|
|
+
|
|
|
+ // HostLayerManager methods
|
|
|
+ void ForcePresent() override;
|
|
|
+ TextureFactoryIdentifier GetTextureFactoryIdentifier() override;
|
|
|
+ LayersBackend GetBackendType() override;
|
|
|
+diff --git a/gfx/layers/moz.build b/gfx/layers/moz.build
|
|
|
+--- a/gfx/layers/moz.build
|
|
|
++++ b/gfx/layers/moz.build
|
|
|
+@@ -331,32 +331,30 @@ UNIFIED_SOURCES += [
|
|
|
+ 'apz/util/ContentProcessController.cpp',
|
|
|
+ 'apz/util/DoubleTapToZoom.cpp',
|
|
|
+ 'apz/util/InputAPZContext.cpp',
|
|
|
+ 'apz/util/ScrollLinkedEffectDetector.cpp',
|
|
|
+ 'apz/util/TouchActionHelper.cpp',
|
|
|
+ 'AsyncCanvasRenderer.cpp',
|
|
|
+ 'AxisPhysicsModel.cpp',
|
|
|
+ 'AxisPhysicsMSDModel.cpp',
|
|
|
+- 'basic/BasicBorderLayer.cpp',
|
|
|
+ 'basic/BasicCanvasLayer.cpp',
|
|
|
+ 'basic/BasicColorLayer.cpp',
|
|
|
+ 'basic/BasicCompositor.cpp',
|
|
|
+ 'basic/BasicContainerLayer.cpp',
|
|
|
+ 'basic/BasicImages.cpp',
|
|
|
+ 'basic/BasicLayerManager.cpp',
|
|
|
+ 'basic/BasicLayersImpl.cpp',
|
|
|
+ 'basic/BasicPaintedLayer.cpp',
|
|
|
+ 'basic/TextureHostBasic.cpp',
|
|
|
+ 'BSPTree.cpp',
|
|
|
+ 'BufferTexture.cpp',
|
|
|
+ 'BufferUnrotate.cpp',
|
|
|
+ 'CanvasRenderer.cpp',
|
|
|
+ 'client/CanvasClient.cpp',
|
|
|
+- 'client/ClientBorderLayer.cpp',
|
|
|
+ 'client/ClientCanvasLayer.cpp',
|
|
|
+ 'client/ClientCanvasRenderer.cpp',
|
|
|
+ 'client/ClientColorLayer.cpp',
|
|
|
+ 'client/ClientContainerLayer.cpp',
|
|
|
+ 'client/ClientImageLayer.cpp',
|
|
|
+ 'client/ClientLayerManager.cpp',
|
|
|
+ 'client/ClientPaintedLayer.cpp',
|
|
|
+ 'client/ClientTiledPaintedLayer.cpp',
|
|
|
+diff --git a/gfx/layers/wr/WebRenderLayerManager.h b/gfx/layers/wr/WebRenderLayerManager.h
|
|
|
+--- a/gfx/layers/wr/WebRenderLayerManager.h
|
|
|
++++ b/gfx/layers/wr/WebRenderLayerManager.h
|
|
|
+@@ -81,17 +81,16 @@ public:
|
|
|
+ virtual const char* Name() const override { return "WebRender"; }
|
|
|
+
|
|
|
+ virtual void SetRoot(Layer* aLayer) override;
|
|
|
+
|
|
|
+ already_AddRefed<PaintedLayer> CreatePaintedLayer() override { return nullptr; }
|
|
|
+ already_AddRefed<ContainerLayer> CreateContainerLayer() override { return nullptr; }
|
|
|
+ already_AddRefed<ImageLayer> CreateImageLayer() override { return nullptr; }
|
|
|
+ already_AddRefed<ColorLayer> CreateColorLayer() override { return nullptr; }
|
|
|
+- already_AddRefed<BorderLayer> CreateBorderLayer() override { return nullptr; }
|
|
|
+ already_AddRefed<CanvasLayer> CreateCanvasLayer() override { return nullptr; }
|
|
|
+
|
|
|
+ virtual bool NeedsWidgetInvalidation() override { return false; }
|
|
|
+
|
|
|
+ virtual void SetLayerObserverEpoch(uint64_t aLayerObserverEpoch) override;
|
|
|
+
|
|
|
+ virtual void DidComposite(uint64_t aTransactionId,
|
|
|
+ const mozilla::TimeStamp& aCompositeStart,
|
|
|
+diff --git a/gfx/tests/gtest/TestLayers.cpp b/gfx/tests/gtest/TestLayers.cpp
|
|
|
+--- a/gfx/tests/gtest/TestLayers.cpp
|
|
|
++++ b/gfx/tests/gtest/TestLayers.cpp
|
|
|
+@@ -71,19 +71,16 @@ public:
|
|
|
+ }
|
|
|
+ virtual already_AddRefed<PaintedLayer> CreatePaintedLayer() {
|
|
|
+ RefPtr<PaintedLayer> layer = new TestPaintedLayer(this);
|
|
|
+ return layer.forget();
|
|
|
+ }
|
|
|
+ virtual already_AddRefed<ColorLayer> CreateColorLayer() {
|
|
|
+ MOZ_CRASH("Not implemented.");
|
|
|
+ }
|
|
|
+- virtual already_AddRefed<BorderLayer> CreateBorderLayer() {
|
|
|
+- MOZ_CRASH("Not implemented.");
|
|
|
+- }
|
|
|
+ virtual void SetRoot(Layer* aLayer) {}
|
|
|
+ virtual bool BeginTransactionWithTarget(gfxContext* aTarget) { return true; }
|
|
|
+ virtual already_AddRefed<CanvasLayer> CreateCanvasLayer() {
|
|
|
+ MOZ_CRASH("Not implemented.");
|
|
|
+ }
|
|
|
+ virtual void EndTransaction(DrawPaintedLayerCallback aCallback,
|
|
|
+ void* aCallbackData,
|
|
|
+ EndTransactionFlags aFlags = END_DEFAULT) {}
|
|
|
+diff --git a/gfx/thebes/gfxPrefs.h b/gfx/thebes/gfxPrefs.h
|
|
|
+--- a/gfx/thebes/gfxPrefs.h
|
|
|
++++ b/gfx/thebes/gfxPrefs.h
|
|
|
+@@ -540,17 +540,16 @@ private:
|
|
|
+ DECL_GFX_PREF(Once, "image.multithreaded_decoding.idle_timeout", ImageMTDecodingIdleTimeout, int32_t, -1);
|
|
|
+ DECL_GFX_PREF(Live, "image.webp.enabled", ImageWebPEnabled, bool, false);
|
|
|
+
|
|
|
+ DECL_GFX_PREF(Once, "layers.acceleration.disabled", LayersAccelerationDisabledDoNotUseDirectly, bool, false);
|
|
|
+ DECL_GFX_PREF(Live, "layers.acceleration.draw-fps", LayersDrawFPS, bool, false);
|
|
|
+ DECL_GFX_PREF(Live, "layers.acceleration.draw-fps.print-histogram", FPSPrintHistogram, bool, false);
|
|
|
+ DECL_GFX_PREF(Live, "layers.acceleration.draw-fps.write-to-file", WriteFPSToFile, bool, false);
|
|
|
+ DECL_GFX_PREF(Once, "layers.acceleration.force-enabled", LayersAccelerationForceEnabledDoNotUseDirectly, bool, false);
|
|
|
+- DECL_GFX_PREF(Live, "layers.advanced.border-layers", LayersAllowBorderLayers, bool, false);
|
|
|
+ DECL_GFX_PREF(Live, "layers.advanced.basic-layer.enabled", LayersAdvancedBasicLayerEnabled, bool, false);
|
|
|
+ DECL_GFX_PREF(Once, "layers.amd-switchable-gfx.enabled", LayersAMDSwitchableGfxEnabled, bool, false);
|
|
|
+ DECL_GFX_PREF(Once, "layers.async-pan-zoom.enabled", AsyncPanZoomEnabledDoNotUseDirectly, bool, true);
|
|
|
+ DECL_GFX_PREF(Live, "layers.bench.enabled", LayersBenchEnabled, bool, false);
|
|
|
+ DECL_GFX_PREF(Once, "layers.bufferrotation.enabled", BufferRotationEnabled, bool, true);
|
|
|
+ DECL_GFX_PREF(Live, "layers.child-process-shutdown", ChildProcessShutdown, bool, true);
|
|
|
+ #ifdef MOZ_GFX_OPTIMIZE_MOBILE
|
|
|
+ // If MOZ_GFX_OPTIMIZE_MOBILE is defined, we force component alpha off
|
|
|
+diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp
|
|
|
+--- a/layout/painting/nsDisplayList.cpp
|
|
|
++++ b/layout/painting/nsDisplayList.cpp
|
|
|
+@@ -5319,17 +5319,16 @@ nsDisplayCaret::CreateWebRenderCommands(
|
|
|
+ !BackfaceIsHidden(),
|
|
|
+ wr::ToColorF(color));
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ nsDisplayBorder::nsDisplayBorder(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
|
|
|
+ : nsDisplayItem(aBuilder, aFrame)
|
|
|
+- , mBorderIsEmpty(false)
|
|
|
+ {
|
|
|
+ MOZ_COUNT_CTOR(nsDisplayBorder);
|
|
|
+
|
|
|
+ mBounds = CalculateBounds<nsRect>(*mFrame->StyleBorder());
|
|
|
+ }
|
|
|
+
|
|
|
+ bool
|
|
|
+ nsDisplayBorder::IsInvisibleInRect(const nsRect& aRect) const
|
|
|
+@@ -5379,100 +5378,17 @@ nsDisplayBorder::ComputeInvalidationRegi
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ LayerState
|
|
|
+ nsDisplayBorder::GetLayerState(nsDisplayListBuilder* aBuilder,
|
|
|
+ LayerManager* aManager,
|
|
|
+ const ContainerLayerParameters& aParameters)
|
|
|
+ {
|
|
|
+- if (!ShouldUseAdvancedLayer(aManager, gfxPrefs::LayersAllowBorderLayers)) {
|
|
|
+- return LAYER_NONE;
|
|
|
+- }
|
|
|
+-
|
|
|
+- mBorderIsEmpty = false;
|
|
|
+- nsPoint offset = ToReferenceFrame();
|
|
|
+- Maybe<nsCSSBorderRenderer> br =
|
|
|
+- nsCSSRendering::CreateBorderRenderer(mFrame->PresContext(),
|
|
|
+- nullptr,
|
|
|
+- mFrame,
|
|
|
+- nsRect(),
|
|
|
+- nsRect(offset, mFrame->GetSize()),
|
|
|
+- mFrame->StyleContext(),
|
|
|
+- &mBorderIsEmpty,
|
|
|
+- mFrame->GetSkipSides());
|
|
|
+-
|
|
|
+- mBorderRenderer = Nothing();
|
|
|
+- mBorderImageRenderer = Nothing();
|
|
|
+- if (!br) {
|
|
|
+- if (mBorderIsEmpty) {
|
|
|
+- return LAYER_ACTIVE;
|
|
|
+- }
|
|
|
+- return LAYER_NONE;
|
|
|
+- }
|
|
|
+-
|
|
|
+- bool hasCompositeColors;
|
|
|
+- if (!br->AllBordersSolid(&hasCompositeColors) || hasCompositeColors) {
|
|
|
+- return LAYER_NONE;
|
|
|
+- }
|
|
|
+-
|
|
|
+- // We don't support this yet as we don't copy the values to
|
|
|
+- // the layer, and BasicBorderLayer doesn't support it yet.
|
|
|
+- if (!br->mNoBorderRadius) {
|
|
|
+- return LAYER_NONE;
|
|
|
+- }
|
|
|
+-
|
|
|
+- // We copy these values correctly to the layer, but BasicBorderLayer
|
|
|
+- // won't render them
|
|
|
+- if (!br->AreBorderSideFinalStylesSame(eSideBitsAll) ||
|
|
|
+- !br->AllBordersSameWidth()) {
|
|
|
+- return LAYER_NONE;
|
|
|
+- }
|
|
|
+-
|
|
|
+- NS_FOR_CSS_SIDES(i) {
|
|
|
+- if (br->mBorderStyles[i] == NS_STYLE_BORDER_STYLE_SOLID) {
|
|
|
+- mColors[i] = ToDeviceColor(br->mBorderColors[i]);
|
|
|
+- mWidths[i] = br->mBorderWidths[i];
|
|
|
+- mBorderStyles[i] = br->mBorderStyles[i];
|
|
|
+- } else {
|
|
|
+- mWidths[i] = 0;
|
|
|
+- }
|
|
|
+- }
|
|
|
+- NS_FOR_CSS_FULL_CORNERS(corner) {
|
|
|
+- mCorners[corner] = LayerSize(br->mBorderRadii[corner].width, br->mBorderRadii[corner].height);
|
|
|
+- }
|
|
|
+-
|
|
|
+- mRect = ViewAs<LayerPixel>(br->mOuterRect);
|
|
|
+- return LAYER_ACTIVE;
|
|
|
+-}
|
|
|
+-
|
|
|
+-already_AddRefed<Layer>
|
|
|
+-nsDisplayBorder::BuildLayer(nsDisplayListBuilder* aBuilder,
|
|
|
+- LayerManager* aManager,
|
|
|
+- const ContainerLayerParameters& aContainerParameters)
|
|
|
+-{
|
|
|
+- if (mBorderIsEmpty) {
|
|
|
+- return nullptr;
|
|
|
+- }
|
|
|
+-
|
|
|
+- RefPtr<BorderLayer> layer = static_cast<BorderLayer*>
|
|
|
+- (aManager->GetLayerBuilder()->GetLeafLayerFor(aBuilder, this));
|
|
|
+- if (!layer) {
|
|
|
+- layer = aManager->CreateBorderLayer();
|
|
|
+- if (!layer)
|
|
|
+- return nullptr;
|
|
|
+- }
|
|
|
+- layer->SetRect(mRect);
|
|
|
+- layer->SetCornerRadii(mCorners);
|
|
|
+- layer->SetColors(mColors);
|
|
|
+- layer->SetWidths(mWidths);
|
|
|
+- layer->SetStyles(mBorderStyles);
|
|
|
+- layer->SetBaseTransform(gfx::Matrix4x4::Translation(aContainerParameters.mOffset.x,
|
|
|
+- aContainerParameters.mOffset.y, 0));
|
|
|
+- return layer.forget();
|
|
|
++ return LAYER_NONE;
|
|
|
+ }
|
|
|
+
|
|
|
+ bool
|
|
|
+ nsDisplayBorder::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
|
|
|
+ mozilla::wr::IpcResourceUpdateQueue& aResources,
|
|
|
+ const StackingContextHelper& aSc,
|
|
|
+ mozilla::layers::WebRenderLayerManager* aManager,
|
|
|
+ nsDisplayListBuilder* aDisplayListBuilder)
|
|
|
+@@ -5485,137 +5401,16 @@ nsDisplayBorder::CreateWebRenderCommands
|
|
|
+ aBuilder,
|
|
|
+ aResources,
|
|
|
+ aSc,
|
|
|
+ aManager,
|
|
|
+ aDisplayListBuilder);
|
|
|
+ };
|
|
|
+
|
|
|
+ void
|
|
|
+-nsDisplayBorder::CreateBorderImageWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
|
|
|
+- mozilla::wr::IpcResourceUpdateQueue& aResources,
|
|
|
+- const StackingContextHelper& aSc,
|
|
|
+- mozilla::layers::WebRenderLayerManager* aManager,
|
|
|
+- nsDisplayListBuilder* aDisplayListBuilder)
|
|
|
+-{
|
|
|
+- MOZ_ASSERT(mBorderImageRenderer);
|
|
|
+- if (!mBorderImageRenderer->mImageRenderer.IsReady()) {
|
|
|
+- return;
|
|
|
+- }
|
|
|
+-
|
|
|
+- float widths[4];
|
|
|
+- float slice[4];
|
|
|
+- float outset[4];
|
|
|
+- const int32_t appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
|
|
|
+- 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::LayoutRect dest = aSc.ToRelativeLayoutRect(destRect);
|
|
|
+-
|
|
|
+- wr::LayoutRect clip = dest;
|
|
|
+- if (!mBorderImageRenderer->mClip.IsEmpty()) {
|
|
|
+- LayoutDeviceRect clipRect = LayoutDeviceRect::FromAppUnits(
|
|
|
+- mBorderImageRenderer->mClip, appUnitsPerDevPixel);
|
|
|
+- clip = aSc.ToRelativeLayoutRect(clipRect);
|
|
|
+- }
|
|
|
+-
|
|
|
+- switch (mBorderImageRenderer->mImageRenderer.GetType()) {
|
|
|
+- case eStyleImageType_Image:
|
|
|
+- {
|
|
|
+- uint32_t flags = imgIContainer::FLAG_ASYNC_NOTIFY;
|
|
|
+- if (aDisplayListBuilder->IsPaintingToWindow()) {
|
|
|
+- flags |= imgIContainer::FLAG_HIGH_QUALITY_SCALING;
|
|
|
+- }
|
|
|
+- if (aDisplayListBuilder->ShouldSyncDecodeImages()) {
|
|
|
+- flags |= imgIContainer::FLAG_SYNC_DECODE;
|
|
|
+- }
|
|
|
+-
|
|
|
+- RefPtr<imgIContainer> img = mBorderImageRenderer->mImageRenderer.GetImage();
|
|
|
+- Maybe<SVGImageContext> svgContext;
|
|
|
+- gfx::IntSize decodeSize =
|
|
|
+- nsLayoutUtils::ComputeImageContainerDrawingParameters(img, mFrame, destRect,
|
|
|
+- aSc, flags, svgContext);
|
|
|
+- RefPtr<layers::ImageContainer> container =
|
|
|
+- img->GetImageContainerAtSize(aManager, decodeSize, svgContext, flags);
|
|
|
+- if (!container) {
|
|
|
+- return;
|
|
|
+- }
|
|
|
+-
|
|
|
+- gfx::IntSize size;
|
|
|
+- Maybe<wr::ImageKey> key = aManager->CommandBuilder().CreateImageKey(this, container, aBuilder,
|
|
|
+- aResources, aSc, size, Nothing());
|
|
|
+- if (key.isNothing()) {
|
|
|
+- return;
|
|
|
+- }
|
|
|
+-
|
|
|
+- aBuilder.PushBorderImage(dest,
|
|
|
+- clip,
|
|
|
+- !BackfaceIsHidden(),
|
|
|
+- wr::ToBorderWidths(widths[0], widths[1], widths[2], widths[3]),
|
|
|
+- key.value(),
|
|
|
+- wr::ToNinePatchDescriptor(
|
|
|
+- (float)(mBorderImageRenderer->mImageSize.width) / appUnitsPerDevPixel,
|
|
|
+- (float)(mBorderImageRenderer->mImageSize.height) / appUnitsPerDevPixel,
|
|
|
+- wr::ToSideOffsets2D_u32(slice[0], slice[1], slice[2], slice[3])),
|
|
|
+- wr::ToSideOffsets2D_f32(outset[0], outset[1], outset[2], outset[3]),
|
|
|
+- wr::ToRepeatMode(mBorderImageRenderer->mRepeatModeHorizontal),
|
|
|
+- wr::ToRepeatMode(mBorderImageRenderer->mRepeatModeVertical));
|
|
|
+- break;
|
|
|
+- }
|
|
|
+- case eStyleImageType_Gradient:
|
|
|
+- {
|
|
|
+- RefPtr<nsStyleGradient> gradientData = mBorderImageRenderer->mImageRenderer.GetGradientData();
|
|
|
+- nsCSSGradientRenderer renderer =
|
|
|
+- nsCSSGradientRenderer::Create(mFrame->PresContext(), gradientData,
|
|
|
+- mBorderImageRenderer->mImageSize);
|
|
|
+-
|
|
|
+- wr::ExtendMode extendMode;
|
|
|
+- nsTArray<wr::GradientStop> stops;
|
|
|
+- LayoutDevicePoint lineStart;
|
|
|
+- LayoutDevicePoint lineEnd;
|
|
|
+- LayoutDeviceSize gradientRadius;
|
|
|
+- renderer.BuildWebRenderParameters(1.0, extendMode, stops, lineStart, lineEnd, gradientRadius);
|
|
|
+-
|
|
|
+- if (gradientData->mShape == NS_STYLE_GRADIENT_SHAPE_LINEAR) {
|
|
|
+- LayoutDevicePoint startPoint = LayoutDevicePoint(dest.origin.x, dest.origin.y) + lineStart;
|
|
|
+- LayoutDevicePoint endPoint = LayoutDevicePoint(dest.origin.x, dest.origin.y) + lineEnd;
|
|
|
+-
|
|
|
+- aBuilder.PushBorderGradient(dest,
|
|
|
+- clip,
|
|
|
+- !BackfaceIsHidden(),
|
|
|
+- wr::ToBorderWidths(widths[0], widths[1], widths[2], widths[3]),
|
|
|
+- wr::ToLayoutPoint(startPoint),
|
|
|
+- wr::ToLayoutPoint(endPoint),
|
|
|
+- stops,
|
|
|
+- extendMode,
|
|
|
+- wr::ToSideOffsets2D_f32(outset[0], outset[1], outset[2], outset[3]));
|
|
|
+- } else {
|
|
|
+- aBuilder.PushBorderRadialGradient(dest,
|
|
|
+- clip,
|
|
|
+- !BackfaceIsHidden(),
|
|
|
+- wr::ToBorderWidths(widths[0], widths[1], widths[2], widths[3]),
|
|
|
+- wr::ToLayoutPoint(lineStart),
|
|
|
+- wr::ToLayoutSize(gradientRadius),
|
|
|
+- stops,
|
|
|
+- extendMode,
|
|
|
+- wr::ToSideOffsets2D_f32(outset[0], outset[1], outset[2], outset[3]));
|
|
|
+- }
|
|
|
+- break;
|
|
|
+- }
|
|
|
+- default:
|
|
|
+- MOZ_ASSERT_UNREACHABLE("Unsupport border image type");
|
|
|
+- }
|
|
|
+-}
|
|
|
+-
|
|
|
+-void
|
|
|
+ nsDisplayBorder::Paint(nsDisplayListBuilder* aBuilder,
|
|
|
+ gfxContext* aCtx) {
|
|
|
+ nsPoint offset = ToReferenceFrame();
|
|
|
+
|
|
|
+ PaintBorderFlags flags = aBuilder->ShouldSyncDecodeImages()
|
|
|
+ ? PaintBorderFlags::SYNC_DECODE_IMAGES
|
|
|
+ : PaintBorderFlags();
|
|
|
+
|
|
|
+diff --git a/layout/painting/nsDisplayList.h b/layout/painting/nsDisplayList.h
|
|
|
+--- a/layout/painting/nsDisplayList.h
|
|
|
++++ b/layout/painting/nsDisplayList.h
|
|
|
+@@ -3511,19 +3511,16 @@ public:
|
|
|
+
|
|
|
+ virtual bool IsInvisibleInRect(const nsRect& aRect) const override;
|
|
|
+ virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder,
|
|
|
+ bool* aSnap) const override;
|
|
|
+ virtual LayerState GetLayerState(nsDisplayListBuilder* aBuilder,
|
|
|
+ LayerManager* aManager,
|
|
|
+ const ContainerLayerParameters& aParameters) override;
|
|
|
+
|
|
|
+- virtual already_AddRefed<Layer> BuildLayer(nsDisplayListBuilder* aBuilder,
|
|
|
+- LayerManager* aManager,
|
|
|
+- const ContainerLayerParameters& aContainerParameters) override;
|
|
|
+ virtual bool CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
|
|
|
+ mozilla::wr::IpcResourceUpdateQueue& aResources,
|
|
|
+ const StackingContextHelper& aSc,
|
|
|
+ mozilla::layers::WebRenderLayerManager* aManager,
|
|
|
+ nsDisplayListBuilder* aDisplayListBuilder) override;
|
|
|
+
|
|
|
+ virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
|
|
|
+
|
|
|
+@@ -3538,21 +3535,16 @@ public:
|
|
|
+ virtual nsRegion GetTightBounds(nsDisplayListBuilder* aBuilder,
|
|
|
+ bool* aSnap) const override
|
|
|
+ {
|
|
|
+ *aSnap = true;
|
|
|
+ return CalculateBounds<nsRegion>(*mFrame->StyleBorder());
|
|
|
+ }
|
|
|
+
|
|
|
+ protected:
|
|
|
+- void CreateBorderImageWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
|
|
|
+- mozilla::wr::IpcResourceUpdateQueue& aResource,
|
|
|
+- const StackingContextHelper& aSc,
|
|
|
+- mozilla::layers::WebRenderLayerManager* aManager,
|
|
|
+- nsDisplayListBuilder* aDisplayListBuilder);
|
|
|
+ template<typename T>
|
|
|
+ T CalculateBounds(const nsStyleBorder& aStyleBorder) const
|
|
|
+ {
|
|
|
+ nsRect borderBounds(ToReferenceFrame(), mFrame->GetSize());
|
|
|
+ if (aStyleBorder.IsBorderImageLoaded()) {
|
|
|
+ borderBounds.Inflate(aStyleBorder.GetImageOutset());
|
|
|
+ return borderBounds;
|
|
|
+ } else {
|
|
|
+@@ -3589,27 +3581,17 @@ protected:
|
|
|
+ nsSize cornerSize(radii[mozilla::eCornerBottomLeftX], radii[mozilla::eCornerBottomLeftY]);
|
|
|
+ result.OrWith(nsRect(borderBounds.BottomLeft() - nsPoint(0, cornerSize.height), cornerSize));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+- mozilla::Array<mozilla::gfx::Color, 4> mColors;
|
|
|
+- mozilla::Array<mozilla::LayerCoord, 4> mWidths;
|
|
|
+- mozilla::Array<mozilla::LayerSize, 4> mCorners;
|
|
|
+- mozilla::Array<uint8_t, 4> mBorderStyles;
|
|
|
+- mozilla::LayerRect mRect;
|
|
|
+-
|
|
|
+- mozilla::Maybe<nsCSSBorderRenderer> mBorderRenderer;
|
|
|
+- mozilla::Maybe<nsCSSBorderImageRenderer> mBorderImageRenderer;
|
|
|
+-
|
|
|
+ nsRect mBounds;
|
|
|
+- bool mBorderIsEmpty;
|
|
|
+ };
|
|
|
+
|
|
|
+ /**
|
|
|
+ * A simple display item that just renders a solid color across the
|
|
|
+ * specified bounds. For canvas frames (in the CSS sense) we split off the
|
|
|
+ * drawing of the background color into this class (from nsDisplayBackground
|
|
|
+ * via nsDisplayCanvasBackground). This is done so that we can always draw a
|
|
|
+ * background color to avoid ugly flashes of white when we can't draw a full
|