sproutcore 1.11.0.rc2 → 1.11.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +8 -8
  2. data/CHANGELOG +10 -0
  3. data/VERSION.yml +1 -1
  4. data/lib/frameworks/sproutcore/CHANGELOG.md +114 -1
  5. data/lib/frameworks/sproutcore/apps/showcase/views/views_item_view.js +1 -7
  6. data/lib/frameworks/sproutcore/apps/showcase/views/views_list_view.js +9 -9
  7. data/lib/frameworks/sproutcore/frameworks/ajax/system/request.js +167 -5
  8. data/lib/frameworks/sproutcore/frameworks/ajax/system/response.js +24 -8
  9. data/lib/frameworks/sproutcore/frameworks/core_foundation/child_view_layouts/stack_layout.js +737 -0
  10. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/layout.js +0 -6
  11. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +11 -7
  12. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane_statechart.js +7 -11
  13. data/lib/frameworks/sproutcore/frameworks/core_foundation/protocols/child_view_layout_protocol.js +8 -3
  14. data/lib/frameworks/sproutcore/frameworks/core_foundation/protocols/observable_protocol.js +9 -6
  15. data/lib/frameworks/sproutcore/frameworks/{desktop/protocols/responder.js → core_foundation/protocols/responder_protocol.js} +83 -17
  16. data/lib/frameworks/sproutcore/frameworks/core_foundation/protocols/{sparse_array_delegate.js → sparse_array_delegate_protocol.js} +11 -7
  17. data/lib/frameworks/sproutcore/frameworks/core_foundation/protocols/view_transition_protocol.js +11 -6
  18. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/color.js +2 -2
  19. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/page.js +0 -22
  20. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +61 -56
  21. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/main_pane.js +2 -2
  22. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/append_remove.js +3 -3
  23. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/animation.js +63 -39
  24. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/border_frame_test.js +28 -28
  25. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/createLayer.js +10 -4
  26. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layout.js +102 -1
  27. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutDidChange.js +4 -4
  28. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutStyle.js +103 -103
  29. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/replaceAllChildren_test.js +1 -1
  30. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js +77 -1
  31. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view_states_test.js +18 -17
  32. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +42 -49
  33. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/animation.js +5 -6
  34. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/enabled.js +16 -5
  35. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +241 -102
  36. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout_style.js +1 -4
  37. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/manipulation.js +0 -11
  38. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/statechart.js +993 -610
  39. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/theming.js +3 -2
  40. data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/data_source.js +6 -11
  41. data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +94 -27
  42. data/lib/frameworks/sproutcore/frameworks/datastore/system/query.js +133 -53
  43. data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +30 -35
  44. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/writeAttribute.js +3 -2
  45. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/writeDataHash.js +73 -29
  46. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/conflictedStoreKeys_test.js +156 -0
  47. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/dataSourceCallbacks.js +61 -37
  48. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/find.js +2 -2
  49. data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/core/system/datetime.js +68 -39
  50. data/lib/frameworks/sproutcore/frameworks/designer/tests/coders/page.js +1 -2
  51. data/lib/frameworks/sproutcore/frameworks/desktop/panes/panel.js +8 -6
  52. data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +80 -14
  53. data/lib/frameworks/sproutcore/frameworks/desktop/panes/sheet.js +2 -2
  54. data/lib/frameworks/sproutcore/frameworks/desktop/protocols/{drag_data_source.js → drag_data_source_protocol.js} +16 -10
  55. data/lib/frameworks/sproutcore/frameworks/desktop/protocols/{drag_source.js → drag_source_protocol.js} +28 -26
  56. data/lib/frameworks/sproutcore/frameworks/desktop/protocols/{drop_target.js → drop_target_protocol.js} +73 -75
  57. data/lib/frameworks/sproutcore/frameworks/desktop/system/drag.js +4 -4
  58. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/panel/ui.js +39 -23
  59. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/mouse.js +120 -97
  60. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/rowSizeForContentIndex.js +26 -25
  61. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/ui.js +3 -3
  62. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +5 -0
  63. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/split/{dividers.js → dividers_test.js} +38 -38
  64. data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +29 -14
  65. data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_scroll.js +2 -1
  66. data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll_view.js +13 -18
  67. data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +41 -35
  68. data/lib/frameworks/sproutcore/frameworks/desktop/views/slider.js +14 -14
  69. data/lib/frameworks/sproutcore/frameworks/desktop/views/split.js +41 -26
  70. data/lib/frameworks/sproutcore/frameworks/desktop/views/static_content.js +2 -12
  71. data/lib/frameworks/sproutcore/frameworks/foundation/gestures/tap.js +2 -2
  72. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +14 -10
  73. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/gesturable.js +104 -63
  74. data/lib/frameworks/sproutcore/frameworks/foundation/protocols/swap_transition_protocol.js +9 -4
  75. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/auto_mixin_tests.js +1 -2
  76. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/auto_resize_test.js +33 -33
  77. data/lib/frameworks/sproutcore/frameworks/foundation/tests/transitions/view_transitions_test.js +5 -5
  78. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/container/methods.js +0 -4
  79. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/container/transition_test.js +0 -4
  80. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/container/ui.js +0 -2
  81. data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +12 -8
  82. data/lib/frameworks/sproutcore/frameworks/media/resources/silence.mp3 +0 -0
  83. data/lib/frameworks/sproutcore/frameworks/media/tests/audio.js +69 -0
  84. data/lib/frameworks/sproutcore/frameworks/media/views/audio.js +1 -0
  85. data/lib/frameworks/sproutcore/frameworks/runtime/core.js +2 -2
  86. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +11 -4
  87. data/lib/frameworks/sproutcore/frameworks/runtime/protocols/mixin_protocol.js +150 -0
  88. data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +447 -137
  89. data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +9 -15
  90. data/lib/frameworks/sproutcore/frameworks/runtime/system/set.js +19 -17
  91. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/binding.js +188 -16
  92. data/lib/frameworks/sproutcore/frameworks/statechart/system/state.js +1 -1
  93. data/lib/frameworks/sproutcore/frameworks/template_view/panes/template.js +0 -3
  94. data/lib/frameworks/sproutcore/frameworks/template_view/tests/panes/template.js +0 -17
  95. data/lib/frameworks/sproutcore/frameworks/template_view/tests/views/template/collection.js +43 -26
  96. data/lib/frameworks/sproutcore/frameworks/template_view/views/bindable_span.js +9 -2
  97. data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list.css +0 -1
  98. data/lib/frameworks/sproutcore/themes/ace/resources/scroll/scroll.css +3 -0
  99. data/sproutcore.gemspec +3 -3
  100. metadata +19 -17
  101. data/lib/frameworks/sproutcore/frameworks/core_foundation/child_view_layouts/horizontal_stack_layout.js +0 -465
  102. data/lib/frameworks/sproutcore/frameworks/core_foundation/child_view_layouts/vertical_stack_layout.js +0 -472
  103. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/build.js +0 -87
  104. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/build_children.js +0 -89
