зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1051985 - Move the background color and content description from ContainerLayer to Layer. r=mattwoodrow
This commit is contained in:
Родитель
78cc61d618
Коммит
901529a459
|
@ -187,7 +187,8 @@ Layer::Layer(LayerManager* aManager, void* aImplData) :
|
|||
mScrollbarTargetId(FrameMetrics::NULL_SCROLL_ID),
|
||||
mScrollbarDirection(ScrollDirection::NONE),
|
||||
mDebugColorIndex(0),
|
||||
mAnimationGeneration(0)
|
||||
mAnimationGeneration(0),
|
||||
mBackgroundColor(0, 0, 0, 0)
|
||||
{}
|
||||
|
||||
Layer::~Layer()
|
||||
|
@ -763,7 +764,6 @@ ContainerLayer::ContainerLayer(LayerManager* aManager, void* aImplData)
|
|||
mPreYScale(1.0f),
|
||||
mInheritedXScale(1.0f),
|
||||
mInheritedYScale(1.0f),
|
||||
mBackgroundColor(0, 0, 0, 0),
|
||||
mUseIntermediateSurface(false),
|
||||
mSupportsComponentAlphaChildren(false),
|
||||
mMayHaveReadbackChild(false)
|
||||
|
@ -921,8 +921,7 @@ void
|
|||
ContainerLayer::FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
|
||||
{
|
||||
aAttrs = ContainerLayerAttributes(mPreXScale, mPreYScale,
|
||||
mInheritedXScale, mInheritedYScale,
|
||||
mBackgroundColor, mContentDescription);
|
||||
mInheritedXScale, mInheritedYScale);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -1144,6 +1144,28 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void SetBackgroundColor(const gfxRGBA& aColor)
|
||||
{
|
||||
if (mBackgroundColor == aColor) {
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) BackgroundColor", this));
|
||||
mBackgroundColor = aColor;
|
||||
Mutated();
|
||||
}
|
||||
|
||||
void SetContentDescription(const std::string& aContentDescription)
|
||||
{
|
||||
if (mContentDescription == aContentDescription) {
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) ContentDescription", this));
|
||||
mContentDescription = aContentDescription;
|
||||
Mutated();
|
||||
}
|
||||
|
||||
// These getters can be used anytime.
|
||||
float GetOpacity() { return mOpacity; }
|
||||
gfx::CompositionOp GetMixBlendMode() const { return mMixBlendMode; }
|
||||
|
@ -1174,6 +1196,9 @@ public:
|
|||
FrameMetrics::ViewID GetScrollbarTargetContainerId() { return mScrollbarTargetId; }
|
||||
ScrollDirection GetScrollbarDirection() { return mScrollbarDirection; }
|
||||
Layer* GetMaskLayer() const { return mMaskLayer; }
|
||||
gfxRGBA GetBackgroundColor() const { return mBackgroundColor; }
|
||||
const std::string& GetContentDescription() const { return mContentDescription; }
|
||||
|
||||
|
||||
// Note that all lengths in animation data are either in CSS pixels or app
|
||||
// units and must be converted to device pixels by the compositor.
|
||||
|
@ -1566,6 +1591,12 @@ protected:
|
|||
// If this layer is used for OMTA, then this counter is used to ensure we
|
||||
// stay in sync with the animation manager
|
||||
uint64_t mAnimationGeneration;
|
||||
// This is currently set and used only for scrollable container layers.
|
||||
gfxRGBA mBackgroundColor;
|
||||
// A description of the content element corresponding to this frame.
|
||||
// This is empty unless this is a scrollable ContainerLayer and the
|
||||
// apz.printtree pref is turned on.
|
||||
std::string mContentDescription;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1745,28 +1776,6 @@ public:
|
|||
Mutated();
|
||||
}
|
||||
|
||||
void SetBackgroundColor(const gfxRGBA& aColor)
|
||||
{
|
||||
if (mBackgroundColor == aColor) {
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) BackgroundColor", this));
|
||||
mBackgroundColor = aColor;
|
||||
Mutated();
|
||||
}
|
||||
|
||||
void SetContentDescription(const std::string& aContentDescription)
|
||||
{
|
||||
if (mContentDescription == aContentDescription) {
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) ContentDescription", this));
|
||||
mContentDescription = aContentDescription;
|
||||
Mutated();
|
||||
}
|
||||
|
||||
virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs);
|
||||
|
||||
void SortChildrenBy3DZOrder(nsTArray<Layer*>& aArray);
|
||||
|
@ -1783,9 +1792,6 @@ public:
|
|||
float GetInheritedXScale() const { return mInheritedXScale; }
|
||||
float GetInheritedYScale() const { return mInheritedYScale; }
|
||||
|
||||
gfxRGBA GetBackgroundColor() const { return mBackgroundColor; }
|
||||
const std::string& GetContentDescription() const { return mContentDescription; }
|
||||
|
||||
MOZ_LAYER_DECL_NAME("ContainerLayer", TYPE_CONTAINER)
|
||||
|
||||
/**
|
||||
|
@ -1871,14 +1877,6 @@ protected:
|
|||
// be part of mTransform.
|
||||
float mInheritedXScale;
|
||||
float mInheritedYScale;
|
||||
// This is currently set and used only for scrollable container layers.
|
||||
// When multi-layer-apz (bug 967844) is implemented, this is likely to move
|
||||
// elsewhere (e.g. to Layer).
|
||||
gfxRGBA mBackgroundColor;
|
||||
// A description of the content element corresponding to this frame.
|
||||
// This is empty unless this ContainerLayer is scrollable and the
|
||||
// apz.printtree pref is turned on.
|
||||
std::string mContentDescription;
|
||||
bool mUseIntermediateSurface;
|
||||
bool mSupportsComponentAlphaChildren;
|
||||
bool mMayHaveReadbackChild;
|
||||
|
|
|
@ -269,7 +269,7 @@ APZCTreeManager::UpdatePanZoomControllerTree(CompositorParent* aCompositor,
|
|||
<< "\tsr=" << metrics.mScrollableRect
|
||||
<< (aLayer->GetVisibleRegion().IsEmpty() ? "\tscrollinfo" : "")
|
||||
<< (apzc->HasScrollgrab() ? "\tscrollgrab" : "")
|
||||
<< "\t" << container->GetContentDescription();
|
||||
<< "\t" << aLayer->GetContentDescription();
|
||||
|
||||
// Bind the APZC instance into the tree of APZCs
|
||||
if (aNextSibling) {
|
||||
|
|
|
@ -359,7 +359,7 @@ TiledContentHost::Composite(EffectChain& aEffectChain,
|
|||
if (aOpacity == 1.0f && gfxPrefs::LowPrecisionOpacity() < 1.0f) {
|
||||
// Background colors are only stored on scrollable layers. Grab
|
||||
// the one from the nearest scrollable ancestor layer.
|
||||
for (ContainerLayer* ancestor = GetLayer()->GetParent(); ancestor; ancestor = ancestor->GetParent()) {
|
||||
for (Layer* ancestor = GetLayer(); ancestor; ancestor = ancestor->GetParent()) {
|
||||
if (ancestor->GetFrameMetrics().IsScrollable()) {
|
||||
backgroundColor = ancestor->GetBackgroundColor();
|
||||
break;
|
||||
|
|
|
@ -320,6 +320,8 @@ LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
|
|||
layer->SetInvalidRegion(common.invalidRegion());
|
||||
layer->SetFrameMetrics(common.metrics());
|
||||
layer->SetScrollHandoffParentId(common.scrollParentId());
|
||||
layer->SetBackgroundColor(common.backgroundColor().value());
|
||||
layer->SetContentDescription(common.contentDescription());
|
||||
|
||||
typedef SpecificLayerAttributes Specific;
|
||||
const SpecificLayerAttributes& specific = attrs.specific();
|
||||
|
@ -352,8 +354,6 @@ LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
|
|||
specific.get_ContainerLayerAttributes();
|
||||
containerLayer->SetPreScale(attrs.preXScale(), attrs.preYScale());
|
||||
containerLayer->SetInheritedScale(attrs.inheritedXScale(), attrs.inheritedYScale());
|
||||
containerLayer->SetBackgroundColor(attrs.backgroundColor().value());
|
||||
containerLayer->SetContentDescription(attrs.contentDescription());
|
||||
break;
|
||||
}
|
||||
case Specific::TColorLayerAttributes: {
|
||||
|
|
|
@ -217,6 +217,8 @@ struct CommonLayerAttributes {
|
|||
nsIntRegion invalidRegion;
|
||||
FrameMetrics metrics;
|
||||
ViewID scrollParentId;
|
||||
LayerColor backgroundColor;
|
||||
string contentDescription;
|
||||
};
|
||||
|
||||
struct ThebesLayerAttributes {
|
||||
|
@ -227,8 +229,6 @@ struct ContainerLayerAttributes {
|
|||
float preYScale;
|
||||
float inheritedXScale;
|
||||
float inheritedYScale;
|
||||
LayerColor backgroundColor;
|
||||
string contentDescription;
|
||||
};
|
||||
struct ColorLayerAttributes { LayerColor color; nsIntRect bounds; };
|
||||
struct CanvasLayerAttributes { GraphicsFilterType filter; nsIntRect bounds; };
|
||||
|
|
|
@ -599,6 +599,8 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies,
|
|||
common.invalidRegion() = mutant->GetInvalidRegion();
|
||||
common.metrics() = mutant->GetFrameMetrics();
|
||||
common.scrollParentId() = mutant->GetScrollHandoffParentId();
|
||||
common.backgroundColor() = mutant->GetBackgroundColor();
|
||||
common.contentDescription() = mutant->GetContentDescription();
|
||||
attrs.specific() = null_t();
|
||||
mutant->FillSpecificAttributes(attrs.specific());
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче