templateObject(), "baseline-callnative-template");
break;
}
+ case ICStub::Call_StringSplit: {
+ ICCall_StringSplit *callStub = toCall_StringSplit();
+ MarkObject(trc, &callStub->templateObject(), "baseline-callstringsplit-template");
+ MarkString(trc, &callStub->expectedArg(), "baseline-callstringsplit-arg");
+ MarkString(trc, &callStub->expectedThis(), "baseline-callstringsplit-this");
+ break;
+ }
case ICStub::GetElem_NativeSlot: {
ICGetElem_NativeSlot *getElemStub = toGetElem_NativeSlot();
MarkShape(trc, &getElemStub->shape(), "baseline-getelem-native-shape");
@@ -8306,6 +8313,25 @@ GetTemplateObjectForNative(JSContext *cx, HandleScript script, jsbytecode *pc,
return true;
}
+static bool
+IsOptimizableCallStringSplit(Value callee, Value thisv, int argc, Value *args)
+{
+ if (argc != 1 || !thisv.isString() || !args[0].isString())
+ return false;
+
+ if (!thisv.toString()->isAtom() || !args[0].toString()->isAtom())
+ return false;
+
+ if (!callee.isObject() || !callee.toObject().is
())
+ return false;
+
+ JSFunction &calleeFun = callee.toObject().as();
+ if (!calleeFun.isNative() || calleeFun.native() != js::str_split)
+ return false;
+
+ return true;
+}
+
static bool
TryAttachCallStub(JSContext *cx, ICCall_Fallback *stub, HandleScript script, jsbytecode *pc,
JSOp op, uint32_t argc, Value *vp, bool constructing, bool isSpread,
@@ -8323,6 +8349,15 @@ TryAttachCallStub(JSContext *cx, ICCall_Fallback *stub, HandleScript script, jsb
RootedValue callee(cx, vp[0]);
RootedValue thisv(cx, vp[1]);
+ // Don't attach an optimized call stub if we could potentially attach an
+ // optimized StringSplit stub.
+ if (stub->numOptimizedStubs() == 0 && IsOptimizableCallStringSplit(callee, thisv, argc, vp + 2))
+ return true;
+
+ JS_ASSERT_IF(stub->hasStub(ICStub::Call_StringSplit), stub->numOptimizedStubs() == 1);
+
+ stub->unlinkStubsWithKind(cx, ICStub::Call_StringSplit);
+
if (!callee.isObject())
return true;
@@ -8469,6 +8504,65 @@ TryAttachCallStub(JSContext *cx, ICCall_Fallback *stub, HandleScript script, jsb
return true;
}
+static bool
+CopyArray(JSContext *cx, HandleObject obj, MutableHandleValue result)
+{
+ JS_ASSERT(obj->is());
+ uint32_t length = obj->as().length();
+ JS_ASSERT(obj->getDenseInitializedLength() == length);
+
+ RootedTypeObject type(cx, obj->getType(cx));
+ if (!type)
+ return false;
+
+ RootedObject newObj(cx, NewDenseArray(cx, length, type, NewArray_FullyAllocating));
+ if (!newObj)
+ return false;
+
+ newObj->setDenseInitializedLength(length);
+ newObj->initDenseElements(0, obj->getDenseElements(), length);
+ result.setObject(*newObj);
+ return true;
+}
+
+static bool
+TryAttachStringSplit(JSContext *cx, ICCall_Fallback *stub, HandleScript script,
+ uint32_t argc, Value *vp, jsbytecode *pc, HandleValue res)
+{
+ if (stub->numOptimizedStubs() != 0)
+ return true;
+
+ RootedValue callee(cx, vp[0]);
+ RootedValue thisv(cx, vp[1]);
+ Value *args = vp + 2;
+
+ if (!IsOptimizableCallStringSplit(callee, thisv, argc, args))
+ return true;
+
+ JS_ASSERT(res.toObject().is());
+ JS_ASSERT(callee.isObject());
+ JS_ASSERT(callee.toObject().is());
+
+ RootedString thisString(cx, thisv.toString());
+ RootedString argString(cx, args[0].toString());
+ RootedObject obj(cx, &res.toObject());
+ RootedValue arr(cx);
+
+ // Copy the array before storing in stub.
+ if (!CopyArray(cx, obj, &arr))
+ return false;
+
+ ICCall_StringSplit::Compiler compiler(cx, stub->fallbackMonitorStub()->firstMonitorStub(),
+ script->pcToOffset(pc), thisString, argString,
+ arr);
+ ICStub *newStub = compiler.getStub(compiler.getStubSpace(script));
+ if (!newStub)
+ return false;
+
+ stub->addNewStub(newStub);
+ return true;
+}
+
static bool
MaybeCloneFunctionAtCallsite(JSContext *cx, MutableHandleValue callee, HandleScript script,
jsbytecode *pc)
@@ -8559,6 +8653,11 @@ DoCallFallback(JSContext *cx, BaselineFrame *frame, ICCall_Fallback *stub_, uint
if (!stub->addMonitorStubForValue(cx, script, res))
return false;
+ // If 'callee' is a potential Call_StringSplit, try to attach an
+ // optimized StringSplit stub.
+ if (!TryAttachStringSplit(cx, stub, script, argc, vp, pc, res))
+ return false;
+
return true;
}
@@ -9241,6 +9340,100 @@ ICCallScriptedCompiler::generateStubCode(MacroAssembler &masm)
return true;
}
+typedef bool (*CopyArrayFn)(JSContext *, HandleObject, MutableHandleValue);
+static const VMFunction CopyArrayInfo = FunctionInfo(CopyArray);
+
+bool
+ICCall_StringSplit::Compiler::generateStubCode(MacroAssembler &masm)
+{
+ // Stack Layout: [ ..., CalleeVal, ThisVal, Arg0Val, +ICStackValueOffset+ ]
+ GeneralRegisterSet regs = availableGeneralRegs(0);
+ Label failureRestoreArgc;
+#ifdef DEBUG
+ Label oneArg;
+ Register argcReg = R0.scratchReg();
+ masm.branch32(Assembler::Equal, argcReg, Imm32(1), &oneArg);
+ masm.assumeUnreachable("Expected argc == 1");
+ masm.bind(&oneArg);
+#endif
+ Register scratchReg = regs.takeAny();
+
+ // Guard that callee is native function js::str_split.
+ {
+ Address calleeAddr(BaselineStackReg, ICStackValueOffset + (2 * sizeof(Value)));
+ ValueOperand calleeVal = regs.takeAnyValue();
+
+ // Ensure that callee is an object.
+ masm.loadValue(calleeAddr, calleeVal);
+ masm.branchTestObject(Assembler::NotEqual, calleeVal, &failureRestoreArgc);
+
+ // Ensure that callee is a function.
+ Register calleeObj = masm.extractObject(calleeVal, ExtractTemp0);
+ masm.branchTestObjClass(Assembler::NotEqual, calleeObj, scratchReg,
+ &JSFunction::class_, &failureRestoreArgc);
+
+ // Ensure that callee's function impl is the native str_split.
+ masm.loadPtr(Address(calleeObj, JSFunction::offsetOfNativeOrScript()), scratchReg);
+ masm.branchPtr(Assembler::NotEqual, scratchReg, ImmPtr(js::str_split), &failureRestoreArgc);
+
+ regs.add(calleeVal);
+ }
+
+ // Guard argument.
+ {
+ // Ensure that arg is a string.
+ Address argAddr(BaselineStackReg, ICStackValueOffset);
+ ValueOperand argVal = regs.takeAnyValue();
+
+ masm.loadValue(argAddr, argVal);
+ masm.branchTestString(Assembler::NotEqual, argVal, &failureRestoreArgc);
+
+ Register argString = masm.extractString(argVal, ExtractTemp0);
+ masm.branchPtr(Assembler::NotEqual, Address(BaselineStubReg, offsetOfExpectedArg()),
+ argString, &failureRestoreArgc);
+ regs.add(argVal);
+ }
+
+ // Guard this-value.
+ {
+ // Ensure that thisv is a string.
+ Address thisvAddr(BaselineStackReg, ICStackValueOffset + sizeof(Value));
+ ValueOperand thisvVal = regs.takeAnyValue();
+
+ masm.loadValue(thisvAddr, thisvVal);
+ masm.branchTestString(Assembler::NotEqual, thisvVal, &failureRestoreArgc);
+
+ Register thisvString = masm.extractString(thisvVal, ExtractTemp0);
+ masm.branchPtr(Assembler::NotEqual, Address(BaselineStubReg, offsetOfExpectedThis()),
+ thisvString, &failureRestoreArgc);
+ regs.add(thisvVal);
+ }
+
+ // Main stub body.
+ {
+ Register paramReg = regs.takeAny();
+
+ // Push arguments.
+ enterStubFrame(masm, scratchReg);
+ masm.loadPtr(Address(BaselineStubReg, offsetOfTemplateObject()), paramReg);
+ masm.push(paramReg);
+
+ if (!callVM(CopyArrayInfo, masm))
+ return false;
+ leaveStubFrame(masm);
+ regs.add(paramReg);
+ }
+
+ // Enter type monitor IC to type-check result.
+ EmitEnterTypeMonitorIC(masm);
+
+ // Guard failure path.
+ masm.bind(&failureRestoreArgc);
+ masm.move32(Imm32(1), R0.scratchReg());
+ EmitStubGuardFailure(masm);
+ return true;
+}
+
bool
ICCall_Native::Compiler::generateStubCode(MacroAssembler &masm)
{
diff --git a/js/src/jit/BaselineIC.h b/js/src/jit/BaselineIC.h
index 60228ed61c85..0c168187a44d 100644
--- a/js/src/jit/BaselineIC.h
+++ b/js/src/jit/BaselineIC.h
@@ -377,6 +377,7 @@ class ICEntry
_(Call_ScriptedApplyArray) \
_(Call_ScriptedApplyArguments) \
_(Call_ScriptedFunCall) \
+ _(Call_StringSplit) \
\
_(GetElem_Fallback) \
_(GetElem_NativeSlot) \
@@ -791,6 +792,7 @@ class ICStub
case Call_ScriptedApplyArray:
case Call_ScriptedApplyArguments:
case Call_ScriptedFunCall:
+ case Call_StringSplit:
case WarmUpCounter_Fallback:
case GetElem_NativeSlot:
case GetElem_NativePrototypeSlot:
@@ -6047,6 +6049,91 @@ class ICCall_ScriptedFunCall : public ICMonitoredStub
};
};
+class ICCall_StringSplit : public ICMonitoredStub
+{
+ friend class ICStubSpace;
+
+ protected:
+ uint32_t pcOffset_;
+ HeapPtrString expectedThis_;
+ HeapPtrString expectedArg_;
+ HeapPtrObject templateObject_;
+
+ ICCall_StringSplit(JitCode *stubCode, ICStub *firstMonitorStub, uint32_t pcOffset, HandleString thisString,
+ HandleString argString, HandleObject templateObject)
+ : ICMonitoredStub(ICStub::Call_StringSplit, stubCode, firstMonitorStub),
+ pcOffset_(pcOffset), expectedThis_(thisString), expectedArg_(argString),
+ templateObject_(templateObject)
+ { }
+
+ public:
+ static inline ICCall_StringSplit *New(ICStubSpace *space, JitCode *code,
+ ICStub *firstMonitorStub, uint32_t pcOffset, HandleString thisString,
+ HandleString argString, HandleObject templateObject)
+ {
+ if (!code)
+ return nullptr;
+ return space->allocate(code, firstMonitorStub, pcOffset, thisString,
+ argString, templateObject);
+ }
+
+ static size_t offsetOfExpectedThis() {
+ return offsetof(ICCall_StringSplit, expectedThis_);
+ }
+
+ static size_t offsetOfExpectedArg() {
+ return offsetof(ICCall_StringSplit, expectedArg_);
+ }
+
+ static size_t offsetOfTemplateObject() {
+ return offsetof(ICCall_StringSplit, templateObject_);
+ }
+
+ HeapPtrString &expectedThis() {
+ return expectedThis_;
+ }
+
+ HeapPtrString &expectedArg() {
+ return expectedArg_;
+ }
+
+ HeapPtrObject &templateObject() {
+ return templateObject_;
+ }
+
+ class Compiler : public ICCallStubCompiler {
+ protected:
+ ICStub *firstMonitorStub_;
+ uint32_t pcOffset_;
+ RootedString expectedThis_;
+ RootedString expectedArg_;
+ RootedObject templateObject_;
+
+ bool generateStubCode(MacroAssembler &masm);
+
+ virtual int32_t getKey() const {
+ return static_cast(kind);
+ }
+
+ public:
+ Compiler(JSContext *cx, ICStub *firstMonitorStub, uint32_t pcOffset, HandleString thisString,
+ HandleString argString, HandleValue templateObject)
+ : ICCallStubCompiler(cx, ICStub::Call_StringSplit),
+ firstMonitorStub_(firstMonitorStub),
+ pcOffset_(pcOffset),
+ expectedThis_(cx, thisString),
+ expectedArg_(cx, argString),
+ templateObject_(cx, &templateObject.toObject())
+ { }
+
+ ICStub *getStub(ICStubSpace *space) {
+ return ICCall_StringSplit::New(space, getStubCode(), firstMonitorStub_,
+ pcOffset_, expectedThis_, expectedArg_,
+ templateObject_);
+ }
+ };
+};
+
// Stub for performing a TableSwitch, updating the IC's return address to jump
// to whatever point the switch is branching to.
class ICTableSwitch : public ICStub
diff --git a/js/src/jit/MIR.cpp b/js/src/jit/MIR.cpp
index 53c31aa9abec..d6e2e09f2f51 100644
--- a/js/src/jit/MIR.cpp
+++ b/js/src/jit/MIR.cpp
@@ -1222,12 +1222,12 @@ MPhi::foldsTernary()
if (testArg != test->input())
return nullptr;
- // If testArg is a number type we can:
+ // If testArg is an int32 type we can:
// - fold testArg ? testArg : 0 to testArg
// - fold testArg ? 0 : testArg to 0
- if (IsNumberType(testArg->type()) && c->vp()->toNumber() == 0) {
+ if (testArg->type() == MIRType_Int32 && c->vp()->toNumber() == 0) {
// When folding to the constant we need to hoist it.
- if (trueDef == c)
+ if (trueDef == c && !c->block()->dominates(block()))
c->block()->moveBefore(pred->lastIns(), c);
return trueDef;
}
@@ -1239,7 +1239,7 @@ MPhi::foldsTernary()
c->vp()->toString() == GetIonContext()->runtime->emptyString())
{
// When folding to the constant we need to hoist it.
- if (trueDef == c)
+ if (trueDef == c && !c->block()->dominates(block()))
c->block()->moveBefore(pred->lastIns(), c);
return trueDef;
}
diff --git a/js/src/jit/shared/CodeGenerator-shared.cpp b/js/src/jit/shared/CodeGenerator-shared.cpp
index 97ecdeeaf40c..16227afe0d94 100644
--- a/js/src/jit/shared/CodeGenerator-shared.cpp
+++ b/js/src/jit/shared/CodeGenerator-shared.cpp
@@ -76,19 +76,24 @@ CodeGeneratorShared::CodeGeneratorShared(MIRGenerator *gen, LIRGraph *graph, Mac
JS_ASSERT(graph->argumentSlotCount() == 0);
frameDepth_ += gen->maxAsmJSStackArgBytes();
- // If the function uses any SIMD, we may need to insert padding so that
- // local slots are aligned for SIMD.
if (gen->usesSimd()) {
- frameInitialAdjustment_ = ComputeByteAlignment(sizeof(AsmJSFrame), AsmJSStackAlignment);
+ // If the function uses any SIMD then we may need to insert padding
+ // so that local slots are aligned for SIMD.
+ frameInitialAdjustment_ = ComputeByteAlignment(sizeof(AsmJSFrame),
+ AsmJSStackAlignment);
frameDepth_ += frameInitialAdjustment_;
+ // Keep the stack aligned. Some SIMD sequences build values on the
+ // stack and need the stack aligned.
+ frameDepth_ += ComputeByteAlignment(sizeof(AsmJSFrame) + frameDepth_,
+ AsmJSStackAlignment);
+ } else if (gen->performsCall()) {
+ // An MAsmJSCall does not align the stack pointer at calls sites but
+ // instead relies on the a priori stack adjustment. This must be the
+ // last adjustment of frameDepth_.
+ frameDepth_ += ComputeByteAlignment(sizeof(AsmJSFrame) + frameDepth_,
+ AsmJSStackAlignment);
}
- // An MAsmJSCall does not align the stack pointer at calls sites but instead
- // relies on the a priori stack adjustment. This must be the last
- // adjustment of frameDepth_.
- if (gen->performsCall())
- frameDepth_ += ComputeByteAlignment(sizeof(AsmJSFrame) + frameDepth_, AsmJSStackAlignment);
-
// FrameSizeClass is only used for bailing, which cannot happen in
// asm.js code.
frameClass_ = FrameSizeClass::None();
diff --git a/js/src/jsobjinlines.h b/js/src/jsobjinlines.h
index 7e8d49cd87c2..0d44423c22e2 100644
--- a/js/src/jsobjinlines.h
+++ b/js/src/jsobjinlines.h
@@ -543,6 +543,10 @@ JSObject::create(js::ExclusiveContext *cx, js::gc::AllocKind kind, js::gc::Initi
if (span)
obj->initializeSlotRange(0, span);
+ // JSFunction's fixed slots expect POD-style initialization.
+ if (type->clasp()->isJSFunction())
+ memset(obj->fixedSlots(), 0, sizeof(js::HeapSlot) * GetGCKindSlots(kind));
+
js::gc::TraceCreateObject(obj);
return obj;
diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp
index 873f1841869f..daebe822b80c 100644
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -130,7 +130,7 @@ FrameLayerBuilder::DisplayItemData::BeginUpdate(Layer* aLayer, LayerState aState
mContainerLayerGeneration = aContainerLayerGeneration;
mUsed = true;
- if (aLayer->AsThebesLayer()) {
+ if (aLayer->AsPaintedLayer()) {
mItem = aItem;
}
@@ -241,17 +241,17 @@ static inline MaskLayerImageCache* GetMaskLayerImageCache()
}
/**
- * We keep a stack of these to represent the ThebesLayers that are
+ * We keep a stack of these to represent the PaintedLayers that are
* currently available to have display items added to.
* We use a stack here because as much as possible we want to
- * assign display items to existing ThebesLayers, and to the lowest
- * ThebesLayer in z-order. This reduces the number of layers and
+ * assign display items to existing PaintedLayers, and to the lowest
+ * PaintedLayer in z-order. This reduces the number of layers and
* makes it more likely a display item will be rendered to an opaque
* layer, giving us the best chance of getting subpixel AA.
*/
-class ThebesLayerData {
+class PaintedLayerData {
public:
- ThebesLayerData() :
+ PaintedLayerData() :
mAnimatedGeometryRoot(nullptr),
mFixedPosFrameForLayerData(nullptr),
mReferenceFrame(nullptr),
@@ -268,7 +268,7 @@ public:
mAllDrawingAbove(false)
{}
/**
- * Record that an item has been added to the ThebesLayer, so we
+ * Record that an item has been added to the PaintedLayer, so we
* need to update our regions.
* @param aVisibleRect the area of the item that's visible
* @param aDrawRect the area of the item that would be drawn if it
@@ -290,7 +290,7 @@ public:
/**
* Add aHitRegion, aMaybeHitRegion, and aDispatchToContentHitRegion to the
- * hit regions for this ThebesLayer.
+ * hit regions for this PaintedLayer.
*/
void AccumulateEventRegions(const nsRegion& aHitRegion,
const nsRegion& aMaybeHitRegion,
@@ -324,7 +324,7 @@ public:
}
}
- void CopyAboveRegion(ThebesLayerData* aOther)
+ void CopyAboveRegion(PaintedLayerData* aOther)
{
if (aOther->mAllDrawingAbove || mAllDrawingAbove) {
SetAllDrawingAbove();
@@ -380,11 +380,11 @@ public:
*/
nsAutoCString mLog;
- #define FLB_LOG_THEBES_DECISION(tld, ...) \
+ #define FLB_LOG_PAINTED_LAYER_DECISION(tld, ...) \
tld->mLog.AppendPrintf("\t\t\t\t"); \
tld->mLog.AppendPrintf(__VA_ARGS__);
#else
- #define FLB_LOG_THEBES_DECISION(...)
+ #define FLB_LOG_PAINTED_LAYER_DECISION(...)
#endif
/**
@@ -406,20 +406,20 @@ public:
*/
nsIntRegion mOpaqueRegion;
/**
- * The definitely-hit region for this ThebesLayer.
+ * The definitely-hit region for this PaintedLayer.
*/
nsRegion mHitRegion;
/**
- * The maybe-hit region for this ThebesLayer.
+ * The maybe-hit region for this PaintedLayer.
*/
nsRegion mMaybeHitRegion;
/**
- * The dispatch-to-content hit region for this ThebesLayer.
+ * The dispatch-to-content hit region for this PaintedLayer.
*/
nsRegion mDispatchToContentHitRegion;
/**
* The "active scrolled root" for all content in the layer. Must
- * be non-null; all content in a ThebesLayer must have the same
+ * be non-null; all content in a PaintedLayer must have the same
* active scrolled root.
*/
const nsIFrame* mAnimatedGeometryRoot;
@@ -430,7 +430,7 @@ public:
*/
const nsIFrame* mFixedPosFrameForLayerData;
const nsIFrame* mReferenceFrame;
- ThebesLayer* mLayer;
+ PaintedLayer* mLayer;
/**
* If mIsSolidColorInVisibleRegion is true, this is the color of the visible
* region.
@@ -458,14 +458,14 @@ public:
*/
bool mForceTransparentSurface;
/**
- * Set if all layers below this ThebesLayer should be hidden.
+ * Set if all layers below this PaintedLayer should be hidden.
*/
bool mHideAllLayersBelow;
/**
* Set if the opaque region for this layer can be applied to the parent
* animated geometry root of this layer's animated geometry root.
- * We set this when a ThebesLayer's animated geometry root is a scrollframe
- * and the ThebesLayer completely fills the displayport of the scrollframe.
+ * We set this when a PaintedLayer's animated geometry root is a scrollframe
+ * and the PaintedLayer completely fills the displayport of the scrollframe.
*/
bool mOpaqueForAnimatedGeometryRootParent;
@@ -479,7 +479,7 @@ public:
* image, a clip for SOME item in the layer. There is no guarantee which
* item's clip will be stored here and mItemClip should not be used to clip
* the whole layer - only some part of the clip should be used, as determined
- * by ThebesDisplayItemLayerUserData::GetCommonClipCount() - which may even be
+ * by PaintedDisplayItemLayerUserData::GetCommonClipCount() - which may even be
* no part at all.
*/
DisplayItemClip mItemClip;
@@ -509,18 +509,18 @@ public:
private:
/**
* The region of visible content above the layer and below the
- * next ThebesLayerData currently in the stack, if any. Note that not
- * all ThebesLayers for the container are in the ThebesLayerData stack.
+ * next PaintedLayerData currently in the stack, if any. Note that not
+ * all PaintedLayers for the container are in the PaintedLayerData stack.
* Same coordinate system as mVisibleRegion.
* This is a conservative approximation: it contains the true region.
*/
nsIntRegion mVisibleAboveRegion;
/**
* The region containing the bounds of all display items (regardless
- * of visibility) in the layer and below the next ThebesLayerData
+ * of visibility) in the layer and below the next PaintedLayerData
* currently in the stack, if any.
- * Note that not all ThebesLayers for the container are in the
- * ThebesLayerData stack.
+ * Note that not all PaintedLayers for the container are in the
+ * PaintedLayerData stack.
* Same coordinate system as mVisibleRegion.
*/
nsIntRegion mDrawAboveRegion;
@@ -541,7 +541,7 @@ struct NewLayerEntry {
, mOpaqueForAnimatedGeometryRootParent(false)
, mPropagateComponentAlphaFlattening(true)
{}
- // mLayer is null if the previous entry is for a ThebesLayer that hasn't
+ // mLayer is null if the previous entry is for a PaintedLayer that hasn't
// been optimized to some other form (yet).
nsRefPtr mLayer;
const nsIFrame* mAnimatedGeometryRoot;
@@ -594,7 +594,7 @@ public:
mContainerLayer(aContainerLayer),
mContainerBounds(aContainerBounds),
mParameters(aParameters),
- mNextFreeRecycledThebesLayer(0),
+ mNextFreeRecycledPaintedLayer(0),
mFlattenToSingleLayer(aFlattenToSingleLayer)
{
nsPresContext* presContext = aContainerFrame->PresContext();
@@ -623,8 +623,8 @@ public:
*/
void ProcessDisplayItems(nsDisplayList* aList);
/**
- * This finalizes all the open ThebesLayers by popping every element off
- * mThebesLayerDataStack, then sets the children of the container layer
+ * This finalizes all the open PaintedLayers by popping every element off
+ * mPaintedLayerDataStack, then sets the children of the container layer
* to be all the layers in mNewChildLayers in that order and removes any
* layers as children of the container that aren't in mNewChildLayers.
* @param aTextContentFlags if any child layer has CONTENT_COMPONENT_ALPHA,
@@ -694,27 +694,27 @@ public:
const nsIntRect* aLayerContentsVisibleRect = nullptr) const;
protected:
- friend class ThebesLayerData;
+ friend class PaintedLayerData;
/**
- * Grab the next recyclable ThebesLayer, or create one if there are no
- * more recyclable ThebesLayers. Does any necessary invalidation of
- * a recycled ThebesLayer, and sets up the transform on the ThebesLayer
+ * Grab the next recyclable PaintedLayer, or create one if there are no
+ * more recyclable PaintedLayers. Does any necessary invalidation of
+ * a recycled PaintedLayer, and sets up the transform on the PaintedLayer
* to account for scrolling.
*/
- already_AddRefed CreateOrRecycleThebesLayer(const nsIFrame* aAnimatedGeometryRoot,
+ already_AddRefed CreateOrRecyclePaintedLayer(const nsIFrame* aAnimatedGeometryRoot,
const nsIFrame *aReferenceFrame,
const nsPoint& aTopLeft);
/**
* Grab the next recyclable ColorLayer, or create one if there are no
* more recyclable ColorLayers.
*/
- already_AddRefed CreateOrRecycleColorLayer(ThebesLayer* aThebes);
+ already_AddRefed CreateOrRecycleColorLayer(PaintedLayer* aPainted);
/**
* Grab the next recyclable ImageLayer, or create one if there are no
* more recyclable ImageLayers.
*/
- already_AddRefed CreateOrRecycleImageLayer(ThebesLayer* aThebes);
+ already_AddRefed CreateOrRecycleImageLayer(PaintedLayer* aPainted);
/**
* Grab a recyclable ImageLayer for use as a mask layer for aLayer (that is a
* mask layer which has been used for aLayer before), or create one if such
@@ -722,25 +722,25 @@ protected:
*/
already_AddRefed CreateOrRecycleMaskImageLayerFor(Layer* aLayer);
/**
- * Grabs all ThebesLayers and ColorLayers from the ContainerLayer and makes them
+ * Grabs all PaintedLayers and ColorLayers from the ContainerLayer and makes them
* available for recycling.
*/
void CollectOldLayers();
/**
- * If aItem used to belong to a ThebesLayer, invalidates the area of
- * aItem in that layer. If aNewLayer is a ThebesLayer, invalidates the area of
+ * If aItem used to belong to a PaintedLayer, invalidates the area of
+ * aItem in that layer. If aNewLayer is a PaintedLayer, invalidates the area of
* aItem in that layer.
*/
void InvalidateForLayerChange(nsDisplayItem* aItem,
- ThebesLayer* aNewLayer);
+ PaintedLayer* aNewLayer);
/**
- * Try to determine whether the ThebesLayer at aThebesLayerIndex
+ * Try to determine whether the PaintedLayer at aPaintedLayerIndex
* has a single opaque color behind it, over the entire bounds of its visible
* region.
* If successful, return that color, otherwise return NS_RGBA(0,0,0,0).
*/
- nscolor FindOpaqueBackgroundColorFor(int32_t aThebesLayerIndex);
+ nscolor FindOpaqueBackgroundColorFor(int32_t aPaintedLayerIndex);
/**
* Find the fixed-pos frame, if any, containing (or equal to)
* aAnimatedGeometryRoot. Only return a fixed-pos frame if its viewport
@@ -803,21 +803,21 @@ protected:
bool* aOpaqueForAnimatedGeometryRootParent);
/**
- * Indicate that we are done adding items to the ThebesLayer at the top of
- * mThebesLayerDataStack. Set the final visible region and opaque-content
+ * Indicate that we are done adding items to the PaintedLayer at the top of
+ * mPaintedLayerDataStack. Set the final visible region and opaque-content
* flag, and pop it off the stack.
*/
- void PopThebesLayerData();
+ void PopPaintedLayerData();
/**
- * Find the ThebesLayer to which we should assign the next display item.
- * We scan the ThebesLayerData stack to find the topmost ThebesLayer
+ * Find the PaintedLayer to which we should assign the next display item.
+ * We scan the PaintedLayerData stack to find the topmost PaintedLayer
* that is compatible with the display item (i.e., has the same
* active scrolled root), and that has no content from other layers above
* it and intersecting the aVisibleRect.
- * Returns the layer, and also updates the ThebesLayerData. Will
- * push a new ThebesLayerData onto the stack if no suitable existing
- * layer is found. If we choose a ThebesLayer that's already on the
- * ThebesLayerData stack, later elements on the stack will be popped off.
+ * Returns the layer, and also updates the PaintedLayerData. Will
+ * push a new PaintedLayerData onto the stack if no suitable existing
+ * layer is found. If we choose a PaintedLayer that's already on the
+ * PaintedLayerData stack, later elements on the stack will be popped off.
* @param aVisibleRect the area of the next display item that's visible
* @param aAnimatedGeometryRoot the active scrolled root for the next
* display item
@@ -828,15 +828,15 @@ protected:
* and we will be adding fixed-pos metadata for this layer because the
* display item returned true from ShouldFixToViewport.
*/
- ThebesLayerData* FindThebesLayerFor(nsDisplayItem* aItem,
+ PaintedLayerData* FindPaintedLayerFor(nsDisplayItem* aItem,
const nsIntRect& aVisibleRect,
const nsIFrame* aAnimatedGeometryRoot,
const nsPoint& aTopLeft,
bool aShouldFixToViewport);
- ThebesLayerData* GetTopThebesLayerData()
+ PaintedLayerData* GetTopPaintedLayerData()
{
- return mThebesLayerDataStack.IsEmpty() ? nullptr
- : mThebesLayerDataStack[mThebesLayerDataStack.Length() - 1].get();
+ return mPaintedLayerDataStack.IsEmpty() ? nullptr
+ : mPaintedLayerDataStack[mPaintedLayerDataStack.Length() - 1].get();
}
/* Build a mask layer to represent the clipping region. Will return null if
@@ -846,7 +846,7 @@ protected:
* aLayer is the layer to be clipped.
* aLayerVisibleRegion is the region that will be set as aLayer's visible region,
* relative to the container reference frame
- * aRoundedRectClipCount is used when building mask layers for ThebesLayers,
+ * aRoundedRectClipCount is used when building mask layers for PaintedLayers,
* SetupMaskLayer will build a mask layer for only the first
* aRoundedRectClipCount rounded rects in aClip
*/
@@ -869,35 +869,35 @@ protected:
DebugOnly mAccumulatedChildBounds;
ContainerLayerParameters mParameters;
/**
- * The region of ThebesLayers that should be invalidated every time
+ * The region of PaintedLayers that should be invalidated every time
* we recycle one.
*/
- nsIntRegion mInvalidThebesContent;
- nsAutoTArray,1> mThebesLayerDataStack;
+ nsIntRegion mInvalidPaintedContent;
+ nsAutoTArray,1> mPaintedLayerDataStack;
/**
* We collect the list of children in here. During ProcessDisplayItems,
* the layers in this array either have mContainerLayer as their parent,
* or no parent.
- * ThebesLayers have two entries in this array: the second one is used only if
- * the ThebesLayer is optimized away to a ColorLayer or ImageLayer.
- * It's essential that this array is only appended to, since ThebesLayerData
- * records the index of its ThebesLayer in this array.
+ * PaintedLayers have two entries in this array: the second one is used only if
+ * the PaintedLayer is optimized away to a ColorLayer or ImageLayer.
+ * It's essential that this array is only appended to, since PaintedLayerData
+ * records the index of its PaintedLayer in this array.
*/
typedef nsAutoTArray AutoLayersArray;
AutoLayersArray mNewChildLayers;
- nsTArray > mRecycledThebesLayers;
+ nsTArray > mRecycledPaintedLayers;
nsDataHashtable, nsRefPtr >
mRecycledMaskImageLayers;
- uint32_t mNextFreeRecycledThebesLayer;
+ uint32_t mNextFreeRecycledPaintedLayer;
nscoord mAppUnitsPerDevPixel;
bool mSnappingEnabled;
bool mFlattenToSingleLayer;
};
-class ThebesDisplayItemLayerUserData : public LayerUserData
+class PaintedDisplayItemLayerUserData : public LayerUserData
{
public:
- ThebesDisplayItemLayerUserData() :
+ PaintedDisplayItemLayerUserData() :
mMaskClipCount(0),
mForcedBackgroundColor(NS_RGBA(0,0,0,0)),
mXScale(1.f), mYScale(1.f),
@@ -906,7 +906,7 @@ public:
mAnimatedGeometryRootPosition(0, 0) {}
/**
- * Record the number of clips in the Thebes layer's mask layer.
+ * Record the number of clips in the PaintedLayer's mask layer.
* Should not be reset when the layer is recycled since it is used to track
* changes in the use of mask layers.
*/
@@ -929,21 +929,21 @@ public:
nscoord mAppUnitsPerDevPixel;
/**
- * The offset from the ThebesLayer's 0,0 to the
+ * The offset from the PaintedLayer's 0,0 to the
* reference frame. This isn't necessarily the same as the transform
- * set on the ThebesLayer since we might also be applying an extra
+ * set on the PaintedLayer since we might also be applying an extra
* offset specified by the parent ContainerLayer/
*/
nsIntPoint mTranslation;
/**
- * We try to make 0,0 of the ThebesLayer be the top-left of the
+ * We try to make 0,0 of the PaintedLayer be the top-left of the
* border-box of the "active scrolled root" frame (i.e. the nearest ancestor
* frame for the display items that is being actively scrolled). But
- * we force the ThebesLayer transform to be an integer translation, and we may
- * have a resolution scale, so we have to snap the ThebesLayer transform, so
+ * we force the PaintedLayer transform to be an integer translation, and we may
+ * have a resolution scale, so we have to snap the PaintedLayer transform, so
* 0,0 may not be exactly the top-left of the active scrolled root. Here we
- * store the coordinates in ThebesLayer space of the top-left of the
+ * store the coordinates in PaintedLayer space of the top-left of the
* active scrolled root.
*/
gfxPoint mAnimatedGeometryRootPosition;
@@ -993,15 +993,15 @@ struct MaskLayerUserData : public LayerUserData
};
/**
- * The address of gThebesDisplayItemLayerUserData is used as the user
- * data key for ThebesLayers created by FrameLayerBuilder.
- * It identifies ThebesLayers used to draw non-layer content, which are
+ * The address of gPaintedDisplayItemLayerUserData is used as the user
+ * data key for PaintedLayers created by FrameLayerBuilder.
+ * It identifies PaintedLayers used to draw non-layer content, which are
* therefore eligible for recycling. We want display items to be able to
- * create their own dedicated ThebesLayers in BuildLayer, if necessary,
+ * create their own dedicated PaintedLayers in BuildLayer, if necessary,
* and we wouldn't want to accidentally recycle those.
- * The user data is a ThebesDisplayItemLayerUserData.
+ * The user data is a PaintedDisplayItemLayerUserData.
*/
-uint8_t gThebesDisplayItemLayerUserData;
+uint8_t gPaintedDisplayItemLayerUserData;
/**
* The address of gColorLayerUserData is used as the user
* data key for ColorLayers created by FrameLayerBuilder.
@@ -1036,10 +1036,10 @@ MaskLayerUserData* GetMaskLayerUserData(Layer* aLayer)
return static_cast(aLayer->GetUserData(&gMaskLayerUserData));
}
-ThebesDisplayItemLayerUserData* GetThebesDisplayItemLayerUserData(Layer* aLayer)
+PaintedDisplayItemLayerUserData* GetPaintedDisplayItemLayerUserData(Layer* aLayer)
{
- return static_cast(
- aLayer->GetUserData(&gThebesDisplayItemLayerUserData));
+ return static_cast(
+ aLayer->GetUserData(&gPaintedDisplayItemLayerUserData));
}
/* static */ void
@@ -1053,14 +1053,14 @@ FrameLayerBuilder::Shutdown()
void
FrameLayerBuilder::Init(nsDisplayListBuilder* aBuilder, LayerManager* aManager,
- ThebesLayerData* aLayerData)
+ PaintedLayerData* aLayerData)
{
mDisplayListBuilder = aBuilder;
mRootPresContext = aBuilder->RootReferenceFrame()->PresContext()->GetRootPresContext();
if (mRootPresContext) {
mInitialDOMGeneration = mRootPresContext->GetDOMGeneration();
}
- mContainingThebesLayer = aLayerData;
+ mContainingPaintedLayer = aLayerData;
aManager->SetUserData(&gLayerManagerLayerBuilder, this);
}
@@ -1124,12 +1124,12 @@ AppendToString(nsACString& s, const nsIntRegion& r,
* apply the inverse of that transform before calling InvalidateRegion.
*/
static void
-InvalidatePostTransformRegion(ThebesLayer* aLayer, const nsIntRegion& aRegion,
+InvalidatePostTransformRegion(PaintedLayer* aLayer, const nsIntRegion& aRegion,
const nsIntPoint& aTranslation)
{
// Convert the region from the coordinates of the container layer
// (relative to the snapped top-left of the display list reference frame)
- // to the ThebesLayer's own coordinates
+ // to the PaintedLayer's own coordinates
nsIntRegion rgn = aRegion;
rgn.MoveBy(-aTranslation);
aLayer->InvalidateRegion(rgn);
@@ -1143,12 +1143,12 @@ InvalidatePostTransformRegion(ThebesLayer* aLayer, const nsIntRegion& aRegion,
}
static void
-InvalidatePostTransformRegion(ThebesLayer* aLayer, const nsRect& aRect,
+InvalidatePostTransformRegion(PaintedLayer* aLayer, const nsRect& aRect,
const DisplayItemClip& aClip,
const nsIntPoint& aTranslation)
{
- ThebesDisplayItemLayerUserData* data =
- static_cast(aLayer->GetUserData(&gThebesDisplayItemLayerUserData));
+ PaintedDisplayItemLayerUserData* data =
+ static_cast(aLayer->GetUserData(&gPaintedDisplayItemLayerUserData));
nsRect rect = aClip.ApplyNonRoundedIntersection(aRect);
@@ -1158,12 +1158,12 @@ InvalidatePostTransformRegion(ThebesLayer* aLayer, const nsRect& aRect,
static nsIntPoint
-GetTranslationForThebesLayer(ThebesLayer* aLayer)
+GetTranslationForPaintedLayer(PaintedLayer* aLayer)
{
- ThebesDisplayItemLayerUserData* data =
- static_cast
- (aLayer->GetUserData(&gThebesDisplayItemLayerUserData));
- NS_ASSERTION(data, "Must be a tracked thebes layer!");
+ PaintedDisplayItemLayerUserData* data =
+ static_cast
+ (aLayer->GetUserData(&gPaintedDisplayItemLayerUserData));
+ NS_ASSERTION(data, "Must be a tracked painted layer!");
return data->mTranslation;
}
@@ -1213,16 +1213,16 @@ FrameLayerBuilder::RemoveFrameFromLayerManager(nsIFrame* aFrame,
for (uint32_t i = 0; i < array->Length(); ++i) {
DisplayItemData* data = array->ElementAt(i);
- ThebesLayer* t = data->mLayer->AsThebesLayer();
+ PaintedLayer* t = data->mLayer->AsPaintedLayer();
if (t) {
- ThebesDisplayItemLayerUserData* thebesData =
- static_cast(t->GetUserData(&gThebesDisplayItemLayerUserData));
- if (thebesData) {
+ PaintedDisplayItemLayerUserData* paintedData =
+ static_cast(t->GetUserData(&gPaintedDisplayItemLayerUserData));
+ if (paintedData) {
nsRegion old = data->mGeometry->ComputeInvalidationRegion();
- nsIntRegion rgn = old.ScaleToOutsidePixels(thebesData->mXScale, thebesData->mYScale, thebesData->mAppUnitsPerDevPixel);
- rgn.MoveBy(-GetTranslationForThebesLayer(t));
- thebesData->mRegionToInvalidate.Or(thebesData->mRegionToInvalidate, rgn);
- thebesData->mRegionToInvalidate.SimplifyOutward(8);
+ nsIntRegion rgn = old.ScaleToOutsidePixels(paintedData->mXScale, paintedData->mYScale, paintedData->mAppUnitsPerDevPixel);
+ rgn.MoveBy(-GetTranslationForPaintedLayer(t));
+ paintedData->mRegionToInvalidate.Or(paintedData->mRegionToInvalidate, rgn);
+ paintedData->mRegionToInvalidate.SimplifyOutward(8);
}
}
@@ -1291,7 +1291,7 @@ FrameLayerBuilder::ProcessRemovedDisplayItems(nsRefPtrHashKey*
if (!data->mUsed) {
// This item was visible, but isn't anymore.
- ThebesLayer* t = data->mLayer->AsThebesLayer();
+ PaintedLayer* t = data->mLayer->AsPaintedLayer();
if (t && data->mGeometry) {
#ifdef MOZ_DUMP_PAINTING
if (nsLayoutUtils::InvalidationDebuggingIsEnabled()) {
@@ -1488,10 +1488,10 @@ FrameLayerBuilder::GetDebugOldLayerFor(nsIFrame* aFrame, uint32_t aDisplayItemKe
}
already_AddRefed
-ContainerState::CreateOrRecycleColorLayer(ThebesLayer *aThebes)
+ContainerState::CreateOrRecycleColorLayer(PaintedLayer *aPainted)
{
- ThebesDisplayItemLayerUserData* data =
- static_cast(aThebes->GetUserData(&gThebesDisplayItemLayerUserData));
+ PaintedDisplayItemLayerUserData* data =
+ static_cast(aPainted->GetUserData(&gPaintedDisplayItemLayerUserData));
nsRefPtr layer = data->mColorLayer;
if (layer) {
layer->SetMaskLayer(nullptr);
@@ -1501,21 +1501,21 @@ ContainerState::CreateOrRecycleColorLayer(ThebesLayer *aThebes)
layer = mManager->CreateColorLayer();
if (!layer)
return nullptr;
- // Mark this layer as being used for Thebes-painting display items
+ // Mark this layer as being used for painting display items
data->mColorLayer = layer;
layer->SetUserData(&gColorLayerUserData, nullptr);
- // Remove other layer types we might have stored for this ThebesLayer
+ // Remove other layer types we might have stored for this PaintedLayer
data->mImageLayer = nullptr;
}
return layer.forget();
}
already_AddRefed
-ContainerState::CreateOrRecycleImageLayer(ThebesLayer *aThebes)
+ContainerState::CreateOrRecycleImageLayer(PaintedLayer *aPainted)
{
- ThebesDisplayItemLayerUserData* data =
- static_cast(aThebes->GetUserData(&gThebesDisplayItemLayerUserData));
+ PaintedDisplayItemLayerUserData* data =
+ static_cast(aPainted->GetUserData(&gPaintedDisplayItemLayerUserData));
nsRefPtr layer = data->mImageLayer;
if (layer) {
layer->SetMaskLayer(nullptr);
@@ -1525,11 +1525,11 @@ ContainerState::CreateOrRecycleImageLayer(ThebesLayer *aThebes)
layer = mManager->CreateImageLayer();
if (!layer)
return nullptr;
- // Mark this layer as being used for Thebes-painting display items
+ // Mark this layer as being used for painting display items
data->mImageLayer = layer;
layer->SetUserData(&gImageLayerUserData, nullptr);
- // Remove other layer types we might have stored for this ThebesLayer
+ // Remove other layer types we might have stored for this PaintedLayer
data->mColorLayer = nullptr;
}
return layer.forget();
@@ -1593,7 +1593,7 @@ ResetScrollPositionForLayerPixelAlignment(const nsIFrame* aAnimatedGeometryRoot)
}
static void
-InvalidateEntireThebesLayer(ThebesLayer* aLayer, const nsIFrame* aAnimatedGeometryRoot)
+InvalidateEntirePaintedLayer(PaintedLayer* aLayer, const nsIFrame* aAnimatedGeometryRoot)
{
#ifdef MOZ_DUMP_PAINTING
if (nsLayoutUtils::InvalidationDebuggingIsEnabled()) {
@@ -1606,14 +1606,14 @@ InvalidateEntireThebesLayer(ThebesLayer* aLayer, const nsIFrame* aAnimatedGeomet
ResetScrollPositionForLayerPixelAlignment(aAnimatedGeometryRoot);
}
-already_AddRefed
-ContainerState::CreateOrRecycleThebesLayer(const nsIFrame* aAnimatedGeometryRoot,
+already_AddRefed
+ContainerState::CreateOrRecyclePaintedLayer(const nsIFrame* aAnimatedGeometryRoot,
const nsIFrame* aReferenceFrame,
const nsPoint& aTopLeft)
{
- // We need a new thebes layer
- nsRefPtr layer;
- ThebesDisplayItemLayerUserData* data;
+ // We need a new painted layer
+ nsRefPtr layer;
+ PaintedDisplayItemLayerUserData* data;
bool layerRecycled = false;
#ifndef MOZ_WIDGET_ANDROID
bool didResetScrollPositionForLayerPixelAlignment = false;
@@ -1621,7 +1621,7 @@ ContainerState::CreateOrRecycleThebesLayer(const nsIFrame* aAnimatedGeometryRoot
// Check whether the layer will be scrollable. This is used as a hint to
// influence whether tiled layers are used or not.
- LayerManager::ThebesLayerCreationHint creationHint = LayerManager::NONE;
+ LayerManager::PaintedLayerCreationHint creationHint = LayerManager::NONE;
if (mParameters.mInLowPrecisionDisplayPort ) {
creationHint = LayerManager::SCROLLABLE;
}
@@ -1631,14 +1631,14 @@ ContainerState::CreateOrRecycleThebesLayer(const nsIFrame* aAnimatedGeometryRoot
creationHint = LayerManager::SCROLLABLE;
}
- if (mNextFreeRecycledThebesLayer < mRecycledThebesLayers.Length()) {
+ if (mNextFreeRecycledPaintedLayer < mRecycledPaintedLayers.Length()) {
// Try to recycle a layer
- layer = mRecycledThebesLayers[mNextFreeRecycledThebesLayer];
- ++mNextFreeRecycledThebesLayer;
+ layer = mRecycledPaintedLayers[mNextFreeRecycledPaintedLayer];
+ ++mNextFreeRecycledPaintedLayer;
// Check if the layer hint has changed and whether or not the layer should
// be recreated because of it.
- if (mManager->IsOptimizedFor(layer->AsThebesLayer(), creationHint)) {
+ if (mManager->IsOptimizedFor(layer->AsPaintedLayer(), creationHint)) {
layerRecycled = true;
// Clear clip rect and mask layer so we don't accidentally stay clipped.
@@ -1646,17 +1646,17 @@ ContainerState::CreateOrRecycleThebesLayer(const nsIFrame* aAnimatedGeometryRoot
layer->SetMaskLayer(nullptr);
layer->ClearExtraDumpInfo();
- data = static_cast
- (layer->GetUserData(&gThebesDisplayItemLayerUserData));
- NS_ASSERTION(data, "Recycled ThebesLayers must have user data");
+ data = static_cast
+ (layer->GetUserData(&gPaintedDisplayItemLayerUserData));
+ NS_ASSERTION(data, "Recycled PaintedLayers must have user data");
- // This gets called on recycled ThebesLayers that are going to be in the
+ // This gets called on recycled PaintedLayers that are going to be in the
// final layer tree, so it's a convenient time to invalidate the
- // content that changed where we don't know what ThebesLayer it belonged
+ // content that changed where we don't know what PaintedLayer it belonged
// to, or if we need to invalidate the entire layer, we can do that.
- // This needs to be done before we update the ThebesLayer to its new
+ // This needs to be done before we update the PaintedLayer to its new
// transform. See nsGfxScrollFrame::InvalidateInternal, where
- // we ensure that mInvalidThebesContent is updated according to the
+ // we ensure that mInvalidPaintedContent is updated according to the
// scroll position as of the most recent paint.
if (!FuzzyEqual(data->mXScale, mParameters.mXScale, 0.00001f) ||
!FuzzyEqual(data->mYScale, mParameters.mYScale, 0.00001f) ||
@@ -1666,7 +1666,7 @@ ContainerState::CreateOrRecycleThebesLayer(const nsIFrame* aAnimatedGeometryRoot
printf_stderr("Recycled layer %p changed scale\n", layer.get());
}
#endif
- InvalidateEntireThebesLayer(layer, aAnimatedGeometryRoot);
+ InvalidateEntirePaintedLayer(layer, aAnimatedGeometryRoot);
#ifndef MOZ_WIDGET_ANDROID
didResetScrollPositionForLayerPixelAlignment = true;
#endif
@@ -1689,19 +1689,19 @@ ContainerState::CreateOrRecycleThebesLayer(const nsIFrame* aAnimatedGeometryRoot
}
// We do not need to Invalidate these areas in the widget because we
- // assume the caller of InvalidateThebesLayerContents has ensured
+ // assume the caller of InvalidatePaintedLayerContents has ensured
// the area is invalidated in the widget.
}
}
if (!layerRecycled) {
- // Create a new thebes layer
- layer = mManager->CreateThebesLayerWithHint(creationHint);
+ // Create a new painted layer
+ layer = mManager->CreatePaintedLayerWithHint(creationHint);
if (!layer)
return nullptr;
- // Mark this layer as being used for Thebes-painting display items
- data = new ThebesDisplayItemLayerUserData();
- layer->SetUserData(&gThebesDisplayItemLayerUserData, data);
+ // Mark this layer as being used for painting display items
+ data = new PaintedDisplayItemLayerUserData();
+ layer->SetUserData(&gPaintedDisplayItemLayerUserData, data);
ResetScrollPositionForLayerPixelAlignment(aAnimatedGeometryRoot);
#ifndef MOZ_WIDGET_ANDROID
didResetScrollPositionForLayerPixelAlignment = true;
@@ -1716,7 +1716,7 @@ ContainerState::CreateOrRecycleThebesLayer(const nsIFrame* aAnimatedGeometryRoot
mLayerBuilder->SavePreviousDataForLayer(layer, data->mMaskClipCount);
- // Set up transform so that 0,0 in the Thebes layer corresponds to the
+ // Set up transform so that 0,0 in the Painted layer corresponds to the
// (pixel-snapped) top-left of the aAnimatedGeometryRoot.
nsPoint offset = aAnimatedGeometryRoot->GetOffsetToCrossDoc(aReferenceFrame);
nscoord appUnitsPerDevPixel = aAnimatedGeometryRoot->PresContext()->AppUnitsPerDevPixel();
@@ -1742,7 +1742,7 @@ ContainerState::CreateOrRecycleThebesLayer(const nsIFrame* aAnimatedGeometryRoot
// from what we need.
if (!animatedGeometryRootTopLeft.WithinEpsilonOf(data->mAnimatedGeometryRootPosition, SUBPIXEL_OFFSET_EPSILON)) {
data->mAnimatedGeometryRootPosition = animatedGeometryRootTopLeft;
- InvalidateEntireThebesLayer(layer, aAnimatedGeometryRoot);
+ InvalidateEntirePaintedLayer(layer, aAnimatedGeometryRoot);
} else if (didResetScrollPositionForLayerPixelAlignment) {
data->mAnimatedGeometryRootPosition = animatedGeometryRootTopLeft;
}
@@ -1829,13 +1829,13 @@ ContainerState::SetOuterVisibleRegionForLayer(Layer* aLayer,
}
nscolor
-ContainerState::FindOpaqueBackgroundColorFor(int32_t aThebesLayerIndex)
+ContainerState::FindOpaqueBackgroundColorFor(int32_t aPaintedLayerIndex)
{
- ThebesLayerData* target = mThebesLayerDataStack[aThebesLayerIndex];
- for (int32_t i = aThebesLayerIndex - 1; i >= 0; --i) {
- ThebesLayerData* candidate = mThebesLayerDataStack[i];
+ PaintedLayerData* target = mPaintedLayerDataStack[aPaintedLayerIndex];
+ for (int32_t i = aPaintedLayerIndex - 1; i >= 0; --i) {
+ PaintedLayerData* candidate = mPaintedLayerDataStack[i];
if (candidate->IntersectsVisibleAboveRegion(target->mVisibleRegion)) {
- // Some non-Thebes content between target and candidate; this is
+ // Some non-PaintedLayer content between target and candidate; this is
// hopeless
break;
}
@@ -1853,8 +1853,8 @@ ContainerState::FindOpaqueBackgroundColorFor(int32_t aThebesLayerIndex)
nsRect appUnitRect = deviceRect.ToAppUnits(mAppUnitsPerDevPixel);
appUnitRect.ScaleInverseRoundOut(mParameters.mXScale, mParameters.mYScale);
- FrameLayerBuilder::ThebesLayerItemsEntry* entry =
- mLayerBuilder->GetThebesLayerItemsEntry(candidate->mLayer);
+ FrameLayerBuilder::PaintedLayerItemsEntry* entry =
+ mLayerBuilder->GetPaintedLayerItemsEntry(candidate->mLayer);
NS_ASSERTION(entry, "Must know about this layer!");
for (int32_t j = entry->mItems.Length() - 1; j >= 0; --j) {
nsDisplayItem* item = entry->mItems[j].mItem;
@@ -1901,7 +1901,7 @@ ContainerState::FindOpaqueBackgroundColorFor(int32_t aThebesLayerIndex)
}
void
-ThebesLayerData::UpdateCommonClipCount(
+PaintedLayerData::UpdateCommonClipCount(
const DisplayItemClip& aCurrentClip)
{
if (!mLayer->Manager()->IsWidgetLayerManager()) {
@@ -1917,7 +1917,7 @@ ThebesLayerData::UpdateCommonClipCount(
}
already_AddRefed
-ThebesLayerData::CanOptimizeImageLayer(nsDisplayListBuilder* aBuilder)
+PaintedLayerData::CanOptimizeImageLayer(nsDisplayListBuilder* aBuilder)
{
if (!mImage) {
return nullptr;
@@ -2042,23 +2042,23 @@ ContainerState::SetFixedPositionLayerData(Layer* aLayer,
}
static bool
-CanOptimizeAwayThebesLayer(ThebesLayerData* aData,
+CanOptimizeAwayPaintedLayer(PaintedLayerData* aData,
FrameLayerBuilder* aLayerBuilder)
{
if (!aLayerBuilder->IsBuildingRetainedLayers()) {
return false;
}
- // If there's no thebes layer with valid content in it that we can reuse,
+ // If there's no painted layer with valid content in it that we can reuse,
// always create a color or image layer (and potentially throw away an
- // existing completely invalid thebes layer).
+ // existing completely invalid painted layer).
if (aData->mLayer->GetValidRegion().IsEmpty()) {
return true;
}
- // There is an existing thebes layer we can reuse. Throwing it away can make
+ // There is an existing painted layer we can reuse. Throwing it away can make
// compositing cheaper (see bug 946952), but it might cause us to re-allocate
- // the thebes layer frequently due to an animation. So we only discard it if
+ // the painted layer frequently due to an animation. So we only discard it if
// we're in tree compression mode, which is triggered at a low frequency.
return aLayerBuilder->CheckInLayerTreeCompressionMode();
}
@@ -2077,12 +2077,12 @@ static int32_t FindIndexOfLayerIn(nsTArray& aArray,
#endif
void
-ContainerState::PopThebesLayerData()
+ContainerState::PopPaintedLayerData()
{
- NS_ASSERTION(!mThebesLayerDataStack.IsEmpty(), "Can't pop");
+ NS_ASSERTION(!mPaintedLayerDataStack.IsEmpty(), "Can't pop");
- int32_t lastIndex = mThebesLayerDataStack.Length() - 1;
- ThebesLayerData* data = mThebesLayerDataStack[lastIndex];
+ int32_t lastIndex = mPaintedLayerDataStack.Length() - 1;
+ PaintedLayerData* data = mPaintedLayerDataStack[lastIndex];
AdjustLayerDataForFixedPositioning(data->mFixedPosFrameForLayerData,
data->mDrawRegion,
@@ -2093,13 +2093,13 @@ ContainerState::PopThebesLayerData()
nsRefPtr layer;
nsRefPtr imageContainer = data->CanOptimizeImageLayer(mBuilder);
- FLB_LOG_THEBES_DECISION(data, "Selecting layer for tld=%p\n", data);
- FLB_LOG_THEBES_DECISION(data, " Solid=%i, hasImage=%i, canOptimizeAwayThebes=%i\n",
+ FLB_LOG_PAINTED_LAYER_DECISION(data, "Selecting layer for tld=%p\n", data);
+ FLB_LOG_PAINTED_LAYER_DECISION(data, " Solid=%i, hasImage=%i, canOptimizeAwayPaintedLayer=%i\n",
data->mIsSolidColorInVisibleRegion, !!imageContainer,
- CanOptimizeAwayThebesLayer(data, mLayerBuilder));
+ CanOptimizeAwayPaintedLayer(data, mLayerBuilder));
if ((data->mIsSolidColorInVisibleRegion || imageContainer) &&
- CanOptimizeAwayThebesLayer(data, mLayerBuilder)) {
+ CanOptimizeAwayPaintedLayer(data, mLayerBuilder)) {
NS_ASSERTION(!(data->mIsSolidColorInVisibleRegion && imageContainer),
"Can't be a solid color as well as an image!");
if (imageContainer) {
@@ -2118,7 +2118,7 @@ ContainerState::PopThebesLayerData()
layer = imageLayer;
mLayerBuilder->StoreOptimizedLayerForFrame(data->mImage,
imageLayer);
- FLB_LOG_THEBES_DECISION(data, " Selected image layer=%p\n", layer.get());
+ FLB_LOG_PAINTED_LAYER_DECISION(data, " Selected image layer=%p\n", layer.get());
} else {
nsRefPtr colorLayer = CreateOrRecycleColorLayer(data->mLayer);
colorLayer->SetColor(data->mSolidColor);
@@ -2128,17 +2128,17 @@ ContainerState::PopThebesLayerData()
colorLayer->SetPostScale(data->mLayer->GetPostXScale(), data->mLayer->GetPostYScale());
nsIntRect visibleRect = data->mVisibleRegion.GetBounds();
- visibleRect.MoveBy(-GetTranslationForThebesLayer(data->mLayer));
+ visibleRect.MoveBy(-GetTranslationForPaintedLayer(data->mLayer));
colorLayer->SetBounds(visibleRect);
layer = colorLayer;
- FLB_LOG_THEBES_DECISION(data, " Selected color layer=%p\n", layer.get());
+ FLB_LOG_PAINTED_LAYER_DECISION(data, " Selected color layer=%p\n", layer.get());
}
NS_ASSERTION(FindIndexOfLayerIn(mNewChildLayers, layer) < 0,
"Layer already in list???");
NS_ASSERTION(newLayerEntry->mLayer == data->mLayer,
- "Thebes layer at wrong index");
+ "Painted layer at wrong index");
// Store optimized layer in reserved slot
newLayerEntry = &mNewChildLayers[data->mNewChildLayersIndex + 1];
NS_ASSERTION(!newLayerEntry->mLayer, "Slot already occupied?");
@@ -2146,7 +2146,7 @@ ContainerState::PopThebesLayerData()
newLayerEntry->mAnimatedGeometryRoot = data->mAnimatedGeometryRoot;
newLayerEntry->mFixedPosFrameForLayerData = data->mFixedPosFrameForLayerData;
- // Hide the ThebesLayer. We leave it in the layer tree so that we
+ // Hide the PaintedLayer. We leave it in the layer tree so that we
// can find and recycle it later.
nsIntRect emptyRect;
data->mLayer->SetClipRect(&emptyRect);
@@ -2157,7 +2157,7 @@ ContainerState::PopThebesLayerData()
layer = data->mLayer;
imageContainer = nullptr;
layer->SetClipRect(nullptr);
- FLB_LOG_THEBES_DECISION(data, " Selected thebes layer=%p\n", layer.get());
+ FLB_LOG_PAINTED_LAYER_DECISION(data, " Selected painted layer=%p\n", layer.get());
}
if (mLayerBuilder->IsBuildingRetainedLayers()) {
@@ -2170,7 +2170,7 @@ ContainerState::PopThebesLayerData()
}
nsIntRect layerBounds = data->mBounds.GetBounds();
- layerBounds.MoveBy(-GetTranslationForThebesLayer(data->mLayer));
+ layerBounds.MoveBy(-GetTranslationForPaintedLayer(data->mLayer));
layer->SetLayerBounds(layerBounds);
#ifdef MOZ_DUMP_PAINTING
@@ -2180,7 +2180,7 @@ ContainerState::PopThebesLayerData()
nsIntRegion transparentRegion;
transparentRegion.Sub(data->mVisibleRegion, data->mOpaqueRegion);
bool isOpaque = transparentRegion.IsEmpty();
- // For translucent ThebesLayers, try to find an opaque background
+ // For translucent PaintedLayers, try to find an opaque background
// color that covers the entire area beneath it so we can pull that
// color into this layer to make it opaque.
if (layer == data->mLayer) {
@@ -2193,11 +2193,11 @@ ContainerState::PopThebesLayerData()
}
// Store the background color
- ThebesDisplayItemLayerUserData* userData =
- GetThebesDisplayItemLayerUserData(data->mLayer);
+ PaintedDisplayItemLayerUserData* userData =
+ GetPaintedDisplayItemLayerUserData(data->mLayer);
NS_ASSERTION(userData, "where did our user data go?");
if (userData->mForcedBackgroundColor != backgroundColor) {
- // Invalidate the entire target ThebesLayer since we're changing
+ // Invalidate the entire target PaintedLayer since we're changing
// the background color
#ifdef MOZ_DUMP_PAINTING
if (nsLayoutUtils::InvalidationDebuggingIsEnabled()) {
@@ -2218,8 +2218,8 @@ ContainerState::PopThebesLayerData()
int32_t commonClipCount = std::max(0, data->mCommonClipCount);
SetupMaskLayer(layer, data->mItemClip, data->mVisibleRegion, commonClipCount);
// copy commonClipCount to the entry
- FrameLayerBuilder::ThebesLayerItemsEntry* entry = mLayerBuilder->
- GetThebesLayerItemsEntry(static_cast(layer.get()));
+ FrameLayerBuilder::PaintedLayerItemsEntry* entry = mLayerBuilder->
+ GetPaintedLayerItemsEntry(static_cast(layer.get()));
entry->mCommonClipCount = commonClipCount;
} else {
// mask layer for image and color layers
@@ -2242,38 +2242,38 @@ ContainerState::PopThebesLayerData()
SetFixedPositionLayerData(layer, data->mFixedPosFrameForLayerData);
- ThebesLayerData* containingThebesLayerData =
- mLayerBuilder->GetContainingThebesLayerData();
- if (containingThebesLayerData) {
+ PaintedLayerData* containingPaintedLayerData =
+ mLayerBuilder->GetContainingPaintedLayerData();
+ if (containingPaintedLayerData) {
if (!data->mDispatchToContentHitRegion.GetBounds().IsEmpty()) {
nsRect rect = nsLayoutUtils::TransformFrameRectToAncestor(
mContainerReferenceFrame,
data->mDispatchToContentHitRegion.GetBounds(),
- containingThebesLayerData->mReferenceFrame);
- containingThebesLayerData->mDispatchToContentHitRegion.Or(
- containingThebesLayerData->mDispatchToContentHitRegion, rect);
+ containingPaintedLayerData->mReferenceFrame);
+ containingPaintedLayerData->mDispatchToContentHitRegion.Or(
+ containingPaintedLayerData->mDispatchToContentHitRegion, rect);
}
if (!data->mMaybeHitRegion.GetBounds().IsEmpty()) {
nsRect rect = nsLayoutUtils::TransformFrameRectToAncestor(
mContainerReferenceFrame,
data->mMaybeHitRegion.GetBounds(),
- containingThebesLayerData->mReferenceFrame);
- containingThebesLayerData->mMaybeHitRegion.Or(
- containingThebesLayerData->mMaybeHitRegion, rect);
+ containingPaintedLayerData->mReferenceFrame);
+ containingPaintedLayerData->mMaybeHitRegion.Or(
+ containingPaintedLayerData->mMaybeHitRegion, rect);
}
if (!data->mHitRegion.GetBounds().IsEmpty()) {
// Our definitely-hit region must go to the maybe-hit-region since
// this function is an approximation.
Matrix4x4 matrix = nsLayoutUtils::GetTransformToAncestor(
- mContainerReferenceFrame, containingThebesLayerData->mReferenceFrame);
+ mContainerReferenceFrame, containingPaintedLayerData->mReferenceFrame);
Matrix matrix2D;
bool isPrecise = matrix.Is2D(&matrix2D) && !matrix2D.HasNonAxisAlignedTransform();
nsRect rect = nsLayoutUtils::TransformFrameRectToAncestor(
mContainerReferenceFrame,
data->mHitRegion.GetBounds(),
- containingThebesLayerData->mReferenceFrame);
- nsRegion* dest = isPrecise ? &containingThebesLayerData->mHitRegion
- : &containingThebesLayerData->mMaybeHitRegion;
+ containingPaintedLayerData->mReferenceFrame);
+ nsRegion* dest = isPrecise ? &containingPaintedLayerData->mHitRegion
+ : &containingPaintedLayerData->mMaybeHitRegion;
dest->Or(*dest, rect);
}
} else {
@@ -2286,7 +2286,7 @@ ContainerState::PopThebesLayerData()
regions.mDispatchToContentHitRegion.Or(regions.mDispatchToContentHitRegion,
ScaleRegionToOutsidePixels(data->mDispatchToContentHitRegion));
- nsIntPoint translation = -GetTranslationForThebesLayer(data->mLayer);
+ nsIntPoint translation = -GetTranslationForPaintedLayer(data->mLayer);
regions.mHitRegion.MoveBy(translation);
regions.mDispatchToContentHitRegion.MoveBy(translation);
@@ -2294,14 +2294,14 @@ ContainerState::PopThebesLayerData()
}
if (lastIndex > 0) {
- // Since we're going to pop off the last ThebesLayerData, the
+ // Since we're going to pop off the last PaintedLayerData, the
// mVisibleAboveRegion of the second-to-last item will need to include
// the regions of the last item.
- ThebesLayerData* nextData = mThebesLayerDataStack[lastIndex - 1];
+ PaintedLayerData* nextData = mPaintedLayerDataStack[lastIndex - 1];
nextData->CopyAboveRegion(data);
}
- mThebesLayerDataStack.RemoveElementAt(lastIndex);
+ mPaintedLayerDataStack.RemoveElementAt(lastIndex);
}
static bool
@@ -2324,14 +2324,14 @@ IsItemAreaInWindowOpaqueRegion(nsDisplayListBuilder* aBuilder,
}
void
-ThebesLayerData::Accumulate(ContainerState* aState,
+PaintedLayerData::Accumulate(ContainerState* aState,
nsDisplayItem* aItem,
const nsIntRegion& aClippedOpaqueRegion,
const nsIntRect& aVisibleRect,
const nsIntRect& aDrawRect,
const DisplayItemClip& aClip)
{
- FLB_LOG_THEBES_DECISION(this, "Accumulating dp=%s(%p), f=%p against tld=%p\n", aItem->Name(), aItem, aItem->Frame(), this);
+ FLB_LOG_PAINTED_LAYER_DECISION(this, "Accumulating dp=%s(%p), f=%p against tld=%p\n", aItem->Name(), aItem, aItem->Frame(), this);
bool snap;
nsRect itemBounds = aItem->GetBounds(aState->mBuilder, &snap);
@@ -2342,7 +2342,7 @@ ThebesLayerData::Accumulate(ContainerState* aState,
}
if (aState->mParameters.mDisableSubpixelAntialiasingInDescendants) {
// Disable component alpha.
- // Note that the transform (if any) on the ThebesLayer is always an integer translation so
+ // Note that the transform (if any) on the PaintedLayer is always an integer translation so
// we don't have to factor that in here.
aItem->DisableComponentAlpha();
}
@@ -2352,7 +2352,7 @@ ThebesLayerData::Accumulate(ContainerState* aState,
if (!mIsSolidColorInVisibleRegion && mOpaqueRegion.Contains(aDrawRect) &&
mVisibleRegion.Contains(aVisibleRect) && !mImage) {
- // A very common case! Most pages have a ThebesLayer with the page
+ // A very common case! Most pages have a PaintedLayer with the page
// background (opaque) visible and most or all of the page content over the
// top of that background.
// The rest of this method won't do anything. mVisibleRegion, mOpaqueRegion
@@ -2371,9 +2371,9 @@ ThebesLayerData::Accumulate(ContainerState* aState,
aClippedOpaqueRegion.Contains(mVisibleRegion) &&
aItem->SupportsOptimizingToImage()) {
mImage = static_cast(aItem);
- FLB_LOG_THEBES_DECISION(this, " Tracking image: nsDisplayImageContainer covers the layer\n");
+ FLB_LOG_PAINTED_LAYER_DECISION(this, " Tracking image: nsDisplayImageContainer covers the layer\n");
} else if (mImage) {
- FLB_LOG_THEBES_DECISION(this, " No longer tracking image\n");
+ FLB_LOG_PAINTED_LAYER_DECISION(this, " No longer tracking image\n");
mImage = nullptr;
}
@@ -2392,7 +2392,7 @@ ThebesLayerData::Accumulate(ContainerState* aState,
nsRect bounds = aItem->GetBounds(aState->mBuilder, &snap);
if (!aState->ScaleToInsidePixels(bounds, snap).Contains(aVisibleRect)) {
isUniform = false;
- FLB_LOG_THEBES_DECISION(this, " Display item does not cover the visible rect\n");
+ FLB_LOG_PAINTED_LAYER_DECISION(this, " Display item does not cover the visible rect\n");
}
}
if (isUniform) {
@@ -2406,11 +2406,11 @@ ThebesLayerData::Accumulate(ContainerState* aState,
// we can just blend the colors together
mSolidColor = NS_ComposeColors(mSolidColor, uniformColor);
} else {
- FLB_LOG_THEBES_DECISION(this, " Layer not a solid color: Can't blend colors togethers\n");
+ FLB_LOG_PAINTED_LAYER_DECISION(this, " Layer not a solid color: Can't blend colors togethers\n");
mIsSolidColorInVisibleRegion = false;
}
} else {
- FLB_LOG_THEBES_DECISION(this, " Layer is not a solid color: Display item is not uniform over the visible bound\n");
+ FLB_LOG_PAINTED_LAYER_DECISION(this, " Layer is not a solid color: Display item is not uniform over the visible bound\n");
mIsSolidColorInVisibleRegion = false;
}
@@ -2456,8 +2456,8 @@ ThebesLayerData::Accumulate(ContainerState* aState,
}
}
-ThebesLayerData*
-ContainerState::FindThebesLayerFor(nsDisplayItem* aItem,
+PaintedLayerData*
+ContainerState::FindPaintedLayerFor(nsDisplayItem* aItem,
const nsIntRect& aVisibleRect,
const nsIFrame* aAnimatedGeometryRoot,
const nsPoint& aTopLeft,
@@ -2466,13 +2466,13 @@ ContainerState::FindThebesLayerFor(nsDisplayItem* aItem,
int32_t i;
int32_t lowestUsableLayerWithScrolledRoot = -1;
int32_t topmostLayerWithScrolledRoot = -1;
- for (i = mThebesLayerDataStack.Length() - 1; i >= 0; --i) {
+ for (i = mPaintedLayerDataStack.Length() - 1; i >= 0; --i) {
// Don't let should-fix-to-viewport items share a layer with any other items.
if (aShouldFixToViewport) {
++i;
break;
}
- ThebesLayerData* data = mThebesLayerDataStack[i];
+ PaintedLayerData* data = mPaintedLayerDataStack[i];
// Give up if there is content drawn above (in z-order) this layer that
// intersects aItem's visible region; aItem must be placed in a
// layer above this layer.
@@ -2498,7 +2498,7 @@ ContainerState::FindThebesLayerFor(nsDisplayItem* aItem,
if (topmostLayerWithScrolledRoot < 0) {
--i;
for (; i >= 0; --i) {
- ThebesLayerData* data = mThebesLayerDataStack[i];
+ PaintedLayerData* data = mPaintedLayerDataStack[i];
if (data->mAnimatedGeometryRoot == aAnimatedGeometryRoot) {
topmostLayerWithScrolledRoot = i;
break;
@@ -2507,42 +2507,42 @@ ContainerState::FindThebesLayerFor(nsDisplayItem* aItem,
}
if (topmostLayerWithScrolledRoot >= 0) {
- while (uint32_t(topmostLayerWithScrolledRoot + 1) < mThebesLayerDataStack.Length()) {
- PopThebesLayerData();
+ while (uint32_t(topmostLayerWithScrolledRoot + 1) < mPaintedLayerDataStack.Length()) {
+ PopPaintedLayerData();
}
}
- ThebesLayerData* thebesLayerData = nullptr;
+ PaintedLayerData* paintedLayerData = nullptr;
if (lowestUsableLayerWithScrolledRoot < 0) {
- nsRefPtr layer =
- CreateOrRecycleThebesLayer(aAnimatedGeometryRoot, aItem->ReferenceFrame(), aTopLeft);
+ nsRefPtr layer =
+ CreateOrRecyclePaintedLayer(aAnimatedGeometryRoot, aItem->ReferenceFrame(), aTopLeft);
- thebesLayerData = new ThebesLayerData();
- mThebesLayerDataStack.AppendElement(thebesLayerData);
- thebesLayerData->mLayer = layer;
- thebesLayerData->mAnimatedGeometryRoot = aAnimatedGeometryRoot;
- thebesLayerData->mFixedPosFrameForLayerData =
+ paintedLayerData = new PaintedLayerData();
+ mPaintedLayerDataStack.AppendElement(paintedLayerData);
+ paintedLayerData->mLayer = layer;
+ paintedLayerData->mAnimatedGeometryRoot = aAnimatedGeometryRoot;
+ paintedLayerData->mFixedPosFrameForLayerData =
FindFixedPosFrameForLayerData(aAnimatedGeometryRoot, aShouldFixToViewport);
- thebesLayerData->mReferenceFrame = aItem->ReferenceFrame();
- thebesLayerData->mSingleItemFixedToViewport = aShouldFixToViewport;
+ paintedLayerData->mReferenceFrame = aItem->ReferenceFrame();
+ paintedLayerData->mSingleItemFixedToViewport = aShouldFixToViewport;
NS_ASSERTION(FindIndexOfLayerIn(mNewChildLayers, layer) < 0,
"Layer already in list???");
- thebesLayerData->mNewChildLayersIndex = mNewChildLayers.Length();
+ paintedLayerData->mNewChildLayersIndex = mNewChildLayers.Length();
NewLayerEntry* newLayerEntry = mNewChildLayers.AppendElement();
newLayerEntry->mLayer = layer.forget();
newLayerEntry->mAnimatedGeometryRoot = aAnimatedGeometryRoot;
- newLayerEntry->mFixedPosFrameForLayerData = thebesLayerData->mFixedPosFrameForLayerData;
+ newLayerEntry->mFixedPosFrameForLayerData = paintedLayerData->mFixedPosFrameForLayerData;
// newLayerEntry->mOpaqueRegion is filled in later from
- // thebesLayerData->mOpaqueRegion, if necessary.
+ // paintedLayerData->mOpaqueRegion, if necessary.
// Allocate another entry for this layer's optimization to ColorLayer/ImageLayer
mNewChildLayers.AppendElement();
} else {
- thebesLayerData = mThebesLayerDataStack[lowestUsableLayerWithScrolledRoot];
+ paintedLayerData = mPaintedLayerDataStack[lowestUsableLayerWithScrolledRoot];
}
- return thebesLayerData;
+ return paintedLayerData;
}
#ifdef MOZ_DUMP_PAINTING
@@ -2565,7 +2565,7 @@ PaintInactiveLayer(nsDisplayListBuilder* aBuilder,
gfxContext* aContext,
nsRenderingContext* aCtx)
{
- // This item has an inactive layer. Render it to a ThebesLayer
+ // This item has an inactive layer. Render it to a PaintedLayer
// using a temporary BasicLayerManager.
BasicLayerManager* basic = static_cast(aManager);
nsRefPtr context = aContext;
@@ -2593,7 +2593,7 @@ PaintInactiveLayer(nsDisplayListBuilder* aBuilder,
basic->AbortTransaction();
}
} else {
- basic->EndTransaction(FrameLayerBuilder::DrawThebesLayer, aBuilder);
+ basic->EndTransaction(FrameLayerBuilder::DrawPaintedLayer, aBuilder);
}
FrameLayerBuilder *builder = static_cast(basic->GetUserData(&gLayerManagerLayerBuilder));
if (builder) {
@@ -2627,7 +2627,7 @@ ContainerState::ChooseAnimatedGeometryRoot(const nsDisplayList& aList,
{
for (nsDisplayItem* item = aList.GetBottom(); item; item = item->GetAbove()) {
LayerState layerState = item->GetLayerState(mBuilder, mManager, mParameters);
- // Don't use an item that won't be part of any ThebesLayers to pick the
+ // Don't use an item that won't be part of any PaintedLayers to pick the
// active scrolled root.
if (layerState == LAYER_ACTIVE_FORCE) {
continue;
@@ -2723,15 +2723,15 @@ ContainerState::ComputeOpaqueRect(nsDisplayItem* aItem,
/*
* Iterate through the non-clip items in aList and its descendants.
* For each item we compute the effective clip rect. Each item is assigned
- * to a layer. We invalidate the areas in ThebesLayers where an item
- * has moved from one ThebesLayer to another. Also,
- * aState->mInvalidThebesContent is invalidated in every ThebesLayer.
+ * to a layer. We invalidate the areas in PaintedLayers where an item
+ * has moved from one PaintedLayer to another. Also,
+ * aState->mInvalidPaintedContent is invalidated in every PaintedLayer.
* We set the clip rect for items that generated their own layer, and
* create a mask layer to do any rounded rect clipping.
- * (ThebesLayers don't need a clip rect on the layer, we clip the items
+ * (PaintedLayers don't need a clip rect on the layer, we clip the items
* individually when we draw them.)
* We set the visible rect for all layers, although the actual setting
- * of visible rects for some ThebesLayers is deferred until the calling
+ * of visible rects for some PaintedLayers is deferred until the calling
* of ContainerState::Finish.
*/
void
@@ -2835,7 +2835,7 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList)
if (mManager->IsWidgetLayerManager()) {
animatedGeometryRoot = nsLayoutUtils::GetAnimatedGeometryRootFor(item, mBuilder, mManager);
} else {
- // For inactive layer subtrees, splitting content into ThebesLayers
+ // For inactive layer subtrees, splitting content into PaintedLayers
// based on animated geometry roots is pointless. It's more efficient
// to build the minimum number of layers.
animatedGeometryRoot = mContainerAnimatedGeometryRoot;
@@ -2867,7 +2867,7 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList)
itemVisibleRect.IsEmpty(),
"State is LAYER_ACTIVE_EMPTY but visible rect is not.");
- // As long as the new layer isn't going to be a ThebesLayer,
+ // As long as the new layer isn't going to be a PaintedLayer,
// InvalidateForLayerChange doesn't need the new layer pointer.
// We also need to check the old data now, because BuildLayer
// can overwrite it.
@@ -2875,7 +2875,7 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList)
// If the item would have its own layer but is invisible, just hide it.
// Note that items without their own layers can't be skipped this
- // way, since their ThebesLayer may decide it wants to draw them
+ // way, since their PaintedLayer may decide it wants to draw them
// into its buffer even if they're currently covered.
if (itemVisibleRect.IsEmpty() &&
!item->ShouldBuildLayerEvenIfInvisible(mBuilder)) {
@@ -2893,8 +2893,8 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList)
continue;
}
- NS_ASSERTION(!ownLayer->AsThebesLayer(),
- "Should never have created a dedicated Thebes layer!");
+ NS_ASSERTION(!ownLayer->AsPaintedLayer(),
+ "Should never have created a dedicated Painted layer!");
const nsIFrame* fixedPosFrame =
FindFixedPosFrameForLayerData(animatedGeometryRoot, shouldFixToViewport);
@@ -2931,7 +2931,7 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList)
} else {
ownLayer->SetClipRect(nullptr);
}
- ThebesLayerData* data = GetTopThebesLayerData();
+ PaintedLayerData* data = GetTopPaintedLayerData();
if (data) {
// Prerendered transform items can be updated without layer building
// (async animations or an empty transaction), so we need to put items
@@ -2955,7 +2955,7 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList)
// Add the entire bounds rect to the mDrawAboveRegion.
// The visible region may be excluding opaque content above the
// item, and we need to ensure that that content is not placed
- // in a ThebesLayer below the item!
+ // in a PaintedLayer below the item!
data->AddDrawAboveRegion(itemDrawRect);
}
}
@@ -3017,37 +3017,37 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList)
/**
* No need to allocate geometry for items that aren't
- * part of a ThebesLayer.
+ * part of a PaintedLayer.
*/
mLayerBuilder->AddLayerDisplayItem(ownLayer, item,
layerState,
topLeft, nullptr);
} else {
- ThebesLayerData* thebesLayerData =
- FindThebesLayerFor(item, itemVisibleRect, animatedGeometryRoot, topLeft,
+ PaintedLayerData* paintedLayerData =
+ FindPaintedLayerFor(item, itemVisibleRect, animatedGeometryRoot, topLeft,
shouldFixToViewport);
if (itemType == nsDisplayItem::TYPE_LAYER_EVENT_REGIONS) {
nsDisplayLayerEventRegions* eventRegions =
static_cast(item);
- thebesLayerData->AccumulateEventRegions(eventRegions->HitRegion(),
+ paintedLayerData->AccumulateEventRegions(eventRegions->HitRegion(),
eventRegions->MaybeHitRegion(),
eventRegions->DispatchToContentHitRegion());
} else {
// check to see if the new item has rounded rect clips in common with
// other items in the layer
- thebesLayerData->UpdateCommonClipCount(itemClip);
+ paintedLayerData->UpdateCommonClipCount(itemClip);
- InvalidateForLayerChange(item, thebesLayerData->mLayer);
+ InvalidateForLayerChange(item, paintedLayerData->mLayer);
- mLayerBuilder->AddThebesDisplayItem(thebesLayerData, item, itemClip, itemVisibleRect,
+ mLayerBuilder->AddPaintedDisplayItem(paintedLayerData, item, itemClip, itemVisibleRect,
*this, layerState, topLeft);
nsIntRegion opaquePixels = ComputeOpaqueRect(item,
- animatedGeometryRoot, thebesLayerData->mFixedPosFrameForLayerData,
+ animatedGeometryRoot, paintedLayerData->mFixedPosFrameForLayerData,
itemClip, aList,
- &thebesLayerData->mHideAllLayersBelow,
- &thebesLayerData->mOpaqueForAnimatedGeometryRootParent);
- thebesLayerData->Accumulate(this, item, opaquePixels,
+ &paintedLayerData->mHideAllLayersBelow,
+ &paintedLayerData->mOpaqueForAnimatedGeometryRootParent);
+ paintedLayerData->Accumulate(this, item, opaquePixels,
itemVisibleRect, itemDrawRect, itemClip);
}
}
@@ -3062,7 +3062,7 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList)
}
void
-ContainerState::InvalidateForLayerChange(nsDisplayItem* aItem, ThebesLayer* aNewLayer)
+ContainerState::InvalidateForLayerChange(nsDisplayItem* aItem, PaintedLayer* aNewLayer)
{
NS_ASSERTION(aItem->GetPerFrameKey(),
"Display items that render using Thebes must have a key");
@@ -3072,7 +3072,7 @@ ContainerState::InvalidateForLayerChange(nsDisplayItem* aItem, ThebesLayer* aNew
if (aNewLayer != oldLayer && oldLayer) {
// The item has changed layers.
// Invalidate the old bounds in the old layer and new bounds in the new layer.
- ThebesLayer* t = oldLayer->AsThebesLayer();
+ PaintedLayer* t = oldLayer->AsPaintedLayer();
if (t && oldGeometry) {
// Note that whenever the layer's scale changes, we invalidate the whole thing,
// so it doesn't matter whether we are using the old scale at last paint
@@ -3098,18 +3098,18 @@ void
FrameLayerBuilder::ComputeGeometryChangeForItem(DisplayItemData* aData)
{
nsDisplayItem *item = aData->mItem;
- ThebesLayer* thebesLayer = aData->mLayer->AsThebesLayer();
- if (!item || !thebesLayer) {
+ PaintedLayer* paintedLayer = aData->mLayer->AsPaintedLayer();
+ if (!item || !paintedLayer) {
aData->EndUpdate();
return;
}
- ThebesLayerItemsEntry* entry = mThebesLayerItems.GetEntry(thebesLayer);
+ PaintedLayerItemsEntry* entry = mPaintedLayerItems.GetEntry(paintedLayer);
nsAutoPtr geometry(item->AllocateGeometry(mDisplayListBuilder));
- ThebesDisplayItemLayerUserData* layerData =
- static_cast(aData->mLayer->GetUserData(&gThebesDisplayItemLayerUserData));
+ PaintedDisplayItemLayerUserData* layerData =
+ static_cast(aData->mLayer->GetUserData(&gPaintedDisplayItemLayerUserData));
nsPoint shift = layerData->mAnimatedGeometryRootOrigin - layerData->mLastAnimatedGeometryRootOrigin;
const DisplayItemClip& clip = item->GetClip();
@@ -3122,7 +3122,7 @@ FrameLayerBuilder::ComputeGeometryChangeForItem(DisplayItemData* aData)
bool notifyRenderingChanged = true;
if (!aData->mGeometry) {
// This item is being added for the first time, invalidate its entire area.
- //TODO: We call GetGeometry again in AddThebesDisplayItem, we should reuse this.
+ //TODO: We call GetGeometry again in AddPaintedDisplayItem, we should reuse this.
combined = clip.ApplyNonRoundedIntersection(geometry->ComputeInvalidationRegion());
#ifdef MOZ_DUMP_PAINTING
if (nsLayoutUtils::InvalidationDebuggingIsEnabled()) {
@@ -3190,7 +3190,7 @@ FrameLayerBuilder::ComputeGeometryChangeForItem(DisplayItemData* aData)
if (notifyRenderingChanged) {
item->NotifyRenderingChanged();
}
- InvalidatePostTransformRegion(thebesLayer,
+ InvalidatePostTransformRegion(paintedLayer,
combined.ScaleToOutsidePixels(layerData->mXScale, layerData->mYScale, layerData->mAppUnitsPerDevPixel),
layerData->mTranslation);
}
@@ -3199,7 +3199,7 @@ FrameLayerBuilder::ComputeGeometryChangeForItem(DisplayItemData* aData)
}
void
-FrameLayerBuilder::AddThebesDisplayItem(ThebesLayerData* aLayerData,
+FrameLayerBuilder::AddPaintedDisplayItem(PaintedLayerData* aLayerData,
nsDisplayItem* aItem,
const DisplayItemClip& aClip,
const nsIntRect& aItemVisibleRect,
@@ -3207,10 +3207,10 @@ FrameLayerBuilder::AddThebesDisplayItem(ThebesLayerData* aLayerData,
LayerState aLayerState,
const nsPoint& aTopLeft)
{
- ThebesLayer* layer = aLayerData->mLayer;
- ThebesDisplayItemLayerUserData* thebesData =
- static_cast
- (layer->GetUserData(&gThebesDisplayItemLayerUserData));
+ PaintedLayer* layer = aLayerData->mLayer;
+ PaintedDisplayItemLayerUserData* paintedData =
+ static_cast
+ (layer->GetUserData(&gPaintedDisplayItemLayerUserData));
nsRefPtr tempManager;
nsIntRect intClip;
bool hasClip = false;
@@ -3228,19 +3228,19 @@ FrameLayerBuilder::AddThebesDisplayItem(ThebesLayerData* aLayerData,
DisplayItemClip* oldClip = nullptr;
GetOldLayerFor(aItem, nullptr, &oldClip);
hasClip = aClip.ComputeRegionInClips(oldClip,
- aTopLeft - thebesData->mLastAnimatedGeometryRootOrigin,
+ aTopLeft - paintedData->mLastAnimatedGeometryRootOrigin,
&clip);
if (hasClip) {
- intClip = clip.GetBounds().ScaleToOutsidePixels(thebesData->mXScale,
- thebesData->mYScale,
- thebesData->mAppUnitsPerDevPixel);
+ intClip = clip.GetBounds().ScaleToOutsidePixels(paintedData->mXScale,
+ paintedData->mYScale,
+ paintedData->mAppUnitsPerDevPixel);
}
}
AddLayerDisplayItem(layer, aItem, aLayerState, aTopLeft, tempManager);
- ThebesLayerItemsEntry* entry = mThebesLayerItems.PutEntry(layer);
+ PaintedLayerItemsEntry* entry = mPaintedLayerItems.PutEntry(layer);
if (entry) {
entry->mContainerLayerFrame = aContainerState.GetContainerFrame();
if (entry->mContainerLayerGeneration == 0) {
@@ -3269,7 +3269,7 @@ FrameLayerBuilder::AddThebesDisplayItem(ThebesLayerData* aLayerData,
bool snap;
nsRect visibleRect =
aItem->GetVisibleRect().Intersect(aItem->GetBounds(mDisplayListBuilder, &snap));
- nsIntRegion rgn = visibleRect.ToOutsidePixels(thebesData->mAppUnitsPerDevPixel);
+ nsIntRegion rgn = visibleRect.ToOutsidePixels(paintedData->mAppUnitsPerDevPixel);
SetOuterVisibleRegion(tmpLayer, &rgn);
// If BuildLayer didn't call BuildContainerLayerFor, then our new layer won't have been
@@ -3289,7 +3289,7 @@ FrameLayerBuilder::AddThebesDisplayItem(ThebesLayerData* aLayerData,
layerBuilder->WillEndTransaction();
tempManager->AbortTransaction();
- nsIntPoint offset = GetLastPaintOffset(layer) - GetTranslationForThebesLayer(layer);
+ nsIntPoint offset = GetLastPaintOffset(layer) - GetTranslationForPaintedLayer(layer);
props->MoveBy(-offset);
nsIntRegion invalid = props->ComputeDifferences(tmpLayer, nullptr);
if (aLayerState == LAYER_SVG_EFFECTS) {
@@ -3303,14 +3303,14 @@ FrameLayerBuilder::AddThebesDisplayItem(ThebesLayerData* aLayerData,
printf_stderr("Inactive LayerManager(%p) for display item %s(%p) has an invalid region - invalidating layer %p\n", tempManager.get(), aItem->Name(), aItem->Frame(), layer);
}
#endif
- invalid.ScaleRoundOut(thebesData->mXScale, thebesData->mYScale);
+ invalid.ScaleRoundOut(paintedData->mXScale, paintedData->mYScale);
if (hasClip) {
invalid.And(invalid, intClip);
}
InvalidatePostTransformRegion(layer, invalid,
- GetTranslationForThebesLayer(layer));
+ GetTranslationForPaintedLayer(layer));
}
}
ClippedDisplayItem* cdi =
@@ -3389,9 +3389,9 @@ FrameLayerBuilder::AddLayerDisplayItem(Layer* aLayer,
}
nsIntPoint
-FrameLayerBuilder::GetLastPaintOffset(ThebesLayer* aLayer)
+FrameLayerBuilder::GetLastPaintOffset(PaintedLayer* aLayer)
{
- ThebesLayerItemsEntry* entry = mThebesLayerItems.PutEntry(aLayer);
+ PaintedLayerItemsEntry* entry = mPaintedLayerItems.PutEntry(aLayer);
if (entry) {
if (entry->mContainerLayerGeneration == 0) {
entry->mContainerLayerGeneration = mContainerLayerGeneration;
@@ -3399,18 +3399,18 @@ FrameLayerBuilder::GetLastPaintOffset(ThebesLayer* aLayer)
if (entry->mHasExplicitLastPaintOffset)
return entry->mLastPaintOffset;
}
- return GetTranslationForThebesLayer(aLayer);
+ return GetTranslationForPaintedLayer(aLayer);
}
void
-FrameLayerBuilder::SavePreviousDataForLayer(ThebesLayer* aLayer, uint32_t aClipCount)
+FrameLayerBuilder::SavePreviousDataForLayer(PaintedLayer* aLayer, uint32_t aClipCount)
{
- ThebesLayerItemsEntry* entry = mThebesLayerItems.PutEntry(aLayer);
+ PaintedLayerItemsEntry* entry = mPaintedLayerItems.PutEntry(aLayer);
if (entry) {
if (entry->mContainerLayerGeneration == 0) {
entry->mContainerLayerGeneration = mContainerLayerGeneration;
}
- entry->mLastPaintOffset = GetTranslationForThebesLayer(aLayer);
+ entry->mLastPaintOffset = GetTranslationForPaintedLayer(aLayer);
entry->mHasExplicitLastPaintOffset = true;
entry->mLastCommonClipCount = aClipCount;
}
@@ -3437,9 +3437,9 @@ ContainerState::CollectOldLayers()
layer = layer->GetNextSibling()) {
NS_ASSERTION(!layer->HasUserData(&gMaskLayerUserData),
"Mask layer in layer tree; could not be recycled.");
- if (layer->HasUserData(&gThebesDisplayItemLayerUserData)) {
- NS_ASSERTION(layer->AsThebesLayer(), "Wrong layer type");
- mRecycledThebesLayers.AppendElement(static_cast(layer));
+ if (layer->HasUserData(&gPaintedDisplayItemLayerUserData)) {
+ NS_ASSERTION(layer->AsPaintedLayer(), "Wrong layer type");
+ mRecycledPaintedLayers.AppendElement(static_cast(layer));
}
if (Layer* maskLayer = layer->GetMaskLayer()) {
@@ -3524,7 +3524,7 @@ ContainerState::SetupScrollingMetadata(NewLayerEntry* aEntry)
}
layerClip = &tmpClipRect;
// XXX this could cause IPC churn due to cliprects being updated
- // twice during layer building --- for non-ThebesLayers that have
+ // twice during layer building --- for non-PaintedLayers that have
// both CSS and scroll clipping.
}
}
@@ -3619,8 +3619,8 @@ ContainerState::Finish(uint32_t* aTextContentFlags, LayerManagerData* aData,
const nsIntRect& aContainerPixelBounds,
nsDisplayList* aChildItems, bool& aHasComponentAlphaChildren)
{
- while (!mThebesLayerDataStack.IsEmpty()) {
- PopThebesLayerData();
+ while (!mPaintedLayerDataStack.IsEmpty()) {
+ PopPaintedLayerData();
}
NS_ASSERTION(mContainerBounds.IsEqualInterior(mAccumulatedChildBounds),
@@ -3861,7 +3861,7 @@ FrameLayerBuilder::RestoreDisplayItemData(nsRefPtrHashKey* aEnt
}
/* static */ PLDHashOperator
-FrameLayerBuilder::RestoreThebesLayerItemEntries(ThebesLayerItemsEntry* aEntry, void* aUserArg)
+FrameLayerBuilder::RestorePaintedLayerItemEntries(PaintedLayerItemsEntry* aEntry, void* aUserArg)
{
uint32_t *generation = static_cast(aUserArg);
@@ -3921,9 +3921,9 @@ FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder* aBuilder,
if (oldLayer) {
NS_ASSERTION(oldLayer->Manager() == aManager, "Wrong manager");
- if (oldLayer->HasUserData(&gThebesDisplayItemLayerUserData)) {
- // The old layer for this item is actually our ThebesLayer
- // because we rendered its layer into that ThebesLayer. So we
+ if (oldLayer->HasUserData(&gPaintedDisplayItemLayerUserData)) {
+ // The old layer for this item is actually our PaintedLayer
+ // because we rendered its layer into that PaintedLayer. So we
// don't actually have a retained container layer.
} else {
NS_ASSERTION(oldLayer->GetType() == Layer::TYPE_CONTAINER,
@@ -3949,7 +3949,7 @@ FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder* aBuilder,
if (aContainerItem && state == LAYER_ACTIVE_EMPTY) {
// Empty layers only have metadata and should never have display items. We
// early exit because later, invalidation will walk up the frame tree to
- // determine which thebes layer gets invalidated. Since an empty layer
+ // determine which painted layer gets invalidated. Since an empty layer
// should never have anything to paint, it should never be invalidated.
NS_ASSERTION(aChildren->IsEmpty(), "Should have no children");
return containerLayer.forget();
@@ -3970,7 +3970,7 @@ FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder* aBuilder,
uint32_t oldGeneration = mContainerLayerGeneration;
mContainerLayerGeneration = ++mMaxContainerLayerGeneration;
- nsRefPtr thebesLayerInvalidRegion = nullptr;
+ nsRefPtr paintedLayerInvalidRegion = nullptr;
if (mRetainingManager) {
if (aContainerItem) {
StoreDataForFrame(aContainerItem, containerLayer, LAYER_ACTIVE);
@@ -4017,7 +4017,7 @@ FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder* aBuilder,
flattenToSingleLayer = true;
data->mDisplayItems.EnumerateEntries(RestoreDisplayItemData,
&mContainerLayerGeneration);
- mThebesLayerItems.EnumerateEntries(RestoreThebesLayerItemEntries,
+ mPaintedLayerItems.EnumerateEntries(RestorePaintedLayerItemEntries,
&mContainerLayerGeneration);
aContainerFrame->AddStateBits(NS_FRAME_NO_COMPONENT_ALPHA);
continue;
@@ -4067,7 +4067,7 @@ FrameLayerBuilder::GetLeafLayerFor(nsDisplayListBuilder* aBuilder,
Layer* layer = GetOldLayerFor(aItem);
if (!layer)
return nullptr;
- if (layer->HasUserData(&gThebesDisplayItemLayerUserData)) {
+ if (layer->HasUserData(&gPaintedDisplayItemLayerUserData)) {
// This layer was created to render Thebes-rendered content for this
// display item. The display item should not use it for its own
// layer rendering.
@@ -4123,7 +4123,7 @@ FrameLayerBuilder::GetDedicatedLayer(nsIFrame* aFrame, uint32_t aDisplayItemKey)
Layer* layer = element->mLayer;
if (!layer->HasUserData(&gColorLayerUserData) &&
!layer->HasUserData(&gImageLayerUserData) &&
- !layer->HasUserData(&gThebesDisplayItemLayerUserData)) {
+ !layer->HasUserData(&gPaintedDisplayItemLayerUserData)) {
return layer;
}
}
@@ -4149,7 +4149,7 @@ PredictScaleForContent(nsIFrame* aFrame, nsIFrame* aAncestorWithScale,
}
gfxSize
-FrameLayerBuilder::GetThebesLayerScaleForFrame(nsIFrame* aFrame)
+FrameLayerBuilder::GetPaintedLayerScaleForFrame(nsIFrame* aFrame)
{
MOZ_ASSERT(aFrame, "need a frame");
nsIFrame* last = nullptr;
@@ -4177,9 +4177,9 @@ FrameLayerBuilder::GetThebesLayerScaleForFrame(nsIFrame* aFrame)
continue;
}
for (Layer* l = container->GetFirstChild(); l; l = l->GetNextSibling()) {
- ThebesDisplayItemLayerUserData* data =
- static_cast
- (l->GetUserData(&gThebesDisplayItemLayerUserData));
+ PaintedDisplayItemLayerUserData* data =
+ static_cast
+ (l->GetUserData(&gPaintedDisplayItemLayerUserData));
if (data) {
return PredictScaleForContent(aFrame, f, gfxSize(data->mXScale, data->mYScale));
}
@@ -4245,7 +4245,7 @@ FrameLayerBuilder::RecomputeVisibilityForItems(nsTArray& aIt
const DisplayItemClip& clip = cdi->mItem->GetClip();
NS_ASSERTION(AppUnitsPerDevPixel(cdi->mItem) == aAppUnitsPerDevPixel,
- "a thebes layer should contain items only at the same zoom");
+ "a painted layer should contain items only at the same zoom");
NS_ABORT_IF_FALSE(clip.HasClip() ||
clip.GetRoundedRectCount() == 0,
@@ -4392,16 +4392,16 @@ static void DrawForcedBackgroundColor(gfxContext* aContext, Layer* aLayer, nscol
/*
* A note on residual transforms:
*
- * In a transformed subtree we sometimes apply the ThebesLayer's
- * "residual transform" when drawing content into the ThebesLayer.
+ * In a transformed subtree we sometimes apply the PaintedLayer's
+ * "residual transform" when drawing content into the PaintedLayer.
* This is a translation by components in the range [-0.5,0.5) provided
* by the layer system; applying the residual transform followed by the
* transforms used by layer compositing ensures that the subpixel alignment
- * of the content of the ThebesLayer exactly matches what it would be if
+ * of the content of the PaintedLayer exactly matches what it would be if
* we used cairo/Thebes to draw directly to the screen without going through
* retained layer buffers.
*
- * The visible and valid regions of the ThebesLayer are computed without
+ * The visible and valid regions of the PaintedLayer are computed without
* knowing the residual transform (because we don't know what the residual
* transform is going to be until we've built the layer tree!). So we have to
* consider whether content painted in the range [x, xmost) might be painted
@@ -4418,14 +4418,14 @@ static void DrawForcedBackgroundColor(gfxContext* aContext, Layer* aLayer, nscol
*/
/* static */ void
-FrameLayerBuilder::DrawThebesLayer(ThebesLayer* aLayer,
+FrameLayerBuilder::DrawPaintedLayer(PaintedLayer* aLayer,
gfxContext* aContext,
const nsIntRegion& aRegionToDraw,
DrawRegionClip aClip,
const nsIntRegion& aRegionToInvalidate,
void* aCallbackData)
{
- PROFILER_LABEL("FrameLayerBuilder", "DrawThebesLayer",
+ PROFILER_LABEL("FrameLayerBuilder", "DrawPaintedLayer",
js::ProfileEntry::Category::GRAPHICS);
nsDisplayListBuilder* builder = static_cast
@@ -4437,16 +4437,16 @@ FrameLayerBuilder::DrawThebesLayer(ThebesLayer* aLayer,
if (layerBuilder->CheckDOMModified())
return;
- ThebesLayerItemsEntry* entry = layerBuilder->mThebesLayerItems.GetEntry(aLayer);
+ PaintedLayerItemsEntry* entry = layerBuilder->mPaintedLayerItems.GetEntry(aLayer);
NS_ASSERTION(entry, "We shouldn't be drawing into a layer with no items!");
if (!entry->mContainerLayerFrame) {
return;
}
- ThebesDisplayItemLayerUserData* userData =
- static_cast
- (aLayer->GetUserData(&gThebesDisplayItemLayerUserData));
+ PaintedDisplayItemLayerUserData* userData =
+ static_cast
+ (aLayer->GetUserData(&gPaintedDisplayItemLayerUserData));
NS_ASSERTION(userData, "where did our user data go?");
bool shouldDrawRectsSeparately = ShouldDrawRectsSeparately(aContext, aClip);
@@ -4462,15 +4462,15 @@ FrameLayerBuilder::DrawThebesLayer(ThebesLayer* aLayer,
}
// make the origin of the context coincide with the origin of the
- // ThebesLayer
+ // PaintedLayer
gfxContextMatrixAutoSaveRestore saveMatrix(aContext);
- nsIntPoint offset = GetTranslationForThebesLayer(aLayer);
+ nsIntPoint offset = GetTranslationForPaintedLayer(aLayer);
nsPresContext* presContext = entry->mContainerLayerFrame->PresContext();
- if (!layerBuilder->GetContainingThebesLayerData()) {
- // Recompute visibility of items in our ThebesLayer. Note that this
+ if (!layerBuilder->GetContainingPaintedLayerData()) {
+ // Recompute visibility of items in our PaintedLayer. Note that this
// recomputes visibility for all descendants of our display items too,
- // so there's no need to do this for the items in inactive ThebesLayers.
+ // so there's no need to do this for the items in inactive PaintedLayers.
int32_t appUnitsPerDevPixel = presContext->AppUnitsPerDevPixel();
RecomputeVisibilityForItems(entry->mItems, builder, aRegionToDraw,
offset, appUnitsPerDevPixel,
@@ -4578,11 +4578,11 @@ CalculateBounds(const nsTArray& aRects, int32_t A2
}
static void
-SetClipCount(ThebesDisplayItemLayerUserData* aThebesData,
+SetClipCount(PaintedDisplayItemLayerUserData* apaintedData,
uint32_t aClipCount)
{
- if (aThebesData) {
- aThebesData->mMaskClipCount = aClipCount;
+ if (apaintedData) {
+ apaintedData->mMaskClipCount = aClipCount;
}
}
@@ -4595,11 +4595,11 @@ ContainerState::SetupMaskLayer(Layer *aLayer,
// if the number of clips we are going to mask has decreased, then aLayer might have
// cached graphics which assume the existence of a soon-to-be non-existent mask layer
// in that case, invalidate the whole layer.
- ThebesDisplayItemLayerUserData* thebesData = GetThebesDisplayItemLayerUserData(aLayer);
- if (thebesData &&
- aRoundedRectClipCount < thebesData->mMaskClipCount) {
- ThebesLayer* thebes = aLayer->AsThebesLayer();
- thebes->InvalidateRegion(thebes->GetValidRegion().GetBounds());
+ PaintedDisplayItemLayerUserData* paintedData = GetPaintedDisplayItemLayerUserData(aLayer);
+ if (paintedData &&
+ aRoundedRectClipCount < paintedData->mMaskClipCount) {
+ PaintedLayer* painted = aLayer->AsPaintedLayer();
+ painted->InvalidateRegion(painted->GetValidRegion().GetBounds());
}
// don't build an unnecessary mask
@@ -4607,7 +4607,7 @@ ContainerState::SetupMaskLayer(Layer *aLayer,
if (aClip.GetRoundedRectCount() == 0 ||
aRoundedRectClipCount == 0 ||
layerBounds.IsEmpty()) {
- SetClipCount(thebesData, 0);
+ SetClipCount(paintedData, 0);
return;
}
@@ -4624,7 +4624,7 @@ ContainerState::SetupMaskLayer(Layer *aLayer,
if (*userData == newData) {
aLayer->SetMaskLayer(maskLayer);
- SetClipCount(thebesData, aRoundedRectClipCount);
+ SetClipCount(paintedData, aRoundedRectClipCount);
return;
}
@@ -4678,7 +4678,7 @@ ContainerState::SetupMaskLayer(Layer *aLayer,
// fail if we can't get the right surface
if (!dt) {
NS_WARNING("Could not create DrawTarget for mask layer.");
- SetClipCount(thebesData, 0);
+ SetClipCount(paintedData, 0);
return;
}
@@ -4725,7 +4725,7 @@ ContainerState::SetupMaskLayer(Layer *aLayer,
userData->mImageKey = lookupKey;
aLayer->SetMaskLayer(maskLayer);
- SetClipCount(thebesData, aRoundedRectClipCount);
+ SetClipCount(paintedData, aRoundedRectClipCount);
return;
}
diff --git a/layout/base/FrameLayerBuilder.h b/layout/base/FrameLayerBuilder.h
index 74e3be0a4d95..7d4055a0ad99 100644
--- a/layout/base/FrameLayerBuilder.h
+++ b/layout/base/FrameLayerBuilder.h
@@ -27,7 +27,7 @@ namespace layers {
class ContainerLayer;
class LayerManager;
class BasicLayerManager;
-class ThebesLayer;
+class PaintedLayer;
}
namespace gfx {
@@ -36,7 +36,7 @@ class Matrix4x4;
class FrameLayerBuilder;
class LayerManagerData;
-class ThebesLayerData;
+class PaintedLayerData;
class ContainerState;
class RefCountedRegion {
@@ -99,14 +99,14 @@ struct ContainerLayerParameters {
bool mDisableSubpixelAntialiasingInDescendants;
bool mInLowPrecisionDisplayPort;
/**
- * When this is false, ThebesLayer coordinates are drawn to with an integer
+ * When this is false, PaintedLayer coordinates are drawn to with an integer
* translation and the scale in mXScale/mYScale.
*/
bool AllowResidualTranslation()
{
// If we're in a transformed subtree, but no ancestor transform is actively
// changing, we'll use the residual translation when drawing into the
- // ThebesLayer to ensure that snapping exactly matches the ideal transform.
+ // PaintedLayer to ensure that snapping exactly matches the ideal transform.
return mInTransformedSubtree && !mInActiveTransformedSubtree;
}
};
@@ -124,7 +124,7 @@ struct ContainerLayerParameters {
* That data enables us to retain layer trees. When constructing a
* ContainerLayer, we first check to see if there's an existing
* ContainerLayer for the same frame that can be recycled. If we recycle
- * it, we also try to reuse its existing ThebesLayer children to render
+ * it, we also try to reuse its existing PaintedLayer children to render
* the display items without layers of their own. The idea is that by
* recycling layers deterministically, we can ensure that when nothing
* changes in a display list, we will reuse the existing layers without
@@ -135,7 +135,7 @@ struct ContainerLayerParameters {
* locates the last layer used to render the display item, if any, and
* return it as a candidate for recycling.
*
- * FrameLayerBuilder sets up ThebesLayers so that 0,0 in the Thebes layer
+ * FrameLayerBuilder sets up PaintedLayers so that 0,0 in the Painted layer
* corresponds to the (pixel-snapped) top-left of the aAnimatedGeometryRoot.
* It sets up ContainerLayers so that 0,0 in the container layer
* corresponds to the snapped top-left of the display item reference frame.
@@ -143,7 +143,7 @@ struct ContainerLayerParameters {
* When we construct a container layer, we know the transform that will be
* applied to the layer. If the transform scales the content, we can get
* better results when intermediate buffers are used by pushing some scale
- * from the container's transform down to the children. For ThebesLayer
+ * from the container's transform down to the children. For PaintedLayer
* children, the scaling can be achieved by changing the size of the layer
* and drawing into it with increased or decreased resolution. By convention,
* integer types (nsIntPoint/nsIntSize/nsIntRect/nsIntRegion) are all in layer
@@ -153,7 +153,7 @@ class FrameLayerBuilder : public layers::LayerUserData {
public:
typedef layers::ContainerLayer ContainerLayer;
typedef layers::Layer Layer;
- typedef layers::ThebesLayer ThebesLayer;
+ typedef layers::PaintedLayer PaintedLayer;
typedef layers::ImageLayer ImageLayer;
typedef layers::LayerManager LayerManager;
typedef layers::BasicLayerManager BasicLayerManager;
@@ -177,7 +177,7 @@ public:
static void Shutdown();
void Init(nsDisplayListBuilder* aBuilder, LayerManager* aManager,
- ThebesLayerData* aLayerData = nullptr);
+ PaintedLayerData* aLayerData = nullptr);
/**
* Call this to notify that we have just started a transaction on the
@@ -208,7 +208,7 @@ public:
* This gets called by display list code. It calls BuildLayer on the
* items in the display list, making items with their own layers
* children of the new container, and assigning all other items to
- * ThebesLayer children created and managed by the FrameLayerBuilder.
+ * PaintedLayer children created and managed by the FrameLayerBuilder.
* Returns a layer with clip rect cleared; it is the
* caller's responsibility to add any clip rect. The visible region
* is set based on what's in the layer.
@@ -249,7 +249,7 @@ public:
static void InvalidateAllLayersForFrame(nsIFrame *aFrame);
/**
- * Call this to determine if a frame has a dedicated (non-Thebes) layer
+ * Call this to determine if a frame has a dedicated (non-Painted) layer
* for the given display item key. If there isn't one, we return null,
* otherwise we return the layer.
*/
@@ -261,7 +261,7 @@ public:
* This function can be called multiple times in a row to draw
* different regions.
*/
- static void DrawThebesLayer(ThebesLayer* aLayer,
+ static void DrawPaintedLayer(PaintedLayer* aLayer,
gfxContext* aContext,
const nsIntRegion& aRegionToDraw,
mozilla::layers::DrawRegionClip aClip,
@@ -298,13 +298,13 @@ public:
BasicLayerManager* aManager);
/**
- * Record aItem as a display item that is rendered by the ThebesLayer
+ * Record aItem as a display item that is rendered by the PaintedLayer
* aLayer, with aClipRect, where aContainerLayerFrame is the frame
* for the container layer this ThebesItem belongs to.
* aItem must have an underlying frame.
* @param aTopLeft offset from active scrolled root to reference frame
*/
- void AddThebesDisplayItem(ThebesLayerData* aLayer,
+ void AddPaintedDisplayItem(PaintedLayerData* aLayer,
nsDisplayItem* aItem,
const DisplayItemClip& aClip,
const nsIntRect& aItemVisibleRect,
@@ -355,13 +355,13 @@ public:
* of the active scrolled root frame. It must be an integer
* translation.
*/
- void SavePreviousDataForLayer(ThebesLayer* aLayer, uint32_t aClipCount);
+ void SavePreviousDataForLayer(PaintedLayer* aLayer, uint32_t aClipCount);
/**
* Get the translation transform that was in aLayer when we last painted. It's either
* the transform saved by SaveLastPaintTransform, or else the transform
* that's currently in the layer (which must be an integer translation).
*/
- nsIntPoint GetLastPaintOffset(ThebesLayer* aLayer);
+ nsIntPoint GetLastPaintOffset(PaintedLayer* aLayer);
/**
* Return the resolution at which we expect to render aFrame's contents,
@@ -370,12 +370,12 @@ public:
* being rendered at, as well as any currently-inactive transforms between
* aFrame and that container layer.
*/
- static gfxSize GetThebesLayerScaleForFrame(nsIFrame* aFrame);
+ static gfxSize GetPaintedLayerScaleForFrame(nsIFrame* aFrame);
/**
* Stores a Layer as the dedicated layer in the DisplayItemData for a given frame/key pair.
*
- * Used when we optimize a ThebesLayer into an ImageLayer and want to retroactively update the
+ * Used when we optimize a PaintedLayer into an ImageLayer and want to retroactively update the
* DisplayItemData so we can retrieve the layer from within layout.
*/
void StoreOptimizedLayerForFrame(nsDisplayItem* aItem, Layer* aLayer);
@@ -446,7 +446,7 @@ public:
* longer than the transaction.
*
* Updates the geometry, frame list and clip.
- * For items within a ThebesLayer, a geometry object must be specifed to retain
+ * For items within a PaintedLayer, a geometry object must be specifed to retain
* until the next transaction.
*
*/
@@ -489,7 +489,7 @@ protected:
* Given a frame and a display item key that uniquely identifies a
* display item for the frame, find the layer that was last used to
* render that display item. Returns null if there is no such layer.
- * This could be a dedicated layer for the display item, or a ThebesLayer
+ * This could be a dedicated layer for the display item, or a PaintedLayer
* that renders many display items.
*/
DisplayItemData* GetOldLayerForFrame(nsIFrame* aFrame, uint32_t aDisplayItemKey);
@@ -534,12 +534,12 @@ protected:
void* aClosure);
/**
* We store one of these for each display item associated with a
- * ThebesLayer, in a hashtable that maps each ThebesLayer to an array
- * of ClippedDisplayItems. (ThebesLayerItemsEntry is the hash entry
+ * PaintedLayer, in a hashtable that maps each PaintedLayer to an array
+ * of ClippedDisplayItems. (PaintedLayerItemsEntry is the hash entry
* for that hashtable.)
* These are only stored during the paint process, so that the
- * DrawThebesLayer callback can figure out which items to draw for the
- * ThebesLayer.
+ * DrawPaintedLayer callback can figure out which items to draw for the
+ * PaintedLayer.
*/
struct ClippedDisplayItem {
ClippedDisplayItem(nsDisplayItem* aItem, uint32_t aGeneration)
@@ -585,25 +585,25 @@ protected:
* the paint process. This is the hashentry for that hashtable.
*/
public:
- class ThebesLayerItemsEntry : public nsPtrHashKey {
+ class PaintedLayerItemsEntry : public nsPtrHashKey {
public:
- explicit ThebesLayerItemsEntry(const ThebesLayer *key)
- : nsPtrHashKey(key)
+ explicit PaintedLayerItemsEntry(const PaintedLayer *key)
+ : nsPtrHashKey(key)
, mContainerLayerFrame(nullptr)
, mLastCommonClipCount(0)
, mContainerLayerGeneration(0)
, mHasExplicitLastPaintOffset(false)
, mCommonClipCount(0)
{}
- ThebesLayerItemsEntry(const ThebesLayerItemsEntry &toCopy) :
- nsPtrHashKey(toCopy.mKey), mItems(toCopy.mItems)
+ PaintedLayerItemsEntry(const PaintedLayerItemsEntry &toCopy) :
+ nsPtrHashKey