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

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

Issue 2430253003: Get rid of createVisibleSelection() to take EphemeralRange (Closed)
Patch Set: 2016-10-20T14:03:19 Created 4 years, 2 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
« no previous file with comments | « third_party/WebKit/Source/web/WebLocalFrameImpl.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(range); 170 VisibleSelection selection = createVisibleSelection(
171 SelectionInDOMTree::Builder().setBaseAndExtent(range).build());
171 selection.expandUsingGranularity(WordGranularity); 172 selection.expandUsingGranularity(WordGranularity);
172 const EphemeralRange wordRange = selection.toNormalizedEphemeralRange(); 173 const EphemeralRange wordRange = selection.toNormalizedEphemeralRange();
173 174
174 // Convert to NSAttributedString. 175 // Convert to NSAttributedString.
175 NSAttributedString* string = attributedSubstringFromRange(wordRange); 176 NSAttributedString* string = attributedSubstringFromRange(wordRange);
176 baselinePoint = getBaselinePoint(frame->view(), wordRange, string); 177 baselinePoint = getBaselinePoint(frame->view(), wordRange, string);
177 return string; 178 return string;
178 } 179 }
179 180
180 NSAttributedString* WebSubstringUtil::attributedSubstringInRange( 181 NSAttributedString* WebSubstringUtil::attributedSubstringInRange(
(...skipping 21 matching lines...) Expand all
202 if (ephemeralRange.isNull()) 203 if (ephemeralRange.isNull())
203 return nil; 204 return nil;
204 205
205 NSAttributedString* result = attributedSubstringFromRange(ephemeralRange); 206 NSAttributedString* result = attributedSubstringFromRange(ephemeralRange);
206 if (baselinePoint) 207 if (baselinePoint)
207 *baselinePoint = getBaselinePoint(frame->view(), ephemeralRange, result); 208 *baselinePoint = getBaselinePoint(frame->view(), ephemeralRange, result);
208 return result; 209 return result;
209 } 210 }
210 211
211 } // namespace blink 212 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebLocalFrameImpl.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698