| Index: Source/core/editing/VisibleUnits.cpp
|
| diff --git a/Source/core/editing/VisibleUnits.cpp b/Source/core/editing/VisibleUnits.cpp
|
| index 9ffa0c86b26111f990102052a61108d09d4f7224..adcbe0892f53355e63542650b1790b20b36b964b 100644
|
| --- a/Source/core/editing/VisibleUnits.cpp
|
| +++ b/Source/core/editing/VisibleUnits.cpp
|
| @@ -766,6 +766,38 @@ static VisiblePosition startOfLine(const VisiblePosition& c, LineEndpointComputa
|
| return c.honorEditingBoundaryAtOrBefore(visPos);
|
| }
|
|
|
| +bool isStartOfWordASpace(const VisiblePosition& visiblePosition)
|
| +{
|
| + if (visiblePosition.isNull())
|
| + return false;
|
| +
|
| + Position position = visiblePosition.deepEquivalent();
|
| + Node* node = position.anchorNode();
|
| + Document& document = node->document();
|
| +
|
| + if (!document.documentElement())
|
| + return false;
|
| +
|
| + Node* boundary = node->enclosingBlockFlowElement();
|
| + if (!boundary)
|
| + return false;
|
| +
|
| + RefPtr<Range> searchRange(document.createRange());
|
| + Position start(position.parentAnchoredEquivalent());
|
| + TrackExceptionState exceptionState;
|
| +
|
| + searchRange->selectNodeContents(boundary, exceptionState);
|
| + if (exceptionState.hadException())
|
| + return false;
|
| +
|
| + searchRange->setStart(start.anchorNode(), start.deprecatedEditingOffset(), exceptionState);
|
| + if (exceptionState.hadException())
|
| + return false;
|
| +
|
| + TextIterator it(searchRange.get(), TextIteratorEmitsCharactersBetweenAllVisiblePositions);
|
| + return it.length() ? isASCIISpace(it.characterAt(0)) : false;
|
| +}
|
| +
|
| // FIXME: Rename this function to reflect the fact it ignores bidi levels.
|
| VisiblePosition startOfLine(const VisiblePosition& currentPosition)
|
| {
|
|
|