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

Unified Diff: Source/core/dom/Position.h

Issue 189773005: Revert of Have Position deal with more references (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/core/dom/Position.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « no previous file | Source/core/dom/Position.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698