mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-25 01:01:52 +00:00
Bug 895003 - Introduce a second preference to control the chrome paint flashing - nglayout.debug.paint_flashing_chrome. r=roc
The original pref still controls content and chrome when set. The preference is now live, for content and chrome, the change will be seen on the next refresh. The cached value is now in nsPresContext, rather than nsRefreshDriver.
This commit is contained in:
parent
c25761a19b
commit
3dffde4a8d
@ -3347,7 +3347,7 @@ nsDOMWindowUtils::SetPaintFlashing(bool aPaintFlashing)
|
||||
{
|
||||
nsPresContext* presContext = GetPresContext();
|
||||
if (presContext) {
|
||||
presContext->RefreshDriver()->SetPaintFlashing(aPaintFlashing);
|
||||
presContext->SetPaintFlashing(aPaintFlashing);
|
||||
// Clear paint flashing colors
|
||||
nsIPresShell* presShell = GetPresShell();
|
||||
if (!aPaintFlashing && presShell) {
|
||||
@ -3366,7 +3366,7 @@ nsDOMWindowUtils::GetPaintFlashing(bool* aRetVal)
|
||||
*aRetVal = false;
|
||||
nsPresContext* presContext = GetPresContext();
|
||||
if (presContext) {
|
||||
*aRetVal = presContext->RefreshDriver()->GetPaintFlashing();
|
||||
*aRetVal = presContext->GetPaintFlashing();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -3327,7 +3327,7 @@ FrameLayerBuilder::DrawThebesLayer(ThebesLayer* aLayer,
|
||||
aContext->Restore();
|
||||
}
|
||||
|
||||
if (presContext->RefreshDriver()->GetPaintFlashing()) {
|
||||
if (presContext->GetPaintFlashing()) {
|
||||
FlashPaint(aContext);
|
||||
}
|
||||
|
||||
|
@ -199,7 +199,8 @@ nsPresContext::nsPresContext(nsIDocument* aDocument, nsPresContextType aType)
|
||||
mPageSize(-1, -1), mPPScale(1.0f),
|
||||
mViewportStyleOverflow(NS_STYLE_OVERFLOW_AUTO, NS_STYLE_OVERFLOW_AUTO),
|
||||
mImageAnimationModePref(imgIContainer::kNormalAnimMode),
|
||||
mAllInvalidated(false)
|
||||
mAllInvalidated(false),
|
||||
mPaintFlashing(false), mPaintFlashingInitialized(false)
|
||||
{
|
||||
// NOTE! nsPresContext::operator new() zeroes out all members, so don't
|
||||
// bother initializing members to 0.
|
||||
@ -315,6 +316,12 @@ nsPresContext::~nsPresContext()
|
||||
Preferences::UnregisterCallback(nsPresContext::PrefChangedCallback,
|
||||
"layout.css.devPixelsPerPx",
|
||||
this);
|
||||
Preferences::UnregisterCallback(nsPresContext::PrefChangedCallback,
|
||||
"nglayout.debug.paint_flashing",
|
||||
this);
|
||||
Preferences::UnregisterCallback(nsPresContext::PrefChangedCallback,
|
||||
"nglayout.debug.paint_flashing_chrome",
|
||||
this);
|
||||
}
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsPresContext)
|
||||
@ -879,6 +886,11 @@ nsPresContext::PreferenceChanged(const char* aPrefName)
|
||||
return;
|
||||
mPrefChangedTimer->InitWithFuncCallback(nsPresContext::PrefChangedUpdateTimerCallback, (void*)this, 0, nsITimer::TYPE_ONE_SHOT);
|
||||
}
|
||||
if (prefName.EqualsLiteral("nglayout.debug.paint_flashing") ||
|
||||
prefName.EqualsLiteral("nglayout.debug.paint_flashing_chrome")) {
|
||||
mPaintFlashingInitialized = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -1024,6 +1036,12 @@ nsPresContext::Init(nsDeviceContext* aDeviceContext)
|
||||
Preferences::RegisterCallback(nsPresContext::PrefChangedCallback,
|
||||
"layout.css.devPixelsPerPx",
|
||||
this);
|
||||
Preferences::RegisterCallback(nsPresContext::PrefChangedCallback,
|
||||
"nglayout.debug.paint_flashing",
|
||||
this);
|
||||
Preferences::RegisterCallback(nsPresContext::PrefChangedCallback,
|
||||
"nglayout.debug.paint_flashing_chrome",
|
||||
this);
|
||||
|
||||
nsresult rv = mEventManager->Init();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -2619,6 +2637,19 @@ nsPresContext::IsCrossProcessRootContentDocument()
|
||||
return (tabChild && tabChild->IsRootContentDocument());
|
||||
}
|
||||
|
||||
bool nsPresContext::GetPaintFlashing() const
|
||||
{
|
||||
if (!mPaintFlashingInitialized) {
|
||||
bool pref = Preferences::GetBool("nglayout.debug.paint_flashing");
|
||||
if (!pref && IsChrome()) {
|
||||
pref = Preferences::GetBool("nglayout.debug.paint_flashing_chrome");
|
||||
}
|
||||
mPaintFlashing = pref;
|
||||
mPaintFlashingInitialized = true;
|
||||
}
|
||||
return mPaintFlashing;
|
||||
}
|
||||
|
||||
nsRootPresContext::nsRootPresContext(nsIDocument* aDocument,
|
||||
nsPresContextType aType)
|
||||
: nsPresContext(aDocument, aType),
|
||||
|
@ -859,6 +859,16 @@ public:
|
||||
return GetCachedBoolPref(kPresContext_UseDocumentColors) || IsChrome();
|
||||
}
|
||||
|
||||
// Explicitly enable and disable paint flashing.
|
||||
void SetPaintFlashing(bool aPaintFlashing) {
|
||||
mPaintFlashing = aPaintFlashing;
|
||||
mPaintFlashingInitialized = true;
|
||||
}
|
||||
|
||||
// This method should be used instead of directly accessing mPaintFlashing,
|
||||
// as that value may be out of date when mPaintFlashingInitialized is false.
|
||||
bool GetPaintFlashing() const;
|
||||
|
||||
bool SupressingResizeReflow() const { return mSupressResizeReflow; }
|
||||
|
||||
virtual NS_HIDDEN_(gfxUserFontSet*) GetUserFontSetExternal();
|
||||
@ -1326,6 +1336,11 @@ protected:
|
||||
mutable unsigned mIsChromeIsCached : 1;
|
||||
mutable unsigned mIsChrome : 1;
|
||||
|
||||
// Should we paint flash in this context? Do not use this variable directly.
|
||||
// Use GetPaintFlashing() method instead.
|
||||
mutable unsigned mPaintFlashing : 1;
|
||||
mutable unsigned mPaintFlashingInitialized : 1;
|
||||
|
||||
#ifdef DEBUG
|
||||
bool mInitialized;
|
||||
#endif
|
||||
|
@ -724,8 +724,6 @@ nsRefreshDriver::nsRefreshDriver(nsPresContext* aPresContext)
|
||||
mMostRecentRefreshEpochTime = JS_Now();
|
||||
mMostRecentRefresh = TimeStamp::Now();
|
||||
|
||||
mPaintFlashing = Preferences::GetBool("nglayout.debug.paint_flashing");
|
||||
|
||||
mRequests.Init();
|
||||
mStartTable.Init();
|
||||
}
|
||||
|
@ -230,17 +230,6 @@ public:
|
||||
*/
|
||||
static int32_t DefaultInterval();
|
||||
|
||||
/**
|
||||
* Enable/disable paint flashing.
|
||||
*/
|
||||
void SetPaintFlashing(bool aPaintFlashing) {
|
||||
mPaintFlashing = aPaintFlashing;
|
||||
}
|
||||
|
||||
bool GetPaintFlashing() {
|
||||
return mPaintFlashing;
|
||||
}
|
||||
|
||||
private:
|
||||
typedef nsTObserverArray<nsARefreshObserver*> ObserverArray;
|
||||
typedef nsTHashtable<nsISupportsHashKey> RequestTable;
|
||||
@ -295,7 +284,6 @@ private:
|
||||
bool mTestControllingRefreshes;
|
||||
bool mViewManagerFlushIsPending;
|
||||
bool mRequestedHighPrecision;
|
||||
bool mPaintFlashing;
|
||||
|
||||
int64_t mMostRecentRefreshEpochTime;
|
||||
mozilla::TimeStamp mMostRecentRefresh;
|
||||
|
Loading…
Reference in New Issue
Block a user