Skip to content

Commit

Permalink
Merge inbound to mozilla-central a=merge
Browse files Browse the repository at this point in the history
  • Loading branch information
ccoroiu committed Jul 17, 2018
2 parents 1048419 + f054527 commit 29cc186
Show file tree
Hide file tree
Showing 28 changed files with 277 additions and 79 deletions.
8 changes: 5 additions & 3 deletions accessible/base/AccEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,14 @@ AccVCChangeEvent::
int32_t aOldStart, int32_t aOldEnd,
Accessible* aNewAccessible,
int32_t aNewStart, int32_t aNewEnd,
int16_t aReason, EIsFromUserInput aIsFromUserInput) :
int16_t aReason, int16_t aBoundaryType,
EIsFromUserInput aIsFromUserInput) :
AccEvent(::nsIAccessibleEvent::EVENT_VIRTUALCURSOR_CHANGED, aAccessible,
aIsFromUserInput),
mOldAccessible(aOldAccessible), mNewAccessible(aNewAccessible),
mOldStart(aOldStart), mNewStart(aNewStart),
mOldEnd(aOldEnd), mNewEnd(aNewEnd),
mReason(aReason)
mReason(aReason), mBoundaryType(aBoundaryType)
{
}

Expand Down Expand Up @@ -258,7 +259,8 @@ a11y::MakeXPCEvent(AccEvent* aEvent)
ToXPC(vcc->NewAccessible()),
vcc->NewStartOffset(),
vcc->NewEndOffset(),
vcc->Reason());
vcc->Reason(),
vcc->BoundaryType());
return xpEvent.forget();
}

Expand Down
3 changes: 3 additions & 0 deletions accessible/base/AccEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ class AccVCChangeEvent : public AccEvent
Accessible* aNewAccessible,
int32_t aNewStart, int32_t aNewEnd,
int16_t aReason,
int16_t aBoundaryType,
EIsFromUserInput aIsFromUserInput = eFromUserInput);

virtual ~AccVCChangeEvent() { }
Expand All @@ -507,6 +508,7 @@ class AccVCChangeEvent : public AccEvent
int32_t NewStartOffset() const { return mNewStart; }
int32_t NewEndOffset() const { return mNewEnd; }
int32_t Reason() const { return mReason; }
int32_t BoundaryType() const { return mBoundaryType; }

private:
RefPtr<Accessible> mOldAccessible;
Expand All @@ -516,6 +518,7 @@ class AccVCChangeEvent : public AccEvent
int32_t mOldEnd;
int32_t mNewEnd;
int16_t mReason;
int16_t mBoundaryType;
};

