sproutcore 1.10.3.1 → 1.11.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (380) hide show
  1. checksums.yaml +8 -8
  2. data/CHANGELOG +4 -8
  3. data/VERSION.yml +2 -2
  4. data/lib/frameworks/sproutcore/Buildfile +5 -4
  5. data/lib/frameworks/sproutcore/CHANGELOG.md +274 -40
  6. data/lib/frameworks/sproutcore/CONTRIBUTORS.md +133 -0
  7. data/lib/frameworks/sproutcore/README.md +31 -144
  8. data/lib/frameworks/sproutcore/apps/showcase/controllers/source_tree_controller.js +9 -4
  9. data/lib/frameworks/sproutcore/apps/showcase/resources/stylesheet.css +5 -0
  10. data/lib/frameworks/sproutcore/apps/showcase/system/views_item_content.js +1 -1
  11. data/lib/frameworks/sproutcore/apps/showcase/views/split_views.js +15 -2
  12. data/lib/frameworks/sproutcore/apps/showcase/views/stacked_views.js +1 -1
  13. data/lib/frameworks/sproutcore/apps/tests/english.lproj/main_page.js +11 -1
  14. data/lib/frameworks/sproutcore/frameworks/ajax/mixins/websocket_delegate.js +90 -0
  15. data/lib/frameworks/sproutcore/frameworks/ajax/system/request.js +81 -5
  16. data/lib/frameworks/sproutcore/frameworks/ajax/system/response.js +23 -4
  17. data/lib/frameworks/sproutcore/frameworks/ajax/system/websocket.js +475 -0
  18. data/lib/frameworks/sproutcore/frameworks/ajax/tests/system/request.js +149 -26
  19. data/lib/frameworks/sproutcore/frameworks/ajax/tests/system/websocket.js +197 -0
  20. data/lib/frameworks/sproutcore/frameworks/ajax/tests/system/xhr_response_test.js +65 -0
  21. data/lib/frameworks/sproutcore/frameworks/bootstrap/system/loader.js +4 -0
  22. data/lib/frameworks/sproutcore/frameworks/core_foundation/child_view_layouts/horizontal_stack_layout.js +232 -52
  23. data/lib/frameworks/sproutcore/frameworks/core_foundation/child_view_layouts/vertical_stack_layout.js +235 -49
  24. data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/array.js +23 -13
  25. data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/object.js +3 -1
  26. data/lib/frameworks/sproutcore/frameworks/core_foundation/core.js +81 -1
  27. data/lib/frameworks/sproutcore/frameworks/core_foundation/english.lproj/ordinal.js +17 -0
  28. data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/string.js +7 -0
  29. data/lib/frameworks/sproutcore/frameworks/{desktop/tests/views/disclosure/methods.js → core_foundation/french.lproj/ordinal.js} +7 -4
  30. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/layout.js +2 -6
  31. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/main.js +1 -1
  32. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +104 -69
  33. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane_statechart.js +6 -1
  34. data/lib/frameworks/sproutcore/frameworks/core_foundation/protocols/child_view_layout_protocol.js +59 -0
  35. data/lib/frameworks/sproutcore/frameworks/core_foundation/protocols/view_transition_protocol.js +18 -1
  36. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/application.js +192 -0
  37. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/bezier_curves.js +52 -0
  38. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/color.js +384 -64
  39. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/core_query.js +6 -14
  40. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/device.js +21 -35
  41. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +72 -36
  42. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/locale.js +90 -34
  43. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/platform.js +55 -7
  44. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/render_context.js +20 -15
  45. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/req_anim_frame.js +9 -10
  46. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +763 -542
  47. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/selection_set.js +4 -3
  48. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/sparse_array.js +1 -7
  49. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/string.js +14 -0
  50. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/touch.js +538 -0
  51. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/utils/rect.js +56 -1
  52. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/array/array_case.js +99 -4
  53. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/object/single_case.js +25 -19
  54. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/core_tests.js +75 -0
  55. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/ext/number_test.js +81 -0
  56. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/action_support.js +4 -4
  57. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/responder_context.js +4 -4
  58. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/string.js +19 -1
  59. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/color.js +36 -20
  60. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/root_responder/design_modes_test.js +83 -0
  61. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/root_responder/makeMainPane.js +7 -3
  62. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/root_responder/mouse_events.js +338 -0
  63. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/root_responder/root_responder.js +14 -89
  64. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/root_responder/touch.js +106 -0
  65. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/sparse_array.js +2 -2
  66. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/touch.js +136 -0
  67. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/utils/rect.js +42 -1
  68. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/append_remove.js +11 -0
  69. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/child_view.js +5 -5
  70. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/design_mode_test.js +457 -0
  71. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/sendEvent.js +36 -10
  72. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/background_color.js +44 -0
  73. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/border_frame_test.js +51 -24
  74. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/childViewLayout_test.js +176 -1
  75. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/clippingFrame.js +46 -16
  76. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/convertFrames.js +69 -15
  77. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/didAppendToDocument.js +2 -2
  78. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layout.js +7 -1
  79. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutDidChange.js +30 -10
  80. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutStyle.js +376 -71
  81. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/static_layout.js +0 -10
  82. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/viewDidResize.js +117 -34
  83. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view_states_test.js +52 -2
  84. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +656 -42
  85. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/animation.js +159 -38
  86. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/cursor.js +0 -7
  87. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/design_mode.js +206 -0
  88. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/enabled.js +0 -28
  89. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/keyboard.js +21 -6
  90. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +372 -450
  91. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout_style.js +28 -13
  92. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/manipulation.js +22 -51
  93. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/statechart.js +59 -30
  94. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/theming.js +0 -29
  95. data/lib/frameworks/sproutcore/frameworks/datastore/mixins/relationship_support.js +22 -10
  96. data/lib/frameworks/sproutcore/frameworks/datastore/models/children_attribute.js +42 -36
  97. data/lib/frameworks/sproutcore/frameworks/datastore/models/many_attribute.js +54 -3
  98. data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +178 -59
  99. data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +2 -2
  100. data/lib/frameworks/sproutcore/frameworks/datastore/system/child_array.js +206 -132
  101. data/lib/frameworks/sproutcore/frameworks/datastore/system/many_array.js +214 -118
  102. data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +96 -13
  103. data/lib/frameworks/sproutcore/frameworks/datastore/system/query.js +14 -4
  104. data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +82 -42
  105. data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +272 -177
  106. data/lib/frameworks/sproutcore/frameworks/datastore/tests/integration/store_interaction_test.js +54 -0
  107. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/datetime_recordattribute.js +24 -16
  108. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/many_attribute.js +6 -3
  109. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/data_store.js +267 -35
  110. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record.js +57 -46
  111. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array.js +150 -53
  112. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array_complex.js +57 -17
  113. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_complex.js +13 -9
  114. data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/polymorphism → datastore}/tests/models/polymorphism/many.js +2 -2
  115. data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/polymorphism → datastore}/tests/models/polymorphism/simple.js +0 -0
  116. data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/polymorphism → datastore}/tests/models/polymorphism/single.js +12 -2
  117. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/writeAttribute.js +20 -15
  118. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record_attribute.js +9 -2
  119. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/many_array/core_methods.js +80 -14
  120. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/autonomous_dataSourceCallbacks.js +280 -0
  121. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/autonomous_pushChanges.js +232 -0
  122. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/chain.js +31 -5
  123. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/parse.js +16 -2
  124. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/core_methods.js +60 -40
  125. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/materializeRecord.js +78 -0
  126. data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/core/system/datetime.js +13 -1
  127. data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/core/tests/system/datetime.js +20 -0
  128. data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/localized/{resources → english.lproj}/strings.js +0 -0
  129. data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/localized/french.lproj/strings.js +45 -0
  130. data/lib/frameworks/sproutcore/frameworks/designer/designers/object_designer.js +7 -3
  131. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_row_delegate.js +125 -44
  132. data/lib/frameworks/sproutcore/frameworks/desktop/panes/alert.js +139 -48
  133. data/lib/frameworks/sproutcore/frameworks/desktop/panes/draggable.js +202 -0
  134. data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +59 -56
  135. data/lib/frameworks/sproutcore/frameworks/desktop/panes/palette.js +13 -49
  136. data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +466 -305
  137. data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drag_source.js +49 -12
  138. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/slider.js +79 -21
  139. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/split.js +12 -2
  140. data/lib/frameworks/sproutcore/frameworks/desktop/resources/menu_item_view.css +8 -0
  141. data/lib/frameworks/sproutcore/frameworks/desktop/resources/overlay-scroller.css +187 -0
  142. data/lib/frameworks/sproutcore/frameworks/desktop/system/drag.js +94 -30
  143. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/alert/ui.js +163 -3
  144. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/menu/methods.js +97 -78
  145. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/menu/ui.js +61 -1
  146. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/panel/methods.js +7 -3
  147. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/panel/ui.js +47 -22
  148. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/picker/methods.js +66 -9
  149. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/picker/ui.js +21 -11
  150. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/sheet/ui.js +12 -18
  151. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/button/methods.js +17 -14
  152. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/button/ui.js +2 -1
  153. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/methods.js +9 -6
  154. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/collection_fast_path.js +54 -21
  155. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/content.js +52 -20
  156. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/itemViewForContentIndex.js +94 -4
  157. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/keyboard.js +177 -0
  158. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/layerIdFor.js +13 -1
  159. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/length.js +9 -9
  160. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/mouse.js +18 -0
  161. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/date_field/methods.js +104 -0
  162. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/disclosure/ui.js +48 -49
  163. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/grid/drag_and_drop.js +22 -18
  164. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/grid/methods.js +17 -5
  165. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/link_view_test.js +136 -0
  166. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/contentIndexesInRect.js +77 -0
  167. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/drag_and_drop.js +53 -16
  168. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/layoutForContentIndex.js +41 -0
  169. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/rowDelegate.js +25 -25
  170. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/rowOffsetForContentIndex.js +102 -27
  171. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/{rowHeightForContentIndex.js → rowSizeForContentIndex.js} +7 -6
  172. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/ui_outline.js +2 -0
  173. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/ui_row_heights.js +70 -75
  174. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/ui_simple.js +29 -30
  175. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list_item.js +57 -0
  176. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/menu_scroll_view/menu_scroll_view_test.js +206 -0
  177. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/progress/ui.js +15 -0
  178. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/radio/methods.js +15 -7
  179. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/integration.js +16 -11
  180. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/methods.js +164 -12
  181. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/scale.js +387 -0
  182. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/touch.js +549 -0
  183. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/ui.js +214 -45
  184. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroller.js +5 -5
  185. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/methods.js +73 -22
  186. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +88 -3
  187. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/select/methods.js +8 -0
  188. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/slider/methods.js +16 -1
  189. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/slider/ui.js +54 -0
  190. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/split/dividers.js +21 -2
  191. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/static_content.js +31 -25
  192. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/tab/methods.js +109 -29
  193. data/lib/frameworks/sproutcore/frameworks/desktop/views/button.js +10 -1
  194. data/lib/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +3 -0
  195. data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +779 -603
  196. data/lib/frameworks/sproutcore/frameworks/desktop/views/date_field.js +106 -7
  197. data/lib/frameworks/sproutcore/frameworks/desktop/views/link_view.js +406 -0
  198. data/lib/frameworks/sproutcore/frameworks/desktop/views/list.js +437 -245
  199. data/lib/frameworks/sproutcore/frameworks/desktop/views/list_item.js +13 -0
  200. data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +124 -62
  201. data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_scroll.js +176 -597
  202. data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_scroller_view.js +206 -0
  203. data/lib/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +3 -0
  204. data/lib/frameworks/sproutcore/frameworks/desktop/views/progress.js +5 -4
  205. data/lib/frameworks/sproutcore/frameworks/desktop/views/radio.js +3 -0
  206. data/lib/frameworks/sproutcore/frameworks/desktop/views/scene.js +56 -158
  207. data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll_view.js +2560 -0
  208. data/lib/frameworks/sproutcore/frameworks/desktop/views/scroller.js +458 -242
  209. data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +117 -54
  210. data/lib/frameworks/sproutcore/frameworks/desktop/views/select.js +18 -12
  211. data/lib/frameworks/sproutcore/frameworks/desktop/views/slider.js +162 -34
  212. data/lib/frameworks/sproutcore/frameworks/desktop/views/split.js +30 -15
  213. data/lib/frameworks/sproutcore/frameworks/desktop/views/split_divider.js +33 -7
  214. data/lib/frameworks/sproutcore/frameworks/desktop/views/static_content.js +22 -2
  215. data/lib/frameworks/sproutcore/frameworks/desktop/views/tab.js +47 -22
  216. data/lib/frameworks/sproutcore/frameworks/experimental/Buildfile +0 -6
  217. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/views/form.js +2 -1
  218. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/views/form_row.js +21 -21
  219. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/ext/menu.js +14 -3
  220. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/mixins/select_view_menu.js +24 -10
  221. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/ext/menu_resizing.js +1 -1
  222. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/mixins/select_view_menu/bindings.js +7 -4
  223. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/mixins/select_view_menu/check_selected.js +7 -9
  224. data/lib/frameworks/sproutcore/frameworks/{desktop/tests/panes/select_button/methods.js → experimental/frameworks/select_view/tests/views/select/method.js} +54 -76
  225. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/views/select/selected_item.js +35 -0
  226. data/lib/frameworks/sproutcore/frameworks/{desktop/tests/panes/select_button → experimental/frameworks/select_view/tests/views/select}/ui.js +107 -36
  227. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/views/select.js +225 -66
  228. data/lib/frameworks/sproutcore/frameworks/foundation/controllers/tree.js +39 -38
  229. data/lib/frameworks/sproutcore/frameworks/foundation/core.js +5 -18
  230. data/lib/frameworks/sproutcore/frameworks/foundation/debug/control_test_pane.js +12 -0
  231. data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/inflections.js +84 -0
  232. data/lib/frameworks/sproutcore/frameworks/foundation/french.lproj/inflections.js +41 -0
  233. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_mixin.js +1 -0
  234. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +7 -0
  235. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_display.js +3 -4
  236. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/flowed_layout.js +6 -2
  237. data/lib/frameworks/sproutcore/frameworks/foundation/private/tree_item_observer.js +408 -239
  238. data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/canvas_image.js +1 -1
  239. data/lib/frameworks/sproutcore/frameworks/foundation/resources/text_field.css +2 -1
  240. data/lib/frameworks/sproutcore/frameworks/foundation/spanish.lproj/inflections.js +38 -0
  241. data/lib/frameworks/sproutcore/frameworks/foundation/system/benchmark.js +104 -76
  242. data/lib/frameworks/sproutcore/frameworks/foundation/system/string.js +20 -94
  243. data/lib/frameworks/sproutcore/frameworks/foundation/system/text_selection.js +33 -22
  244. data/lib/frameworks/sproutcore/frameworks/foundation/system/undo_manager.js +475 -0
  245. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/auto_resize_test.js +163 -1
  246. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/flowed_layout/tests.js +41 -0
  247. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/staticLayout.js +2 -5
  248. data/lib/frameworks/sproutcore/frameworks/foundation/tests/private/tree_item_observer/methods.js +268 -0
  249. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/undo_manager.js +231 -0
  250. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/container/ui.js +16 -0
  251. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/image/ui.js +27 -0
  252. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/methods.js +24 -0
  253. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +135 -6
  254. data/lib/frameworks/sproutcore/frameworks/foundation/transitions/fade_transition.js +6 -0
  255. data/lib/frameworks/sproutcore/frameworks/foundation/transitions/pop_transition.js +7 -0
  256. data/lib/frameworks/sproutcore/frameworks/foundation/transitions/scale_transition.js +6 -0
  257. data/lib/frameworks/sproutcore/frameworks/foundation/transitions/slide_transition.js +4 -0
  258. data/lib/frameworks/sproutcore/frameworks/foundation/transitions/swap_dissolve_transition.js +3 -1
  259. data/lib/frameworks/sproutcore/frameworks/foundation/validators/credit_card.js +21 -21
  260. data/lib/frameworks/sproutcore/frameworks/foundation/views/container.js +65 -15
  261. data/lib/frameworks/sproutcore/frameworks/foundation/views/image.js +4 -1
  262. data/lib/frameworks/sproutcore/frameworks/foundation/views/label.js +1 -1
  263. data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +193 -213
  264. data/lib/frameworks/sproutcore/frameworks/jquery/{jquery-1.8.3-patched.js → jquery-1.11.1.js} +7507 -6684
  265. data/lib/frameworks/sproutcore/frameworks/routing/system/routes.js +28 -11
  266. data/lib/frameworks/sproutcore/frameworks/routing/tests/system/routes.js +26 -0
  267. data/lib/frameworks/sproutcore/frameworks/runtime/core.js +54 -25
  268. data/lib/frameworks/sproutcore/frameworks/runtime/ext/array.js +0 -6
  269. data/lib/frameworks/sproutcore/frameworks/runtime/ext/number.js +36 -0
  270. data/lib/frameworks/sproutcore/frameworks/runtime/ext/window.js +25 -0
  271. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +3 -3
  272. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/enumerable.js +1 -1
  273. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +156 -66
  274. data/lib/frameworks/sproutcore/frameworks/runtime/private/observer_set.js +2 -2
  275. data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +150 -65
  276. data/lib/frameworks/sproutcore/frameworks/runtime/system/index_set.js +57 -11
  277. data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +68 -49
  278. data/lib/frameworks/sproutcore/frameworks/runtime/system/run_loop.js +14 -6
  279. data/lib/frameworks/sproutcore/frameworks/runtime/system/string.js +23 -23
  280. data/lib/frameworks/sproutcore/frameworks/runtime/tests/ext/number_test.js +44 -0
  281. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/array.js +0 -10
  282. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/enumerable/enumerable.js +340 -285
  283. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/binding.js +104 -3
  284. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/observer_set.js +14 -1
  285. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/string.js +15 -2
  286. data/lib/frameworks/sproutcore/frameworks/statechart/system/state.js +21 -18
  287. data/lib/frameworks/sproutcore/frameworks/statechart/system/statechart.js +52 -19
  288. data/lib/frameworks/sproutcore/frameworks/statechart/tests/event_handling/responder/pane.js +27 -24
  289. data/lib/frameworks/sproutcore/frameworks/template_view/controls/button.js +30 -0
  290. data/lib/frameworks/sproutcore/frameworks/template_view/ext/handlebars/bind.js +1 -1
  291. data/lib/frameworks/sproutcore/frameworks/template_view/ext/handlebars/collection.js +2 -0
  292. data/lib/frameworks/sproutcore/frameworks/template_view/ext/handlebars/view.js +1 -0
  293. data/lib/frameworks/sproutcore/frameworks/template_view/tests/mixins/template_helpers/checkbox_support.js +2 -2
  294. data/lib/frameworks/sproutcore/frameworks/template_view/tests/views/template/handlebars.js +4 -2
  295. data/lib/frameworks/sproutcore/frameworks/template_view/views/bindable_span.js +1 -1
  296. data/lib/frameworks/sproutcore/frameworks/template_view/views/template_collection.js +16 -14
  297. data/lib/frameworks/sproutcore/frameworks/testing/core.js +5 -3
  298. data/lib/frameworks/sproutcore/frameworks/testing/system/plan.js +13 -0
  299. data/lib/frameworks/sproutcore/lib/index.rhtml +2 -2
  300. data/lib/frameworks/sproutcore/phantomjs/test_runner.js +28 -7
  301. data/lib/frameworks/sproutcore/scripts/run_sc_server_master.sh +1 -1
  302. data/lib/frameworks/sproutcore/themes/ace/resources/_variables.css +2 -0
  303. data/lib/frameworks/sproutcore/themes/ace/resources/disclosure/ace/disclosure.css +1 -0
  304. data/lib/frameworks/sproutcore/themes/ace/resources/picker/popover/popover.css +3 -4
  305. data/lib/frameworks/sproutcore/themes/ace/resources/scroller/horizontal/horizontal.css +15 -15
  306. data/lib/frameworks/sproutcore/themes/ace/resources/scroller/horizontal/horizontal_overlay.css +74 -0
  307. data/lib/frameworks/sproutcore/themes/ace/resources/scroller/vertical/vertical.css +11 -13
  308. data/lib/frameworks/sproutcore/themes/ace/resources/scroller/vertical/vertical_overlay.css +74 -0
  309. data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/jumbo/knob-active.png +0 -0
  310. data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/jumbo/knob-active@2x.png +0 -0
  311. data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/jumbo/knob.png +0 -0
  312. data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/jumbo/knob@2x.png +0 -0
  313. data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/{22px → jumbo}/slider.css +9 -4
  314. data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/jumbo/track.png +0 -0
  315. data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/jumbo/track@2x.png +0 -0
  316. data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/regular/knob-active.png +0 -0
  317. data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/regular/knob-active@2x.png +0 -0
  318. data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/regular/knob.png +0 -0
  319. data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/regular/knob@2x.png +0 -0
  320. data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/regular/slider.css +32 -0
  321. data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/regular/track.png +0 -0
  322. data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/regular/track@2x.png +0 -0
  323. data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/slider.css +13 -0
  324. data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/small/knob-active.png +0 -0
  325. data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/small/knob-active@2x.png +0 -0
  326. data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/small/knob.png +0 -0
  327. data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/small/knob@2x.png +0 -0
  328. data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/small/slider.css +32 -0
  329. data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/small/track.png +0 -0
  330. data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/small/track@2x.png +0 -0
  331. data/lib/frameworks/sproutcore/themes/ace/resources/split/split.css +2 -3
  332. data/lib/sproutcore/builders/chance_file.rb +3 -3
  333. data/lib/sproutcore/helpers/minifier.rb +1 -0
  334. data/vendor/chance/lib/chance/instance.rb +34 -34
  335. data/vendor/chance/lib/chance/instance/spriting.rb +21 -16
  336. metadata +81 -58
  337. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/visibility.js +0 -17
  338. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_fast_path.js +0 -710
  339. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/scrollable.js +0 -267
  340. data/lib/frameworks/sproutcore/frameworks/desktop/resources/touch-scroller.css +0 -196
  341. data/lib/frameworks/sproutcore/frameworks/desktop/system/undo_manager.js +0 -224
  342. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/select_field/methods.js +0 -163
  343. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/select_field/ui.js +0 -177
  344. data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll.js +0 -2053
  345. data/lib/frameworks/sproutcore/frameworks/desktop/views/select_button.js +0 -1024
  346. data/lib/frameworks/sproutcore/frameworks/desktop/views/select_field.js +0 -404
  347. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/menu/render_delegates/menu_scroller.js +0 -28
  348. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/menu/tests/menu/scroll.js +0 -235
  349. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/menu/views/menu/scroll.js +0 -363
  350. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/menu/views/menu/scroller.js +0 -250
  351. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/README.md +0 -47
  352. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/models/record.js +0 -134
  353. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/render_delegates/desktop_scroller.js +0 -92
  354. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/render_delegates/native_scroll.js +0 -25
  355. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/render_delegates/scroll.js +0 -33
  356. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/render_delegates/touch_scroller.js +0 -76
  357. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/tests/scroll/integration.js +0 -25
  358. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/tests/scroll/methods.js +0 -143
  359. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/tests/scroll/ui.js +0 -256
  360. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/core_scroll.js +0 -1164
  361. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/core_scroller.js +0 -332
  362. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/desktop/scroll.js +0 -236
  363. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/desktop/scroller.js +0 -347
  364. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/scroll.js +0 -15
  365. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/scroller.js +0 -10
  366. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/touch/scroll.js +0 -804
  367. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/touch/scroller.js +0 -133
  368. data/lib/frameworks/sproutcore/frameworks/foundation/tasks/preload_bundle.js +0 -41
  369. data/lib/frameworks/sproutcore/themes/ace/resources/scroller/horizontal/horizontal_touch.css +0 -91
  370. data/lib/frameworks/sproutcore/themes/ace/resources/scroller/vertical/vertical_touch.css +0 -92
  371. data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/14px/knob.png +0 -0
  372. data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/14px/knob_active.png +0 -0
  373. data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/14px/slider.css +0 -27
  374. data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/16px/knob.png +0 -0
  375. data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/16px/knob_active.png +0 -0
  376. data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/16px/slider.css +0 -27
  377. data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/22px/knob.png +0 -0
  378. data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/22px/knob_active.png +0 -0
  379. data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/22px/track.png +0 -0
  380. data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/track.png +0 -0
