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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 position += numCharacters; | 107 position += numCharacters; |
108 } | 108 } |
109 return [string autorelease]; | 109 return [string autorelease]; |
110 } | 110 } |
111 | 111 |
112 namespace blink { | 112 namespace blink { |
113 | 113 |
114 NSAttributedString* WebSubstringUtil::attributedWordAtPoint(WebView* view, WebPo
int point, WebPoint& baselinePoint) | 114 NSAttributedString* WebSubstringUtil::attributedWordAtPoint(WebView* view, WebPo
int point, WebPoint& baselinePoint) |
115 { | 115 { |
116 HitTestResult result = static_cast<WebViewImpl*>(view)->coreHitTestResultAt(
point); | 116 HitTestResult result = static_cast<WebViewImpl*>(view)->coreHitTestResultAt(
point); |
117 if (!result.targetNode()) | 117 if (!result.innerNode()) |
118 return nil; | 118 return nil; |
119 LocalFrame* frame = result.targetNode()->document().frame(); | 119 LocalFrame* frame = result.innerNode()->document().frame(); |
120 FrameView* frameView = frame->view(); | 120 FrameView* frameView = frame->view(); |
121 | 121 |
122 RefPtrWillBeRawPtr<Range> range = frame->rangeForPoint(result.roundedPointIn
InnerNodeFrame()); | 122 RefPtrWillBeRawPtr<Range> range = frame->rangeForPoint(result.roundedPointIn
InnerNodeFrame()); |
123 if (!range) | 123 if (!range) |
124 return nil; | 124 return nil; |
125 | 125 |
126 // Expand to word under point. | 126 // Expand to word under point. |
127 VisibleSelection selection(range.get()); | 127 VisibleSelection selection(range.get()); |
128 selection.expandUsingGranularity(WordGranularity); | 128 selection.expandUsingGranularity(WordGranularity); |
129 RefPtrWillBeRawPtr<Range> wordRange = selection.toNormalizedRange(); | 129 RefPtrWillBeRawPtr<Range> wordRange = selection.toNormalizedRange(); |
(...skipping 28 matching lines...) Expand all Loading... |
158 if (!editable) | 158 if (!editable) |
159 return nil; | 159 return nil; |
160 RefPtrWillBeRawPtr<Range> range(PlainTextRange(location, location + length).
createRange(*editable)); | 160 RefPtrWillBeRawPtr<Range> range(PlainTextRange(location, location + length).
createRange(*editable)); |
161 if (!range) | 161 if (!range) |
162 return nil; | 162 return nil; |
163 | 163 |
164 return attributedSubstringFromRange(range.get()); | 164 return attributedSubstringFromRange(range.get()); |
165 } | 165 } |
166 | 166 |
167 } // namespace blink | 167 } // namespace blink |
OLD | NEW |