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

Unified Diff: third_party/WebKit/Source/core/editing/VisibleUnits.cpp

Issue 1365263002: Update composed tree version of isEndOfEditableOrNonEditableContent() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2015-09-25T15:29:49 Created 5 years, 3 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 | third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/VisibleUnits.cpp
diff --git a/third_party/WebKit/Source/core/editing/VisibleUnits.cpp b/third_party/WebKit/Source/core/editing/VisibleUnits.cpp
index 751409debe4532e9e5ebdcd14da9a02d8e363478..e0265d75f8273660f8693f7f9331eb3a506d785d 100644
--- a/third_party/WebKit/Source/core/editing/VisibleUnits.cpp
+++ b/third_party/WebKit/Source/core/editing/VisibleUnits.cpp
@@ -45,6 +45,7 @@
#include "core/frame/LocalFrame.h"
#include "core/frame/Settings.h"
#include "core/html/HTMLBRElement.h"
+#include "core/html/HTMLTextFormControlElement.h"
#include "core/layout/HitTestRequest.h"
#include "core/layout/HitTestResult.h"
#include "core/layout/LayoutBlockFlow.h"
@@ -1794,20 +1795,26 @@ VisiblePosition endOfEditableContent(const VisiblePosition& visiblePosition)
return createVisiblePosition(lastPositionInNode(highestRoot));
}
-template <typename Strategy>
-static bool isEndOfEditableOrNonEditableContentAlgorithm(const VisiblePositionTemplate<Strategy>& p)
-{
- return p.isNotNull() && nextPositionOf(p).isNull();
-}
-
bool isEndOfEditableOrNonEditableContent(const VisiblePosition& position)
{
- return isEndOfEditableOrNonEditableContentAlgorithm<EditingStrategy>(position);
+ return position.isNotNull() && nextPositionOf(position).isNull();
}
+// TODO(yosin) We should rename |isEndOfEditableOrNonEditableContent()| what
+// this function does, e.g. |isLastVisiblePositionOrEndOfInnerEditor()|.
bool isEndOfEditableOrNonEditableContent(const VisiblePositionInComposedTree& position)
{
- return isEndOfEditableOrNonEditableContentAlgorithm<EditingInComposedTreeStrategy>(position);
+ if (position.isNull())
+ return false;
+ const VisiblePositionInComposedTree nextPosition = nextPositionOf(position);
+ if (nextPosition.isNull())
+ return true;
+ // In DOM version, following condition, the last position of inner editor
+ // of INPUT/TEXTAREA element, by |nextPosition().isNull()|, because of
+ // an inner editor is an only leaf node.
+ if (!nextPosition.deepEquivalent().isAfterAnchor())
+ return false;
+ return isHTMLTextFormControlElement(nextPosition.deepEquivalent().anchorNode());
}
VisiblePosition leftBoundaryOfLine(const VisiblePosition& c, TextDirection direction)
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698