mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1053462 - Add isFromUserInput to vc change events and pivot methods. r=surkov
This commit is contained in:
parent
0e583a355f
commit
522150ea20
@ -186,8 +186,9 @@ AccVCChangeEvent::
|
||||
AccVCChangeEvent(Accessible* aAccessible,
|
||||
nsIAccessible* aOldAccessible,
|
||||
int32_t aOldStart, int32_t aOldEnd,
|
||||
int16_t aReason) :
|
||||
AccEvent(::nsIAccessibleEvent::EVENT_VIRTUALCURSOR_CHANGED, aAccessible),
|
||||
int16_t aReason, EIsFromUserInput aIsFromUserInput) :
|
||||
AccEvent(::nsIAccessibleEvent::EVENT_VIRTUALCURSOR_CHANGED, aAccessible,
|
||||
aIsFromUserInput),
|
||||
mOldAccessible(aOldAccessible), mOldStart(aOldStart), mOldEnd(aOldEnd),
|
||||
mReason(aReason)
|
||||
{
|
||||
|
@ -469,7 +469,8 @@ public:
|
||||
AccVCChangeEvent(Accessible* aAccessible,
|
||||
nsIAccessible* aOldAccessible,
|
||||
int32_t aOldStart, int32_t aOldEnd,
|
||||
int16_t aReason);
|
||||
int16_t aReason,
|
||||
EIsFromUserInput aIsFromUserInput = eFromUserInput);
|
||||
|
||||
virtual ~AccVCChangeEvent() { }
|
||||
|
||||
|
@ -101,7 +101,7 @@ nsAccessiblePivot::SetPosition(nsIAccessible* aPosition)
|
||||
int32_t oldStart = mStartOffset, oldEnd = mEndOffset;
|
||||
mStartOffset = mEndOffset = -1;
|
||||
NotifyOfPivotChange(secondPosition, oldStart, oldEnd,
|
||||
nsIAccessiblePivot::REASON_NONE);
|
||||
nsIAccessiblePivot::REASON_NONE, false);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -154,7 +154,8 @@ nsAccessiblePivot::GetEndOffset(int32_t* aEndOffset)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessiblePivot::SetTextRange(nsIAccessibleText* aTextAccessible,
|
||||
int32_t aStartOffset, int32_t aEndOffset)
|
||||
int32_t aStartOffset, int32_t aEndOffset,
|
||||
bool aIsFromUserInput, uint8_t aArgc)
|
||||
{
|
||||
NS_ENSURE_ARG(aTextAccessible);
|
||||
|
||||
@ -186,7 +187,8 @@ nsAccessiblePivot::SetTextRange(nsIAccessibleText* aTextAccessible,
|
||||
mPosition = newPosition;
|
||||
|
||||
NotifyOfPivotChange(oldPosition, oldStart, oldEnd,
|
||||
nsIAccessiblePivot::REASON_TEXT);
|
||||
nsIAccessiblePivot::REASON_TEXT,
|
||||
(aArgc > 0) ? aIsFromUserInput : true);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -196,7 +198,7 @@ nsAccessiblePivot::SetTextRange(nsIAccessibleText* aTextAccessible,
|
||||
NS_IMETHODIMP
|
||||
nsAccessiblePivot::MoveNext(nsIAccessibleTraversalRule* aRule,
|
||||
nsIAccessible* aAnchor, bool aIncludeStart,
|
||||
uint8_t aArgc, bool* aResult)
|
||||
bool aIsFromUserInput, uint8_t aArgc, bool* aResult)
|
||||
{
|
||||
NS_ENSURE_ARG(aResult);
|
||||
NS_ENSURE_ARG(aRule);
|
||||
@ -215,7 +217,8 @@ nsAccessiblePivot::MoveNext(nsIAccessibleTraversalRule* aRule,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (accessible)
|
||||
*aResult = MovePivotInternal(accessible, nsIAccessiblePivot::REASON_NEXT);
|
||||
*aResult = MovePivotInternal(accessible, nsIAccessiblePivot::REASON_NEXT,
|
||||
(aArgc > 2) ? aIsFromUserInput : true);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -223,7 +226,7 @@ nsAccessiblePivot::MoveNext(nsIAccessibleTraversalRule* aRule,
|
||||
NS_IMETHODIMP
|
||||
nsAccessiblePivot::MovePrevious(nsIAccessibleTraversalRule* aRule,
|
||||
nsIAccessible* aAnchor,
|
||||
bool aIncludeStart,
|
||||
bool aIncludeStart, bool aIsFromUserInput,
|
||||
uint8_t aArgc, bool* aResult)
|
||||
{
|
||||
NS_ENSURE_ARG(aResult);
|
||||
@ -243,13 +246,16 @@ nsAccessiblePivot::MovePrevious(nsIAccessibleTraversalRule* aRule,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (accessible)
|
||||
*aResult = MovePivotInternal(accessible, nsIAccessiblePivot::REASON_PREV);
|
||||
*aResult = MovePivotInternal(accessible, nsIAccessiblePivot::REASON_PREV,
|
||||
(aArgc > 2) ? aIsFromUserInput : true);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessiblePivot::MoveFirst(nsIAccessibleTraversalRule* aRule, bool* aResult)
|
||||
nsAccessiblePivot::MoveFirst(nsIAccessibleTraversalRule* aRule,
|
||||
bool aIsFromUserInput,
|
||||
uint8_t aArgc, bool* aResult)
|
||||
{
|
||||
NS_ENSURE_ARG(aResult);
|
||||
NS_ENSURE_ARG(aRule);
|
||||
@ -262,14 +268,16 @@ nsAccessiblePivot::MoveFirst(nsIAccessibleTraversalRule* aRule, bool* aResult)
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (accessible)
|
||||
*aResult = MovePivotInternal(accessible, nsIAccessiblePivot::REASON_FIRST);
|
||||
*aResult = MovePivotInternal(accessible, nsIAccessiblePivot::REASON_FIRST,
|
||||
(aArgc > 0) ? aIsFromUserInput : true);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessiblePivot::MoveLast(nsIAccessibleTraversalRule* aRule,
|
||||
bool* aResult)
|
||||
bool aIsFromUserInput,
|
||||
uint8_t aArgc, bool* aResult)
|
||||
{
|
||||
NS_ENSURE_ARG(aResult);
|
||||
NS_ENSURE_ARG(aRule);
|
||||
@ -291,13 +299,16 @@ nsAccessiblePivot::MoveLast(nsIAccessibleTraversalRule* aRule,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (accessible)
|
||||
*aResult = MovePivotInternal(accessible, nsAccessiblePivot::REASON_LAST);
|
||||
*aResult = MovePivotInternal(accessible, nsAccessiblePivot::REASON_LAST,
|
||||
(aArgc > 0) ? aIsFromUserInput : true);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessiblePivot::MoveNextByText(TextBoundaryType aBoundary, bool* aResult)
|
||||
nsAccessiblePivot::MoveNextByText(TextBoundaryType aBoundary,
|
||||
bool aIsFromUserInput, uint8_t aArgc,
|
||||
bool* aResult)
|
||||
{
|
||||
NS_ENSURE_ARG(aResult);
|
||||
|
||||
@ -407,13 +418,16 @@ nsAccessiblePivot::MoveNextByText(TextBoundaryType aBoundary, bool* aResult)
|
||||
mStartOffset = tempStart;
|
||||
mEndOffset = tempEnd;
|
||||
NotifyOfPivotChange(startPosition, oldStart, oldEnd,
|
||||
nsIAccessiblePivot::REASON_TEXT);
|
||||
nsIAccessiblePivot::REASON_TEXT,
|
||||
(aArgc > 0) ? aIsFromUserInput : true);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessiblePivot::MovePreviousByText(TextBoundaryType aBoundary, bool* aResult)
|
||||
nsAccessiblePivot::MovePreviousByText(TextBoundaryType aBoundary,
|
||||
bool aIsFromUserInput, uint8_t aArgc,
|
||||
bool* aResult)
|
||||
{
|
||||
NS_ENSURE_ARG(aResult);
|
||||
|
||||
@ -536,7 +550,8 @@ nsAccessiblePivot::MovePreviousByText(TextBoundaryType aBoundary, bool* aResult)
|
||||
mEndOffset = tempEnd;
|
||||
|
||||
NotifyOfPivotChange(startPosition, oldStart, oldEnd,
|
||||
nsIAccessiblePivot::REASON_TEXT);
|
||||
nsIAccessiblePivot::REASON_TEXT,
|
||||
(aArgc > 0) ? aIsFromUserInput : true);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
@ -544,6 +559,7 @@ nsAccessiblePivot::MovePreviousByText(TextBoundaryType aBoundary, bool* aResult)
|
||||
NS_IMETHODIMP
|
||||
nsAccessiblePivot::MoveToPoint(nsIAccessibleTraversalRule* aRule,
|
||||
int32_t aX, int32_t aY, bool aIgnoreNoMatch,
|
||||
bool aIsFromUserInput, uint8_t aArgc,
|
||||
bool* aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
@ -581,7 +597,8 @@ nsAccessiblePivot::MoveToPoint(nsIAccessibleTraversalRule* aRule,
|
||||
}
|
||||
|
||||
if (match || !aIgnoreNoMatch)
|
||||
*aResult = MovePivotInternal(match, nsIAccessiblePivot::REASON_POINT);
|
||||
*aResult = MovePivotInternal(match, nsIAccessiblePivot::REASON_POINT,
|
||||
(aArgc > 0) ? aIsFromUserInput : true);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -626,14 +643,16 @@ nsAccessiblePivot::IsDescendantOf(Accessible* aAccessible, Accessible* aAncestor
|
||||
|
||||
bool
|
||||
nsAccessiblePivot::MovePivotInternal(Accessible* aPosition,
|
||||
PivotMoveReason aReason)
|
||||
PivotMoveReason aReason,
|
||||
bool aIsFromUserInput)
|
||||
{
|
||||
nsRefPtr<Accessible> oldPosition = mPosition.forget();
|
||||
mPosition = aPosition;
|
||||
int32_t oldStart = mStartOffset, oldEnd = mEndOffset;
|
||||
mStartOffset = mEndOffset = -1;
|
||||
|
||||
return NotifyOfPivotChange(oldPosition, oldStart, oldEnd, aReason);
|
||||
return NotifyOfPivotChange(oldPosition, oldStart, oldEnd, aReason,
|
||||
aIsFromUserInput);
|
||||
}
|
||||
|
||||
Accessible*
|
||||
@ -824,7 +843,7 @@ nsAccessiblePivot::SearchForText(Accessible* aAccessible, bool aBackward)
|
||||
bool
|
||||
nsAccessiblePivot::NotifyOfPivotChange(Accessible* aOldPosition,
|
||||
int32_t aOldStart, int32_t aOldEnd,
|
||||
int16_t aReason)
|
||||
int16_t aReason, bool aIsFromUserInput)
|
||||
{
|
||||
if (aOldPosition == mPosition &&
|
||||
aOldStart == mStartOffset && aOldEnd == mEndOffset)
|
||||
@ -833,7 +852,8 @@ nsAccessiblePivot::NotifyOfPivotChange(Accessible* aOldPosition,
|
||||
nsTObserverArray<nsCOMPtr<nsIAccessiblePivotObserver> >::ForwardIterator iter(mObservers);
|
||||
while (iter.HasMore()) {
|
||||
nsIAccessiblePivotObserver* obs = iter.GetNext();
|
||||
obs->OnPivotChanged(this, aOldPosition, aOldStart, aOldEnd, aReason);
|
||||
obs->OnPivotChanged(this, aOldPosition, aOldStart, aOldEnd, aReason,
|
||||
aIsFromUserInput);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -49,7 +49,8 @@ private:
|
||||
*/
|
||||
bool NotifyOfPivotChange(Accessible* aOldAccessible,
|
||||
int32_t aOldStart, int32_t aOldEnd,
|
||||
PivotMoveReason aReason);
|
||||
PivotMoveReason aReason,
|
||||
bool aIsFromUserInput);
|
||||
|
||||
/*
|
||||
* Check to see that the given accessible is a descendant of given ancestor
|
||||
@ -95,7 +96,8 @@ private:
|
||||
/*
|
||||
* Update the pivot, and notify observers. Return true if it moved.
|
||||
*/
|
||||
bool MovePivotInternal(Accessible* aPosition, PivotMoveReason aReason);
|
||||
bool MovePivotInternal(Accessible* aPosition, PivotMoveReason aReason,
|
||||
bool aIsFromUserInput);
|
||||
|
||||
/*
|
||||
* Get initial node we should start a search from with a given rule.
|
||||
|
@ -816,11 +816,12 @@ NS_IMETHODIMP
|
||||
DocAccessible::OnPivotChanged(nsIAccessiblePivot* aPivot,
|
||||
nsIAccessible* aOldAccessible,
|
||||
int32_t aOldStart, int32_t aOldEnd,
|
||||
PivotMoveReason aReason)
|
||||
PivotMoveReason aReason,
|
||||
bool aIsFromUserInput)
|
||||
{
|
||||
nsRefPtr<AccEvent> event = new AccVCChangeEvent(this, aOldAccessible,
|
||||
aOldStart, aOldEnd,
|
||||
aReason);
|
||||
nsRefPtr<AccEvent> event = new AccVCChangeEvent(
|
||||
this, aOldAccessible, aOldStart, aOldEnd, aReason,
|
||||
aIsFromUserInput ? eFromUserInput : eNoUserInput);
|
||||
nsEventShell::FireEvent(event);
|
||||
|
||||
return NS_OK;
|
||||
|
@ -20,7 +20,7 @@ interface nsIAccessiblePivotObserver;
|
||||
* provides traversal methods to move the pivot to next/prev state that complies
|
||||
* to a given rule.
|
||||
*/
|
||||
[scriptable, uuid(c2938033-e240-4fe5-9cb6-e7ad649ccd10)]
|
||||
[scriptable, uuid(81fe5144-059b-42db-bd3a-f6ce3158d5e9)]
|
||||
interface nsIAccessiblePivot : nsISupports
|
||||
{
|
||||
const TextBoundaryType CHAR_BOUNDARY = 0;
|
||||
@ -64,91 +64,114 @@ interface nsIAccessiblePivot : nsISupports
|
||||
/**
|
||||
* Set the pivot's text range in a text accessible.
|
||||
*
|
||||
* @param aTextAccessible [in] the text accessible that contains the desired
|
||||
* range.
|
||||
* @param aStartOffset [in] the start offset to set.
|
||||
* @param aEndOffset [in] the end offset to set.
|
||||
* @param aTextAccessible [in] the text accessible that contains the desired
|
||||
* range.
|
||||
* @param aStartOffset [in] the start offset to set.
|
||||
* @param aEndOffset [in] the end offset to set.
|
||||
* @param aIsFromUserInput [in] the pivot changed because of direct user input
|
||||
* (default is true).
|
||||
* @throws NS_ERROR_INVALID_ARG when the offset exceeds the accessible's
|
||||
* character count.
|
||||
*/
|
||||
void setTextRange(in nsIAccessibleText aTextAccessible,
|
||||
in long aStartOffset, in long aEndOffset);
|
||||
[optional_argc] void setTextRange(in nsIAccessibleText aTextAccessible,
|
||||
in long aStartOffset, in long aEndOffset,
|
||||
[optional] in boolean aIsFromUserInput);
|
||||
|
||||
/**
|
||||
* Move pivot to next object, from current position or given anchor,
|
||||
* complying to given traversal rule.
|
||||
*
|
||||
* @param aRule [in] traversal rule to use.
|
||||
* @param aAnchor [in] accessible to start search from, if not provided,
|
||||
* @param aRule [in] traversal rule to use.
|
||||
* @param aAnchor [in] accessible to start search from, if not provided,
|
||||
* current position will be used.
|
||||
* @param aIncludeStart [in] include anchor accessible in search.
|
||||
* @param aIncludeStart [in] include anchor accessible in search.
|
||||
* @param aIsFromUserInput [in] the pivot changed because of direct user input
|
||||
* (default is true).
|
||||
* @return true on success, false if there are no new nodes to traverse to.
|
||||
*/
|
||||
[optional_argc] boolean moveNext(in nsIAccessibleTraversalRule aRule,
|
||||
[optional] in nsIAccessible aAnchor,
|
||||
[optional] in boolean aIncludeStart);
|
||||
[optional] in boolean aIncludeStart,
|
||||
[optional] in boolean aIsFromUserInput);
|
||||
|
||||
/**
|
||||
* Move pivot to previous object, from current position or given anchor,
|
||||
* complying to given traversal rule.
|
||||
*
|
||||
* @param aRule [in] traversal rule to use.
|
||||
* @param aAnchor [in] accessible to start search from, if not provided,
|
||||
* @param aRule [in] traversal rule to use.
|
||||
* @param aAnchor [in] accessible to start search from, if not provided,
|
||||
* current position will be used.
|
||||
* @param aIncludeStart [in] include anchor accessible in search.
|
||||
* @param aIncludeStart [in] include anchor accessible in search.
|
||||
* @param aIsFromUserInput [in] the pivot changed because of direct user input
|
||||
* (default is true).
|
||||
* @return true on success, false if there are no new nodes to traverse to.
|
||||
*/
|
||||
[optional_argc] boolean movePrevious(in nsIAccessibleTraversalRule aRule,
|
||||
[optional] in nsIAccessible aAnchor,
|
||||
[optional] in boolean aIncludeStart);
|
||||
[optional] in boolean aIncludeStart,
|
||||
[optional] in boolean aIsFromUserInput);
|
||||
|
||||
/**
|
||||
* Move pivot to first object in subtree complying to given traversal rule.
|
||||
*
|
||||
* @param aRule [in] traversal rule to use.
|
||||
* @param aRule [in] traversal rule to use.
|
||||
* @param aIsFromUserInput [in] the pivot changed because of direct user input
|
||||
* (default is true).
|
||||
* @return true on success, false if there are no new nodes to traverse to.
|
||||
*/
|
||||
boolean moveFirst(in nsIAccessibleTraversalRule aRule);
|
||||
[optional_argc] boolean moveFirst(in nsIAccessibleTraversalRule aRule,
|
||||
[optional] in boolean aIsFromUserInput);
|
||||
|
||||
/**
|
||||
* Move pivot to last object in subtree complying to given traversal rule.
|
||||
*
|
||||
* @param aRule [in] traversal rule to use.
|
||||
* @return true on success, false if there are no new nodes to traverse to.
|
||||
* @param aRule [in] traversal rule to use.
|
||||
* @param aIsFromUserInput [in] the pivot changed because of direct user input
|
||||
* (default is true).
|
||||
*/
|
||||
boolean moveLast(in nsIAccessibleTraversalRule aRule);
|
||||
[optional_argc] boolean moveLast(in nsIAccessibleTraversalRule aRule,
|
||||
[optional] in boolean aIsFromUserInput);
|
||||
|
||||
/**
|
||||
* Move pivot to next text range.
|
||||
*
|
||||
* @param aBoundary [in] type of boundary for next text range, character, word,
|
||||
* etc.
|
||||
* @param aBoundary [in] type of boundary for next text range,
|
||||
* character, word, etc.
|
||||
* @param aIsFromUserInput [in] the pivot changed because of direct user input
|
||||
* (default is true).
|
||||
* @return true on success, false if there are is no more text.
|
||||
*/
|
||||
boolean moveNextByText(in TextBoundaryType aBoundary);
|
||||
|
||||
[optional_argc] boolean moveNextByText(in TextBoundaryType aBoundary,
|
||||
[optional] in boolean aIsFromUserInput);
|
||||
|
||||
/**
|
||||
* Move pivot to previous text range.
|
||||
*
|
||||
* @param aBoundary [in] type of boundary for previous text range, character,
|
||||
* word, etc.
|
||||
* @param aBoundary [in] type of boundary for next text range,
|
||||
* character, word, etc.
|
||||
* @param aIsFromUserInput [in] the pivot changed because of direct user input
|
||||
* (default is true).
|
||||
* @return true on success, false if there are is no more text.
|
||||
*/
|
||||
boolean movePreviousByText(in TextBoundaryType aBoundary);
|
||||
[optional_argc] boolean movePreviousByText(in TextBoundaryType aBoundary,
|
||||
[optional] in boolean aIsFromUserInput);
|
||||
|
||||
/**
|
||||
* Move pivot to given coordinate in screen pixels.
|
||||
*
|
||||
* @param aRule [in] raversal rule to use.
|
||||
* @param aX [in] screen's x coordinate
|
||||
* @param aY [in] screen's y coordinate
|
||||
* @param aIgnoreNoMatch [in] don't unset position if no object was found at
|
||||
* point.
|
||||
* @param aRule [in] raversal rule to use.
|
||||
* @param aX [in] screen's x coordinate
|
||||
* @param aY [in] screen's y coordinate
|
||||
* @param aIgnoreNoMatch [in] don't unset position if no object was found
|
||||
* at point.
|
||||
* @param aIsFromUserInput [in] the pivot changed because of direct user input
|
||||
* (default is true).
|
||||
* @return true on success, false if the pivot has not been moved.
|
||||
*/
|
||||
boolean moveToPoint(in nsIAccessibleTraversalRule aRule,
|
||||
in long aX, in long aY,
|
||||
in boolean aIgnoreNoMatch);
|
||||
[optional_argc] boolean moveToPoint(in nsIAccessibleTraversalRule aRule,
|
||||
in long aX, in long aY,
|
||||
in boolean aIgnoreNoMatch,
|
||||
[optional] in boolean aIsFromUserInput);
|
||||
|
||||
/**
|
||||
* Add an observer for pivot changes.
|
||||
@ -174,19 +197,23 @@ interface nsIAccessiblePivotObserver : nsISupports
|
||||
/**
|
||||
* Called when the pivot changes.
|
||||
*
|
||||
* @param aPivot [in] the pivot that has changed.
|
||||
* @param aOldAccessible [in] the old pivot position before the change, or null.
|
||||
* @param aOldStart [in] the old start offset, or -1.
|
||||
* @param aOldEnd [in] the old end offset, or -1.
|
||||
* @param aReason [in] the reason for the pivot change.
|
||||
* @param aPivot [in] the pivot that has changed.
|
||||
* @param aOldAccessible [in] the old pivot position before the change,
|
||||
* or null.
|
||||
* @param aOldStart [in] the old start offset, or -1.
|
||||
* @param aOldEnd [in] the old end offset, or -1.
|
||||
* @param aReason [in] the reason for the pivot change.
|
||||
* @param aIsFromUserInput [in] the pivot changed because of direct user input
|
||||
* (default is true).
|
||||
*/
|
||||
void onPivotChanged(in nsIAccessiblePivot aPivot,
|
||||
in nsIAccessible aOldAccessible,
|
||||
in long aOldStart, in long aOldEnd,
|
||||
in PivotMoveReason aReason);
|
||||
in PivotMoveReason aReason,
|
||||
in boolean aIsFromUserInput);
|
||||
};
|
||||
|
||||
[scriptable, uuid(4d9c4352-20f5-4c54-9580-0c77bb6b1115)]
|
||||
[scriptable, uuid(e197460d-1eff-4247-b4bb-a43be1840dae)]
|
||||
interface nsIAccessibleTraversalRule : nsISupports
|
||||
{
|
||||
/* Ignore this accessible object */
|
||||
|
@ -75,11 +75,12 @@ var ObjectTraversalRule =
|
||||
/**
|
||||
* A checker for virtual cursor changed events.
|
||||
*/
|
||||
function VCChangedChecker(aDocAcc, aIdOrNameOrAcc, aTextOffsets, aPivotMoveMethod)
|
||||
function VCChangedChecker(aDocAcc, aIdOrNameOrAcc, aTextOffsets, aPivotMoveMethod,
|
||||
aIsFromUserInput)
|
||||
{
|
||||
this.__proto__ = new invokerChecker(EVENT_VIRTUALCURSOR_CHANGED, aDocAcc);
|
||||
|
||||
this.match = function VCChangedChecker_check(aEvent)
|
||||
this.match = function VCChangedChecker_match(aEvent)
|
||||
{
|
||||
var event = null;
|
||||
try {
|
||||
@ -114,6 +115,9 @@ function VCChangedChecker(aDocAcc, aIdOrNameOrAcc, aTextOffsets, aPivotMoveMetho
|
||||
"expecting " + aIdOrNameOrAcc + ", got '" +
|
||||
prettyName(position));
|
||||
|
||||
SimpleTest.is(aEvent.isFromUserInput, aIsFromUserInput,
|
||||
"Expected user input is " + aIsFromUserInput + '\n');
|
||||
|
||||
if (aTextOffsets) {
|
||||
SimpleTest.is(aDocAcc.virtualCursor.startOffset, aTextOffsets[0],
|
||||
"wrong start offset");
|
||||
@ -190,7 +194,7 @@ function setVCRangeInvoker(aDocAcc, aTextAccessible, aTextOffsets)
|
||||
};
|
||||
|
||||
this.eventSeq = [
|
||||
new VCChangedChecker(aDocAcc, aTextAccessible, aTextOffsets, "setTextRange")
|
||||
new VCChangedChecker(aDocAcc, aTextAccessible, aTextOffsets, "setTextRange", true)
|
||||
];
|
||||
}
|
||||
|
||||
@ -203,8 +207,11 @@ function setVCRangeInvoker(aDocAcc, aTextAccessible, aTextOffsets)
|
||||
* @param aIdOrNameOrAcc [in] id, accessible or accessible name to expect
|
||||
* virtual cursor to land on after performing move method.
|
||||
* false if no move is expected.
|
||||
* @param aIsFromUserInput [in] set user input flag when invoking method, and
|
||||
* expect it in the event.
|
||||
*/
|
||||
function setVCPosInvoker(aDocAcc, aPivotMoveMethod, aRule, aIdOrNameOrAcc)
|
||||
function setVCPosInvoker(aDocAcc, aPivotMoveMethod, aRule, aIdOrNameOrAcc,
|
||||
aIsFromUserInput)
|
||||
{
|
||||
var expectMove = (aIdOrNameOrAcc != false);
|
||||
this.invoke = function virtualCursorChangedInvoker_invoke()
|
||||
@ -212,7 +219,20 @@ function setVCPosInvoker(aDocAcc, aPivotMoveMethod, aRule, aIdOrNameOrAcc)
|
||||
VCChangedChecker.
|
||||
storePreviousPosAndOffset(aDocAcc.virtualCursor);
|
||||
if (aPivotMoveMethod && aRule) {
|
||||
var moved = aDocAcc.virtualCursor[aPivotMoveMethod](aRule);
|
||||
var moved = false;
|
||||
switch (aPivotMoveMethod) {
|
||||
case 'moveFirst':
|
||||
case 'moveLast':
|
||||
moved = aDocAcc.virtualCursor[aPivotMoveMethod](aRule,
|
||||
aIsFromUserInput === undefined ? true : aIsFromUserInput);
|
||||
break;
|
||||
case 'moveNext':
|
||||
case 'movePrevious':
|
||||
moved = aDocAcc.virtualCursor[aPivotMoveMethod](aRule,
|
||||
aDocAcc.virtualCursor.position, false,
|
||||
aIsFromUserInput === undefined ? true : aIsFromUserInput);
|
||||
break;
|
||||
}
|
||||
SimpleTest.is(!!moved, !!expectMove,
|
||||
"moved pivot with " + aPivotMoveMethod +
|
||||
" to " + aIdOrNameOrAcc);
|
||||
@ -228,7 +248,8 @@ function setVCPosInvoker(aDocAcc, aPivotMoveMethod, aRule, aIdOrNameOrAcc)
|
||||
|
||||
if (expectMove) {
|
||||
this.eventSeq = [
|
||||
new VCChangedChecker(aDocAcc, aIdOrNameOrAcc, null, aPivotMoveMethod)
|
||||
new VCChangedChecker(aDocAcc, aIdOrNameOrAcc, null, aPivotMoveMethod,
|
||||
aIsFromUserInput === undefined ? !!aPivotMoveMethod : aIsFromUserInput)
|
||||
];
|
||||
} else {
|
||||
this.eventSeq = [];
|
||||
@ -249,15 +270,19 @@ function setVCPosInvoker(aDocAcc, aPivotMoveMethod, aRule, aIdOrNameOrAcc)
|
||||
* @param aIdOrNameOrAcc [in] id, accessible or accessible name to expect
|
||||
* virtual cursor to land on after performing move method.
|
||||
* false if no move is expected.
|
||||
* @param aIsFromUserInput [in] set user input flag when invoking method, and
|
||||
* expect it in the event.
|
||||
*/
|
||||
function setVCTextInvoker(aDocAcc, aPivotMoveMethod, aBoundary, aTextOffsets, aIdOrNameOrAcc)
|
||||
function setVCTextInvoker(aDocAcc, aPivotMoveMethod, aBoundary, aTextOffsets,
|
||||
aIdOrNameOrAcc, aIsFromUserInput)
|
||||
{
|
||||
var expectMove = (aIdOrNameOrAcc != false);
|
||||
this.invoke = function virtualCursorChangedInvoker_invoke()
|
||||
{
|
||||
VCChangedChecker.storePreviousPosAndOffset(aDocAcc.virtualCursor);
|
||||
SimpleTest.info(aDocAcc.virtualCursor.position);
|
||||
var moved = aDocAcc.virtualCursor[aPivotMoveMethod](aBoundary);
|
||||
var moved = aDocAcc.virtualCursor[aPivotMoveMethod](aBoundary,
|
||||
aIsFromUserInput === undefined ? true : false);
|
||||
SimpleTest.is(!!moved, !!expectMove,
|
||||
"moved pivot by text with " + aPivotMoveMethod +
|
||||
" to " + aIdOrNameOrAcc);
|
||||
@ -272,7 +297,8 @@ function setVCTextInvoker(aDocAcc, aPivotMoveMethod, aBoundary, aTextOffsets, aI
|
||||
|
||||
if (expectMove) {
|
||||
this.eventSeq = [
|
||||
new VCChangedChecker(aDocAcc, aIdOrNameOrAcc, aTextOffsets, aPivotMoveMethod)
|
||||
new VCChangedChecker(aDocAcc, aIdOrNameOrAcc, aTextOffsets, aPivotMoveMethod,
|
||||
aIsFromUserInput === undefined ? true : aIsFromUserInput)
|
||||
];
|
||||
} else {
|
||||
this.eventSeq = [];
|
||||
@ -317,7 +343,7 @@ function moveVCCoordInvoker(aDocAcc, aX, aY, aIgnoreNoMatch,
|
||||
|
||||
if (expectMove) {
|
||||
this.eventSeq = [
|
||||
new VCChangedChecker(aDocAcc, aIdOrNameOrAcc, null, 'moveToPoint')
|
||||
new VCChangedChecker(aDocAcc, aIdOrNameOrAcc, null, 'moveToPoint', true)
|
||||
];
|
||||
} else {
|
||||
this.eventSeq = [];
|
||||
@ -407,7 +433,8 @@ function queueTraversalSequence(aQueue, aDocAcc, aRule, aModalRoot, aSequence)
|
||||
// No further more matches for given rule, expect no virtual cursor changes.
|
||||
aQueue.push(new setVCPosInvoker(aDocAcc, "moveNext", aRule, false));
|
||||
|
||||
aQueue.push(new setVCPosInvoker(aDocAcc, "moveFirst", aRule, aSequence[0]));
|
||||
// set isFromUserInput to false, just to test..
|
||||
aQueue.push(new setVCPosInvoker(aDocAcc, "moveFirst", aRule, aSequence[0], false));
|
||||
|
||||
// No previous more matches for given rule, expect no virtual cursor changes.
|
||||
aQueue.push(new setVCPosInvoker(aDocAcc, "movePrevious", aRule, false));
|
||||
|
@ -96,8 +96,10 @@
|
||||
NS_ERROR_INVALID_ARG));
|
||||
|
||||
// Put cursor in an ignored subtree
|
||||
// set isFromUserInput to false, just to test..
|
||||
gQueue.push(new setVCPosInvoker(docAcc, null, null,
|
||||
getAccessible(doc.getElementById("hidden-link"))));
|
||||
getAccessible(doc.getElementById("hidden-link")),
|
||||
false));
|
||||
// Next item shoud be outside of that subtree
|
||||
gQueue.push(new setVCPosInvoker(docAcc, "moveNext", ObjectTraversalRule, "An "));
|
||||
|
||||
|
@ -53,8 +53,10 @@
|
||||
getAccessible(doc.getElementById('paragraph-1'), nsIAccessibleText)));
|
||||
gQueue.push(new setVCTextInvoker(docAcc, 'movePreviousByText', WORD_BOUNDARY, [0,3],
|
||||
getAccessible(doc.getElementById('p1-link-1'), nsIAccessibleText)));
|
||||
// set user input to false, and see if it works
|
||||
gQueue.push(new setVCTextInvoker(docAcc, 'movePreviousByText', WORD_BOUNDARY, [5,7],
|
||||
getAccessible(doc.getElementById('paragraph-1'), nsIAccessibleText)));
|
||||
getAccessible(doc.getElementById('paragraph-1'), nsIAccessibleText)),
|
||||
false);
|
||||
|
||||
gQueue.push(new setVCPosInvoker(docAcc, null, null,
|
||||
getAccessible(doc.getElementById('section-1'))));
|
||||
@ -62,8 +64,10 @@
|
||||
getAccessible(doc.getElementById('section-1'), nsIAccessibleText)));
|
||||
gQueue.push(new setVCTextInvoker(docAcc, 'moveNextByText', WORD_BOUNDARY, [0,9],
|
||||
getAccessible(doc.getElementById('s1-link-1'), nsIAccessibleText)));
|
||||
// set user input to false, and see if it works
|
||||
gQueue.push(new setVCTextInvoker(docAcc, 'moveNextByText', WORD_BOUNDARY, [10,14],
|
||||
getAccessible(doc.getElementById('s1-link-1'), nsIAccessibleText)));
|
||||
getAccessible(doc.getElementById('s1-link-1'), nsIAccessibleText),
|
||||
false));
|
||||
gQueue.push(new setVCTextInvoker(docAcc, 'moveNextByText', WORD_BOUNDARY, [4,6],
|
||||
getAccessible(doc.getElementById('section-1'), nsIAccessibleText)));
|
||||
gQueue.push(new setVCTextInvoker(docAcc, 'moveNextByText', WORD_BOUNDARY, [7,12],
|
||||
|
Loading…
Reference in New Issue
Block a user