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

Unified Diff: third_party/WebKit/Source/core/html/forms/RangeInputType.cpp

Issue 2266423003: Revert of Remove the blocking touch handlers for the input[type=range] and add touch-action instead (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
Index: third_party/WebKit/Source/core/html/forms/RangeInputType.cpp
diff --git a/third_party/WebKit/Source/core/html/forms/RangeInputType.cpp b/third_party/WebKit/Source/core/html/forms/RangeInputType.cpp
index 06a4be9aa064ee6d75525ab5d0ae94db5501f744..99734bd5547b0238af4bcdb2e3335dc97b336e15 100644
--- a/third_party/WebKit/Source/core/html/forms/RangeInputType.cpp
+++ b/third_party/WebKit/Source/core/html/forms/RangeInputType.cpp
@@ -36,10 +36,13 @@
#include "core/InputTypeNames.h"
#include "core/dom/AXObjectCache.h"
#include "core/dom/NodeComputedStyle.h"
+#include "core/dom/Touch.h"
+#include "core/dom/TouchList.h"
#include "core/dom/shadow/ShadowRoot.h"
#include "core/events/KeyboardEvent.h"
#include "core/events/MouseEvent.h"
#include "core/events/ScopedEventQueue.h"
+#include "core/events/TouchEvent.h"
#include "core/html/HTMLDataListElement.h"
#include "core/html/HTMLDataListOptionsCollection.h"
#include "core/html/HTMLDivElement.h"
@@ -163,6 +166,29 @@
if (targetNode == thumb)
return;
thumb->dragFrom(event->absoluteLocation());
+}
+
+void RangeInputType::handleTouchEvent(TouchEvent* event)
+{
+ if (element().isDisabledOrReadOnly())
+ return;
+
+ if (event->type() == EventTypeNames::touchend) {
+ element().dispatchFormControlChangeEvent();
+ event->setDefaultHandled();
+ return;
+ }
+
+ TouchList* touches = event->targetTouches();
+ if (touches->length() == 1) {
+ sliderThumbElement()->setPositionFromPoint(touches->item(0)->absoluteLocation());
+ event->setDefaultHandled();
+ }
+}
+
+bool RangeInputType::hasTouchEventHandler() const
+{
+ return true;
}
void RangeInputType::handleKeydownEvent(KeyboardEvent* event)
@@ -236,7 +262,6 @@
track->appendChild(SliderThumbElement::create(document));
HTMLElement* container = SliderContainerElement::create(document);
container->appendChild(track);
- container->setAttribute(styleAttr, "-webkit-appearance:inherit");
element().userAgentShadowRoot()->appendChild(container);
}

Powered by Google App Engine
This is Rietveld 408576698