sproutcore 1.11.0.rc3 → 1.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +6 -14
  2. data/CHANGELOG +5 -0
  3. data/VERSION.yml +1 -1
  4. data/lib/frameworks/sproutcore/Buildfile +3 -2
  5. data/lib/frameworks/sproutcore/CHANGELOG.md +59 -10
  6. data/lib/frameworks/sproutcore/apps/showcase/resources/main_page.js +1 -0
  7. data/lib/frameworks/sproutcore/apps/showcase/resources/stylesheet.css +9 -4
  8. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/manipulation.js +1 -1
  9. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +0 -10
  10. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/locale.js +1 -1
  11. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +10 -45
  12. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/selection_set.js +3 -3
  13. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/touch.js +76 -0
  14. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/{touch.js → touch_test.js} +64 -0
  15. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/append_remove.js +1 -1
  16. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/design_mode_test.js +61 -24
  17. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/createChildViews.js +1 -2
  18. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/destroy.js +0 -3
  19. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/{layoutStyle.js → layout_style_test.js} +4 -4
  20. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layout_test.js +602 -0
  21. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/viewDidResize.js +0 -23
  22. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +18 -17
  23. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/animation.js +5 -5
  24. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/design_mode.js +64 -24
  25. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +904 -871
  26. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout_style.js +1 -3
  27. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/statechart.js +40 -24
  28. data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/fixtures.js +2 -2
  29. data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +5 -5
  30. data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +14 -14
  31. data/lib/frameworks/sproutcore/frameworks/datastore/system/query.js +1 -1
  32. data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +2 -2
  33. data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +36 -33
  34. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/writeAttribute.js +1 -1
  35. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/autonomous_dataSourceCallbacks.js +6 -6
  36. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitChangesFromNestedStore.js +1 -1
  37. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitRecord.js +1 -1
  38. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/dataSourceCallbacks.js +7 -7
  39. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/destroyRecord.js +2 -2
  40. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/recordDidChange.js +2 -2
  41. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/retrieveRecord.js +4 -4
  42. data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/core/system/datetime.js +11 -11
  43. data/lib/frameworks/sproutcore/frameworks/designer/coders/object.js +1 -1
  44. data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +30 -1
  45. data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +12 -1
  46. data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_scroll.js +5 -3
  47. data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_scroller_view.js +0 -36
  48. data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll_view.js +3 -3
  49. data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +1 -1
  50. data/lib/frameworks/sproutcore/frameworks/desktop/views/static_content.js +1 -1
  51. data/lib/frameworks/sproutcore/frameworks/foundation/gestures/pinch_gesture.js +286 -0
  52. data/lib/frameworks/sproutcore/frameworks/foundation/gestures/swipe_gesture.js +449 -0
  53. data/lib/frameworks/sproutcore/frameworks/foundation/gestures/tap_gesture.js +259 -0
  54. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/gesturable.js +218 -30
  55. data/lib/frameworks/sproutcore/frameworks/foundation/system/gesture.js +259 -158
  56. data/lib/frameworks/sproutcore/frameworks/foundation/system/string.js +58 -50
  57. data/lib/frameworks/sproutcore/frameworks/foundation/system/utils/string_measurement.js +1 -1
  58. data/lib/frameworks/sproutcore/frameworks/foundation/tests/gestures/pinch_gesture_test.js +321 -0
  59. data/lib/frameworks/sproutcore/frameworks/foundation/tests/gestures/swipe_gesture_test.js +154 -0
  60. data/lib/frameworks/sproutcore/frameworks/foundation/tests/gestures/tap_gesture_test.js +55 -0
  61. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/gesturable_test.js +233 -0
  62. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/staticLayout.js +2 -2
  63. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/gesture_test.js +254 -0
  64. data/lib/frameworks/sproutcore/frameworks/foundation/views/container.js +1 -0
  65. data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +1 -1
  66. data/lib/frameworks/sproutcore/frameworks/legacy/object_keys_polyfill.js +51 -0
  67. data/lib/frameworks/sproutcore/frameworks/{core_foundation/system/req_anim_frame.js → legacy/request_animation_frame_polyfill.js} +10 -3
  68. data/lib/frameworks/sproutcore/frameworks/media/views/audio.js +19 -25
  69. data/lib/frameworks/sproutcore/frameworks/media/views/controls.js +7 -7
  70. data/lib/frameworks/sproutcore/frameworks/media/views/mini_controls.js +3 -3
  71. data/lib/frameworks/sproutcore/frameworks/media/views/simple_controls.js +9 -9
  72. data/lib/frameworks/sproutcore/frameworks/runtime/core.js +2 -2
  73. data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/insertAt.js +2 -2
  74. data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/removeAt.js +1 -1
  75. data/lib/frameworks/sproutcore/frameworks/runtime/ext/array.js +1 -1
  76. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +2 -2
  77. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/freezable.js +2 -2
  78. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +66 -5
  79. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/tree.js +44 -0
  80. data/lib/frameworks/sproutcore/frameworks/runtime/private/observer_queue.js +4 -1
  81. data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +0 -25
  82. data/lib/frameworks/sproutcore/frameworks/runtime/system/enumerator.js +1 -1
  83. data/lib/frameworks/sproutcore/frameworks/runtime/system/error.js +67 -15
  84. data/lib/frameworks/sproutcore/frameworks/runtime/system/index_set.js +6 -11
  85. data/lib/frameworks/sproutcore/frameworks/runtime/system/set.js +6 -6
  86. data/lib/frameworks/sproutcore/frameworks/runtime/system/string.js +1 -1
  87. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/{observable.js → observable_test.js} +110 -16
  88. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/error.js +21 -0
  89. data/lib/frameworks/sproutcore/frameworks/statechart/system/statechart.js +2 -2
  90. data/lib/frameworks/sproutcore/frameworks/template_view/ext/handlebars.js +1 -1
  91. data/lib/frameworks/sproutcore/frameworks/testing/system/plan.js +1 -1
  92. data/lib/sproutcore/render_engines/haml.rb +1 -1
  93. metadata +610 -604
  94. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layout.js +0 -210
  95. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutDidChange.js +0 -275
  96. data/lib/frameworks/sproutcore/frameworks/foundation/gestures/pinch.js +0 -119
  97. data/lib/frameworks/sproutcore/frameworks/foundation/gestures/swipe.js +0 -234
  98. data/lib/frameworks/sproutcore/frameworks/foundation/gestures/tap.js +0 -157