/**
Expand Down
3 changes: 2 additions & 1 deletion accessible/base/Platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ void ProxyVirtualCursorChangeEvent(ProxyAccessible* aTarget,
ProxyAccessible* aNewPosition,
int32_t aNewStartOffset,
int32_t aNewEndOffset,
uint16_t aReason, bool aFromUser);
int16_t aReason, int16_t aBoundaryType,
bool aFromUser);
#endif
} // namespace a11y
} // namespace mozilla
Expand Down
44 changes: 29 additions & 15 deletions accessible/base/nsAccessiblePivot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ nsAccessiblePivot::SetPosition(nsIAccessible* aPosition)
int32_t oldStart = mStartOffset, oldEnd = mEndOffset;
mStartOffset = mEndOffset = -1;
NotifyOfPivotChange(position, oldStart, oldEnd,
nsIAccessiblePivot::REASON_NONE, false);
nsIAccessiblePivot::REASON_NONE,
nsIAccessiblePivot::NO_BOUNDARY, false);

return NS_OK;
}
Expand Down Expand Up @@ -186,7 +187,8 @@ nsAccessiblePivot::SetTextRange(nsIAccessibleText* aTextAccessible,

mPosition.swap(acc);
NotifyOfPivotChange(acc, oldStart, oldEnd,
nsIAccessiblePivot::REASON_TEXT,
nsIAccessiblePivot::REASON_NONE,
nsIAccessiblePivot::NO_BOUNDARY,
(aArgc > 0) ? aIsFromUserInput : true);

return NS_OK;
Expand Down Expand Up @@ -378,6 +380,10 @@ nsAccessiblePivot::MoveNextByText(TextBoundaryType aBoundary,
startBoundary = nsIAccessibleText::BOUNDARY_WORD_START;
endBoundary = nsIAccessibleText::BOUNDARY_WORD_END;
break;
case LINE_BOUNDARY:
startBoundary = nsIAccessibleText::BOUNDARY_LINE_START;
endBoundary = nsIAccessibleText::BOUNDARY_LINE_END;
break;
default:
return NS_ERROR_INVALID_ARG;
}
Expand Down Expand Up @@ -418,7 +424,7 @@ nsAccessiblePivot::MoveNextByText(TextBoundaryType aBoundary,
mStartOffset = tempStart;
mEndOffset = tempEnd;
NotifyOfPivotChange(startPosition, oldStart, oldEnd,
nsIAccessiblePivot::REASON_TEXT,
nsIAccessiblePivot::REASON_NEXT, aBoundary,
(aArgc > 0) ? aIsFromUserInput : true);
return NS_OK;
}
Expand Down Expand Up @@ -452,14 +458,13 @@ nsAccessiblePivot::MovePreviousByText(TextBoundaryType aBoundary,
}

// If the search led to the parent of the node we started on (e.g. when
// starting on a text leaf), start the text movement from the end of that
// node, otherwise we just default to 0.
// starting on a text leaf), start the text movement from the end offset
// of that node. Otherwise we just default to the last offset in the parent.
if (tempStart == -1) {
if (tempPosition != curPosition)
tempStart = text == curPosition->Parent() ?
text->GetChildOffset(curPosition) : text->CharacterCount();
if (tempPosition != curPosition && text == curPosition->Parent())
tempStart = text->GetChildOffset(curPosition) + nsAccUtils::TextLength(curPosition);
else
tempStart = 0;
tempStart = text->CharacterCount();
}

// If there's no more text on the current node, try to find the previous
Expand Down Expand Up @@ -505,6 +510,10 @@ nsAccessiblePivot::MovePreviousByText(TextBoundaryType aBoundary,
startBoundary = nsIAccessibleText::BOUNDARY_WORD_START;
endBoundary = nsIAccessibleText::BOUNDARY_WORD_END;
break;
case LINE_BOUNDARY:
startBoundary = nsIAccessibleText::BOUNDARY_LINE_START;
endBoundary = nsIAccessibleText::BOUNDARY_LINE_END;
break;
default:
return NS_ERROR_INVALID_ARG;
}
Expand Down Expand Up @@ -551,7 +560,7 @@ nsAccessiblePivot::MovePreviousByText(TextBoundaryType aBoundary,
mEndOffset = tempEnd;

NotifyOfPivotChange(startPosition, oldStart, oldEnd,
nsIAccessiblePivot::REASON_TEXT,
nsIAccessiblePivot::REASON_PREV, aBoundary,
(aArgc > 0) ? aIsFromUserInput : true);
return NS_OK;
}
Expand Down Expand Up @@ -651,7 +660,7 @@ nsAccessiblePivot::MovePivotInternal(Accessible* aPosition,
mStartOffset = mEndOffset = -1;

return NotifyOfPivotChange(oldPosition, oldStart, oldEnd, aReason,
aIsFromUserInput);
nsIAccessiblePivot::NO_BOUNDARY, aIsFromUserInput);
}

Accessible*
Expand Down Expand Up @@ -825,13 +834,17 @@ nsAccessiblePivot::SearchForText(Accessible* aAccessible, bool aBackward)
if (temp == root)
break;

// Unlike traditional pre-order traversal we revisit the parent
// nodes when we go up the tree. This is because our starting point
// may be a subtree or a leaf. If it's parent matches, it should
// take precedent over a sibling.
if (temp != aAccessible && temp->IsHyperText())
return temp->AsHyperText();

sibling = aBackward ? temp->PrevSibling() : temp->NextSibling();

if (sibling)
break;

sibling = aBackward ? temp->PrevSibling() : temp->NextSibling();
} while ((temp = temp->Parent()));

if (!sibling)
Expand All @@ -849,7 +862,8 @@ nsAccessiblePivot::SearchForText(Accessible* aAccessible, bool aBackward)
bool
nsAccessiblePivot::NotifyOfPivotChange(Accessible* aOldPosition,
int32_t aOldStart, int32_t aOldEnd,
int16_t aReason, bool aIsFromUserInput)
int16_t aReason, int16_t aBoundaryType,
bool aIsFromUserInput)
{
if (aOldPosition == mPosition &&
aOldStart == mStartOffset && aOldEnd == mEndOffset)
Expand All @@ -862,7 +876,7 @@ nsAccessiblePivot::NotifyOfPivotChange(Accessible* aOldPosition,
obs->OnPivotChanged(this,
xpcOldPos, aOldStart, aOldEnd,
ToXPC(mPosition), mStartOffset, mEndOffset,
aReason, aIsFromUserInput);
aReason, aBoundaryType, aIsFromUserInput);
}

return true;
Expand Down
1 change: 1 addition & 0 deletions accessible/base/nsAccessiblePivot.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class nsAccessiblePivot final : public nsIAccessiblePivot
bool NotifyOfPivotChange(Accessible* aOldAccessible,
int32_t aOldStart, int32_t aOldEnd,
PivotMoveReason aReason,
TextBoundaryType aBoundaryType,
bool aIsFromUserInput);

/*
Expand Down
3 changes: 2 additions & 1 deletion accessible/generic/Accessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,8 @@ Accessible::HandleAccEvent(AccEvent* aEvent)
vcEvent->OldStartOffset(), vcEvent->OldEndOffset(),
position ? reinterpret_cast<uintptr_t>(position->UniqueID()) : 0,
vcEvent->NewStartOffset(), vcEvent->NewEndOffset(),
vcEvent->Reason(), vcEvent->IsFromUserInput());
vcEvent->Reason(), vcEvent->BoundaryType(),
vcEvent->IsFromUserInput());
break;
}
#if defined(XP_WIN)
Expand Down
4 changes: 3 additions & 1 deletion accessible/generic/DocAccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,7 @@ DocAccessible::OnPivotChanged(nsIAccessiblePivot* aPivot,
nsIAccessible* aNewAccessible,
int32_t aNewStart, int32_t aNewEnd,
PivotMoveReason aReason,
TextBoundaryType aBoundaryType,
bool aIsFromUserInput)
{
RefPtr<AccEvent> event =
Expand All @@ -691,7 +692,8 @@ DocAccessible::OnPivotChanged(nsIAccessiblePivot* aPivot,
aOldStart, aOldEnd,
(aNewAccessible ? aNewAccessible->ToInternalAccessible() : nullptr),
aNewStart, aNewEnd,
aReason, aIsFromUserInput ? eFromUserInput : eNoUserInput);
aReason, aBoundaryType,
aIsFromUserInput ? eFromUserInput : eNoUserInput);
nsEventShell::FireEvent(event);

return NS_OK;
Expand Down
5 changes: 3 additions & 2 deletions accessible/interfaces/nsIAccessiblePivot.idl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ interface nsIAccessiblePivotObserver;
[scriptable, uuid(81fe5144-059b-42db-bd3a-f6ce3158d5e9)]
interface nsIAccessiblePivot : nsISupports
{
const TextBoundaryType NO_BOUNDARY = -1;
const TextBoundaryType CHAR_BOUNDARY = 0;
const TextBoundaryType WORD_BOUNDARY = 1;
const TextBoundaryType LINE_BOUNDARY = 2;
Expand All @@ -33,8 +34,7 @@ interface nsIAccessiblePivot : nsISupports
const PivotMoveReason REASON_PREV = 2;
const PivotMoveReason REASON_FIRST = 3;
const PivotMoveReason REASON_LAST = 4;
const PivotMoveReason REASON_TEXT = 5;
const PivotMoveReason REASON_POINT = 6;
const PivotMoveReason REASON_POINT = 5;

/**
* The accessible the pivot is currently pointed at.
Expand Down Expand Up @@ -212,6 +212,7 @@ interface nsIAccessiblePivotObserver : nsISupports
in nsIAccessible aNewAccessible,
in long aNewStart, in long aNewEnd,
in PivotMoveReason aReason,
in TextBoundaryType aBoundaryType,
in boolean aIsFromUserInput);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,9 @@ interface nsIAccessibleVirtualCursorChangeEvent : nsIAccessibleEvent
* Reason for virtual cursor move.
*/
readonly attribute short reason;

