зеркало из https://github.com/mozilla/gecko-dev.git
Merge mozilla-central to autoland on a CLOSED TREE
--HG-- extra : amend_source : 4c359cbd3980d22d601fa80681a1e73e49979665
This commit is contained in:
Коммит
cf6a9d902d
|
@ -25,7 +25,6 @@
|
|||
#include "mozilla/layers/LayersTypes.h"
|
||||
#include "nsRect.h"
|
||||
#include "nsRegion.h"
|
||||
#include "mozilla/Array.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
@ -1285,26 +1284,6 @@ struct ParamTraits<mozilla::gfx::Glyph>
|
|||
}
|
||||
};
|
||||
|
||||
template<typename T, size_t Length>
|
||||
struct ParamTraits<mozilla::Array<T, Length>>
|
||||
{
|
||||
typedef mozilla::Array<T, Length> paramType;
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
for (size_t i = 0; i < Length; i++) {
|
||||
WriteParam(aMsg, aParam[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) {
|
||||
for (size_t i = 0; i < Length; i++) {
|
||||
if (!ReadParam(aMsg, aIter, &aResult[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} /* namespace IPC */
|
||||
|
||||
#endif /* __GFXMESSAGEUTILS_H__ */
|
||||
|
|
|
@ -610,7 +610,6 @@ CloneLayerTreePropertiesInternal(Layer* aRoot, bool aIsMask /* = false */)
|
|||
case Layer::TYPE_SHADOW:
|
||||
case Layer::TYPE_PAINTED:
|
||||
case Layer::TYPE_TEXT:
|
||||
case Layer::TYPE_BORDER:
|
||||
return MakeUnique<LayerPropertiesBase>(aRoot);
|
||||
}
|
||||
|
||||
|
|
|
@ -2217,18 +2217,6 @@ TextLayer::DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent)
|
|||
layer->set_type(LayersPacket::Layer::TextLayer);
|
||||
}
|
||||
|
||||
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)
|
||||
, mPreTransCallback(nullptr)
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "gfxRect.h" // for gfxRect
|
||||
#include "gfx2DGlue.h"
|
||||
#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2, etc
|
||||
#include "mozilla/Array.h"
|
||||
#include "mozilla/DebugOnly.h" // for DebugOnly
|
||||
#include "mozilla/EventForwards.h" // for nsPaintEvent
|
||||
#include "mozilla/Maybe.h" // for Maybe
|
||||
|
@ -88,7 +87,6 @@ class ImageLayer;
|
|||
class ColorLayer;
|
||||
class TextLayer;
|
||||
class CanvasLayer;
|
||||
class BorderLayer;
|
||||
class ReadbackLayer;
|
||||
class ReadbackProcessor;
|
||||
class RefLayer;
|
||||
|
@ -409,11 +407,6 @@ public:
|
|||
* Create a TextLayer for this manager's layer tree.
|
||||
*/
|
||||
virtual already_AddRefed<TextLayer> CreateTextLayer() = 0;
|
||||
/**
|
||||
* CONSTRUCTION PHASE ONLY
|
||||
* Create a BorderLayer for this manager's layer tree.
|
||||
*/
|
||||
virtual already_AddRefed<BorderLayer> CreateBorderLayer() { return nullptr; }
|
||||
/**
|
||||
* CONSTRUCTION PHASE ONLY
|
||||
* Create a CanvasLayer for this manager's layer tree.
|
||||
|
@ -759,7 +752,6 @@ public:
|
|||
TYPE_CONTAINER,
|
||||
TYPE_IMAGE,
|
||||
TYPE_TEXT,
|
||||
TYPE_BORDER,
|
||||
TYPE_READBACK,
|
||||
TYPE_REF,
|
||||
TYPE_SHADOW,
|
||||
|
@ -1544,12 +1536,6 @@ public:
|
|||
*/
|
||||
virtual TextLayer* AsTextLayer() { return nullptr; }
|
||||
|
||||
/**
|
||||
* Dynamic cast to a Border. Returns null if this is not a
|
||||
* ColorLayer.
|
||||
*/
|
||||
virtual BorderLayer* AsBorderLayer() { return nullptr; }
|
||||
|
||||
/**
|
||||
* Dynamic cast to a LayerComposite. Return null if this is not a
|
||||
* LayerComposite. Can be used anytime.
|
||||
|
@ -2405,73 +2391,6 @@ protected:
|
|||
RefPtr<gfx::ScaledFont> mFont;
|
||||
};
|
||||
|
||||
/**
|
||||
* 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();
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
/**
|
||||
* A Layer for HTML Canvas elements. It's backed by either a
|
||||
* gfxASurface or a GLContext (for WebGL layers), and has some control
|
||||
|
|
|
@ -242,10 +242,6 @@ typedef gfx::Matrix4x4Typed<LayerPixel, CSSTransformedLayerPixel> CSSTransformMa
|
|||
typedef gfx::Matrix4x4Typed<ParentLayerPixel, ParentLayerPixel> AsyncTransformComponentMatrix;
|
||||
typedef gfx::Matrix4x4Typed<CSSTransformedLayerPixel, ParentLayerPixel> AsyncTransformMatrix;
|
||||
|
||||
typedef Array<gfx::Color, 4> BorderColors;
|
||||
typedef Array<LayerSize, 4> BorderCorners;
|
||||
typedef Array<LayerCoord, 4> BorderWidths;
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
||||
|
|
|
@ -1,83 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* 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
|
|
@ -115,7 +115,6 @@ public:
|
|||
virtual already_AddRefed<CanvasLayer> CreateCanvasLayer() override;
|
||||
virtual already_AddRefed<ColorLayer> CreateColorLayer() override;
|
||||
virtual already_AddRefed<TextLayer> CreateTextLayer() override;
|
||||
virtual already_AddRefed<BorderLayer> CreateBorderLayer() override;
|
||||
virtual already_AddRefed<ReadbackLayer> CreateReadbackLayer() override;
|
||||
virtual ImageFactory *GetImageFactory();
|
||||
|
||||
|
|
|
@ -1,79 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* 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)
|
||||
{
|
||||
NS_ASSERTION(ClientManager()->InConstruction(),
|
||||
"Can only set properties in construction phase");
|
||||
BorderLayer::SetVisibleRegion(aRegion);
|
||||
}
|
||||
|
||||
virtual void RenderLayer()
|
||||
{
|
||||
RenderMaskLayers(this);
|
||||
}
|
||||
|
||||
virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
|
||||
{
|
||||
aAttrs = BorderLayerAttributes(mRect, mColors, mCorners, mWidths);
|
||||
}
|
||||
|
||||
virtual Layer* AsLayer() { return this; }
|
||||
virtual ShadowableLayer* AsShadowableLayer() { return this; }
|
||||
|
||||
virtual void Disconnect()
|
||||
{
|
||||
ClientLayer::Disconnect();
|
||||
}
|
||||
|
||||
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
|
|
@ -19,8 +19,6 @@
|
|||
#include "nsRect.h" // for mozilla::gfx::IntRect
|
||||
#include "nsXULAppAPI.h" // for XRE_GetProcessType, etc
|
||||
#include "gfxPrefs.h" // for WebGLForceLayersReadback
|
||||
#include "gfxUtils.h"
|
||||
#include "mozilla/layers/TextureClientSharedSurface.h"
|
||||
|
||||
using namespace mozilla::gfx;
|
||||
using namespace mozilla::gl;
|
||||
|
|
|
@ -88,7 +88,6 @@ public:
|
|||
virtual already_AddRefed<ReadbackLayer> CreateReadbackLayer() override;
|
||||
virtual already_AddRefed<ColorLayer> CreateColorLayer() override;
|
||||
virtual already_AddRefed<TextLayer> CreateTextLayer() override;
|
||||
virtual already_AddRefed<BorderLayer> CreateBorderLayer() override;
|
||||
virtual already_AddRefed<RefLayer> CreateRefLayer() override;
|
||||
|
||||
void UpdateTextureFactoryIdentifier(const TextureFactoryIdentifier& aNewIdentifier);
|
||||
|
|
|
@ -1164,49 +1164,6 @@ public:
|
|||
virtual const char* Name() const override { return "TextLayerComposite"; }
|
||||
};
|
||||
|
||||
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) 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()
|
||||
{
|
||||
|
@ -1277,16 +1234,6 @@ LayerManagerComposite::CreateTextLayer()
|
|||
return RefPtr<TextLayer>(new TextLayerComposite(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)
|
||||
|
|
|
@ -240,7 +240,6 @@ public:
|
|||
virtual already_AddRefed<ImageLayer> CreateImageLayer() override;
|
||||
virtual already_AddRefed<ColorLayer> CreateColorLayer() override;
|
||||
virtual already_AddRefed<TextLayer> CreateTextLayer() override;
|
||||
virtual already_AddRefed<BorderLayer> CreateBorderLayer() override;
|
||||
virtual already_AddRefed<CanvasLayer> CreateCanvasLayer() override;
|
||||
virtual already_AddRefed<RefLayer> CreateRefLayer() override;
|
||||
|
||||
|
|
|
@ -337,15 +337,6 @@ LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
|
|||
updateHitTestingTree = true;
|
||||
break;
|
||||
}
|
||||
case Edit::TOpCreateBorderLayer: {
|
||||
MOZ_LAYERS_LOG(("[ParentSide] CreateTextLayer"));
|
||||
|
||||
RefPtr<BorderLayer> layer = layer_manager()->CreateBorderLayer();
|
||||
AsLayerComposite(edit.get_OpCreateBorderLayer())->Bind(layer);
|
||||
|
||||
updateHitTestingTree = true;
|
||||
break;
|
||||
}
|
||||
case Edit::TOpCreateCanvasLayer: {
|
||||
MOZ_LAYERS_LOG(("[ParentSide] CreateCanvasLayer"));
|
||||
|
||||
|
@ -489,19 +480,6 @@ LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
|
|||
textLayer->SetScaledFont(reinterpret_cast<gfx::ScaledFont*>(specific.get_TextLayerAttributes().scaledFont()));
|
||||
break;
|
||||
}
|
||||
case Specific::TBorderLayerAttributes: {
|
||||
MOZ_LAYERS_LOG(("[ParentSide] border layer"));
|
||||
|
||||
BorderLayer* borderLayer = layerParent->AsBorderLayer();
|
||||
if (!borderLayer) {
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
}
|
||||
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"));
|
||||
|
||||
|
|
|
@ -33,8 +33,6 @@ using mozilla::dom::ScreenOrientationInternal from "mozilla/dom/ScreenOrientatio
|
|||
using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h";
|
||||
using mozilla::LayerMargin from "Units.h";
|
||||
using mozilla::LayerPoint from "Units.h";
|
||||
using mozilla::LayerCoord from "Units.h";
|
||||
using mozilla::LayerSize from "Units.h";
|
||||
using mozilla::LayerRect from "Units.h";
|
||||
using mozilla::LayerIntRegion from "Units.h";
|
||||
using mozilla::ParentLayerIntRect from "Units.h";
|
||||
|
@ -48,9 +46,6 @@ 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";
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
@ -68,7 +63,6 @@ struct OpCreateContainerLayer { PLayer layer; };
|
|||
struct OpCreateImageLayer { PLayer layer; };
|
||||
struct OpCreateColorLayer { PLayer layer; };
|
||||
struct OpCreateTextLayer { PLayer layer; };
|
||||
struct OpCreateBorderLayer { PLayer layer; };
|
||||
struct OpCreateCanvasLayer { PLayer layer; };
|
||||
struct OpCreateRefLayer { PLayer layer; };
|
||||
|
||||
|
@ -282,12 +276,6 @@ struct RefLayerAttributes {
|
|||
EventRegionsOverride eventRegionsOverride;
|
||||
};
|
||||
struct ImageLayerAttributes { SamplingFilter samplingFilter; IntSize scaleToSize; ScaleMode scaleMode; };
|
||||
struct BorderLayerAttributes {
|
||||
LayerRect rect;
|
||||
BorderColors colors;
|
||||
BorderCorners corners;
|
||||
BorderWidths widths;
|
||||
};
|
||||
|
||||
union SpecificLayerAttributes {
|
||||
null_t;
|
||||
|
@ -298,7 +286,6 @@ union SpecificLayerAttributes {
|
|||
TextLayerAttributes;
|
||||
RefLayerAttributes;
|
||||
ImageLayerAttributes;
|
||||
BorderLayerAttributes;
|
||||
};
|
||||
|
||||
struct LayerAttributes {
|
||||
|
@ -466,7 +453,6 @@ union Edit {
|
|||
OpCreateImageLayer;
|
||||
OpCreateColorLayer;
|
||||
OpCreateTextLayer;
|
||||
OpCreateBorderLayer;
|
||||
OpCreateCanvasLayer;
|
||||
OpCreateRefLayer;
|
||||
|
||||
|
|
|
@ -112,14 +112,6 @@ ShadowLayerParent::AsTextLayer() const
|
|||
: nullptr;
|
||||
}
|
||||
|
||||
BorderLayer*
|
||||
ShadowLayerParent::AsBorderLayer() const
|
||||
{
|
||||
return mLayer && mLayer->GetType() == Layer::TYPE_BORDER
|
||||
? static_cast<BorderLayer*>(mLayer.get())
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
ShadowLayerParent::ActorDestroy(ActorDestroyReason why)
|
||||
{
|
||||
|
|
|
@ -43,7 +43,6 @@ public:
|
|||
ColorLayer* AsColorLayer() const;
|
||||
TextLayer* AsTextLayer() const;
|
||||
ImageLayer* AsImageLayer() const;
|
||||
BorderLayer* AsBorderLayer() const;
|
||||
RefLayer* AsRefLayer() const;
|
||||
PaintedLayer* AsPaintedLayer() const;
|
||||
|
||||
|
|
|
@ -271,11 +271,6 @@ ShadowLayerForwarder::CreatedTextLayer(ShadowableLayer* aColor)
|
|||
CreatedLayer<OpCreateTextLayer>(mTxn, aColor);
|
||||
}
|
||||
void
|
||||
ShadowLayerForwarder::CreatedBorderLayer(ShadowableLayer* aBorder)
|
||||
{
|
||||
CreatedLayer<OpCreateBorderLayer>(mTxn, aBorder);
|
||||
}
|
||||
void
|
||||
ShadowLayerForwarder::CreatedCanvasLayer(ShadowableLayer* aCanvas)
|
||||
{
|
||||
CreatedLayer<OpCreateCanvasLayer>(mTxn, aCanvas);
|
||||
|
|
|
@ -210,7 +210,6 @@ public:
|
|||
void CreatedCanvasLayer(ShadowableLayer* aCanvas);
|
||||
void CreatedRefLayer(ShadowableLayer* aRef);
|
||||
void CreatedTextLayer(ShadowableLayer* aRef);
|
||||
void CreatedBorderLayer(ShadowableLayer* aRef);
|
||||
|
||||
/**
|
||||
* At least one attribute of |aMutant| has changed, and |aMutant|
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace layers {
|
|||
|
||||
using namespace mozilla::ipc;
|
||||
using namespace mozilla::gfx;
|
||||
using namespace mozilla::media;
|
||||
|
||||
|
||||
static VideoBridgeParent* sVideoBridgeSingleton;
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#define gfx_layers_ipc_VideoBridgeParent_h_
|
||||
|
||||
#include "mozilla/layers/PVideoBridgeParent.h"
|
||||
#include "mozilla/layers/ISurfaceAllocator.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
|
|
@ -274,7 +274,6 @@ UNIFIED_SOURCES += [
|
|||
'AsyncCanvasRenderer.cpp',
|
||||
'AxisPhysicsModel.cpp',
|
||||
'AxisPhysicsMSDModel.cpp',
|
||||
'basic/BasicBorderLayer.cpp',
|
||||
'basic/BasicCanvasLayer.cpp',
|
||||
'basic/BasicColorLayer.cpp',
|
||||
'basic/BasicCompositor.cpp',
|
||||
|
@ -289,7 +288,6 @@ UNIFIED_SOURCES += [
|
|||
'BufferTexture.cpp',
|
||||
'BufferUnrotate.cpp',
|
||||
'client/CanvasClient.cpp',
|
||||
'client/ClientBorderLayer.cpp',
|
||||
'client/ClientCanvasLayer.cpp',
|
||||
'client/ClientColorLayer.cpp',
|
||||
'client/ClientContainerLayer.cpp',
|
||||
|
|
|
@ -447,7 +447,6 @@ private:
|
|||
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.text-layers", LayersAllowTextLayers, bool, false);
|
||||
DECL_GFX_PREF(Once, "layers.allow-d3d9-fallback", LayersAllowD3D9Fallback, bool, false);
|
||||
DECL_GFX_PREF(Once, "layers.amd-switchable-gfx.enabled", LayersAMDSwitchableGfxEnabled, bool, false);
|
||||
|
|
|
@ -301,7 +301,7 @@ public:
|
|||
nsStyleBorder styleBorder = *mFrame->StyleBorder();
|
||||
nsMathMLmtdFrame* frame = static_cast<nsMathMLmtdFrame*>(mFrame);
|
||||
ApplyBorderToStyle(frame, styleBorder);
|
||||
nsRect bounds = CalculateBounds(styleBorder).GetBounds();
|
||||
nsRect bounds = CalculateBounds(styleBorder);
|
||||
nsMargin overflow = ComputeBorderOverflow(frame, styleBorder);
|
||||
bounds.Inflate(overflow);
|
||||
return bounds;
|
||||
|
|
|
@ -1117,14 +1117,6 @@ public:
|
|||
return aRect.ScaleToOutsidePixels(mParameters.mXScale, mParameters.mYScale,
|
||||
mAppUnitsPerDevPixel);
|
||||
}
|
||||
nsIntRegion ScaleToOutsidePixels(const nsRegion& aRegion, bool aSnap = false) const
|
||||
{
|
||||
if (aSnap && mSnappingEnabled) {
|
||||
return ScaleRegionToNearestPixels(aRegion);
|
||||
}
|
||||
return aRegion.ScaleToOutsidePixels(mParameters.mXScale, mParameters.mYScale,
|
||||
mAppUnitsPerDevPixel);
|
||||
}
|
||||
nsIntRect ScaleToInsidePixels(const nsRect& aRect, bool aSnap = false) const
|
||||
{
|
||||
if (aSnap && mSnappingEnabled) {
|
||||
|
@ -4341,14 +4333,6 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList)
|
|||
SetupMaskLayerForCSSMask(ownLayer, maskItem);
|
||||
}
|
||||
|
||||
// Convert the visible rect to a region and give the item
|
||||
// a chance to try restrict it further.
|
||||
nsIntRegion itemVisibleRegion = itemVisibleRect;
|
||||
nsRegion tightBounds = item->GetTightBounds(mBuilder, &snap);
|
||||
if (!tightBounds.IsEmpty()) {
|
||||
itemVisibleRegion.AndWith(ScaleToOutsidePixels(tightBounds, snap));
|
||||
}
|
||||
|
||||
ContainerLayer* oldContainer = ownLayer->GetParent();
|
||||
if (oldContainer && oldContainer != mContainerLayer) {
|
||||
oldContainer->RemoveChild(ownLayer);
|
||||
|
@ -4387,7 +4371,7 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList)
|
|||
newLayerEntry->mVisibleRegion =
|
||||
item->GetVisibleRectForChildren().ToOutsidePixels(mAppUnitsPerDevPixel);
|
||||
} else {
|
||||
newLayerEntry->mVisibleRegion = itemVisibleRegion;
|
||||
newLayerEntry->mVisibleRegion = itemVisibleRect;
|
||||
}
|
||||
newLayerEntry->mOpaqueRegion = ComputeOpaqueRect(item,
|
||||
animatedGeometryRoot, layerClip, aList,
|
||||
|
@ -4400,7 +4384,7 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList)
|
|||
item->Frame()->HasPerspective());
|
||||
const nsIntRegion &visible = useChildrenVisible ?
|
||||
item->GetVisibleRectForChildren().ToOutsidePixels(mAppUnitsPerDevPixel):
|
||||
itemVisibleRegion;
|
||||
itemVisibleRect;
|
||||
|
||||
SetOuterVisibleRegionForLayer(ownLayer, visible,
|
||||
layerContentsVisibleRect.width >= 0 ? &layerContentsVisibleRect : nullptr,
|
||||
|
@ -4701,13 +4685,6 @@ FrameLayerBuilder::AddPaintedDisplayItem(PaintedLayerData* aLayerData,
|
|||
nsRect visibleRect =
|
||||
aItem->GetVisibleRect().Intersect(aItem->GetBounds(mDisplayListBuilder, &snap));
|
||||
nsIntRegion rgn = visibleRect.ToOutsidePixels(paintedData->mAppUnitsPerDevPixel);
|
||||
|
||||
// Convert the visible rect to a region and give the item
|
||||
// a chance to try restrict it further.
|
||||
nsRegion tightBounds = aItem->GetTightBounds(mDisplayListBuilder, &snap);
|
||||
if (!tightBounds.IsEmpty()) {
|
||||
rgn.AndWith(tightBounds.ToOutsidePixels(paintedData->mAppUnitsPerDevPixel));
|
||||
}
|
||||
SetOuterVisibleRegion(tmpLayer, &rgn);
|
||||
|
||||
// If BuildLayer didn't call BuildContainerLayerFor, then our new layer won't have been
|
||||
|
|
|
@ -673,142 +673,14 @@ nsCSSRendering::PaintBorder(nsPresContext* aPresContext,
|
|||
nsCSSProps::SubpropertyEntryFor(eCSSProperty_border_color)[side]);
|
||||
newStyleBorder.mBorderColor[side] = StyleComplexColor::FromColor(color);
|
||||
}
|
||||
return PaintBorderWithStyleBorder(aPresContext, aRenderingContext, aForFrame,
|
||||
aDirtyRect, aBorderArea, newStyleBorder,
|
||||
aStyleContext, aFlags, aSkipSides);
|
||||
DrawResult result =
|
||||
PaintBorderWithStyleBorder(aPresContext, aRenderingContext, aForFrame,
|
||||
aDirtyRect, aBorderArea, newStyleBorder,
|
||||
aStyleContext, aFlags, aSkipSides);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Maybe<nsCSSBorderRenderer>
|
||||
nsCSSRendering::CreateBorderRenderer(nsPresContext* aPresContext,
|
||||
DrawTarget* aDrawTarget,
|
||||
nsIFrame* aForFrame,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aBorderArea,
|
||||
nsStyleContext* aStyleContext,
|
||||
Sides aSkipSides)
|
||||
{
|
||||
nsStyleContext *styleIfVisited = aStyleContext->GetStyleIfVisited();
|
||||
const nsStyleBorder *styleBorder = aStyleContext->StyleBorder();
|
||||
// Don't check RelevantLinkVisited here, since we want to take the
|
||||
// same amount of time whether or not it's true.
|
||||
if (!styleIfVisited) {
|
||||
return CreateBorderRendererWithStyleBorder(aPresContext, aDrawTarget,
|
||||
aForFrame, aDirtyRect,
|
||||
aBorderArea, *styleBorder,
|
||||
aStyleContext, aSkipSides);
|
||||
}
|
||||
|
||||
nsStyleBorder newStyleBorder(*styleBorder);
|
||||
|
||||
NS_FOR_CSS_SIDES(side) {
|
||||
nscolor color = aStyleContext->GetVisitedDependentColor(
|
||||
nsCSSProps::SubpropertyEntryFor(eCSSProperty_border_color)[side]);
|
||||
newStyleBorder.mBorderColor[side] = StyleComplexColor::FromColor(color);
|
||||
}
|
||||
return CreateBorderRendererWithStyleBorder(aPresContext, aDrawTarget,
|
||||
aForFrame, aDirtyRect, aBorderArea,
|
||||
newStyleBorder, aStyleContext,
|
||||
aSkipSides);
|
||||
}
|
||||
|
||||
nsCSSBorderRenderer
|
||||
ConstructBorderRenderer(nsPresContext* aPresContext,
|
||||
nsStyleContext* aStyleContext,
|
||||
DrawTarget* aDrawTarget,
|
||||
nsIFrame* aForFrame,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aBorderArea,
|
||||
const nsStyleBorder& aStyleBorder,
|
||||
Sides aSkipSides,
|
||||
bool* aNeedsClip)
|
||||
{
|
||||
nsMargin border = aStyleBorder.GetComputedBorder();
|
||||
|
||||
// Get our style context's color struct.
|
||||
const nsStyleColor* ourColor = aStyleContext->StyleColor();
|
||||
|
||||
// In NavQuirks mode we want to use the parent's context as a starting point
|
||||
// for determining the background color.
|
||||
bool quirks = aPresContext->CompatibilityMode() == eCompatibility_NavQuirks;
|
||||
nsIFrame* bgFrame = nsCSSRendering::FindNonTransparentBackgroundFrame(aForFrame, quirks);
|
||||
nsStyleContext* bgContext = bgFrame->StyleContext();
|
||||
nscolor bgColor =
|
||||
bgContext->GetVisitedDependentColor(eCSSProperty_background_color);
|
||||
|
||||
// Compute the outermost boundary of the area that might be painted.
|
||||
// Same coordinate space as aBorderArea & aBGClipRect.
|
||||
nsRect joinedBorderArea =
|
||||
::BoxDecorationRectForBorder(aForFrame, aBorderArea, aSkipSides, &aStyleBorder);
|
||||
RectCornerRadii bgRadii;
|
||||
::GetRadii(aForFrame, aStyleBorder, aBorderArea, joinedBorderArea, &bgRadii);
|
||||
|
||||
PrintAsFormatString(" joinedBorderArea: %d %d %d %d\n", joinedBorderArea.x, joinedBorderArea.y,
|
||||
joinedBorderArea.width, joinedBorderArea.height);
|
||||
|
||||
// start drawing
|
||||
if (::IsBoxDecorationSlice(aStyleBorder)) {
|
||||
if (joinedBorderArea.IsEqualEdges(aBorderArea)) {
|
||||
// No need for a clip, just skip the sides we don't want.
|
||||
border.ApplySkipSides(aSkipSides);
|
||||
} else {
|
||||
// We're drawing borders around the joined continuation boxes so we need
|
||||
// to clip that to the slice that we want for this frame.
|
||||
*aNeedsClip = true;
|
||||
}
|
||||
} else {
|
||||
MOZ_ASSERT(joinedBorderArea.IsEqualEdges(aBorderArea),
|
||||
"Should use aBorderArea for box-decoration-break:clone");
|
||||
MOZ_ASSERT(aForFrame->GetSkipSides().IsEmpty() ||
|
||||
IS_TRUE_OVERFLOW_CONTAINER(aForFrame),
|
||||
"Should not skip sides for box-decoration-break:clone except "
|
||||
"::first-letter/line continuations or other frame types that "
|
||||
"don't have borders but those shouldn't reach this point. "
|
||||
"Overflow containers do reach this point though.");
|
||||
border.ApplySkipSides(aSkipSides);
|
||||
}
|
||||
|
||||
// Convert to dev pixels.
|
||||
nscoord twipsPerPixel = aPresContext->DevPixelsToAppUnits(1);
|
||||
Rect joinedBorderAreaPx = NSRectToRect(joinedBorderArea, twipsPerPixel);
|
||||
Float borderWidths[4] = { Float(border.top / twipsPerPixel),
|
||||
Float(border.right / twipsPerPixel),
|
||||
Float(border.bottom / twipsPerPixel),
|
||||
Float(border.left / twipsPerPixel) };
|
||||
Rect dirtyRect = NSRectToRect(aDirtyRect, twipsPerPixel);
|
||||
|
||||
uint8_t borderStyles[4];
|
||||
nscolor borderColors[4];
|
||||
nsBorderColors* compositeColors[4];
|
||||
|
||||
// pull out styles, colors, composite colors
|
||||
NS_FOR_CSS_SIDES (i) {
|
||||
borderStyles[i] = aStyleBorder.GetBorderStyle(i);
|
||||
borderColors[i] = ourColor->CalcComplexColor(aStyleBorder.mBorderColor[i]);
|
||||
aStyleBorder.GetCompositeColors(i, &compositeColors[i]);
|
||||
}
|
||||
|
||||
PrintAsFormatString(" borderStyles: %d %d %d %d\n", borderStyles[0], borderStyles[1], borderStyles[2], borderStyles[3]);
|
||||
|
||||
nsIDocument* document = nullptr;
|
||||
nsIContent* content = aForFrame->GetContent();
|
||||
if (content) {
|
||||
document = content->OwnerDoc();
|
||||
}
|
||||
|
||||
return nsCSSBorderRenderer(aPresContext,
|
||||
document,
|
||||
aDrawTarget,
|
||||
dirtyRect,
|
||||
joinedBorderAreaPx,
|
||||
borderStyles,
|
||||
borderWidths,
|
||||
bgRadii,
|
||||
borderColors,
|
||||
compositeColors,
|
||||
bgColor);
|
||||
}
|
||||
|
||||
|
||||
DrawResult
|
||||
nsCSSRendering::PaintBorderWithStyleBorder(nsPresContext* aPresContext,
|
||||
nsRenderingContext& aRenderingContext,
|
||||
|
@ -852,6 +724,17 @@ nsCSSRendering::PaintBorderWithStyleBorder(nsPresContext* aPresContext,
|
|||
result = DrawResult::NOT_READY;
|
||||
}
|
||||
|
||||
// Get our style context's color struct.
|
||||
const nsStyleColor* ourColor = aStyleContext->StyleColor();
|
||||
|
||||
// In NavQuirks mode we want to use the parent's context as a starting point
|
||||
// for determining the background color.
|
||||
bool quirks = aPresContext->CompatibilityMode() == eCompatibility_NavQuirks;
|
||||
nsIFrame* bgFrame = FindNonTransparentBackgroundFrame(aForFrame, quirks);
|
||||
nsStyleContext* bgContext = bgFrame->StyleContext();
|
||||
nscolor bgColor =
|
||||
bgContext->GetVisitedDependentColor(eCSSProperty_background_color);
|
||||
|
||||
nsMargin border = aStyleBorder.GetComputedBorder();
|
||||
if (0 == border.left && 0 == border.right &&
|
||||
0 == border.top && 0 == border.bottom) {
|
||||
|
@ -859,27 +742,93 @@ nsCSSRendering::PaintBorderWithStyleBorder(nsPresContext* aPresContext,
|
|||
return result;
|
||||
}
|
||||
|
||||
bool needsClip = false;
|
||||
nsCSSBorderRenderer br = ConstructBorderRenderer(aPresContext,
|
||||
aStyleContext,
|
||||
&aDrawTarget,
|
||||
aForFrame,
|
||||
aDirtyRect,
|
||||
aBorderArea,
|
||||
aStyleBorder,
|
||||
aSkipSides,
|
||||
&needsClip);
|
||||
// Compute the outermost boundary of the area that might be painted.
|
||||
// Same coordinate space as aBorderArea & aBGClipRect.
|
||||
nsRect joinedBorderArea =
|
||||
::BoxDecorationRectForBorder(aForFrame, aBorderArea, aSkipSides, &aStyleBorder);
|
||||
RectCornerRadii bgRadii;
|
||||
::GetRadii(aForFrame, aStyleBorder, aBorderArea, joinedBorderArea, &bgRadii);
|
||||
|
||||
if (needsClip) {
|
||||
aDrawTarget.PushClipRect(
|
||||
PrintAsFormatString(" joinedBorderArea: %d %d %d %d\n", joinedBorderArea.x, joinedBorderArea.y,
|
||||
joinedBorderArea.width, joinedBorderArea.height);
|
||||
|
||||
// start drawing
|
||||
bool needToPopClip = false;
|
||||
|
||||
if (::IsBoxDecorationSlice(aStyleBorder)) {
|
||||
if (joinedBorderArea.IsEqualEdges(aBorderArea)) {
|
||||
// No need for a clip, just skip the sides we don't want.
|
||||
border.ApplySkipSides(aSkipSides);
|
||||
} else {
|
||||
// We're drawing borders around the joined continuation boxes so we need
|
||||
// to clip that to the slice that we want for this frame.
|
||||
aDrawTarget.PushClipRect(
|
||||
NSRectToSnappedRect(aBorderArea,
|
||||
aForFrame->PresContext()->AppUnitsPerDevPixel(),
|
||||
aDrawTarget));
|
||||
needToPopClip = true;
|
||||
}
|
||||
} else {
|
||||
MOZ_ASSERT(joinedBorderArea.IsEqualEdges(aBorderArea),
|
||||
"Should use aBorderArea for box-decoration-break:clone");
|
||||
MOZ_ASSERT(aForFrame->GetSkipSides().IsEmpty() ||
|
||||
IS_TRUE_OVERFLOW_CONTAINER(aForFrame),
|
||||
"Should not skip sides for box-decoration-break:clone except "
|
||||
"::first-letter/line continuations or other frame types that "
|
||||
"don't have borders but those shouldn't reach this point. "
|
||||
"Overflow containers do reach this point though.");
|
||||
border.ApplySkipSides(aSkipSides);
|
||||
}
|
||||
|
||||
// Convert to dev pixels.
|
||||
nscoord twipsPerPixel = aPresContext->DevPixelsToAppUnits(1);
|
||||
Rect joinedBorderAreaPx = NSRectToRect(joinedBorderArea, twipsPerPixel);
|
||||
Float borderWidths[4] = { Float(border.top / twipsPerPixel),
|
||||
Float(border.right / twipsPerPixel),
|
||||
Float(border.bottom / twipsPerPixel),
|
||||
Float(border.left / twipsPerPixel) };
|
||||
Rect dirtyRect = NSRectToRect(aDirtyRect, twipsPerPixel);
|
||||
|
||||
uint8_t borderStyles[4];
|
||||
nscolor borderColors[4];
|
||||
nsBorderColors *compositeColors[4];
|
||||
|
||||
// pull out styles, colors, composite colors
|
||||
NS_FOR_CSS_SIDES (i) {
|
||||
borderStyles[i] = aStyleBorder.GetBorderStyle(i);
|
||||
borderColors[i] = ourColor->CalcComplexColor(aStyleBorder.mBorderColor[i]);
|
||||
aStyleBorder.GetCompositeColors(i, &compositeColors[i]);
|
||||
}
|
||||
|
||||
PrintAsFormatString(" borderStyles: %d %d %d %d\n", borderStyles[0], borderStyles[1], borderStyles[2], borderStyles[3]);
|
||||
//PrintAsFormatString ("bgRadii: %f %f %f %f\n", bgRadii[0], bgRadii[1], bgRadii[2], bgRadii[3]);
|
||||
|
||||
#if 0
|
||||
// this will draw a transparent red backround underneath the border area
|
||||
ColorPattern color(ToDeviceColor(Color(1.f, 0.f, 0.f, 0.5f)));
|
||||
aDrawTarget.FillRect(joinedBorderAreaPx, color);
|
||||
#endif
|
||||
|
||||
nsIDocument* document = nullptr;
|
||||
nsIContent* content = aForFrame->GetContent();
|
||||
if (content) {
|
||||
document = content->OwnerDoc();
|
||||
}
|
||||
|
||||
nsCSSBorderRenderer br(aPresContext,
|
||||
document,
|
||||
&aDrawTarget,
|
||||
dirtyRect,
|
||||
joinedBorderAreaPx,
|
||||
borderStyles,
|
||||
borderWidths,
|
||||
bgRadii,
|
||||
borderColors,
|
||||
compositeColors,
|
||||
bgColor);
|
||||
br.DrawBorders();
|
||||
|
||||
if (needsClip) {
|
||||
if (needToPopClip) {
|
||||
aDrawTarget.PopClip();
|
||||
}
|
||||
|
||||
|
@ -888,53 +837,6 @@ nsCSSRendering::PaintBorderWithStyleBorder(nsPresContext* aPresContext,
|
|||
return result;
|
||||
}
|
||||
|
||||
Maybe<nsCSSBorderRenderer>
|
||||
nsCSSRendering::CreateBorderRendererWithStyleBorder(nsPresContext* aPresContext,
|
||||
DrawTarget* aDrawTarget,
|
||||
nsIFrame* aForFrame,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aBorderArea,
|
||||
const nsStyleBorder& aStyleBorder,
|
||||
nsStyleContext* aStyleContext,
|
||||
Sides aSkipSides)
|
||||
{
|
||||
const nsStyleDisplay* displayData = aStyleContext->StyleDisplay();
|
||||
if (displayData->mAppearance) {
|
||||
nsITheme *theme = aPresContext->GetTheme();
|
||||
if (theme &&
|
||||
theme->ThemeSupportsWidget(aPresContext, aForFrame,
|
||||
displayData->mAppearance)) {
|
||||
return Nothing();
|
||||
}
|
||||
}
|
||||
|
||||
if (aStyleBorder.mBorderImageSource.GetType() != eStyleImageType_Null) {
|
||||
return Nothing();
|
||||
}
|
||||
|
||||
nsMargin border = aStyleBorder.GetComputedBorder();
|
||||
if (0 == border.left && 0 == border.right &&
|
||||
0 == border.top && 0 == border.bottom) {
|
||||
// Empty border area
|
||||
return Nothing();
|
||||
}
|
||||
|
||||
bool needsClip = false;
|
||||
nsCSSBorderRenderer br = ConstructBorderRenderer(aPresContext,
|
||||
aStyleContext,
|
||||
aDrawTarget,
|
||||
aForFrame,
|
||||
aDirtyRect,
|
||||
aBorderArea,
|
||||
aStyleBorder,
|
||||
aSkipSides,
|
||||
&needsClip);
|
||||
if (needsClip) {
|
||||
return Nothing();
|
||||
}
|
||||
return Some(br);
|
||||
}
|
||||
|
||||
static nsRect
|
||||
GetOutlineInnerRect(nsIFrame* aFrame)
|
||||
{
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include "nsLayoutUtils.h"
|
||||
#include "nsStyleStruct.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsCSSRenderingBorders.h"
|
||||
|
||||
class gfxDrawable;
|
||||
class nsStyleContext;
|
||||
|
@ -417,25 +416,6 @@ struct nsCSSRendering {
|
|||
mozilla::PaintBorderFlags aFlags,
|
||||
Sides aSkipSides = Sides());
|
||||
|
||||
static mozilla::Maybe<nsCSSBorderRenderer>
|
||||
CreateBorderRenderer(nsPresContext* aPresContext,
|
||||
DrawTarget* aDrawTarget,
|
||||
nsIFrame* aForFrame,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aBorderArea,
|
||||
nsStyleContext* aStyleContext,
|
||||
Sides aSkipSides = Sides());
|
||||
|
||||
static mozilla::Maybe<nsCSSBorderRenderer>
|
||||
CreateBorderRendererWithStyleBorder(nsPresContext* aPresContext,
|
||||
DrawTarget* aDrawTarget,
|
||||
nsIFrame* aForFrame,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aBorderArea,
|
||||
const nsStyleBorder& aBorderStyle,
|
||||
nsStyleContext* aStyleContext,
|
||||
Sides aSkipSides = Sides());
|
||||
|
||||
|
||||
/**
|
||||
* Render the outline for an element using css rendering rules
|
||||
|
|
|
@ -106,8 +106,8 @@ IsZeroSize(const Size& sz) {
|
|||
return sz.width == 0.0 || sz.height == 0.0;
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
nsCSSBorderRenderer::AllCornersZeroSize(const RectCornerRadii& corners) {
|
||||
static bool
|
||||
AllCornersZeroSize(const RectCornerRadii& corners) {
|
||||
return IsZeroSize(corners[NS_CORNER_TOP_LEFT]) &&
|
||||
IsZeroSize(corners[NS_CORNER_TOP_RIGHT]) &&
|
||||
IsZeroSize(corners[NS_CORNER_BOTTOM_RIGHT]) &&
|
||||
|
@ -182,17 +182,16 @@ nsCSSBorderRenderer::nsCSSBorderRenderer(nsPresContext* aPresContext,
|
|||
mDrawTarget(aDrawTarget),
|
||||
mDirtyRect(aDirtyRect),
|
||||
mOuterRect(aOuterRect),
|
||||
mBorderStyles(aBorderStyles),
|
||||
mBorderWidths(aBorderWidths),
|
||||
mBorderRadii(aBorderRadii),
|
||||
mBorderColors(aBorderColors),
|
||||
mCompositeColors(aCompositeColors),
|
||||
mBackgroundColor(aBackgroundColor)
|
||||
{
|
||||
PodCopy(mBorderStyles, aBorderStyles, 4);
|
||||
PodCopy(mBorderWidths, aBorderWidths, 4);
|
||||
PodCopy(mBorderColors, aBorderColors, 4);
|
||||
if (aCompositeColors) {
|
||||
PodCopy(mCompositeColors, aCompositeColors, 4);
|
||||
} else {
|
||||
if (!mCompositeColors) {
|
||||
static nsBorderColors * const noColors[4] = { nullptr };
|
||||
PodCopy(mCompositeColors, noColors, 4);
|
||||
mCompositeColors = &noColors[0];
|
||||
}
|
||||
|
||||
mInnerRect = mOuterRect;
|
||||
|
@ -272,7 +271,7 @@ ComputeBorderCornerDimensions(const Float* aBorderWidths,
|
|||
Float rightWidth = aBorderWidths[eSideRight];
|
||||
Float bottomWidth = aBorderWidths[eSideBottom];
|
||||
|
||||
if (nsCSSBorderRenderer::AllCornersZeroSize(aRadii)) {
|
||||
if (AllCornersZeroSize(aRadii)) {
|
||||
// These will always be in pixel units from CSS
|
||||
(*aDimsRet)[C_TL] = Size(leftWidth, topWidth);
|
||||
(*aDimsRet)[C_TR] = Size(rightWidth, topWidth);
|
||||
|
|
|
@ -16,11 +16,9 @@
|
|||
#include "nsColor.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsStyleStruct.h"
|
||||
#include "nsPresContext.h"
|
||||
|
||||
struct nsBorderColors;
|
||||
class nsDisplayBorder;
|
||||
|
||||
namespace mozilla {
|
||||
namespace gfx {
|
||||
|
@ -77,8 +75,6 @@ class nsCSSBorderRenderer final
|
|||
typedef mozilla::gfx::RectCornerRadii RectCornerRadii;
|
||||
typedef mozilla::gfx::StrokeOptions StrokeOptions;
|
||||
|
||||
friend class nsDisplayBorder;
|
||||
|
||||
public:
|
||||
|
||||
nsCSSBorderRenderer(nsPresContext* aPresContext,
|
||||
|
@ -109,8 +105,6 @@ public:
|
|||
const Float* aBorderSizes,
|
||||
RectCornerRadii* aOuterRadiiRet);
|
||||
|
||||
static bool AllCornersZeroSize(const RectCornerRadii& corners);
|
||||
|
||||
private:
|
||||
|
||||
RectCornerRadii mBorderCornerDimensions;
|
||||
|
@ -121,20 +115,20 @@ private:
|
|||
|
||||
// destination DrawTarget and dirty rect
|
||||
DrawTarget* mDrawTarget;
|
||||
const Rect mDirtyRect;
|
||||
const Rect& mDirtyRect;
|
||||
|
||||
// the rectangle of the outside and the inside of the border
|
||||
Rect mOuterRect;
|
||||
Rect mInnerRect;
|
||||
|
||||
// the style and size of the border
|
||||
uint8_t mBorderStyles[4];
|
||||
Float mBorderWidths[4];
|
||||
const uint8_t* mBorderStyles;
|
||||
const Float* mBorderWidths;
|
||||
RectCornerRadii mBorderRadii;
|
||||
|
||||
// colors
|
||||
nscolor mBorderColors[4];
|
||||
nsBorderColors* mCompositeColors[4];
|
||||
const nscolor* mBorderColors;
|
||||
nsBorderColors* const* mCompositeColors;
|
||||
|
||||
// the background color
|
||||
nscolor mBackgroundColor;
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include "nsIScrollableFrame.h"
|
||||
#include "nsIFrameInlines.h"
|
||||
#include "nsThemeConstants.h"
|
||||
#include "BorderConsts.h"
|
||||
#include "LayerTreeInvalidation.h"
|
||||
|
||||
#include "imgIContainer.h"
|
||||
|
@ -4006,7 +4005,7 @@ nsDisplayBorder::nsDisplayBorder(nsDisplayListBuilder* aBuilder, nsIFrame* aFram
|
|||
{
|
||||
MOZ_COUNT_CTOR(nsDisplayBorder);
|
||||
|
||||
mBounds = CalculateBounds(*mFrame->StyleBorder()).GetBounds();
|
||||
mBounds = CalculateBounds(*mFrame->StyleBorder());
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -4058,80 +4057,6 @@ nsDisplayBorder::ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder,
|
|||
}
|
||||
}
|
||||
|
||||
LayerState
|
||||
nsDisplayBorder::GetLayerState(nsDisplayListBuilder* aBuilder,
|
||||
LayerManager* aManager,
|
||||
const ContainerLayerParameters& aParameters)
|
||||
{
|
||||
if (!gfxPrefs::LayersAllowBorderLayers()) {
|
||||
return LAYER_NONE;
|
||||
}
|
||||
|
||||
nsPoint offset = ToReferenceFrame();
|
||||
Maybe<nsCSSBorderRenderer> br =
|
||||
nsCSSRendering::CreateBorderRenderer(mFrame->PresContext(),
|
||||
nullptr,
|
||||
mFrame,
|
||||
nsRect(),
|
||||
nsRect(offset, mFrame->GetSize()),
|
||||
mFrame->StyleContext(),
|
||||
mFrame->GetSkipSides());
|
||||
if (!br) {
|
||||
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(SIDE_BITS_ALL) ||
|
||||
!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];
|
||||
} else {
|
||||
mWidths[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
mRect = ViewAs<LayerPixel>(br->mOuterRect);
|
||||
return LAYER_INACTIVE;
|
||||
}
|
||||
|
||||
already_AddRefed<Layer>
|
||||
nsDisplayBorder::BuildLayer(nsDisplayListBuilder* aBuilder,
|
||||
LayerManager* aManager,
|
||||
const ContainerLayerParameters& aContainerParameters)
|
||||
{
|
||||
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({ LayerSize(), LayerSize(), LayerSize(), LayerSize() });
|
||||
layer->SetColors(mColors);
|
||||
layer->SetWidths(mWidths);
|
||||
layer->SetBaseTransform(gfx::Matrix4x4::Translation(aContainerParameters.mOffset.x,
|
||||
aContainerParameters.mOffset.y, 0));
|
||||
return layer.forget();
|
||||
}
|
||||
|
||||
void
|
||||
nsDisplayBorder::Paint(nsDisplayListBuilder* aBuilder,
|
||||
nsRenderingContext* aCtx) {
|
||||
|
@ -4159,7 +4084,7 @@ nsDisplayBorder::GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap)
|
|||
return mBounds;
|
||||
}
|
||||
|
||||
nsRegion
|
||||
nsRect
|
||||
nsDisplayBorder::CalculateBounds(const nsStyleBorder& aStyleBorder)
|
||||
{
|
||||
nsRect borderBounds(ToReferenceFrame(), mFrame->GetSize());
|
||||
|
@ -4168,37 +4093,37 @@ nsDisplayBorder::CalculateBounds(const nsStyleBorder& aStyleBorder)
|
|||
return borderBounds;
|
||||
} else {
|
||||
nsMargin border = aStyleBorder.GetComputedBorder();
|
||||
nsRegion result;
|
||||
nsRect result;
|
||||
if (border.top > 0) {
|
||||
result = nsRect(borderBounds.X(), borderBounds.Y(), borderBounds.Width(), border.top);
|
||||
}
|
||||
if (border.right > 0) {
|
||||
result.OrWith(nsRect(borderBounds.XMost() - border.right, borderBounds.Y(), border.right, borderBounds.Height()));
|
||||
result.UnionRect(result, nsRect(borderBounds.XMost() - border.right, borderBounds.Y(), border.right, borderBounds.Height()));
|
||||
}
|
||||
if (border.bottom > 0) {
|
||||
result.OrWith(nsRect(borderBounds.X(), borderBounds.YMost() - border.bottom, borderBounds.Width(), border.bottom));
|
||||
result.UnionRect(result, nsRect(borderBounds.X(), borderBounds.YMost() - border.bottom, borderBounds.Width(), border.bottom));
|
||||
}
|
||||
if (border.left > 0) {
|
||||
result.OrWith(nsRect(borderBounds.X(), borderBounds.Y(), border.left, borderBounds.Height()));
|
||||
result.UnionRect(result, nsRect(borderBounds.X(), borderBounds.Y(), border.left, borderBounds.Height()));
|
||||
}
|
||||
|
||||
nscoord radii[8];
|
||||
if (mFrame->GetBorderRadii(radii)) {
|
||||
if (border.left > 0 || border.top > 0) {
|
||||
nsSize cornerSize(radii[NS_CORNER_TOP_LEFT_X], radii[NS_CORNER_TOP_LEFT_Y]);
|
||||
result.OrWith(nsRect(borderBounds.TopLeft(), cornerSize));
|
||||
result.UnionRect(result, nsRect(borderBounds.TopLeft(), cornerSize));
|
||||
}
|
||||
if (border.top > 0 || border.right > 0) {
|
||||
nsSize cornerSize(radii[NS_CORNER_TOP_RIGHT_X], radii[NS_CORNER_TOP_RIGHT_Y]);
|
||||
result.OrWith(nsRect(borderBounds.TopRight() - nsPoint(cornerSize.width, 0), cornerSize));
|
||||
result.UnionRect(result, nsRect(borderBounds.TopRight() - nsPoint(cornerSize.width, 0), cornerSize));
|
||||
}
|
||||
if (border.right > 0 || border.bottom > 0) {
|
||||
nsSize cornerSize(radii[NS_CORNER_BOTTOM_RIGHT_X], radii[NS_CORNER_BOTTOM_RIGHT_Y]);
|
||||
result.OrWith(nsRect(borderBounds.BottomRight() - nsPoint(cornerSize.width, cornerSize.height), cornerSize));
|
||||
result.UnionRect(result, nsRect(borderBounds.BottomRight() - nsPoint(cornerSize.width, cornerSize.height), cornerSize));
|
||||
}
|
||||
if (border.bottom > 0 || border.left > 0) {
|
||||
nsSize cornerSize(radii[NS_CORNER_BOTTOM_LEFT_X], radii[NS_CORNER_BOTTOM_LEFT_Y]);
|
||||
result.OrWith(nsRect(borderBounds.BottomLeft() - nsPoint(0, cornerSize.height), cornerSize));
|
||||
result.UnionRect(result, nsRect(borderBounds.BottomLeft() - nsPoint(0, cornerSize.height), cornerSize));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#define NSDISPLAYLIST_H_
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Array.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/EnumSet.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
|
@ -1427,13 +1426,6 @@ public:
|
|||
*aSnap = false;
|
||||
return nsRect(ToReferenceFrame(), Frame()->GetSize());
|
||||
}
|
||||
|
||||
virtual nsRegion GetTightBounds(nsDisplayListBuilder* aBuilder, bool* aSnap)
|
||||
{
|
||||
*aSnap = false;
|
||||
return nsRegion();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if nothing will be rendered inside aRect, false if uncertain.
|
||||
* aRect is assumed to be contained in this item's bounds.
|
||||
|
@ -2565,13 +2557,6 @@ public:
|
|||
|
||||
virtual bool IsInvisibleInRect(const nsRect& aRect) override;
|
||||
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap) 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 void Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx) override;
|
||||
NS_DISPLAY_DECL_NAME("Border", TYPE_BORDER)
|
||||
|
||||
|
@ -2581,18 +2566,8 @@ public:
|
|||
const nsDisplayItemGeometry* aGeometry,
|
||||
nsRegion* aInvalidRegion) override;
|
||||
|
||||
virtual nsRegion GetTightBounds(nsDisplayListBuilder* aBuilder, bool* aSnap) override
|
||||
{
|
||||
*aSnap = true;
|
||||
return CalculateBounds(*mFrame->StyleBorder());
|
||||
}
|
||||
|
||||
protected:
|
||||
nsRegion CalculateBounds(const nsStyleBorder& aStyleBorder);
|
||||
|
||||
mozilla::Array<mozilla::gfx::Color, 4> mColors;
|
||||
mozilla::Array<mozilla::LayerCoord, 4> mWidths;
|
||||
mozilla::LayerRect mRect;
|
||||
nsRect CalculateBounds(const nsStyleBorder& aStyleBorder);
|
||||
|
||||
nsRect mBounds;
|
||||
};
|
||||
|
|
10
mfbt/Array.h
10
mfbt/Array.h
|
@ -46,16 +46,6 @@ public:
|
|||
return mArr[aIndex];
|
||||
}
|
||||
|
||||
bool operator==(const Array<T, Length>& aOther) const
|
||||
{
|
||||
for (size_t i = 0; i < Length; i++) {
|
||||
if (mArr[i] != aOther[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
typedef T* iterator;
|
||||
typedef const T* const_iterator;
|
||||
typedef ReverseIterator<T*> reverse_iterator;
|
||||
|
|
|
@ -1521,12 +1521,6 @@ protected:
|
|||
template<class Item, typename ActualAlloc = Alloc>
|
||||
elem_type* AppendElements(const Item* aArray, size_type aArrayLen);
|
||||
|
||||
template<class Item, size_t Length, typename ActualAlloc = Alloc>
|
||||
elem_type* AppendElements(const mozilla::Array<Item, Length>& aArray)
|
||||
{
|
||||
return AppendElements<Item, ActualAlloc>(&aArray[0], Length);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
template<class Item>
|
||||
|
|
Загрузка…
Ссылка в новой задаче