Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
EmbedLiteWindowBaseChild fixing
  • Loading branch information
rainemak committed Apr 8, 2020
1 parent 95720b8 commit c59c3f4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion embedding/embedlite/embedshared/EmbedLiteViewBaseChild.h
Expand Up @@ -217,7 +217,7 @@ class EmbedLiteViewBaseChild : public PEmbedLiteViewChild,
nsCOMPtr<nsIWebBrowser> mWebBrowser;
nsCOMPtr<nsIIdleServiceInternal> mIdleService;
RefPtr<WebBrowserChrome> mChrome;
nsCOMPtr<nsPIDOMWindow> mDOMWindow;
nsCOMPtr<nsPIDOMWindowOuter> mDOMWindow;
nsCOMPtr<nsIWebNavigation> mWebNavigation;
bool mWindowObserverRegistered;
bool mIsFocused;
Expand Down
20 changes: 11 additions & 9 deletions embedding/embedlite/embedshared/EmbedLiteWindowBaseChild.cpp
Expand Up @@ -5,6 +5,8 @@

#include "EmbedLog.h"

#include <math.h>

#include "EmbedLitePuppetWidget.h"
#include "EmbedLiteWindowBaseChild.h"
#include "mozilla/Unused.h"
Expand Down Expand Up @@ -33,8 +35,8 @@ EmbedLiteWindowBaseChild::EmbedLiteWindowBaseChild(const uint16_t& width, const
{
MOZ_COUNT_CTOR(EmbedLiteWindowBaseChild);

mCreateWidgetTask = NewRunnableMethod(this, &EmbedLiteWindowBaseChild::CreateWidget);
MessageLoop::current()->PostTask(FROM_HERE, mCreateWidgetTask);
mCreateWidgetTask = NewCancelableRunnableMethod(this, &EmbedLiteWindowBaseChild::CreateWidget);
MessageLoop::current()->PostTask(mCreateWidgetTask.forget());
sWindowCount++;

// Make sure gfx platform is initialized and ready to go.
Expand Down Expand Up @@ -77,8 +79,8 @@ bool EmbedLiteWindowBaseChild::RecvDestroy()

bool EmbedLiteWindowBaseChild::RecvSetSize(const gfxSize& aSize)
{
mBounds = LayoutDeviceIntRect(0, 0, aSize.width, aSize.height);
LOGT("this:%p width: %f, height: %f", this, aSize.width, aSize.height);
mBounds = LayoutDeviceIntRect(0, 0, (int)nearbyint(aSize.width), (int)nearbyint(aSize.height));
LOGT("this:%p width: %f, height: %f as int w: %d h: %h", this, aSize.width, aSize.height, (int)nearbyint(aSize.width), (int)nearbyint(aSize.height));
if (mWidget) {
mWidget->Resize(aSize.width, aSize.height, true);
}
Expand Down Expand Up @@ -158,11 +160,11 @@ void EmbedLiteWindowBaseChild::CreateWidget()

// EmbedLitePuppetWidget::CreateCompositor() reads back Size
// when it creates the compositor.
mWidget->Create(
nullptr, 0, // no parents
mBounds,
&widgetInit // HandleWidgetEvent
);
Unused << mWidget->Create(
nullptr, 0, // no parents
mBounds,
&widgetInit // HandleWidgetEvent
);
static_cast<EmbedLitePuppetWidget*>(mWidget.get())->UpdateSize();

Unused << SendInitialized();
Expand Down
3 changes: 2 additions & 1 deletion embedding/embedlite/embedshared/EmbedLiteWindowBaseChild.h
Expand Up @@ -9,6 +9,7 @@
#include "mozilla/embedlite/PEmbedLiteWindowChild.h"
#include "mozilla/WidgetUtils.h"
#include "nsIWidget.h"
#include "base/task.h" // for CancelableRunnable

namespace mozilla {
namespace embedlite {
Expand Down Expand Up @@ -38,7 +39,7 @@ class EmbedLiteWindowBaseChild : public PEmbedLiteWindowChild
nsCOMPtr<nsIWidget> mWidget;
LayoutDeviceIntRect mBounds;
mozilla::ScreenRotation mRotation;
CancelableTask* mCreateWidgetTask;
RefPtr<CancelableRunnable> mCreateWidgetTask;

DISALLOW_EVIL_CONSTRUCTORS(EmbedLiteWindowBaseChild);
};
Expand Down

0 comments on commit c59c3f4

Please sign in to comment.