Bug 592563 - Call nsIWidget::Show() on plugin widgets from nsIWidget::ConfigureChildren(). r=roc,josh a=blockingbeta6+

This commit is contained in:
Steven Michaud 2010-09-07 12:20:03 -05:00
Родитель d9e0814bb4
Коммит fb431a2f1c
2 изменённых файлов: 19 добавлений и 17 удалений

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

@ -402,6 +402,8 @@ public:
nsCocoaTextInputHandler* TextInputHandler() { return &mTextInputHandler; } nsCocoaTextInputHandler* TextInputHandler() { return &mTextInputHandler; }
NSView<mozView>* GetEditorView(); NSView<mozView>* GetEditorView();
PRBool IsPluginView() { return (mWindowType == eWindowType_plugin); }
protected: protected:
PRBool ReportDestroyEvent(); PRBool ReportDestroyEvent();

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

@ -907,8 +907,8 @@ NS_IMETHODIMP nsChildView::Show(PRBool aState)
[mView setHidden:!aState]; [mView setHidden:!aState];
mVisible = aState; mVisible = aState;
if (!mVisible) if (!mVisible && IsPluginView())
HideChildPluginViews(mView); HidePlugin();
} }
return NS_OK; return NS_OK;
@ -1004,14 +1004,9 @@ NS_IMETHODIMP nsChildView::SetFocus(PRBool aRaise)
{ {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
// Don't so anything if we're invisible (if Show(PR_FALSE) has been NSWindow* window = [mView window];
// called on us, or if Show(PR_TRUE) hasn't yet been called). This if (window)
// resolves bug 504450. [window makeFirstResponder:mView];
if (mView && ![mView isHidden]) {
NSWindow* window = [mView window];
if (window)
[window makeFirstResponder:mView];
}
return NS_OK; return NS_OK;
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
@ -1660,18 +1655,23 @@ void nsChildView::ApplyConfiguration(nsIWidget* aExpectedParent,
nsWindowType kidType; nsWindowType kidType;
aConfiguration.mChild->GetWindowType(kidType); aConfiguration.mChild->GetWindowType(kidType);
#endif #endif
NS_ASSERTION(kidType == eWindowType_plugin || kidType == eWindowType_child, NS_ASSERTION(kidType == eWindowType_plugin,
"Configured widget is not a child or plugin type"); "Configured widget is not a plugin type");
NS_ASSERTION(aConfiguration.mChild->GetParent() == aExpectedParent, NS_ASSERTION(aConfiguration.mChild->GetParent() == aExpectedParent,
"Configured widget is not a child of the right widget"); "Configured widget is not a child of the right widget");
aConfiguration.mChild->Resize(
// nsIWidget::Show() doesn't get called on plugin widgets unless we call
// it from here. See bug 592563.
nsChildView* child = static_cast<nsChildView*>(aConfiguration.mChild);
child->Show(!aConfiguration.mClipRegion.IsEmpty());
child->Resize(
aConfiguration.mBounds.x, aConfiguration.mBounds.y, aConfiguration.mBounds.x, aConfiguration.mBounds.y,
aConfiguration.mBounds.width, aConfiguration.mBounds.height, aConfiguration.mBounds.width, aConfiguration.mBounds.height,
aRepaint); aRepaint);
// On Mac we don't use the clip region here, we just store it
// in case GetPluginClipRect needs it. // Store the clip region here in case GetPluginClipRect needs it.
static_cast<nsChildView*>(aConfiguration.mChild)-> child->StoreWindowClipRegion(aConfiguration.mClipRegion);
StoreWindowClipRegion(aConfiguration.mClipRegion);
} }
nsresult nsChildView::ConfigureChildren(const nsTArray<Configuration>& aConfigurations) nsresult nsChildView::ConfigureChildren(const nsTArray<Configuration>& aConfigurations)