Bug 1598060 - removing walker actor/front passing as an argument where not necessary. r=rcaliman

Differential Revision: https://phabricator.services.mozilla.com/D54339

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Yura Zenevich 2019-11-26 19:03:01 +00:00
Родитель 5758a8c26c
Коммит b7e64c314b
4 изменённых файлов: 19 добавлений и 20 удалений

Просмотреть файл

@ -114,8 +114,9 @@ class AccessibilityTree extends Component {
* accessible walker as a parent.
*/
onNameChange(accessible, parent) {
const { accessibles, accessibilityWalker, dispatch } = this.props;
parent = parent || accessibilityWalker;
const { accessibles, dispatch } = this.props;
const accessibilityWalkerFront = accessible.parent();
parent = parent || accessibilityWalkerFront;
if (
accessibles.has(accessible.actorID) ||

Просмотреть файл

@ -655,8 +655,7 @@ const AccessibleWalkerActor = ActorClassWithSpec(accessibleWalkerSpec, {
rawAccessible.name,
event.DOMNode == this.rootDoc
? undefined
: this.getRef(rawAccessible.parent),
this
: this.getRef(rawAccessible.parent)
);
}
break;
@ -681,7 +680,7 @@ const AccessibleWalkerActor = ActorClassWithSpec(accessibleWalkerSpec, {
.forEach(child =>
events.emit(child, "index-in-parent-change", child.indexInParent)
);
events.emit(accessible, "reorder", rawAccessible.childCount, this);
events.emit(accessible, "reorder", rawAccessible.childCount);
}
break;
case EVENT_HIDE:
@ -701,7 +700,7 @@ const AccessibleWalkerActor = ActorClassWithSpec(accessibleWalkerSpec, {
case EVENT_TEXT_INSERTED:
case EVENT_TEXT_REMOVED:
if (accessible) {
events.emit(accessible, "text-change", this);
events.emit(accessible, "text-change");
if (NAME_FROM_SUBTREE_RULE_ROLES.has(rawAccessible.role)) {
events.emit(
accessible,
@ -709,8 +708,7 @@ const AccessibleWalkerActor = ActorClassWithSpec(accessibleWalkerSpec, {
rawAccessible.name,
event.DOMNode == this.rootDoc
? undefined
: this.getRef(rawAccessible.parent),
this
: this.getRef(rawAccessible.parent)
);
}
}

Просмотреть файл

@ -91,12 +91,13 @@ class AccessibleFront extends FrontClassWithSpec(accessibleSpec) {
Object.assign(this._form, form);
}
nameChange(name, parent, walker) {
nameChange(name, parent) {
this._form.name = name;
// Name change event affects the tree rendering, we fire this event on
// accessibility walker as the point of interaction for UI.
if (walker) {
events.emit(walker, "name-change", this, parent);
const accessibilityWalkerFront = this.parent();
if (accessibilityWalkerFront) {
events.emit(accessibilityWalkerFront, "name-change", this, parent);
}
}
@ -112,20 +113,22 @@ class AccessibleFront extends FrontClassWithSpec(accessibleSpec) {
this._form.keyboardShortcut = keyboardShortcut;
}
reorder(childCount, walker) {
reorder(childCount) {
this._form.childCount = childCount;
// Reorder event affects the tree rendering, we fire this event on
// accessibility walker as the point of interaction for UI.
if (walker) {
events.emit(walker, "reorder", this);
const accessibilityWalkerFront = this.parent();
if (accessibilityWalkerFront) {
events.emit(accessibilityWalkerFront, "reorder", this);
}
}
textChange(walker) {
textChange() {
// Text event affects the tree rendering, we fire this event on
// accessibility walker as the point of interaction for UI.
if (walker) {
events.emit(walker, "text-change", this);
const accessibilityWalkerFront = this.parent();
if (accessibilityWalkerFront) {
events.emit(accessibilityWalkerFront, "text-change", this);
}
}

Просмотреть файл

@ -55,7 +55,6 @@ const accessibleSpec = generateActorSpec({
type: "nameChange",
name: Arg(0, "string"),
parent: Arg(1, "nullable:accessible"),
walker: Arg(2, "nullable:accessiblewalker"),
},
"value-change": {
type: "valueChange",
@ -80,11 +79,9 @@ const accessibleSpec = generateActorSpec({
reorder: {
type: "reorder",
childCount: Arg(0, "number"),
walker: Arg(1, "nullable:accessiblewalker"),
},
"text-change": {
type: "textChange",
walker: Arg(0, "nullable:accessiblewalker"),
},
"index-in-parent-change": {
type: "indexInParentChange",