Changeset 160526 in webkit
- Timestamp:
- Dec 12, 2013 8:59:44 PM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r160525 r160526 1 2013-12-12 KyungTae Kim <ktf.kim@samsung.com> 2 3 Improve the find word boundary performance 4 https://bugs.webkit.org/show_bug.cgi?id=125619 5 6 In endWordBoundary case, the textBreakPrevious call in findWordBoundary is unnecessary. 7 So use separate function for endWordBoundary can improve the performance. 8 9 Reviewed by Darin Adler. 10 11 No tests because no operation changes. 12 13 * editing/VisibleUnits.cpp: Use findEndWordBoundary in endWordBoundary 14 (WebCore::endWordBoundary): 15 * platform/text/TextBoundaries.cpp: Add findEndWordBoundary function 16 (WebCore::findEndWordBoundary): 17 * platform/text/TextBoundaries.h: 18 * platform/text/mac/TextBoundaries.mm: Add findEndWordBoundary function 19 (WebCore::findEndWordBoundary): 20 1 21 2013-12-12 Benjamin Poulain <bpoulain@apple.com> 2 22 -
trunk/Source/WebCore/editing/VisibleUnits.cpp
r160235 r160526 651 651 } 652 652 needMoreContext = false; 653 int start,end;654 find WordBoundary(characters, length, offset, &start, &end);653 int end; 654 findEndWordBoundary(characters, length, offset, &end); 655 655 return end; 656 656 } -
trunk/Source/WebCore/platform/text/TextBoundaries.cpp
r157330 r160526 98 98 } 99 99 100 void findEndWordBoundary(const UChar* chars, int len, int position, int* end) 101 { 102 TextBreakIterator* it = wordBreakIterator(chars, len); 103 *end = textBreakFollowing(it, position); 104 if (*end < 0) 105 *end = textBreakLast(it); 106 } 107 100 108 #endif // !PLATFORM(MAC) 101 109 -
trunk/Source/WebCore/platform/text/TextBoundaries.h
r157330 r160526 46 46 47 47 void findWordBoundary(const UChar*, int len, int position, int* start, int* end); 48 void findEndWordBoundary(const UChar*, int len, int position, int* end); 48 49 int findNextWordFromIndex(const UChar*, int len, int position, bool forward); 49 50 -
trunk/Source/WebCore/platform/text/mac/TextBoundaries.mm
r157330 r160526 41 41 } 42 42 43 void findEndWordBoundary(const UChar* chars, int len, int position, int* end) 44 { 45 NSString* string = [[NSString alloc] initWithCharactersNoCopy:const_cast<unichar*>(chars) 46 length:len freeWhenDone:NO]; 47 NSAttributedString* attr = [[NSAttributedString alloc] initWithString:string]; 48 NSRange range = [attr doubleClickAtIndex:(position >= len) ? len - 1 : position]; 49 [attr release]; 50 [string release]; 51 *end = range.location + range.length; 52 } 53 43 54 int findNextWordFromIndex(const UChar* chars, int len, int position, bool forward) 44 55 {
Note: See TracChangeset
for help on using the changeset viewer.