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

Unified Diff: third_party/WebKit/WebCore/dom/Position.cpp

Issue 21165: Revert the merge. Mac build is mysteriously broken. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 10 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 | « third_party/WebKit/WebCore/dom/Position.h ('k') | third_party/WebKit/WebCore/dom/XMLTokenizerLibxml2.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/WebCore/dom/Position.cpp
===================================================================
--- third_party/WebKit/WebCore/dom/Position.cpp (revision 9383)
+++ third_party/WebKit/WebCore/dom/Position.cpp (working copy)
@@ -97,9 +97,9 @@
return WebCore::computedStyle(elem);
}
-Position Position::previous(PositionMoveType moveType) const
+Position Position::previous(EUsingComposedCharacters usingComposedCharacters) const
{
- Node* n = node();
+ Node *n = node();
if (!n)
return *this;
@@ -108,37 +108,28 @@
ASSERT(o >= 0);
if (o > 0) {
- Node* child = n->childNode(o - 1);
- if (child)
+ Node *child = n->childNode(o - 1);
+ if (child) {
return Position(child, maxDeepOffset(child));
-
+ }
// There are two reasons child might be 0:
// 1) The node is node like a text node that is not an element, and therefore has no children.
// Going backward one character at a time is correct.
// 2) The old offset was a bogus offset like (<br>, 1), and there is no child.
// Going from 1 to 0 is correct.
- switch (moveType) {
- case CodePoint:
- return Position(n, o - 1);
- case Character:
- return Position(n, uncheckedPreviousOffset(n, o));
- case BackwardDeletion:
- return Position(n, uncheckedPreviousOffsetForBackwardDeletion(n, o));
- }
+ return Position(n, usingComposedCharacters ? uncheckedPreviousOffset(n, o) : o - 1);
}
- Node* parent = n->parentNode();
+ Node *parent = n->parentNode();
if (!parent)
return *this;
return Position(parent, n->nodeIndex());
}
-Position Position::next(PositionMoveType moveType) const
+Position Position::next(EUsingComposedCharacters usingComposedCharacters) const
{
- ASSERT(moveType != BackwardDeletion);
-
- Node* n = node();
+ Node *n = node();
if (!n)
return *this;
@@ -156,10 +147,10 @@
// Going forward one character at a time is correct.
// 2) The new offset is a bogus offset like (<br>, 1), and there is no child.
// Going from 0 to 1 is correct.
- return Position(n, (moveType == Character) ? uncheckedNextOffset(n, o) : o + 1);
+ return Position(n, usingComposedCharacters ? uncheckedNextOffset(n, o) : o + 1);
}
- Node* parent = n->parentNode();
+ Node *parent = n->parentNode();
if (!parent)
return *this;
@@ -171,11 +162,6 @@
return n->renderer() ? n->renderer()->previousOffset(current) : current - 1;
}
-int Position::uncheckedPreviousOffsetForBackwardDeletion(const Node* n, int current)
-{
- return n->renderer() ? n->renderer()->previousOffsetForBackwardDeletion(current) : current - 1;
-}
-
int Position::uncheckedNextOffset(const Node* n, int current)
{
return n->renderer() ? n->renderer()->nextOffset(current) : current + 1;
« no previous file with comments | « third_party/WebKit/WebCore/dom/Position.h ('k') | third_party/WebKit/WebCore/dom/XMLTokenizerLibxml2.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698