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

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

Issue 2209773002: 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: '==' -> '>=' and '==' -> 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/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 8d9d3f157686106527291c1d3c1f15c6a4c3c210..7c3a1b5884a9f3e055fb52483082f2383eab1b15 100644
--- a/third_party/WebKit/Source/core/html/shadow/SliderThumbElement.cpp
+++ b/third_party/WebKit/Source/core/html/shadow/SliderThumbElement.cpp
@@ -143,6 +143,24 @@ void SliderThumbElement::setPositionFromPoint(const LayoutPoint& point)
}
position = std::min(position, trackSize).clampNegativeToZero();
const Decimal ratio = Decimal::fromDouble(static_cast<double>(position) / trackSize);
+ HTMLInputElement* host = hostInput();
majidvp 2016/08/04 15:20:36 I don't think this component should be involved wi
+ if (!isVertical) {
majidvp 2016/08/04 15:20:36 Good catch handling the vertical case. I think the
+ if (ratio <= Decimal(0)) {
+ host->setAttribute(styleAttr, "touch-action:pan-y pan-left");
+ } else if (ratio >= Decimal(1)) {
+ host->setAttribute(styleAttr, "touch-action:pan-y pan-right");
+ } else {
+ host->setAttribute(styleAttr, "touch-action:pan-y");
+ }
+ } else {
+ if (ratio <= Decimal(0)) {
+ host->setAttribute(styleAttr, "touch-action:pan-x pan-down");
+ } else if (ratio >= Decimal(1)) {
+ host->setAttribute(styleAttr, "touch-action:pan-x pan-up");
+ } else {
+ host->setAttribute(styleAttr, "touch-action:pan-x");
+ }
+ }
const Decimal fraction = isVertical || !isLeftToRightDirection ? Decimal(1) - ratio : ratio;
StepRange stepRange(input->createStepRange(RejectAny));
Decimal value = stepRange.clampValue(stepRange.valueFromProportion(fraction));

Powered by Google App Engine
This is Rietveld 408576698