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

Unified Diff: ManualTests/forms/list-picker.html

Issue 736883002: Implement <select> Popup Menu using PagePopup (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years 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 side-by-side diff with in-line comments
Download patch
Index: ManualTests/forms/list-picker.html
diff --git a/ManualTests/forms/list-picker.html b/ManualTests/forms/list-picker.html
new file mode 100644
index 0000000000000000000000000000000000000000..1868e54e66efa1c957330e261c0cc1bc808bb466
--- /dev/null
+++ b/ManualTests/forms/list-picker.html
@@ -0,0 +1,147 @@
+<!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>
+
+<div><input type="text" id="date"></div>
+<iframe></iframe>
+
+<ol id="console" style="font-family:monospace;">
+</ol>
+
+<script>
+var arguments = {
+ selectedIndex: 0,
+ children: [
+ {
+ type: "option",
+ label: "foo",
+ title: "",
+ value: 0,
+ ariaLabel: "",
+ disabled: false,
+ },
+ {
+ type: "option",
+ label: "bar",
+ title: "",
+ value: 1,
+ ariaLabel: "",
+ disabled: false,
+ },
+ {
+ type: "option",
+ label: "bar",
+ title: "",
+ value: 2,
+ ariaLabel: "",
+ disabled: false,
+ },
+ {
+ type: "optgroup",
+ label: "foo",
+ title: "",
+ ariaLabel: "",
+ disabled: false,
+ children: [{
+ type: "option",
+ label: "bar",
+ title: "",
+ value: 3,
+ ariaLabel: "",
+ disabled: false,
+ },
+ {
+ type: "option",
+ label: "bar",
+ title: "",
+ value: 4,
+ ariaLabel: "",
+ disabled: false,
+ },
+ ],
+ },
+ {
+ type: "option",
+ label: "bar",
+ title: "",
+ value: 5,
+ ariaLabel: "",
+ disabled: false,
+ },
+ ],
+ anchorRectInScreen: {x: 1332,
+ y: 356,
+ width: 64,
+ height: 18,
+ },
+ };
+
+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/web/resources/pickerCommon.css?' + (new Date()).getTime();
+ doc.head.appendChild(commonCssLink);
+ var commonChromiumCssLink = doc.createElement('link');
+ commonChromiumCssLink.rel = 'stylesheet';
+ commonChromiumCssLink.href = '../../Source/web/resources/pickerCommon.css?' + (new Date()).getTime();
+ doc.head.appendChild(commonChromiumCssLink);
+ var listPickerCssLink = doc.createElement('link');
+ listPickerCssLink.rel = 'stylesheet';
+ listPickerCssLink.href = '../../Source/web/resources/listPicker.css?' + (new Date()).getTime();
+ doc.head.appendChild(listPickerCssLink);
+ var calendarPickerChromiumCssLink = doc.createElement('link');
+ calendarPickerChromiumCssLink.rel = 'stylesheet';
+ calendarPickerChromiumCssLink.href = '../../Source/web/resources/calendarPicker.css?' + (new Date()).getTime();
+ doc.head.appendChild(calendarPickerChromiumCssLink);
+ var commonJsScript = doc.createElement('script');
+ commonJsScript.src = '../../Source/web/resources/pickerCommon.js?' + (new Date()).getTime();
+ doc.body.appendChild(commonJsScript);
+ var listPickerJsScript = doc.createElement('script');
+ listPickerJsScript.src = '../../Source/web/resources/listPicker.js?' + (new Date()).getTime();
+ doc.body.appendChild(listPickerJsScript);
+
+ var pagePopupController = {
+ setValueAndClosePopup: function(numValue, stringValue) {
+ window.log('number=' + numValue + ', string="' + stringValue + '"');
+ if (numValue == 0)
+ window.document.getElementById('date').value = stringValue;
+ },
+ }
+
+ 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);
+}
+
+openCalendar(arguments);
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698