Remove duplicate null check of presShell. (Bug 747231, patch 1) r=roc

--HG--
extra : transplant_source : %05I%BFz%3C%95%CB%19%BCV%08Lx%F5G%88%9B%02S9
This commit is contained in:
L. David Baron 2012-05-05 15:25:26 +02:00
Родитель bebbcf9bbd
Коммит b4ff21d2cc
1 изменённых файлов: 25 добавлений и 27 удалений

Просмотреть файл

@ -295,7 +295,7 @@ nsDOMWindowUtils::SetDisplayPortForElement(float aXPx, float aYPx,
nsIPresShell* presShell = GetPresShell();
if (!presShell) {
return NS_ERROR_FAILURE;
}
}
nsRect displayport(nsPresContext::CSSPixelsToAppUnits(aXPx),
nsPresContext::CSSPixelsToAppUnits(aYPx),
@ -334,33 +334,31 @@ nsDOMWindowUtils::SetDisplayPortForElement(float aXPx, float aYPx,
}
}
if (presShell) {
nsIFrame* rootFrame = presShell->FrameManager()->GetRootFrame();
if (rootFrame) {
nsIContent* rootContent =
rootScrollFrame ? rootScrollFrame->GetContent() : nsnull;
nsRect rootDisplayport;
bool usingDisplayport = rootContent &&
nsLayoutUtils::GetDisplayPort(rootContent, &rootDisplayport);
rootFrame->InvalidateWithFlags(
usingDisplayport ? rootDisplayport : rootFrame->GetVisualOverflowRect(),
nsIFrame::INVALIDATE_NO_THEBES_LAYERS);
nsIFrame* rootFrame = presShell->FrameManager()->GetRootFrame();
if (rootFrame) {
nsIContent* rootContent =
rootScrollFrame ? rootScrollFrame->GetContent() : nsnull;
nsRect rootDisplayport;
bool usingDisplayport = rootContent &&
nsLayoutUtils::GetDisplayPort(rootContent, &rootDisplayport);
rootFrame->InvalidateWithFlags(
usingDisplayport ? rootDisplayport : rootFrame->GetVisualOverflowRect(),
nsIFrame::INVALIDATE_NO_THEBES_LAYERS);
// If we are hiding something that is a display root then send empty paint
// transaction in order to release retained layers because it won't get
// any more paint requests when it is hidden.
if (displayport.IsEmpty() &&
rootFrame == nsLayoutUtils::GetDisplayRootFrame(rootFrame)) {
nsCOMPtr<nsIWidget> widget = GetWidget();
if (widget) {
bool isRetainingManager;
LayerManager* manager = widget->GetLayerManager(&isRetainingManager);
if (isRetainingManager) {
manager->BeginTransaction();
nsLayoutUtils::PaintFrame(nsnull, rootFrame, nsRegion(), NS_RGB(255, 255, 255),
nsLayoutUtils::PAINT_WIDGET_LAYERS |
nsLayoutUtils::PAINT_EXISTING_TRANSACTION);
}
// If we are hiding something that is a display root then send empty paint
// transaction in order to release retained layers because it won't get
// any more paint requests when it is hidden.
if (displayport.IsEmpty() &&
rootFrame == nsLayoutUtils::GetDisplayRootFrame(rootFrame)) {
nsCOMPtr<nsIWidget> widget = GetWidget();
if (widget) {
bool isRetainingManager;
LayerManager* manager = widget->GetLayerManager(&isRetainingManager);
if (isRetainingManager) {
manager->BeginTransaction();
nsLayoutUtils::PaintFrame(nsnull, rootFrame, nsRegion(), NS_RGB(255, 255, 255),
nsLayoutUtils::PAINT_WIDGET_LAYERS |
nsLayoutUtils::PAINT_EXISTING_TRANSACTION);
}
}
}