Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 211 // TODO(yosin): We should move to call |TypingCommand::closeTyping()| to | 211 // TODO(yosin): We should move to call |TypingCommand::closeTyping()| to |
| 212 // |Editor| class. | 212 // |Editor| class. |
| 213 if (close_typing) | 213 if (close_typing) |
| 214 TypingCommand::CloseTyping(frame_); | 214 TypingCommand::CloseTyping(frame_); |
| 215 | 215 |
| 216 if (should_clear_typing_style) | 216 if (should_clear_typing_style) |
| 217 frame_->GetEditor().ClearTypingStyle(); | 217 frame_->GetEditor().ClearTypingStyle(); |
| 218 | 218 |
| 219 const SelectionInDOMTree old_selection_in_dom_tree = | 219 const SelectionInDOMTree old_selection_in_dom_tree = |
| 220 selection_editor_->GetSelectionInDOMTree(); | 220 selection_editor_->GetSelectionInDOMTree(); |
| 221 if (old_selection_in_dom_tree == new_selection) | 221 if (old_selection_in_dom_tree == new_selection) { |
| 222 // Notify to a focused text control. Even if DOM representation of text | |
| 223 // selection is not changed, selectionStart / selectionEnd IDL attributes | |
| 224 // can be changed. | |
| 225 NotifyLayoutObjectOfSelectionChange( | |
|
yosin_UTC9
2017/05/11 09:41:55
Could you rename NotifyLayoutObjectOfSelectionChan
Xiaocheng
2017/05/11 18:37:18
+1 for renaming.
| |
| 226 SelectionOptionsToUserTriggered(options)); | |
| 222 return false; | 227 return false; |
| 228 } | |
| 223 selection_editor_->SetSelection(new_selection); | 229 selection_editor_->SetSelection(new_selection); |
| 224 ScheduleVisualUpdateForPaintInvalidationIfNeeded(); | 230 ScheduleVisualUpdateForPaintInvalidationIfNeeded(); |
| 225 | 231 |
| 226 const Document& current_document = GetDocument(); | 232 const Document& current_document = GetDocument(); |
| 227 // TODO(yosin): We should get rid of unsued |options| for | 233 // TODO(yosin): We should get rid of unsued |options| for |
| 228 // |Editor::respondToChangedSelection()|. | 234 // |Editor::respondToChangedSelection()|. |
| 229 // Note: Since, setting focus can modify DOM tree, we should use | 235 // Note: Since, setting focus can modify DOM tree, we should use |
| 230 // |oldSelection| before setting focus | 236 // |oldSelection| before setting focus |
| 231 frame_->GetEditor().RespondToChangedSelection( | 237 frame_->GetEditor().RespondToChangedSelection( |
| 232 old_selection_in_dom_tree.ComputeStartPosition(), options); | 238 old_selection_in_dom_tree.ComputeStartPosition(), options); |
| (...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1184 } | 1190 } |
| 1185 | 1191 |
| 1186 void showTree(const blink::FrameSelection* sel) { | 1192 void showTree(const blink::FrameSelection* sel) { |
| 1187 if (sel) | 1193 if (sel) |
| 1188 sel->ShowTreeForThis(); | 1194 sel->ShowTreeForThis(); |
| 1189 else | 1195 else |
| 1190 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; | 1196 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; |
| 1191 } | 1197 } |
| 1192 | 1198 |
| 1193 #endif | 1199 #endif |
| OLD | NEW |