зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1350671 - stylo: Allow resolving out of date styles when explicitly reconstructing frames for an element. r=bholley
MozReview-Commit-ID: 7w9pehHNXQ --HG-- extra : rebase_source : 1476b4397a4384046c324f0176ecd9f699b026bd
This commit is contained in:
Родитель
c4d0f36a65
Коммит
c4f1f8e321
|
@ -2953,6 +2953,10 @@ PresShell::RecreateFramesFor(nsIContent* aContent)
|
|||
nsStyleChangeList changeList(mPresContext->StyleSet()->BackendType());
|
||||
changeList.AppendChange(nullptr, aContent, nsChangeHint_ReconstructFrame);
|
||||
|
||||
// We might have restyles pending when we're asked to recreate frames.
|
||||
// Record that we're OK with stale styles being returned, to avoid assertions.
|
||||
ServoStyleSet::AutoAllowStaleStyles guard(mStyleSet->GetAsServo());
|
||||
|
||||
// Mark ourselves as not safe to flush while we're doing frame construction.
|
||||
++mChangeNestCount;
|
||||
RestyleManager* restyleManager = mPresContext->RestyleManager();
|
||||
|
|
|
@ -291,7 +291,8 @@ SERVO_BINDING_FUNC(Servo_NoteExplicitHints, void, RawGeckoElementBorrowed elemen
|
|||
SERVO_BINDING_FUNC(Servo_TakeChangeHint, nsChangeHint, RawGeckoElementBorrowed element)
|
||||
SERVO_BINDING_FUNC(Servo_ResolveStyle, ServoComputedValuesStrong,
|
||||
RawGeckoElementBorrowed element,
|
||||
RawServoStyleSetBorrowed set)
|
||||
RawServoStyleSetBorrowed set,
|
||||
bool allow_stale)
|
||||
SERVO_BINDING_FUNC(Servo_ResolvePseudoStyle, ServoComputedValuesStrong,
|
||||
RawGeckoElementBorrowed element, nsIAtom* pseudo_tag,
|
||||
bool is_probe, RawServoStyleSetBorrowed set)
|
||||
|
|
|
@ -27,6 +27,7 @@ using namespace mozilla::dom;
|
|||
ServoStyleSet::ServoStyleSet()
|
||||
: mPresContext(nullptr)
|
||||
, mBatching(0)
|
||||
, mAllowResolveStaleStyles(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -783,7 +784,8 @@ ServoStyleSet::RebuildData()
|
|||
already_AddRefed<ServoComputedValues>
|
||||
ServoStyleSet::ResolveServoStyle(Element* aElement)
|
||||
{
|
||||
return Servo_ResolveStyle(aElement, mRawSet.get()).Consume();
|
||||
return Servo_ResolveStyle(aElement, mRawSet.get(),
|
||||
mAllowResolveStaleStyles).Consume();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -46,6 +46,29 @@ class ServoStyleSet
|
|||
{
|
||||
friend class ServoRestyleManager;
|
||||
public:
|
||||
class AutoAllowStaleStyles
|
||||
{
|
||||
public:
|
||||
explicit AutoAllowStaleStyles(ServoStyleSet* aStyleSet)
|
||||
: mStyleSet(aStyleSet)
|
||||
{
|
||||
if (mStyleSet) {
|
||||
MOZ_ASSERT(!mStyleSet->mAllowResolveStaleStyles);
|
||||
mStyleSet->mAllowResolveStaleStyles = true;
|
||||
}
|
||||
}
|
||||
|
||||
~AutoAllowStaleStyles()
|
||||
{
|
||||
if (mStyleSet) {
|
||||
mStyleSet->mAllowResolveStaleStyles = false;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
ServoStyleSet* mStyleSet;
|
||||
};
|
||||
|
||||
static bool IsInServoTraversal()
|
||||
{
|
||||
// The callers of this function are generally main-thread-only _except_
|
||||
|
@ -296,6 +319,7 @@ private:
|
|||
EnumeratedArray<SheetType, SheetType::Count,
|
||||
nsTArray<RefPtr<ServoStyleSheet>>> mSheets;
|
||||
int32_t mBatching;
|
||||
bool mAllowResolveStaleStyles;
|
||||
|
||||
// Stores pointers to our cached style contexts for non-inheriting anonymous
|
||||
// boxes.
|
||||
|
|
Загрузка…
Ссылка в новой задаче