| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1492 void Editor::ChangeSelectionAfterCommand( | 1492 void Editor::ChangeSelectionAfterCommand( |
| 1493 const SelectionInDOMTree& new_selection, | 1493 const SelectionInDOMTree& new_selection, |
| 1494 FrameSelection::SetSelectionOptions options) { | 1494 FrameSelection::SetSelectionOptions options) { |
| 1495 if (new_selection.IsNone()) | 1495 if (new_selection.IsNone()) |
| 1496 return; | 1496 return; |
| 1497 | 1497 |
| 1498 // See <rdar://problem/5729315> Some shouldChangeSelectedDOMRange contain | 1498 // See <rdar://problem/5729315> Some shouldChangeSelectedDOMRange contain |
| 1499 // Ranges for selections that are no longer valid | 1499 // Ranges for selections that are no longer valid |
| 1500 bool selection_did_not_change_dom_position = | 1500 bool selection_did_not_change_dom_position = |
| 1501 new_selection == GetFrame().Selection().GetSelectionInDOMTree(); | 1501 new_selection == GetFrame().Selection().GetSelectionInDOMTree(); |
| 1502 GetFrame().Selection().SetSelection(new_selection, options); | 1502 GetFrame().Selection().SetSelection( |
| 1503 SelectionInDOMTree::Builder(new_selection) |
| 1504 .SetIsHandleVisible(GetFrame().Selection().IsHandleVisible()) |
| 1505 .Build(), |
| 1506 options); |
| 1503 | 1507 |
| 1504 // Some editing operations change the selection visually without affecting its | 1508 // Some editing operations change the selection visually without affecting its |
| 1505 // position within the DOM. For example when you press return in the following | 1509 // position within the DOM. For example when you press return in the following |
| 1506 // (the caret is marked by ^): | 1510 // (the caret is marked by ^): |
| 1507 // <div contentEditable="true"><div>^Hello</div></div> | 1511 // <div contentEditable="true"><div>^Hello</div></div> |
| 1508 // WebCore inserts <div><br></div> *before* the current block, which correctly | 1512 // WebCore inserts <div><br></div> *before* the current block, which correctly |
| 1509 // moves the paragraph down but which doesn't change the caret's DOM position | 1513 // moves the paragraph down but which doesn't change the caret's DOM position |
| 1510 // (["hello", 0]). In these situations the above FrameSelection::setSelection | 1514 // (["hello", 0]). In these situations the above FrameSelection::setSelection |
| 1511 // call does not call EditorClient::respondToChangedSelection(), which, on the | 1515 // call does not call EditorClient::respondToChangedSelection(), which, on the |
| 1512 // Mac, sends selection change notifications and starts a new kill ring | 1516 // Mac, sends selection change notifications and starts a new kill ring |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1847 | 1851 |
| 1848 DEFINE_TRACE(Editor) { | 1852 DEFINE_TRACE(Editor) { |
| 1849 visitor->Trace(frame_); | 1853 visitor->Trace(frame_); |
| 1850 visitor->Trace(last_edit_command_); | 1854 visitor->Trace(last_edit_command_); |
| 1851 visitor->Trace(undo_stack_); | 1855 visitor->Trace(undo_stack_); |
| 1852 visitor->Trace(mark_); | 1856 visitor->Trace(mark_); |
| 1853 visitor->Trace(typing_style_); | 1857 visitor->Trace(typing_style_); |
| 1854 } | 1858 } |
| 1855 | 1859 |
| 1856 } // namespace blink | 1860 } // namespace blink |
| OLD | NEW |