| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |