Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(771)

Side by Side Diff: third_party/WebKit/Source/core/editing/EditingUtilities.cpp

Issue 1854583003: Make leadingWhitespacePosition() to respect "white-space" CSS property (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-04-01T14:49:00 Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/editing/EditingUtilities.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 const bool isSpace = option == ConsiderNonCollapsibleWhitespace ? (isSpaceOr Newline(previousCharacter) || previousCharacter == noBreakSpaceCharacter) : isCo llapsibleWhitespace(previousCharacter);
1410 if (!isSpace || !isEditablePosition(prev)) 1410 if (!isSpace || !isEditablePosition(prev))
1411 return Position(); 1411 return Position();
1412 return prev; 1412 return prev;
1413 } 1413 }
1414 1414
1415 // This assumes that it starts in editable content. 1415 // This assumes that it starts in editable content.
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
1700 // instead of possibly at the end of the last node before the selection 1700 // instead of possibly at the end of the last node before the selection
1701 return mostForwardCaretPosition(visiblePosition.deepEquivalent()); 1701 return mostForwardCaretPosition(visiblePosition.deepEquivalent());
1702 } 1702 }
1703 1703
1704 bool isTextSecurityNode(const Node* node) 1704 bool isTextSecurityNode(const Node* node)
1705 { 1705 {
1706 return node && node->layoutObject() && node->layoutObject()->style()->textSe curity() != TSNONE; 1706 return node && node->layoutObject() && node->layoutObject()->style()->textSe curity() != TSNONE;
1707 } 1707 }
1708 1708
1709 } // namespace blink 1709 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/EditingUtilities.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698