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

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

Issue 14859003: Remove the compile time flag for DATALIST Element. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebasing after r150849 Created 7 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
« no previous file with comments | « Source/core/html/RangeInputType.h ('k') | Source/core/html/shadow/SliderThumbElement.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 26 matching lines...) Expand all
37 #include "core/accessibility/AXObjectCache.h" 37 #include "core/accessibility/AXObjectCache.h"
38 #include "core/dom/ExceptionCodePlaceholder.h" 38 #include "core/dom/ExceptionCodePlaceholder.h"
39 #include "core/dom/KeyboardEvent.h" 39 #include "core/dom/KeyboardEvent.h"
40 #include "core/dom/MouseEvent.h" 40 #include "core/dom/MouseEvent.h"
41 #include "core/dom/ScopedEventQueue.h" 41 #include "core/dom/ScopedEventQueue.h"
42 #include "core/dom/Touch.h" 42 #include "core/dom/Touch.h"
43 #include "core/dom/TouchEvent.h" 43 #include "core/dom/TouchEvent.h"
44 #include "core/dom/TouchList.h" 44 #include "core/dom/TouchList.h"
45 #include "core/dom/shadow/ElementShadow.h" 45 #include "core/dom/shadow/ElementShadow.h"
46 #include "core/dom/shadow/ShadowRoot.h" 46 #include "core/dom/shadow/ShadowRoot.h"
47 #include "core/html/HTMLDataListElement.h"
47 #include "core/html/HTMLDivElement.h" 48 #include "core/html/HTMLDivElement.h"
48 #include "core/html/HTMLInputElement.h" 49 #include "core/html/HTMLInputElement.h"
50 #include "core/html/HTMLOptionElement.h"
49 #include "core/html/InputTypeNames.h" 51 #include "core/html/InputTypeNames.h"
50 #include "core/html/StepRange.h" 52 #include "core/html/StepRange.h"
51 #include "core/html/parser/HTMLParserIdioms.h" 53 #include "core/html/parser/HTMLParserIdioms.h"
52 #include "core/html/shadow/SliderThumbElement.h" 54 #include "core/html/shadow/SliderThumbElement.h"
53 #include "core/platform/PlatformMouseEvent.h" 55 #include "core/platform/PlatformMouseEvent.h"
54 #include "core/rendering/RenderSlider.h" 56 #include "core/rendering/RenderSlider.h"
55 #include <wtf/MathExtras.h> 57 #include "wtf/MathExtras.h"
56 #include <wtf/PassOwnPtr.h> 58 #include "wtf/NonCopyingSort.h"
57 59 #include "wtf/PassOwnPtr.h"
58 #if ENABLE(DATALIST_ELEMENT)
59 #include "core/html/HTMLDataListElement.h"
60 #include "core/html/HTMLOptionElement.h"
61 #include <wtf/NonCopyingSort.h>
62 #endif
63 60
64 namespace WebCore { 61 namespace WebCore {
65 62
66 using namespace HTMLNames; 63 using namespace HTMLNames;
67 using namespace std; 64 using namespace std;
68 65
69 static const int rangeDefaultMinimum = 0; 66 static const int rangeDefaultMinimum = 0;
70 static const int rangeDefaultMaximum = 100; 67 static const int rangeDefaultMaximum = 100;
71 static const int rangeDefaultStep = 1; 68 static const int rangeDefaultStep = 1;
72 static const int rangeDefaultStepBase = 0; 69 static const int rangeDefaultStepBase = 0;
73 static const int rangeStepScaleFactor = 1; 70 static const int rangeStepScaleFactor = 1;
74 71
75 static Decimal ensureMaximum(const Decimal& proposedValue, const Decimal& minimu m, const Decimal& fallbackValue) 72 static Decimal ensureMaximum(const Decimal& proposedValue, const Decimal& minimu m, const Decimal& fallbackValue)
76 { 73 {
77 return proposedValue >= minimum ? proposedValue : std::max(minimum, fallback Value); 74 return proposedValue >= minimum ? proposedValue : std::max(minimum, fallback Value);
78 } 75 }
79 76
80 PassOwnPtr<InputType> RangeInputType::create(HTMLInputElement* element) 77 PassOwnPtr<InputType> RangeInputType::create(HTMLInputElement* element)
81 { 78 {
82 return adoptPtr(new RangeInputType(element)); 79 return adoptPtr(new RangeInputType(element));
83 } 80 }
84 81
85 RangeInputType::RangeInputType(HTMLInputElement* element) 82 RangeInputType::RangeInputType(HTMLInputElement* element)
86 : InputType(element) 83 : InputType(element)
87 #if ENABLE(DATALIST_ELEMENT)
88 , m_tickMarkValuesDirty(true) 84 , m_tickMarkValuesDirty(true)
89 #endif
90 { 85 {
91 } 86 }
92 87
93 void RangeInputType::attach() 88 void RangeInputType::attach()
94 { 89 {
95 observeFeatureIfVisible(UseCounter::InputTypeRange); 90 observeFeatureIfVisible(UseCounter::InputTypeRange);
96 } 91 }
97 92
98 bool RangeInputType::isRangeControl() const 93 bool RangeInputType::isRangeControl() const
99 { 94 {
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 HTMLElement* RangeInputType::sliderThumbElement() const 320 HTMLElement* RangeInputType::sliderThumbElement() const
326 { 321 {
327 return sliderThumbElementOf(element()); 322 return sliderThumbElementOf(element());
328 } 323 }
329 324
330 HTMLElement* RangeInputType::sliderTrackElement() const 325 HTMLElement* RangeInputType::sliderTrackElement() const
331 { 326 {
332 return sliderTrackElementOf(element()); 327 return sliderTrackElementOf(element());
333 } 328 }
334 329
335 #if ENABLE(DATALIST_ELEMENT)
336 void RangeInputType::listAttributeTargetChanged() 330 void RangeInputType::listAttributeTargetChanged()
337 { 331 {
338 m_tickMarkValuesDirty = true; 332 m_tickMarkValuesDirty = true;
339 HTMLElement* sliderTrackElement = sliderTrackElementOf(element()); 333 HTMLElement* sliderTrackElement = sliderTrackElementOf(element());
340 if (sliderTrackElement->renderer()) 334 if (sliderTrackElement->renderer())
341 sliderTrackElement->renderer()->setNeedsLayout(true); 335 sliderTrackElement->renderer()->setNeedsLayout(true);
342 } 336 }
343 337
344 static bool decimalCompare(const Decimal& a, const Decimal& b) 338 static bool decimalCompare(const Decimal& a, const Decimal& b)
345 { 339 {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 left = middle; 388 left = middle;
395 else 389 else
396 right = middle; 390 right = middle;
397 } 391 }
398 const Decimal closestLeft = middle ? m_tickMarkValues[middle - 1] : Decimal: :infinity(Decimal::Negative); 392 const Decimal closestLeft = middle ? m_tickMarkValues[middle - 1] : Decimal: :infinity(Decimal::Negative);
399 const Decimal closestRight = middle != m_tickMarkValues.size() ? m_tickMarkV alues[middle] : Decimal::infinity(Decimal::Positive); 393 const Decimal closestRight = middle != m_tickMarkValues.size() ? m_tickMarkV alues[middle] : Decimal::infinity(Decimal::Positive);
400 if (closestRight - value < value - closestLeft) 394 if (closestRight - value < value - closestLeft)
401 return closestRight; 395 return closestRight;
402 return closestLeft; 396 return closestLeft;
403 } 397 }
404 #endif
405 398
406 } // namespace WebCore 399 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/RangeInputType.h ('k') | Source/core/html/shadow/SliderThumbElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698