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

Side by Side Diff: Source/core/html/forms/RangeInputType.cpp

Issue 234933002: Dispatch change event for Input type=range for touchEnd (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Code review changes Created 6 years, 8 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 unified diff | Download patch
« no previous file with comments | « LayoutTests/fast/forms/range/slider-onchange-event-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * Copyright (C) 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2011 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 return; 159 return;
160 thumb->dragFrom(event->absoluteLocation()); 160 thumb->dragFrom(event->absoluteLocation());
161 } 161 }
162 162
163 void RangeInputType::handleTouchEvent(TouchEvent* event) 163 void RangeInputType::handleTouchEvent(TouchEvent* event)
164 { 164 {
165 if (element().isDisabledOrReadOnly()) 165 if (element().isDisabledOrReadOnly())
166 return; 166 return;
167 167
168 if (event->type() == EventTypeNames::touchend) { 168 if (event->type() == EventTypeNames::touchend) {
169 element().dispatchFormControlChangeEvent();
169 event->setDefaultHandled(); 170 event->setDefaultHandled();
170 return; 171 return;
171 } 172 }
172 173
173 TouchList* touches = event->targetTouches(); 174 TouchList* touches = event->targetTouches();
174 if (touches->length() == 1) { 175 if (touches->length() == 1) {
175 sliderThumbElement()->setPositionFromPoint(touches->item(0)->absoluteLoc ation()); 176 sliderThumbElement()->setPositionFromPoint(touches->item(0)->absoluteLoc ation());
176 event->setDefaultHandled(); 177 event->setDefaultHandled();
177 } 178 }
178 } 179 }
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 right = middle; 394 right = middle;
394 } 395 }
395 const Decimal closestLeft = middle ? m_tickMarkValues[middle - 1] : Decimal: :infinity(Decimal::Negative); 396 const Decimal closestLeft = middle ? m_tickMarkValues[middle - 1] : Decimal: :infinity(Decimal::Negative);
396 const Decimal closestRight = middle != m_tickMarkValues.size() ? m_tickMarkV alues[middle] : Decimal::infinity(Decimal::Positive); 397 const Decimal closestRight = middle != m_tickMarkValues.size() ? m_tickMarkV alues[middle] : Decimal::infinity(Decimal::Positive);
397 if (closestRight - value < value - closestLeft) 398 if (closestRight - value < value - closestLeft)
398 return closestRight; 399 return closestRight;
399 return closestLeft; 400 return closestLeft;
400 } 401 }
401 402
402 } // namespace WebCore 403 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/forms/range/slider-onchange-event-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698