| 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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 SetSelectionOptions options, | 313 SetSelectionOptions options, |
| 314 CursorAlignOnScroll align, | 314 CursorAlignOnScroll align, |
| 315 TextGranularity granularity) { | 315 TextGranularity granularity) { |
| 316 setSelection( | 316 setSelection( |
| 317 SelectionInDOMTree::Builder(newSelection.asSelection()) | 317 SelectionInDOMTree::Builder(newSelection.asSelection()) |
| 318 .setIsHandleVisible(handleVisibility == HandleVisibility::Visible) | 318 .setIsHandleVisible(handleVisibility == HandleVisibility::Visible) |
| 319 .build(), | 319 .build(), |
| 320 options, align, granularity); | 320 options, align, granularity); |
| 321 } | 321 } |
| 322 | 322 |
| 323 void FrameSelection::setSelection(const VisibleSelection& newSelection, | |
| 324 SetSelectionOptions options) { | |
| 325 setSelection(newSelection.asSelection(), options); | |
| 326 } | |
| 327 | |
| 328 void FrameSelection::nodeChildrenWillBeRemoved(ContainerNode& container) { | 323 void FrameSelection::nodeChildrenWillBeRemoved(ContainerNode& container) { |
| 329 if (!container.inActiveDocument()) | 324 if (!container.inActiveDocument()) |
| 330 return; | 325 return; |
| 331 // TODO(yosin): We should move to call |TypingCommand::closeTyping()| to | 326 // TODO(yosin): We should move to call |TypingCommand::closeTyping()| to |
| 332 // |Editor| class. | 327 // |Editor| class. |
| 333 if (!document().isRunningExecCommand()) | 328 if (!document().isRunningExecCommand()) |
| 334 TypingCommand::closeTyping(m_frame); | 329 TypingCommand::closeTyping(m_frame); |
| 335 } | 330 } |
| 336 | 331 |
| 337 void FrameSelection::nodeWillBeRemoved(Node& node) { | 332 void FrameSelection::nodeWillBeRemoved(Node& node) { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 // another element. See snav-input.html and snav-textarea.html | 386 // another element. See snav-input.html and snav-textarea.html |
| 392 if (isSpatialNavigationEnabled(m_frame)) | 387 if (isSpatialNavigationEnabled(m_frame)) |
| 393 return false; | 388 return false; |
| 394 // Even if selection isn't changed, we prevent to default action, e.g. | 389 // Even if selection isn't changed, we prevent to default action, e.g. |
| 395 // scroll window when caret is at end of content editable. | 390 // scroll window when caret is at end of content editable. |
| 396 return true; | 391 return true; |
| 397 } | 392 } |
| 398 | 393 |
| 399 const SetSelectionOptions options = | 394 const SetSelectionOptions options = |
| 400 CloseTyping | ClearTypingStyle | userTriggered; | 395 CloseTyping | ClearTypingStyle | userTriggered; |
| 401 setSelection(selectionModifier.selection(), options); | 396 setSelection(selectionModifier.selection().asSelection(), options); |
| 402 | 397 |
| 403 if (granularity == LineGranularity || granularity == ParagraphGranularity) | 398 if (granularity == LineGranularity || granularity == ParagraphGranularity) |
| 404 m_xPosForVerticalArrowNavigation = | 399 m_xPosForVerticalArrowNavigation = |
| 405 selectionModifier.xPosForVerticalArrowNavigation(); | 400 selectionModifier.xPosForVerticalArrowNavigation(); |
| 406 | 401 |
| 407 if (userTriggered == UserTriggered) | 402 if (userTriggered == UserTriggered) |
| 408 m_granularity = CharacterGranularity; | 403 m_granularity = CharacterGranularity; |
| 409 | 404 |
| 410 scheduleVisualUpdateForPaintInvalidationIfNeeded(); | 405 scheduleVisualUpdateForPaintInvalidationIfNeeded(); |
| 411 | 406 |
| (...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1181 } | 1176 } |
| 1182 | 1177 |
| 1183 void showTree(const blink::FrameSelection* sel) { | 1178 void showTree(const blink::FrameSelection* sel) { |
| 1184 if (sel) | 1179 if (sel) |
| 1185 sel->showTreeForThis(); | 1180 sel->showTreeForThis(); |
| 1186 else | 1181 else |
| 1187 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; | 1182 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; |
| 1188 } | 1183 } |
| 1189 | 1184 |
| 1190 #endif | 1185 #endif |
| OLD | NEW |