Bug 808358 - nsWindow.cpp:388:5: error: expected unqualified-id before if

This commit is contained in:
Oleg Romashin 2012-11-03 21:00:08 -07:00
parent 4388c1b02d
commit c8177f76d7
3 changed files with 60 additions and 9 deletions

View File

@ -77,7 +77,8 @@ MozQWidget::~MozQWidget()
void MozQWidget::paint(QPainter* aPainter, const QStyleOptionGraphicsItem* aOption, QWidget* aWidget /*= 0*/)
{
mReceiver->DoPaint(aPainter, aOption, aWidget);
if (mReceiver)
mReceiver->DoPaint(aPainter, aOption, aWidget);
}
void MozQWidget::activate()
@ -405,7 +406,9 @@ void MozQWidget::closeEvent(QCloseEvent* aEvent)
void MozQWidget::hideEvent(QHideEvent* aEvent)
{
mReceiver->hideEvent(aEvent);
if (mReceiver) {
mReceiver->hideEvent(aEvent);
}
QGraphicsWidget::hideEvent(aEvent);
}

View File

@ -65,6 +65,7 @@ using namespace QtMobility;
#include "mozilla/Services.h"
#include "mozilla/Preferences.h"
#include "mozilla/Likely.h"
#include "LayersTypes.h"
#include "nsIWidgetListener.h"
#include "nsIStringBundle.h"
@ -102,7 +103,9 @@ static Atom sPluginIMEAtom = nullptr;
#endif
#endif //MOZ_X11
#include "gfxUtils.h"
#include "Layers.h"
#include "GLContextProvider.h"
#include "BasicLayers.h"
#include "LayerManagerOGL.h"
#include "nsFastStartupQt.h"
@ -119,6 +122,8 @@ extern "C" {
using namespace mozilla;
using namespace mozilla::widget;
using mozilla::gl::GLContext;
using mozilla::layers::LayerManagerOGL;
// Cached offscreen surface
static nsRefPtr<gfxASurface> gBufferSurface;
@ -379,16 +384,35 @@ nsWindow::Destroy(void)
#endif
}
/** Need to clean our LayerManager up while still alive */
if (mLayerManager) {
nsRefPtr<GLContext> gl = nullptr;
if (mLayerManager->GetBackendType() == mozilla::layers::LAYERS_OPENGL) {
LayerManagerOGL *ogllm = static_cast<LayerManagerOGL*>(mLayerManager.get());
gl = ogllm->gl();
}
mLayerManager->Destroy();
if (gl) {
gl->MarkDestroyed();
}
}
mLayerManager = nullptr;
// It is safe to call DestroyeCompositor several times (here and
// in the parent class) since it will take effect only once.
// The reason we call it here is because on gtk platforms we need
// to destroy the compositor before we destroy the gdk window (which
// destroys the the gl context attached to it).
DestroyCompositor();
ClearCachedResources();
nsIRollupListener* rollupListener = nsBaseWidget::GetActiveRollupListener();
nsCOMPtr<nsIWidget> rollupWidget = rollupListener->GetRollupWidget();
if (static_cast<nsIWidget *>(this) == rollupWidget)
rollupListener->Rollup(0, nullptr);
}
if (mLayerManager) {
mLayerManager->Destroy();
}
mLayerManager = nullptr;
Show(false);
@ -431,6 +455,21 @@ nsWindow::Destroy(void)
return NS_OK;
}
void
nsWindow::ClearCachedResources()
{
if (mLayerManager &&
mLayerManager->GetBackendType() == mozilla::layers::LAYERS_BASIC) {
static_cast<mozilla::layers::BasicLayerManager*> (mLayerManager.get())->
ClearCachedResources();
}
for (nsIWidget* kid = mFirstChild; kid; ) {
nsIWidget* next = kid->GetNextSibling();
static_cast<nsWindow*>(kid)->ClearCachedResources();
kid = next;
}
}
NS_IMETHODIMP
nsWindow::SetParent(nsIWidget *aNewParent)
{
@ -1659,7 +1698,7 @@ nsWindow::OnKeyPressEvent(QKeyEvent *aEvent)
KeySym keysym = aEvent->nativeVirtualKey();
if (keysym) {
domCharCode = (uint32_t) keysym2ucs(keysym);
if (domCharCode == -1 || ! QChar((quint32)domCharCode).isPrint()) {
if (domCharCode == -1 || !QChar((quint32)domCharCode).isPrint()) {
domCharCode = 0;
}
}
@ -2609,6 +2648,7 @@ nsWindow::createQWidget(MozQWidget *parent,
MozQWidget * widget = new MozQWidget(this, parentQWidget);
if (!widget)
return nullptr;
widget->setObjectName(QString(windowName));
// make only child and plugin windows focusable
if (eWindowType_child == mWindowType || eWindowType_plugin == mWindowType) {
@ -2857,6 +2897,13 @@ NS_IMETHODIMP
nsWindow::Show(bool aState)
{
LOG(("nsWindow::Show [%p] state %d\n", (void *)this, aState));
if (aState == mIsShown)
return NS_OK;
// Clear our cached resources when the window is hidden.
if (mIsShown && !aState) {
ClearCachedResources();
}
mIsShown = aState;

View File

@ -316,6 +316,7 @@ private:
nsNativeWidget nativeParent,
nsWidgetInitData* aInitData);
void SetSoftwareKeyboardState(bool aOpen, const InputContextAction& aAction);
void ClearCachedResources();
MozQWidget* mWidget;