Commit a7f37819 authored by yosin@chromium.org's avatar yosin@chromium.org

Move global function lowestEditableAncestor() to local function in VisibleSelection.cpp

This patch moves global function |lowestEditableAncestor()| in
"EditingUtilities.{cpp,h}" to local function in "VisibleSelection.cpp" to
narrow visibility for improving code health and ease of implement composed tree
version.

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/1318943002

git-svn-id: svn://svn.chromium.org/blink/trunk@201302 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent aadd6347
......@@ -246,19 +246,6 @@ ContainerNode* highestEditableRoot(const PositionInComposedTree& position, Edita
return highestEditableRoot(toPositionInDOMTree(position), editableType);
}
Element* lowestEditableAncestor(Node* node)
{
while (node) {
if (node->hasEditableStyle())
return node->rootEditableElement();
if (isHTMLBodyElement(*node))
break;
node = node->parentNode();
}
return 0;
}
bool isEditablePosition(const Position& p, EditableType editableType, EUpdateStyle updateStyle)
{
Node* node = p.parentAnchoredEquivalent().anchorNode();
......
......@@ -68,7 +68,6 @@ ContainerNode* highestEditableRoot(const PositionInComposedTree&, EditableType =
Node* highestEnclosingNodeOfType(const Position&, bool (*nodeIsOfType)(const Node*),
EditingBoundaryCrossingRule = CannotCrossEditingBoundary, Node* stayWithin = nullptr);
Node* highestNodeToRemoveInPruning(Node*, Node* excludeNode = nullptr);
Element* lowestEditableAncestor(Node*);
Element* enclosingBlock(Node*, EditingBoundaryCrossingRule = CannotCrossEditingBoundary);
Element* enclosingBlock(const Position&, EditingBoundaryCrossingRule);
......
......@@ -905,6 +905,19 @@ bool VisibleSelection::isBaseFirstInComposedTree() const
return m_baseInComposedTree.isNotNull() && m_baseInComposedTree.compareTo(m_extentInComposedTree) <= 0;
}
static Element* lowestEditableAncestor(Node* node)
{
while (node) {
if (node->hasEditableStyle())
return node->rootEditableElement();
if (isHTMLBodyElement(*node))
break;
node = node->parentNode();
}
return nullptr;
}
void VisibleSelection::adjustSelectionToAvoidCrossingEditingBoundaries()
{
if (m_base.isNull() || m_start.isNull() || m_end.isNull())
......
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