Backout changeset 5ca278d8c1af (Bug 1433671) for not handling all callers in all platforms. r=backout

This reverts commit 795018bb21eb9fa906128d0a15cf773643878585.
This commit is contained in:
Emilio Cobos Álvarez 2018-01-30 12:17:04 +01:00
parent b0b4e4a39a
commit 1528ebee1c
7 changed files with 121 additions and 209 deletions

View File

@ -44,10 +44,9 @@ class AccessibleCaretEventHub::NoActionState
public:
const char* Name() const override { return "NoActionState"; }
MOZ_CAN_RUN_SCRIPT nsEventStatus OnPress(AccessibleCaretEventHub* aContext,
const nsPoint& aPoint,
int32_t aTouchId,
EventClassID aEventClass) override
nsEventStatus OnPress(AccessibleCaretEventHub* aContext,
const nsPoint& aPoint, int32_t aTouchId,
EventClassID aEventClass) override
{
nsEventStatus rv = nsEventStatus_eIgnore;
@ -64,34 +63,31 @@ public:
return rv;
}
MOZ_CAN_RUN_SCRIPT void OnScrollStart(
AccessibleCaretEventHub* aContext) override
void OnScrollStart(AccessibleCaretEventHub* aContext) override
{
aContext->mManager->OnScrollStart();
aContext->SetState(aContext->ScrollState());
}
MOZ_CAN_RUN_SCRIPT void OnScrollPositionChanged(
AccessibleCaretEventHub* aContext) override
void OnScrollPositionChanged(AccessibleCaretEventHub* aContext) override
{
aContext->mManager->OnScrollPositionChanged();
}
MOZ_CAN_RUN_SCRIPT void OnSelectionChanged(AccessibleCaretEventHub* aContext,
nsIDOMDocument* aDoc,
nsISelection* aSel,
int16_t aReason) override
void OnSelectionChanged(AccessibleCaretEventHub* aContext,
nsIDOMDocument* aDoc, nsISelection* aSel,
int16_t aReason) override
{
aContext->mManager->OnSelectionChanged(aDoc, aSel, aReason);
}
MOZ_CAN_RUN_SCRIPT void OnBlur(AccessibleCaretEventHub* aContext,
bool aIsLeavingDocument) override
void OnBlur(AccessibleCaretEventHub* aContext,
bool aIsLeavingDocument) override
{
aContext->mManager->OnBlur();
}
MOZ_CAN_RUN_SCRIPT void OnReflow(AccessibleCaretEventHub* aContext) override
void OnReflow(AccessibleCaretEventHub* aContext) override
{
aContext->mManager->OnReflow();
}
@ -112,8 +108,8 @@ class AccessibleCaretEventHub::PressCaretState
public:
const char* Name() const override { return "PressCaretState"; }
MOZ_CAN_RUN_SCRIPT nsEventStatus OnMove(AccessibleCaretEventHub* aContext,
const nsPoint& aPoint) override
nsEventStatus OnMove(AccessibleCaretEventHub* aContext,
const nsPoint& aPoint) override
{
if (aContext->MoveDistanceIsLarge(aPoint)) {
if (NS_SUCCEEDED(aContext->mManager->DragCaret(aPoint))) {
@ -124,8 +120,7 @@ public:
return nsEventStatus_eConsumeNoDefault;
}
MOZ_CAN_RUN_SCRIPT nsEventStatus
OnRelease(AccessibleCaretEventHub* aContext) override
nsEventStatus OnRelease(AccessibleCaretEventHub* aContext) override
{
aContext->mManager->ReleaseCaret();
aContext->mManager->TapCaret(aContext->mPressPoint);
@ -150,16 +145,15 @@ class AccessibleCaretEventHub::DragCaretState
public:
const char* Name() const override { return "DragCaretState"; }
MOZ_CAN_RUN_SCRIPT nsEventStatus OnMove(AccessibleCaretEventHub* aContext,
const nsPoint& aPoint) override
nsEventStatus OnMove(AccessibleCaretEventHub* aContext,
const nsPoint& aPoint) override
{
aContext->mManager->DragCaret(aPoint);
return nsEventStatus_eConsumeNoDefault;
}
MOZ_CAN_RUN_SCRIPT nsEventStatus
OnRelease(AccessibleCaretEventHub* aContext) override
nsEventStatus OnRelease(AccessibleCaretEventHub* aContext) override
{
aContext->mManager->ReleaseCaret();
aContext->SetState(aContext->NoActionState());
@ -194,23 +188,22 @@ public:
return nsEventStatus_eIgnore;
}
MOZ_CAN_RUN_SCRIPT nsEventStatus OnLongTap(AccessibleCaretEventHub* aContext,
const nsPoint& aPoint) override
nsEventStatus OnLongTap(AccessibleCaretEventHub* aContext,
const nsPoint& aPoint) override
{
aContext->SetState(aContext->LongTapState());
return aContext->GetState()->OnLongTap(aContext, aPoint);
}
MOZ_CAN_RUN_SCRIPT void OnScrollStart(
AccessibleCaretEventHub* aContext) override
void OnScrollStart(AccessibleCaretEventHub* aContext) override
{
aContext->mManager->OnScrollStart();
aContext->SetState(aContext->ScrollState());
}
MOZ_CAN_RUN_SCRIPT void OnBlur(AccessibleCaretEventHub* aContext,
bool aIsLeavingDocument) override
void OnBlur(AccessibleCaretEventHub* aContext,
bool aIsLeavingDocument) override
{
aContext->mManager->OnBlur();
if (aIsLeavingDocument) {
@ -218,15 +211,14 @@ public:
}
}
MOZ_CAN_RUN_SCRIPT void OnSelectionChanged(AccessibleCaretEventHub* aContext,
nsIDOMDocument* aDoc,
nsISelection* aSel,
int16_t aReason) override
void OnSelectionChanged(AccessibleCaretEventHub* aContext,
nsIDOMDocument* aDoc, nsISelection* aSel,
int16_t aReason) override
{
aContext->mManager->OnSelectionChanged(aDoc, aSel, aReason);
}
MOZ_CAN_RUN_SCRIPT void OnReflow(AccessibleCaretEventHub* aContext) override
void OnReflow(AccessibleCaretEventHub* aContext) override
{
aContext->mManager->OnReflow();
}
@ -256,14 +248,13 @@ public:
aContext->SetState(aContext->PostScrollState());
}
MOZ_CAN_RUN_SCRIPT void OnScrollPositionChanged(
AccessibleCaretEventHub* aContext) override
void OnScrollPositionChanged(AccessibleCaretEventHub* aContext) override
{
aContext->mManager->OnScrollPositionChanged();
}
MOZ_CAN_RUN_SCRIPT void OnBlur(AccessibleCaretEventHub* aContext,
bool aIsLeavingDocument) override
void OnBlur(AccessibleCaretEventHub* aContext,
bool aIsLeavingDocument) override
{
aContext->mManager->OnBlur();
if (aIsLeavingDocument) {
@ -282,10 +273,9 @@ class AccessibleCaretEventHub::PostScrollState
public:
const char* Name() const override { return "PostScrollState"; }
MOZ_CAN_RUN_SCRIPT nsEventStatus OnPress(AccessibleCaretEventHub* aContext,
const nsPoint& aPoint,
int32_t aTouchId,
EventClassID aEventClass) override
nsEventStatus OnPress(AccessibleCaretEventHub* aContext,
const nsPoint& aPoint, int32_t aTouchId,
EventClassID aEventClass) override
{
aContext->mManager->OnScrollEnd();
aContext->SetState(aContext->NoActionState());
@ -294,21 +284,19 @@ public:
aEventClass);
}
MOZ_CAN_RUN_SCRIPT void OnScrollStart(
AccessibleCaretEventHub* aContext) override
void OnScrollStart(AccessibleCaretEventHub* aContext) override
{
aContext->SetState(aContext->ScrollState());
}
MOZ_CAN_RUN_SCRIPT void OnScrollEnd(
AccessibleCaretEventHub* aContext) override
void OnScrollEnd(AccessibleCaretEventHub* aContext) override
{
aContext->mManager->OnScrollEnd();
aContext->SetState(aContext->NoActionState());
}
MOZ_CAN_RUN_SCRIPT void OnBlur(AccessibleCaretEventHub* aContext,
bool aIsLeavingDocument) override
void OnBlur(AccessibleCaretEventHub* aContext,
bool aIsLeavingDocument) override
{
aContext->mManager->OnBlur();
if (aIsLeavingDocument) {
@ -337,8 +325,8 @@ class AccessibleCaretEventHub::LongTapState
public:
const char* Name() const override { return "LongTapState"; }
MOZ_CAN_RUN_SCRIPT nsEventStatus OnLongTap(AccessibleCaretEventHub* aContext,
const nsPoint& aPoint) override
nsEventStatus OnLongTap(AccessibleCaretEventHub* aContext,
const nsPoint& aPoint) override
{
// In general text selection is lower-priority than the context menu. If
// we consume this long-press event, then it prevents the context menu from
@ -357,14 +345,13 @@ public:
return nsEventStatus_eIgnore;
}
MOZ_CAN_RUN_SCRIPT void OnScrollStart(
AccessibleCaretEventHub* aContext) override
void OnScrollStart(AccessibleCaretEventHub* aContext) override
{
aContext->mManager->OnScrollStart();
aContext->SetState(aContext->ScrollState());
}
MOZ_CAN_RUN_SCRIPT void OnReflow(AccessibleCaretEventHub* aContext) override
void OnReflow(AccessibleCaretEventHub* aContext) override
{
aContext->mManager->OnReflow();
}

View File

@ -60,39 +60,29 @@ class WidgetTouchEvent;
// Please see the wiki page for more information.
// https://wiki.mozilla.org/AccessibleCaret
//
class AccessibleCaretEventHub
: public nsIReflowObserver
, public nsIScrollObserver
, public nsISelectionListener
, public nsSupportsWeakReference
class AccessibleCaretEventHub : public nsIReflowObserver,
public nsIScrollObserver,
public nsISelectionListener,
public nsSupportsWeakReference
{
public:
explicit AccessibleCaretEventHub(nsIPresShell* aPresShell);
void Init();
void Terminate();
MOZ_CAN_RUN_SCRIPT nsEventStatus HandleEvent(WidgetEvent* aEvent);
nsEventStatus HandleEvent(WidgetEvent* aEvent);
// Call this function to notify the blur event happened.
MOZ_CAN_RUN_SCRIPT void NotifyBlur(bool aIsLeavingDocument);
void NotifyBlur(bool aIsLeavingDocument);
NS_DECL_ISUPPORTS
// nsIReflowObserver
MOZ_CAN_RUN_SCRIPT NS_IMETHOD Reflow(DOMHighResTimeStamp start,
DOMHighResTimeStamp end) final;
MOZ_CAN_RUN_SCRIPT NS_IMETHOD
ReflowInterruptible(DOMHighResTimeStamp start, DOMHighResTimeStamp end) final;
// nsISelectionListener
MOZ_CAN_RUN_SCRIPT NS_IMETHOD NotifySelectionChanged(nsIDOMDocument* doc,
nsISelection* sel,
int16_t reason) final;
NS_DECL_NSIREFLOWOBSERVER
NS_DECL_NSISELECTIONLISTENER
// Override nsIScrollObserver methods.
MOZ_CAN_RUN_SCRIPT virtual void ScrollPositionChanged() override;
MOZ_CAN_RUN_SCRIPT virtual void AsyncPanZoomStarted() override;
MOZ_CAN_RUN_SCRIPT virtual void AsyncPanZoomStopped() override;
virtual void ScrollPositionChanged() override;
virtual void AsyncPanZoomStarted() override;
virtual void AsyncPanZoomStopped() override;
// Base state
class State;
@ -123,10 +113,9 @@ protected:
void SetState(State* aState);
MOZ_CAN_RUN_SCRIPT nsEventStatus HandleMouseEvent(WidgetMouseEvent* aEvent);
MOZ_CAN_RUN_SCRIPT nsEventStatus HandleTouchEvent(WidgetTouchEvent* aEvent);
MOZ_CAN_RUN_SCRIPT nsEventStatus
HandleKeyboardEvent(WidgetKeyboardEvent* aEvent);
nsEventStatus HandleMouseEvent(WidgetMouseEvent* aEvent);
nsEventStatus HandleTouchEvent(WidgetTouchEvent* aEvent);
nsEventStatus HandleKeyboardEvent(WidgetKeyboardEvent* aEvent);
virtual nsPoint GetTouchEventPosition(WidgetTouchEvent* aEvent,
int32_t aIdentifier) const;
@ -136,25 +125,11 @@ protected:
void LaunchLongTapInjector();
void CancelLongTapInjector();
static void FireLongTap(nsITimer* aTimer, void* aAccessibleCaretEventHub);
void LaunchScrollEndInjector();
void CancelScrollEndInjector();
// This is a MOZ_CAN_RUN_SCRIPT_BOUNDARY because it fires from a timer.
//
// The `aAccessibleCaretEventHub` parameter is guaranteed to remain alive
// because we take a strong ref to it from inside the function.
MOZ_CAN_RUN_SCRIPT_BOUNDARY static void FireLongTap(
nsITimer* aTimer,
void* aAccessibleCaretEventHub);
// This is a MOZ_CAN_RUN_SCRIPT_BOUNDARY because it fires from a timer.
//
// The `aAccessibleCaretEventHub` parameter is guaranteed to remain alive
// because we take a strong ref to it from inside the function.
MOZ_CAN_RUN_SCRIPT_BOUNDARY static void FireScrollEnd(
nsITimer* aTimer,
void* aAccessibleCaretEventHub);
static void FireScrollEnd(nsITimer* aTimer, void* aAccessibleCaretEventHub);
// Member variables
State* mState = NoActionState();

View File

@ -547,14 +547,18 @@ AccessibleCaretManager::TapCaret(const nsPoint& aPoint)
nsresult
AccessibleCaretManager::SelectWordOrShortcut(const nsPoint& aPoint)
{
auto UpdateCaretsWithHapticFeedback = [this] {
UpdateCarets();
ProvideHapticFeedback();
};
// If the long-tap is landing on a pre-existing selection, don't replace
// it with a new one. Instead just return and let the context menu pop up
// on the pre-existing selection.
if (GetCaretMode() == CaretMode::Selection &&
GetSelection()->ContainsPoint(aPoint)) {
AC_LOG("%s: UpdateCarets() for current selection", __FUNCTION__);
UpdateCarets();
ProvideHapticFeedback();
UpdateCaretsWithHapticFeedback();
return NS_OK;
}
@ -602,8 +606,7 @@ AccessibleCaretManager::SelectWordOrShortcut(const nsPoint& aPoint)
}
// We need to update carets to get correct information before dispatching
// CaretStateChangedEvent.
UpdateCarets();
ProvideHapticFeedback();
UpdateCaretsWithHapticFeedback();
DispatchCaretStateChangedEvent(CaretChangedReason::Longpressonemptycontent);
return NS_OK;
}
@ -637,8 +640,7 @@ AccessibleCaretManager::SelectWordOrShortcut(const nsPoint& aPoint)
// Then try select a word under point.
nsresult rv = SelectWord(ptFrame, ptInFrame);
UpdateCarets();
ProvideHapticFeedback();
UpdateCaretsWithHapticFeedback();
return rv;
}

View File

@ -59,47 +59,45 @@ public:
// Press caret on the given point. Return NS_OK if the point is actually on
// one of the carets.
MOZ_CAN_RUN_SCRIPT virtual nsresult PressCaret(const nsPoint& aPoint,
EventClassID aEventClass);
virtual nsresult PressCaret(const nsPoint& aPoint, EventClassID aEventClass);
// Drag caret to the given point. It's required to call PressCaret()
// beforehand.
MOZ_CAN_RUN_SCRIPT virtual nsresult DragCaret(const nsPoint& aPoint);
virtual nsresult DragCaret(const nsPoint& aPoint);
// Release caret from he previous press action. It's required to call
// PressCaret() beforehand.
MOZ_CAN_RUN_SCRIPT virtual nsresult ReleaseCaret();
virtual nsresult ReleaseCaret();
// A quick single tap on caret on given point without dragging.
MOZ_CAN_RUN_SCRIPT virtual nsresult TapCaret(const nsPoint& aPoint);
virtual nsresult TapCaret(const nsPoint& aPoint);
// Select a word or bring up paste shortcut (if Gaia is listening) under the
// given point.
MOZ_CAN_RUN_SCRIPT virtual nsresult SelectWordOrShortcut(
const nsPoint& aPoint);
virtual nsresult SelectWordOrShortcut(const nsPoint& aPoint);
// Handle scroll-start event.
MOZ_CAN_RUN_SCRIPT virtual void OnScrollStart();
virtual void OnScrollStart();
// Handle scroll-end event.
MOZ_CAN_RUN_SCRIPT virtual void OnScrollEnd();
virtual void OnScrollEnd();
// Handle ScrollPositionChanged from nsIScrollObserver. This might be called
// at anytime, not necessary between OnScrollStart and OnScrollEnd.
MOZ_CAN_RUN_SCRIPT virtual void OnScrollPositionChanged();
virtual void OnScrollPositionChanged();
// Handle reflow event from nsIReflowObserver.
MOZ_CAN_RUN_SCRIPT virtual void OnReflow();
virtual void OnReflow();
// Handle blur event from nsFocusManager.
MOZ_CAN_RUN_SCRIPT virtual void OnBlur();
virtual void OnBlur();
// Handle NotifySelectionChanged event from nsISelectionListener.
MOZ_CAN_RUN_SCRIPT virtual nsresult OnSelectionChanged(nsIDOMDocument* aDoc,
nsISelection* aSel,
int16_t aReason);
virtual nsresult OnSelectionChanged(nsIDOMDocument* aDoc,
nsISelection* aSel,
int16_t aReason);
// Handle key event.
MOZ_CAN_RUN_SCRIPT virtual void OnKeyboardEvent();
virtual void OnKeyboardEvent();
// The canvas frame holding the accessible caret anonymous content elements
// was reconstructed, resulting in the content elements getting cloned.
@ -147,16 +145,13 @@ protected:
// Update carets based on current selection status. This function will flush
// layout, so caller must ensure the PresShell is still valid after calling
// this method.
MOZ_CAN_RUN_SCRIPT void UpdateCarets(
const UpdateCaretsHintSet& aHints = UpdateCaretsHint::Default);
void UpdateCarets(const UpdateCaretsHintSet& aHints = UpdateCaretsHint::Default);
// Force hiding all carets regardless of the current selection status.
MOZ_CAN_RUN_SCRIPT void HideCarets();
void HideCarets();
MOZ_CAN_RUN_SCRIPT void UpdateCaretsForCursorMode(
const UpdateCaretsHintSet& aHints);
MOZ_CAN_RUN_SCRIPT void UpdateCaretsForSelectionMode(
const UpdateCaretsHintSet& aHints);
void UpdateCaretsForCursorMode(const UpdateCaretsHintSet& aHints);
void UpdateCaretsForSelectionMode(const UpdateCaretsHintSet& aHints);
// Provide haptic / touch feedback, primarily for select on longpress.
void ProvideHapticFeedback();
@ -210,7 +205,7 @@ protected:
// See the mRefCnt assertions in AccessibleCaretEventHub.
//
// Returns whether mPresShell we're holding is still valid.
MOZ_MUST_USE MOZ_CAN_RUN_SCRIPT bool FlushLayout();
MOZ_MUST_USE bool FlushLayout();
dom::Element* GetEditingHostForFrame(nsIFrame* aFrame) const;
dom::Selection* GetSelection() const;
@ -266,8 +261,7 @@ protected:
// This function will flush layout, so caller must ensure the PresShell is
// still valid after calling this method.
MOZ_CAN_RUN_SCRIPT virtual void DispatchCaretStateChangedEvent(
dom::CaretChangedReason aReason);
virtual void DispatchCaretStateChangedEvent(dom::CaretChangedReason aReason);
// ---------------------------------------------------------------------------
// Member variables

View File

@ -231,11 +231,10 @@ public:
virtual void Paint(nsView* aViewToPaint, const nsRegion& aDirtyRegion,
uint32_t aFlags) override;
MOZ_CAN_RUN_SCRIPT virtual nsresult HandleEvent(
nsIFrame* aFrame,
mozilla::WidgetGUIEvent* aEvent,
bool aDontRetargetEvents,
nsEventStatus* aEventStatus) override;
virtual nsresult HandleEvent(nsIFrame* aFrame,
mozilla::WidgetGUIEvent* aEvent,
bool aDontRetargetEvents,
nsEventStatus* aEventStatus) override;
virtual nsresult HandleDOMEventWithTarget(
nsIContent* aTargetContent,
mozilla::WidgetEvent* aEvent,
@ -676,9 +675,8 @@ protected:
already_AddRefed<nsIPresShell> GetParentPresShellForEventHandling();
nsIContent* GetCurrentEventContent();
nsIFrame* GetCurrentEventFrame();
MOZ_CAN_RUN_SCRIPT nsresult
RetargetEventToParent(mozilla::WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus);
nsresult RetargetEventToParent(mozilla::WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus);
void PushCurrentEventInfo(nsIFrame* aFrame, nsIContent* aContent);
void PopCurrentEventInfo();
/**

View File

@ -196,9 +196,6 @@ public:
return Move(event);
}
MOZ_CAN_RUN_SCRIPT_BOUNDARY void TestAsyncPanZoomScroll();
MOZ_CAN_RUN_SCRIPT_BOUNDARY
void HandleEventAndCheckState(UniquePtr<WidgetEvent> aEvent,
MockAccessibleCaretEventHub::State* aExpectedState,
nsEventStatus aExpectedEventStatus)
@ -213,48 +210,40 @@ public:
EXPECT_EQ(mHub->GetState(), aExpectedState);
}
template<typename PressEventCreator, typename ReleaseEventCreator>
MOZ_CAN_RUN_SCRIPT_BOUNDARY void TestPressReleaseOnNoCaret(
template <typename PressEventCreator, typename ReleaseEventCreator>
void TestPressReleaseOnNoCaret(PressEventCreator aPressEventCreator,
ReleaseEventCreator aReleaseEventCreator);
template <typename PressEventCreator, typename ReleaseEventCreator>
void TestPressReleaseOnCaret(PressEventCreator aPressEventCreator,
ReleaseEventCreator aReleaseEventCreator);
template <typename PressEventCreator, typename MoveEventCreator,
typename ReleaseEventCreator>
void TestPressMoveReleaseOnNoCaret(PressEventCreator aPressEventCreator,
MoveEventCreator aMoveEventCreator,
ReleaseEventCreator aReleaseEventCreator);
template <typename PressEventCreator, typename MoveEventCreator,
typename ReleaseEventCreator>
void TestPressMoveReleaseOnCaret(PressEventCreator aPressEventCreator,
MoveEventCreator aMoveEventCreator,
ReleaseEventCreator aReleaseEventCreator);
template <typename PressEventCreator, typename ReleaseEventCreator>
void TestLongTapWithSelectWordSuccessful(
PressEventCreator aPressEventCreator,
ReleaseEventCreator aReleaseEventCreator);
template<typename PressEventCreator, typename ReleaseEventCreator>
MOZ_CAN_RUN_SCRIPT_BOUNDARY void TestPressReleaseOnCaret(
template <typename PressEventCreator, typename ReleaseEventCreator>
void TestLongTapWithSelectWordFailed(
PressEventCreator aPressEventCreator,
ReleaseEventCreator aReleaseEventCreator);
template<typename PressEventCreator,
typename MoveEventCreator,
typename ReleaseEventCreator>
MOZ_CAN_RUN_SCRIPT_BOUNDARY void TestPressMoveReleaseOnNoCaret(
PressEventCreator aPressEventCreator,
MoveEventCreator aMoveEventCreator,
ReleaseEventCreator aReleaseEventCreator);
template<typename PressEventCreator,
typename MoveEventCreator,
typename ReleaseEventCreator>
MOZ_CAN_RUN_SCRIPT_BOUNDARY void TestPressMoveReleaseOnCaret(
PressEventCreator aPressEventCreator,
MoveEventCreator aMoveEventCreator,
ReleaseEventCreator aReleaseEventCreator);
template<typename PressEventCreator, typename ReleaseEventCreator>
MOZ_CAN_RUN_SCRIPT_BOUNDARY void TestLongTapWithSelectWordSuccessful(
PressEventCreator aPressEventCreator,
ReleaseEventCreator aReleaseEventCreator);
template<typename PressEventCreator, typename ReleaseEventCreator>
MOZ_CAN_RUN_SCRIPT_BOUNDARY void TestLongTapWithSelectWordFailed(
PressEventCreator aPressEventCreator,
ReleaseEventCreator aReleaseEventCreator);
template<typename PressEventCreator,
typename MoveEventCreator,
typename ReleaseEventCreator>
MOZ_CAN_RUN_SCRIPT_BOUNDARY void TestEventDrivenAsyncPanZoomScroll(
PressEventCreator aPressEventCreator,
MoveEventCreator aMoveEventCreator,
template <typename PressEventCreator, typename MoveEventCreator,
typename ReleaseEventCreator>
void TestEventDrivenAsyncPanZoomScroll(
PressEventCreator aPressEventCreator, MoveEventCreator aMoveEventCreator,
ReleaseEventCreator aReleaseEventCreator);
// Member variables
@ -263,13 +252,11 @@ public:
}; // class AccessibleCaretEventHubTester
TEST_F(AccessibleCaretEventHubTester, TestMousePressReleaseOnNoCaret)
MOZ_CAN_RUN_SCRIPT
{
TestPressReleaseOnNoCaret(CreateMousePressEvent, CreateMouseReleaseEvent);
}
TEST_F(AccessibleCaretEventHubTester, TestTouchPressReleaseOnNoCaret)
MOZ_CAN_RUN_SCRIPT
{
TestPressReleaseOnNoCaret(CreateTouchStartEvent, CreateTouchEndEvent);
}
@ -297,13 +284,11 @@ AccessibleCaretEventHubTester::TestPressReleaseOnNoCaret(
}
TEST_F(AccessibleCaretEventHubTester, TestMousePressReleaseOnCaret)
MOZ_CAN_RUN_SCRIPT
{
TestPressReleaseOnCaret(CreateMousePressEvent, CreateMouseReleaseEvent);
}
TEST_F(AccessibleCaretEventHubTester, TestTouchPressReleaseOnCaret)
MOZ_CAN_RUN_SCRIPT
{
TestPressReleaseOnCaret(CreateTouchStartEvent, CreateTouchEndEvent);
}
@ -341,14 +326,12 @@ AccessibleCaretEventHubTester::TestPressReleaseOnCaret(
}
TEST_F(AccessibleCaretEventHubTester, TestMousePressMoveReleaseOnNoCaret)
MOZ_CAN_RUN_SCRIPT
{
TestPressMoveReleaseOnNoCaret(CreateMousePressEvent, CreateMouseMoveEvent,
CreateMouseReleaseEvent);
}
TEST_F(AccessibleCaretEventHubTester, TestTouchPressMoveReleaseOnNoCaret)
MOZ_CAN_RUN_SCRIPT
{
TestPressMoveReleaseOnNoCaret(CreateTouchStartEvent, CreateTouchMoveEvent,
CreateTouchEndEvent);
@ -397,14 +380,12 @@ AccessibleCaretEventHubTester::TestPressMoveReleaseOnNoCaret(
}
TEST_F(AccessibleCaretEventHubTester, TestMousePressMoveReleaseOnCaret)
MOZ_CAN_RUN_SCRIPT
{
TestPressMoveReleaseOnCaret(CreateMousePressEvent, CreateMouseMoveEvent,
CreateMouseReleaseEvent);
}
TEST_F(AccessibleCaretEventHubTester, TestTouchPressMoveReleaseOnCaret)
MOZ_CAN_RUN_SCRIPT
{
TestPressMoveReleaseOnCaret(CreateTouchStartEvent, CreateTouchMoveEvent,
CreateTouchEndEvent);
@ -466,7 +447,6 @@ AccessibleCaretEventHubTester::TestPressMoveReleaseOnCaret(
TEST_F(AccessibleCaretEventHubTester,
TestTouchStartMoveEndOnCaretWithTouchCancelIgnored)
MOZ_CAN_RUN_SCRIPT
{
nscoord x0 = 0, y0 = 0;
nscoord x1 = 100, y1 = 100;
@ -525,14 +505,12 @@ MOZ_CAN_RUN_SCRIPT
nsEventStatus_eIgnore);}
TEST_F(AccessibleCaretEventHubTester, TestMouseLongTapWithSelectWordSuccessful)
MOZ_CAN_RUN_SCRIPT
{
TestLongTapWithSelectWordSuccessful(CreateMousePressEvent,
CreateMouseReleaseEvent);
}
TEST_F(AccessibleCaretEventHubTester, TestTouchLongTapWithSelectWordSuccessful)
MOZ_CAN_RUN_SCRIPT
{
TestLongTapWithSelectWordSuccessful(CreateTouchStartEvent,
CreateTouchEndEvent);
@ -611,14 +589,12 @@ AccessibleCaretEventHubTester::TestLongTapWithSelectWordSuccessful(
}
TEST_F(AccessibleCaretEventHubTester, TestMouseLongTapWithSelectWordFailed)
MOZ_CAN_RUN_SCRIPT
{
TestLongTapWithSelectWordFailed(CreateMousePressEvent,
CreateMouseReleaseEvent);
}
TEST_F(AccessibleCaretEventHubTester, TestTouchLongTapWithSelectWordFailed)
MOZ_CAN_RUN_SCRIPT
{
TestLongTapWithSelectWordFailed(CreateTouchStartEvent,
CreateTouchEndEvent);
@ -654,14 +630,12 @@ AccessibleCaretEventHubTester::TestLongTapWithSelectWordFailed(
}
TEST_F(AccessibleCaretEventHubTester, TestTouchEventDrivenAsyncPanZoomScroll)
MOZ_CAN_RUN_SCRIPT
{
TestEventDrivenAsyncPanZoomScroll(CreateTouchStartEvent, CreateTouchMoveEvent,
CreateTouchEndEvent);
}
TEST_F(AccessibleCaretEventHubTester, TestMouseEventDrivenAsyncPanZoomScroll)
MOZ_CAN_RUN_SCRIPT
{
TestEventDrivenAsyncPanZoomScroll(CreateMousePressEvent, CreateMouseMoveEvent,
CreateMouseReleaseEvent);
@ -764,13 +738,7 @@ AccessibleCaretEventHubTester::TestEventDrivenAsyncPanZoomScroll(
EXPECT_EQ(mHub->GetState(), MockAccessibleCaretEventHub::NoActionState());
}
TEST_F(AccessibleCaretEventHubTester, TestAsyncPanZoomScroll) MOZ_CAN_RUN_SCRIPT
{
TestAsyncPanZoomScroll();
}
void
AccessibleCaretEventHubTester::TestAsyncPanZoomScroll()
TEST_F(AccessibleCaretEventHubTester, TestAsyncPanZoomScroll)
{
MockFunction<void(::std::string aCheckPointName)> check;
{
@ -814,7 +782,6 @@ AccessibleCaretEventHubTester::TestAsyncPanZoomScroll()
}
TEST_F(AccessibleCaretEventHubTester, TestAsyncPanZoomScrollStartedThenBlur)
MOZ_CAN_RUN_SCRIPT
{
{
InSequence dummy;
@ -835,7 +802,6 @@ MOZ_CAN_RUN_SCRIPT
}
TEST_F(AccessibleCaretEventHubTester, TestAsyncPanZoomScrollEndedThenBlur)
MOZ_CAN_RUN_SCRIPT
{
{
InSequence dummy;

View File

@ -146,7 +146,6 @@ public:
}; // class AccessibleCaretManagerTester
TEST_F(AccessibleCaretManagerTester, TestUpdatesInSelectionMode)
MOZ_CAN_RUN_SCRIPT
{
EXPECT_CALL(mManager, GetCaretMode())
.WillRepeatedly(Return(CaretMode::Selection));
@ -168,7 +167,6 @@ MOZ_CAN_RUN_SCRIPT
}
TEST_F(AccessibleCaretManagerTester, TestSingleTapOnNonEmptyInput)
MOZ_CAN_RUN_SCRIPT
{
EXPECT_CALL(mManager, GetCaretMode())
.WillRepeatedly(Return(CaretMode::Cursor));
@ -239,7 +237,6 @@ MOZ_CAN_RUN_SCRIPT
}
TEST_F(AccessibleCaretManagerTester, TestSingleTapOnEmptyInput)
MOZ_CAN_RUN_SCRIPT
{
EXPECT_CALL(mManager, GetCaretMode())
.WillRepeatedly(Return(CaretMode::Cursor));
@ -309,7 +306,7 @@ MOZ_CAN_RUN_SCRIPT
EXPECT_EQ(FirstCaretAppearance(), Appearance::NormalNotShown);
}
TEST_F(AccessibleCaretManagerTester, TestTypingAtEndOfInput) MOZ_CAN_RUN_SCRIPT
TEST_F(AccessibleCaretManagerTester, TestTypingAtEndOfInput)
{
EXPECT_CALL(mManager, GetCaretMode())
.WillRepeatedly(Return(CaretMode::Cursor));
@ -352,7 +349,6 @@ TEST_F(AccessibleCaretManagerTester, TestTypingAtEndOfInput) MOZ_CAN_RUN_SCRIPT
}
TEST_F(AccessibleCaretManagerTester, TestScrollInSelectionMode)
MOZ_CAN_RUN_SCRIPT
{
// Simulate caret hiding when scrolling.
AutoRestore<bool> savesCaretsAlwaysShowWhenScrolling(
@ -431,9 +427,7 @@ MOZ_CAN_RUN_SCRIPT
check.Call("scrollend2");
}
TEST_F(AccessibleCaretManagerTester,
TestScrollInSelectionModeWithAlwaysTiltPref)
MOZ_CAN_RUN_SCRIPT
TEST_F(AccessibleCaretManagerTester, TestScrollInSelectionModeWithAlwaysTiltPref)
{
// Simulate Firefox Android preference.
AutoRestore<bool> saveCaretsAlwaysTilt(
@ -539,7 +533,6 @@ MOZ_CAN_RUN_SCRIPT
}
TEST_F(AccessibleCaretManagerTester, TestScrollInCursorModeWhenLogicallyVisible)
MOZ_CAN_RUN_SCRIPT
{
// Simulate caret hiding when scrolling.
AutoRestore<bool> savesCaretsAlwaysShowWhenScrolling(
@ -605,7 +598,6 @@ MOZ_CAN_RUN_SCRIPT
}
TEST_F(AccessibleCaretManagerTester, TestScrollInCursorModeWhenHidden)
MOZ_CAN_RUN_SCRIPT
{
// Simulate caret hiding when scrolling.
AutoRestore<bool> savesCaretsAlwaysShowWhenScrolling(
@ -665,7 +657,6 @@ MOZ_CAN_RUN_SCRIPT
}
TEST_F(AccessibleCaretManagerTester, TestScrollInCursorModeOnEmptyContent)
MOZ_CAN_RUN_SCRIPT
{
// Simulate caret hiding when scrolling.
AutoRestore<bool> savesCaretsAlwaysShowWhenScrolling(
@ -742,7 +733,6 @@ MOZ_CAN_RUN_SCRIPT
TEST_F(AccessibleCaretManagerTester,
TestScrollInCursorModeWithCaretShownWhenLongTappingOnEmptyContentPref)
MOZ_CAN_RUN_SCRIPT
{
// Simulate Firefox Android preference.
AutoRestore<bool> savesCaretShownWhenLongTappingOnEmptyContent(