@@ -2,7 +2,6 @@ import { getNodeFromTree, memoize } from '../../core/utils';
2
2
import { sanitize } from '../text' ;
3
3
import { getIntersectionRect , getRectCenter , isPointInRect } from '../math' ;
4
4
import getOverflowHiddenAncestors from './get-overflow-hidden-ancestors' ;
5
- import cache from '../../core/base/cache' ;
6
5
7
6
/**
8
7
* Get the visible text client rects of a node.
@@ -12,29 +11,30 @@ import cache from '../../core/base/cache';
12
11
* @param {Element } node
13
12
*/
14
13
const getVisibleChildTextRects = memoize (
15
- function getVisibleChildTextRectsMemoized ( node ) {
14
+ function getVisibleChildTextRectsMemoized ( node , ruleId = null ) {
16
15
const vNode = getNodeFromTree ( node ) ;
17
16
const nodeRect = vNode . boundingClientRect ;
18
17
const clientRects = [ ] ;
19
- const overflowHiddenNodes = getOverflowHiddenAncestors ( vNode ) ;
18
+ const overflowHiddenNodes = getOverflowHiddenAncestors ( vNode , ruleId ) ;
20
19
21
20
node . childNodes . forEach ( textNode => {
22
21
if ( textNode . nodeType !== 3 || sanitize ( textNode . nodeValue ) === '' ) {
23
22
return ;
24
23
}
25
24
26
25
const contentRects = getContentRects ( textNode ) ;
27
- if (
28
- isOutsideNodeBounds ( contentRects , nodeRect ) &&
29
- ! cache . get ( '200%ZoomRule' )
30
- ) {
26
+ if ( isOutsideNodeBounds ( contentRects , nodeRect ) && ! ruleId ) {
31
27
return ;
32
28
}
33
29
34
30
clientRects . push ( ...filterHiddenRects ( contentRects , overflowHiddenNodes ) ) ;
35
31
} ) ;
36
32
37
- if ( clientRects . length <= 0 && cache . get ( '200%ZoomRule' ) ) {
33
+ if (
34
+ clientRects . length <= 0 &&
35
+ ruleId &&
36
+ ruleId === 'zoom-text-overlap-viewport'
37
+ ) {
38
38
return [ ] ;
39
39
}
40
40
/**
0 commit comments