зеркало из https://github.com/mozilla/pjs.git
Bug 721294. Only call nsIPresShell::WillPaint for the root presshell. Pass aWilLSendDidPaint correctly to nsIPresShell::Paint. Remove aPaintDefaultBackground from nsIPresShell::Paint. r=mats
This commit is contained in:
Родитель
a620ddc416
Коммит
8107318de6
|
@ -143,8 +143,8 @@ typedef struct CapturingContentInfo {
|
|||
} CapturingContentInfo;
|
||||
|
||||
#define NS_IPRESSHELL_IID \
|
||||
{ 0x3ab5b116, 0x2d73, 0x431c, \
|
||||
{ 0x9a, 0x4b, 0x6c, 0x91, 0x9e, 0x42, 0x45, 0xc3 } }
|
||||
{ 0x87acd089, 0x8da7, 0x4438, \
|
||||
{ 0xa5, 0xcd, 0x90, 0x1e, 0x5d, 0x8f, 0xd8, 0x19 } }
|
||||
|
||||
// Constants for ScrollContentIntoView() function
|
||||
#define NS_PRESSHELL_SCROLL_TOP 0
|
||||
|
@ -1145,13 +1145,21 @@ public:
|
|||
|
||||
virtual void Paint(nsIView* aViewToPaint, nsIWidget* aWidget,
|
||||
const nsRegion& aDirtyRegion, const nsIntRegion& aIntDirtyRegion,
|
||||
bool aPaintDefaultBackground, bool aWillSendDidPaint) = 0;
|
||||
bool aWillSendDidPaint) = 0;
|
||||
virtual nsresult HandleEvent(nsIFrame* aFrame,
|
||||
nsGUIEvent* aEvent,
|
||||
bool aDontRetargetEvents,
|
||||
nsEventStatus* aEventStatus) = 0;
|
||||
virtual bool ShouldIgnoreInvalidation() = 0;
|
||||
/**
|
||||
* Notify that the NS_WILL_PAINT event was received. Fires on every
|
||||
* visible presshell in the document tree.
|
||||
*/
|
||||
virtual void WillPaint(bool aWillSendDidPaint) = 0;
|
||||
/**
|
||||
* Notify that the NS_DID_PAINT event was received. Only fires on the
|
||||
* root pres shell.
|
||||
*/
|
||||
virtual void DidPaint() = 0;
|
||||
virtual void ScheduleViewManagerFlush() = 0;
|
||||
virtual void ClearMouseCaptureOnView(nsIView* aView) = 0;
|
||||
|
|
|
@ -5427,7 +5427,6 @@ PresShell::Paint(nsIView* aViewToPaint,
|
|||
nsIWidget* aWidgetToPaint,
|
||||
const nsRegion& aDirtyRegion,
|
||||
const nsIntRegion& aIntDirtyRegion,
|
||||
bool aPaintDefaultBackground,
|
||||
bool aWillSendDidPaint)
|
||||
{
|
||||
#ifdef NS_FUNCTION_TIMER
|
||||
|
@ -5449,7 +5448,7 @@ PresShell::Paint(nsIView* aViewToPaint,
|
|||
nsPresContext* presContext = GetPresContext();
|
||||
AUTO_LAYOUT_PHASE_ENTRY_POINT(presContext, Paint);
|
||||
|
||||
nsIFrame* frame = aPaintDefaultBackground ? nsnull : aViewToPaint->GetFrame();
|
||||
nsIFrame* frame = aViewToPaint->GetFrame();
|
||||
|
||||
bool isRetainingManager;
|
||||
LayerManager* layerManager =
|
||||
|
@ -5488,9 +5487,6 @@ PresShell::Paint(nsIView* aViewToPaint,
|
|||
frame->BeginDeferringInvalidatesForDisplayRoot(aDirtyRegion);
|
||||
|
||||
// We can paint directly into the widget using its layer manager.
|
||||
// When we get rid of child widgets, this will be the only path we
|
||||
// need. (aPaintDefaultBackground will never be needed since the
|
||||
// chrome can always paint a default background.)
|
||||
nsLayoutUtils::PaintFrame(nsnull, frame, aDirtyRegion, bgcolor,
|
||||
nsLayoutUtils::PAINT_WIDGET_LAYERS |
|
||||
nsLayoutUtils::PAINT_EXISTING_TRANSACTION);
|
||||
|
@ -7208,10 +7204,11 @@ PresShell::DidPaint()
|
|||
return;
|
||||
}
|
||||
|
||||
NS_ASSERTION(mPresContext->IsRoot(), "Should only call DidPaint on root presshells");
|
||||
|
||||
nsRootPresContext* rootPresContext = mPresContext->GetRootPresContext();
|
||||
if (!rootPresContext) {
|
||||
return;
|
||||
}
|
||||
// This should only be called on root presshells, but maybe if a document
|
||||
// tree is torn down we might not be a root presshell...
|
||||
if (rootPresContext == mPresContext) {
|
||||
rootPresContext->UpdatePluginGeometry();
|
||||
}
|
||||
|
|
|
@ -316,7 +316,7 @@ public:
|
|||
|
||||
virtual void Paint(nsIView* aViewToPaint, nsIWidget* aWidget,
|
||||
const nsRegion& aDirtyRegion, const nsIntRegion& aIntDirtyRegion,
|
||||
bool aPaintDefaultBackground, bool aWillSendDidPaint);
|
||||
bool aWillSendDidPaint);
|
||||
virtual nsresult HandleEvent(nsIFrame* aFrame,
|
||||
nsGUIEvent* aEvent,
|
||||
bool aDontRetargetEvents,
|
||||
|
|
|
@ -337,7 +337,8 @@ nsIView* nsIViewManager::GetDisplayRootFor(nsIView* aView)
|
|||
rendering.
|
||||
*/
|
||||
void nsViewManager::Refresh(nsView *aView, nsIWidget *aWidget,
|
||||
const nsIntRegion& aRegion)
|
||||
const nsIntRegion& aRegion,
|
||||
bool aWillSendDidPaint)
|
||||
{
|
||||
NS_ASSERTION(aView == nsView::GetViewFor(aWidget), "view widget mismatch");
|
||||
NS_ASSERTION(aView->GetViewManager() == this, "wrong view manager");
|
||||
|
@ -368,7 +369,14 @@ void nsViewManager::Refresh(nsView *aView, nsIWidget *aWidget,
|
|||
nsAutoScriptBlocker scriptBlocker;
|
||||
SetPainting(true);
|
||||
|
||||
RenderViews(aView, aWidget, damageRegion, aRegion, false, false);
|
||||
NS_ASSERTION(GetDisplayRootFor(aView) == aView,
|
||||
"Widgets that we paint must all be display roots");
|
||||
|
||||
if (mPresShell) {
|
||||
mPresShell->Paint(aView, aWidget, damageRegion, aRegion,
|
||||
aWillSendDidPaint);
|
||||
mozilla::StartupTimeline::RecordOnce(mozilla::StartupTimeline::FIRST_PAINT);
|
||||
}
|
||||
|
||||
SetPainting(false);
|
||||
}
|
||||
|
@ -379,23 +387,6 @@ void nsViewManager::Refresh(nsView *aView, nsIWidget *aWidget,
|
|||
}
|
||||
}
|
||||
|
||||
// aRC and aRegion are in view coordinates
|
||||
void nsViewManager::RenderViews(nsView *aView, nsIWidget *aWidget,
|
||||
const nsRegion& aRegion,
|
||||
const nsIntRegion& aIntRegion,
|
||||
bool aPaintDefaultBackground,
|
||||
bool aWillSendDidPaint)
|
||||
{
|
||||
NS_ASSERTION(GetDisplayRootFor(aView) == aView,
|
||||
"Widgets that we paint must all be display roots");
|
||||
|
||||
if (mPresShell) {
|
||||
mPresShell->Paint(aView, aWidget, aRegion, aIntRegion,
|
||||
aPaintDefaultBackground, aWillSendDidPaint);
|
||||
mozilla::StartupTimeline::RecordOnce(mozilla::StartupTimeline::FIRST_PAINT);
|
||||
}
|
||||
}
|
||||
|
||||
void nsViewManager::ProcessPendingUpdatesForView(nsView* aView,
|
||||
bool aFlushDirtyRegion)
|
||||
{
|
||||
|
@ -819,14 +810,14 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent,
|
|||
break;
|
||||
|
||||
// Paint.
|
||||
Refresh(view, event->widget, event->region);
|
||||
Refresh(view, event->widget, event->region, event->willSendDidPaint);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case NS_DID_PAINT: {
|
||||
nsRefPtr<nsViewManager> rootVM = RootViewManager();
|
||||
rootVM->CallDidPaintOnObservers();
|
||||
rootVM->CallDidPaintOnObserver();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1397,21 +1388,14 @@ nsViewManager::CallWillPaintOnObservers(bool aWillSendDidPaint)
|
|||
}
|
||||
|
||||
void
|
||||
nsViewManager::CallDidPaintOnObservers()
|
||||
nsViewManager::CallDidPaintOnObserver()
|
||||
{
|
||||
NS_PRECONDITION(IsRootVM(), "Must be root VM for this to be called!");
|
||||
|
||||
PRInt32 index;
|
||||
for (index = 0; index < mVMCount; index++) {
|
||||
nsViewManager* vm = (nsViewManager*)gViewManagers->ElementAt(index);
|
||||
if (vm->RootViewManager() == this) {
|
||||
// One of our kids.
|
||||
if (vm->mRootView && vm->mRootView->IsEffectivelyVisible()) {
|
||||
nsCOMPtr<nsIPresShell> shell = vm->GetPresShell();
|
||||
if (shell) {
|
||||
shell->DidPaint();
|
||||
}
|
||||
}
|
||||
if (mRootView && mRootView->IsEffectivelyVisible()) {
|
||||
nsCOMPtr<nsIPresShell> shell = GetPresShell();
|
||||
if (shell) {
|
||||
shell->DidPaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -153,7 +153,7 @@ private:
|
|||
* Call WillPaint() on all view observers under this vm root.
|
||||
*/
|
||||
void CallWillPaintOnObservers(bool aWillSendDidPaint);
|
||||
void CallDidPaintOnObservers();
|
||||
void CallDidPaintOnObserver();
|
||||
void ReparentChildWidgets(nsIView* aView, nsIWidget *aNewWidget);
|
||||
void ReparentWidgets(nsIView* aView, nsIView *aParent);
|
||||
void InvalidateWidgetArea(nsView *aWidgetView, const nsRegion &aDamagedRegion);
|
||||
|
@ -161,12 +161,8 @@ private:
|
|||
void InvalidateViews(nsView *aView);
|
||||
|
||||
// aView is the view for aWidget and aRegion is relative to aWidget.
|
||||
void Refresh(nsView *aView, nsIWidget *aWidget, const nsIntRegion& aRegion);
|
||||
// aRootView is the view for aWidget, aRegion is relative to aRootView, and
|
||||
// aIntRegion is relative to aWidget.
|
||||
void RenderViews(nsView *aRootView, nsIWidget *aWidget,
|
||||
const nsRegion& aRegion, const nsIntRegion& aIntRegion,
|
||||
bool aPaintDefaultBackground, bool aWillSendDidPaint);
|
||||
void Refresh(nsView *aView, nsIWidget *aWidget, const nsIntRegion& aRegion,
|
||||
bool aWillSendDidPaint);
|
||||
|
||||
void InvalidateRectDifference(nsView *aView, const nsRect& aRect, const nsRect& aCutOut);
|
||||
void InvalidateHorizontalBandDifference(nsView *aView, const nsRect& aRect, const nsRect& aCutOut,
|
||||
|
|
Загрузка…
Ссылка в новой задаче