Commit f4f29e88 authored by nzolghadr's avatar nzolghadr Committed by Commit bot

Move slider implemention to use pointer capture

Previously slider input implementation was using
a hack in EventHandler to capture all the incoming
inputs. Now that pointer capture APIs are
introduced we can remove that hack.

BUG=701058

Review-Url: https://codereview.chromium.org/2749313002
Cr-Commit-Position: refs/heads/master@{#457846}
parent 2991f43a
......@@ -177,7 +177,11 @@ void SliderThumbElement::setPositionFromPoint(const LayoutPoint& point) {
void SliderThumbElement::startDragging() {
if (LocalFrame* frame = document().frame()) {
frame->eventHandler().setCapturingMouseEventsNode(this);
// Note that we get to here only we through mouse event path. The touch
// events are implicitly captured to the starting element and will be
// handled in handleTouchEvent function.
frame->eventHandler().setPointerCapture(PointerEventFactory::s_mouseId,
this);
m_inDragMode = true;
}
}
......@@ -186,8 +190,10 @@ void SliderThumbElement::stopDragging() {
if (!m_inDragMode)
return;
if (LocalFrame* frame = document().frame())
frame->eventHandler().setCapturingMouseEventsNode(nullptr);
if (LocalFrame* frame = document().frame()) {
frame->eventHandler().releasePointerCapture(PointerEventFactory::s_mouseId,
this);
}
m_inDragMode = false;
if (layoutObject())
layoutObject()->setNeedsLayoutAndFullPaintInvalidation(
......@@ -197,6 +203,12 @@ void SliderThumbElement::stopDragging() {
}
void SliderThumbElement::defaultEventHandler(Event* event) {
if (event->isPointerEvent() &&
event->type() == EventTypeNames::lostpointercapture) {
stopDragging();
return;
}
if (!event->isMouseEvent()) {
HTMLDivElement::defaultEventHandler(event);
return;
......
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