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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 if (closeTyping) | 205 if (closeTyping) |
206 TypingCommand::closeTyping(m_frame); | 206 TypingCommand::closeTyping(m_frame); |
207 | 207 |
208 if (shouldClearTypingStyle) | 208 if (shouldClearTypingStyle) |
209 clearTypingStyle(); | 209 clearTypingStyle(); |
210 | 210 |
211 if (m_selectionEditor->visibleSelection<Strategy>() == s && | 211 if (m_selectionEditor->visibleSelection<Strategy>() == s && |
212 m_handleVisibility == handleVisibility) { | 212 m_handleVisibility == handleVisibility) { |
213 // Even if selection was not changed, selection offsets may have been | 213 // Even if selection was not changed, selection offsets may have been |
214 // changed. | 214 // changed. |
215 m_frame->inputMethodController().cancelCompositionIfSelectionIsInvalid(); | |
216 notifyLayoutObjectOfSelectionChange(userTriggered); | 215 notifyLayoutObjectOfSelectionChange(userTriggered); |
217 return; | 216 return; |
218 } | 217 } |
219 | 218 |
220 const VisibleSelectionTemplate<Strategy> oldSelection = | 219 const VisibleSelectionTemplate<Strategy> oldSelection = |
221 visibleSelection<Strategy>(); | 220 visibleSelection<Strategy>(); |
222 const Position& oldSelectionStart = selection().start(); | 221 const Position& oldSelectionStart = selection().start(); |
223 | 222 |
224 m_handleVisibility = handleVisibility; | 223 m_handleVisibility = handleVisibility; |
225 m_selectionEditor->setVisibleSelection(s, options); | 224 m_selectionEditor->setVisibleSelection(s, options); |
(...skipping 29 matching lines...) Expand all Loading... |
255 // editing/selection/longpress-selection-in-iframe-removed-crash.html | 254 // editing/selection/longpress-selection-in-iframe-removed-crash.html |
256 // reach here. | 255 // reach here. |
257 return; | 256 return; |
258 } | 257 } |
259 notifyLayoutObjectOfSelectionChange(userTriggered); | 258 notifyLayoutObjectOfSelectionChange(userTriggered); |
260 // If the selections are same in the DOM tree but not in the flat tree, | 259 // If the selections are same in the DOM tree but not in the flat tree, |
261 // don't fire events. For example, if the selection crosses shadow tree | 260 // don't fire events. For example, if the selection crosses shadow tree |
262 // boundary, selection for the DOM tree is shrunk while that for the | 261 // boundary, selection for the DOM tree is shrunk while that for the |
263 // flat tree is not. Additionally, this case occurs in some edge cases. | 262 // flat tree is not. Additionally, this case occurs in some edge cases. |
264 // See also: editing/pasteboard/4076267-3.html | 263 // See also: editing/pasteboard/4076267-3.html |
265 if (oldSelection == m_selectionEditor->visibleSelection<Strategy>()) { | 264 if (oldSelection == m_selectionEditor->visibleSelection<Strategy>()) |
266 m_frame->inputMethodController().cancelCompositionIfSelectionIsInvalid(); | |
267 return; | 265 return; |
268 } | 266 |
269 m_frame->editor().respondToChangedSelection(oldSelectionStart, options); | 267 m_frame->editor().respondToChangedSelection(oldSelectionStart, options); |
270 if (userTriggered == UserTriggered) { | 268 if (userTriggered == UserTriggered) { |
271 ScrollAlignment alignment; | 269 ScrollAlignment alignment; |
272 | 270 |
273 if (m_frame->editor().behavior().shouldCenterAlignWhenSelectionIsRevealed()) | 271 if (m_frame->editor().behavior().shouldCenterAlignWhenSelectionIsRevealed()) |
274 alignment = (align == CursorAlignOnScroll::Always) | 272 alignment = (align == CursorAlignOnScroll::Always) |
275 ? ScrollAlignment::alignCenterAlways | 273 ? ScrollAlignment::alignCenterAlways |
276 : ScrollAlignment::alignCenterIfNeeded; | 274 : ScrollAlignment::alignCenterIfNeeded; |
277 else | 275 else |
278 alignment = (align == CursorAlignOnScroll::Always) | 276 alignment = (align == CursorAlignOnScroll::Always) |
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1421 } | 1419 } |
1422 | 1420 |
1423 void showTree(const blink::FrameSelection* sel) { | 1421 void showTree(const blink::FrameSelection* sel) { |
1424 if (sel) | 1422 if (sel) |
1425 sel->showTreeForThis(); | 1423 sel->showTreeForThis(); |
1426 else | 1424 else |
1427 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; | 1425 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; |
1428 } | 1426 } |
1429 | 1427 |
1430 #endif | 1428 #endif |
OLD | NEW |