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

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

Issue 2465803002: Get rid of VisibleSelection::expandUsingGranularity() (Closed)
Patch Set: 2016-10-31T17:16:07 Created 4 years, 1 month 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 | « third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp ('k') | no next file » | 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) 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 160
161 if (!result.innerNode()) 161 if (!result.innerNode())
162 return nil; 162 return nil;
163 LocalFrame* frame = result.innerNode()->document().frame(); 163 LocalFrame* frame = result.innerNode()->document().frame();
164 EphemeralRange range = 164 EphemeralRange range =
165 frame->rangeForPoint(result.roundedPointInInnerNodeFrame()); 165 frame->rangeForPoint(result.roundedPointInInnerNodeFrame());
166 if (range.isNull()) 166 if (range.isNull())
167 return nil; 167 return nil;
168 168
169 // Expand to word under point. 169 // Expand to word under point.
170 VisibleSelection selection = createVisibleSelection( 170 const VisibleSelection& selection =
171 SelectionInDOMTree::Builder().setBaseAndExtent(range).build()); 171 createVisibleSelection(SelectionInDOMTree::Builder()
172 selection.expandUsingGranularity(WordGranularity); 172 .setBaseAndExtent(range)
173 .setGranularity(WordGranularity)
174 .build());
173 const EphemeralRange wordRange = selection.toNormalizedEphemeralRange(); 175 const EphemeralRange wordRange = selection.toNormalizedEphemeralRange();
174 176
175 // Convert to NSAttributedString. 177 // Convert to NSAttributedString.
176 NSAttributedString* string = attributedSubstringFromRange(wordRange); 178 NSAttributedString* string = attributedSubstringFromRange(wordRange);
177 baselinePoint = getBaselinePoint(frame->view(), wordRange, string); 179 baselinePoint = getBaselinePoint(frame->view(), wordRange, string);
178 return string; 180 return string;
179 } 181 }
180 182
181 NSAttributedString* WebSubstringUtil::attributedSubstringInRange( 183 NSAttributedString* WebSubstringUtil::attributedSubstringInRange(
182 WebLocalFrame* webFrame, 184 WebLocalFrame* webFrame,
(...skipping 20 matching lines...) Expand all
203 if (ephemeralRange.isNull()) 205 if (ephemeralRange.isNull())
204 return nil; 206 return nil;
205 207
206 NSAttributedString* result = attributedSubstringFromRange(ephemeralRange); 208 NSAttributedString* result = attributedSubstringFromRange(ephemeralRange);
207 if (baselinePoint) 209 if (baselinePoint)
208 *baselinePoint = getBaselinePoint(frame->view(), ephemeralRange, result); 210 *baselinePoint = getBaselinePoint(frame->view(), ephemeralRange, result);
209 return result; 211 return result;
210 } 212 }
211 213
212 } // namespace blink 214 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698