Title: [115783] trunk/Source/WebCore
- Revision
- 115783
- Author
- [email protected]
- Date
- 2012-05-01 20:01:29 -0700 (Tue, 01 May 2012)
Log Message
Calendar Picker: Too wide in Japanese locale
https://bugs.webkit.org/show_bug.cgi?id=85331
Reviewed by Kentaro Hara.
No new tests. This is a locale-specific behavior.
* Resources/calendarPicker.js:
(formatJapaneseImperialEra):
Do not show an imperial era later than 平成99年 to avoid very long
year string like "275760年(平成273772年)."
(YearMonthController.prototype.attachTo):
- Respect the maximum year specfied by <input max=...>
If <input max="9999-12-31"> is specified, we don't need to
secure space for the year 275,760.
- Check the width for 平成99年 as well as the maximum year because
"2087年(平成99年)" is usually wider than "275760年".
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (115782 => 115783)
--- trunk/Source/WebCore/ChangeLog 2012-05-02 02:52:32 UTC (rev 115782)
+++ trunk/Source/WebCore/ChangeLog 2012-05-02 03:01:29 UTC (rev 115783)
@@ -1,3 +1,23 @@
+2012-05-01 Kent Tamura <[email protected]>
+
+ Calendar Picker: Too wide in Japanese locale
+ https://bugs.webkit.org/show_bug.cgi?id=85331
+
+ Reviewed by Kentaro Hara.
+
+ No new tests. This is a locale-specific behavior.
+
+ * Resources/calendarPicker.js:
+ (formatJapaneseImperialEra):
+ Do not show an imperial era later than 平成99年 to avoid very long
+ year string like "275760年(平成273772年)."
+ (YearMonthController.prototype.attachTo):
+ - Respect the maximum year specfied by <input max=...>
+ If <input max="9999-12-31"> is specified, we don't need to
+ secure space for the year 275,760.
+ - Check the width for 平成99年 as well as the maximum year because
+ "2087年(平成99年)" is usually wider than "275760年".
+
2012-05-01 Noel Gordon <[email protected]>
PNGImageDecoder: Add ENABLE(IMAGE_DECODER_DOWN_SAMPLING) guards to rowAvailable
Modified: trunk/Source/WebCore/Resources/calendarPicker.js (115782 => 115783)
--- trunk/Source/WebCore/Resources/calendarPicker.js 2012-05-02 02:52:32 UTC (rev 115782)
+++ trunk/Source/WebCore/Resources/calendarPicker.js 2012-05-02 03:01:29 UTC (rev 115783)
@@ -122,12 +122,22 @@
return result[1];
}
+/*
+ * @const
+ * @type {number}
+ */
+var ImperialEraLimit = 2087;
+
/**
* @param {!number} year
* @param {!number} month
* @return {!string}
*/
function formatJapaneseImperialEra(year, month) {
+ // We don't show an imperial era if it is greater than 99 becase of space
+ // limitation.
+ if (year > ImperialEraLimit)
+ return "";
if (year > 1989)
return "(平成" + (year - 1988) + "年)";
if (year == 1989)
@@ -426,14 +436,18 @@
this._wall.addEventListener("click", bind(this._closePopup, this), false);
main.appendChild(this._wall);
- // The maximum year which <input type=date> supports is 275,760.
- // See WebCore/platform/DateComponents.h
- var MaximumYear = 275760;
+ var maximumYear = global.maximumDate.getUTCFullYear();
var maxWidth = 0;
for (var m = 0; m < 12; ++m) {
- this._month.textContent = formatYearMonth(MaximumYear, m);
+ this._month.textContent = formatYearMonth(maximumYear, m);
maxWidth = Math.max(maxWidth, this._month.offsetWidth);
}
+ if (getLanguage() == "ja" && ImperialEraLimit < maximumYear) {
+ for (var m = 0; m < 12; ++m) {
+ this._month.textContent = formatYearMonth(ImperialEraLimit, m);
+ maxWidth = Math.max(maxWidth, this._month.offsetWidth);
+ }
+ }
this._month.style.minWidth = maxWidth + 'px';
global.firstFocusableControl = this._left2; // FIXME: Shoud it be this.month?
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes