Index: third_party/WebKit/Source/core/editing/EphemeralRange.cpp |
diff --git a/third_party/WebKit/Source/core/editing/EphemeralRange.cpp b/third_party/WebKit/Source/core/editing/EphemeralRange.cpp |
index 641d8b1fabc3f86d48086de4d370729b5ff2d0e4..2767484862f96592db1f214fa106e2e365b7abd3 100644 |
--- a/third_party/WebKit/Source/core/editing/EphemeralRange.cpp |
+++ b/third_party/WebKit/Source/core/editing/EphemeralRange.cpp |
@@ -11,6 +11,16 @@ |
namespace blink { |
+namespace { |
+template <typename Strategy> |
+Node* commonAncestorContainerNode(const Node* containerA, |
+ const Node* containerB) { |
+ if (!containerA || !containerB) |
+ return nullptr; |
+ return Strategy::commonAncestor(*containerA, *containerB); |
+} |
+} |
+ |
template <typename Strategy> |
EphemeralRangeTemplate<Strategy>::EphemeralRangeTemplate( |
const PositionTemplate<Strategy>& start, |
@@ -109,6 +119,13 @@ PositionTemplate<Strategy> EphemeralRangeTemplate<Strategy>::endPosition() |
} |
template <typename Strategy> |
+Node* EphemeralRangeTemplate<Strategy>::commonAncestorContainer() const { |
+ return commonAncestorContainerNode<Strategy>( |
+ m_startPosition.computeContainerNode(), |
+ m_endPosition.computeContainerNode()); |
+} |
+ |
+template <typename Strategy> |
bool EphemeralRangeTemplate<Strategy>::isCollapsed() const { |
DCHECK(isValid()); |
return m_startPosition == m_endPosition; |