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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
276 // |Editor| class. | 276 // |Editor| class. |
277 if (closeTyping) | 277 if (closeTyping) |
278 TypingCommand::closeTyping(m_frame); | 278 TypingCommand::closeTyping(m_frame); |
279 | 279 |
280 if (shouldClearTypingStyle) | 280 if (shouldClearTypingStyle) |
281 clearTypingStyle(); | 281 clearTypingStyle(); |
282 | 282 |
283 if (m_selectionEditor->visibleSelection<Strategy>() == s) { | 283 if (m_selectionEditor->visibleSelection<Strategy>() == s) { |
284 // Even if selection was not changed, selection offsets may have been | 284 // Even if selection was not changed, selection offsets may have been |
285 // changed. | 285 // changed. |
286 m_frame->inputMethodController().cancelCompositionIfSelectionIsInvalid() ; | |
yosin_UTC9
2016/09/28 03:38:50
Note: This catches replacing Text node with same l
Changwan Ryu
2016/09/28 06:20:12
Hmm.. My understanding is that there is no JS way
| |
287 notifyLayoutObjectOfSelectionChange(userTriggered); | 286 notifyLayoutObjectOfSelectionChange(userTriggered); |
288 return; | 287 return; |
289 } | 288 } |
290 | 289 |
291 const VisibleSelectionTemplate<Strategy> oldSelection = visibleSelection<Str ategy>(); | 290 const VisibleSelectionTemplate<Strategy> oldSelection = visibleSelection<Str ategy>(); |
292 const VisibleSelection oldSelectionInDOMTree = selection(); | 291 const VisibleSelection oldSelectionInDOMTree = selection(); |
293 | 292 |
294 m_selectionEditor->setVisibleSelection(s, options); | 293 m_selectionEditor->setVisibleSelection(s, options); |
295 m_frameCaret->setCaretRectNeedsUpdate(); | 294 m_frameCaret->setCaretRectNeedsUpdate(); |
296 | 295 |
(...skipping 26 matching lines...) Expand all Loading... | |
323 // editing/selection/longpress-selection-in-iframe-removed-crash.html | 322 // editing/selection/longpress-selection-in-iframe-removed-crash.html |
324 // reach here. | 323 // reach here. |
325 return; | 324 return; |
326 } | 325 } |
327 notifyLayoutObjectOfSelectionChange(userTriggered); | 326 notifyLayoutObjectOfSelectionChange(userTriggered); |
328 // If the selections are same in the DOM tree but not in the flat tree, | 327 // If the selections are same in the DOM tree but not in the flat tree, |
329 // don't fire events. For example, if the selection crosses shadow tree | 328 // don't fire events. For example, if the selection crosses shadow tree |
330 // boundary, selection for the DOM tree is shrunk while that for the | 329 // boundary, selection for the DOM tree is shrunk while that for the |
331 // flat tree is not. Additionally, this case occurs in some edge cases. | 330 // flat tree is not. Additionally, this case occurs in some edge cases. |
332 // See also: editing/pasteboard/4076267-3.html | 331 // See also: editing/pasteboard/4076267-3.html |
333 if (oldSelection == m_selectionEditor->visibleSelection<Strategy>()) { | 332 if (oldSelection == m_selectionEditor->visibleSelection<Strategy>()) |
334 m_frame->inputMethodController().cancelCompositionIfSelectionIsInvalid() ; | |
yosin_UTC9
2016/09/28 03:38:50
Ditto as L286.
Changwan Ryu
2016/09/28 06:20:12
Explained in L286.
| |
335 return; | 333 return; |
336 } | 334 |
337 m_frame->editor().respondToChangedSelection(oldSelectionInDOMTree, options); | 335 m_frame->editor().respondToChangedSelection(oldSelectionInDOMTree, options); |
338 if (userTriggered == UserTriggered) { | 336 if (userTriggered == UserTriggered) { |
339 ScrollAlignment alignment; | 337 ScrollAlignment alignment; |
340 | 338 |
341 if (m_frame->editor().behavior().shouldCenterAlignWhenSelectionIsReveale d()) | 339 if (m_frame->editor().behavior().shouldCenterAlignWhenSelectionIsReveale d()) |
342 alignment = (align == CursorAlignOnScroll::Always) ? ScrollAlignment ::alignCenterAlways : ScrollAlignment::alignCenterIfNeeded; | 340 alignment = (align == CursorAlignOnScroll::Always) ? ScrollAlignment ::alignCenterAlways : ScrollAlignment::alignCenterIfNeeded; |
343 else | 341 else |
344 alignment = (align == CursorAlignOnScroll::Always) ? ScrollAlignment ::alignTopAlways : ScrollAlignment::alignToEdgeIfNeeded; | 342 alignment = (align == CursorAlignOnScroll::Always) ? ScrollAlignment ::alignTopAlways : ScrollAlignment::alignToEdgeIfNeeded; |
345 | 343 |
346 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesh eets | 344 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesh eets |
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1392 | 1390 |
1393 void showTree(const blink::FrameSelection* sel) | 1391 void showTree(const blink::FrameSelection* sel) |
1394 { | 1392 { |
1395 if (sel) | 1393 if (sel) |
1396 sel->showTreeForThis(); | 1394 sel->showTreeForThis(); |
1397 else | 1395 else |
1398 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; | 1396 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; |
1399 } | 1397 } |
1400 | 1398 |
1401 #endif | 1399 #endif |
OLD | NEW |