@@ -77,7 +77,7 @@ test("raises exception if you try to write an attribute before an attribute hash
77
77
  try {
78
78
  foo.writeAttribute("foo", "bar");
79
79
  } catch(e) {
80
- equals(e, SC.Record.BAD_STATE_ERROR, 'should throw BAD_STATE_ERROR');
80
+ equals(e.message, SC.Record.BAD_STATE_ERROR.toString(), 'should throw BAD_STATE_ERROR');
81
81
  cnt++;
82
82
  }
83
83
  equals(cnt, 1, 'should raise exception');
@@ -163,7 +163,7 @@ test("Confirm that dataSourceDidCancel switched the records to the right states"
163
163
  }catch(error){
164
164
  msg=error.message;
165
165
  }
166
- equals(SC.Record.BAD_STATE_ERROR.message, msg,
166
+ equals(SC.Record.BAD_STATE_ERROR.toString(), msg,
167
167
  "should throw the following error ");
168
168
 
169
169
  store.dataSourceDidCancel(storeKey2);
@@ -196,7 +196,7 @@ test("Confirm that dataSourceDidCancel switched the records to the right states"
196
196
  }catch(error){
197
197
  msg=error.message;
198
198
  }
199
- equals(SC.Record.BAD_STATE_ERROR.message, msg,
199
+ equals(SC.Record.BAD_STATE_ERROR.toString(), msg,
200
200
  "should throw the following error ");
201
201
 
202
202
  });
@@ -210,7 +210,7 @@ test("Confirm that dataSourceDidComplete switched the records to the right state
210
210
  }catch(error){
211
211
  msg=error.message;
212
212
  }
213
- equals(SC.Record.BAD_STATE_ERROR.message, msg,
213
+ equals(SC.Record.BAD_STATE_ERROR.toString(), msg,
214
214
  "should throw the following error ");
215
215
 
216
216
  try{
@@ -219,7 +219,7 @@ test("Confirm that dataSourceDidComplete switched the records to the right state
219
219
  }catch(error){
220
220
  msg=error.message;
221
221
  }
222
- equals(SC.Record.BAD_STATE_ERROR.message, msg,
222
+ equals(SC.Record.BAD_STATE_ERROR.toString(), msg,
223
223
  "should throw the following error ");
224
224
 
225
225
  store.dataSourceDidComplete(storeKey11);
@@ -237,7 +237,7 @@ test("Confirm that dataSourceDidDestroy switched the records to the right states
237
237
  }catch(error){
238
238
  msg=error.message;
239
239
  }
240
- equals(SC.Record.BAD_STATE_ERROR.message, msg,
240
+ equals(SC.Record.BAD_STATE_ERROR.toString(), msg,
241
241
  "should throw the following error ");
242
242
 
243
243
  store.dataSourceDidDestroy(storeKey13);
@@ -255,7 +255,7 @@ test("Confirm that dataSourceDidError switched the records to the right states",
255
255
  }catch(error){
256
256
  msg = error.message;
257
257
  }
258
- equals(SC.Record.BAD_STATE_ERROR.message, msg,
258
+ equals(SC.Record.BAD_STATE_ERROR.toString(), msg,
259
259
  "should throw the following error ");
260
260
 
261
261
  store.dataSourceDidError(storeKey15, SC.Record.BAD_STATE_ERROR);
@@ -118,7 +118,7 @@ function createConflict(force) {
118
118
  try {
119
119
  child.commitChanges(force);
120
120
  } catch(e) {
121
- equals(e, SC.Store.CHAIN_CONFLICT_ERROR, 'should throw CHAIN_CONFLICT_ERROR');
121
+ equals(e.message, SC.Store.CHAIN_CONFLICT_ERROR.toString(), 'should throw CHAIN_CONFLICT_ERROR');
122
122
  errorCount++;
123
123
  }
124
124
 
@@ -156,7 +156,7 @@ test("Confirm that all the states are switched as expected after running commitR
156
156
  throwError=true;
157
157
  msg=error.message;
158
158
  }
159
- equals(msg, SC.Record.NOT_FOUND_ERROR.message, "commitRecord should throw the following error");
159
+ equals(msg, SC.Record.NOT_FOUND_ERROR.toString(), "commitRecord should throw the following error");
160
160
 
161
161
  store.commitRecord(undefined, undefined, storeKey7);
162
162
  status = store.readStatus( storeKey7);
@@ -161,7 +161,7 @@ test("Confirm that dataSourceDidCancel switched the records to the right states"
161
161
  }catch(error){
162
162
  msg=error.message;
163
163
  }
164
- equals(SC.Record.BAD_STATE_ERROR.message, msg,
164
+ equals(SC.Record.BAD_STATE_ERROR.toString(), msg,
165
165
  "should throw the following error ");
166
166
 
167
167
  store.dataSourceDidCancel(storeKey2);
@@ -194,7 +194,7 @@ test("Confirm that dataSourceDidCancel switched the records to the right states"
194
194
  }catch(error){
195
195
  msg=error.message;
196
196
  }
197
- equals(SC.Record.BAD_STATE_ERROR.message, msg,
197
+ equals(SC.Record.BAD_STATE_ERROR.toString(), msg,
198
198
  "should throw the following error ");
199
199
 
200
200
  });
@@ -208,7 +208,7 @@ test("Confirm that dataSourceDidComplete switched the records to the right state
208
208
  }catch(error){
209
209
  msg=error.message;
210
210
  }
211
- equals(SC.Record.BAD_STATE_ERROR.message, msg,
211
+ equals(SC.Record.BAD_STATE_ERROR.toString(), msg,
212
212
  "should throw the following error ");
213
213
 
214
214
  try{
@@ -217,7 +217,7 @@ test("Confirm that dataSourceDidComplete switched the records to the right state
217
217
  }catch(error){
218
218
  msg=error.message;
219
219
  }
220
- equals(SC.Record.BAD_STATE_ERROR.message, msg,
220
+ equals(SC.Record.BAD_STATE_ERROR.toString(), msg,
221
221
  "should throw the following error ");
222
222
 
223
223
  store.dataSourceDidComplete(storeKey11);
@@ -258,8 +258,8 @@ test("Confirm that dataSourceDidDestroy switched the records to the right states
258
258
  msg='';
259
259
  }catch(error){
260
260
  msg=error.message;
261
- }
262
- equals(SC.Record.BAD_STATE_ERROR.message, msg,
261
+ }
262
+ equals(SC.Record.BAD_STATE_ERROR.toString(), msg,
263
263
  "should throw the following error ");
264
264
 
265
265
  store.dataSourceDidDestroy(storeKey13);
@@ -277,7 +277,7 @@ test("Confirm that dataSourceDidError switched the records to the right states",
277
277
  }catch(error){
278
278
  msg = error.message;
279
279
  }
280
- equals(SC.Record.BAD_STATE_ERROR.message, msg,
280
+ equals(SC.Record.BAD_STATE_ERROR.toString(), msg,
281
281
  "should throw the following error ");
282
282
 
283
283
  store.dataSourceDidError(storeKey15, SC.Record.BAD_STATE_ERROR);
@@ -86,7 +86,7 @@ test("Check for different states after/before executing destroyRecord", function
86
86
  }catch(error1){
87
87
  msg=error1.message;
88
88
  }
89
- equals(msg, SC.Record.NOT_FOUND_ERROR.message, "destroyRecord should throw the following error");
89
+ equals(msg, SC.Record.NOT_FOUND_ERROR.toString(), "destroyRecord should throw the following error");
90
90
 
91
91
  try{
92
92
  store.destroyRecord(undefined, undefined, storeKey4);
@@ -94,7 +94,7 @@ test("Check for different states after/before executing destroyRecord", function
94
94
  }catch(error2){
95
95
  msg=error2.message;
96
96
  }
97
- equals(msg, SC.Record.BUSY_ERROR.message, "destroyRecord should throw the following error");
97
+ equals(msg, SC.Record.BUSY_ERROR.toString(), "destroyRecord should throw the following error");
98
98
 
99
99
  store.destroyRecord(undefined, undefined, storeKey5);
100
100
  status = store.readStatus(storeKey5);
@@ -56,13 +56,13 @@ test("recordDidChange", function() {
56
56
  try{
57
57
  store.recordDidChange(undefined, undefined, storeKey1);
58
58
  }catch(error1){
59
- equals(SC.Record.BUSY_ERROR.message, error1.message, "the status shouldn't have changed.");
59
+ equals(SC.Record.BUSY_ERROR.toString(), error1.message, "the status shouldn't have changed.");
60
60
  }
61
61
 
62
62
  try{
63
63
  store.recordDidChange(undefined, undefined, storeKey2);
64
64
  }catch(error2){
65
- equals(SC.Record.NOT_FOUND_ERROR.message, error2.message, "the status shouldn't have changed.");
65
+ equals(SC.Record.NOT_FOUND_ERROR.toString(), error2.message, "the status shouldn't have changed.");
66
66
  }
67
67
 
68
68
  store.recordDidChange(undefined, undefined, storeKey3);
@@ -119,7 +119,7 @@ function testStates(canLoad) {
119
119
  }catch(error1){
120
120
  msg=error1.message;
121
121
  }
122
- equals(msg, SC.Record.BUSY_ERROR.message, "should throw error");
122
+ equals(msg, SC.Record.BUSY_ERROR.toString(), "should throw error");
123
123
 
124
124
  try{
125
125
  store.retrieveRecord(undefined, undefined, storeKey5, YES);
@@ -127,7 +127,7 @@ function testStates(canLoad) {
127
127
  }catch(error2){
128
128
  msg=error2.message;
129
129
  }
130
- equals(msg, SC.Record.BUSY_ERROR.message, "should throw error");
130
+ equals(msg, SC.Record.BUSY_ERROR.toString(), "should throw error");
131
131
 
132
132
  try{
133
133
  store.retrieveRecord(undefined, undefined, storeKey6, YES);
@@ -135,7 +135,7 @@ function testStates(canLoad) {
135
135
  }catch(error3){
136
136
  msg=error3.message;
137
137
  }
138
- equals(msg, SC.Record.BUSY_ERROR.message, "should throw error");
138
+ equals(msg, SC.Record.BUSY_ERROR.toString(), "should throw error");
139
139
 
140
140
  try{
141
141
  store.retrieveRecord(undefined, undefined, storeKey7, YES);
@@ -143,7 +143,7 @@ function testStates(canLoad) {
143
143
  }catch(error4){
144
144
  msg=error4.message;
145
145
  }
146
- equals(msg, SC.Record.BAD_STATE_ERROR.message, "should throw error");
146
+ equals(msg, SC.Record.BAD_STATE_ERROR.toString(), "should throw error");
147
147
 
148
148
 
149
149
  store.retrieveRecord(undefined, undefined, storeKey8, YES);
@@ -12,7 +12,7 @@
12
12
  @constant
13
13
  @type Error
14
14
  */
15
- SC.SCANNER_OUT_OF_BOUNDS_ERROR = new Error("Out of bounds.");
15
+ SC.SCANNER_OUT_OF_BOUNDS_ERROR = SC.$error("Out of bounds.");
16
16
 
17
17
  /**
18
18
  Standard error thrown by `SC.Scanner` when you pass a value not an integer.
@@ -21,7 +21,7 @@ SC.SCANNER_OUT_OF_BOUNDS_ERROR = new Error("Out of bounds.");
21
21
  @constant
22
22
  @type Error
23
23
  */
24
- SC.SCANNER_INT_ERROR = new Error("Not an int.");
24
+ SC.SCANNER_INT_ERROR = SC.$error("Not an int.");
25
25
 
26
26
  /**
27
27
  Standard error thrown by `SC.SCanner` when it cannot find a string to skip.
@@ -30,7 +30,7 @@ SC.SCANNER_INT_ERROR = new Error("Not an int.");
30
30
  @constant
31
31
  @type Error
32
32
  */
33
- SC.SCANNER_SKIP_ERROR = new Error("Did not find the string to skip.");
33
+ SC.SCANNER_SKIP_ERROR = SC.$error("Did not find the string to skip.");
34
34
 
35
35
  /**
36
36
  Standard error thrown by `SC.Scanner` when it can any kind a string in the
@@ -40,7 +40,7 @@ SC.SCANNER_SKIP_ERROR = new Error("Did not find the string to skip.");
40
40
  @constant
41
41
  @type Error
42
42
  */
43
- SC.SCANNER_SCAN_ARRAY_ERROR = new Error("Did not find any string of the given array to scan.");
43
+ SC.SCANNER_SCAN_ARRAY_ERROR = SC.$error("Did not find any string of the given array to scan.");
44
44
 
45
45
  /**
46
46
  Standard error thrown when trying to compare two dates in different
@@ -50,7 +50,7 @@ SC.SCANNER_SCAN_ARRAY_ERROR = new Error("Did not find any string of the given ar
50
50
  @constant
51
51
  @type Error
52
52
  */
53
- SC.DATETIME_COMPAREDATE_TIMEZONE_ERROR = new Error("Can't compare the dates of two DateTimes that don't have the same timezone.");
53
+ SC.DATETIME_COMPAREDATE_TIMEZONE_ERROR = SC.$error("Can't compare the dates of two DateTimes that don't have the same timezone.");
54
54
 
55
55
  /**
56
56
  Standard ISO8601 date format
@@ -106,7 +106,7 @@ SC.Scanner = SC.Object.extend(
106
106
  @returns {String} The characters
107
107
  */
108
108
  scan: function(len) {
109
- if (this.scanLocation + len > this.length) throw SC.SCANNER_OUT_OF_BOUNDS_ERROR;
109
+ if (this.scanLocation + len > this.length) SC.SCANNER_OUT_OF_BOUNDS_ERROR.throw();
110
110
  var str = this.string.substr(this.scanLocation, len);
111
111
  this.scanLocation += len;
112
112
  return str;
@@ -125,7 +125,7 @@ SC.Scanner = SC.Object.extend(
125
125
  var str = this.scan(max_len);
126
126
  var re = new RegExp("^\\d{" + min_len + "," + max_len + "}");
127
127
  var match = str.match(re);
128
- if (!match) throw SC.SCANNER_INT_ERROR;
128
+ if (!match) SC.SCANNER_INT_ERROR.throw();
129
129
  if (match[0].length < max_len) {
130
130
  this.scanLocation += match[0].length - max_len;
131
131
  }
@@ -140,7 +140,7 @@ SC.Scanner = SC.Object.extend(
140
140
  @returns {Boolean} YES if the given string was successfully scanned, NO otherwise
141
141
  */
142
142
  skipString: function(str) {
143
- if (this.scan(str.length) !== str) throw SC.SCANNER_SKIP_ERROR;
143
+ if (this.scan(str.length) !== str) SC.SCANNER_SKIP_ERROR.throw();
144
144
  return YES;
145
145
  },
146
146
 
@@ -158,7 +158,7 @@ SC.Scanner = SC.Object.extend(
158
158
  }
159
159
  this.scanLocation -= ary[i].length;
160
160
  }
161
- throw SC.SCANNER_SCAN_ARRAY_ERROR;
161
+ SC.SCANNER_SCAN_ARRAY_ERROR.throw();
162
162
  }
163
163
 
164
164
  });
@@ -1227,7 +1227,7 @@ SC.DateTime.mixin(SC.Comparable,
1227
1227
  */
1228
1228
  compareDate: function(a, b) {
1229
1229
  if (SC.none(a) || SC.none(b)) throw new Error("You must pass two valid dates to compareDate()");
1230
- if (a.get('timezone') !== b.get('timezone')) throw SC.DATETIME_COMPAREDATE_TIMEZONE_ERROR;
1230
+ if (a.get('timezone') !== b.get('timezone')) SC.DATETIME_COMPAREDATE_TIMEZONE_ERROR.throw();
1231
1231
  var ma = a.adjust({hour: 0}).get('milliseconds');
1232
1232
  var mb = b.adjust({hour: 0}).get('milliseconds');
1233
1233
  return ma < mb ? -1 : ma === mb ? 0 : 1;
@@ -1273,7 +1273,7 @@ SC.DateTime.mixin(SC.Comparable,
1273
1273
  divider = 6048e5; // week: 1000 * 60 * 60 * 24 * 7
1274
1274
  break;
1275
1275
  default:
1276
- throw format + " is not supported";
1276
+ throw new Error(format + " is not supported");
1277
1277
  }
1278
1278
 
1279
1279
  var ret = diff/divider;
@@ -309,7 +309,7 @@ SC.ObjectCoder = SC.Object.extend({
309
309
  begin: function(object) {
310
310
  var methodName = this.get('encodeMethodName');
311
311
  if (SC.typeOf(object[methodName]) !== SC.T_FUNCTION) {
312
- throw SC.$error("Cannot encode %@ because it does not respond to %@()".fmt(object, methodName)) ;
312
+ SC.throw("Cannot encode %@ because it does not respond to %@()".fmt(object, methodName));
313
313
  }
314
314
 
315
315
  // save className for later coding
@@ -557,7 +557,7 @@ SC.MenuPane = SC.PickerPane.extend(
557
557
  @returns {SC.View} receiver
558
558
  */
559
559
  createChildViews: function () {
560
- var scroll, menuView, menuItemViews;
560
+ var scroll, menuView;
561
561
 
562
562
  // Create the menu items collection view.
563
563
  // TODO: Should this not be an SC.ListView?
@@ -1273,3 +1273,32 @@ SC._menu_fetchItem = function (k) {
1273
1273
  if (!k) return null;
1274
1274
  return this.get ? this.get(k) : this[k];
1275
1275
  };
1276
+
1277
+
1278
+ /**
1279
+ Default metrics for the different control sizes.
1280
+ */
1281
+ SC.MenuPane.TINY_MENU_ITEM_HEIGHT = 10;
1282
+ // SC.MenuPane.TINY_MENU_ITEM_SEPARATOR_HEIGHT = 2;
1283
+ // SC.MenuPane.TINY_MENU_HEIGHT_PADDING = 2;
1284
+ // SC.MenuPane.TINY_SUBMENU_OFFSET_X = 0;
1285
+
1286
+ SC.MenuPane.SMALL_MENU_ITEM_HEIGHT = 16;
1287
+ // SC.MenuPane.SMALL_MENU_ITEM_SEPARATOR_HEIGHT = 7;
1288
+ // SC.MenuPane.SMALL_MENU_HEIGHT_PADDING = 4;
1289
+ // SC.MenuPane.SMALL_SUBMENU_OFFSET_X = 2;
1290
+
1291
+ SC.MenuPane.REGULAR_MENU_ITEM_HEIGHT = 22;
1292
+ // SC.MenuPane.REGULAR_MENU_ITEM_SEPARATOR_HEIGHT = 9;
1293
+ // SC.MenuPane.REGULAR_MENU_HEIGHT_PADDING = 6;
1294
+ // SC.MenuPane.REGULAR_SUBMENU_OFFSET_X = 2;
1295
+
1296
+ SC.MenuPane.LARGE_MENU_ITEM_HEIGHT = 31;
1297
+ // SC.MenuPane.LARGE_MENU_ITEM_SEPARATOR_HEIGHT = 20;
1298
+ // SC.MenuPane.LARGE_MENU_HEIGHT_PADDING = 0;
1299
+ // SC.MenuPane.LARGE_SUBMENU_OFFSET_X = 4;
1300
+
1301
+ SC.MenuPane.HUGE_MENU_ITEM_HEIGHT = 20;
1302
+ // SC.MenuPane.HUGE_MENU_ITEM_SEPARATOR_HEIGHT = 9;
1303
+ // SC.MenuPane.HUGE_MENU_HEIGHT_PADDING = 0;
1304
+ // SC.MenuPane.HUGE_SUBMENU_OFFSET_X = 0;
@@ -309,7 +309,7 @@ SC.PickerPane = SC.PalettePane.extend(
309
309
  // Throw an error if a null or empty value is set. You're not allowed to go anchorless.
310
310
  // (TODO: why can't we go anchorless? positionPane happily centers an unmoored pane.)
311
311
  if (!value) {
312
- throw "You must set 'anchorElement' to either a view or a DOM element";
312
+ SC.throw("You must set 'anchorElement' to either a view or a DOM element");
313
313
  }
314
314
 
315
315
  // Clean up any previous anchor elements.
@@ -641,11 +641,22 @@ SC.PickerPane = SC.PalettePane.extend(
641
641
 
642
642
  frame = this.fitPositionToScreen(origin, frame, anchor);
643
643
 
644
+ // Create an adjustment layout from the computed position.
644
645
  adjustHash = {
645
646
  left: frame.x,
646
647
  top: frame.y
647
648
  };
648
649
 
650
+ // If the computed position also constrains width or height, add it to the adjustment.
651
+ /*jshint eqnull:true*/
652
+ if (frame.width != null) {
653
+ adjustHash.width = frame.width;
654
+ }
655
+
656
+ if (frame.height != null) {
657
+ adjustHash.height = frame.height;
658
+ }
659
+
649
660
  /*
650
661
  Special case behavior for transitions that include scale or rotate: notably SC.View.SCALE_IN and SC.View.POP_IN.
651
662
 
@@ -100,7 +100,7 @@ SC.MenuScrollView = SC.ScrollView.extend(
100
100
  },
101
101
 
102
102
  /** @private @see SC.ScrollView. When the content view's size changes, we need to update our scroll offset properties. */
103
- _sc_contentViewSizeDidChangeUnfiltered: function () {
103
+ _sc_repositionContentViewUnfiltered: function () {
104
104
  var hasVerticalScroller = this.get('hasVerticalScroller'),
105
105
  // UNUSED. minimumVerticalScrollOffset = this.get('minimumVerticalScrollOffset'),
106
106
  maximumVerticalScrollOffset = this.get('maximumVerticalScrollOffset');
@@ -120,6 +120,8 @@ SC.MenuScrollView = SC.ScrollView.extend(
120
120
  this.setIfChanged('isVerticalScrollerVisible', contentHeight > containerHeight);
121
121
  }
122
122
  }
123
+
124
+ sc_super();
123
125
  },
124
126
 
125
127
  /** @private @see SC.ScrollView. Re-position the scrollers and content depending on the need to scroll or not. */
@@ -214,7 +216,7 @@ SC.MenuScrollView = SC.ScrollView.extend(
214
216
  layout: { height: 0 },
215
217
 
216
218
  value: this.get('verticalScrollOffset'),
217
- valueBinding: '.owner.verticalScrollOffset', // Bind the value of the scroller to our vertical offset.
219
+ valueBinding: '.parentView.verticalScrollOffset', // Bind the value of the scroller to our vertical offset.
218
220
  minimum: this.get('minimumVerticalScrollOffset'),
219
221
  maximum: this.get('maximumVerticalScrollOffset')
220
222
  });
@@ -242,7 +244,7 @@ SC.MenuScrollView = SC.ScrollView.extend(
242
244
  layout: { bottom: 0, height: 0 },
243
245
 
244
246
  value: this.get('verticalScrollOffset'),
245
- valueBinding: '.owner.verticalScrollOffset', // Bind the value of the scroller to our vertical offset.
247
+ valueBinding: '.parentView.verticalScrollOffset', // Bind the value of the scroller to our vertical offset.
246
248
  minimum: this.get('minimumVerticalScrollOffset'),
247
249
  maximum: this.get('maximumVerticalScrollOffset')
248
250
  });
@@ -87,12 +87,6 @@ SC.MenuScrollerView = SC.ScrollerView.extend(
87
87
  }
88
88
  },
89
89
 
90
- /** @private */
91
- willDestroyLayer: function () {
92
- var callback = this._sc_scroller_scrollDidChange;
93
- SC.Event.remove(this.$(), 'scroll', this, callback);
94
- },
95
-
96
90
  /** @private */
97
91
  mouseEntered: function (evt) {
98
92
  this.set('isMouseOver', YES);
@@ -104,36 +98,6 @@ SC.MenuScrollerView = SC.ScrollerView.extend(
104
98
  this.set('isMouseOver', NO);
105
99
  },
106
100
 
107
- /** @private */
108
- _sc_scroller_armScrollTimer: function () {
109
- if (!this._sc_scrollTimer) {
110
- SC.run(function () {
111
- var method = this._sc_scroller_scrollDidChange;
112
- this._sc_scrollTimer = this.invokeLater(method, 50);
113
- });
114
- }
115
- },
116
-
117
- /** @private */
118
- _sc_scroller_scrollDidChange: function () {
119
- var now = Date.now(),
120
- last = this._sc_lastScroll,
121
- layer = this.get('layer'),
122
- scroll = 0;
123
-
124
- if (last && (now - last) < 50) return this._sc_scroller_armScrollTimer();
125
- this._sc_scrollTimer = null;
126
- this._sc_lastScroll = now;
127
-
128
- SC.run(function () {
129
- if (!this.get('isEnabledInPane')) return; // nothing to do.
130
-
131
- this._sc_scrollValue = scroll = layer.scrollTop;
132
- this.set('value', scroll); // will now enforce minimum and maximum
133
- });
134
- },
135
-
136
-
137
101
  /** @private
138
102
  Scroll the menu if it is is an up or down arrow. This is called by
139
103
  the function that simulates mouseOver.