IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
14 | 14 | |
15 | 15 | var node, |
16 | 16 | range = this.range, |
| 17 | startCt = range.startContainer, |
| 18 | endCt = range.endContainer, |
| 19 | startOffset = range.startOffset, |
| 20 | endOffset = range.endOffset, |
17 | 21 | guard, |
18 | 22 | userGuard = this.guard, |
19 | 23 | type = this.type, |
… |
… |
|
24 | 28 | { |
25 | 29 | this._.start = 1; |
26 | 30 | |
27 | | // Trim text nodes and optmize the range boundaries. DOM changes |
28 | | // may happen at this point. |
29 | | range.trim(); |
30 | | |
31 | 31 | // A collapsed range must return null at first call. |
32 | 32 | if ( range.collapsed ) |
33 | 33 | { |
… |
… |
|
39 | 39 | // Create the LTR guard function, if necessary. |
40 | 40 | if ( !rtl && !this._.guardLTR ) |
41 | 41 | { |
42 | | // Gets the node that stops the walker when going LTR. |
43 | | var limitLTR = range.endContainer, |
44 | | blockerLTR = limitLTR.getChild( range.endOffset ); |
| 42 | // The node that stops walker from moving up. |
| 43 | var limitLTR = endCt.type == CKEDITOR.NODE_ELEMENT ? |
| 44 | endCt : |
| 45 | endCt.getParent(); |
45 | 46 | |
| 47 | // The node that stops the walker from going to next. |
| 48 | var blockerLTR = endCt.type == CKEDITOR.NODE_ELEMENT ? |
| 49 | endCt.getChild( endOffset ) : |
| 50 | endCt.getNext(); |
| 51 | |
46 | 52 | this._.guardLTR = function( node, movingOut ) |
47 | 53 | { |
48 | 54 | return ( ( !movingOut || !limitLTR.equals( node ) ) |
… |
… |
|
54 | 60 | // Create the RTL guard function, if necessary. |
55 | 61 | if ( rtl && !this._.guardRTL ) |
56 | 62 | { |
57 | | // Gets the node that stops the walker when going LTR. |
58 | | var limitRTL = range.startContainer, |
59 | | blockerRTL = ( range.startOffset > 0 ) && limitRTL.getChild( range.startOffset - 1 ); |
| 63 | // The node that stops walker from moving up. |
| 64 | var limitRTL = startCt.type == CKEDITOR.NODE_ELEMENT ? |
| 65 | startCt : |
| 66 | startCt.getParent(); |
60 | 67 | |
| 68 | // The node that stops the walker from going to next. |
| 69 | var blockerRTL = startCt.type == CKEDITOR.NODE_ELEMENT ? |
| 70 | startOffset ? |
| 71 | startCt.getChild( startOffset - 1 ) : null : |
| 72 | startCt.getPrevious(); |
| 73 | |
61 | 74 | this._.guardRTL = function( node, movingOut ) |
62 | 75 | { |
63 | 76 | return ( ( !movingOut || !limitRTL.equals( node ) ) |
… |
… |
|
89 | 102 | else |
90 | 103 | { |
91 | 104 | // Get the first node to be returned. |
92 | | |
93 | 105 | if ( rtl ) |
94 | 106 | { |
95 | | node = range.endContainer; |
| 107 | node = endCt; |
96 | 108 | |
97 | | if ( range.endOffset > 0 ) |
| 109 | if ( node.type == CKEDITOR.NODE_ELEMENT ) |
98 | 110 | { |
99 | | node = node.getChild( range.endOffset - 1 ); |
100 | | if ( guard( node ) === false ) |
101 | | node = null; |
102 | | } |
103 | | else |
104 | | node = ( guard ( node, true ) === false ) ? |
105 | | null : node.getPreviousSourceNode( true, type, guard ); |
106 | | } |
| 111 | if ( endOffset > 0 ) |
| 112 | node = node.getChild( endOffset - 1 ); |
| 113 | else |
| 114 | node = ( guard ( node, true ) === false ) ? |
| 115 | null : node.getPreviousSourceNode( true, type, guard ); |
| 116 | } |
| 117 | } |
107 | 118 | else |
108 | 119 | { |
109 | | node = range.startContainer; |
110 | | node = node.getChild( range.startOffset ); |
| 120 | node = startCt; |
111 | 121 | |
112 | | if ( node ) |
| 122 | if ( node.type == CKEDITOR.NODE_ELEMENT ) |
113 | 123 | { |
114 | | if ( guard( node ) === false ) |
115 | | node = null; |
| 124 | if ( ! ( node = node.getChild( startOffset ) ) ) |
| 125 | node = ( guard ( startCt, true ) === false ) ? |
| 126 | null : startCt.getNextSourceNode( true, type, guard ) ; |
116 | 127 | } |
117 | | else |
118 | | node = ( guard ( range.startContainer, true ) === false ) ? |
119 | | null : range.startContainer.getNextSourceNode( true, type, guard ) ; |
120 | 128 | } |
| 129 | |
| 130 | if ( node && guard( node ) === false ) |
| 131 | node = null; |
121 | 132 | } |
122 | 133 | |
123 | 134 | while ( node && !this._.end ) |