mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-09-24 10:58:20 +00:00
Merge "ImmutableRange: Avoid doing expensive TreeWalker computation twice"
This commit is contained in:
commit
5a5b2e61f1
|
@ -435,14 +435,9 @@ class ImmutableRange {
|
|||
$tw->currentNode = $boundaryPointB[0];
|
||||
|
||||
$AFollowsB = $tw->nextNode();
|
||||
|
||||
if ( $AFollowsB ) {
|
||||
switch ( $this->computePosition( $boundaryPointB, $boundaryPointA ) ) {
|
||||
case 'after':
|
||||
return 'before';
|
||||
case 'before':
|
||||
return 'after';
|
||||
}
|
||||
// Swap variables
|
||||
[ $boundaryPointB, $boundaryPointA ] = [ $boundaryPointA, $boundaryPointB ];
|
||||
}
|
||||
|
||||
$ancestor = $boundaryPointB[0]->parentNode;
|
||||
|
@ -467,11 +462,11 @@ class ImmutableRange {
|
|||
}
|
||||
|
||||
if ( CommentUtils::childIndexOf( $child ) < $boundaryPointA[1] ) {
|
||||
return 'after';
|
||||
return $AFollowsB ? 'before' : 'after';
|
||||
}
|
||||
}
|
||||
|
||||
return 'before';
|
||||
return $AFollowsB ? 'after' : 'before';
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue