Commit 91963aac authored by yosin@chromium.org's avatar yosin@chromium.org

Introduce Position version of enclsoingBlock()

This patch introduces |Position| version of |enclosingBlock()| as a preparation
of templatzing it.

This patch is a preparation of making selection to handle granularity for web
component, http://crrev.com/1277863002

BUG=513568
TEST=n/a; No behavior changes

Review URL: https://codereview.chromium.org/1320823002

git-svn-id: svn://svn.chromium.org/blink/trunk@201289 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 7a95ea43
......@@ -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;
}
......
......@@ -71,6 +71,7 @@ Node* highestNodeToRemoveInPruning(Node*, Node* excludeNode = nullptr);
Element* lowestEditableAncestor(Node*);
Element* enclosingBlock(Node*, EditingBoundaryCrossingRule = CannotCrossEditingBoundary);
Element* enclosingBlock(const Position&, EditingBoundaryCrossingRule);
Element* enclosingBlockFlowElement(Node&); // Deprecated, use enclosingBlock instead.
bool inSameContainingBlockFlowElement(Node*, Node*);
Element* enclosingTableCell(const Position&);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment