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

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

Issue 1647313003: Continue converting to explicit LayoutUnit constructors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@explicitContstructors
Patch Set: Add TODO 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/ColumnBalancer.h » ('j') | 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) 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 if (isVertical) { 137 if (isVertical) {
138 trackSize = trackElement->layoutBox()->contentHeight() - layoutBox()->si ze().height(); 138 trackSize = trackElement->layoutBox()->contentHeight() - layoutBox()->si ze().height();
139 position = offset.y() - layoutBox()->size().height() / 2 - trackBounding Box.y() + inputBoundingBox.y() - layoutBox()->marginBottom(); 139 position = offset.y() - layoutBox()->size().height() / 2 - trackBounding Box.y() + inputBoundingBox.y() - layoutBox()->marginBottom();
140 currentPosition = absoluteThumbOrigin.y() - absoluteSliderContentOrigin. y(); 140 currentPosition = absoluteThumbOrigin.y() - absoluteSliderContentOrigin. y();
141 } else { 141 } else {
142 trackSize = trackElement->layoutBox()->contentWidth() - layoutBox()->siz e().width(); 142 trackSize = trackElement->layoutBox()->contentWidth() - layoutBox()->siz e().width();
143 position = offset.x() - layoutBox()->size().width() / 2 - trackBoundingB ox.x() + inputBoundingBox.x(); 143 position = offset.x() - layoutBox()->size().width() / 2 - trackBoundingB ox.x() + inputBoundingBox.x();
144 position -= isLeftToRightDirection ? layoutBox()->marginLeft() : layoutB ox()->marginRight(); 144 position -= isLeftToRightDirection ? layoutBox()->marginLeft() : layoutB ox()->marginRight();
145 currentPosition = absoluteThumbOrigin.x() - absoluteSliderContentOrigin. x(); 145 currentPosition = absoluteThumbOrigin.x() - absoluteSliderContentOrigin. x();
146 } 146 }
147 position = std::max<LayoutUnit>(0, std::min(position, trackSize)); 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;
(...skipping 168 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 | « no previous file | third_party/WebKit/Source/core/layout/ColumnBalancer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698