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

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

Issue 2810593002: Set plugin focus by implementing HTMLPlugInElement::SetFocused. (Closed)
Patch Set: fix comments Created 3 years, 8 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } 85 }
86 86
87 int DateTimeNumericFieldElement::DefaultValueForStepDown() const { 87 int DateTimeNumericFieldElement::DefaultValueForStepDown() const {
88 return range_.maximum; 88 return range_.maximum;
89 } 89 }
90 90
91 int DateTimeNumericFieldElement::DefaultValueForStepUp() const { 91 int DateTimeNumericFieldElement::DefaultValueForStepUp() const {
92 return range_.minimum; 92 return range_.minimum;
93 } 93 }
94 94
95 void DateTimeNumericFieldElement::SetFocused(bool value) { 95 void DateTimeNumericFieldElement::SetFocused(bool value,
96 WebFocusType focus_type) {
96 if (!value) { 97 if (!value) {
97 int value = TypeAheadValue(); 98 int value = TypeAheadValue();
98 type_ahead_buffer_.Clear(); 99 type_ahead_buffer_.Clear();
99 if (value >= 0) 100 if (value >= 0)
100 SetValueAsInteger(value, kDispatchEvent); 101 SetValueAsInteger(value, kDispatchEvent);
101 } 102 }
102 DateTimeFieldElement::SetFocused(value); 103 DateTimeFieldElement::SetFocused(value, focus_type);
103 } 104 }
104 105
105 String DateTimeNumericFieldElement::FormatValue(int value) const { 106 String DateTimeNumericFieldElement::FormatValue(int value) const {
106 Locale& locale = LocaleForOwner(); 107 Locale& locale = LocaleForOwner();
107 if (hard_limits_.maximum > 999) 108 if (hard_limits_.maximum > 999)
108 return locale.ConvertToLocalizedNumber(String::Format("%04d", value)); 109 return locale.ConvertToLocalizedNumber(String::Format("%04d", value));
109 if (hard_limits_.maximum > 99) 110 if (hard_limits_.maximum > 99)
110 return locale.ConvertToLocalizedNumber(String::Format("%03d", value)); 111 return locale.ConvertToLocalizedNumber(String::Format("%03d", value));
111 return locale.ConvertToLocalizedNumber(String::Format("%02d", value)); 112 return locale.ConvertToLocalizedNumber(String::Format("%02d", value));
112 } 113 }
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 int DateTimeNumericFieldElement::RoundUp(int n) const { 231 int DateTimeNumericFieldElement::RoundUp(int n) const {
231 n -= step_.step_base; 232 n -= step_.step_base;
232 if (n >= 0) 233 if (n >= 0)
233 n = (n + step_.step - 1) / step_.step * step_.step; 234 n = (n + step_.step - 1) / step_.step * step_.step;
234 else 235 else
235 n = -(-n / step_.step * step_.step); 236 n = -(-n / step_.step * step_.step);
236 return n + step_.step_base; 237 return n + step_.step_base;
237 } 238 }
238 239
239 } // namespace blink 240 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698