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

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

Issue 977113003: Rename renderer() to layoutObject(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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 | « Source/core/html/forms/NumberInputType.cpp ('k') | Source/core/html/forms/SearchInputType.cpp » ('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) 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 184
185 StepRange stepRange(createStepRange(RejectAny)); 185 StepRange stepRange(createStepRange(RejectAny));
186 186
187 187
188 // FIXME: We can't use stepUp() for the step value "any". So, we increase 188 // FIXME: We can't use stepUp() for the step value "any". So, we increase
189 // or decrease the value by 1/100 of the value range. Is it reasonable? 189 // or decrease the value by 1/100 of the value range. Is it reasonable?
190 const Decimal step = equalIgnoringCase(element().fastGetAttribute(stepAttr), "any") ? (stepRange.maximum() - stepRange.minimum()) / 100 : stepRange.step(); 190 const Decimal step = equalIgnoringCase(element().fastGetAttribute(stepAttr), "any") ? (stepRange.maximum() - stepRange.minimum()) / 100 : stepRange.step();
191 const Decimal bigStep = std::max((stepRange.maximum() - stepRange.minimum()) / 10, step); 191 const Decimal bigStep = std::max((stepRange.maximum() - stepRange.minimum()) / 10, step);
192 192
193 bool isVertical = false; 193 bool isVertical = false;
194 if (element().renderer()) { 194 if (element().layoutObject()) {
195 ControlPart part = element().renderer()->style()->appearance(); 195 ControlPart part = element().layoutObject()->style()->appearance();
196 isVertical = part == SliderVerticalPart; 196 isVertical = part == SliderVerticalPart;
197 } 197 }
198 198
199 Decimal newValue; 199 Decimal newValue;
200 if (key == "Up") 200 if (key == "Up")
201 newValue = current + step; 201 newValue = current + step;
202 else if (key == "Down") 202 else if (key == "Down")
203 newValue = current - step; 203 newValue = current - step;
204 else if (key == "Left") 204 else if (key == "Left")
205 newValue = isVertical ? current + step : current - step; 205 newValue = isVertical ? current + step : current - step;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 319
320 inline Element* RangeInputType::sliderTrackElement() const 320 inline Element* RangeInputType::sliderTrackElement() const
321 { 321 {
322 return element().closedShadowRoot()->getElementById(ShadowElementNames::slid erTrack()); 322 return element().closedShadowRoot()->getElementById(ShadowElementNames::slid erTrack());
323 } 323 }
324 324
325 void RangeInputType::listAttributeTargetChanged() 325 void RangeInputType::listAttributeTargetChanged()
326 { 326 {
327 m_tickMarkValuesDirty = true; 327 m_tickMarkValuesDirty = true;
328 Element* sliderTrackElement = this->sliderTrackElement(); 328 Element* sliderTrackElement = this->sliderTrackElement();
329 if (sliderTrackElement->renderer()) 329 if (sliderTrackElement->layoutObject())
330 sliderTrackElement->renderer()->setNeedsLayoutAndFullPaintInvalidation() ; 330 sliderTrackElement->layoutObject()->setNeedsLayoutAndFullPaintInvalidati on();
331 } 331 }
332 332
333 static bool decimalCompare(const Decimal& a, const Decimal& b) 333 static bool decimalCompare(const Decimal& a, const Decimal& b)
334 { 334 {
335 return a < b; 335 return a < b;
336 } 336 }
337 337
338 void RangeInputType::updateTickMarkValues() 338 void RangeInputType::updateTickMarkValues()
339 { 339 {
340 if (!m_tickMarkValuesDirty) 340 if (!m_tickMarkValuesDirty)
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 right = middle; 384 right = middle;
385 } 385 }
386 const Decimal closestLeft = middle ? m_tickMarkValues[middle - 1] : Decimal: :infinity(Decimal::Negative); 386 const Decimal closestLeft = middle ? m_tickMarkValues[middle - 1] : Decimal: :infinity(Decimal::Negative);
387 const Decimal closestRight = middle != m_tickMarkValues.size() ? m_tickMarkV alues[middle] : Decimal::infinity(Decimal::Positive); 387 const Decimal closestRight = middle != m_tickMarkValues.size() ? m_tickMarkV alues[middle] : Decimal::infinity(Decimal::Positive);
388 if (closestRight - value < value - closestLeft) 388 if (closestRight - value < value - closestLeft)
389 return closestRight; 389 return closestRight;
390 return closestLeft; 390 return closestLeft;
391 } 391 }
392 392
393 } // namespace blink 393 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/html/forms/NumberInputType.cpp ('k') | Source/core/html/forms/SearchInputType.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698