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