Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Change ScreenRotation enum to uint32
This commit also fixes orientation
change notification to the HAL (API change).
  • Loading branch information
rainemak committed Dec 19, 2016
1 parent b79e356 commit 32dbbc8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
25 changes: 15 additions & 10 deletions embedding/embedlite/embedshared/EmbedLiteWindowBaseChild.cpp
Expand Up @@ -85,13 +85,13 @@ bool EmbedLiteWindowBaseChild::RecvSetSize(const gfxSize& aSize)
return true;
}

bool EmbedLiteWindowBaseChild::RecvSetContentOrientation(const mozilla::ScreenRotation& aRotation)
bool EmbedLiteWindowBaseChild::RecvSetContentOrientation(const uint32_t &aRotation)
{
LOGT("this:%p", this);
mRotation = aRotation;
mRotation = static_cast<mozilla::ScreenRotation>(aRotation);
if (mWidget) {
EmbedLitePuppetWidget* widget = static_cast<EmbedLitePuppetWidget*>(mWidget.get());
widget->SetRotation(aRotation);
widget->SetRotation(mRotation);
widget->UpdateSize();
}

Expand All @@ -112,26 +112,31 @@ bool EmbedLiteWindowBaseChild::RecvSetContentOrientation(const mozilla::ScreenRo
screen->GetColorDepth(&colorDepth);
screen->GetPixelDepth(&pixelDepth);

ScreenOrientation orientation = eScreenOrientation_Default;
switch (aRotation) {
mozilla::dom::ScreenOrientationInternal orientation = eScreenOrientation_Default;
uint16_t angle = 0;
switch (mRotation) {
case ROTATION_0:
orientation = eScreenOrientation_PortraitPrimary;
angle = 0;
orientation = mozilla::dom::eScreenOrientation_PortraitPrimary;
break;
case ROTATION_90:
orientation = eScreenOrientation_LandscapePrimary;
angle = 90;
orientation = mozilla::dom::eScreenOrientation_LandscapePrimary;
break;
case ROTATION_180:
orientation = eScreenOrientation_PortraitSecondary;
angle = 180;
orientation = mozilla::dom::eScreenOrientation_PortraitSecondary;
break;
case ROTATION_270:
orientation = eScreenOrientation_LandscapeSecondary;
angle = 270;
orientation = mozilla::dom::eScreenOrientation_LandscapeSecondary;
break;
default:
break;
}

hal::NotifyScreenConfigurationChange(hal::ScreenConfiguration(
rect, orientation, colorDepth, pixelDepth));
rect, orientation, angle, colorDepth, pixelDepth));

return true;
}
Expand Down
2 changes: 1 addition & 1 deletion embedding/embedlite/embedshared/EmbedLiteWindowBaseChild.h
Expand Up @@ -29,7 +29,7 @@ class EmbedLiteWindowBaseChild : public PEmbedLiteWindowChild
virtual void ActorDestroy(ActorDestroyReason aWhy) override;
virtual bool RecvDestroy() override;
virtual bool RecvSetSize(const gfxSize& size) override;
virtual bool RecvSetContentOrientation(const mozilla::ScreenRotation&) override;
virtual bool RecvSetContentOrientation(const uint32_t &) override;

private:
void CreateWidget();
Expand Down
Expand Up @@ -44,7 +44,7 @@ EmbedLiteWindowBaseParent::EmbedLiteWindowBaseParent(const uint16_t& width, cons
, mWindow(nullptr)
, mCompositor(nullptr)
, mSize(width, height)
, mRotation(ROTATION_0)
, mRotation(mozilla::ROTATION_0)
{
MOZ_ASSERT(sWindowMap.find(id) == sWindowMap.end());
sWindowMap[id] = this;
Expand Down
Expand Up @@ -35,7 +35,7 @@ class EmbedLiteWindowBaseParent : public PEmbedLiteWindowParent
EmbedLiteCompositorParent* GetCompositor() const { return mCompositor.get(); }

void SetSize(int width, int height);
void SetContentOrientation(mozilla::ScreenRotation);
void SetContentOrientation(const uint32_t &);
bool ScheduleUpdate();
void SuspendRendering();
void ResumeRendering();
Expand Down

0 comments on commit 32dbbc8

Please sign in to comment.