Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007 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 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1395 return Position(); | 1395 return Position(); |
| 1396 | 1396 |
| 1397 const Position& prev = previousCharacterPosition(position, affinity); | 1397 const Position& prev = previousCharacterPosition(position, affinity); |
| 1398 if (prev == position) | 1398 if (prev == position) |
| 1399 return Position(); | 1399 return Position(); |
| 1400 const Node* const anchorNode = prev.anchorNode(); | 1400 const Node* const anchorNode = prev.anchorNode(); |
| 1401 if (!anchorNode || !anchorNode->isTextNode()) | 1401 if (!anchorNode || !anchorNode->isTextNode()) |
| 1402 return Position(); | 1402 return Position(); |
| 1403 if (enclosingBlockFlowElement(*anchorNode) != enclosingBlockFlowElement(*pos ition.anchorNode())) | 1403 if (enclosingBlockFlowElement(*anchorNode) != enclosingBlockFlowElement(*pos ition.anchorNode())) |
| 1404 return Position(); | 1404 return Position(); |
| 1405 if (!anchorNode->isTextNode()) | 1405 if (option == NotConsiderNonCollapsibleWhitespace && anchorNode->layoutObjec t() && !anchorNode->layoutObject()->style()->collapseWhiteSpace()) |
| 1406 return Position(); | 1406 return Position(); |
| 1407 const String& string = toText(anchorNode)->data(); | 1407 const String& string = toText(anchorNode)->data(); |
| 1408 const UChar previousCharacter = string[prev.computeOffsetInContainerNode()]; | 1408 const UChar previousCharacter = string[prev.computeOffsetInContainerNode()]; |
| 1409 const bool isSpace = option == ConsiderNonCollapsibleWhitespace ? (isSpaceOr Newline(previousCharacter) || previousCharacter == noBreakSpaceCharacter) : isCo llapsibleWhitespace(previousCharacter); | 1409 if (!isSpaceOrNewline(previousCharacter) && previousCharacter != noBreakSpac eCharacter) |
|
yoichio
2016/04/01 05:10:05
This check works whether option is?
yosin_UTC9
2016/04/01 05:53:37
Go tit. Revert this change.
| |
| 1410 if (!isSpace || !isEditablePosition(prev)) | 1410 return Position(); |
| 1411 if (!isEditablePosition(prev)) | |
| 1411 return Position(); | 1412 return Position(); |
| 1412 return prev; | 1413 return prev; |
| 1413 } | 1414 } |
| 1414 | 1415 |
| 1415 // This assumes that it starts in editable content. | 1416 // This assumes that it starts in editable content. |
| 1416 Position trailingWhitespacePosition(const Position& position, TextAffinity, Whit espacePositionOption option) | 1417 Position trailingWhitespacePosition(const Position& position, TextAffinity, Whit espacePositionOption option) |
| 1417 { | 1418 { |
| 1418 ASSERT(isEditablePosition(position, ContentIsEditable, DoNotUpdateStyle)); | 1419 ASSERT(isEditablePosition(position, ContentIsEditable, DoNotUpdateStyle)); |
| 1419 if (position.isNull()) | 1420 if (position.isNull()) |
| 1420 return Position(); | 1421 return Position(); |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1700 // instead of possibly at the end of the last node before the selection | 1701 // instead of possibly at the end of the last node before the selection |
| 1701 return mostForwardCaretPosition(visiblePosition.deepEquivalent()); | 1702 return mostForwardCaretPosition(visiblePosition.deepEquivalent()); |
| 1702 } | 1703 } |
| 1703 | 1704 |
| 1704 bool isTextSecurityNode(const Node* node) | 1705 bool isTextSecurityNode(const Node* node) |
| 1705 { | 1706 { |
| 1706 return node && node->layoutObject() && node->layoutObject()->style()->textSe curity() != TSNONE; | 1707 return node && node->layoutObject() && node->layoutObject()->style()->textSe curity() != TSNONE; |
| 1707 } | 1708 } |
| 1708 | 1709 |
| 1709 } // namespace blink | 1710 } // namespace blink |
| OLD | NEW |