Skip to content

Commit

Permalink
[embedlite] Implement RequestFlingSnap. Fixes JB#44042
Browse files Browse the repository at this point in the history
The layout.css.scroll-snap.enabled is enabled by default.
  • Loading branch information
rainemak committed Apr 5, 2019
1 parent 5a21922 commit edf708d
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions embedding/embedlite/PEmbedLiteView.ipdl
Expand Up @@ -53,6 +53,7 @@ child:
HandleSingleTap(CSSPoint aPoint, Modifiers aModifiers, ScrollableLayerGuid aGuid);
HandleLongTap(CSSPoint aPoint, ScrollableLayerGuid aGuid, uint64_t aInputBlockId);
AcknowledgeScrollUpdate(ViewID aScrollId, uint32_t aScrollGeneration);
RequestFlingSnap(ViewID aScrollId, CSSPoint aDestination);
HandleTextEvent(nsString commit, nsString preEdit);
HandleKeyPressEvent(int domKeyCode, int gmodifiers, int charCode);
HandleKeyReleaseEvent(int domKeyCode, int gmodifiers, int charCode);
Expand Down
9 changes: 9 additions & 0 deletions embedding/embedlite/embedshared/EmbedLiteViewBaseChild.cpp
Expand Up @@ -846,6 +846,15 @@ EmbedLiteViewBaseChild::RecvAcknowledgeScrollUpdate(const FrameMetrics::ViewID&
return true;
}

bool
EmbedLiteViewBaseChild::RecvRequestFlingSnap(const FrameMetrics::ViewID& aScrollId,
const CSSPoint& aDestination)
{
LOGT("thread id: %ld", syscall(SYS_gettid));
APZCCallbackHelper::RequestFlingSnap(aScrollId, aDestination);
return true;
}

void
EmbedLiteViewBaseChild::InitEvent(WidgetGUIEvent& event, nsIntPoint* aPoint)
{
Expand Down
1 change: 1 addition & 0 deletions embedding/embedlite/embedshared/EmbedLiteViewBaseChild.h
Expand Up @@ -165,6 +165,7 @@ class EmbedLiteViewBaseChild : public PEmbedLiteViewChild,
const mozilla::layers::ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId) override;
virtual bool RecvAcknowledgeScrollUpdate(const FrameMetrics::ViewID& aScrollId, const uint32_t& aScrollGeneration) override;
virtual bool RecvRequestFlingSnap(const FrameMetrics::ViewID& aScrollId, const CSSPoint& aDestination) override;
virtual bool RecvMouseEvent(const nsString& aType,
const float& aX,
const float& aY,
Expand Down
10 changes: 10 additions & 0 deletions embedding/embedlite/embedthread/EmbedContentController.cpp
Expand Up @@ -41,6 +41,9 @@ void EmbedContentController::RequestContentRepaint(const FrameMetrics& aFrameMet
void EmbedContentController::RequestFlingSnap(const FrameMetrics::ViewID &aScrollId, const mozilla::CSSPoint &aDestination)
{
LOGT();
mUILoop->PostTask(
FROM_HERE,
NewRunnableMethod(this, &EmbedContentController::DoRequestFlingSnap, aScrollId, aDestination));
}

void EmbedContentController::HandleDoubleTap(const CSSPoint& aPoint,
Expand Down Expand Up @@ -127,6 +130,13 @@ void EmbedContentController::DoSendScrollEvent(const FrameMetrics &aFrameMetrics
}
}

void EmbedContentController::DoRequestFlingSnap(const FrameMetrics::ViewID &aScrollId, const mozilla::CSSPoint &aDestination)
{
if (mRenderFrame) {
Unused << mRenderFrame->SendRequestFlingSnap(aScrollId, aDestination);
}
}

void EmbedContentController::DoNotifyAPZStateChange(const mozilla::layers::ScrollableLayerGuid &aGuid, APZStateChange aChange, int aArg)
{
if (mRenderFrame) {
Expand Down
1 change: 1 addition & 0 deletions embedding/embedlite/embedthread/EmbedContentController.h
Expand Up @@ -48,6 +48,7 @@ class EmbedContentController : public mozilla::layers::GeckoContentController
EmbedLiteViewListener* const GetListener() const;
void DoRequestContentRepaint(const FrameMetrics& aFrameMetrics);
void DoSendScrollEvent(const FrameMetrics& aFrameMetrics);
void DoRequestFlingSnap(const FrameMetrics::ViewID &aScrollId, const mozilla::CSSPoint &aDestination);
void DoNotifyAPZStateChange(const mozilla::layers::ScrollableLayerGuid &aGuid, APZStateChange aChange, int aArg);
void DoNotifyFlushComplete();

Expand Down

0 comments on commit edf708d

Please sign in to comment.