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

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

Issue 294963003: MediaVolumeSliderPart is not vertical (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Added TC. Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/media/media-controls.js ('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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 197
198 198
199 // FIXME: We can't use stepUp() for the step value "any". So, we increase 199 // FIXME: We can't use stepUp() for the step value "any". So, we increase
200 // or decrease the value by 1/100 of the value range. Is it reasonable? 200 // or decrease the value by 1/100 of the value range. Is it reasonable?
201 const Decimal step = equalIgnoringCase(element().fastGetAttribute(stepAttr), "any") ? (stepRange.maximum() - stepRange.minimum()) / 100 : stepRange.step(); 201 const Decimal step = equalIgnoringCase(element().fastGetAttribute(stepAttr), "any") ? (stepRange.maximum() - stepRange.minimum()) / 100 : stepRange.step();
202 const Decimal bigStep = max((stepRange.maximum() - stepRange.minimum()) / 10 , step); 202 const Decimal bigStep = max((stepRange.maximum() - stepRange.minimum()) / 10 , step);
203 203
204 bool isVertical = false; 204 bool isVertical = false;
205 if (element().renderer()) { 205 if (element().renderer()) {
206 ControlPart part = element().renderer()->style()->appearance(); 206 ControlPart part = element().renderer()->style()->appearance();
207 isVertical = part == SliderVerticalPart || part == MediaVolumeSliderPart ; 207 isVertical = part == SliderVerticalPart;
208 } 208 }
209 209
210 Decimal newValue; 210 Decimal newValue;
211 if (key == "Up") 211 if (key == "Up")
212 newValue = current + step; 212 newValue = current + step;
213 else if (key == "Down") 213 else if (key == "Down")
214 newValue = current - step; 214 newValue = current - step;
215 else if (key == "Left") 215 else if (key == "Left")
216 newValue = isVertical ? current + step : current - step; 216 newValue = isVertical ? current + step : current - step;
217 else if (key == "Right") 217 else if (key == "Right")
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 right = middle; 394 right = middle;
395 } 395 }
396 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);
397 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);
398 if (closestRight - value < value - closestLeft) 398 if (closestRight - value < value - closestLeft)
399 return closestRight; 399 return closestRight;
400 return closestLeft; 400 return closestLeft;
401 } 401 }
402 402
403 } // namespace WebCore 403 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/media/media-controls.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698