Closed Bug 826817 Opened 11 years ago Closed 11 years ago

Make all platforms always fire WillPaintWindow/DidPaintWindow

Categories

(Core :: Widget, defect)

18 Branch
x86_64
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla21

People

(Reporter: roc, Assigned: roc)

References

Details

Attachments

(6 files)

This will simplify some code.
Comment on attachment 698131 [details] [diff] [review]
Part 1: Send WillPaintWindow/DidPaintWindow from all widget implementations

>diff --git a/widget/xpwidgets/PuppetWidget.cpp b/widget/xpwidgets/PuppetWidget.cpp
>     if (mozilla::layers::LAYERS_D3D10 == mLayerManager->GetBackendType()) {
>-      mAttachedWidgetListener->PaintWindow(this, region, nsIWidgetListener::WILL_SEND_DID_PAINT);
>+      mAttachedWidgetListener->PaintWindow(this, region,
>+        nsIWidgetListener::SENT_WILL_PAINT | nsIWidgetListener::WILL_SEND_DID_PAINT);
>     } else {
>       nsRefPtr<gfxContext> ctx = new gfxContext(mSurface);
>       ctx->Rectangle(gfxRect(0,0,0,0));
>       ctx->Clip();
>       AutoLayerManagerSetup setupLayerManager(this, ctx,
>                                               BUFFER_NONE);
>-      mAttachedWidgetListener->PaintWindow(this, region, nsIWidgetListener::WILL_SEND_DID_PAINT);
>+      mAttachedWidgetListener->PaintWindow(this, region,
>+        nsIWidgetListener::SENT_WILL_PAINT | nsIWidgetListener::WILL_SEND_DID_PAINT);
>       mTabChild->NotifyPainted();
>     }
>   }
> 
>-  if (mAttachedWidgetListener) {
>-    mAttachedWidgetListener->DidPaintWindow();
>-  }
>+  mAttachedWidgetListener->DidPaintWindow();

I think you should keep the null check on mAttachedWidgetListener before DidPaintWindow and also have null checks before PaintWindow.
Attachment #698131 - Flags: review?(tnikkel) → review+
Attachment #698132 - Flags: review?(tnikkel) → review+
Attachment #698133 - Flags: review?(tnikkel) → review+
Attachment #698134 - Flags: review?(tnikkel) → review+
Comment on attachment 698131 [details] [diff] [review]
Part 1: Send WillPaintWindow/DidPaintWindow from all widget implementations

>diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm
>-bool nsChildView::PaintWindow(nsIntRegion aRegion, bool aIsAlternate)
>-{
>-  nsIWidget* widget = this;
>+nsIWidgetListener* nsChildView::GetPaintListener() {
>   nsIWidgetListener* listener = mWidgetListener;
> 
>   // If there is no listener, use the parent popup's listener if that exists.
>   if (!listener && mParentWidget) {
>     nsWindowType type;
>     mParentWidget->GetWindowType(type);
>     if (type == eWindowType_popup) {
>       widget = mParentWidget;
>       listener = mParentWidget->GetWidgetListener();
>     }
>   }
> 
>+  return listener;
>+}
>+
>+bool nsChildView::PaintWindow(nsIntRegion aRegion, bool aIsAlternate)
>+{
>+  nsIWidget* widget = this;
>+  nsIWidgetListener* listener = GetPaintListener();
>   if (!listener)
>     return false;
> 
>   bool returnValue = false;
>   bool oldDispatchPaint = mIsDispatchPaint;
>   mIsDispatchPaint = true;
>-  uint32_t flags = nsIWidgetListener::SENT_WILL_PAINT;
>+  uint32_t flags =
>+    nsIWidgetListener::SENT_WILL_PAINT | nsIWidgetListener::WILL_SEND_DID_PAINT;
>   if (aIsAlternate) {
>     flags |= nsIWidgetListener::PAINT_IS_ALTERNATE; 
>   }
>   returnValue = listener->PaintWindow(widget, aRegion, flags);
>+
>+  listener = GetPaintListener();
>+  if (listener) {
>+    listener->DidPaintWindow();
>+  }
>+
>   mIsDispatchPaint = oldDispatchPaint;
>   return returnValue;
> }

The old code would change widget from this to mParentWidget when it changed the listener to the parent listener to, so I think this might be wrong actually.
Attachment #698131 - Flags: review+ → review-
I rebased these and applied the review comments. Were there any significant changes to the patches in your queue that I might be missing?
Attached patch new Part 1Splinter Review
Attachment #706923 - Flags: review?(roc)
This is the only significant change.
(In reply to Timothy Nikkel (:tn) from comment #7)
> I rebased these and applied the review comments. Were there any significant
> changes to the patches in your queue that I might be missing?

No, I haven't done anything with them.
Comment on attachment 706923 [details] [diff] [review]
new Part 1

Review of attachment 706923 [details] [diff] [review]:
-----------------------------------------------------------------

Feel free to land these patches
Attachment #706923 - Flags: review?(roc) → review+
(In reply to Robert O'Callahan (:roc) (Mozilla Corporation) from comment #11)
> Feel free to land these patches

That was my plan.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: