Bug 1241651. Remove nsPresContext::GetDisplayRootPresContext. r=mattwoodrow

It should no longer serve any purpose different from nsPresContext::GetRootPresContext.
This commit is contained in:
Timothy Nikkel 2016-01-21 19:09:04 -06:00
parent eb42da0000
commit 098499fdf4
4 changed files with 12 additions and 40 deletions

View File

@ -151,7 +151,7 @@ nsPresContext::IsDOMPaintEventPending()
if (mFireAfterPaintEvents) {
return true;
}
nsRootPresContext* drpc = GetDisplayRootPresContext();
nsRootPresContext* drpc = GetRootPresContext();
if (drpc && drpc->mRefreshDriver->ViewManagerFlushIsPending()) {
// Since we're promising that there will be a MozAfterPaint event
// fired, we record an empty invalidation in case display list
@ -1333,33 +1333,6 @@ nsPresContext::GetRootPresContext()
return pc->IsRoot() ? static_cast<nsRootPresContext*>(pc) : nullptr;
}
nsRootPresContext*
nsPresContext::GetDisplayRootPresContext()
{
nsPresContext* pc = this;
for (;;) {
nsPresContext* parent = pc->GetParentPresContext();
if (!parent) {
// Not sure if this is always strictly the parent, but it works for GetRootPresContext
// where the current pres context has no frames.
nsIDocument *doc = pc->Document();
if (doc) {
doc = doc->GetParentDocument();
if (doc) {
nsIPresShell* shell = doc->GetShell();
if (shell) {
parent = shell->GetPresContext();
}
}
}
}
if (!parent || parent == pc)
break;
pc = parent;
}
return pc->IsRoot() ? static_cast<nsRootPresContext*>(pc) : nullptr;
}
void
nsPresContext::CompatibilityModeChanged()
{

View File

@ -208,7 +208,7 @@ public:
* be found (e.g. it's detached).
*/
nsRootPresContext* GetRootPresContext();
nsRootPresContext* GetDisplayRootPresContext();
virtual bool IsRoot() { return false; }
nsIDocument* Document() const

View File

@ -148,11 +148,11 @@ public:
NS_ASSERTION(mRootRefreshDrivers.Contains(aDriver), "RemoveRefreshDriver for a refresh driver that's not in the root refresh list!");
mRootRefreshDrivers.RemoveElement(aDriver);
} else {
nsPresContext* displayRoot = aDriver->PresContext()->GetDisplayRootPresContext();
nsPresContext* rootContext = aDriver->PresContext()->GetRootPresContext();
// During PresContext shutdown, we can't accurately detect
// if a root refresh driver exists or not. Therefore, we have to
// search and find out which list this driver exists in.
if (!displayRoot) {
if (!rootContext) {
if (mRootRefreshDrivers.Contains(aDriver)) {
mRootRefreshDrivers.RemoveElement(aDriver);
} else {
@ -202,13 +202,12 @@ protected:
bool IsRootRefreshDriver(nsRefreshDriver* aDriver)
{
nsPresContext* displayRoot = aDriver->PresContext()->GetDisplayRootPresContext();
if (!displayRoot) {
nsPresContext* rootContext = aDriver->PresContext()->GetRootPresContext();
if (!rootContext) {
return false;
}
nsRefreshDriver* rootRefreshDriver = displayRoot->GetRootPresContext()->RefreshDriver();
return aDriver == rootRefreshDriver;
return aDriver == rootContext->RefreshDriver();
}
/*
@ -2030,9 +2029,9 @@ nsRefreshDriver::IsWaitingForPaint(mozilla::TimeStamp aTime)
// Try find the 'root' refresh driver for the current window and check
// if that is waiting for a paint.
nsPresContext *displayRoot = PresContext()->GetDisplayRootPresContext();
if (displayRoot) {
nsRefreshDriver *rootRefresh = displayRoot->GetRootPresContext()->RefreshDriver();
nsPresContext *rootContext = PresContext()->GetRootPresContext();
if (rootContext) {
nsRefreshDriver *rootRefresh = rootContext->RefreshDriver();
if (rootRefresh && rootRefresh != this) {
if (rootRefresh->IsWaitingForPaint(aTime)) {
if (mRootRefresh != rootRefresh) {

View File

@ -1086,9 +1086,9 @@ nsView::DidCompositeWindow(const TimeStamp& aCompositeStart,
nsAutoScriptBlocker scriptBlocker;
nsPresContext* context = presShell->GetPresContext();
nsRootPresContext* rootContext = context->GetDisplayRootPresContext();
nsRootPresContext* rootContext = context->GetRootPresContext();
MOZ_ASSERT(rootContext, "rootContext must be valid.");
rootContext->GetRootPresContext()->NotifyDidPaintForSubtree(nsIPresShell::PAINT_COMPOSITE);
rootContext->NotifyDidPaintForSubtree(nsIPresShell::PAINT_COMPOSITE);
// If the two timestamps are identical, this was likely a fake composite
// event which wouldn't be terribly useful to display.