@@ -165,14 +165,6 @@ SC.View.reopen(
165
165
  // Methods
166
166
  //
167
167
 
168
- /** @private */
169
- init: function (original) {
170
- original();
171
-
172
- // If the view is pre-configured as disabled, then go to the proper initial state.
173
- if (!this.get('isEnabled')) { this._doDisable(); }
174
- }.enhance(),
175
-
176
168
  /** @private
177
169
  Observes the isEnabled property and resigns first responder if set to NO.
178
170
  This will avoid cases where, for example, a disabled text field retains
@@ -210,16 +202,6 @@ SC.View.reopen(
210
202
  }
211
203
  },
212
204
 
213
- /** @private Enhance. */
214
- _executeQueuedUpdates: function (original) {
215
- original();
216
-
217
- // Update the layout style of the layer if necessary.
218
- if (this._enabledStyleNeedsUpdate) {
219
- this._doUpdateEnabledStyle();
220
- }
221
- }.enhance(),
222
-
223
205
  /** @private */
224
206
  _doUpdateEnabledStyle: function () {
225
207
  var isEnabled = this.get('isEnabled');
@@ -272,16 +254,6 @@ SC.View.reopen(
272
254
  }
273
255
  },
274
256
 
275
- applyAttributesToContext: function (original, context) {
276
- original(context);
277
-
278
- if (!this.get('isEnabled')) {
279
- context.addClass('disabled');
280
- context.setAttr('aria-disabled', 'true');
281
- }
282
-
283
- }.enhance(),
284
-
285
257
  /** @private */
286
258
  _gotoEnabledState: function () {
287
259
  this.set('enabledState', SC.CoreView.ENABLED);
@@ -55,23 +55,38 @@ SC.View.reopen(
55
55
  /**
56
56
  This method will process a key input event, attempting to convert it to
57
57
  an appropriate action method and sending it up the responder chain. The
58
- event is converted using the SC.KEY_BINDINGS hash, which maps key events
59
- into method names. If no key binding is found, then the key event will
60
- be passed along using an insertText() method.
58
+ event is converted using the key bindings hashes, (SC.BASE_KEY_BINDINGS
59
+ and SC.MODIFIED_KEY_BINDINGS) which map key events to method names. If
60
+ no key binding method is found, then the key event will be passed along
61
+ to any insertText() method found.
61
62
 
62
63
  @param {SC.Event} event
63
64
  @returns {Object} object that handled event, if any
64
65
  */
65
66
  interpretKeyEvents: function(event) {
66
- var codes = event.commandCodes(), cmd = codes[0], chr = codes[1], ret;
67
+ var codes = event.commandCodes(),
68
+ cmd = codes[0],
69
+ chr = codes[1],
70
+ ret,
71
+ match,
72
+ methodName,
73
+ target,
74
+ pane,
75
+ handler;
67
76
 
68
77
  if (!cmd && !chr) { return null ; } //nothing to do.
69
78
 
70
79
  // if this is a command key, try to do something about it.
71
80
  if (cmd) {
72
- var methodName = SC.MODIFIED_KEY_BINDINGS[cmd] || SC.BASE_KEY_BINDINGS[cmd.match(/[^_]+$/)[0]];
81
+ match = cmd.match(/[^_]+$/);
82
+ methodName = SC.MODIFIED_KEY_BINDINGS[cmd];
83
+ if (!methodName && match && match.length > 0) {
84
+ methodName = SC.BASE_KEY_BINDINGS[match[0]];
85
+ }
73
86
  if (methodName) {
74
- var target = this, pane = this.get('pane'), handler = null;
87
+ target = this;
88
+ pane = this.get('pane');
89
+ handler = null;
75
90
  while(target && !(handler = target.tryToPerform(methodName, event))){
76
91
  target = (target===pane)? null: target.get('nextResponder') ;
77
92
  }
@@ -7,9 +7,6 @@ SC.LAYOUT_HORIZONTAL = 'sc-layout-horizontal';
7
7
  /** Select a vertical layout for various views.*/
8
8
  SC.LAYOUT_VERTICAL = 'sc-layout-vertical';
9
9
 
10
- /** @private */
11
- SC._VIEW_DEFAULT_DIMS = ['marginTop', 'marginLeft'];
12
-
13
10
  /**
14
11
  Layout properties to take up the full width of a parent view.
15
12
  */
@@ -32,22 +29,29 @@ SC.ANCHOR_CENTER = { centerX: 0, centerY: 0 };
32
29
 
33
30
  SC.LAYOUT_AUTO = 'auto';
34
31
 
32
+ // Regexes representating valid values for rotation and scale layout properties
33
+ SC._ROTATION_VALUE_REGEX = /^\-?\d+(\.\d*)?(rad|deg)$/;
34
+ SC._SCALE_VALUE_REGEX = /^\d+(,\d+){0,2}$/;
35
35
 
36
36
  SC.View.reopen(
37
37
  /** @scope SC.View.prototype */ {
38
38
 
39
39
  /**
40
- Set to YES to indicate the view has layout support added.
40
+ Walks like a duck. Is YES to indicate that a view has layout support.
41
41
  */
42
42
  hasLayout: YES,
43
43
 
44
44
  /**
45
- Optional background color. Will be applied to the view's element if
46
- set. This property is intended for one-off views that need a background
47
- element. If you plan to create many view instances it is probably better
48
- to use CSS.
45
+ The view's background color. Only recommended for use during prototyping and in views
46
+ where the background color may change arbitrarily, for example in connection with an
47
+ instance of `SC.Color`. Otherwise you should use CSS and `classNames` or
48
+ `classNameBindings`.
49
+
50
+ If set at create time, will be added to the view's layer. For dynamic background colors,
51
+ you must add `backgroundColor` to the view's `displayProperties`.
49
52
 
50
53
  @type String
54
+ @default null
51
55
  */
52
56
  backgroundColor: null,
53
57
 
@@ -55,10 +59,10 @@ SC.View.reopen(
55
59
  _previousLayout: null,
56
60
 
57
61
  /**
58
- Activates use of brower's static layout. To activate, set this
59
- property to YES.
62
+ Activates use of brower's static layout. To activate, set this property to YES.
60
63
 
61
64
  @type Boolean
65
+ @default NO
62
66
  */
63
67
  useStaticLayout: NO,
64
68
 
@@ -66,40 +70,6 @@ SC.View.reopen(
66
70
  // LAYOUT
67
71
  //
68
72
 
69
- /** @private */
70
- init: function (original) {
71
- original();
72
-
73
- this._previousLayout = this.get('layout');
74
-
75
- // Apply the automatic child view layout if it is defined.
76
- var childViewLayout = this.childViewLayout;
77
- if (childViewLayout) {
78
- // Layout the child views once.
79
- this.set('childViewsNeedLayout', true);
80
- this.layoutChildViewsIfNeeded();
81
-
82
- // If the child view layout is live, start observing affecting properties.
83
- if (this.get('isChildViewLayoutLive')) {
84
- this.addObserver('childViews.[]', this, this._cvl_childViewsDidChange);
85
- // DISABLED. this.addObserver('childViewLayout', this, this._cvl_childViewLayoutDidChange);
86
- this.addObserver('childViewLayoutOptions', this, this._cvl_childViewLayoutDidChange);
87
-
88
- // Initialize the child views.
89
- this._cvl_setupChildViewsLiveLayout();
90
- }
91
- }
92
-
93
- }.enhance(),
94
-
95
- /** @private */
96
- destroy: function (original) {
97
- // Clean up.
98
- this._previousLayout = null;
99
-
100
- return original();
101
- }.enhance(),
102
-
103
73
  /**
104
74
  The 'frame' property depends on the 'layout' property as well as the
105
75
  parent view's frame. In order to properly invalidate any cached values,
@@ -112,6 +82,26 @@ SC.View.reopen(
112
82
  whenever 'layout' is set.
113
83
  */
114
84
  propertyDidChange: function (key, value, _keepCache) {
85
+ //@if(debug)
86
+ // Debug mode only property validation.
87
+ switch (key) {
88
+ case 'layout':
89
+ // If a layout value is accidentally set to NaN, this can result in infinite loops. Help the developer out by failing
90
+ // early so that they can follow the stack trace to the problem.
91
+ var layout = this.get('layout');
92
+ for (var property in layout) {
93
+ if (!layout.hasOwnProperty(property)) { continue; }
94
+
95
+ var layoutValue = layout[property];
96
+ if (isNaN(layoutValue) && (layoutValue !== SC.LAYOUT_AUTO) &&
97
+ !SC._ROTATION_VALUE_REGEX.exec(layoutValue) && !SC._SCALE_VALUE_REGEX.exec(layoutValue)) {
98
+ throw new Error("SC.View layout property set to invalid value, %@: %@.".fmt(property, layoutValue));
99
+ }
100
+ }
101
+ break;
102
+ }
103
+ //@endif
104
+
115
105
  // If the key is 'layout', we need to call layoutDidChange() immediately
116
106
  // so that if the frame has changed any cached values (for both this view
117
107
  // and any child views) can be appropriately invalidated.
@@ -122,13 +112,52 @@ SC.View.reopen(
122
112
  var layoutChange = false;
123
113
  if (typeof this.layout === "function" && this._kvo_dependents) {
124
114
  var dependents = this._kvo_dependents[key];
125
- if (dependents && dependents.indexOf('layout') != -1) { layoutChange = true; }
115
+ if (dependents && dependents.indexOf('layout') !== -1) { layoutChange = true; }
116
+ }
117
+
118
+ if (key === 'layout' || layoutChange) {
119
+ this.layoutDidChange();
126
120
  }
127
- if (key === 'layout' || layoutChange) { this.layoutDidChange(); }
121
+
128
122
  // Resume notification as usual.
129
123
  sc_super();
130
124
  },
131
125
 
126
+ /** @private Apply the adjustment to a clone of the layout (cloned unless newLayout is passed in) */
127
+ _sc_applyAdjustment: function (key, newValue, layout, newLayout) {
128
+ var animateLayout = this._animateLayout;
129
+
130
+ // If a call to animate occurs in the same run loop, the animation layout
131
+ // would still be applied in the next run loop, potentially overriding this
132
+ // adjustment. So we need to cancel the animation layout.
133
+ if (animateLayout) {
134
+ if (newValue === null) {
135
+ delete animateLayout[key];
136
+ } else {
137
+ animateLayout[key] = newValue;
138
+ }
139
+
140
+ if (this._pendingAnimations && this._pendingAnimations[key]) {
141
+ // Adjusting a value that was about to be animated cancels the animation.
142
+ delete this._pendingAnimations[key];
143
+ }
144
+
145
+ }
146
+
147
+ // Ignore undefined values or values equal to the current value.
148
+ if (newValue !== undefined && layout[key] != newValue) { // coerced so '100' == 100
149
+ // Only clone the layout if it is not given.
150
+ if (!newLayout) newLayout = SC.clone(this.get('layout'));
151
+
152
+ if (newValue === null) {
153
+ delete newLayout[key];
154
+ } else {
155
+ newLayout[key] = newValue;
156
+ }
157
+ }
158
+
159
+ return newLayout;
160
+ },
132
161
 
133
162
  /**
134
163
  This convenience method will take the current layout, apply any changes
@@ -146,66 +175,31 @@ SC.View.reopen(
146
175
  @returns {SC.View} receiver
147
176
  */
148
177
  adjust: function (key, value) {
149
- if (key === undefined) { return this; } // nothing to do.
178
+ if (key === undefined) { return this; } // FAST PATH! Nothing to do.
150
179
 
151
180
  var layout = this.get('layout'),
152
- didChange = NO,
153
- animateLayout = this._animateLayout,
154
- cur, hash;
181
+ newLayout;
155
182
 
156
183
  // Normalize arguments.
157
184
  if (SC.typeOf(key) === SC.T_STRING) {
158
- hash = {};
159
- hash[key] = value;
185
+ newLayout = this._sc_applyAdjustment(key, value, layout);
160
186
  } else {
161
- hash = key;
162
- }
163
-
164
- for (key in hash) {
165
- if (!hash.hasOwnProperty(key)) { continue; }
166
-
167
- value = hash[key];
168
- cur = layout[key];
187
+ for (var aKey in key) {
188
+ if (!key.hasOwnProperty(aKey)) { continue; }
169
189
 
170
- // If a call to animate occurs in the same run loop, the animation layout
171
- // would still be applied in the next run loop, potentially overriding this
172
- // adjustment. So we need to fix up the animation layout.
173
- if (animateLayout) {
174
- if (value === null) {
175
- delete animateLayout[key];
176
- } else {
177
- animateLayout[key] = value;
178
- }
179
-
180
- if (this._pendingAnimations[key]) {
181
- // Adjusting a value that was previously about to be animated cancels the animation.
182
- delete this._pendingAnimations[key];
183
- }
184
- }
185
-
186
- if (value === undefined || cur == value) { continue; }
187
-
188
- // only clone the layout the first time we see a change
189
- if (!didChange) layout = SC.clone(layout);
190
-
191
- if (value === null) {
192
- delete layout[key];
193
- } else {
194
- layout[key] = value;
190
+ newLayout = this._sc_applyAdjustment(aKey, key[aKey], layout, newLayout);
195
191
  }
196
-
197
- didChange = YES;
198
192
  }
199
193
 
200
194
  // now set adjusted layout
201
- if (didChange) {
195
+ if (newLayout) {
202
196
  var transitionAdjust = this.get('transitionAdjust');
203
197
 
204
198
  if (this.get('viewState') & SC.CoreView.IS_SHOWN && transitionAdjust) {
205
199
  // Run the adjust transition.
206
- this._transitionAdjust(layout);
200
+ this._transitionAdjust(newLayout);
207
201
  } else {
208
- this.set('layout', layout);
202
+ this.set('layout', newLayout);
209
203
  }
210
204
  }
211
205
 
@@ -222,44 +216,71 @@ SC.View.reopen(
222
216
  },
223
217
 
224
218
  /** @private */
225
- didTransitionAdjust: function () {
226
- },
219
+ didTransitionAdjust: function () {},
227
220
 
228
221
  /**
229
- The layout describes how you want your view to be positioned on the
230
- screen. You can define the following properties:
231
-
232
- - left: the left edge
233
- - top: the top edge
234
- - right: the right edge
235
- - bottom: the bottom edge
236
- - height: the height
237
- - width: the width
238
- - centerX: an offset from center X
239
- - centerY: an offset from center Y
240
- - minWidth: a minimum width
241
- - minHeight: a minimum height
242
- - maxWidth: a maximum width
243
- - maxHeight: a maximum height
244
- - border: border on all sides
245
- - borderTop: top border
246
- - borderRight: right border
247
- - borderBottom: bottom border
248
- - borderLeft: bottom left
249
- - opacity: the opacity of the view
250
- - zIndex: position above or below other views
251
-
252
- Note that you can only use certain combinations to set layout. For
253
- example, you may set left/right or left/width, but not left/width/right,
254
- since that combination doesn't make sense.
222
+ Set the layout to a hash of layout properties to describe in detail how your view
223
+ should be positioned on screen. Like most application development environments,
224
+ your views are laid out absolutely, relative to their parent view.
225
+
226
+ You can define your layout using combinations of the following positional properties:
227
+
228
+ - left
229
+ - top
230
+ - right
231
+ - bottom
232
+ - height
233
+ - width
234
+ - centerX: offset from center, horizontally
235
+ - centerY: offset from center, vertically
236
+ - minWidth
237
+ - minHeight
238
+ - maxWidth
239
+ - maxHeight
240
+ - scale: once positioned, scales the view in place.
241
+ - transformOriginX, transformOriginY: defines the point (as a decimal percentage) around which
242
+ your view will scale. (Also impacts rotation; see below.)
243
+
244
+ They are processed by SproutCore's layout engine and used to position the view's element onscreen. They are
245
+ also reliably and speedily processed into a scaled rectangle (with x, y, height, width, scale and origin
246
+ values) available on the frame property. See documentation on it and the clippingFrame property for more.
247
+
248
+ Most of these properties take integer numbers of pixels, for example { left: 10 }, or fractional
249
+ percentages like { left 0.25 }. Exceptions include scale, which takes a scale factor (e.g. { scale:
250
+ 2 } doubles the view's size), and transformOriginX/Y which take a decimal percent, and default to 0.5
251
+ (the center of the view).
252
+
253
+ It's possible to define very sophisticated layouts with these properties alone. For example, you
254
+ can define a view which takes up the full screen until it reaches a certain width, and aligns to
255
+ the left thereafter, with { left: 0, right: 0, maxWidth: 400 }. (If you need the flexibility to
256
+ assign entirely different layouts at different screen or window sizes, see the Design Modes
257
+ documentation under SC.Application.)
258
+
259
+ Certain layout combinations are nonsensical and of course should be avoided. For example, you
260
+ can use left + right or left + width, but not left + right + width.
261
+
262
+ If your view has a CSS border, it's important that you specify its thickness in the layout hash,
263
+ using one or more of the following border properties, as well as in your CSS. This is an unfortunate
264
+ bit of repetition, but it's necessary to allow SproutCore to adjust the layout to compensate. (HTML
265
+ positions borders outside of the body of an element; SproutCore positions them inside their rectangles.)
266
+
267
+ - border: border thickness on all sides
268
+ - borderTop: top border thickness
269
+ - borderRight: right border thickness
270
+ - borderBottom: bottom border thickness
271
+ - borderLeft: bottom left thickness
272
+
273
+ You can also use the following layout properties, which don't impact your view's frame.
255
274
 
256
- Likewise, you may set a minWidth/minHeight, or maxWidth/maxHeight, but
257
- if you also set the width/height explicitly, then those constraints won't
258
- matter as much.
275
+ - opacity: the opacity of the view
276
+ - rotate: once positioned, rotates the view in place.
277
+ - zIndex: position above or below other views (Not recommended. Control sibling view
278
+ overlay with childView order (later views draw above earlier views) where possible.)
259
279
 
260
- Layout is designed to maximize reliance on the browser's rendering
261
- engine to keep your app up to date.
280
+ To change a layout property, you should use the adjust method, which handles some particulars for you.
262
281
 
282
+ @type Object
283
+ @default { top: 0, left: 0, bottom: 0, right: 0 }
263
284
  @test in layoutStyle
264
285
  */
265
286
  layout: { top: 0, left: 0, bottom: 0, right: 0 },
@@ -281,6 +302,7 @@ SC.View.reopen(
281
302
  fixed left & top position within its parent's frame. Fixed positions are
282
303
  therefore unaffected by changes to their parent view's size.
283
304
 
305
+ @field
284
306
  @returns {Boolean} YES if fixed, NO otherwise
285
307
  @test in layoutStyle
286
308
  */
@@ -318,25 +340,48 @@ SC.View.reopen(
318
340
  width and height. Fixed sizes are therefore unaffected by changes to their
319
341
  parent view's size.
320
342
 
343
+ @field
321
344
  @returns {Boolean} YES if fixed, NO otherwise
322
- @test in layoutStyle
345
+ @test in layout
323
346
  */
324
347
  isFixedSize: function () {
325
- var layout = this.get('layout'),
326
- ret;
348
+ return this.get('isFixedHeight') && this.get('isFixedWidth');
349
+ }.property('isFixedWidth', 'isFixedHeight').cacheable(),
327
350
 
328
- // Size is fixed if it has width + height !== SC.LAYOUT_AUTO
329
- ret = (
330
- ((layout.width !== undefined) && (layout.height !== undefined)) &&
331
- ((layout.width !== SC.LAYOUT_AUTO) && (layout.height !== SC.LAYOUT_AUTO))
332
- );
351
+ /**
352
+ Returns whether the height is 'fixed' or not. A fixed height is defined on the layout
353
+ as an integer number of pixels. Fixed widths are therefore unaffected by changes
354
+ to their parent view's height.
333
355
 
334
- // The size may appear fixed, but only if none of the values are percentages.
335
- if (ret) {
336
- ret = (!SC.isPercentage(layout.width) && !SC.isPercentage(layout.height));
337
- }
356
+ @field
357
+ @returns {Boolean} YES if fixed, NO otherwise
358
+ @test in layout
359
+ */
360
+ isFixedHeight: function() {
361
+ var layout = this.get('layout');
338
362
 
339
- return ret;
363
+ // Width is fixed if it has a height and it isn't SC.LAYOUT_AUTO or a percent.
364
+ return (layout.height !== undefined) &&
365
+ (layout.height !== SC.LAYOUT_AUTO) &&
366
+ !SC.isPercentage(layout.height);
367
+ }.property('layout').cacheable(),
368
+
369
+ /**
370
+ Returns whether the width is 'fixed' or not. A fixed width is defined on the layout
371
+ as an integer number of pixels. Fixed widths are therefore unaffected by changes
372
+ to their parent view's width.
373
+
374
+ @field
375
+ @returns {Boolean} YES if fixed, NO otherwise
376
+ @test in layout
377
+ */
378
+ isFixedWidth: function() {
379
+ var layout = this.get('layout');
380
+
381
+ // Width is fixed if it has a width and it isn't SC.LAYOUT_AUTO or a percent.
382
+ return (layout.width !== undefined) &&
383
+ (layout.width !== SC.LAYOUT_AUTO) &&
384
+ !SC.isPercentage(layout.width);
340
385
  }.property('layout').cacheable(),
341
386
 
342
387
  /**
@@ -357,31 +402,7 @@ SC.View.reopen(
357
402
  @test in convertFrames
358
403
  */
359
404
  convertFrameToView: function (frame, targetView) {
360
- var myX = 0, myY = 0, targetX = 0, targetY = 0, view = this, f;
361
-
362
- // walk up this side
363
- while (view) {
364
- f = view.get('frame');
365
- myX += f.x;
366
- myY += f.y;
367
- view = view.get('layoutView');
368
- }
369
-
370
- // walk up other size
371
- if (targetView) {
372
- view = targetView;
373
- while (view) {
374
- f = view.get('frame');
375
- targetX += f.x;
376
- targetY += f.y;
377
- view = view.get('layoutView');
378
- }
379
- }
380
-
381
- // now we can figure how to translate the origin.
382
- myX = frame.x + myX - targetX;
383
- myY = frame.y + myY - targetY;
384
- return { x: myX, y: myY, width: frame.width, height: frame.height };
405
+ return this._convertFrameFromViewHelper(frame, this, targetView);
385
406
  },
386
407
 
387
408
  /**
@@ -401,31 +422,65 @@ SC.View.reopen(
401
422
  @test in converFrames
402
423
  */
403
424
  convertFrameFromView: function (frame, targetView) {
404
- var myX = 0, myY = 0, targetX = 0, targetY = 0, view = this, f;
405
-
406
- // walk up this side
407
- //Note: Intentional assignment of variable f
408
- while (view && (f = view.get('frame'))) {
409
- myX += f.x;
410
- myY += f.y;
411
- view = view.get('parentView');
425
+ return this._convertFrameFromViewHelper(frame, targetView, this);
426
+ },
427
+
428
+ /** @private */
429
+ _convertFrameFromViewHelper: function(frame, fromView, targetView) {
430
+ var myX = frame.x, myY = frame.y, myWidth = frame.width, myHeight = frame.height, view, f;
431
+
432
+ // first, walk up from the view of the frame, up to the top level
433
+ if (fromView) {
434
+ view = fromView;
435
+ //Note: Intentional assignment of variable f
436
+ while (view && (f = view.get('frame'))) {
437
+
438
+ // if scale != 1, then multiple by the scale (going from view to parent)
439
+ if (f.scale && f.scale !== 1) {
440
+ myX *= f.scale;
441
+ myY *= f.scale;
442
+ myWidth *= f.scale;
443
+ myHeight *= f.scale;
444
+ }
445
+
446
+ myX += f.x;
447
+ myY += f.y;
448
+
449
+ view = view.get('layoutView');
450
+ }
412
451
  }
413
452
 
414
- // walk up other size
453
+ // now, we'll walk down from the top level to the target view
454
+
455
+ // construct an array of view ancestry, from
456
+ // the top level view down to the target view
415
457
  if (targetView) {
458
+ var viewAncestors = [];
416
459
  view = targetView;
417
- while (view) {
460
+
461
+ while (view && view.get('frame')) {
462
+ viewAncestors.unshift(view);
463
+ view = view.get('layoutView');
464
+ }
465
+
466
+ // now walk the frame from
467
+ for (var i = 0; i < viewAncestors.length; i++ ) {
468
+ view = viewAncestors[i];
418
469
  f = view.get('frame');
419
- targetX += f.x;
420
- targetY += f.y;
421
- view = view.get('parentView');
470
+
471
+ myX -= f.x;
472
+ myY -= f.y;
473
+
474
+ if (f.scale && f.scale !== 1) {
475
+ myX /= f.scale;
476
+ myY /= f.scale;
477
+ myWidth /= f.scale;
478
+ myHeight /= f.scale;
479
+ }
422
480
  }
423
481
  }
424
482
 
425
- // now we can figure how to translate the origin.
426
- myX = frame.x - myX + targetX;
427
- myY = frame.y - myY + targetY;
428
- return { x: myX, y: myY, width: frame.width, height: frame.height };
483
+ return { x: myX, y: myY, width: myWidth, height: myHeight };
429
484
  },
430
485
 
431
486
  /**
@@ -470,237 +525,107 @@ SC.View.reopen(
470
525
  return frame;
471
526
  },
472
527
 
473
- /**
474
- Computes what the frame of this view would be if the parent were resized
475
- to the passed dimensions. You can use this method to project the size of
476
- a frame based on the resize behavior of the parent.
477
-
478
- This method is used especially by the scroll view to automatically
479
- calculate when scrollviews should be visible.
480
-
481
- Passing null for the parent dimensions will use the actual current
482
- parent dimensions. This is the same method used to calculate the current
483
- frame when it changes.
484
-
485
- @param {Rect} pdim the projected parent dimensions
486
- @returns {Rect} the computed frame
487
- */
488
- computeFrameWithParentFrame: function (original, pdim) {
489
- var f, layout = this.get('layout');
490
-
491
- // We can't predict the frame for static layout, so just return the view's
492
- // current frame (see original computeFrameWithParentFrame in views/view.js)
493
- if (this.get('useStaticLayout')) {
494
- f = original();
495
- return f ? this._adjustForBorder(f, layout) : null;
496
- } else {
497
- f = {};
498
- }
499
-
500
- var error, layer, AUTO = SC.LAYOUT_AUTO,
501
- pv = this.get('parentView'),
502
- dH, dW, //shortHand for parentDimensions
503
- lR = layout.right,
504
- lL = layout.left,
505
- lT = layout.top,
506
- lB = layout.bottom,
507
- lW = layout.width,
508
- lH = layout.height,
509
- lcX = layout.centerX,
510
- lcY = layout.centerY;
511
-
512
- if (lW === AUTO) {
513
- error = SC.Error.desc(("%@.layout() cannot use width:auto if " +
514
- "staticLayout is disabled").fmt(this), "%@".fmt(this), -1);
515
- SC.Logger.error(error.toString());
516
- throw error;
517
- }
518
-
519
- if (lH === AUTO) {
520
- error = SC.Error.desc(("%@.layout() cannot use height:auto if " +
521
- "staticLayout is disabled").fmt(this), "%@".fmt(this), -1);
522
- SC.Logger.error(error.toString());
523
- throw error;
524
- }
525
-
526
- if (!pdim) { pdim = this.computeParentDimensions(layout); }
527
- dH = pdim.height;
528
- dW = pdim.width;
529
-
530
- // handle left aligned and left/right
531
- if (!SC.none(lL)) {
532
- if (SC.isPercentage(lL)) {
533
- f.x = dW * lL;
534
- } else {
535
- f.x = lL;
536
- }
537
- if (lW !== undefined) {
538
- if (lW === AUTO) { f.width = AUTO; }
539
- else if (SC.isPercentage(lW)) { f.width = dW * lW; }
540
- else { f.width = lW; }
541
- } else { // better have lR!
542
- f.width = dW - f.x;
543
- if (lR && SC.isPercentage(lR)) { f.width = f.width - (lR * dW); }
544
- else { f.width = f.width - (lR || 0); }
545
- }
546
- // handle right aligned
547
- } else if (!SC.none(lR)) {
548
- if (SC.none(lW)) {
549
- if (SC.isPercentage(lR)) {
550
- f.width = dW - (dW * lR);
551
- }
552
- else f.width = dW - lR;
553
- f.x = 0;
554
- } else {
555
- if (lW === AUTO) f.width = AUTO;
556
- else if (SC.isPercentage(lW)) f.width = dW * lW;
557
- else f.width = (lW || 0);
558
- if (SC.isPercentage(lW)) f.x = dW - (lR * dW) - f.width;
559
- else f.x = dW - lR - f.width;
560
- }
561
-
562
- // handle centered
563
- } else if (!SC.none(lcX)) {
564
- if (lW === AUTO) f.width = AUTO;
565
- else if (SC.isPercentage(lW)) f.width = lW * dW;
566
- else f.width = (lW || 0);
567
- if (SC.isPercentage(lcX)) f.x = (dW - f.width) / 2 + (lcX * dW);
568
- else f.x = (dW - f.width) / 2 + lcX;
569
- } else {
570
- f.x = 0; // fallback
571
- if (SC.none(lW)) {
572
- f.width = dW;
573
- } else {
574
- if (lW === AUTO) f.width = AUTO;
575
- if (SC.isPercentage(lW)) f.width = lW * dW;
576
- else f.width = (lW || 0);
577
- }
578
- }
579
-
580
- // handle top aligned and top/bottom
581
- if (!SC.none(lT)) {
582
- if (SC.isPercentage(lT)) f.y = lT * dH;
583
- else f.y = lT;
584
- if (lH !== undefined) {
585
- if (lH === AUTO) f.height = AUTO;
586
- else if (SC.isPercentage(lH)) f.height = lH * dH;
587
- else f.height = lH;
588
- } else { // better have lB!
589
- if (lB && SC.isPercentage(lB)) f.height = dH - f.y - (lB * dH);
590
- else f.height = dH - f.y - (lB || 0);
591
- }
592
-
593
- // handle bottom aligned
594
- } else if (!SC.none(lB)) {
595
- if (SC.none(lH)) {
596
- if (SC.isPercentage(lB)) f.height = dH - (lB * dH);
597
- else f.height = dH - lB;
598
- f.y = 0;
599
- } else {
600
- if (lH === AUTO) f.height = AUTO;
601
- if (lH && SC.isPercentage(lH)) f.height = lH * dH;
602
- else f.height = (lH || 0);
603
- if (SC.isPercentage(lB)) f.y = dH - (lB * dH) - f.height;
604
- else f.y = dH - lB - f.height;
605
- }
606
-
607
- // handle centered
608
- } else if (!SC.none(lcY)) {
609
- if (lH === AUTO) f.height = AUTO;
610
- if (lH && SC.isPercentage(lH)) f.height = lH * dH;
611
- else f.height = (lH || 0);
612
- if (SC.isPercentage(lcY)) f.y = (dH - f.height) / 2 + (lcY * dH);
613
- else f.y = (dH - f.height) / 2 + lcY;
614
-
615
- // fallback
616
- } else {
617
- f.y = 0; // fallback
618
- if (SC.none(lH)) {
619
- f.height = dH;
620
- } else {
621
- if (lH === AUTO) f.height = AUTO;
622
- if (SC.isPercentage(lH)) f.height = lH * dH;
623
- else f.height = lH || 0;
624
- }
625
- }
626
-
627
- f.x = Math.floor(f.x);
628
- f.y = Math.floor(f.y);
629
- if (f.height !== AUTO) f.height = Math.floor(f.height);
630
- if (f.width !== AUTO) f.width = Math.floor(f.width);
631
-
632
- // if width or height were set to auto and we have a layer, try lookup
633
- if (f.height === AUTO || f.width === AUTO) {
634
- layer = this.get('layer');
635
- if (f.height === AUTO) f.height = layer ? layer.clientHeight : 0;
636
- if (f.width === AUTO) f.width = layer ? layer.clientWidth : 0;
637
- }
638
-
639
- f = this._adjustForBorder(f, layout);
640
-
641
- // Account for special cases inside ScrollView, where we adjust the
642
- // element's scrollTop/scrollLeft property for performance reasons.
643
- if (pv && pv.isScrollContainer) {
644
- pv = pv.get('parentView');
645
- f.x -= pv.get('horizontalScrollOffset');
646
- f.y -= pv.get('verticalScrollOffset');
647
- }
648
-
649
- // make sure the width/height fix min/max...
650
- if (!SC.none(layout.maxHeight) && (f.height > layout.maxHeight)) {
651
- f.height = layout.maxHeight;
652
- }
528
+ /** @private */
529
+ _adjustForScale: function (frame, layout, scale, oX, oY) {
530
+ // Add the original, unscaled height and width.
531
+ var originalWidth = frame.width;
532
+ var originalHeight = frame.height;
653
533
 
654
- if (!SC.none(layout.minHeight) && (f.height < layout.minHeight)) {
655
- f.height = layout.minHeight;
534
+ // make sure width/height are never < 0
535
+ if (originalHeight < 0) originalHeight = 0;
536
+ if (originalWidth < 0) originalWidth = 0;
537
+
538
+ // GATEKEEP: Scale not supported.
539
+ if (!SC.platform.supportsCSSTransforms) {
540
+ frame.scale = 1;
541
+ frame.transformOriginX = frame.transformOriginY = 0.5;
542
+
543
+ // Add the original, unscaled height and width.
544
+ frame.originalWidth = originalWidth;
545
+ frame.originalHeight = originalHeight;
546
+ return frame;
656
547
  }
657
-
658
- if (!SC.none(layout.maxWidth) && (f.width > layout.maxWidth)) {
659
- f.width = layout.maxWidth;
548
+ // Get the scale and transform origins, if not provided. (Note inlining of SC.none for performance)
549
+ /*jshint eqnull:true*/
550
+ scale = scale == null ? layout.scale : scale;
551
+ oX = oX == null ? layout.transformOriginX : oX;
552
+ oY = oY == null ? layout.transformOriginY : oY;
553
+ // Get defaults.
554
+ if (scale == null) scale = 1;
555
+ if (oX == null) oX = 0.5;
556
+ if (oY == null) oY = 0.5;
557
+
558
+ // If the scale isn't 1, do some calculations.
559
+ if (scale !== 1) {
560
+ frame = SC.scaleRect(frame, scale, oX, oY);
660
561
  }
562
+ // Regardless, attach the scale numbers for reference.
563
+ frame.scale = scale;
564
+ frame.transformOriginX = oX;
565
+ frame.transformOriginY = oY;
661
566
 
662
- if (!SC.none(layout.minWidth) && (f.width < layout.minWidth)) {
663
- f.width = layout.minWidth;
664
- }
567
+ // Add the original, unscaled height and width.
568
+ frame.originalWidth = originalWidth;
569
+ frame.originalHeight = originalHeight;
665
570
 
666
- // make sure width/height are never < 0
667
- if (f.height < 0) f.height = 0;
668
- if (f.width < 0) f.width = 0;
571
+ // Make sure width/height are never < 0.
572
+ if (frame.height < 0) frame.height = 0;
573
+ if (frame.width < 0) frame.width = 0;
669
574
 
670
- return f;
671
- }.enhance(),
575
+ return frame;
576
+ },
672
577
 
673
578
  computeParentDimensions: function (frame) {
674
- var ret, pv = this.get('parentView'), pf = (pv) ? pv.get('frame') : null;
579
+ var parentView = this.get('parentView'),
580
+ parentFrame = (parentView) ? parentView.get('frame') : null,
581
+ ret;
675
582
 
676
- if (pf) {
677
- ret = { width: pf.width, height: pf.height };
583
+ if (parentFrame) {
584
+ ret = {
585
+ width: parentFrame.width,
586
+ height: parentFrame.height
587
+ };
588
+ } else if (frame) {
589
+ ret = {
590
+ width: (frame.left || 0) + (frame.width || 0) + (frame.right || 0),
591
+ height: (frame.top || 0) + (frame.height || 0) + (frame.bottom || 0)
592
+ };
678
593
  } else {
679
- var f = frame || {};
680
594
  ret = {
681
- width: (f.left || 0) + (f.width || 0) + (f.right || 0),
682
- height: (f.top || 0) + (f.height || 0) + (f.bottom || 0)
595
+ width: 0,
596
+ height: 0
683
597
  };
684
598
  }
599
+
685
600
  return ret;
686
601
  },
687
602
 
688
603
  /**
689
- The frame of the view including the borders
604
+ The frame of the view including the borders and scale
690
605
  */
691
606
  borderFrame: function () {
692
607
  var layout = this.get('layout'),
693
608
  frame = this.get('frame'),
609
+ scale = (frame && !SC.none(frame.scale)) ? frame.scale : 1,
694
610
  borderTop = this._effectiveBorderFor('borderTop', layout),
611
+ scaledBorderTop = borderTop * scale,
695
612
  borderRight = this._effectiveBorderFor('borderRight', layout),
613
+ scaledBorderRight = borderRight * scale,
696
614
  borderBottom = this._effectiveBorderFor('borderBottom', layout),
697
- borderLeft = this._effectiveBorderFor('borderLeft', layout);
615
+ scaledBorderBottom = borderBottom * scale,
616
+ borderLeft = this._effectiveBorderFor('borderLeft', layout),
617
+ scaledBorderLeft = borderLeft * scale;
698
618
 
699
619
  return frame ? {
700
- x: frame.x - borderLeft,
701
- y: frame.y - borderTop,
702
- width: frame.width + borderLeft + borderRight,
703
- height: frame.height + borderTop + borderBottom
620
+ x: frame.x - scaledBorderLeft,
621
+ y: frame.y - scaledBorderTop,
622
+ width: frame.width + scaledBorderLeft + scaledBorderRight,
623
+ height: frame.height + scaledBorderTop + scaledBorderBottom,
624
+ scale: scale,
625
+ originalWidth: frame.originalWidth + borderLeft + borderRight,
626
+ originalHeight: frame.originalHeight + borderTop + borderBottom,
627
+ transformOriginX: frame.transformOriginX,
628
+ transformOriginY: frame.transformOriginY
704
629
  } : null;
705
630
  }.property('frame').cacheable(),
706
631
 
@@ -711,24 +636,38 @@ SC.View.reopen(
711
636
  viewDidResize() if its size may have changed. You will not usually override
712
637
  this method, but you may override the viewDidResize() method.
713
638
 
639
+ @param {Frame} parentFrame the parent view's current frame.
714
640
  @returns {void}
715
641
  @test in viewDidResize
716
642
  */
717
- parentViewDidResize: function () {
718
- var positionMayHaveChanged,
719
- sizeMayHaveChanged;
720
-
721
- // If this view uses static layout, our "do we think the frame changed?"
722
- // result of isFixedLayout is not applicable and we simply have to assume
723
- // that the frame may have changed.
724
- sizeMayHaveChanged = this.get('useStaticLayout') || !this.get('isFixedSize');
725
- positionMayHaveChanged = !this.get('isFixedPosition');
726
-
727
- if (sizeMayHaveChanged) {
728
- // If our size isn't fixed, our frame may have changed and it will effect our child views.
643
+ parentViewDidResize: function (parentFrame) {
644
+ // Determine if our position may have changed.
645
+ var positionMayHaveChanged = !this.get('isFixedPosition');
646
+
647
+ // Figure out if our size may have changed.
648
+ var isStatic = this.get('useStaticLayout'),
649
+ // Figure out whether our height may have changed.
650
+ parentHeight = parentFrame ? parentFrame.height : 0,
651
+ parentHeightDidChange = parentHeight !== this._scv_parentHeight,
652
+ isFixedHeight = this.get('isFixedHeight'),
653
+ heightMayHaveChanged = isStatic || (parentHeightDidChange && !isFixedHeight),
654
+ // Figure out whether our width may have changed.
655
+ parentWidth = parentFrame ? parentFrame.width : 0,
656
+ parentWidthDidChange = parentWidth !== this._scv_parentWidth,
657
+ isFixedWidth = this.get('isFixedWidth'),
658
+ widthMayHaveChanged = isStatic || (parentWidthDidChange && !isFixedWidth);
659
+
660
+ // Update the cached parent frame.
661
+ this._scv_parentHeight = parentHeight;
662
+ this._scv_parentWidth = parentWidth;
663
+
664
+ // If our height or width changed, our resulting frame change may impact our child views.
665
+ if (heightMayHaveChanged || widthMayHaveChanged) {
729
666
  this.viewDidResize();
730
- } else if (positionMayHaveChanged) {
731
- // If our size is fixed but our position isn't, our frame may have changed, but it won't effect our child views.
667
+ }
668
+ // If our size didn't change but our position did, our frame will change, but it won't impact our child
669
+ // views' frames. (Note that the _viewFrameDidChange call is made by viewDidResize above.)
670
+ else if (positionMayHaveChanged) {
732
671
  this._viewFrameDidChange();
733
672
  }
734
673
  },
@@ -749,10 +688,12 @@ SC.View.reopen(
749
688
  this._viewFrameDidChange();
750
689
 
751
690
  // Also notify our children.
752
- var cv = this.childViews, len, idx, view;
691
+ var cv = this.childViews,
692
+ frame = this.get('frame'),
693
+ len, idx, view;
753
694
  for (idx = 0; idx < (len = cv.length); ++idx) {
754
695
  view = cv[idx];
755
- view.tryToPerform('parentViewDidResize');
696
+ view.tryToPerform('parentViewDidResize', frame);
756
697
  }
757
698
  },
758
699
 
@@ -760,7 +701,7 @@ SC.View.reopen(
760
701
  Invoked by other views to notify this view that its frame has changed.
761
702
 
762
703
  This notifies the view that its frame property has changed,
763
- then propagates those changes to its child views.
704
+ then notifies its child views that their clipping frames may have changed.
764
705
  */
765
706
  _viewFrameDidChange: function () {
766
707
  this.notifyPropertyChange('frame');
@@ -854,14 +795,11 @@ SC.View.reopen(
854
795
 
855
796
  // Handle old style rotation.
856
797
  if (!SC.none(currentLayout.rotate)) {
857
- //@if (debug)
858
- SC.Logger.warn('Developer Warning: Please set rotateX instead of rotate.');
859
- //@endif
860
- if (SC.none(currentLayout.rotateX)) {
861
- currentLayout.rotateX = currentLayout.rotate;
862
- }
798
+ if (SC.none(currentLayout.rotateZ) && SC.platform.get('supportsCSS3DTransforms')) {
799
+ currentLayout.rotateZ = currentLayout.rotate;
863
800
  delete currentLayout.rotate;
864
801
  }
802
+ }
865
803
 
866
804
  // Optimize notifications depending on if we resized or just moved.
867
805
  this._checkForResize();
@@ -885,7 +823,7 @@ SC.View.reopen(
885
823
 
886
824
  /** @private */
887
825
  _checkForResize: function () {
888
- // Did our layout change in a way that could cause us to be resized? If
826
+ // Did our layout change in a way that could cause us to have changed size? If
889
827
  // not, then there's no need to invalidate the frames of our child views.
890
828
  var previousLayout = this._previousLayout,
891
829
  currentLayout = this.get('layout'),
@@ -894,22 +832,25 @@ SC.View.reopen(
894
832
  // We test the new layout to see if we believe it will affect the view's frame.
895
833
  // Since all the child view frames may depend on the parent's frame, it's
896
834
  // best only to notify a frame change when it actually happens.
897
- if (previousLayout && !SC.none(previousLayout.width) && !SC.none(previousLayout.height) && previousLayout !== currentLayout) {
898
- var currentTest,
899
- previousTest;
900
-
901
- // This code already exists in _adjustForBorder, so we use it to test the effective width/height.
902
- // TODO: consider checking min/max sizes
903
- previousTest = this._adjustForBorder({ x: 0, y: 0, width: previousLayout.width, height: previousLayout.height },
904
- previousLayout);
905
- currentTest = this._adjustForBorder({ x: 0, y: 0, width: currentLayout.width || 0, height: currentLayout.height || 0 },
906
- currentLayout);
907
-
908
- if (previousTest.width === currentTest.width && previousTest.height === currentTest.height) {
909
- didResize = false;
910
- }
835
+ /*jshint eqnull:true*/
836
+ if (previousLayout &&
837
+ previousLayout.width != null &&
838
+ previousLayout.height != null &&
839
+ previousLayout.width === currentLayout.width &&
840
+ previousLayout.height === currentLayout.height &&
841
+ previousLayout.border === currentLayout.border &&
842
+ previousLayout.borderTop === currentLayout.borderTop &&
843
+ previousLayout.borderLeft === currentLayout.borderLeft &&
844
+ previousLayout.borderBottom === currentLayout.borderBottom &&
845
+ previousLayout.borderRight === currentLayout.borderRight) {
846
+ didResize = false;
911
847
  }
912
848
 
849
+ // Cache the last layout to fine-tune notifications when the layout changes.
850
+ // NOTE: Do this before continuing so that any adjustments that occur in viewDidResize or from _viewFrameDidChange
851
+ // (say to the position after a resize), don't result in _checkForResize running against the old _previousLayout.
852
+ this._previousLayout = currentLayout;
853
+
913
854
  if (didResize) {
914
855
  this.viewDidResize();
915
856
  } else {
@@ -917,9 +858,6 @@ SC.View.reopen(
917
858
  // TODO: consider checking for position changes by testing the resulting frame against the cached frame. This is difficult to do.
918
859
  this._viewFrameDidChange();
919
860
  }
920
-
921
- // Cache the last layout to fine-tune notifications when the layout changes.
922
- this._previousLayout = currentLayout;
923
861
  },
924
862
 
925
863
  /**
@@ -1101,20 +1039,6 @@ SC.View.reopen(
1101
1039
  context.setStyle(this.get('layoutStyle'));
1102
1040
  },
1103
1041
 
1104
- applyAttributesToContext: function (original, context) {
1105
- original(context);
1106
-
1107
- // Have to pass 'true' for second argument for legacy.
1108
- this.renderLayout(context, true);
1109
-
1110
- if (this.get('useStaticLayout')) { context.addClass('sc-static-layout'); }
1111
-
1112
- var backgroundColor = this.get('backgroundColor');
1113
- if (backgroundColor) {
1114
- context.setStyle('backgroundColor', backgroundColor);
1115
- }
1116
- }.enhance(),
1117
-
1118
1042
  // ------------------------------------------------------------------------
1119
1043
  // Child View Layouts
1120
1044
  //
@@ -1228,16 +1152,6 @@ SC.View.reopen(
1228
1152
  this._updatedLayout();
1229
1153
  },
1230
1154
 
1231
- /** @private Enhance. */
1232
- _executeQueuedUpdates: function (original) {
1233
- original();
1234
-
1235
- // Update the layout style of the layer if necessary.
1236
- if (this._layoutStyleNeedsUpdate) {
1237
- this._doUpdateLayoutStyle();
1238
- }
1239
- }.enhance(),
1240
-
1241
1155
  /** @private Override: Notify on attached (avoids notify of frame changed). */
1242
1156
  _notifyDidAttach: function () {
1243
1157
  // If we are using static layout then we don't know the frame until appended to the document.
@@ -1254,14 +1168,22 @@ SC.View.reopen(
1254
1168
  _adopted: function (beforeView) {
1255
1169
  // Our frame may change once we've been adopted to a parent.
1256
1170
  this._checkForResize();
1171
+
1172
+ // Notify all of our descendents that our parent has changed. They will update their `pane` value for one.
1173
+ this._callOnChildViews('_ancestorDidChangeParent');
1257
1174
  },
1258
1175
 
1259
1176
  /** @private Extension: The 'orphaned' event. */
1260
1177
  _orphaned: function (oldParentView) {
1261
1178
  sc_super();
1262
1179
 
1263
- // Our frame may change once we've been removed from a parent.
1264
- if (!this.isDestroyed) { this._checkForResize(); }
1180
+ if (!this.isDestroyed) {
1181
+ // Our frame may change once we've been removed from a parent.
1182
+ this._checkForResize();
1183
+
1184
+ // Notify all of our descendents that our parent has changed. They will update their `pane` value for one.
1185
+ this._callOnChildViews('_ancestorDidChangeParent');
1186
+ }
1265
1187
  },
1266
1188
 
1267
1189
  /** @private Extension: The 'updatedContent' event. */