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

Make EventHandler to use VisibleSelection::toNormalizedEphemeralRange()...

Make EventHandler to use VisibleSelection::toNormalizedEphemeralRange() instead of toNormalizedRange()

This patch changes |EventHandler| class to use |toNormalizedEphemeralRange()|
in |VisibleSelection| class instead of |toNormalizedRange()| as a preparation
of templatizing |VisibleSelection| to use templatized positions instead of
DOM position to represent range.

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

git-svn-id: svn://svn.chromium.org/blink/trunk@201121 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent c78fe095
...@@ -1654,7 +1654,9 @@ bool EventHandler::handleMouseFocus(const MouseEventWithHitTestResults& targeted ...@@ -1654,7 +1654,9 @@ bool EventHandler::handleMouseFocus(const MouseEventWithHitTestResults& targeted
// mouseup will set a selection inside it, which will call // mouseup will set a selection inside it, which will call
// FrameSelection::setFocusedNodeIfNeeded. // FrameSelection::setFocusedNodeIfNeeded.
if (element && m_frame->selection().isRange()) { if (element && m_frame->selection().isRange()) {
if (m_frame->selection().toNormalizedRange()->isNodeFullyContained(*element) // TODO(yosin) We should not create |Range| object for calling
// |isNodeFullyContained()|.
if (createRange(m_frame->selection().selection().toNormalizedEphemeralRange())->isNodeFullyContained(*element)
&& element->isDescendantOf(m_frame->document()->focusedElement())) && element->isDescendantOf(m_frame->document()->focusedElement()))
return false; return false;
} }
......
...@@ -92,7 +92,7 @@ TEST_F(EventHandlerTest, dragSelectionAfterScroll) ...@@ -92,7 +92,7 @@ TEST_F(EventHandlerTest, dragSelectionAfterScroll)
FrameSelection& selection = document().frame()->selection(); FrameSelection& selection = document().frame()->selection();
ASSERT_TRUE(selection.isRange()); ASSERT_TRUE(selection.isRange());
RefPtrWillBeRawPtr<Range> range = selection.toNormalizedRange(); RefPtrWillBeRawPtr<Range> range = createRange(selection.selection().toNormalizedEphemeralRange());
ASSERT_TRUE(range.get()); ASSERT_TRUE(range.get());
EXPECT_EQ("Line 1\nLine 2", range->text()); EXPECT_EQ("Line 1\nLine 2", range->text());
} }
......
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