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

Side by Side Diff: third_party/WebKit/Source/platform/text/TextBoundaries.cpp

Issue 2701993002: DO NOT COMMIT: Results of running new (proposed) clang-format on Blink (Closed)
Patch Set: Created 3 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) 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Dominik Roettsches <dominik.roettsches@access-company.com> 3 * Copyright (C) 2009 Dominik Roettsches <dominik.roettsches@access-company.com>
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 int len, 61 int len,
62 int position, 62 int position,
63 bool forward) { 63 bool forward) {
64 TextBreakIterator* it = wordBreakIterator(chars, len); 64 TextBreakIterator* it = wordBreakIterator(chars, len);
65 65
66 if (forward) { 66 if (forward) {
67 position = it->following(position); 67 position = it->following(position);
68 while (position != TextBreakDone) { 68 while (position != TextBreakDone) {
69 // We stop searching when the character preceeding the break 69 // We stop searching when the character preceeding the break
70 // is alphanumeric or underscore. 70 // is alphanumeric or underscore.
71 if (position < len && (isAlphanumeric(chars[position - 1]) || 71 if (position < len &&
72 chars[position - 1] == lowLineCharacter)) 72 (isAlphanumeric(chars[position - 1]) ||
73 chars[position - 1] == lowLineCharacter))
73 return position; 74 return position;
74 75
75 position = it->following(position); 76 position = it->following(position);
76 } 77 }
77 78
78 return len; 79 return len;
79 } else { 80 } else {
80 position = it->preceding(position); 81 position = it->preceding(position);
81 while (position != TextBreakDone) { 82 while (position != TextBreakDone) {
82 // We stop searching when the character following the break 83 // We stop searching when the character following the break
83 // is alphanumeric or underscore. 84 // is alphanumeric or underscore.
84 if (position > 0 && (isAlphanumeric(chars[position]) || 85 if (position > 0 &&
85 chars[position] == lowLineCharacter)) 86 (isAlphanumeric(chars[position]) ||
87 chars[position] == lowLineCharacter))
86 return position; 88 return position;
87 89
88 position = it->preceding(position); 90 position = it->preceding(position);
89 } 91 }
90 92
91 return 0; 93 return 0;
92 } 94 }
93 } 95 }
94 96
95 void findWordBoundary(const UChar* chars, 97 void findWordBoundary(const UChar* chars,
96 int len, 98 int len,
97 int position, 99 int position,
98 int* start, 100 int* start,
99 int* end) { 101 int* end) {
100 TextBreakIterator* it = wordBreakIterator(chars, len); 102 TextBreakIterator* it = wordBreakIterator(chars, len);
101 *end = it->following(position); 103 *end = it->following(position);
102 if (*end < 0) 104 if (*end < 0)
103 *end = it->last(); 105 *end = it->last();
104 *start = it->previous(); 106 *start = it->previous();
105 } 107 }
106 108
107 int findWordEndBoundary(const UChar* chars, int len, int position) { 109 int findWordEndBoundary(const UChar* chars, int len, int position) {
108 TextBreakIterator* it = wordBreakIterator(chars, len); 110 TextBreakIterator* it = wordBreakIterator(chars, len);
109 int end = it->following(position); 111 int end = it->following(position);
110 return end < 0 ? it->last() : end; 112 return end < 0 ? it->last() : end;
111 } 113 }
112 114
113 } // namespace blink 115 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/text/CharacterTest.cpp ('k') | third_party/WebKit/Source/platform/text/UnicodeRange.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698