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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 else | 292 else |
293 alignment = (align == AlignCursorOnScrollAlways) ? ScrollAlignment::
alignTopAlways : ScrollAlignment::alignToEdgeIfNeeded; | 293 alignment = (align == AlignCursorOnScrollAlways) ? ScrollAlignment::
alignTopAlways : ScrollAlignment::alignToEdgeIfNeeded; |
294 | 294 |
295 revealSelection(alignment, RevealExtent); | 295 revealSelection(alignment, RevealExtent); |
296 } | 296 } |
297 | 297 |
298 notifyAccessibilityForSelectionChange(); | 298 notifyAccessibilityForSelectionChange(); |
299 m_frame->domWindow()->enqueueDocumentEvent(Event::create(EventTypeNames::sel
ectionchange)); | 299 m_frame->domWindow()->enqueueDocumentEvent(Event::create(EventTypeNames::sel
ectionchange)); |
300 } | 300 } |
301 | 301 |
| 302 bool FrameSelection::collapseToEnd() |
| 303 { |
| 304 // Check for selection is editable and whether it's range selection or not. |
| 305 if (!selection().rootEditableElement() || !isRange()) |
| 306 return false; |
| 307 |
| 308 // Collapsing the selection to end of range selection. |
| 309 moveTo(m_selection.end(), DOWNSTREAM); |
| 310 |
| 311 return true; |
| 312 } |
| 313 |
302 static bool removingNodeRemovesPosition(Node& node, const Position& position) | 314 static bool removingNodeRemovesPosition(Node& node, const Position& position) |
303 { | 315 { |
304 if (!position.anchorNode()) | 316 if (!position.anchorNode()) |
305 return false; | 317 return false; |
306 | 318 |
307 if (position.anchorNode() == node) | 319 if (position.anchorNode() == node) |
308 return true; | 320 return true; |
309 | 321 |
310 if (!node.isElementNode()) | 322 if (!node.isElementNode()) |
311 return false; | 323 return false; |
(...skipping 1574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1886 sel.showTreeForThis(); | 1898 sel.showTreeForThis(); |
1887 } | 1899 } |
1888 | 1900 |
1889 void showTree(const WebCore::FrameSelection* sel) | 1901 void showTree(const WebCore::FrameSelection* sel) |
1890 { | 1902 { |
1891 if (sel) | 1903 if (sel) |
1892 sel->showTreeForThis(); | 1904 sel->showTreeForThis(); |
1893 } | 1905 } |
1894 | 1906 |
1895 #endif | 1907 #endif |
OLD | NEW |