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

Side by Side Diff: third_party/WebKit/Source/web/mac/WebSubstringUtil.mm

Issue 1604783002: ALL-IN-ONE: Optimization to previousBoundary() and nextBoundary() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@progressive_accumulator
Patch Set: Created 4 years, 11 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) 2005, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2011 Google Inc. All rights reserved.
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 are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 89
90 if (style->visitedDependentColor(CSSPropertyColor).alpha()) 90 if (style->visitedDependentColor(CSSPropertyColor).alpha())
91 [attrs setObject:nsColor(style->visitedDependentColor(CSSPropertyCol or)) forKey:NSForegroundColorAttributeName]; 91 [attrs setObject:nsColor(style->visitedDependentColor(CSSPropertyCol or)) forKey:NSForegroundColorAttributeName];
92 else 92 else
93 [attrs removeObjectForKey:NSForegroundColorAttributeName]; 93 [attrs removeObjectForKey:NSForegroundColorAttributeName];
94 if (style->visitedDependentColor(CSSPropertyBackgroundColor).alpha()) 94 if (style->visitedDependentColor(CSSPropertyBackgroundColor).alpha())
95 [attrs setObject:nsColor(style->visitedDependentColor(CSSPropertyBac kgroundColor)) forKey:NSBackgroundColorAttributeName]; 95 [attrs setObject:nsColor(style->visitedDependentColor(CSSPropertyBac kgroundColor)) forKey:NSBackgroundColorAttributeName];
96 else 96 else
97 [attrs removeObjectForKey:NSBackgroundColorAttributeName]; 97 [attrs removeObjectForKey:NSBackgroundColorAttributeName];
98 98
99 Vector<UChar> characters; 99 ForwardsTextBuffer characters;
100 it.copyTextTo(characters); 100 it.copyTextTo(characters);
101 NSString* substring = 101 NSString* substring =
102 [[[NSString alloc] initWithCharacters:characters.data() 102 [[[NSString alloc] initWithCharacters:characters.data()
103 length:characters.size()] autorelease ]; 103 length:characters.size()] autorelease ];
104 [string replaceCharactersInRange:NSMakeRange(position, 0) 104 [string replaceCharactersInRange:NSMakeRange(position, 0)
105 withString:substring]; 105 withString:substring];
106 [string setAttributes:attrs range:NSMakeRange(position, numCharacters)]; 106 [string setAttributes:attrs range:NSMakeRange(position, numCharacters)];
107 position += numCharacters; 107 position += numCharacters;
108 } 108 }
109 return [string autorelease]; 109 return [string autorelease];
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 if (ephemeralRange.isNull()) 167 if (ephemeralRange.isNull())
168 return nil; 168 return nil;
169 169
170 NSAttributedString* result = attributedSubstringFromRange(ephemeralRange); 170 NSAttributedString* result = attributedSubstringFromRange(ephemeralRange);
171 if (baselinePoint) 171 if (baselinePoint)
172 *baselinePoint = getBaselinePoint(frame->view(), ephemeralRange, result) ; 172 *baselinePoint = getBaselinePoint(frame->view(), ephemeralRange, result) ;
173 return result; 173 return result;
174 } 174 }
175 175
176 } // namespace blink 176 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698