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

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

Issue 2374183004: Make non-null VisibleSelections creatable only by createVisibleSelection[Deprecated] (Closed)
Patch Set: Fix mac compile error 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
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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 HitTestResult result = static_cast<WebFrameWidgetBase*>(frameWidget)->coreHi tTestResultAt(point); 142 HitTestResult result = static_cast<WebFrameWidgetBase*>(frameWidget)->coreHi tTestResultAt(point);
143 143
144 if (!result.innerNode()) 144 if (!result.innerNode())
145 return nil; 145 return nil;
146 LocalFrame* frame = result.innerNode()->document().frame(); 146 LocalFrame* frame = result.innerNode()->document().frame();
147 EphemeralRange range = frame->rangeForPoint(result.roundedPointInInnerNodeFr ame()); 147 EphemeralRange range = frame->rangeForPoint(result.roundedPointInInnerNodeFr ame());
148 if (range.isNull()) 148 if (range.isNull())
149 return nil; 149 return nil;
150 150
151 // Expand to word under point. 151 // Expand to word under point.
152 VisibleSelection selection(range); 152 VisibleSelection selection = createVisibleSelectionDeprecated(range);
153 selection.expandUsingGranularity(WordGranularity); 153 selection.expandUsingGranularity(WordGranularity);
154 const EphemeralRange wordRange = selection.toNormalizedEphemeralRange(); 154 const EphemeralRange wordRange = selection.toNormalizedEphemeralRange();
155 155
156 // Convert to NSAttributedString. 156 // Convert to NSAttributedString.
157 NSAttributedString* string = attributedSubstringFromRange(wordRange); 157 NSAttributedString* string = attributedSubstringFromRange(wordRange);
158 baselinePoint = getBaselinePoint(frame->view(), wordRange, string); 158 baselinePoint = getBaselinePoint(frame->view(), wordRange, string);
159 return string; 159 return string;
160 } 160 }
161 161
162 NSAttributedString* WebSubstringUtil::attributedSubstringInRange(WebLocalFrame* webFrame, size_t location, size_t length) 162 NSAttributedString* WebSubstringUtil::attributedSubstringInRange(WebLocalFrame* webFrame, size_t location, size_t length)
(...skipping 14 matching lines...) Expand all
177 if (ephemeralRange.isNull()) 177 if (ephemeralRange.isNull())
178 return nil; 178 return nil;
179 179
180 NSAttributedString* result = attributedSubstringFromRange(ephemeralRange); 180 NSAttributedString* result = attributedSubstringFromRange(ephemeralRange);
181 if (baselinePoint) 181 if (baselinePoint)
182 *baselinePoint = getBaselinePoint(frame->view(), ephemeralRange, result) ; 182 *baselinePoint = getBaselinePoint(frame->view(), ephemeralRange, result) ;
183 return result; 183 return result;
184 } 184 }
185 185
186 } // namespace blink 186 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698