/**
* Text boundary type for movement, NO_BOUNDARY if none.
*/
readonly attribute short boundaryType;
};
5 changes: 3 additions & 2 deletions accessible/ipc/DocAccessibleParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ DocAccessibleParent::RecvVirtualCursorChangeEvent(const uint64_t& aID,
const int32_t& aNewStartOffset,
const int32_t& aNewEndOffset,
const int16_t& aReason,
const int16_t& aBoundaryType,
const bool& aFromUser)
{
ProxyAccessible* target = GetAccessible(aID);
Expand All @@ -407,7 +408,7 @@ DocAccessibleParent::RecvVirtualCursorChangeEvent(const uint64_t& aID,
ProxyVirtualCursorChangeEvent(target,
newPosition, aOldStartOffset, aOldEndOffset,
oldPosition, aNewStartOffset, aNewEndOffset,
aReason, aFromUser);
aReason, aBoundaryType, aFromUser);
#endif

xpcAccessibleDocument* doc = GetAccService()->GetXPCDocument(this);
Expand All @@ -419,7 +420,7 @@ DocAccessibleParent::RecvVirtualCursorChangeEvent(const uint64_t& aID,
aOldStartOffset, aOldEndOffset,
GetXPCAccessible(newPosition),
aNewStartOffset, aNewEndOffset,
aReason);
aBoundaryType, aReason);
nsCoreUtils::DispatchAccEvent(std::move(event));

return IPC_OK();
Expand Down
1 change: 1 addition & 0 deletions accessible/ipc/DocAccessibleParent.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class DocAccessibleParent : public ProxyAccessible,
const int32_t& aNewStartOffset,
const int32_t& aNewEndOffset,
const int16_t& aReason,
const int16_t& aBoundaryType,
const bool& aFromUser) override;

mozilla::ipc::IPCResult RecvRoleChangedEvent(const a11y::role& aRole) final;
Expand Down
3 changes: 2 additions & 1 deletion accessible/ipc/other/PDocAccessible.ipdl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ parent:
int32_t aOldStartOffset, int32_t aOldEndOffset,
uint64_t aPosition,
int32_t aStartOffset, int32_t aEndOffset,
int16_t aReason, bool aFromUservcEvent);
int16_t aReason, int16_t aBoundaryType,
bool aFromUservcEvent);

/*
* Tell the parent document to bind the existing document as a new child
Expand Down
3 changes: 2 additions & 1 deletion accessible/ipc/win/PDocAccessible.ipdl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ parent:
int32_t aOldStartOffset, int32_t aOldEndOffset,
uint64_t aPosition,
int32_t aStartOffset, int32_t aEndOffset,
int16_t aReason, bool aFromUservcEvent);
int16_t aReason, int16_t aBoundaryType,
bool aFromUservcEvent);

/*
* Tell the parent document to bind the existing document as a new child
Expand Down
9 changes: 7 additions & 2 deletions accessible/jsat/ContentControl.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ var EXPORTED_SYMBOLS = ["ContentControl"];

const MOVEMENT_GRANULARITY_CHARACTER = 1;
const MOVEMENT_GRANULARITY_WORD = 2;
const MOVEMENT_GRANULARITY_LINE = 4;

const CLIPBOARD_COPY = 0x4000;
const CLIPBOARD_PASTE = 0x8000;
Expand Down Expand Up @@ -326,6 +327,9 @@ this.ContentControl.prototype = {
case MOVEMENT_GRANULARITY_WORD:
pivotGranularity = Ci.nsIAccessiblePivot.WORD_BOUNDARY;
break;
case MOVEMENT_GRANULARITY_LINE:
pivotGranularity = Ci.nsIAccessiblePivot.LINE_BOUNDARY;
break;
default:
return;
}
Expand Down Expand Up @@ -474,8 +478,9 @@ this.ContentControl.prototype = {
if (aOptions.forcePresent) {
this._contentScope.get().sendAsyncMessage(
"AccessFu:Present", Presentation.pivotChanged(
vc.position, null, Ci.nsIAccessiblePivot.REASON_NONE,
vc.startOffset, vc.endOffset));
vc.position, null, vc.startOffset, vc.endOffset,
Ci.nsIAccessiblePivot.REASON_NONE,
Ci.nsIAccessiblePivot.NO_BOUNDARY));
}
};

Expand Down
5 changes: 3 additions & 2 deletions accessible/jsat/EventManager.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,9 @@ this.EventManager.prototype = {
}

this.present(
Presentation.pivotChanged(position, event.oldAccessible, event.reason,
event.newStartOffset, event.newEndOffset));
Presentation.pivotChanged(position, event.oldAccessible,
event.newStartOffset, event.newEndOffset,
event.reason, event.boundaryType));

break;
}
Expand Down
Loading

0 comments on commit 29cc186

Please sign in to comment.