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

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

Issue 1320823002: Introduce Position version of enclsoingBlock() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-27T12:35:12 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') | no next file » | 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 6e355eaf12802c462eba1d6038e987550164d12a..3f77c55442fdec4f8213018f66ab2777f843384c 100644
--- a/Source/core/editing/EditingUtilities.cpp
+++ b/Source/core/editing/EditingUtilities.cpp
@@ -650,13 +650,20 @@ bool isInline(const Node* node)
return node && node->layoutObject() && node->layoutObject()->isInline();
}
-// FIXME: Deploy this in all of the places where enclosingBlockFlow/enclosingBlockFlowOrTableElement are used.
-// FIXME: Pass a position to this function. The enclosing block of [table, x] for example, should be the
-// block that contains the table and not the table, and this function should be the only one responsible for
-// knowing about these kinds of special cases.
+// TODO(yosin) Deploy this in all of the places where |enclosingBlockFlow()| and
+// |enclosingBlockFlowOrTableElement()| are used.
+// TODO(yosin) Callers of |Node| version of |enclosingBlock()| should use
+// |Position| version The enclosing block of [table, x] for example, should be
+// the block that contains the table and not the table, and this function should
+// be the only one responsible for knowing about these kinds of special cases.
Element* enclosingBlock(Node* node, EditingBoundaryCrossingRule rule)
{
- Node* enclosingNode = enclosingNodeOfType(firstPositionInOrBeforeNode(node), isEnclosingBlock, rule);
+ return enclosingBlock(firstPositionInOrBeforeNode(node), rule);
+}
+
+Element* enclosingBlock(const Position& position, EditingBoundaryCrossingRule rule)
+{
+ Node* enclosingNode = enclosingNodeOfType(position, isEnclosingBlock, rule);
return enclosingNode && enclosingNode->isElementNode() ? toElement(enclosingNode) : nullptr;
}
« no previous file with comments | « Source/core/editing/EditingUtilities.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698