| Index: Source/core/editing/htmlediting.cpp
|
| diff --git a/Source/core/editing/htmlediting.cpp b/Source/core/editing/htmlediting.cpp
|
| index 8b5e040f7fb0d12d1e820f6ee2dadde554a62a8c..5cc0cece6dd5ce46a654b73850d16eaf6b72506c 100644
|
| --- a/Source/core/editing/htmlediting.cpp
|
| +++ b/Source/core/editing/htmlediting.cpp
|
| @@ -334,6 +334,23 @@ Element* enclosingBlock(Node* node, EditingBoundaryCrossingRule rule)
|
| return enclosingNode && enclosingNode->isElementNode() ? toElement(enclosingNode) : 0;
|
| }
|
|
|
| +Element* enclosingBlockFlowElement(Node& node)
|
| +{
|
| + if (node.isBlockFlowElement())
|
| + return &toElement(node);
|
| +
|
| + for (Node* n = node.parentNode(); n; n = n->parentNode()) {
|
| + if (n->isBlockFlowElement() || isHTMLBodyElement(*n))
|
| + return toElement(n);
|
| + }
|
| + return 0;
|
| +}
|
| +
|
| +bool inSameContainingBlockFlowElement(Node* a, Node* b)
|
| +{
|
| + return a && b && enclosingBlockFlowElement(*a) == enclosingBlockFlowElement(*b);
|
| +}
|
| +
|
| TextDirection directionOfEnclosingBlock(const Position& position)
|
| {
|
| Element* enclosingBlockElement = enclosingBlock(position.containerNode());
|
| @@ -933,7 +950,7 @@ Position leadingWhitespacePosition(const Position& position, EAffinity affinity,
|
| return Position();
|
|
|
| Position prev = previousCharacterPosition(position, affinity);
|
| - if (prev != position && prev.anchorNode()->inSameContainingBlockFlowElement(position.anchorNode()) && prev.anchorNode()->isTextNode()) {
|
| + if (prev != position && inSameContainingBlockFlowElement(prev.anchorNode(), position.anchorNode()) && prev.anchorNode()->isTextNode()) {
|
| String string = toText(prev.anchorNode())->data();
|
| UChar previousCharacter = string[prev.deprecatedEditingOffset()];
|
| bool isSpace = option == ConsiderNonCollapsibleWhitespace ? (isSpaceOrNewline(previousCharacter) || previousCharacter == noBreakSpace) : isCollapsibleWhitespace(previousCharacter);
|
|
|