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

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

Issue 165083002: Issue 318925: Copy and paste sometimes removes spaces between words (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Issue 318925: Copy and paste sometimes removes spaces between words Created 6 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2006, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 26 matching lines...) Expand all
37 class RenderTextFragment; 37 class RenderTextFragment;
38 38
39 enum TextIteratorBehavior { 39 enum TextIteratorBehavior {
40 TextIteratorDefaultBehavior = 0, 40 TextIteratorDefaultBehavior = 0,
41 TextIteratorEmitsCharactersBetweenAllVisiblePositions = 1 << 0, 41 TextIteratorEmitsCharactersBetweenAllVisiblePositions = 1 << 0,
42 TextIteratorEntersTextControls = 1 << 1, 42 TextIteratorEntersTextControls = 1 << 1,
43 TextIteratorIgnoresStyleVisibility = 1 << 2, 43 TextIteratorIgnoresStyleVisibility = 1 << 2,
44 TextIteratorEmitsOriginalText = 1 << 3, 44 TextIteratorEmitsOriginalText = 1 << 3,
45 TextIteratorStopsOnFormControls = 1 << 4, 45 TextIteratorStopsOnFormControls = 1 << 4,
46 TextIteratorEmitsImageAltText = 1 << 5, 46 TextIteratorEmitsImageAltText = 1 << 5,
47 TextIteratorEntersAuthorShadowRoots = 1 << 6 47 TextIteratorEntersAuthorShadowRoots = 1 << 6,
48 TextIteratorBehavesAsIfNodesFollowing = 1 << 7,
48 }; 49 };
49 typedef unsigned TextIteratorBehaviorFlags; 50 typedef unsigned TextIteratorBehaviorFlags;
50 51
51 // FIXME: Can't really answer this question correctly without knowing the white- space mode. 52 // FIXME: Can't really answer this question correctly without knowing the white- space mode.
52 // FIXME: Move this somewhere else in the editing directory. It doesn't belong h ere. 53 // FIXME: Move this somewhere else in the editing directory. It doesn't belong h ere.
53 inline bool isCollapsibleWhitespace(UChar c) 54 inline bool isCollapsibleWhitespace(UChar c)
54 { 55 {
55 switch (c) { 56 switch (c) {
56 case ' ': 57 case ' ':
57 case '\n': 58 case '\n':
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 // Used when the visibility of the style should not affect text gathering. 208 // Used when the visibility of the style should not affect text gathering.
208 bool m_ignoresStyleVisibility; 209 bool m_ignoresStyleVisibility;
209 // Used when the iteration should stop if form controls are reached. 210 // Used when the iteration should stop if form controls are reached.
210 bool m_stopsOnFormControls; 211 bool m_stopsOnFormControls;
211 // Used when m_stopsOnFormControls is set to determine if the iterator shoul d keep advancing. 212 // Used when m_stopsOnFormControls is set to determine if the iterator shoul d keep advancing.
212 bool m_shouldStop; 213 bool m_shouldStop;
213 214
214 bool m_emitsImageAltText; 215 bool m_emitsImageAltText;
215 216
216 bool m_entersAuthorShadowRoots; 217 bool m_entersAuthorShadowRoots;
218 bool m_hasNodesFollowing;
217 }; 219 };
218 220
219 // Iterates through the DOM range, returning all the text, and 0-length boundari es 221 // Iterates through the DOM range, returning all the text, and 0-length boundari es
220 // at points where replaced elements break up the text flow. The text comes back in 222 // at points where replaced elements break up the text flow. The text comes back in
221 // chunks so as to optimize for performance of the iteration. 223 // chunks so as to optimize for performance of the iteration.
222 class SimplifiedBackwardsTextIterator { 224 class SimplifiedBackwardsTextIterator {
223 public: 225 public:
224 explicit SimplifiedBackwardsTextIterator(const Range*, TextIteratorBehaviorF lags = TextIteratorDefaultBehavior); 226 explicit SimplifiedBackwardsTextIterator(const Range*, TextIteratorBehaviorF lags = TextIteratorDefaultBehavior);
225 227
226 bool atEnd() const { return !m_positionNode || m_shouldStop; } 228 bool atEnd() const { return !m_positionNode || m_shouldStop; }
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 Vector<UChar> m_buffer; 365 Vector<UChar> m_buffer;
364 // Did we have to look ahead in the textIterator to confirm the current chun k? 366 // Did we have to look ahead in the textIterator to confirm the current chun k?
365 bool m_didLookAhead; 367 bool m_didLookAhead;
366 RefPtr<Range> m_range; 368 RefPtr<Range> m_range;
367 TextIterator m_textIterator; 369 TextIterator m_textIterator;
368 }; 370 };
369 371
370 } 372 }
371 373
372 #endif 374 #endif
OLDNEW
« no previous file with comments | « LayoutTests/editing/pasteboard/copy-text-with-wrapped-tag-expected.txt ('k') | Source/core/editing/TextIterator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698