Bug 1529698 - Part 1: Make LayerState enum class r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D30837
This commit is contained in:
@@ -175,9 +175,9 @@ class nsDisplayCanvasBackgroundColor final : public nsDisplaySolidColorBase {
|
||||
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
||||
const ContainerLayerParameters& aParameters) override {
|
||||
if (ForceActiveLayers()) {
|
||||
return mozilla::LAYER_ACTIVE;
|
||||
return mozilla::LayerState::LAYER_ACTIVE;
|
||||
}
|
||||
return mozilla::LAYER_NONE;
|
||||
return mozilla::LayerState::LAYER_NONE;
|
||||
}
|
||||
virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
|
||||
|
||||
|
||||
@@ -200,14 +200,14 @@ class nsDisplayCanvas final : public nsDisplayItem {
|
||||
const ContainerLayerParameters& aParameters) override {
|
||||
if (HTMLCanvasElement::FromNode(mFrame->GetContent())
|
||||
->ShouldForceInactiveLayer(aManager))
|
||||
return LAYER_INACTIVE;
|
||||
return LayerState::LAYER_INACTIVE;
|
||||
|
||||
// If compositing is cheap, just do that
|
||||
if (aManager->IsCompositingCheap() ||
|
||||
ActiveLayerTracker::IsContentActive(mFrame))
|
||||
return mozilla::LAYER_ACTIVE;
|
||||
return mozilla::LayerState::LAYER_ACTIVE;
|
||||
|
||||
return LAYER_INACTIVE;
|
||||
return LayerState::LAYER_INACTIVE;
|
||||
}
|
||||
|
||||
// FirstContentfulPaint is supposed to ignore "white" canvases. We use
|
||||
|
||||
@@ -1815,7 +1815,7 @@ LayerState nsDisplayImage::GetLayerState(
|
||||
NS_FAILED(mImage->GetAnimated(&animated)) || !animated) {
|
||||
if (!aManager->IsCompositingCheap() ||
|
||||
!nsLayoutUtils::GPUImageScalingEnabled()) {
|
||||
return LAYER_NONE;
|
||||
return LayerState::LAYER_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1838,27 +1838,27 @@ LayerState nsDisplayImage::GetLayerState(
|
||||
|
||||
// If we are not scaling at all, no point in separating this into a layer.
|
||||
if (scale.width == 1.0f && scale.height == 1.0f) {
|
||||
return LAYER_NONE;
|
||||
return LayerState::LAYER_NONE;
|
||||
}
|
||||
|
||||
// If the target size is pretty small, no point in using a layer.
|
||||
if (destLayerRect.width * destLayerRect.height < 64 * 64) {
|
||||
return LAYER_NONE;
|
||||
return LayerState::LAYER_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!CanOptimizeToImageLayer(aManager, aBuilder)) {
|
||||
return LAYER_NONE;
|
||||
return LayerState::LAYER_NONE;
|
||||
}
|
||||
|
||||
// Image layer doesn't support draw focus ring for image map.
|
||||
nsImageFrame* f = static_cast<nsImageFrame*>(mFrame);
|
||||
if (f->HasImageMap()) {
|
||||
return LAYER_NONE;
|
||||
return LayerState::LAYER_NONE;
|
||||
}
|
||||
|
||||
return LAYER_ACTIVE;
|
||||
return LayerState::LAYER_ACTIVE;
|
||||
}
|
||||
|
||||
/* virtual */
|
||||
|
||||
@@ -851,7 +851,7 @@ class nsDisplayPluginReadback : public nsDisplayItem {
|
||||
LayerState GetLayerState(
|
||||
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
||||
const ContainerLayerParameters& aParameters) override {
|
||||
return LAYER_ACTIVE;
|
||||
return LayerState::LAYER_ACTIVE;
|
||||
}
|
||||
|
||||
virtual nsDisplayItemGeometry* AllocateGeometry(
|
||||
@@ -1105,10 +1105,11 @@ void nsPluginFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
DisplayItemType::TYPE_PRINT_PLUGIN);
|
||||
} else {
|
||||
LayerState state = GetLayerState(aBuilder, nullptr);
|
||||
if (state == LAYER_INACTIVE && nsDisplayItem::ForceActiveLayers()) {
|
||||
state = LAYER_ACTIVE;
|
||||
if (state == LayerState::LAYER_INACTIVE &&
|
||||
nsDisplayItem::ForceActiveLayers()) {
|
||||
state = LayerState::LAYER_ACTIVE;
|
||||
}
|
||||
if (aBuilder->IsPaintingToWindow() && state == LAYER_ACTIVE &&
|
||||
if (aBuilder->IsPaintingToWindow() && state == LayerState::LAYER_ACTIVE &&
|
||||
IsTransparentMode()) {
|
||||
aLists.Content()->AppendNewToTop<nsDisplayPluginReadback>(aBuilder, this);
|
||||
}
|
||||
@@ -1232,17 +1233,17 @@ nsRect nsPluginFrame::GetPaintedRect(const nsDisplayPlugin* aItem) const {
|
||||
|
||||
LayerState nsPluginFrame::GetLayerState(nsDisplayListBuilder* aBuilder,
|
||||
LayerManager* aManager) {
|
||||
if (!mInstanceOwner) return LAYER_NONE;
|
||||
if (!mInstanceOwner) return LayerState::LAYER_NONE;
|
||||
|
||||
if (mInstanceOwner->NeedsScrollImageLayer()) {
|
||||
return LAYER_ACTIVE;
|
||||
return LayerState::LAYER_ACTIVE;
|
||||
}
|
||||
|
||||
if (!mInstanceOwner->UseAsyncRendering()) {
|
||||
return LAYER_NONE;
|
||||
return LayerState::LAYER_NONE;
|
||||
}
|
||||
|
||||
return LAYER_ACTIVE_FORCE;
|
||||
return LayerState::LAYER_ACTIVE_FORCE;
|
||||
}
|
||||
|
||||
class PluginFrameDidCompositeObserver final : public DidCompositeObserver {
|
||||
|
||||
@@ -502,11 +502,12 @@ class nsDisplayVideo : public nsDisplayItem {
|
||||
// managers calling imageContainer->GetCurrentAsSurface can be
|
||||
// very expensive. So just always be active when compositing is
|
||||
// cheap (i.e. hardware accelerated).
|
||||
return LAYER_ACTIVE;
|
||||
return LayerState::LAYER_ACTIVE;
|
||||
}
|
||||
HTMLMediaElement* elem =
|
||||
static_cast<HTMLMediaElement*>(mFrame->GetContent());
|
||||
return elem->IsPotentiallyPlaying() ? LAYER_ACTIVE_FORCE : LAYER_INACTIVE;
|
||||
return elem->IsPotentiallyPlaying() ? LayerState::LAYER_ACTIVE_FORCE
|
||||
: LayerState::LAYER_INACTIVE;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -192,9 +192,9 @@ mozilla::LayerState nsDisplayRemote::GetLayerState(
|
||||
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
||||
const ContainerLayerParameters& aParameters) {
|
||||
if (IsTempLayerManager(aManager)) {
|
||||
return mozilla::LAYER_NONE;
|
||||
return mozilla::LayerState::LAYER_NONE;
|
||||
}
|
||||
return mozilla::LAYER_ACTIVE_FORCE;
|
||||
return mozilla::LayerState::LAYER_ACTIVE_FORCE;
|
||||
}
|
||||
|
||||
already_AddRefed<Layer> nsDisplayRemote::BuildLayer(
|
||||
|
||||
@@ -447,22 +447,22 @@ class LayerManagerData : public LayerUserData {
|
||||
|
||||
const char* layerState;
|
||||
switch (data->mLayerState) {
|
||||
case LAYER_NONE:
|
||||
case LayerState::LAYER_NONE:
|
||||
layerState = "LAYER_NONE";
|
||||
break;
|
||||
case LAYER_INACTIVE:
|
||||
case LayerState::LAYER_INACTIVE:
|
||||
layerState = "LAYER_INACTIVE";
|
||||
break;
|
||||
case LAYER_ACTIVE:
|
||||
case LayerState::LAYER_ACTIVE:
|
||||
layerState = "LAYER_ACTIVE";
|
||||
break;
|
||||
case LAYER_ACTIVE_FORCE:
|
||||
case LayerState::LAYER_ACTIVE_FORCE:
|
||||
layerState = "LAYER_ACTIVE_FORCE";
|
||||
break;
|
||||
case LAYER_ACTIVE_EMPTY:
|
||||
case LayerState::LAYER_ACTIVE_EMPTY:
|
||||
layerState = "LAYER_ACTIVE_EMPTY";
|
||||
break;
|
||||
case LAYER_SVG_EFFECTS:
|
||||
case LayerState::LAYER_SVG_EFFECTS:
|
||||
layerState = "LAYER_SVG_EFFECTS";
|
||||
break;
|
||||
}
|
||||
@@ -822,7 +822,7 @@ struct NewLayerEntry {
|
||||
mClipChain(nullptr),
|
||||
mScrollMetadataASR(nullptr),
|
||||
mLayerContentsVisibleRect(0, 0, -1, -1),
|
||||
mLayerState(LAYER_INACTIVE),
|
||||
mLayerState(LayerState::LAYER_INACTIVE),
|
||||
mHideAllLayersBelow(false),
|
||||
mOpaqueForAnimatedGeometryRootParent(false),
|
||||
mPropagateComponentAlphaFlattening(true),
|
||||
@@ -2067,8 +2067,7 @@ DisplayItemData* FrameLayerBuilder::GetDisplayItemData(nsIFrame* aFrame,
|
||||
for (uint32_t i = 0; i < array.Length(); i++) {
|
||||
DisplayItemData* item =
|
||||
DisplayItemData::AssertDisplayItemData(array.ElementAt(i));
|
||||
if (item->mDisplayItemKey == aKey &&
|
||||
item->FirstFrame() == aFrame &&
|
||||
if (item->mDisplayItemKey == aKey && item->FirstFrame() == aFrame &&
|
||||
item->mLayer->Manager() == mRetainingManager) {
|
||||
return item;
|
||||
}
|
||||
@@ -4441,12 +4440,13 @@ void ContainerState::ProcessDisplayItems(nsDisplayList* aList) {
|
||||
aList->SetNeedsTransparentSurface();
|
||||
}
|
||||
|
||||
LayerState layerState = LAYER_NONE;
|
||||
LayerState layerState = LayerState::LAYER_NONE;
|
||||
if (marker == DisplayItemEntryType::Item) {
|
||||
layerState = item->GetLayerState(mBuilder, mManager, mParameters);
|
||||
|
||||
if (layerState == LAYER_INACTIVE && nsDisplayItem::ForceActiveLayers()) {
|
||||
layerState = LAYER_ACTIVE;
|
||||
if (layerState == LayerState::LAYER_INACTIVE &&
|
||||
nsDisplayItem::ForceActiveLayers()) {
|
||||
layerState = LayerState::LAYER_ACTIVE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4616,11 +4616,12 @@ void ContainerState::ProcessDisplayItems(nsDisplayList* aList) {
|
||||
|
||||
// Assign the item to a layer
|
||||
bool treatInactiveItemAsActive =
|
||||
(layerState == LAYER_INACTIVE &&
|
||||
(layerState == LayerState::LAYER_INACTIVE &&
|
||||
mLayerBuilder->GetContainingPaintedLayerData());
|
||||
if (layerState == LAYER_ACTIVE_FORCE || treatInactiveItemAsActive ||
|
||||
(!forceInactive &&
|
||||
(layerState == LAYER_ACTIVE_EMPTY || layerState == LAYER_ACTIVE))) {
|
||||
if (layerState == LayerState::LAYER_ACTIVE_FORCE ||
|
||||
treatInactiveItemAsActive ||
|
||||
(!forceInactive && (layerState == LayerState::LAYER_ACTIVE_EMPTY ||
|
||||
layerState == LayerState::LAYER_ACTIVE))) {
|
||||
layerCount++;
|
||||
|
||||
// Currently we do not support flattening effects within nested inactive
|
||||
@@ -4628,11 +4629,12 @@ void ContainerState::ProcessDisplayItems(nsDisplayList* aList) {
|
||||
MOZ_ASSERT(selectedLayer == nullptr);
|
||||
MOZ_ASSERT(marker == DisplayItemEntryType::Item);
|
||||
|
||||
// LAYER_ACTIVE_EMPTY means the layer is created just for its metadata.
|
||||
// We should never see an empty layer with any visible content!
|
||||
// LayerState::LAYER_ACTIVE_EMPTY means the layer is created just for its
|
||||
// metadata. We should never see an empty layer with any visible content!
|
||||
NS_ASSERTION(
|
||||
layerState != LAYER_ACTIVE_EMPTY || itemVisibleRect.IsEmpty(),
|
||||
"State is LAYER_ACTIVE_EMPTY but visible rect is not.");
|
||||
layerState != LayerState::LAYER_ACTIVE_EMPTY ||
|
||||
itemVisibleRect.IsEmpty(),
|
||||
"State is LayerState::LAYER_ACTIVE_EMPTY but visible rect is not.");
|
||||
|
||||
// As long as the new layer isn't going to be a PaintedLayer,
|
||||
// InvalidateForLayerChange doesn't need the new layer pointer.
|
||||
@@ -4910,7 +4912,7 @@ void ContainerState::ProcessDisplayItems(nsDisplayList* aList) {
|
||||
// Don't attempt to flatten compnent alpha layers that are within
|
||||
// a forced active layer, or an active transform;
|
||||
if (itemType == DisplayItemType::TYPE_TRANSFORM ||
|
||||
layerState == LAYER_ACTIVE_FORCE) {
|
||||
layerState == LayerState::LAYER_ACTIVE_FORCE) {
|
||||
newLayerEntry->mPropagateComponentAlphaFlattening = false;
|
||||
}
|
||||
|
||||
@@ -5230,7 +5232,8 @@ void FrameLayerBuilder::ComputeGeometryChangeForItem(DisplayItemData* aData) {
|
||||
// inactive layers, since these types don't implement
|
||||
// ComputeInvalidateRegion (and rely on the ComputeDifferences call in
|
||||
// AddPaintedDisplayItem instead).
|
||||
if (!combined.IsEmpty() || aData->mLayerState == LAYER_INACTIVE ||
|
||||
if (!combined.IsEmpty() ||
|
||||
aData->mLayerState == LayerState::LAYER_INACTIVE ||
|
||||
item->NeedsGeometryUpdates()) {
|
||||
geometry = item->AllocateGeometry(mDisplayListBuilder);
|
||||
}
|
||||
@@ -5288,7 +5291,7 @@ void FrameLayerBuilder::AddPaintedDisplayItem(PaintedLayerData* aLayerData,
|
||||
layer->GetUserData(&gPaintedDisplayItemLayerUserData));
|
||||
RefPtr<BasicLayerManager> tempManager;
|
||||
nsIntRect intClip;
|
||||
if (aItem.mLayerState != LAYER_NONE) {
|
||||
if (aItem.mLayerState != LayerState::LAYER_NONE) {
|
||||
if (aItem.mDisplayItemData) {
|
||||
tempManager = aItem.mDisplayItemData->mInactiveManager;
|
||||
|
||||
@@ -5391,7 +5394,7 @@ void FrameLayerBuilder::AddPaintedDisplayItem(PaintedLayerData* aLayerData,
|
||||
data =
|
||||
layerBuilder->GetDisplayItemDataForManager(aItem.mItem, tempManager);
|
||||
data = layerBuilder->StoreDataForFrame(aItem.mItem, tmpLayer,
|
||||
LAYER_ACTIVE, data);
|
||||
LayerState::LAYER_ACTIVE, data);
|
||||
data->mOldTransform = data->mTransform;
|
||||
data->mTransform = aItem.mTransform;
|
||||
}
|
||||
@@ -5422,7 +5425,7 @@ void FrameLayerBuilder::AddPaintedDisplayItem(PaintedLayerData* aLayerData,
|
||||
nsRect visible = aItem.mItem->Frame()->GetVisualOverflowRect();
|
||||
invalid = visible.ToOutsidePixels(paintedData->mAppUnitsPerDevPixel);
|
||||
}
|
||||
if (aItem.mLayerState == LAYER_SVG_EFFECTS) {
|
||||
if (aItem.mLayerState == LayerState::LAYER_SVG_EFFECTS) {
|
||||
invalid = nsSVGIntegrationUtils::AdjustInvalidAreaForSVGEffects(
|
||||
aItem.mItem->Frame(), aItem.mItem->ToReferenceFrame(), invalid);
|
||||
}
|
||||
@@ -6250,10 +6253,11 @@ already_AddRefed<ContainerLayer> FrameLayerBuilder::BuildContainerLayerFor(
|
||||
if (aContainerItem) {
|
||||
DisplayItemData* data =
|
||||
GetDisplayItemDataForManager(aContainerItem, mRetainingManager);
|
||||
StoreDataForFrame(aContainerItem, containerLayer, LAYER_ACTIVE, data);
|
||||
StoreDataForFrame(aContainerItem, containerLayer,
|
||||
LayerState::LAYER_ACTIVE, data);
|
||||
} else {
|
||||
StoreDataForFrame(aContainerFrame, containerDisplayItemKey,
|
||||
containerLayer, LAYER_ACTIVE);
|
||||
containerLayer, LayerState::LAYER_ACTIVE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
enum LayerState {
|
||||
enum class LayerState : uint8_t {
|
||||
LAYER_NONE,
|
||||
LAYER_INACTIVE,
|
||||
LAYER_ACTIVE,
|
||||
|
||||
@@ -3400,10 +3400,10 @@ LayerState nsDisplaySolidColor::GetLayerState(
|
||||
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
||||
const ContainerLayerParameters& aParameters) {
|
||||
if (ForceActiveLayers()) {
|
||||
return LAYER_ACTIVE;
|
||||
return LayerState::LAYER_ACTIVE;
|
||||
}
|
||||
|
||||
return LAYER_NONE;
|
||||
return LayerState::LAYER_NONE;
|
||||
}
|
||||
|
||||
already_AddRefed<Layer> nsDisplaySolidColor::BuildLayer(
|
||||
@@ -4082,12 +4082,12 @@ LayerState nsDisplayBackgroundImage::GetLayerState(
|
||||
if (shouldLayerize == NO_LAYER_NEEDED) {
|
||||
// We can skip the call to CanOptimizeToImageLayer if we don't want a
|
||||
// layer anyway.
|
||||
return LAYER_NONE;
|
||||
return LayerState::LAYER_NONE;
|
||||
}
|
||||
|
||||
if (CanOptimizeToImageLayer(aManager, aBuilder)) {
|
||||
if (shouldLayerize == WHENEVER_POSSIBLE) {
|
||||
return LAYER_ACTIVE;
|
||||
return LayerState::LAYER_ACTIVE;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(shouldLayerize == ONLY_FOR_SCALING,
|
||||
@@ -4115,11 +4115,11 @@ LayerState nsDisplayBackgroundImage::GetLayerState(
|
||||
// Separate this image into a layer.
|
||||
// There's no point in doing this if we are not scaling at all or if the
|
||||
// target size is pretty small.
|
||||
return LAYER_ACTIVE;
|
||||
return LayerState::LAYER_ACTIVE;
|
||||
}
|
||||
}
|
||||
|
||||
return LAYER_NONE;
|
||||
return LayerState::LAYER_NONE;
|
||||
}
|
||||
|
||||
already_AddRefed<Layer> nsDisplayBackgroundImage::BuildLayer(
|
||||
@@ -4702,15 +4702,15 @@ LayerState nsDisplayBackgroundColor::GetLayerState(
|
||||
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
||||
const ContainerLayerParameters& aParameters) {
|
||||
if (ForceActiveLayers() && !HasBackgroundClipText()) {
|
||||
return LAYER_ACTIVE;
|
||||
return LayerState::LAYER_ACTIVE;
|
||||
}
|
||||
|
||||
if (EffectCompositor::HasAnimationsForCompositor(
|
||||
mFrame, DisplayItemType::TYPE_BACKGROUND_COLOR)) {
|
||||
return LAYER_ACTIVE_FORCE;
|
||||
return LayerState::LAYER_ACTIVE_FORCE;
|
||||
}
|
||||
|
||||
return LAYER_NONE;
|
||||
return LayerState::LAYER_NONE;
|
||||
}
|
||||
|
||||
already_AddRefed<Layer> nsDisplayBackgroundColor::BuildLayer(
|
||||
@@ -5250,7 +5250,7 @@ void nsDisplayBorder::ComputeInvalidationRegion(
|
||||
LayerState nsDisplayBorder::GetLayerState(
|
||||
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
||||
const ContainerLayerParameters& aParameters) {
|
||||
return LAYER_NONE;
|
||||
return LayerState::LAYER_NONE;
|
||||
}
|
||||
|
||||
bool nsDisplayBorder::CreateWebRenderCommands(
|
||||
@@ -5818,42 +5818,44 @@ void nsDisplayWrapList::Paint(nsDisplayListBuilder* aBuilder,
|
||||
|
||||
/**
|
||||
* Returns true if all descendant display items can be placed in the same
|
||||
* PaintedLayer --- GetLayerState returns LAYER_INACTIVE or LAYER_NONE,
|
||||
* and they all have the expected animated geometry root.
|
||||
* PaintedLayer --- GetLayerState returns LayerState::LAYER_INACTIVE or
|
||||
* LayerState::LAYER_NONE, and they all have the expected animated geometry
|
||||
* root.
|
||||
*/
|
||||
static LayerState RequiredLayerStateForChildren(
|
||||
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
||||
const ContainerLayerParameters& aParameters, const nsDisplayList& aList,
|
||||
AnimatedGeometryRoot* aExpectedAnimatedGeometryRootForChildren) {
|
||||
LayerState result = LAYER_INACTIVE;
|
||||
LayerState result = LayerState::LAYER_INACTIVE;
|
||||
for (nsDisplayItem* i : aList) {
|
||||
if (result == LAYER_INACTIVE &&
|
||||
if (result == LayerState::LAYER_INACTIVE &&
|
||||
i->GetAnimatedGeometryRoot() !=
|
||||
aExpectedAnimatedGeometryRootForChildren) {
|
||||
result = LAYER_ACTIVE;
|
||||
result = LayerState::LAYER_ACTIVE;
|
||||
}
|
||||
|
||||
LayerState state = i->GetLayerState(aBuilder, aManager, aParameters);
|
||||
if (state == LAYER_ACTIVE &&
|
||||
if (state == LayerState::LAYER_ACTIVE &&
|
||||
(i->GetType() == DisplayItemType::TYPE_BLEND_MODE ||
|
||||
i->GetType() == DisplayItemType::TYPE_TABLE_BLEND_MODE)) {
|
||||
// nsDisplayBlendMode always returns LAYER_ACTIVE to ensure that the
|
||||
// blending operation happens in the intermediate surface of its parent
|
||||
// display item (usually an nsDisplayBlendContainer). But this does not
|
||||
// mean that it needs all its ancestor display items to become active.
|
||||
// nsDisplayBlendMode always returns LayerState::LAYER_ACTIVE to ensure
|
||||
// that the blending operation happens in the intermediate surface of its
|
||||
// parent display item (usually an nsDisplayBlendContainer). But this does
|
||||
// not mean that it needs all its ancestor display items to become active.
|
||||
// So we ignore its layer state and look at its children instead.
|
||||
state = RequiredLayerStateForChildren(
|
||||
aBuilder, aManager, aParameters,
|
||||
*i->GetSameCoordinateSystemChildren(), i->GetAnimatedGeometryRoot());
|
||||
}
|
||||
if ((state == LAYER_ACTIVE || state == LAYER_ACTIVE_FORCE) &&
|
||||
if ((state == LayerState::LAYER_ACTIVE ||
|
||||
state == LayerState::LAYER_ACTIVE_FORCE) &&
|
||||
state > result) {
|
||||
result = state;
|
||||
}
|
||||
if (state == LAYER_ACTIVE_EMPTY && state > result) {
|
||||
result = LAYER_ACTIVE_FORCE;
|
||||
if (state == LayerState::LAYER_ACTIVE_EMPTY && state > result) {
|
||||
result = LayerState::LAYER_ACTIVE_FORCE;
|
||||
}
|
||||
if (state == LAYER_NONE) {
|
||||
if (state == LayerState::LAYER_NONE) {
|
||||
nsDisplayList* list = i->GetSameCoordinateSystemChildren();
|
||||
if (list) {
|
||||
LayerState childState = RequiredLayerStateForChildren(
|
||||
@@ -6204,13 +6206,13 @@ nsDisplayItem::LayerState nsDisplayOpacity::GetLayerState(
|
||||
// layerization changes for content that won't ever be painted.
|
||||
if (mForEventsAndPluginsOnly) {
|
||||
MOZ_ASSERT(mOpacity == 0);
|
||||
return LAYER_INACTIVE;
|
||||
return LayerState::LAYER_INACTIVE;
|
||||
}
|
||||
|
||||
if (mNeedsActiveLayer) {
|
||||
// Returns LAYER_ACTIVE_FORCE to avoid flatterning the layer for async
|
||||
// animations.
|
||||
return LAYER_ACTIVE_FORCE;
|
||||
// Returns LayerState::LAYER_ACTIVE_FORCE to avoid flatterning the layer for
|
||||
// async animations.
|
||||
return LayerState::LAYER_ACTIVE_FORCE;
|
||||
}
|
||||
|
||||
return RequiredLayerStateForChildren(aBuilder, aManager, aParameters, mList,
|
||||
@@ -6293,7 +6295,7 @@ nsRegion nsDisplayBlendMode::GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
|
||||
LayerState nsDisplayBlendMode::GetLayerState(
|
||||
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
||||
const ContainerLayerParameters& aParameters) {
|
||||
return LAYER_ACTIVE;
|
||||
return LayerState::LAYER_ACTIVE;
|
||||
}
|
||||
|
||||
bool nsDisplayBlendMode::CreateWebRenderCommands(
|
||||
@@ -6471,7 +6473,7 @@ LayerState nsDisplayOwnLayer::GetLayerState(
|
||||
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
||||
const ContainerLayerParameters& aParameters) {
|
||||
if (mForceActive) {
|
||||
return mozilla::LAYER_ACTIVE_FORCE;
|
||||
return mozilla::LayerState::LAYER_ACTIVE_FORCE;
|
||||
}
|
||||
|
||||
return RequiredLayerStateForChildren(aBuilder, aManager, aParameters, mList,
|
||||
@@ -7373,7 +7375,7 @@ already_AddRefed<Layer> nsDisplayScrollInfoLayer::BuildLayer(
|
||||
LayerState nsDisplayScrollInfoLayer::GetLayerState(
|
||||
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
||||
const ContainerLayerParameters& aParameters) {
|
||||
return LAYER_ACTIVE_EMPTY;
|
||||
return LayerState::LAYER_ACTIVE_EMPTY;
|
||||
}
|
||||
|
||||
UniquePtr<ScrollMetadata> nsDisplayScrollInfoLayer::ComputeScrollMetadata(
|
||||
@@ -8341,13 +8343,13 @@ nsDisplayItem::LayerState nsDisplayTransform::GetLayerState(
|
||||
// the transform is 2D.
|
||||
if (!GetTransform().Is2D() || Combines3DTransformWithAncestors() ||
|
||||
mIsTransformSeparator || mFrame->HasPerspective()) {
|
||||
return LAYER_ACTIVE_FORCE;
|
||||
return LayerState::LAYER_ACTIVE_FORCE;
|
||||
}
|
||||
|
||||
if (MayBeAnimated(aBuilder)) {
|
||||
// Returns LAYER_ACTIVE_FORCE to avoid flatterning the layer for async
|
||||
// animations.
|
||||
return LAYER_ACTIVE_FORCE;
|
||||
// Returns LayerState::LAYER_ACTIVE_FORCE to avoid flatterning the layer for
|
||||
// async animations.
|
||||
return LayerState::LAYER_ACTIVE_FORCE;
|
||||
}
|
||||
|
||||
// Expect the child display items to have this frame as their animated
|
||||
@@ -8843,7 +8845,7 @@ already_AddRefed<Layer> nsDisplayPerspective::BuildLayer(
|
||||
LayerState nsDisplayPerspective::GetLayerState(
|
||||
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
||||
const ContainerLayerParameters& aParameters) {
|
||||
return LAYER_ACTIVE_FORCE;
|
||||
return LayerState::LAYER_ACTIVE_FORCE;
|
||||
}
|
||||
|
||||
nsRegion nsDisplayPerspective::GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
|
||||
@@ -9446,12 +9448,14 @@ LayerState nsDisplayMasksAndClipPaths::GetLayerState(
|
||||
// When we're not active, FrameLayerBuilder will call PaintAsLayer()
|
||||
// on us during painting. In that case we don't want a mask layer to
|
||||
// be created, because PaintAsLayer() takes care of applying the mask.
|
||||
// So we return LAYER_SVG_EFFECTS instead of LAYER_INACTIVE so that
|
||||
// FrameLayerBuilder doesn't set a mask layer on our layer.
|
||||
return result == LAYER_INACTIVE ? LAYER_SVG_EFFECTS : result;
|
||||
// So we return LayerState::LAYER_SVG_EFFECTS instead of
|
||||
// LayerState::LAYER_INACTIVE so that FrameLayerBuilder doesn't set a mask
|
||||
// layer on our layer.
|
||||
return result == LayerState::LAYER_INACTIVE ? LayerState::LAYER_SVG_EFFECTS
|
||||
: result;
|
||||
}
|
||||
|
||||
return LAYER_SVG_EFFECTS;
|
||||
return LayerState::LAYER_SVG_EFFECTS;
|
||||
}
|
||||
|
||||
bool nsDisplayMasksAndClipPaths::CanPaintOnMaskLayer(LayerManager* aManager) {
|
||||
@@ -9828,7 +9832,7 @@ already_AddRefed<Layer> nsDisplayFilters::BuildLayer(
|
||||
LayerState nsDisplayFilters::GetLayerState(
|
||||
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
||||
const ContainerLayerParameters& aParameters) {
|
||||
return LAYER_SVG_EFFECTS;
|
||||
return LayerState::LAYER_SVG_EFFECTS;
|
||||
}
|
||||
|
||||
bool nsDisplayFilters::ComputeVisibility(nsDisplayListBuilder* aBuilder,
|
||||
@@ -10057,9 +10061,9 @@ LayerState nsDisplaySVGWrapper::GetLayerState(
|
||||
RefPtr<LayerManager> layerManager = aBuilder->GetWidgetLayerManager();
|
||||
if (layerManager &&
|
||||
layerManager->GetBackendType() == layers::LayersBackend::LAYERS_WR) {
|
||||
return LAYER_ACTIVE_FORCE;
|
||||
return LayerState::LAYER_ACTIVE_FORCE;
|
||||
}
|
||||
return LAYER_NONE;
|
||||
return LayerState::LAYER_NONE;
|
||||
}
|
||||
|
||||
bool nsDisplaySVGWrapper::ShouldFlattenAway(nsDisplayListBuilder* aBuilder) {
|
||||
@@ -10118,9 +10122,9 @@ LayerState nsDisplayForeignObject::GetLayerState(
|
||||
RefPtr<LayerManager> layerManager = aBuilder->GetWidgetLayerManager();
|
||||
if (layerManager &&
|
||||
layerManager->GetBackendType() == layers::LayersBackend::LAYERS_WR) {
|
||||
return LAYER_ACTIVE_FORCE;
|
||||
return LayerState::LAYER_ACTIVE_FORCE;
|
||||
}
|
||||
return LAYER_NONE;
|
||||
return LayerState::LAYER_NONE;
|
||||
}
|
||||
|
||||
bool nsDisplayForeignObject::ShouldFlattenAway(nsDisplayListBuilder* aBuilder) {
|
||||
|
||||
@@ -2720,7 +2720,7 @@ class nsDisplayItem : public nsDisplayItemBase {
|
||||
virtual LayerState GetLayerState(
|
||||
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
||||
const ContainerLayerParameters& aParameters) {
|
||||
return mozilla::LAYER_NONE;
|
||||
return mozilla::LayerState::LAYER_NONE;
|
||||
}
|
||||
|
||||
#ifdef MOZ_DUMP_PAINTING
|
||||
@@ -4943,7 +4943,7 @@ class nsDisplayClearBackground : public nsPaintedDisplayItem {
|
||||
LayerState GetLayerState(
|
||||
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
||||
const ContainerLayerParameters& aParameters) override {
|
||||
return mozilla::LAYER_ACTIVE_FORCE;
|
||||
return mozilla::LayerState::LAYER_ACTIVE_FORCE;
|
||||
}
|
||||
|
||||
already_AddRefed<Layer> BuildLayer(
|
||||
@@ -6037,7 +6037,7 @@ class nsDisplaySubDocument : public nsDisplayOwnLayer {
|
||||
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
||||
const ContainerLayerParameters& aParameters) override {
|
||||
if (mShouldFlatten) {
|
||||
return mozilla::LAYER_NONE;
|
||||
return mozilla::LayerState::LAYER_NONE;
|
||||
}
|
||||
return nsDisplayOwnLayer::GetLayerState(aBuilder, aManager, aParameters);
|
||||
}
|
||||
@@ -6118,7 +6118,7 @@ class nsDisplayStickyPosition : public nsDisplayOwnLayer {
|
||||
LayerState GetLayerState(
|
||||
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
||||
const ContainerLayerParameters& aParameters) override {
|
||||
return mozilla::LAYER_ACTIVE;
|
||||
return mozilla::LayerState::LAYER_ACTIVE;
|
||||
}
|
||||
|
||||
bool CreateWebRenderCommands(
|
||||
@@ -6173,7 +6173,7 @@ class nsDisplayFixedPosition : public nsDisplayOwnLayer {
|
||||
LayerState GetLayerState(
|
||||
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
||||
const ContainerLayerParameters& aParameters) override {
|
||||
return mozilla::LAYER_ACTIVE_FORCE;
|
||||
return mozilla::LayerState::LAYER_ACTIVE_FORCE;
|
||||
}
|
||||
|
||||
bool ShouldFixToViewport(nsDisplayListBuilder* aBuilder) const override {
|
||||
@@ -6345,7 +6345,7 @@ class nsDisplayZoom : public nsDisplaySubDocument {
|
||||
LayerState GetLayerState(
|
||||
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
||||
const ContainerLayerParameters& aParameters) override {
|
||||
return mozilla::LAYER_ACTIVE;
|
||||
return mozilla::LayerState::LAYER_ACTIVE;
|
||||
}
|
||||
|
||||
// Get the app units per dev pixel ratio of the child document.
|
||||
@@ -6388,7 +6388,7 @@ class nsDisplayAsyncZoom : public nsDisplayOwnLayer {
|
||||
virtual LayerState GetLayerState(
|
||||
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
||||
const ContainerLayerParameters& aParameters) override {
|
||||
return mozilla::LAYER_ACTIVE_FORCE;
|
||||
return mozilla::LayerState::LAYER_ACTIVE_FORCE;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user