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

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

Issue 1660863002: Force all LayoutUnit construction to be explicit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Also fix LayoutRectTest.cpp Created 4 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Google Inc. All rights reserved. 3 * Copyright (C) 2010 Google 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 position = std::min(position, trackSize).clampNegativeToZero(); 147 position = std::min(position, trackSize).clampNegativeToZero();
148 const Decimal ratio = Decimal::fromDouble(static_cast<double>(position) / tr ackSize); 148 const Decimal ratio = Decimal::fromDouble(static_cast<double>(position) / tr ackSize);
149 const Decimal fraction = isVertical || !isLeftToRightDirection ? Decimal(1) - ratio : ratio; 149 const Decimal fraction = isVertical || !isLeftToRightDirection ? Decimal(1) - ratio : ratio;
150 StepRange stepRange(input->createStepRange(RejectAny)); 150 StepRange stepRange(input->createStepRange(RejectAny));
151 Decimal value = stepRange.clampValue(stepRange.valueFromProportion(fraction) ); 151 Decimal value = stepRange.clampValue(stepRange.valueFromProportion(fraction) );
152 152
153 Decimal closest = input->findClosestTickMarkValue(value); 153 Decimal closest = input->findClosestTickMarkValue(value);
154 if (closest.isFinite()) { 154 if (closest.isFinite()) {
155 double closestFraction = stepRange.proportionFromValue(closest).toDouble (); 155 double closestFraction = stepRange.proportionFromValue(closest).toDouble ();
156 double closestRatio = isVertical || !isLeftToRightDirection ? 1.0 - clos estFraction : closestFraction; 156 double closestRatio = isVertical || !isLeftToRightDirection ? 1.0 - clos estFraction : closestFraction;
157 LayoutUnit closestPosition = trackSize * closestRatio; 157 LayoutUnit closestPosition(trackSize * closestRatio);
158 const LayoutUnit snappingThreshold = 5; 158 const LayoutUnit snappingThreshold(5);
159 if ((closestPosition - position).abs() <= snappingThreshold) 159 if ((closestPosition - position).abs() <= snappingThreshold)
160 value = closest; 160 value = closest;
161 } 161 }
162 162
163 String valueString = serializeForNumberType(value); 163 String valueString = serializeForNumberType(value);
164 if (valueString == input->value()) 164 if (valueString == input->value())
165 return; 165 return;
166 166
167 // FIXME: This is no longer being set from renderer. Consider updating the m ethod name. 167 // FIXME: This is no longer being set from renderer. Consider updating the m ethod name.
168 input->setValueFromRenderer(valueString); 168 input->setValueFromRenderer(valueString);
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 case MediaVolumeSliderThumbPart: 326 case MediaVolumeSliderThumbPart:
327 case MediaFullScreenVolumeSliderPart: 327 case MediaFullScreenVolumeSliderPart:
328 case MediaFullScreenVolumeSliderThumbPart: 328 case MediaFullScreenVolumeSliderThumbPart:
329 return mediaSliderContainer; 329 return mediaSliderContainer;
330 default: 330 default:
331 return sliderContainer; 331 return sliderContainer;
332 } 332 }
333 } 333 }
334 334
335 } // namespace blink 335 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLSelectElement.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutGeometryMap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698