Chromium Code Reviews| Index: third_party/WebKit/Source/core/editing/EditingUtilities.cpp |
| diff --git a/third_party/WebKit/Source/core/editing/EditingUtilities.cpp b/third_party/WebKit/Source/core/editing/EditingUtilities.cpp |
| index 8c1b3c10ec0da89f302771a119acb2a59edbc9c7..a9aaa45b7a1fc701fc9256aa70f01f99b9006a03 100644 |
| --- a/third_party/WebKit/Source/core/editing/EditingUtilities.cpp |
| +++ b/third_party/WebKit/Source/core/editing/EditingUtilities.cpp |
| @@ -293,6 +293,17 @@ int comparePositions(const VisiblePosition& a, const VisiblePosition& b) { |
| return comparePositions(a.deepEquivalent(), b.deepEquivalent()); |
| } |
| +bool isNodeFullyContained(const EphemeralRange& range, Node& node) { |
|
tkent
2017/03/29 09:02:17
The second argument should be |const Node&|.
yoichio
2017/03/29 09:25:40
Yes, but Position has non-const Member<Node>.
tkent
2017/03/29 10:39:51
Oh, I see. Please go ahead landing.
|
| + if (range.isNull()) |
| + return false; |
| + |
| + if (!NodeTraversal::commonAncestor(*range.startPosition().anchorNode(), node)) |
| + return false; |
| + |
| + return range.startPosition() <= Position::beforeNode(&node) && |
| + Position::afterNode(&node) <= range.endPosition(); |
| +} |
| + |
| // TODO(editing-dev): We should implement real version which refers |
| // "user-select" CSS property. |
| // TODO(editing-dev): We should make |SelectionAdjuster| to use this funciton |