@@ -124,13 +124,19 @@ SC.View.reopen(
124
124
  var handled = true,
125
125
  enabledState = this.get('enabledState');
126
126
 
127
+ // If the view itself is disabled, then we can enable it.
127
128
  if (enabledState === SC.CoreView.DISABLED) {
128
- // If the view itself is disabled, then we can enable it.
129
+ // Update the enabled state of all children. Top-down, because if a child is disabled on its own it
130
+ // won't affect its childrens' state and we can bail out early.
129
131
  this._callOnChildViews('_parentDidEnableInPane');
130
132
  this._gotoEnabledState();
133
+
134
+ // If the view is disabled and has a disabled parent, we can enable it, but it will be disabled by the parent.
131
135
  } else if (enabledState === SC.CoreView.DISABLED_AND_BY_PARENT) {
132
136
  // The view is no longer disabled itself, but still disabled by an ancestor.
133
137
  this._gotoDisabledByParentState();
138
+
139
+ // If the view is not disabled, we can't enable it.
134
140
  } else {
135
141
  handled = false;
136
142
  }
@@ -145,15 +151,22 @@ SC.View.reopen(
145
151
 
146
152
  // If the view is not itself disabled, then we can disable it.
147
153
  if (enabledState === SC.CoreView.ENABLED) {
154
+ // Update the disabled state of all children. Top-down, because if a child is disabled on its own it
155
+ // won't affect its childrens' state and we can bail out early.
156
+ this._callOnChildViews('_parentDidDisableInPane');
157
+ this._gotoDisabledState();
158
+
159
+ // Ensure that first responder status is given up.
148
160
  if (this.get('isFirstResponder')) {
149
161
  this.resignFirstResponder();
150
162
  }
151
163
 
152
- this._callOnChildViews('_parentDidDisableInPane');
153
- this._gotoDisabledState();
164
+ // If the view is disabled because of a disabled parent, we can disable the view itself too.
154
165
  } else if (enabledState === SC.CoreView.DISABLED_BY_PARENT) {
155
166
  // The view is now disabled itself and disabled by an ancestor.
156
167
  this._gotoDisabledAndByParentState();
168
+
169
+ // If the view is not enabled, we can't disable it.
157
170
  } else {
158
171
  handled = false;
159
172
  }
@@ -266,13 +279,11 @@ SC.View.reopen(
266
279
 
267
280
  /** @private */
268
281
  _gotoDisabledAndByParentState: function () {
269
- // Update the state.
270
282
  this.set('enabledState', SC.CoreView.DISABLED_AND_BY_PARENT);
271
283
  },
272
284
 
273
285
  /** @private */
274
286
  _gotoDisabledByParentState: function () {
275
- // Update the state.
276
287
  this.set('enabledState', SC.CoreView.DISABLED_BY_PARENT);
277
288
  }
278
289
 
@@ -286,6 +286,142 @@ SC.View.reopen(
286
286
  */
287
287
  layout: { top: 0, left: 0, bottom: 0, right: 0 },
288
288
 
289
+ /** @private The explicit layout of the view, computed from the layout using the explicit position. */
290
+ explicitLayout: function () {
291
+ var layout = this.get('layout'),
292
+ explicitPosition = this.get('explicitPosition'),
293
+ ret;
294
+
295
+ if (layout) {
296
+ ret = SC.clone(layout);
297
+
298
+ // Only use the explicit position values.
299
+ // delete ret.left;
300
+ delete ret.right;
301
+ // delete ret.top;
302
+ delete ret.bottom;
303
+
304
+ /*jshint eqnull:true */
305
+ if (explicitPosition.left != null) { ret.left = explicitPosition.left; }
306
+ if (explicitPosition.right != null) { ret.right = explicitPosition.right; }
307
+ if (explicitPosition.top != null) { ret.top = explicitPosition.top; }
308
+ if (explicitPosition.bottom != null) { ret.bottom = explicitPosition.bottom; }
309
+ if (explicitPosition.centerX != null) { ret.centerX = explicitPosition.centerX; }
310
+ if (explicitPosition.centerY != null) { ret.centerY = explicitPosition.centerY; }
311
+
312
+ // BORDERS
313
+ // Apply border first, so that the more specific borderX values will override it next.
314
+ var border = layout.border;
315
+ if (border != null) {
316
+ ret.borderTop = border;
317
+ ret.borderRight = border;
318
+ ret.borderBottom = border;
319
+ ret.borderLeft = border;
320
+ delete ret.border;
321
+ }
322
+
323
+ if (layout.borderTop != null) {
324
+ ret.borderTop = layout.borderTop;
325
+ }
326
+ if (layout.borderRight != null) {
327
+ ret.borderRight = layout.borderRight;
328
+ }
329
+ if (layout.borderBottom != null) {
330
+ ret.borderBottom = layout.borderBottom;
331
+ }
332
+ if (layout.borderLeft != null) {
333
+ ret.borderLeft = layout.borderLeft;
334
+ }
335
+ }
336
+
337
+ return ret;
338
+ }.property('explicitPosition').cacheable(),
339
+
340
+ /** @private The explicit position of the view, computed from the layout property, which may be written in shortform. */
341
+ explicitPosition: function () {
342
+ var layout = this.get('layout'),
343
+ ret;
344
+
345
+ if (layout) {
346
+ ret = {};
347
+
348
+ /* jshint eqnull:true */
349
+ var hasBottom = (layout.bottom != null);
350
+ var hasRight = (layout.right != null);
351
+ var hasLeft = (layout.left != null);
352
+ var hasTop = (layout.top != null);
353
+ var hasCenterX = (layout.centerX != null);
354
+ var hasCenterY = (layout.centerY != null);
355
+ var hasHeight = (layout.height != null); // || (layout.maxHeight != null)
356
+ var hasWidth = (layout.width != null); // || (layout.maxWidth != null)
357
+
358
+ if (hasLeft) {
359
+ ret.left = layout.left;
360
+ } else if (!hasCenterX && !(hasWidth && hasRight)) {
361
+ ret.left = 0;
362
+ }
363
+
364
+ if (hasRight && !(hasLeft && hasWidth)) {
365
+ ret.right = layout.right;
366
+ } else if (!hasCenterX && !hasWidth) {
367
+ ret.right = 0;
368
+ }
369
+
370
+ //@if(debug)
371
+ // Debug-only warning when layout isn't valid.
372
+ // UNUSED: This is too noisy for certain views that adjust their own layouts based on top of the default layout.
373
+ // if (hasRight && hasLeft && hasWidth) {
374
+ // SC.warn("Developer Warning: When setting `width` in the layout, you must only set `left` or `right`, but not both: %@".fmt(this));
375
+ // }
376
+ //@endif
377
+
378
+ if (hasTop) {
379
+ ret.top = layout.top;
380
+ } else if (!hasCenterY && !(hasHeight && hasBottom)) {
381
+ ret.top = 0;
382
+ }
383
+
384
+ if (hasBottom && !(hasTop && hasHeight)) {
385
+ ret.bottom = layout.bottom;
386
+ } else if (!hasCenterY && !hasHeight) {
387
+ ret.bottom = 0;
388
+ }
389
+
390
+ //@if(debug)
391
+ // Debug-only warning when layout isn't valid.
392
+ // UNUSED: This is too noisy for certain views that adjust their own layouts based on top of the default layout.
393
+ // if (hasBottom && hasTop && hasHeight) {
394
+ // SC.warn("Developer Warning: When setting `height` in the layout, you must only set `top` or `bottom`, but not both: %@".fmt(this));
395
+ // }
396
+ //@endif
397
+
398
+ // CENTERS
399
+ if (hasCenterX) {
400
+ ret.centerX = layout.centerX;
401
+
402
+ //@if(debug)
403
+ // Debug-only warning when layout isn't valid.
404
+ if (!hasWidth) {
405
+ SC.warn("Developer Warning: When setting `centerX` in the layout, you must also set `width`: %@".fmt(this));
406
+ }
407
+ //@endif
408
+ }
409
+
410
+ if (hasCenterY) {
411
+ ret.centerY = layout.centerY;
412
+
413
+ //@if(debug)
414
+ // Debug-only warning when layout isn't valid.
415
+ if (!hasHeight) {
416
+ SC.warn("Developer Warning: When setting `centerY` in the layout, you must also set `height`: %@".fmt(this));
417
+ }
418
+ //@endif
419
+ }
420
+ }
421
+
422
+ return ret;
423
+ }.property('layout').cacheable(),
424
+
289
425
  /**
290
426
  Returns whether the layout is 'fixed' or not. A fixed layout means a
291
427
  fixed left & top position and fixed width & height. Fixed layouts are
@@ -308,33 +444,18 @@ SC.View.reopen(
308
444
  @test in layoutStyle
309
445
  */
310
446
  isFixedPosition: function () {
311
- var layout = this.get('layout'),
312
- hasLeft,
313
- hasTop,
314
- ret;
315
-
316
- // Position is fixed if it has left + top !== SC.LAYOUT_AUTO
317
- hasLeft = layout.left !== undefined;
318
- if (!hasLeft) {
319
- // Check for implied left. If there is a width, then there can't be a right or centerX.
320
- hasLeft = layout.width === undefined || (layout.width !== undefined && layout.right === undefined && layout.centerX === undefined);
321
- }
322
-
323
- hasTop = layout.top !== undefined;
324
- if (!hasTop) {
325
- // Check for implied top. If there is a height, then there can't be a bottom or centerY.
326
- hasTop = layout.height === undefined || (layout.height !== undefined && layout.bottom === undefined && layout.centerY === undefined);
327
- }
447
+ var explicitPosition = this.get('explicitPosition'),
448
+ left = explicitPosition.left,
449
+ top = explicitPosition.top,
450
+ hasFixedLeft,
451
+ hasFixedTop;
328
452
 
329
- ret = (hasLeft && hasTop && layout.left !== SC.LAYOUT_AUTO && layout.top !== SC.LAYOUT_AUTO);
453
+ // Position is fixed if it has left + top, but not as percentages and not as SC.LAYOUT_AUTO.
454
+ hasFixedLeft = left !== undefined && !SC.isPercentage(left) && left !== SC.LAYOUT_AUTO;
455
+ hasFixedTop = top !== undefined && !SC.isPercentage(top) && top !== SC.LAYOUT_AUTO;
330
456
 
331
- // The position may appear fixed, but only if none of the values are percentages.
332
- if (ret) {
333
- ret = (!SC.isPercentage(layout.top) && !SC.isPercentage(layout.left));
334
- }
335
-
336
- return ret;
337
- }.property('layout').cacheable(),
457
+ return hasFixedLeft && hasFixedTop;
458
+ }.property('explicitPosition').cacheable(),
338
459
 
339
460
  /**
340
461
  Returns whether the size is 'fixed' or not. A fixed size means a fixed
@@ -361,10 +482,10 @@ SC.View.reopen(
361
482
  isFixedHeight: function() {
362
483
  var layout = this.get('layout');
363
484
 
364
- // Width is fixed if it has a height and it isn't SC.LAYOUT_AUTO or a percent.
485
+ // Height is fixed if it has a height and it isn't SC.LAYOUT_AUTO or a percent.
365
486
  return (layout.height !== undefined) &&
366
- (layout.height !== SC.LAYOUT_AUTO) &&
367
- !SC.isPercentage(layout.height);
487
+ !SC.isPercentage(layout.height) &&
488
+ (layout.height !== SC.LAYOUT_AUTO);
368
489
  }.property('layout').cacheable(),
369
490
 
370
491
  /**
@@ -381,8 +502,8 @@ SC.View.reopen(
381
502
 
382
503
  // Width is fixed if it has a width and it isn't SC.LAYOUT_AUTO or a percent.
383
504
  return (layout.width !== undefined) &&
384
- (layout.width !== SC.LAYOUT_AUTO) &&
385
- !SC.isPercentage(layout.width);
505
+ !SC.isPercentage(layout.width) &&
506
+ (layout.width !== SC.LAYOUT_AUTO);
386
507
  }.property('layout').cacheable(),
387
508
 
388
509
  /**
@@ -427,7 +548,7 @@ SC.View.reopen(
427
548
  },
428
549
 
429
550
  /** @private */
430
- _convertFrameFromViewHelper: function(frame, fromView, targetView) {
551
+ _convertFrameFromViewHelper: function (frame, fromView, targetView) {
431
552
  var myX = frame.x, myY = frame.y, myWidth = frame.width, myHeight = frame.height, view, f;
432
553
 
433
554
  // first, walk up from the view of the frame, up to the top level
@@ -507,16 +628,18 @@ SC.View.reopen(
507
628
  },
508
629
 
509
630
  /** @private */
510
- _effectiveBorderFor: function (layoutName, layout) {
511
- return ((layout[layoutName] !== undefined) ? layout[layoutName] : layout.border) || 0;
631
+ _sc_explicitValueFor: function (givenValue, impliedValue) {
632
+ return givenValue === undefined ? impliedValue : givenValue;
512
633
  },
513
634
 
514
635
  /** @private */
515
636
  _adjustForBorder: function (frame, layout) {
516
- var borderTop = this._effectiveBorderFor('borderTop', layout),
517
- borderLeft = this._effectiveBorderFor('borderLeft', layout),
518
- borderBottom = this._effectiveBorderFor('borderBottom', layout),
519
- borderRight = this._effectiveBorderFor('borderRight', layout);
637
+ /*jshint eqnull:true */
638
+ var defaultValue = layout.border == null ? 0 : layout.border,
639
+ borderTop = this._sc_explicitValueFor(layout.borderTop, defaultValue),
640
+ borderLeft = this._sc_explicitValueFor(layout.borderLeft, defaultValue),
641
+ borderBottom = this._sc_explicitValueFor(layout.borderBottom, defaultValue),
642
+ borderRight = this._sc_explicitValueFor(layout.borderRight, defaultValue);
520
643
 
521
644
  frame.x += borderLeft; // The border on the left pushes the frame to the right
522
645
  frame.y += borderTop; // The border on the top pushes the frame down
@@ -527,51 +650,41 @@ SC.View.reopen(
527
650
  },
528
651
 
529
652
  /** @private */
530
- _adjustForScale: function (frame, layout, scale, oX, oY) {
531
- // Add the original, unscaled height and width.
532
- var originalWidth = frame.width;
533
- var originalHeight = frame.height;
534
-
535
- // make sure width/height are never < 0
536
- if (originalHeight < 0) originalHeight = 0;
537
- if (originalWidth < 0) originalWidth = 0;
653
+ _adjustForScale: function (frame, layout) {
538
654
 
539
- // GATEKEEP: Scale not supported.
655
+ // Scale not supported on this platform, ignore the layout values.
540
656
  if (!SC.platform.supportsCSSTransforms) {
541
657
  frame.scale = 1;
542
658
  frame.transformOriginX = frame.transformOriginY = 0.5;
543
659
 
544
- // Add the original, unscaled height and width.
545
- frame.originalWidth = originalWidth;
546
- frame.originalHeight = originalHeight;
660
+ // Use scale.
661
+ } else {
547
662
 
548
- return frame;
549
- }
663
+ // Get the scale and transform origins, if not provided. (Note inlining of SC.none for performance)
664
+ /*jshint eqnull:true*/
665
+ var scale = layout.scale,
666
+ oX = layout.transformOriginX,
667
+ oY = layout.transformOriginY;
550
668
 
551
- // Get the scale and transform origins, if not provided. (Note inlining of SC.none for performance)
552
- /*jshint eqnull:true*/
553
- scale = scale == null ? layout.scale : scale;
554
- oX = oX == null ? layout.transformOriginX : oX;
555
- oY = oY == null ? layout.transformOriginY : oY;
556
-
557
- // Get defaults.
558
- if (scale == null) scale = 1;
559
- if (oX == null) oX = 0.5;
560
- if (oY == null) oY = 0.5;
561
-
562
- // If the scale isn't 1, do some calculations.
563
- if (scale !== 1) {
564
- frame = SC.scaleRect(frame, scale, oX, oY);
565
- }
669
+ // If the scale is set and isn't 1, do some calculations.
670
+ if (scale != null && scale !== 1) {
671
+ // Scale the rect.
672
+ frame = SC.scaleRect(frame, scale, oX, oY);
566
673
 
567
- // Regardless, attach the scale numbers for reference.
568
- frame.scale = scale;
569
- frame.transformOriginX = oX;
570
- frame.transformOriginY = oY;
674
+ // Add the scale and original unscaled height and width.
675
+ frame.scale = scale;
676
+ }
571
677
 
572
- // Add the original, unscaled height and width.
573
- frame.originalWidth = originalWidth;
574
- frame.originalHeight = originalHeight;
678
+ // If the origin is set and isn't 0.5, include it.
679
+ if (oX != null && oX !== 0.5) {
680
+ frame.transformOriginX = oX;
681
+ }
682
+
683
+ // If the origin is set and isn't 0.5, include it.
684
+ if (oY != null && oY !== 0.5) {
685
+ frame.transformOriginY = oY;
686
+ }
687
+ }
575
688
 
576
689
  // Make sure width/height are never < 0.
577
690
  if (frame.height < 0) frame.height = 0;
@@ -580,6 +693,7 @@ SC.View.reopen(
580
693
  return frame;
581
694
  },
582
695
 
696
+ /** */
583
697
  computeParentDimensions: function (frame) {
584
698
  var parentView = this.get('parentView'),
585
699
  parentFrame = (parentView) ? parentView.get('frame') : null,
@@ -609,29 +723,54 @@ SC.View.reopen(
609
723
  The frame of the view including the borders and scale
610
724
  */
611
725
  borderFrame: function () {
612
- var layout = this.get('layout'),
613
- frame = this.get('frame'),
614
- scale = (frame && !SC.none(frame.scale)) ? frame.scale : 1,
615
- borderTop = this._effectiveBorderFor('borderTop', layout),
616
- scaledBorderTop = borderTop * scale,
617
- borderRight = this._effectiveBorderFor('borderRight', layout),
618
- scaledBorderRight = borderRight * scale,
619
- borderBottom = this._effectiveBorderFor('borderBottom', layout),
620
- scaledBorderBottom = borderBottom * scale,
621
- borderLeft = this._effectiveBorderFor('borderLeft', layout),
622
- scaledBorderLeft = borderLeft * scale;
623
-
624
- return frame ? {
625
- x: frame.x - scaledBorderLeft,
626
- y: frame.y - scaledBorderTop,
627
- width: frame.width + scaledBorderLeft + scaledBorderRight,
628
- height: frame.height + scaledBorderTop + scaledBorderBottom,
629
- scale: scale,
630
- originalWidth: frame.originalWidth + borderLeft + borderRight,
631
- originalHeight: frame.originalHeight + borderTop + borderBottom,
632
- transformOriginX: frame.transformOriginX,
633
- transformOriginY: frame.transformOriginY
634
- } : null;
726
+ var frame = this.get('frame'),
727
+ ret = null;
728
+
729
+ if (frame) {
730
+ var layout = this.get('layout'),
731
+ defaultValue = layout.border == null ? 0 : layout.border,
732
+ borderTop = this._sc_explicitValueFor(layout.borderTop, defaultValue),
733
+ borderRight = this._sc_explicitValueFor(layout.borderRight, defaultValue),
734
+ borderBottom = this._sc_explicitValueFor(layout.borderBottom, defaultValue),
735
+ borderLeft = this._sc_explicitValueFor(layout.borderLeft, defaultValue);
736
+
737
+ ret = {
738
+ x: frame.x,
739
+ y: frame.y,
740
+ width: frame.width,
741
+ height: frame.height
742
+ };
743
+
744
+ var scale = frame.scale;
745
+ /*jshint eqnull:true*/
746
+ if (scale != null) {
747
+ var scaledBorderTop = borderTop * scale,
748
+ scaledBorderRight = borderRight * scale,
749
+ scaledBorderBottom = borderBottom * scale,
750
+ scaledBorderLeft = borderLeft * scale;
751
+
752
+ ret.scale = scale;
753
+ ret.x -= scaledBorderLeft;
754
+ ret.y -= scaledBorderTop;
755
+ ret.width += scaledBorderLeft + scaledBorderRight;
756
+ ret.height += scaledBorderTop + scaledBorderBottom;
757
+ } else {
758
+ ret.x -= borderLeft;
759
+ ret.y -= borderTop;
760
+ ret.width += borderLeft + borderRight;
761
+ ret.height += borderTop + borderBottom;
762
+ }
763
+
764
+ if (frame.transformOriginX != null) {
765
+ ret.transformOriginX = frame.transformOriginX;
766
+ }
767
+
768
+ if (frame.transformOriginY != null) {
769
+ ret.transformOriginY = frame.transformOriginY;
770
+ }
771
+ }
772
+
773
+ return ret;
635
774
  }.property('frame').cacheable(),
636
775
 
637
776
  /**
@@ -710,6 +849,9 @@ SC.View.reopen(
710
849
  */
711
850
  _viewFrameDidChange: function () {
712
851
  this.notifyPropertyChange('frame');
852
+
853
+ // Notify the children that their clipping frame may have changed. Top-down, because a child's
854
+ // clippingFrame is dependent on its parent's frame.
713
855
  this._callOnChildViews('_sc_view_clippingFrameDidChange');
714
856
  },
715
857
 
@@ -809,6 +951,7 @@ SC.View.reopen(
809
951
  // Optimize notifications depending on if we resized or just moved.
810
952
  this._checkForResize();
811
953
 
954
+
812
955
  // Notify layoutView/parentView, unless we are transitioning.
813
956
  var layoutView = this.get('layoutView');
814
957
  if (layoutView) {
@@ -1175,20 +1318,16 @@ SC.View.reopen(
1175
1318
  // Our frame may change once we've been adopted to a parent.
1176
1319
  this._checkForResize();
1177
1320
 
1178
- // Notify all of our descendents that our parent has changed. They will update their `pane` value for one.
1179
- this._callOnChildViews('_ancestorDidChangeParent');
1321
+ sc_super();
1180
1322
  },
1181
1323
 
1182
1324
  /** @private Extension: The 'orphaned' event. */
1183
- _orphaned: function (oldParentView) {
1325
+ _orphaned: function () {
1184
1326
  sc_super();
1185
1327
 
1186
1328
  if (!this.isDestroyed) {
1187
1329
  // Our frame may change once we've been removed from a parent.
1188
1330
  this._checkForResize();
1189
-
1190
- // Notify all of our descendents that our parent has changed. They will update their `pane` value for one.
1191
- this._callOnChildViews('_ancestorDidChangeParent');
1192
1331
  }
1193
1332
  },
1194
1333