Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: Source/core/editing/TextIterator.cpp

Issue 319083004: Oilpan: add Element/Node Member fields to stack allocated objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/editing/TextIterator.h ('k') | Source/core/html/LinkResource.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved.
3 * Copyright (C) 2005 Alexey Proskuryakov. 3 * Copyright (C) 2005 Alexey Proskuryakov.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 for (size_t i = 0; i < size; ++i) 234 for (size_t i = 0; i < size; ++i)
235 pushFullyClippedState(stack, ancestry[size - i - 1]); 235 pushFullyClippedState(stack, ancestry[size - i - 1]);
236 pushFullyClippedState(stack, node); 236 pushFullyClippedState(stack, node);
237 237
238 ASSERT(stack.size() == 1 + depthCrossingShadowBoundaries(node)); 238 ASSERT(stack.size() == 1 + depthCrossingShadowBoundaries(node));
239 } 239 }
240 240
241 // -------- 241 // --------
242 242
243 TextIterator::TextIterator(const Range* range, TextIteratorBehaviorFlags behavio r) 243 TextIterator::TextIterator(const Range* range, TextIteratorBehaviorFlags behavio r)
244 : m_startContainer(0) 244 : m_startContainer(nullptr)
245 , m_startOffset(0) 245 , m_startOffset(0)
246 , m_endContainer(0) 246 , m_endContainer(nullptr)
247 , m_endOffset(0) 247 , m_endOffset(0)
248 , m_positionNode(0) 248 , m_positionNode(nullptr)
249 , m_textLength(0) 249 , m_textLength(0)
250 , m_needsAnotherNewline(false) 250 , m_needsAnotherNewline(false)
251 , m_textBox(0) 251 , m_textBox(0)
252 , m_remainingTextBox(0) 252 , m_remainingTextBox(0)
253 , m_firstLetterText(0) 253 , m_firstLetterText(0)
254 , m_lastTextNode(0) 254 , m_lastTextNode(nullptr)
255 , m_lastTextNodeEndedWithCollapsedSpace(false) 255 , m_lastTextNodeEndedWithCollapsedSpace(false)
256 , m_lastCharacter(0) 256 , m_lastCharacter(0)
257 , m_sortedTextBoxesPosition(0) 257 , m_sortedTextBoxesPosition(0)
258 , m_hasEmitted(false) 258 , m_hasEmitted(false)
259 , m_emitsCharactersBetweenAllVisiblePositions(behavior & TextIteratorEmitsCh aractersBetweenAllVisiblePositions) 259 , m_emitsCharactersBetweenAllVisiblePositions(behavior & TextIteratorEmitsCh aractersBetweenAllVisiblePositions)
260 , m_entersTextControls(behavior & TextIteratorEntersTextControls) 260 , m_entersTextControls(behavior & TextIteratorEntersTextControls)
261 , m_emitsOriginalText(behavior & TextIteratorEmitsOriginalText) 261 , m_emitsOriginalText(behavior & TextIteratorEmitsOriginalText)
262 , m_handledFirstLetter(false) 262 , m_handledFirstLetter(false)
263 , m_ignoresStyleVisibility(behavior & TextIteratorIgnoresStyleVisibility) 263 , m_ignoresStyleVisibility(behavior & TextIteratorIgnoresStyleVisibility)
264 , m_stopsOnFormControls(behavior & TextIteratorStopsOnFormControls) 264 , m_stopsOnFormControls(behavior & TextIteratorStopsOnFormControls)
265 , m_shouldStop(false) 265 , m_shouldStop(false)
266 , m_emitsImageAltText(behavior & TextIteratorEmitsImageAltText) 266 , m_emitsImageAltText(behavior & TextIteratorEmitsImageAltText)
267 , m_entersAuthorShadowRoots(behavior & TextIteratorEntersAuthorShadowRoots) 267 , m_entersAuthorShadowRoots(behavior & TextIteratorEntersAuthorShadowRoots)
268 { 268 {
269 if (range) 269 if (range)
270 initialize(range->startPosition(), range->endPosition()); 270 initialize(range->startPosition(), range->endPosition());
271 } 271 }
272 272
273 TextIterator::TextIterator(const Position& start, const Position& end, TextItera torBehaviorFlags behavior) 273 TextIterator::TextIterator(const Position& start, const Position& end, TextItera torBehaviorFlags behavior)
274 : m_startContainer(0) 274 : m_startContainer(nullptr)
275 , m_startOffset(0) 275 , m_startOffset(0)
276 , m_endContainer(0) 276 , m_endContainer(nullptr)
277 , m_endOffset(0) 277 , m_endOffset(0)
278 , m_positionNode(0) 278 , m_positionNode(nullptr)
279 , m_textLength(0) 279 , m_textLength(0)
280 , m_needsAnotherNewline(false) 280 , m_needsAnotherNewline(false)
281 , m_textBox(0) 281 , m_textBox(0)
282 , m_remainingTextBox(0) 282 , m_remainingTextBox(0)
283 , m_firstLetterText(0) 283 , m_firstLetterText(0)
284 , m_lastTextNode(0) 284 , m_lastTextNode(nullptr)
285 , m_lastTextNodeEndedWithCollapsedSpace(false) 285 , m_lastTextNodeEndedWithCollapsedSpace(false)
286 , m_lastCharacter(0) 286 , m_lastCharacter(0)
287 , m_sortedTextBoxesPosition(0) 287 , m_sortedTextBoxesPosition(0)
288 , m_hasEmitted(false) 288 , m_hasEmitted(false)
289 , m_emitsCharactersBetweenAllVisiblePositions(behavior & TextIteratorEmitsCh aractersBetweenAllVisiblePositions) 289 , m_emitsCharactersBetweenAllVisiblePositions(behavior & TextIteratorEmitsCh aractersBetweenAllVisiblePositions)
290 , m_entersTextControls(behavior & TextIteratorEntersTextControls) 290 , m_entersTextControls(behavior & TextIteratorEntersTextControls)
291 , m_emitsOriginalText(behavior & TextIteratorEmitsOriginalText) 291 , m_emitsOriginalText(behavior & TextIteratorEmitsOriginalText)
292 , m_handledFirstLetter(false) 292 , m_handledFirstLetter(false)
293 , m_ignoresStyleVisibility(behavior & TextIteratorIgnoresStyleVisibility) 293 , m_ignoresStyleVisibility(behavior & TextIteratorIgnoresStyleVisibility)
294 , m_stopsOnFormControls(behavior & TextIteratorStopsOnFormControls) 294 , m_stopsOnFormControls(behavior & TextIteratorStopsOnFormControls)
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 TextIterator::~TextIterator() 354 TextIterator::~TextIterator()
355 { 355 {
356 } 356 }
357 357
358 void TextIterator::advance() 358 void TextIterator::advance()
359 { 359 {
360 if (m_shouldStop) 360 if (m_shouldStop)
361 return; 361 return;
362 362
363 // reset the run information 363 // reset the run information
364 m_positionNode = 0; 364 m_positionNode = nullptr;
365 m_textLength = 0; 365 m_textLength = 0;
366 366
367 // handle remembered node that needed a newline after the text node's newlin e 367 // handle remembered node that needed a newline after the text node's newlin e
368 if (m_needsAnotherNewline) { 368 if (m_needsAnotherNewline) {
369 // Emit the extra newline, and position it *inside* m_node, after m_node 's 369 // Emit the extra newline, and position it *inside* m_node, after m_node 's
370 // contents, in case it's a block, in the same way that we position the first 370 // contents, in case it's a block, in the same way that we position the first
371 // newline. The range for the emitted newline should start where the lin e 371 // newline. The range for the emitted newline should start where the lin e
372 // break begins. 372 // break begins.
373 // FIXME: It would be cleaner if we emitted two newlines during the last 373 // FIXME: It would be cleaner if we emitted two newlines during the last
374 // iteration, instead of using m_needsAnotherNewline. 374 // iteration, instead of using m_needsAnotherNewline.
375 Node* baseNode = m_node->lastChild() ? m_node->lastChild() : m_node; 375 Node* baseNode = m_node->lastChild() ? m_node->lastChild() : m_node.get( );
376 emitCharacter('\n', baseNode->parentNode(), baseNode, 1, 1); 376 emitCharacter('\n', baseNode->parentNode(), baseNode, 1, 1);
377 m_needsAnotherNewline = false; 377 m_needsAnotherNewline = false;
378 return; 378 return;
379 } 379 }
380 380
381 if (!m_textBox && m_remainingTextBox) { 381 if (!m_textBox && m_remainingTextBox) {
382 m_textBox = m_remainingTextBox; 382 m_textBox = m_remainingTextBox;
383 m_remainingTextBox = 0; 383 m_remainingTextBox = 0;
384 m_firstLetterText = 0; 384 m_firstLetterText = 0;
385 m_offset = 0; 385 m_offset = 0;
386 } 386 }
387 // handle remembered text box 387 // handle remembered text box
388 if (m_textBox) { 388 if (m_textBox) {
389 handleTextBox(); 389 handleTextBox();
390 if (m_positionNode) 390 if (m_positionNode)
391 return; 391 return;
392 } 392 }
393 393
394 while (m_node && (m_node != m_pastEndNode || m_shadowDepth > 0)) { 394 while (m_node && (m_node != m_pastEndNode || m_shadowDepth > 0)) {
395 if (!m_shouldStop && m_stopsOnFormControls && HTMLFormControlElement::en closingFormControlElement(m_node)) 395 if (!m_shouldStop && m_stopsOnFormControls && HTMLFormControlElement::en closingFormControlElement(m_node))
396 m_shouldStop = true; 396 m_shouldStop = true;
397 397
398 // if the range ends at offset 0 of an element, represent the 398 // if the range ends at offset 0 of an element, represent the
399 // position, but not the content, of that element e.g. if the 399 // position, but not the content, of that element e.g. if the
400 // node is a blockflow element, emit a newline that 400 // node is a blockflow element, emit a newline that
401 // precedes the element 401 // precedes the element
402 if (m_node == m_endContainer && !m_endOffset) { 402 if (m_node == m_endContainer && !m_endOffset) {
403 representNodeOffsetZero(); 403 representNodeOffsetZero();
404 m_node = 0; 404 m_node = nullptr;
405 return; 405 return;
406 } 406 }
407 407
408 RenderObject* renderer = m_node->renderer(); 408 RenderObject* renderer = m_node->renderer();
409 if (!renderer) { 409 if (!renderer) {
410 if (m_node->isShadowRoot()) { 410 if (m_node->isShadowRoot()) {
411 // A shadow root doesn't have a renderer, but we want to visit c hildren anyway. 411 // A shadow root doesn't have a renderer, but we want to visit c hildren anyway.
412 m_iterationProgress = m_iterationProgress < HandledNode ? Handle dNode : m_iterationProgress; 412 m_iterationProgress = m_iterationProgress < HandledNode ? Handle dNode : m_iterationProgress;
413 } else { 413 } else {
414 m_iterationProgress = HandledChildren; 414 m_iterationProgress = HandledChildren;
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 // prevent emitting a newline when exiting a collapsed block at beginning of the range 1074 // prevent emitting a newline when exiting a collapsed block at beginning of the range
1075 // FIXME: !m_hasEmitted does not necessarily mean there was a collapsed bloc k... it could 1075 // FIXME: !m_hasEmitted does not necessarily mean there was a collapsed bloc k... it could
1076 // have been an hr (e.g.). Also, a collapsed block could have height (e.g. a table) and 1076 // have been an hr (e.g.). Also, a collapsed block could have height (e.g. a table) and
1077 // therefore look like a blank line. 1077 // therefore look like a blank line.
1078 if (!m_hasEmitted) 1078 if (!m_hasEmitted)
1079 return; 1079 return;
1080 1080
1081 // Emit with a position *inside* m_node, after m_node's contents, in 1081 // Emit with a position *inside* m_node, after m_node's contents, in
1082 // case it is a block, because the run should start where the 1082 // case it is a block, because the run should start where the
1083 // emitted character is positioned visually. 1083 // emitted character is positioned visually.
1084 Node* baseNode = m_node->lastChild() ? m_node->lastChild() : m_node; 1084 Node* baseNode = m_node->lastChild() ? m_node->lastChild() : m_node.get();
1085 // FIXME: This shouldn't require the m_lastTextNode to be true, but we can't change that without making 1085 // FIXME: This shouldn't require the m_lastTextNode to be true, but we can't change that without making
1086 // the logic in _web_attributedStringFromRange match. We'll get that for fre e when we switch to use 1086 // the logic in _web_attributedStringFromRange match. We'll get that for fre e when we switch to use
1087 // TextIterator in _web_attributedStringFromRange. 1087 // TextIterator in _web_attributedStringFromRange.
1088 // See <rdar://problem/5428427> for an example of how this mismatch will cau se problems. 1088 // See <rdar://problem/5428427> for an example of how this mismatch will cau se problems.
1089 if (m_lastTextNode && shouldEmitNewlineAfterNode(*m_node)) { 1089 if (m_lastTextNode && shouldEmitNewlineAfterNode(*m_node)) {
1090 // use extra newline to represent margin bottom, as needed 1090 // use extra newline to represent margin bottom, as needed
1091 bool addNewline = shouldEmitExtraNewlineForNode(m_node); 1091 bool addNewline = shouldEmitExtraNewlineForNode(m_node);
1092 1092
1093 // FIXME: We need to emit a '\n' as we leave an empty block(s) that 1093 // FIXME: We need to emit a '\n' as we leave an empty block(s) that
1094 // contain a VisiblePosition when doing selection preservation. 1094 // contain a VisiblePosition when doing selection preservation.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 void TextIterator::emitText(Node* textNode, RenderObject* renderObject, int text StartOffset, int textEndOffset) 1133 void TextIterator::emitText(Node* textNode, RenderObject* renderObject, int text StartOffset, int textEndOffset)
1134 { 1134 {
1135 RenderText* renderer = toRenderText(renderObject); 1135 RenderText* renderer = toRenderText(renderObject);
1136 m_text = m_emitsOriginalText ? renderer->originalText() : renderer->text(); 1136 m_text = m_emitsOriginalText ? renderer->originalText() : renderer->text();
1137 ASSERT(!m_text.isEmpty()); 1137 ASSERT(!m_text.isEmpty());
1138 ASSERT(0 <= textStartOffset && textStartOffset < static_cast<int>(m_text.len gth())); 1138 ASSERT(0 <= textStartOffset && textStartOffset < static_cast<int>(m_text.len gth()));
1139 ASSERT(0 <= textEndOffset && textEndOffset <= static_cast<int>(m_text.length ())); 1139 ASSERT(0 <= textEndOffset && textEndOffset <= static_cast<int>(m_text.length ()));
1140 ASSERT(textStartOffset <= textEndOffset); 1140 ASSERT(textStartOffset <= textEndOffset);
1141 1141
1142 m_positionNode = textNode; 1142 m_positionNode = textNode;
1143 m_positionOffsetBaseNode = 0; 1143 m_positionOffsetBaseNode = nullptr;
1144 m_positionStartOffset = textStartOffset; 1144 m_positionStartOffset = textStartOffset;
1145 m_positionEndOffset = textEndOffset; 1145 m_positionEndOffset = textEndOffset;
1146 m_singleCharacterBuffer = 0; 1146 m_singleCharacterBuffer = 0;
1147 m_textLength = textEndOffset - textStartOffset; 1147 m_textLength = textEndOffset - textStartOffset;
1148 m_lastCharacter = m_text[textEndOffset - 1]; 1148 m_lastCharacter = m_text[textEndOffset - 1];
1149 1149
1150 m_lastTextNodeEndedWithCollapsedSpace = false; 1150 m_lastTextNodeEndedWithCollapsedSpace = false;
1151 m_hasEmitted = true; 1151 m_hasEmitted = true;
1152 } 1152 }
1153 1153
1154 void TextIterator::emitText(Node* textNode, int textStartOffset, int textEndOffs et) 1154 void TextIterator::emitText(Node* textNode, int textStartOffset, int textEndOffs et)
1155 { 1155 {
1156 emitText(textNode, m_node->renderer(), textStartOffset, textEndOffset); 1156 emitText(textNode, m_node->renderer(), textStartOffset, textEndOffset);
1157 } 1157 }
1158 1158
1159 PassRefPtrWillBeRawPtr<Range> TextIterator::range() const 1159 PassRefPtrWillBeRawPtr<Range> TextIterator::range() const
1160 { 1160 {
1161 // use the current run information, if we have it 1161 // use the current run information, if we have it
1162 if (m_positionNode) { 1162 if (m_positionNode) {
1163 if (m_positionOffsetBaseNode) { 1163 if (m_positionOffsetBaseNode) {
1164 int index = m_positionOffsetBaseNode->nodeIndex(); 1164 int index = m_positionOffsetBaseNode->nodeIndex();
1165 m_positionStartOffset += index; 1165 m_positionStartOffset += index;
1166 m_positionEndOffset += index; 1166 m_positionEndOffset += index;
1167 m_positionOffsetBaseNode = 0; 1167 m_positionOffsetBaseNode = nullptr;
1168 } 1168 }
1169 return Range::create(m_positionNode->document(), m_positionNode, m_posit ionStartOffset, m_positionNode, m_positionEndOffset); 1169 return Range::create(m_positionNode->document(), m_positionNode, m_posit ionStartOffset, m_positionNode, m_positionEndOffset);
1170 } 1170 }
1171 1171
1172 // otherwise, return the end of the overall range we were given 1172 // otherwise, return the end of the overall range we were given
1173 if (m_endContainer) 1173 if (m_endContainer)
1174 return Range::create(m_endContainer->document(), m_endContainer, m_endOf fset, m_endContainer, m_endOffset); 1174 return Range::create(m_endContainer->document(), m_endContainer, m_endOf fset, m_endContainer, m_endOffset);
1175 1175
1176 return nullptr; 1176 return nullptr;
1177 } 1177 }
1178 1178
1179 Node* TextIterator::node() const 1179 Node* TextIterator::node() const
1180 { 1180 {
1181 RefPtrWillBeRawPtr<Range> textRange = range(); 1181 RefPtrWillBeRawPtr<Range> textRange = range();
1182 if (!textRange) 1182 if (!textRange)
1183 return 0; 1183 return 0;
1184 1184
1185 Node* node = textRange->startContainer(); 1185 Node* node = textRange->startContainer();
1186 if (!node) 1186 if (!node)
1187 return 0; 1187 return 0;
1188 if (node->offsetInCharacters()) 1188 if (node->offsetInCharacters())
1189 return node; 1189 return node;
1190 1190
1191 return node->traverseToChildAt(textRange->startOffset()); 1191 return node->traverseToChildAt(textRange->startOffset());
1192 } 1192 }
1193 1193
1194 // -------- 1194 // --------
1195 1195
1196 SimplifiedBackwardsTextIterator::SimplifiedBackwardsTextIterator(const Range* r, TextIteratorBehaviorFlags behavior) 1196 SimplifiedBackwardsTextIterator::SimplifiedBackwardsTextIterator(const Range* r, TextIteratorBehaviorFlags behavior)
1197 : m_node(0) 1197 : m_node(nullptr)
1198 , m_offset(0) 1198 , m_offset(0)
1199 , m_handledNode(false) 1199 , m_handledNode(false)
1200 , m_handledChildren(false) 1200 , m_handledChildren(false)
1201 , m_startNode(0) 1201 , m_startNode(nullptr)
1202 , m_startOffset(0) 1202 , m_startOffset(0)
1203 , m_endNode(0) 1203 , m_endNode(nullptr)
1204 , m_endOffset(0) 1204 , m_endOffset(0)
1205 , m_positionNode(0) 1205 , m_positionNode(nullptr)
1206 , m_positionStartOffset(0) 1206 , m_positionStartOffset(0)
1207 , m_positionEndOffset(0) 1207 , m_positionEndOffset(0)
1208 , m_textOffset(0) 1208 , m_textOffset(0)
1209 , m_textLength(0) 1209 , m_textLength(0)
1210 , m_lastTextNode(0) 1210 , m_lastTextNode(nullptr)
1211 , m_lastCharacter(0) 1211 , m_lastCharacter(0)
1212 , m_singleCharacterBuffer(0) 1212 , m_singleCharacterBuffer(0)
1213 , m_havePassedStartNode(false) 1213 , m_havePassedStartNode(false)
1214 , m_shouldHandleFirstLetter(false) 1214 , m_shouldHandleFirstLetter(false)
1215 , m_stopsOnFormControls(behavior & TextIteratorStopsOnFormControls) 1215 , m_stopsOnFormControls(behavior & TextIteratorStopsOnFormControls)
1216 , m_shouldStop(false) 1216 , m_shouldStop(false)
1217 , m_emitsOriginalText(false) 1217 , m_emitsOriginalText(false)
1218 { 1218 {
1219 ASSERT(behavior == TextIteratorDefaultBehavior || behavior == TextIteratorSt opsOnFormControls); 1219 ASSERT(behavior == TextIteratorDefaultBehavior || behavior == TextIteratorSt opsOnFormControls);
1220 1220
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1254 m_startNode = startNode; 1254 m_startNode = startNode;
1255 m_startOffset = startOffset; 1255 m_startOffset = startOffset;
1256 m_endNode = endNode; 1256 m_endNode = endNode;
1257 m_endOffset = endOffset; 1257 m_endOffset = endOffset;
1258 1258
1259 #ifndef NDEBUG 1259 #ifndef NDEBUG
1260 // Need this just because of the assert. 1260 // Need this just because of the assert.
1261 m_positionNode = endNode; 1261 m_positionNode = endNode;
1262 #endif 1262 #endif
1263 1263
1264 m_lastTextNode = 0; 1264 m_lastTextNode = nullptr;
1265 m_lastCharacter = '\n'; 1265 m_lastCharacter = '\n';
1266 1266
1267 m_havePassedStartNode = false; 1267 m_havePassedStartNode = false;
1268 1268
1269 advance(); 1269 advance();
1270 } 1270 }
1271 1271
1272 void SimplifiedBackwardsTextIterator::advance() 1272 void SimplifiedBackwardsTextIterator::advance()
1273 { 1273 {
1274 ASSERT(m_positionNode); 1274 ASSERT(m_positionNode);
1275 1275
1276 if (m_shouldStop) 1276 if (m_shouldStop)
1277 return; 1277 return;
1278 1278
1279 if (m_stopsOnFormControls && HTMLFormControlElement::enclosingFormControlEle ment(m_node)) { 1279 if (m_stopsOnFormControls && HTMLFormControlElement::enclosingFormControlEle ment(m_node)) {
1280 m_shouldStop = true; 1280 m_shouldStop = true;
1281 return; 1281 return;
1282 } 1282 }
1283 1283
1284 m_positionNode = 0; 1284 m_positionNode = nullptr;
1285 m_textLength = 0; 1285 m_textLength = 0;
1286 1286
1287 while (m_node && !m_havePassedStartNode) { 1287 while (m_node && !m_havePassedStartNode) {
1288 // Don't handle node if we start iterating at [node, 0]. 1288 // Don't handle node if we start iterating at [node, 0].
1289 if (!m_handledNode && !(m_node == m_endNode && !m_endOffset)) { 1289 if (!m_handledNode && !(m_node == m_endNode && !m_endOffset)) {
1290 RenderObject* renderer = m_node->renderer(); 1290 RenderObject* renderer = m_node->renderer();
1291 if (renderer && renderer->isText() && m_node->nodeType() == Node::TE XT_NODE) { 1291 if (renderer && renderer->isText() && m_node->nodeType() == Node::TE XT_NODE) {
1292 // FIXME: What about CDATA_SECTION_NODE? 1292 // FIXME: What about CDATA_SECTION_NODE?
1293 if (renderer->style()->visibility() == VISIBLE && m_offset > 0) 1293 if (renderer->style()->visibility() == VISIBLE && m_offset > 0)
1294 m_handledNode = handleTextNode(); 1294 m_handledNode = handleTextNode();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1330 m_handledNode = true; 1330 m_handledNode = true;
1331 m_handledChildren = true; 1331 m_handledChildren = true;
1332 return; 1332 return;
1333 } 1333 }
1334 } 1334 }
1335 1335
1336 m_fullyClippedStack.pop(); 1336 m_fullyClippedStack.pop();
1337 if (advanceRespectingRange(m_node->previousSibling())) 1337 if (advanceRespectingRange(m_node->previousSibling()))
1338 pushFullyClippedState(m_fullyClippedStack, m_node); 1338 pushFullyClippedState(m_fullyClippedStack, m_node);
1339 else 1339 else
1340 m_node = 0; 1340 m_node = nullptr;
1341 } 1341 }
1342 1342
1343 // For the purpose of word boundary detection, 1343 // For the purpose of word boundary detection,
1344 // we should iterate all visible text and trailing (collapsed) whitespac es. 1344 // we should iterate all visible text and trailing (collapsed) whitespac es.
1345 m_offset = m_node ? maxOffsetIncludingCollapsedSpaces(m_node) : 0; 1345 m_offset = m_node ? maxOffsetIncludingCollapsedSpaces(m_node) : 0;
1346 m_handledNode = false; 1346 m_handledNode = false;
1347 m_handledChildren = false; 1347 m_handledChildren = false;
1348 1348
1349 if (m_positionNode) 1349 if (m_positionNode)
1350 return; 1350 return;
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after
2195 resultEnd = collapseTo; 2195 resultEnd = collapseTo;
2196 return; 2196 return;
2197 } 2197 }
2198 } 2198 }
2199 2199
2200 CharacterIterator computeRangeIterator(inputStart, inputEnd, iteratorFlagsFo rFindPlainText); 2200 CharacterIterator computeRangeIterator(inputStart, inputEnd, iteratorFlagsFo rFindPlainText);
2201 calculateCharacterSubrange(computeRangeIterator, matchStart, matchLength, re sultStart, resultEnd); 2201 calculateCharacterSubrange(computeRangeIterator, matchStart, matchLength, re sultStart, resultEnd);
2202 } 2202 }
2203 2203
2204 } 2204 }
OLDNEW
« no previous file with comments | « Source/core/editing/TextIterator.h ('k') | Source/core/html/LinkResource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698