+2013-05-29 Kent Tamura <tkent@chromium.org>
+
+ Remove leftover files for ENABLE_PAGE_POPUP and ENABLE_CALENDAR_PICKER
+ https://bugs.webkit.org/show_bug.cgi?id=116999
+
+ Reviewed by Anders Carlsson.
+
+ * ManualTests/forms/calendar-picker-crash-by-type-change.html: Removed.
+ * ManualTests/forms/calendar-picker.html: Removed.
+ * ManualTests/forms/color-suggestion-picker.html: Removed.
+ * ManualTests/forms/date-suggestion-picker.html: Removed.
+
2013-05-29 Martin Robinson <mrobinson@igalia.com>
Fix more CMake GTK+ build issues after r150336
+++ /dev/null
-<!DOCTYPE html>
-<script>
-var input = document.createElement('input')
-input.type = 'date'
-var event = document.createEvent('KeyboardEvent')
-event.initKeyboardEvent('keydown', false, false, null, 'Down')
-input.dispatchEvent(event)
-input.type = 'color'
-</script>
-<p>Success if the browser didn't crash.</p>
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset=utf-8>
-<title>Calendar Picker test</title>
-<style>
-body {
- background-color: #eeffff;
- line-height: 1.4em;
- font-family: Helvetica, sans-serif;
-}
-label {
- width: 160px;
- display: inline-block;
-}
-iframe {
- z-index: 2147483647;
- width: 100px;
- height: 100px;
- border: 0;
- overflow: hidden;
-}
-</style>
-</head>
-<body>
-
-<p>This is a testbed for a calendar picker.</p>
-
-<h2>Preview</h2>
-
-<input type="text" id="date" style="margin: 0;"><br>
-<iframe></iframe>
-
-<h2>Console</h2>
-
-<ol id="console" style="font-family:monospace;"></ol>
-
-<h2>Config</h2>
-<form action="" method="GET">
- <fieldset>
- <legend>Locale</legend>
-
- <label for="locale">Locale</label>
- <select name="locale" id="config_locale">
- <!-- Populated from locale_data. -->
- </select>
- <br />
- <label for="locale_rtl">Locale RTL</label>
- <input type="checkbox" name="locale_rtl" id="config_locale_rtl" value="true">
- <br />
- <label for="week_start_day">Week start day</label>
- <select name="week_start_day" id="config_week_start_day">
- <option value="0">Sunday</option>
- <option value="1">Monday</option>
- <option value="2">Tuesday</option>
- <option value="3">Wednesday</option>
- <option value="4">Thursday</option>
- <option value="5">Friday</option>
- <option value="6">Saturday</option>
- </select>
- </fieldset>
-
- <fieldset>
- <legend>Attributes</legend>
-
- <label for="type">[type]</label>
- <select name="type" id="config_type">
- <option>date</option>
- <option>week</option>
- <option>month</option>
- </select>
- <br />
- <label for="value">[value]</label>
- <input type="text" name="value" id="config_value">
- <br />
- <label for="min">[min]</label>
- <input type="text" name="min" id="config_min">
- <br />
- <label for="max">[max]</label>
- <input type="text" name="max" id="config_max">
- <br />
- <label for="step">[step]</label>
- <input type="number" name="step" id="config_step">
- </fieldset>
- <input type="submit" value="Submit">
-</form>
-
-<script>
-function getParam(key) {
- key = key.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
- var pattern = "[\\?&]" + key + "=([^&#]*)";
- var regex = new RegExp(pattern);
- var results = regex.exec(window.location.search);
- if (!results)
- return "";
- return decodeURIComponent(results[1].replace(/\+/g, " "));
-}
-
-function setParam(key, value) {
- key = escape(key);
- value = escape(value);
-
- var kvp = document.location.search.substr(1).split('&');
-
- for (var i = kvp.length - 1; i >= 0; --i){
- kvp[i]
- var x = kvp[i].split('=');
- if (x[0] === key) {
- x[1] = value;
- kvp[i] = x.join('=');
- break;
- }
- }
-
- if (i < 0)
- kvp[kvp.length] = key + "=" + value;
-
- document.location.search = kvp.join('&');
-}
-
-function $(id) {
- return document.getElementById(id);
-}
-
-var config = {};
-function initializeConfig() {
- for (locale in locale_data) {
- var option = document.createElement("option");
- option.setAttribute("label", locale_data[locale].displayName);
- option.setAttribute("value", locale);
- $("config_locale").appendChild(option);
- }
-
- config.locale = getParam("locale") || "en_US";
- config.isLocaleRTL = getParam("locale_rtl") === "true";
- config.weekStartDay = parseInt(getParam("weekStartDay") || "0", 10);
- config.type = getParam("type") || "date";
- config.value = getParam("value") || "";
- config.min = getParam("min") || "";
- config.max = getParam("max") || "";
- config.step = getParam("step") || "1";
-
- $("config_locale").value = config.locale;
- $("config_locale_rtl").checked = config.isLocaleRTL;
- $("config_week_start_day").value = config.weekStartDay;
- $("config_type").value = config.type;
- $("config_value").value = config.value;
- $("config_min").value = config.min;
- $("config_max").value = config.max;
- $("config_step").value = config.step;
-};
-
-var locale_data = {
- "en_US": {
- "displayName": "English (United States)",
- "shortMonthLabels": [
- "Jan",
- "Feb",
- "Mar",
- "Apr",
- "May",
- "Jun",
- "Jul",
- "Aug",
- "Sep",
- "Oct",
- "Nov",
- "Dec"
- ],
- "dayLabels": [
- "S",
- "M",
- "T",
- "W",
- "T",
- "F",
- "S"
- ],
- },
- "ja": {
- "displayName": "Japanese",
- "shortMonthLabels": [
- "1月",
- "2月",
- "3月",
- "4月",
- "5月",
- "6月",
- "7月",
- "8月",
- "9月",
- "10月",
- "11月",
- "12月"
- ],
- "dayLabels": [
- "日",
- "月",
- "火",
- "水",
- "木",
- "金",
- "土"
- ],
- },
- "ar": {
- "displayName": "Arabic",
- "shortMonthLabels": [
- "يناير",
- "فبراير",
- "مارس",
- "أبريل",
- "مايو",
- "يونيو",
- "يوليو",
- "أغسطس",
- "سبتمبر",
- "أكتوبر",
- "نوفمبر",
- "ديسمبر"
- ],
- "dayLabels": [
- "ح",
- "ن",
- "ث",
- "ر",
- "خ",
- "ج",
- "س"
- ],
- },
- "vi": {
- "displayName": "Vietnamese",
- "shortMonthLabels": [
- "thg 1",
- "thg 2",
- "thg 3",
- "thg 4",
- "thg 5",
- "thg 6",
- "thg 7",
- "thg 8",
- "thg 9",
- "thg 10",
- "thg 11",
- "thg 12"
- ],
- "dayLabels": [
- "CN",
- "T2",
- "T3",
- "T4",
- "T5",
- "T6",
- "T7"
- ],
- },
-};
-
-function createParam() {
- return {
- mode: config.type,
- locale: config.locale,
- weekStartDay: config.weekStartDay,
- isLocaleRTL: config.isLocaleRTL,
- dayLabels: locale_data[config.locale].dayLabels,
- shortMonthLabels: locale_data[config.locale].shortMonthLabels,
- max: config.max,
- min: config.min,
- step: config.step * (config.type === "month" ? 1 : 86400000),
- stepBase: "0",
- currentValue: config.value
- }
-};
-
-function openCalendar() {
- var frame = document.getElementsByTagName('iframe')[0];
- var doc = frame.contentDocument;
- doc.documentElement.innerHTML = '<head></head><body><div id=main>Loading...</div></body>';
- var commonCssLink = doc.createElement('link');
- commonCssLink.rel = 'stylesheet';
- commonCssLink.href = '../../Source/WebCore/Resources/pagepopups/pickerCommon.css?' + (new Date()).getTime();
- doc.head.appendChild(commonCssLink);
- var commonChromiumCssLink = doc.createElement('link');
- commonChromiumCssLink.rel = 'stylesheet';
- commonChromiumCssLink.href = '../../Source/WebCore/Resources/pagepopups/chromium/pickerCommonChromium.css?' + (new Date()).getTime();
- doc.head.appendChild(commonChromiumCssLink);
- var suggestionPickerCssLink = doc.createElement('link');
- suggestionPickerCssLink.rel = 'stylesheet';
- suggestionPickerCssLink.href = '../../Source/WebCore/Resources/pagepopups/suggestionPicker.css?' + (new Date()).getTime();
- doc.head.appendChild(suggestionPickerCssLink);
- var link = doc.createElement('link');
- link.rel = 'stylesheet';
- link.href = '../../Source/WebCore/Resources/pagepopups/calendarPicker.css?' + (new Date()).getTime();
- doc.head.appendChild(link);
- var calendarPickerChromiumCssLink = doc.createElement('link');
- calendarPickerChromiumCssLink.rel = 'stylesheet';
- calendarPickerChromiumCssLink.href = '../../Source/WebCore/Resources/pagepopups/chromium/calendarPickerChromium.css?' + (new Date()).getTime();
- doc.head.appendChild(calendarPickerChromiumCssLink);
- var commonJsScript = doc.createElement('script');
- commonJsScript.src = '../../Source/WebCore/Resources/pagepopups/pickerCommon.js?' + (new Date()).getTime();
- doc.body.appendChild(commonJsScript);
- var suggestionPickerJsScript = doc.createElement('script');
- suggestionPickerJsScript.src = '../../Source/WebCore/Resources/pagepopups/suggestionPicker.js?' + (new Date()).getTime();
- doc.body.appendChild(suggestionPickerJsScript);
- var script = doc.createElement('script');
- script.src = '../../Source/WebCore/Resources/pagepopups/calendarPicker.js?' + (new Date()).getTime();
- doc.body.appendChild(script);
-
- var pagePopupController = {
- setValueAndClosePopup: function(numValue, stringValue) {
- window.log('number=' + numValue + ', string="' + stringValue + '"');
- if (numValue == 0)
- window.document.getElementById('date').value = stringValue;
- },
- setValue: function(stringValue) {
- window.log('string="' + stringValue + '"');
- window.document.getElementById('date').value = stringValue;
- },
- closePopup: function() {
- window.log('closePopup');
- },
- localizeNumberString: function(numString) {
- if (typeof numString == "number")
- return numString.toLocaleString();
- return numString.toString();
- },
- histogramEnumeration: function() {},
- formatMonth: function(year, zeroBaseMonth) {
- var monthLabels = ['<January>', '<February>', '<March>', '<April>', '<May>', '<June>',
- '<July>', '<August>', '<September>', '<October>', '<November>', '<December>'];
- return monthLabels[zeroBaseMonth] + " " + year;
- },
- formatShortMonth: function(year, zeroBaseMonth) {
- var monthLabels = ['<Jan>', '<Feb>', '<Mar>', '<Apr>', '<May>', '<Jun>',
- '<Jul>', '<Aug>', '<Sept>', '<Oct>', '<Nov>', '<Dec>'];
- return monthLabels[zeroBaseMonth] + " " + year;
- }
- }
-
- setTimeout(function() {
- frame.contentWindow.postMessage(JSON.stringify(createParam()), "*");
- frame.contentWindow.pagePopupController = pagePopupController;
- }, 100);
-}
-
-function log(str) {
- var entry = document.createElement('li');
- entry.innerText = str;
- document.getElementById('console').appendChild(entry);
-}
-
-window.onload = function() {
- initializeConfig();
- openCalendar();
-};
-</script>
-</body>
-</html>
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset=utf-8>
-<title>Color Suggestion Picker test</title>
-<style>
-body {
- background-color: #eeffff;
-}
-iframe {
- z-index: 2147483647;
- width: 180px;
- height: 240px;
- border: 0;
- overflow: hidden;
-}
-</style>
-</head>
-<body>
-
-<p>This is a testbed for a color suggestion picker.</p>
-
-<div><input type="color" id="color"></div>
-<iframe></iframe>
-
-<ol id="console" style="font-family:monospace;">
-</ol>
-
-<script>
-var arguments = {
- values : ['#000000', '#404040', '#808080', '#c0c0c0', '#ffffff', '#980000', '#ff0000', '#ff9900', '#ffff00', '#00ff00', '#00ffff', '#4a86e8', '#0000ff', '#9900ff', '#ff00ff', '#404040', '#808080', '#c0c0c0', '#ffffff', '#980000', '#ff0000', '#ff9900', '#ffff00', '#00ff00', '#00ffff', '#4a86e8', '#0000ff', '#9900ff', '#ff00ff'],
- otherColorLabel: 'Other...'
-};
-
-function openColorPicker(args) {
- var frame = document.getElementsByTagName('iframe')[0];
- var doc = frame.contentDocument;
- doc.documentElement.innerHTML = '<head></head><body><div id=main>Loading...</div></body>';
- var commonCssLink = doc.createElement('link');
- commonCssLink.rel = 'stylesheet';
- commonCssLink.href = '../../Source/WebCore/Resources/pagepopups/pickerCommon.css?' + (new Date()).getTime();
- doc.head.appendChild(commonCssLink);
- var link = doc.createElement('link');
- link.rel = 'stylesheet';
- link.href = '../../Source/WebCore/Resources/pagepopups/colorSuggestionPicker.css?' + (new Date()).getTime();
- doc.head.appendChild(link);
- var commonJsScript = doc.createElement('script');
- commonJsScript.src = '../../Source/WebCore/Resources/pagepopups/pickerCommon.js?' + (new Date()).getTime();
- doc.body.appendChild(commonJsScript);
- var script = doc.createElement('script');
- script.src = '../../Source/WebCore/Resources/pagepopups/colorSuggestionPicker.js?' + (new Date()).getTime();
- doc.body.appendChild(script);
-
- var pagePopupController = {
- setValueAndClosePopup: function(numValue, stringValue) {
- window.log('number=' + numValue + ', string="' + stringValue + '"');
- if (numValue === 0)
- window.document.getElementById('color').value = stringValue;
- },
- setValue: function(value) {
- window.log('value="' + value + '"');
- window.document.getElementById('color').value = value;
- },
- closePopup: function() {
- },
- }
-
- setTimeout(function() {
- frame.contentWindow.postMessage(JSON.stringify(args), "*");
- frame.contentWindow.pagePopupController = pagePopupController;
- }, 100);
-}
-
-function log(str) {
- var entry = document.createElement('li');
- entry.innerText = str;
- document.getElementById('console').appendChild(entry);
-}
-
-openColorPicker(arguments);
-</script>
-</body>
-</html>
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset=utf-8>
-<title>Calendar Picker test</title>
-<style>
-body {
- background-color: #eeffff;
-}
-iframe {
- z-index: 2147483647;
- width: 100px;
- height: 100px;
- border: 0;
- overflow: hidden;
-}
-</style>
-</head>
-<body>
-
-<p>This is a testbed for date suggestion picker.</p>
-<select onchange="selected(this)">
- <option>with datalist</option>
- <option>with long datalist</option>
- <option>Arabic with datalist</option>
- <option>Arabic with long datalist</option>
-</select>
-
-<div><input type="text" id="date"></div>
-<iframe></iframe>
-
-<ol id="console" style="font-family:monospace;">
-</ol>
-
-<script>
-var datalistArguments = {
- locale: 'en-US',
- dayLabels : ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
- todayLabel : 'Today',
- clearLabel : 'Clear',
- cancelLabel : 'Cancel',
- weekStartDay : 0,
- step : "86400000",
- stepBase: "0",
- max : '2099-12-31',
- suggestionValues : ['2012-01-01', '2012-06-03', '2012-09-06', '2012-12-24'],
- localizedSuggestionValues : ['1/1/12', '6/3/12', '9/6/12', '12/24/12'],
- suggestionLabels : ['', 'Birthday', '', 'Christmas'],
- showOtherDateEntry: true,
- otherDateLabel: 'Other...',
- inputWidth: 127,
- suggestionHighlightColor: "#0000ff",
- suggestionHighlightTextColor: "#ffffff"
-};
-var longDatalistArguments = {
- locale: 'en-US',
- dayLabels : ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
- todayLabel : 'Today',
- clearLabel : 'Clear',
- cancelLabel : 'Cancel',
- weekStartDay : 0,
- step : "86400000",
- stepBase: "0",
- max : '2099-12-31',
- suggestionValues: ["2012-01-01", "2012-01-02", "2012-01-03", "2012-01-04",
- "2012-01-05", "2012-01-06", "2012-01-07", "2012-01-08", "2012-01-09",
- "2012-01-10", "2012-01-11", "2012-01-12", "2012-01-13", "2012-01-14",
- "2012-01-15", "2012-01-16", "2012-01-17", "2012-01-18", "2012-01-19",
- "2012-01-20", "2012-01-21", "2012-01-22", "2012-01-23", "2012-01-24",
- "2012-01-25", "2012-01-26", "2012-01-27", "2012-01-28", "2012-01-29",
- "2012-01-30", "2012-01-31", "2012-02-01", "2012-02-02", "2012-02-03",
- "2012-02-04", "2012-02-05", "2012-02-06", "2012-02-07", "2012-02-08",
- "2012-02-09", "2012-02-10", "2012-02-11", "2012-02-12", "2012-02-13",
- "2012-02-14", "2012-02-15", "2012-02-16", "2012-02-17", "2012-02-18",
- "2012-02-19", "2012-02-20", "2012-02-21", "2012-02-22", "2012-02-23",
- "2012-02-24", "2012-02-25", "2012-02-26", "2012-02-27", "2012-02-28",
- "2012-02-29", "2012-03-01", "2012-03-02", "2012-03-03", "2012-03-04",
- "2012-03-05", "2012-03-06", "2012-03-07", "2012-03-08", "2012-03-09",
- "2012-03-10", "2012-03-11", "2012-03-12", "2012-03-13", "2012-03-14",
- "2012-03-15", "2012-03-16", "2012-03-17", "2012-03-18", "2012-03-19",
- "2012-03-20", "2012-03-21", "2012-03-22", "2012-03-23", "2012-03-24",
- "2012-03-25", "2012-03-26", "2012-03-27", "2012-03-28", "2012-03-29",
- "2012-03-30", "2012-03-31"],
- localizedSuggestionValues: ["1/1/12", "1/2/12", "1/3/12", "1/4/12",
- "1/5/12", "1/6/12", "1/7/12", "1/8/12", "1/9/12", "1/10/12", "1/11/12",
- "1/12/12", "1/13/12", "1/14/12", "1/15/12", "1/16/12", "1/17/12",
- "1/18/12", "1/19/12", "1/20/12", "1/21/12", "1/22/12", "1/23/12",
- "1/24/12", "1/25/12", "1/26/12", "1/27/12", "1/28/12", "1/29/12",
- "1/30/12", "1/31/12", "2/1/12", "2/2/12", "2/3/12", "2/4/12", "2/5/12",
- "2/6/12", "2/7/12", "2/8/12", "2/9/12", "2/10/12", "2/11/12", "2/12/12",
- "2/13/12", "2/14/12", "2/15/12", "2/16/12", "2/17/12", "2/18/12",
- "2/19/12", "2/20/12", "2/21/12", "2/22/12", "2/23/12", "2/24/12",
- "2/25/12", "2/26/12", "2/27/12", "2/28/12", "2/29/12", "3/1/12",
- "3/2/12", "3/3/12", "3/4/12", "3/5/12", "3/6/12", "3/7/12", "3/8/12",
- "3/9/12", "3/10/12", "3/11/12", "3/12/12", "3/13/12", "3/14/12",
- "3/15/12", "3/16/12", "3/17/12", "3/18/12", "3/19/12", "3/20/12",
- "3/21/12", "3/22/12", "3/23/12", "3/24/12", "3/25/12", "3/26/12",
- "3/27/12", "3/28/12", "3/29/12", "3/30/12", "3/31/12"],
- suggestionLabels: ["Today", "Tomorrow", "", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", ""],
- showOtherDateEntry: true,
- otherDateLabel: 'Other...',
- inputWidth: 127,
- suggestionHighlightColor: "#0000ff",
- suggestionHighlightTextColor: "#ffffff"
-};
-
-var arabicDatalistArguments = {
- locale: 'ar',
- isRTL: true,
- isCalendarRTL: true,
- dayLabels : ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'],
- todayLabel : 'اليوم',
- clearLabel : 'مسح',
- weekStartDay : 5,
- step : "86400000",
- stepBase: "0",
- max : '2020-05-15',
- suggestionValues : ['2012-01-01', '2012-06-03', '2012-09-06', '2012-12-24'],
- localizedSuggestionValues : ['1/1/12', '6/3/12', '9/6/12', '12/24/12'],
- suggestionLabels : ['', 'Birthday', '', 'Christmas'],
- showOtherDateEntry: true,
- otherDateLabel: 'Other...',
- inputWidth: 127,
- suggestionHighlightColor: "#0000ff",
- suggestionHighlightTextColor: "#ffffff"
-};
-
-var arabicLongDatalistArguments = {
- locale: 'ar',
- isRTL: true,
- isCalendarRTL: true,
- dayLabels : ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'],
- todayLabel : 'اليوم',
- clearLabel : 'مسح',
- weekStartDay : 5,
- step : "86400000",
- stepBase: "0",
- max : '2020-05-15',
- suggestionValues: ["2012-01-01", "2012-01-02", "2012-01-03", "2012-01-04",
- "2012-01-05", "2012-01-06", "2012-01-07", "2012-01-08", "2012-01-09",
- "2012-01-10", "2012-01-11", "2012-01-12", "2012-01-13", "2012-01-14",
- "2012-01-15", "2012-01-16", "2012-01-17", "2012-01-18", "2012-01-19",
- "2012-01-20", "2012-01-21", "2012-01-22", "2012-01-23", "2012-01-24",
- "2012-01-25", "2012-01-26", "2012-01-27", "2012-01-28", "2012-01-29",
- "2012-01-30", "2012-01-31", "2012-02-01", "2012-02-02", "2012-02-03",
- "2012-02-04", "2012-02-05", "2012-02-06", "2012-02-07", "2012-02-08",
- "2012-02-09", "2012-02-10", "2012-02-11", "2012-02-12", "2012-02-13",
- "2012-02-14", "2012-02-15", "2012-02-16", "2012-02-17", "2012-02-18",
- "2012-02-19", "2012-02-20", "2012-02-21", "2012-02-22", "2012-02-23",
- "2012-02-24", "2012-02-25", "2012-02-26", "2012-02-27", "2012-02-28",
- "2012-02-29", "2012-03-01", "2012-03-02", "2012-03-03", "2012-03-04",
- "2012-03-05", "2012-03-06", "2012-03-07", "2012-03-08", "2012-03-09",
- "2012-03-10", "2012-03-11", "2012-03-12", "2012-03-13", "2012-03-14",
- "2012-03-15", "2012-03-16", "2012-03-17", "2012-03-18", "2012-03-19",
- "2012-03-20", "2012-03-21", "2012-03-22", "2012-03-23", "2012-03-24",
- "2012-03-25", "2012-03-26", "2012-03-27", "2012-03-28", "2012-03-29",
- "2012-03-30", "2012-03-31"],
- localizedSuggestionValues: ["1/1/12", "1/2/12", "1/3/12", "1/4/12",
- "1/5/12", "1/6/12", "1/7/12", "1/8/12", "1/9/12", "1/10/12", "1/11/12",
- "1/12/12", "1/13/12", "1/14/12", "1/15/12", "1/16/12", "1/17/12",
- "1/18/12", "1/19/12", "1/20/12", "1/21/12", "1/22/12", "1/23/12",
- "1/24/12", "1/25/12", "1/26/12", "1/27/12", "1/28/12", "1/29/12",
- "1/30/12", "1/31/12", "2/1/12", "2/2/12", "2/3/12", "2/4/12", "2/5/12",
- "2/6/12", "2/7/12", "2/8/12", "2/9/12", "2/10/12", "2/11/12", "2/12/12",
- "2/13/12", "2/14/12", "2/15/12", "2/16/12", "2/17/12", "2/18/12",
- "2/19/12", "2/20/12", "2/21/12", "2/22/12", "2/23/12", "2/24/12",
- "2/25/12", "2/26/12", "2/27/12", "2/28/12", "2/29/12", "3/1/12",
- "3/2/12", "3/3/12", "3/4/12", "3/5/12", "3/6/12", "3/7/12", "3/8/12",
- "3/9/12", "3/10/12", "3/11/12", "3/12/12", "3/13/12", "3/14/12",
- "3/15/12", "3/16/12", "3/17/12", "3/18/12", "3/19/12", "3/20/12",
- "3/21/12", "3/22/12", "3/23/12", "3/24/12", "3/25/12", "3/26/12",
- "3/27/12", "3/28/12", "3/29/12", "3/30/12", "3/31/12"],
- suggestionLabels: ["Today", "Tomorrow", "", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", ""],
- showOtherDateEntry: true,
- otherDateLabel: 'Other...',
- inputWidth: 127,
- suggestionHighlightColor: "#0000ff",
- suggestionHighlightTextColor: "#ffffff"
-};
-
-function openCalendar(args) {
- var frame = document.getElementsByTagName('iframe')[0];
- var doc = frame.contentDocument;
- doc.documentElement.innerHTML = '<head></head><body><div id=main>Loading...</div></body>';
- var commonCssLink = doc.createElement('link');
- commonCssLink.rel = 'stylesheet';
- commonCssLink.href = '../../Source/WebCore/Resources/pagepopups/pickerCommon.css?' + (new Date()).getTime();
- doc.head.appendChild(commonCssLink);
- var commonChromiumCssLink = doc.createElement('link');
- commonChromiumCssLink.rel = 'stylesheet';
- commonChromiumCssLink.href = '../../Source/WebCore/Resources/pagepopups/chromium/pickerCommonChromium.css?' + (new Date()).getTime();
- doc.head.appendChild(commonChromiumCssLink);
- var suggestionPickerCssLink = doc.createElement('link');
- suggestionPickerCssLink.rel = 'stylesheet';
- suggestionPickerCssLink.href = '../../Source/WebCore/Resources/pagepopups/suggestionPicker.css?' + (new Date()).getTime();
- doc.head.appendChild(suggestionPickerCssLink);
- var link = doc.createElement('link');
- link.rel = 'stylesheet';
- link.href = '../../Source/WebCore/Resources/pagepopups/calendarPicker.css?' + (new Date()).getTime();
- doc.head.appendChild(link);
- var calendarPickerChromiumCssLink = doc.createElement('link');
- calendarPickerChromiumCssLink.rel = 'stylesheet';
- calendarPickerChromiumCssLink.href = '../../Source/WebCore/Resources/pagepopups/chromium/calendarPickerChromium.css?' + (new Date()).getTime();
- doc.head.appendChild(calendarPickerChromiumCssLink);
- var commonJsScript = doc.createElement('script');
- commonJsScript.src = '../../Source/WebCore/Resources/pagepopups/pickerCommon.js?' + (new Date()).getTime();
- doc.body.appendChild(commonJsScript);
- var suggestionPickerJsScript = doc.createElement('script');
- suggestionPickerJsScript.src = '../../Source/WebCore/Resources/pagepopups/suggestionPicker.js?' + (new Date()).getTime();
- doc.body.appendChild(suggestionPickerJsScript);
- var script = doc.createElement('script');
- script.src = '../../Source/WebCore/Resources/pagepopups/calendarPicker.js?' + (new Date()).getTime();
- doc.body.appendChild(script);
-
- var pagePopupController = {
- setValueAndClosePopup: function(numValue, stringValue) {
- window.log('number=' + numValue + ', string="' + stringValue + '"');
- if (numValue == 0)
- window.document.getElementById('date').value = stringValue;
- },
- localizeNumberString: function(numString) {
- if (typeof numString == "number")
- return numString.toLocaleString();
- return numString.toString();
- },
- histogramEnumeration: function() {},
- formatMonth: function(year, zeroBaseMonth) {
- var monthLabels = ['<January>', '<February>', '<March>', '<April>', '<May>', '<June>',
- '<July>', '<August>', '<September>', '<October>', '<November>', '<December>'];
- return monthLabels[zeroBaseMonth] + " " + year;
- }
- }
-
- setTimeout(function() {
- frame.contentWindow.postMessage(JSON.stringify(args), "*");
- frame.contentWindow.pagePopupController = pagePopupController;
- }, 100);
-}
-
-function selected(select) {
- var frame = document.getElementsByTagName('iframe')[0];
- frame.style.width = '100px';
- frame.style.height = '100px';
- switch (select.selectedIndex) {
- case 0:
- openCalendar(datalistArguments);
- break;
- case 1:
- openCalendar(longDatalistArguments);
- break;
- case 2:
- openCalendar(arabicDatalistArguments);
- break;
- case 3:
- openCalendar(arabicLongDatalistArguments);
- break;
- }
-}
-
-function log(str) {
- var entry = document.createElement('li');
- entry.innerText = str;
- document.getElementById('console').appendChild(entry);
-}
-
-openCalendar(englishArguments);
-</script>
-</body>
-</html>
+2013-05-29 Kent Tamura <tkent@chromium.org>
+
+ Remove leftover files for ENABLE_PAGE_POPUP and ENABLE_CALENDAR_PICKER
+ https://bugs.webkit.org/show_bug.cgi?id=116999
+
+ Reviewed by Anders Carlsson.
+
+ * Resources/pagepopups/colorSuggestionPicker.css: Removed.
+ * Resources/pagepopups/colorSuggestionPicker.js: Removed.
+ * Resources/pagepopups/pickerCommon.css: Removed.
+ * Resources/pagepopups/pickerCommon.js: Removed.
+ * Resources/pagepopups/suggestionPicker.css: Removed.
+ * Resources/pagepopups/suggestionPicker.js: Removed.
+
2013-05-29 Jer Noble <jer.noble@apple.com>
Unreviewed build fix; remove unintentional semicolon.
+++ /dev/null
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-body {
- -webkit-user-select: none;
- background-color: white;
- font: -webkit-small-control;
- margin: 0;
- overflow: hidden;
-}
-
-#main {
- background-color: white;
- border: solid 1px #8899aa;
- box-shadow: inset 2px 2px 2px white,
- inset -2px -2px 1px rgba(0,0,0,0.1);
- padding: 6px;
- float: left;
-}
-
-.color-swatch {
- float: left;
- width: 20px;
- height: 20px;
- margin: 1px;
- padding: 0;
- border: 1px solid #e0e0e0;
- box-sizing: content-box;
-}
-
-.color-swatch:focus {
- border: 1px solid #000000;
- outline: none;
-}
-
-.color-swatch-container {
- width: 100%;
- max-height: 104px;
- overflow: auto;
- display: -webkit-flex;
- -webkit-flex-flow: row wrap;
- -webkit-align-items: center;
-}
-
-.other-color {
- width: 100%;
- margin: 4px 0 0 0;
-}
+++ /dev/null
-"use strict";
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-var global = {
- argumentsReceived: false,
- params: null
-};
-
-/**
- * @param {Event} event
- */
-function handleMessage(event) {
- initialize(JSON.parse(event.data));
- global.argumentsReceived = true;
-}
-
-/**
- * @param {!Object} args
- */
-function initialize(args) {
- global.params = args;
- var main = $("main");
- main.innerHTML = "";
- var errorString = validateArguments(args);
- if (errorString) {
- main.textContent = "Internal error: " + errorString;
- resizeWindow(main.offsetWidth, main.offsetHeight);
- } else
- new ColorPicker(main, args);
-}
-
-// The DefaultColorPalette is used when the list of values are empty.
-var DefaultColorPalette = ["#000000", "#404040", "#808080", "#c0c0c0",
- "#ffffff", "#980000", "#ff0000", "#ff9900", "#ffff00", "#00ff00", "#00ffff",
- "#4a86e8", "#0000ff", "#9900ff", "#ff00ff"];
-
-function handleArgumentsTimeout() {
- if (global.argumentsReceived)
- return;
- var args = {
- values : DefaultColorPalette,
- otherColorLabel: "Other..."
- };
- initialize(args);
-}
-
-/**
- * @param {!Object} args
- * @return {?string} An error message, or null if the argument has no errors.
- */
-function validateArguments(args) {
- if (!args.values)
- return "No values.";
- if (!args.otherColorLabel)
- return "No otherColorLabel.";
- return null;
-}
-
-function ColorPicker(element, config) {
- Picker.call(this, element, config);
- this._config = config;
- if (this._config.values.length === 0)
- this._config.values = DefaultColorPalette;
- this._container = null;
- this._layout();
- document.body.addEventListener("keydown", this._handleKeyDown.bind(this));
- this._element.addEventListener("mousemove", this._handleMouseMove.bind(this));
- this._element.addEventListener("mousedown", this._handleMouseDown.bind(this));
-}
-ColorPicker.prototype = Object.create(Picker.prototype);
-
-var SwatchBorderBoxWidth = 24; // keep in sync with CSS
-var SwatchBorderBoxHeight = 24; // keep in sync with CSS
-var SwatchesPerRow = 5;
-var SwatchesMaxRow = 4;
-
-ColorPicker.prototype._layout = function() {
- var container = createElement("div", "color-swatch-container");
- container.addEventListener("click", this._handleSwatchClick.bind(this), false);
- for (var i = 0; i < this._config.values.length; ++i) {
- var swatch = createElement("button", "color-swatch");
- swatch.dataset.index = i;
- swatch.dataset.value = this._config.values[i];
- swatch.title = this._config.values[i];
- swatch.style.backgroundColor = this._config.values[i];
- container.appendChild(swatch);
- }
- var containerWidth = SwatchBorderBoxWidth * SwatchesPerRow;
- if (this._config.values.length > SwatchesPerRow * SwatchesMaxRow)
- containerWidth += getScrollbarWidth();
- container.style.width = containerWidth + "px";
- container.style.maxHeight = (SwatchBorderBoxHeight * SwatchesMaxRow) + "px";
- this._element.appendChild(container);
- var otherButton = createElement("button", "other-color", this._config.otherColorLabel);
- otherButton.addEventListener("click", this.chooseOtherColor.bind(this), false);
- this._element.appendChild(otherButton);
- this._container = container;
- this._otherButton = otherButton;
- var elementWidth = this._element.offsetWidth;
- var elementHeight = this._element.offsetHeight;
- resizeWindow(elementWidth, elementHeight);
-};
-
-ColorPicker.prototype.selectColorAtIndex = function(index) {
- index = Math.max(Math.min(this._container.childNodes.length - 1, index), 0);
- this._container.childNodes[index].focus();
-};
-
-ColorPicker.prototype._handleMouseMove = function(event) {
- if (event.target.classList.contains("color-swatch"))
- event.target.focus();
-};
-
-ColorPicker.prototype._handleMouseDown = function(event) {
- // Prevent blur.
- if (event.target.classList.contains("color-swatch"))
- event.preventDefault();
-};
-
-ColorPicker.prototype._handleKeyDown = function(event) {
- var key = event.keyIdentifier;
- if (key === "U+001B") // ESC
- this.handleCancel();
- else if (key == "Left" || key == "Up" || key == "Right" || key == "Down") {
- var selectedElement = document.activeElement;
- var index = 0;
- if (selectedElement.classList.contains("other-color")) {
- if (key != "Right" && key != "Up")
- return;
- index = this._container.childNodes.length - 1;
- } else if (selectedElement.classList.contains("color-swatch")) {
- index = parseInt(selectedElement.dataset.index, 10);
- switch (key) {
- case "Left":
- index--;
- break;
- case "Right":
- index++;
- break;
- case "Up":
- index -= SwatchesPerRow;
- break;
- case "Down":
- index += SwatchesPerRow;
- break;
- }
- if (index > this._container.childNodes.length - 1) {
- this._otherButton.focus();
- return;
- }
- }
- this.selectColorAtIndex(index);
- }
- event.preventDefault();
-};
-
-ColorPicker.prototype._handleSwatchClick = function(event) {
- if (event.target.classList.contains("color-swatch"))
- this.submitValue(event.target.dataset.value);
-};
-
-if (window.dialogArguments) {
- initialize(dialogArguments);
-} else {
- window.addEventListener("message", handleMessage, false);
- window.setTimeout(handleArgumentsTimeout, 1000);
-}
+++ /dev/null
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-body {
- -webkit-user-select: none;
- background-color: white;
- font: -webkit-small-control;
- margin: 0;
- overflow: hidden;
-}
-
-.rtl {
- direction: rtl;
-}
+++ /dev/null
-"use strict";
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @param {!string} id
- */
-function $(id) {
- return document.getElementById(id);
-}
-
-/**
- * @param {!string} tagName
- * @param {string=} opt_class
- * @param {string=} opt_text
- * @return {!Element}
- */
-function createElement(tagName, opt_class, opt_text) {
- var element = document.createElement(tagName);
- if (opt_class)
- element.setAttribute("class", opt_class);
- if (opt_text)
- element.appendChild(document.createTextNode(opt_text));
- return element;
-}
-
-/**
- * @constructor
- * @param {!number|Rectangle|Object} xOrRect
- * @param {!number} y
- * @param {!number} width
- * @param {!number} height
- */
-function Rectangle(xOrRect, y, width, height) {
- if (typeof xOrRect === "object") {
- y = xOrRect.y;
- width = xOrRect.width;
- height = xOrRect.height;
- xOrRect = xOrRect.x;
- }
- this.x = xOrRect;
- this.y = y;
- this.width = width;
- this.height = height;
-}
-
-Rectangle.prototype = {
- get maxX() { return this.x + this.width; },
- get maxY() { return this.y + this.height; },
- toString: function() { return "Rectangle(" + this.x + "," + this.y + "," + this.width + "," + this.height + ")"; }
-};
-
-/**
- * @param {!Rectangle} rect1
- * @param {!Rectangle} rect2
- * @return {?Rectangle}
- */
-Rectangle.intersection = function(rect1, rect2) {
- var x = Math.max(rect1.x, rect2.x);
- var maxX = Math.min(rect1.maxX, rect2.maxX);
- var y = Math.max(rect1.y, rect2.y);
- var maxY = Math.min(rect1.maxY, rect2.maxY);
- var width = maxX - x;
- var height = maxY - y;
- if (width < 0 || height < 0)
- return null;
- return new Rectangle(x, y, width, height);
-};
-
-/**
- * @param {!number} width
- * @param {!number} height
- */
-function resizeWindow(width, height) {
- setWindowRect(adjustWindowRect(width, height, width, height));
-}
-
-/**
- * @param {!number} width
- * @param {!number} height
- * @param {?number} minWidth
- * @param {?number} minHeight
- * @return {!Rectangle}
- */
-function adjustWindowRect(width, height, minWidth, minHeight) {
- if (typeof minWidth !== "number")
- minWidth = 0;
- if (typeof minHeight !== "number")
- minHeight = 0;
-
- var windowRect = new Rectangle(0, 0, width, height);
-
- if (!global.params.anchorRectInScreen)
- return windowRect;
-
- var anchorRect = new Rectangle(global.params.anchorRectInScreen);
- var availRect = new Rectangle(window.screen.availLeft, window.screen.availTop, window.screen.availWidth, window.screen.availHeight);
-
- _adjustWindowRectVertically(windowRect, availRect, anchorRect, minHeight);
- _adjustWindowRectHorizontally(windowRect, availRect, anchorRect, minWidth);
-
- return windowRect;
-}
-
-function _adjustWindowRectVertically(windowRect, availRect, anchorRect, minHeight) {
- var availableSpaceAbove = anchorRect.y - availRect.y;
- availableSpaceAbove = Math.max(0, Math.min(availRect.height, availableSpaceAbove));
-
- var availableSpaceBelow = availRect.maxY - anchorRect.maxY;
- availableSpaceBelow = Math.max(0, Math.min(availRect.height, availableSpaceBelow));
-
- if (windowRect.height > availableSpaceBelow && availableSpaceBelow < availableSpaceAbove) {
- windowRect.height = Math.min(windowRect.height, availableSpaceAbove);
- windowRect.height = Math.max(windowRect.height, minHeight);
- windowRect.y = anchorRect.y - windowRect.height;
- } else {
- windowRect.height = Math.min(windowRect.height, availableSpaceBelow);
- windowRect.height = Math.max(windowRect.height, minHeight);
- windowRect.y = anchorRect.maxY;
- }
- windowRect.y = Math.min(windowRect.y, availRect.maxY - windowRect.height);
- windowRect.y = Math.max(windowRect.y, availRect.y);
-}
-
-function _adjustWindowRectHorizontally(windowRect, availRect, anchorRect, minWidth) {
- windowRect.width = Math.min(windowRect.width, availRect.width);
- windowRect.width = Math.max(windowRect.width, minWidth);
- windowRect.x = anchorRect.x;
- if (global.params.isRTL)
- windowRect.x += anchorRect.width - windowRect.width;
- windowRect.x = Math.min(windowRect.x, availRect.maxX - windowRect.width);
- windowRect.x = Math.max(windowRect.x, availRect.x);
-}
-
-/**
- * @param {!Rectangle} rect
- */
-function setWindowRect(rect) {
- if (window.frameElement) {
- window.frameElement.style.width = rect.width + "px";
- window.frameElement.style.height = rect.height + "px";
- } else {
- if (isWindowHidden()) {
- window.moveTo(rect.x - window.screen.availLeft, rect.y - window.screen.availTop);
- window.resizeTo(rect.width, rect.height);
- } else {
- window.resizeTo(rect.width, rect.height);
- window.moveTo(rect.x - window.screen.availLeft, rect.y - window.screen.availTop);
- }
- }
-}
-
-function hideWindow() {
- resizeWindow(1, 1);
-}
-
-/**
- * @return {!boolean}
- */
-function isWindowHidden() {
- return window.innerWidth === 1 && window.innerHeight === 1;
-}
-
-window.addEventListener("resize", function() {
- if (isWindowHidden())
- window.dispatchEvent(new CustomEvent("didHide"));
- else
- window.dispatchEvent(new CustomEvent("didOpenPicker"));
-}, false);
-
-/**
- * @return {!number}
- */
-function getScrollbarWidth() {
- if (typeof window.scrollbarWidth === "undefined") {
- var scrollDiv = document.createElement("div");
- scrollDiv.style.opacity = "0";
- scrollDiv.style.overflow = "scroll";
- scrollDiv.style.width = "50px";
- scrollDiv.style.height = "50px";
- document.body.appendChild(scrollDiv);
- window.scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
- scrollDiv.parentNode.removeChild(scrollDiv);
- }
- return window.scrollbarWidth;
-}
-
-/**
- * @param {!string} className
- * @return {?Element}
- */
-function enclosingNodeOrSelfWithClass(selfNode, className)
-{
- for (var node = selfNode; node && node !== selfNode.ownerDocument; node = node.parentNode) {
- if (node.nodeType === Node.ELEMENT_NODE && node.classList.contains(className))
- return node;
- }
- return null;
-};
-
-/**
- * @constructor
- * @param {!Element} element
- * @param {!Object} config
- */
-function Picker(element, config) {
- this._element = element;
- this._config = config;
-}
-
-/**
- * @enum {number}
- */
-Picker.Actions = {
- SetValue: 0,
- Cancel: -1,
- ChooseOtherColor: -2
-};
-
-/**
- * @param {!string} value
- */
-Picker.prototype.submitValue = function(value) {
- window.pagePopupController.setValue(value);
- window.pagePopupController.closePopup();
-}
-
-Picker.prototype.handleCancel = function() {
- window.pagePopupController.closePopup();
-}
-
-Picker.prototype.chooseOtherColor = function() {
- window.pagePopupController.setValueAndClosePopup(Picker.Actions.ChooseOtherColor, "");
-}
-
-Picker.prototype.cleanup = function() {};
+++ /dev/null
-.suggestion-list {
- list-style: none;
- padding: 0;
- margin: 0;
- font: -webkit-small-control;
- border: 1px solid #7f9db9;
- background-color: white;
- overflow: hidden;
-}
-
-.suggestion-list-entry {
- white-space: nowrap;
- height: 1.73em;
- line-height: 1.73em;
- -webkit-select: none;
- cursor: default;
-}
-
-.suggestion-list-entry:focus {
- outline: none;
-}
-
-.suggestion-list-entry .content {
- padding: 0 4px;
-}
-
-.suggestion-list-entry .label {
- text-align: right;
- color: #737373;
- float: right;
- padding: 0 4px 0 20px;
-}
-
-.rtl .suggestion-list-entry .label {
- float: left;
- padding: 0 20px 0 4px;
-}
-
-.suggestion-list-entry .title {
- direction: ltr;
- display: inline-block;
-}
-
-.locale-rtl .suggestion-list-entry .title {
- direction: rtl;
-}
-
-.measuring-width .suggestion-list-entry .label {
- float: none;
- margin-right: 0;
-}
-
-.suggestion-list .separator {
- border-top: 1px solid #dcdcdc;
- height: 0;
-}
+++ /dev/null
-"use strict";
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @constructor
- * @param {!Element} element
- * @param {!Object} config
- */
-function SuggestionPicker(element, config) {
- Picker.call(this, element, config);
- this._isFocusByMouse = false;
- this._containerElement = null;
- this._setColors();
- this._layout();
- this._fixWindowSize();
- this._handleBodyKeyDownBound = this._handleBodyKeyDown.bind(this);
- document.body.addEventListener("keydown", this._handleBodyKeyDownBound);
- this._element.addEventListener("mouseout", this._handleMouseOut.bind(this), false);
-};
-SuggestionPicker.prototype = Object.create(Picker.prototype);
-
-SuggestionPicker.NumberOfVisibleEntries = 20;
-
-// An entry needs to be at least this many pixels visible for it to be a visible entry.
-SuggestionPicker.VisibleEntryThresholdHeight = 4;
-
-SuggestionPicker.ActionNames = {
- OpenCalendarPicker: "openCalendarPicker"
-};
-
-SuggestionPicker.ListEntryClass = "suggestion-list-entry";
-
-SuggestionPicker.validateConfig = function(config) {
- if (config.showOtherDateEntry && !config.otherDateLabel)
- return "No otherDateLabel.";
- if (config.suggestionHighlightColor && !config.suggestionHighlightColor)
- return "No suggestionHighlightColor.";
- if (config.suggestionHighlightTextColor && !config.suggestionHighlightTextColor)
- return "No suggestionHighlightTextColor.";
- if (config.suggestionValues.length !== config.localizedSuggestionValues.length)
- return "localizedSuggestionValues.length must equal suggestionValues.length.";
- if (config.suggestionValues.length !== config.suggestionLabels.length)
- return "suggestionLabels.length must equal suggestionValues.length.";
- if (typeof config.inputWidth === "undefined")
- return "No inputWidth.";
- return null;
-};
-
-SuggestionPicker.prototype._setColors = function() {
- var text = "." + SuggestionPicker.ListEntryClass + ":focus {\
- background-color: " + this._config.suggestionHighlightColor + ";\
- color: " + this._config.suggestionHighlightTextColor + "; }";
- text += "." + SuggestionPicker.ListEntryClass + ":focus .label { color: " + this._config.suggestionHighlightTextColor + "; }";
- document.head.appendChild(createElement("style", null, text));
-};
-
-SuggestionPicker.prototype.cleanup = function() {
- document.body.removeEventListener("keydown", this._handleBodyKeyDownBound, false);
-};
-
-/**
- * @param {!string} title
- * @param {!string} label
- * @param {!string} value
- * @return {!Element}
- */
-SuggestionPicker.prototype._createSuggestionEntryElement = function(title, label, value) {
- var entryElement = createElement("li", SuggestionPicker.ListEntryClass);
- entryElement.tabIndex = 0;
- entryElement.dataset.value = value;
- var content = createElement("span", "content");
- entryElement.appendChild(content);
- var titleElement = createElement("span", "title", title);
- content.appendChild(titleElement);
- if (label) {
- var labelElement = createElement("span", "label", label);
- content.appendChild(labelElement);
- }
- entryElement.addEventListener("mouseover", this._handleEntryMouseOver.bind(this), false);
- return entryElement;
-};
-
-/**
- * @param {!string} title
- * @param {!string} actionName
- * @return {!Element}
- */
-SuggestionPicker.prototype._createActionEntryElement = function(title, actionName) {
- var entryElement = createElement("li", SuggestionPicker.ListEntryClass);
- entryElement.tabIndex = 0;
- entryElement.dataset.action = actionName;
- var content = createElement("span", "content");
- entryElement.appendChild(content);
- var titleElement = createElement("span", "title", title);
- content.appendChild(titleElement);
- entryElement.addEventListener("mouseover", this._handleEntryMouseOver.bind(this), false);
- return entryElement;
-};
-
-/**
-* @return {!number}
-*/
-SuggestionPicker.prototype._measureMaxContentWidth = function() {
- // To measure the required width, we first set the class to "measuring-width" which
- // left aligns all the content including label.
- this._containerElement.classList.add("measuring-width");
- var maxContentWidth = 0;
- var contentElements = this._containerElement.getElementsByClassName("content");
- for (var i=0; i < contentElements.length; ++i) {
- maxContentWidth = Math.max(maxContentWidth, contentElements[i].offsetWidth);
- }
- this._containerElement.classList.remove("measuring-width");
- return maxContentWidth;
-};
-
-SuggestionPicker.prototype._fixWindowSize = function() {
- var ListBorder = 2;
- var desiredWindowWidth = this._measureMaxContentWidth() + ListBorder;
- if (typeof this._config.inputWidth === "number")
- desiredWindowWidth = Math.max(this._config.inputWidth, desiredWindowWidth);
- var totalHeight = ListBorder;
- var maxHeight = 0;
- var entryCount = 0;
- for (var i = 0; i < this._containerElement.childNodes.length; ++i) {
- var node = this._containerElement.childNodes[i];
- if (node.classList.contains(SuggestionPicker.ListEntryClass))
- entryCount++;
- totalHeight += node.offsetHeight;
- if (maxHeight === 0 && entryCount == SuggestionPicker.NumberOfVisibleEntries)
- maxHeight = totalHeight;
- }
- var desiredWindowHeight = totalHeight;
- if (maxHeight !== 0 && totalHeight > maxHeight) {
- this._containerElement.style.maxHeight = (maxHeight - ListBorder) + "px";
- desiredWindowWidth += getScrollbarWidth();
- desiredWindowHeight = maxHeight;
- this._containerElement.style.overflowY = "scroll";
- }
-
- var windowRect = adjustWindowRect(desiredWindowWidth, desiredWindowHeight, desiredWindowWidth, 0);
- this._containerElement.style.height = (windowRect.height - ListBorder) + "px";
- setWindowRect(windowRect);
-};
-
-SuggestionPicker.prototype._layout = function() {
- if (this._config.isRTL)
- this._element.classList.add("rtl");
- if (this._config.isLocaleRTL)
- this._element.classList.add("locale-rtl");
- this._containerElement = createElement("ul", "suggestion-list");
- this._containerElement.addEventListener("click", this._handleEntryClick.bind(this), false);
- for (var i = 0; i < this._config.suggestionValues.length; ++i) {
- this._containerElement.appendChild(this._createSuggestionEntryElement(this._config.localizedSuggestionValues[i], this._config.suggestionLabels[i], this._config.suggestionValues[i]));
- }
- if (this._config.showOtherDateEntry) {
- // Add separator
- var separator = createElement("div", "separator");
- this._containerElement.appendChild(separator);
-
- // Add "Other..." entry
- var otherEntry = this._createActionEntryElement(this._config.otherDateLabel, SuggestionPicker.ActionNames.OpenCalendarPicker);
- this._containerElement.appendChild(otherEntry);
- }
- this._element.appendChild(this._containerElement);
-};
-
-/**
- * @param {!Element} entry
- */
-SuggestionPicker.prototype.selectEntry = function(entry) {
- if (typeof entry.dataset.value !== "undefined") {
- this.submitValue(entry.dataset.value);
- } else if (entry.dataset.action === SuggestionPicker.ActionNames.OpenCalendarPicker) {
- window.addEventListener("didHide", SuggestionPicker._handleWindowDidHide, false);
- hideWindow();
- }
-};
-
-SuggestionPicker._handleWindowDidHide = function() {
- openCalendarPicker();
- window.removeEventListener("didHide", SuggestionPicker._handleWindowDidHide);
-};
-
-/**
- * @param {!Event} event
- */
-SuggestionPicker.prototype._handleEntryClick = function(event) {
- var entry = enclosingNodeOrSelfWithClass(event.target, SuggestionPicker.ListEntryClass);
- if (!entry)
- return;
- this.selectEntry(entry);
- event.preventDefault();
-};
-
-/**
- * @return {?Element}
- */
-SuggestionPicker.prototype._findFirstVisibleEntry = function() {
- var scrollTop = this._containerElement.scrollTop;
- var childNodes = this._containerElement.childNodes;
- for (var i = 0; i < childNodes.length; ++i) {
- var node = childNodes[i];
- if (node.nodeType !== Node.ELEMENT_NODE || !node.classList.contains(SuggestionPicker.ListEntryClass))
- continue;
- if (node.offsetTop + node.offsetHeight - scrollTop > SuggestionPicker.VisibleEntryThresholdHeight)
- return node;
- }
- return null;
-};
-
-/**
- * @return {?Element}
- */
-SuggestionPicker.prototype._findLastVisibleEntry = function() {
- var scrollBottom = this._containerElement.scrollTop + this._containerElement.offsetHeight;
- var childNodes = this._containerElement.childNodes;
- for (var i = childNodes.length - 1; i >= 0; --i){
- var node = childNodes[i];
- if (node.nodeType !== Node.ELEMENT_NODE || !node.classList.contains(SuggestionPicker.ListEntryClass))
- continue;
- if (scrollBottom - node.offsetTop > SuggestionPicker.VisibleEntryThresholdHeight)
- return node;
- }
- return null;
-};
-
-/**
- * @param {!Event} event
- */
-SuggestionPicker.prototype._handleBodyKeyDown = function(event) {
- var eventHandled = false;
- var key = event.keyIdentifier;
- if (key === "U+001B") { // ESC
- this.handleCancel();
- eventHandled = true;
- } else if (key == "Up") {
- if (document.activeElement && document.activeElement.classList.contains(SuggestionPicker.ListEntryClass)) {
- for (var node = document.activeElement.previousElementSibling; node; node = node.previousElementSibling) {
- if (node.classList.contains(SuggestionPicker.ListEntryClass)) {
- this._isFocusByMouse = false;
- node.focus();
- break;
- }
- }
- } else {
- this._element.querySelector("." + SuggestionPicker.ListEntryClass + ":last-child").focus();
- }
- eventHandled = true;
- } else if (key == "Down") {
- if (document.activeElement && document.activeElement.classList.contains(SuggestionPicker.ListEntryClass)) {
- for (var node = document.activeElement.nextElementSibling; node; node = node.nextElementSibling) {
- if (node.classList.contains(SuggestionPicker.ListEntryClass)) {
- this._isFocusByMouse = false;
- node.focus();
- break;
- }
- }
- } else {
- this._element.querySelector("." + SuggestionPicker.ListEntryClass + ":first-child").focus();
- }
- eventHandled = true;
- } else if (key === "Enter") {
- this.selectEntry(document.activeElement);
- eventHandled = true;
- } else if (key === "PageUp") {
- this._containerElement.scrollTop -= this._containerElement.clientHeight;
- // Scrolling causes mouseover event to be called and that tries to move the focus too.
- // To prevent flickering we won't focus if the current focus was caused by the mouse.
- if (!this._isFocusByMouse)
- this._findFirstVisibleEntry().focus();
- eventHandled = true;
- } else if (key === "PageDown") {
- this._containerElement.scrollTop += this._containerElement.clientHeight;
- if (!this._isFocusByMouse)
- this._findLastVisibleEntry().focus();
- eventHandled = true;
- }
- if (eventHandled)
- event.preventDefault();
-};
-
-/**
- * @param {!Event} event
- */
-SuggestionPicker.prototype._handleEntryMouseOver = function(event) {
- var entry = enclosingNodeOrSelfWithClass(event.target, SuggestionPicker.ListEntryClass);
- if (!entry)
- return;
- this._isFocusByMouse = true;
- entry.focus();
- event.preventDefault();
-};
-
-/**
- * @param {!Event} event
- */
-SuggestionPicker.prototype._handleMouseOut = function(event) {
- if (!document.activeElement.classList.contains(SuggestionPicker.ListEntryClass))
- return;
- this._isFocusByMouse = false;
- document.activeElement.blur();
- event.preventDefault();
-};