Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(486)

Unified Diff: third_party/WebKit/Source/core/html/shadow/SliderThumbElement.cpp

Issue 2749313002: Move slider implemention to use pointer capture (Closed)
Patch Set: Add a note Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/shadow/SliderThumbElement.cpp
diff --git a/third_party/WebKit/Source/core/html/shadow/SliderThumbElement.cpp b/third_party/WebKit/Source/core/html/shadow/SliderThumbElement.cpp
index c359033399174ee455fdd2d4ab7f5754a5e2b987..ddd3f9b913ce6da687e1410466588f7918834491 100644
--- a/third_party/WebKit/Source/core/html/shadow/SliderThumbElement.cpp
+++ b/third_party/WebKit/Source/core/html/shadow/SliderThumbElement.cpp
@@ -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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698