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