OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/render_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 4039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4050 // If current focused element is editable, we will send 100 more chars | 4050 // If current focused element is editable, we will send 100 more chars |
4051 // before and after selection. It is for input method surrounding text | 4051 // before and after selection. It is for input method surrounding text |
4052 // feature. | 4052 // feature. |
4053 if (location > kExtraCharsBeforeAndAfterSelection) | 4053 if (location > kExtraCharsBeforeAndAfterSelection) |
4054 offset = location - kExtraCharsBeforeAndAfterSelection; | 4054 offset = location - kExtraCharsBeforeAndAfterSelection; |
4055 else | 4055 else |
4056 offset = 0; | 4056 offset = 0; |
4057 length = location + length - offset + kExtraCharsBeforeAndAfterSelection; | 4057 length = location + length - offset + kExtraCharsBeforeAndAfterSelection; |
4058 WebRange webrange = WebRange::fromDocumentRange(frame_, offset, length); | 4058 WebRange webrange = WebRange::fromDocumentRange(frame_, offset, length); |
4059 if (!webrange.isNull()) | 4059 if (!webrange.isNull()) |
4060 text = WebRange::fromDocumentRange( | 4060 text = webrange.toPlainText(); |
4061 frame_, offset, length).toPlainText(); | |
4062 } else { | 4061 } else { |
4063 offset = location; | 4062 offset = location; |
4064 text = frame_->selectionAsText(); | 4063 text = frame_->selectionAsText(); |
4065 // http://crbug.com/101435 | 4064 // http://crbug.com/101435 |
4066 // In some case, frame->selectionAsText() returned text's length is not | 4065 // In some case, frame->selectionAsText() returned text's length is not |
4067 // equal to the length returned from webwidget()->caretOrSelectionRange(). | 4066 // equal to the length returned from webwidget()->caretOrSelectionRange(). |
4068 // So we have to set the range according to text.length(). | 4067 // So we have to set the range according to text.length(). |
4069 range.set_end(range.start() + text.length()); | 4068 range.set_end(range.start() + text.length()); |
4070 } | 4069 } |
4071 } | 4070 } |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4266 | 4265 |
4267 #if defined(ENABLE_BROWSER_CDMS) | 4266 #if defined(ENABLE_BROWSER_CDMS) |
4268 RendererCdmManager* RenderFrameImpl::GetCdmManager() { | 4267 RendererCdmManager* RenderFrameImpl::GetCdmManager() { |
4269 if (!cdm_manager_) | 4268 if (!cdm_manager_) |
4270 cdm_manager_ = new RendererCdmManager(this); | 4269 cdm_manager_ = new RendererCdmManager(this); |
4271 return cdm_manager_; | 4270 return cdm_manager_; |
4272 } | 4271 } |
4273 #endif // defined(ENABLE_BROWSER_CDMS) | 4272 #endif // defined(ENABLE_BROWSER_CDMS) |
4274 | 4273 |
4275 } // namespace content | 4274 } // namespace content |
OLD | NEW |