OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006 Apple Computer, 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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
349 // Don't do any expansion. | 349 // Don't do any expansion. |
350 break; | 350 break; |
351 case WordGranularity: { | 351 case WordGranularity: { |
352 // General case: Select the word the caret is positioned inside of, or at the start of (RightWordIfOnBoundary). | 352 // General case: Select the word the caret is positioned inside of, or at the start of (RightWordIfOnBoundary). |
353 // Edge case: If the caret is after the last word in a soft-wrapped line or the last word in | 353 // Edge case: If the caret is after the last word in a soft-wrapped line or the last word in |
354 // the document, select that last word (LeftWordIfOnBoundary). | 354 // the document, select that last word (LeftWordIfOnBoundary). |
355 // Edge case: If the caret is after the last word in a paragraph, se lect from the the end of the | 355 // Edge case: If the caret is after the last word in a paragraph, se lect from the the end of the |
356 // last word to the line break (also RightWordIfOnBoundary); | 356 // last word to the line break (also RightWordIfOnBoundary); |
357 VisiblePosition start = VisiblePosition(m_start, m_affinity); | 357 VisiblePosition start = VisiblePosition(m_start, m_affinity); |
358 VisiblePosition originalEnd(m_end, m_affinity); | 358 VisiblePosition originalEnd(m_end, m_affinity); |
359 | |
360 if (!isContentEditable() && isStartOfWordASpace(start)) { | |
361 start = start.next(); | |
362 if (comparePositions(start, originalEnd) >= 0) | |
363 originalEnd = originalEnd.next(); | |
364 } | |
Yuta Kitamura
2014/05/07 11:09:08
It's totally unclear to me why |start| and |end| n
| |
365 | |
359 EWordSide side = RightWordIfOnBoundary; | 366 EWordSide side = RightWordIfOnBoundary; |
360 if (isEndOfEditableOrNonEditableContent(start) || (isEndOfLine(start ) && !isStartOfLine(start) && !isEndOfParagraph(start))) | 367 if (isEndOfEditableOrNonEditableContent(start) || (isEndOfLine(start ) && !isStartOfLine(start) && !isEndOfParagraph(start))) |
361 side = LeftWordIfOnBoundary; | 368 side = LeftWordIfOnBoundary; |
362 m_start = startOfWord(start, side).deepEquivalent(); | 369 m_start = startOfWord(start, side).deepEquivalent(); |
363 side = RightWordIfOnBoundary; | 370 side = RightWordIfOnBoundary; |
364 if (isEndOfEditableOrNonEditableContent(originalEnd) || (isEndOfLine (originalEnd) && !isStartOfLine(originalEnd) && !isEndOfParagraph(originalEnd))) | 371 if (isEndOfEditableOrNonEditableContent(originalEnd) || (isEndOfLine (originalEnd) && !isStartOfLine(originalEnd) && !isEndOfParagraph(originalEnd))) |
365 side = LeftWordIfOnBoundary; | 372 side = LeftWordIfOnBoundary; |
366 | 373 |
367 VisiblePosition wordEnd(endOfWord(originalEnd, side)); | 374 VisiblePosition wordEnd(endOfWord(originalEnd, side)); |
368 VisiblePosition end(wordEnd); | 375 VisiblePosition end(wordEnd); |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
824 sel.showTreeForThis(); | 831 sel.showTreeForThis(); |
825 } | 832 } |
826 | 833 |
827 void showTree(const WebCore::VisibleSelection* sel) | 834 void showTree(const WebCore::VisibleSelection* sel) |
828 { | 835 { |
829 if (sel) | 836 if (sel) |
830 sel->showTreeForThis(); | 837 sel->showTreeForThis(); |
831 } | 838 } |
832 | 839 |
833 #endif | 840 #endif |
OLD | NEW |