Skip to content

Commit

Permalink
[embedlite] Add ScrollBy and ScrollTo methods. Contributes to JB#36705
Browse files Browse the repository at this point in the history
  • Loading branch information
rainemak committed Oct 24, 2016
1 parent 45008bd commit 5848cd8
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 0 deletions.
14 changes: 14 additions & 0 deletions embedding/embedlite/EmbedLiteView.cpp
Expand Up @@ -157,6 +157,20 @@ void EmbedLiteView::Reload(bool hard)
unused << mViewParent->SendReload(hard);
}

void EmbedLiteView::ScrollTo(int x, int y)
{
LOGT();
NS_ENSURE_TRUE(mViewParent, );
unused << mViewParent->SendScrollTo(x, y);
}

void EmbedLiteView::ScrollBy(int x, int y)
{
LOGT();
NS_ENSURE_TRUE(mViewParent, );
unused << mViewParent->SendScrollBy(x, y);
}

void
EmbedLiteView::LoadFrameScript(const char* aURI)
{
Expand Down
7 changes: 7 additions & 0 deletions embedding/embedlite/EmbedLiteView.h
Expand Up @@ -83,6 +83,13 @@ class EmbedLiteView
virtual void StopLoad();
virtual void Reload(bool hard);

// Scrolling methods see nsIDomWindow.idl
// Scrolls this view to an absolute pixel offset.
virtual void ScrollTo(int x, int y);
// Scrolls this view to a pixel offset relative to
// the current scroll position.
virtual void ScrollBy(int x, int y);

// Input Interface
virtual void SendTextEvent(const char* composite, const char* preEdit);
virtual void SendKeyPress(int domKeyCode, int gmodifiers, int charCode);
Expand Down
3 changes: 3 additions & 0 deletions embedding/embedlite/PEmbedLiteView.ipdl
Expand Up @@ -57,6 +57,9 @@ child:
int32_t aButton, int32_t aClickCount,
int32_t aModifiers, bool aIgnoreRootScrollFrame);

ScrollTo(int x, int y);
ScrollBy(int x, int y);

InputDataTouchEvent(ScrollableLayerGuid aGuid, MultiTouchInput event, uint64_t aInputBlockId);
// We use a separate message for touchmove events only to apply
// compression to them.
Expand Down
19 changes: 19 additions & 0 deletions embedding/embedlite/embedshared/EmbedLiteViewBaseChild.cpp
Expand Up @@ -498,6 +498,25 @@ EmbedLiteViewBaseChild::RecvReload(const bool& aHardReload)
return true;
}

bool EmbedLiteViewBaseChild::RecvScrollTo(const int &x, const int &y)
{
if (!mDOMWindow) {
return false;
}
mDOMWindow->ScrollTo(x, y);
return true;
}

bool EmbedLiteViewBaseChild::RecvScrollBy(const int &x, const int &y)
{
if (!mDOMWindow) {
return false;
}

mDOMWindow->ScrollBy(x, y);
return true;
}

bool
EmbedLiteViewBaseChild::RecvSetIsActive(const bool& aIsActive)
{
Expand Down
3 changes: 3 additions & 0 deletions embedding/embedlite/embedshared/EmbedLiteViewBaseChild.h
Expand Up @@ -119,6 +119,9 @@ class EmbedLiteViewBaseChild : public PEmbedLiteViewChild,
virtual bool RecvStopLoad() override;
virtual bool RecvReload(const bool&) override;

virtual bool RecvScrollTo(const int &x, const int &y) override;
virtual bool RecvScrollBy(const int &x, const int &y) override;

virtual bool RecvSetIsActive(const bool&) override;
virtual bool RecvSetIsFocused(const bool&) override;
virtual bool RecvSetThrottlePainting(const bool&) override;
Expand Down

0 comments on commit 5848cd8

Please sign in to comment.