Commit 914a0a80 authored by yosin@chromium.org's avatar yosin@chromium.org

Move global function intersectsNode() to local function in FrameSelection.cpp

This patch moves global function |intersectsNode()| in
"VisibleSelection.{cpp,h}" to local function in "FrameSelection.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/1318183002

git-svn-id: svn://svn.chromium.org/blink/trunk@201362 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent f6696fb8
......@@ -360,6 +360,17 @@ void FrameSelection::nodeWillBeRemoved(Node& node)
removingNodeRemovesPosition(node, m_selection.start()), removingNodeRemovesPosition(node, m_selection.end()));
}
static bool intersectsNode(const VisibleSelection& selection, Node* node)
{
if (selection.isNone())
return false;
Position start = selection.start().parentAnchoredEquivalent();
Position end = selection.end().parentAnchoredEquivalent();
TrackExceptionState exceptionState;
// TODO(yosin) We should avoid to use |Range::intersectsNode()|.
return Range::intersectsNode(node, start, end, exceptionState) && !exceptionState.hadException();
}
void FrameSelection::respondToNodeModification(Node& node, bool baseRemoved, bool extentRemoved, bool startRemoved, bool endRemoved)
{
ASSERT(node.document().isActive());
......
......@@ -230,18 +230,6 @@ PassRefPtrWillBeRawPtr<Range> firstRangeOf(const VisibleSelection& selection)
return Range::create(*start.document(), start, end);
}
// TODO(yosin) We should move |intersectsNode()| to "FrameSelection.cpp".
bool intersectsNode(const VisibleSelection& selection, Node* node)
{
if (selection.isNone())
return false;
Position start = selection.start().parentAnchoredEquivalent();
Position end = selection.end().parentAnchoredEquivalent();
TrackExceptionState exceptionState;
// TODO(yosin) We should avoid to use |Range::intersectsNode()|.
return Range::intersectsNode(node, start, end, exceptionState) && !exceptionState.hadException();
}
template <typename Strategy>
static EphemeralRangeTemplate<Strategy> normalizeRangeAlgorithm(const EphemeralRangeTemplate<Strategy>& range)
{
......
......@@ -256,9 +256,6 @@ private:
// to return.
CORE_EXPORT PassRefPtrWillBeRawPtr<Range> firstRangeOf(const VisibleSelection&);
// TODO(yosin) We should move |intersectsNode()| to "FrameSelection.cpp".
bool intersectsNode(const VisibleSelection&, Node*);
} // namespace blink
#ifndef NDEBUG
......
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