| Index: Source/core/dom/Position.h
|
| diff --git a/Source/core/dom/Position.h b/Source/core/dom/Position.h
|
| index 84289dc994de9a2d8406d30b34e4696909bea2cb..643ba2b7ac41bb4b65eb16a77d280ec9ebd34753 100644
|
| --- a/Source/core/dom/Position.h
|
| +++ b/Source/core/dom/Position.h
|
| @@ -152,9 +152,9 @@
|
| // using composed characters, the result may be inside a single user-visible character if a ligature is formed.
|
| Position previous(PositionMoveType = CodePoint) const;
|
| Position next(PositionMoveType = CodePoint) const;
|
| - static int uncheckedPreviousOffset(const Node&, int current);
|
| - static int uncheckedPreviousOffsetForBackwardDeletion(const Node&, int current);
|
| - static int uncheckedNextOffset(const Node&, int current);
|
| + static int uncheckedPreviousOffset(const Node*, int current);
|
| + static int uncheckedPreviousOffsetForBackwardDeletion(const Node*, int current);
|
| + static int uncheckedNextOffset(const Node*, int current);
|
|
|
| // These can be either inside or just before/after the node, depending on
|
| // if the node is ignored by editing or not.
|
| @@ -192,6 +192,8 @@
|
| static bool nodeIsUserSelectNone(Node*);
|
| static bool nodeIsUserSelectAll(const Node*);
|
| static Node* rootUserSelectAllForNode(Node*);
|
| +
|
| + static ContainerNode* findParent(const Node*);
|
|
|
| void debugPosition(const char* msg = "") const;
|
|
|
| @@ -258,19 +260,21 @@
|
| }
|
|
|
| // positionBeforeNode and positionAfterNode return neighbor-anchored positions, construction is O(1)
|
| -inline Position positionBeforeNode(Node& anchorNode)
|
| -{
|
| - return Position(PassRefPtr<Node>(anchorNode), Position::PositionIsBeforeAnchor);
|
| -}
|
| -
|
| -inline Position positionAfterNode(Node& anchorNode)
|
| -{
|
| - return Position(PassRefPtr<Node>(anchorNode), Position::PositionIsAfterAnchor);
|
| -}
|
| -
|
| -inline int lastOffsetInNode(Node& node)
|
| -{
|
| - return node.offsetInCharacters() ? node.maxCharacterOffset() : static_cast<int>(node.countChildren());
|
| +inline Position positionBeforeNode(Node* anchorNode)
|
| +{
|
| + ASSERT(anchorNode);
|
| + return Position(anchorNode, Position::PositionIsBeforeAnchor);
|
| +}
|
| +
|
| +inline Position positionAfterNode(Node* anchorNode)
|
| +{
|
| + ASSERT(anchorNode);
|
| + return Position(anchorNode, Position::PositionIsAfterAnchor);
|
| +}
|
| +
|
| +inline int lastOffsetInNode(Node* node)
|
| +{
|
| + return node->offsetInCharacters() ? node->maxCharacterOffset() : static_cast<int>(node->countChildren());
|
| }
|
|
|
| // firstPositionInNode and lastPositionInNode return parent-anchored positions, lastPositionInNode construction is O(n) due to countChildren()
|
| @@ -284,7 +288,7 @@
|
| inline Position lastPositionInNode(Node* anchorNode)
|
| {
|
| if (anchorNode->isTextNode())
|
| - return Position(anchorNode, lastOffsetInNode(*anchorNode), Position::PositionIsOffsetInAnchor);
|
| + return Position(anchorNode, lastOffsetInNode(anchorNode), Position::PositionIsOffsetInAnchor);
|
| return Position(anchorNode, Position::PositionIsAfterChildren);
|
| }
|
|
|
|
|