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

Unified Diff: Source/core/editing/EditingUtilities.cpp

Issue 1310073006: Introduce PositionInComposedTree version of enclosingBlock() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-27T15:40:36 Created 5 years, 4 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 | « Source/core/editing/EditingUtilities.h ('k') | Source/core/editing/EditingUtilitiesTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/EditingUtilities.cpp
diff --git a/Source/core/editing/EditingUtilities.cpp b/Source/core/editing/EditingUtilities.cpp
index 3f77c55442fdec4f8213018f66ab2777f843384c..48881234e34683800878fa2cf55acccdb475cefc 100644
--- a/Source/core/editing/EditingUtilities.cpp
+++ b/Source/core/editing/EditingUtilities.cpp
@@ -661,12 +661,23 @@ Element* enclosingBlock(Node* node, EditingBoundaryCrossingRule rule)
return enclosingBlock(firstPositionInOrBeforeNode(node), rule);
}
-Element* enclosingBlock(const Position& position, EditingBoundaryCrossingRule rule)
+template <typename Strategy>
+Element* enclosingBlockAlgorithm(const PositionAlgorithm<Strategy>& position, EditingBoundaryCrossingRule rule)
{
Node* enclosingNode = enclosingNodeOfType(position, isEnclosingBlock, rule);
return enclosingNode && enclosingNode->isElementNode() ? toElement(enclosingNode) : nullptr;
}
+Element* enclosingBlock(const Position& position, EditingBoundaryCrossingRule rule)
+{
+ return enclosingBlockAlgorithm<EditingStrategy>(position, rule);
+}
+
+Element* enclosingBlock(const PositionInComposedTree& position, EditingBoundaryCrossingRule rule)
+{
+ return enclosingBlockAlgorithm<EditingInComposedTreeStrategy>(position, rule);
+}
+
Element* enclosingBlockFlowElement(Node& node)
{
if (isBlockFlowElement(node))
« no previous file with comments | « Source/core/editing/EditingUtilities.h ('k') | Source/core/editing/EditingUtilitiesTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698