Commit graph

2740 commits

Author SHA1 Message Date
Ed Sanders a1a448b6de Rename storeDomElements to storeGeneratedContents
The default is to store the entire generated DOM node, but in
general classes can store anything that can be held by the store.

Change-Id: Ia761079fadfb5a6cfa2f00e5b5e23d6c6d3468ac
2013-10-16 11:17:01 +01:00
Trevor Parscal 395d5f563c Remove ve.isMixedIn(), it's unused and it's evil
Change-Id: I5a5fc4c8eb56530dbac3bc32122faf20b8c92aa5
2013-10-11 21:51:01 +00:00
jenkins-bot d826bc702e Merge changes I160e55ad,Idd0592d6,I4d403f1b
* changes:
  Remove ve.ce.Node.prototype.onAttributeChange
  Remove ve.ce.ImageNode.prototype.onUpdate
  Remove .tagName from ce.MWInlineImageNode
2013-10-11 17:30:18 +00:00
Roan Kattouw 1d7d19ff33 Remove ve.ce.Node.prototype.onAttributeChange
There was code in there once, but it's now empty. Removed it in favor
of adding explicit listeners in the handful of subclasses that
override it.

Change-Id: I160e55ad3c7d85c9f830a4bd7d42ec5dc18ad04f
2013-10-11 15:02:19 +00:00
jenkins-bot 66615efc1f Merge "ve.ce.Surface.getSelectionRect() can return null" 2013-10-11 14:24:10 +00:00
jenkins-bot 873b190804 Merge "Add .isFocusable() to ve.ce.Node as a shortcut" 2013-10-11 14:22:46 +00:00
jenkins-bot 19c1e00446 Merge "Stop using ve.isMixedIn() to check if a node is focusable" 2013-10-11 14:21:55 +00:00
Roan Kattouw 7959ce9ca4 Add .isFocusable() to ve.ce.Node as a shortcut
Change-Id: Ia2d3023100859e94f25bf50ed7298370b8d57c42
2013-10-11 16:09:00 +02:00
Trevor Parscal d602724e83 Stop using ve.isMixedIn() to check if a node is focusable
* Moved isNodeFocusable to ve.ce.NodeFactory
* Added isFocusable static property to ve.ce.Node
* Set isFocusable to true on ve.ce.FocusableNode

Change-Id: I3cf666280abdfce55bf9b0710827bb25c40bfd51
2013-10-11 16:00:34 +02:00
Roan Kattouw 1999ece918 Remove ve.ce.ImageNode.prototype.onUpdate
Was empty.

Bonus: consistently use object style for .attr(), was already
used for .css()

Change-Id: Idd0592d6f30388c9952e110ff6fff008bb465877
2013-10-11 15:09:21 +02:00
Ed Sanders 98230889ab Resizeable node updates context after mouse up
Was previously calling show(), which showed the context regardless
of whether one was required or not. Changed this to update().

Change-Id: I2c6c37b6b988cca60f3f3f2429476ab4b429184b
2013-10-10 13:34:54 +01:00
jenkins-bot e3a0ee5b6a Merge "Snap resizables to a grid when the shift key is held" 2013-10-09 23:24:06 +00:00
Ed Sanders 6445a77cec Snap resizables to a grid when the shift key is held
Defaults to 10px.

Change-Id: Idf760c446778b437edbc3cb209b04cbee1d96fb7
2013-10-10 01:10:28 +02:00
Roan Kattouw 75270e24d5 Fixes for Trevor's crazy half-baked commit
Fix things that 4aa86d0f8 broke:
* Update surface parameter to windowSet in all ve.ui.SurfaceDialog subclasses
* Do the same for ve.ui.SurfaceInspector subclasses
* Fix @extends documentation for SurfaceDialog
* Fix documentation for ve.ui.SurfaceInspector, copypasta from SurfaceDialog

Bonus:
* Add .getMetaList() getter to dm.Surface

Change-Id: I843e99e45e9b013cb9cb559f050384d39bbbddf2
2013-10-09 22:08:13 +02:00
Ed Sanders bffa0df53f Prevent deletion of FocusableNodes from a collapsed selection
Instead select the node and require the user to press delete
again if they really meant to delete the node.

Also test cases!

Bug: 55336
Change-Id: I66520e18740e78ce6313f9b31bb575d06b91bea8
2013-10-09 17:41:31 +02:00
Roan Kattouw 5d7673ebc2 ve.ce.Surface.getSelectionRect() can return null
Document this fact and update callers to check for a null return value

Change-Id: I095041157cc0e24e48662f40690b4928bb8d829a
2013-10-08 11:35:17 +02:00
jenkins-bot 846414f215 Merge "Destroy test surfaces" 2013-10-08 09:19:03 +00:00
Ed Sanders c752215896 Destroy test surfaces
Also make sure surface observers are detached so they don't try to
poll the CE when it has been destroyed. This was causing exceptions
to be thrown in test runners.

Change-Id: Ic8864a73f3ee04da6018f552b1aa68748d7ffba7
2013-10-08 11:16:10 +02:00
jenkins-bot 3a9ca9260f Merge "Fix initialisation errors in EventSequencer" 2013-10-07 23:48:19 +00:00
David Chan 9004a66274 Fix initialisation errors in EventSequencer
ve.EventSequencer.js:
* Initialise listener lists to []
* Call afterLoop listeners even if there are no after listeners

Change-Id: I63a0bafa74f2c3135bd3ca75adc91a57c19319ed
2013-10-08 00:24:45 +01:00
Ed Sanders 972c9a46b7 Make the save dialog an actual dialog
Major changes:
* Create a MW specific save dialog class
* Widgetize save dialog elements
* Simplification of viewPageTarget

Minor changes:
* Added getWindow method to windowSet and setTitle methods to window class
* Add transition css properties to dialog styles

Bug: 48566
Bug: 50722
Bug: 51918
Bug: 52175
Bug: 53313
Change-Id: I8c0db01fb8477a9b3d3dfe2a6073ac67869ce40e
2013-10-07 15:59:00 -07:00
jenkins-bot 5a1a960b19 Merge "EventSequencer: New hooks for useful moments" 2013-10-07 22:24:13 +00:00
David Chan e515017827 EventSequencer: New hooks for useful moments
ve.EventSequencer.js - Implement new types of event listener:
* onLoop( f ) to set a listener for the start of the event loop
* afterLoop( f ) to set a listener for the end of the event loop
* afterOne( f ) to set a one-time listener for after an event
* afterLoopOne( f ) to set a one-time listener for the end of the event loop

Change-Id: Ie388e0e9edcfccaa20e04c649a8b85d028ddde9c
2013-10-07 22:21:21 +00:00
jenkins-bot 574264d2d5 Merge "The amazing mystery of scrollTop and onscroll" 2013-10-07 20:37:44 +00:00
Trevor Parscal 9303648406 The amazing mystery of scrollTop and onscroll
What I learned today:
* Window doesn't have a scrollTop property, body does (that's why animate
  doesn't work on window)
* jQuery.scrollTop() doesn't work on body (in firefox) but works on
  window everywhere
* jQuery.scrollTop() uses scroll offset, not the scrollTop property
* Body doesn't have an onscroll event, window does

What I really learned today:
* Browsers are very poorly designed

Objective:
* Make clippable elements properly resize in Firefox when scrolled

Diagnosis:
* Scroll events were not being emitted from the scrollable container
  after the merge of Ifec0dae598f7fd99270588bd8ca77777a07e9669 because
  such events are not emitted from body tags, only scrollable divs and
  windows
* jQuery.scrollTop was giving incorrect values when called on the body
  instead of the window, so also due to the aforementioned change, the
  clipping was being calculated incorrectly

Treatment:
* Add $clippableScroller property, which is either a scrollable div or
  the window (could this have side-effects if someone did something
  ridiculous like made the body absolutely positioned and overflow:auto?
  Yes, but I have no other option and that's a strange edge case don't
  you think?)
* Use $clippableScroller for listening to scroll events and getting the
  scrollTop value from jQuery

Bug: 55343
Change-Id: I819aba60b200059886b347115fda437b3dc9cb7a
2013-10-07 13:25:02 -07:00
jenkins-bot 1e0c24da49 Merge "Make dialogs, inspectors windows and window sets generic" 2013-10-07 18:55:07 +00:00
Trevor Parscal 4aa86d0f87 Make dialogs, inspectors windows and window sets generic
Objective:
* Remove surface dependencies in dialogs, inspectors, windows and window sets
* Introduce surface-specific versions of dialogs, inspectors and window sets

Change-Id: I2db59127d2085b02e173a3605e174317e419e213
2013-10-07 10:37:47 -07:00
jenkins-bot ac0f2ba092 Merge "Refactor out data processing from ve.dm.Document constructor" 2013-10-07 16:36:02 +00:00
Ed Sanders a8d84db0e8 Refactor out data processing from ve.dm.Document constructor
Also make collection of metadata and construction of nodes optional.

Change-Id: I02ba6d2199caccaf9fe9dcfba58eefa7b52c52b1
2013-10-07 17:26:21 +01:00
jenkins-bot 00b6de429b Merge "Use FlatLinearData for storing converter results" 2013-10-07 14:47:21 +00:00
Ed Sanders e9a8c62692 Remove PagedDialog from test files
Fix for patch I5efa2f893f4b which only removed one reference to the file.

Change-Id: I89b9f30ee8309e1cba0ed98a74238ba671b76a59
2013-10-07 10:57:42 +01:00
Ed Sanders 44b1fdebe4 Use FlatLinearData for storing converter results
Previously we returned ElementLinearData from the converter, then
stripped out the MetaLinearData. This meant that before processing
the ElementLinearData from the converter actually contained metadata
which is confusing.

The new document constructor stores the converter results in a
FlatLinearData object and simultaneously populates element and meta
data stores.

Also in this commit I have moved various methods from ElementLinearData
to FlatLinearData, from which ElementLinearData inherits.

Change-Id: I64561bde2c31d8f703c13ac7b0a0c5f7ade9f3d4
2013-10-06 20:27:32 +01:00
Ed Sanders 000cc4d6e3 Fixup for IconButtonWidget load order
Was loading out of order in test HTML.

Change-Id: Iac56fac0432ad634a3ce0c636c7b863b9ddc950e
2013-10-05 10:45:03 +01:00
jenkins-bot b4f415ecc4 Merge "Prevent context menu from flickering after FocusableNode redraw" 2013-10-05 00:26:00 +00:00
jenkins-bot b15374751e Merge "Toolbar action widgetization and UI refactoring" 2013-10-05 00:17:28 +00:00
Trevor Parscal 6ec34a3dee Toolbar action widgetization and UI refactoring
Objectives:

* Use widgets to render toolbar actions
* Remove labels next to help notices and edit notices buttons
* Add a close button to the help notices and edit notices

Overview:

* ve.ui.ButtonWidget is now abstract, use ve.ui.PushButtonWidget instead
* ve.ui.IconButtonWidget now inherits from ve.ui.ButtonWidget
* ve.ui.PopupWidget's display method no longer takes x and y arguments
* Fixup naming issues in MWCategoryPopupWidget
* Fixup naming issues with some ve-init-mw CSS classes
* Rename ve-mw/ui/styles/ve.ui.Widget.css to ve.ui.MWWidget.css
* Change uses of "callout" to "tail"
* Add hyperlink functionality to buttons
* Make buttons accessible through focusing, but make unfocusable by
  clicking
* Add head option to popup for rendering a title and close button

Bug: 52386
Change-Id: Iea2c8df1be64d40f9c039873d89ee540cc56e687
2013-10-04 16:26:13 -07:00
Trevor Parscal 4a459e40a8 Remove surface dependencies from lookup widget
Objective:
* Use <body> instead of the closest surface overlay as the default
  overlay (wasn't actually being used anyway)
* Use this.$.offsetParent instead of closest surface when measuring
  parent frame offset to position text input menu

Change-Id: I04fc5ff1da4bafd342093922a5bd3b3a784b327c
2013-10-04 21:16:47 +00:00
jenkins-bot e1c49ace99 Merge "Refactor ve.ui.PagedDialog" 2013-10-04 20:25:43 +00:00
Kyle Florence 4efc6cadb7 Refactor ve.ui.PagedDialog
This commit extracts the page and outline handling logic from
ve.ui.PagedDialog (RIP) and moves it into two layouts: ve.ui.PagedLayout
and ve.ui.PagedOutlineLayout, respectively. These layouts are now implemented
inside the dialogs that used to mixin the ve.ui.PagedDialog class. This
brings a much cleaner separation of concerns between Dialogs and Layouts
and allows the use of page handling logic without the accompanying
outline logic.

Change-Id: I5efa2f893f4b7e962438b3aff34b737573bbd5ca
2013-10-04 12:09:15 -07:00
jenkins-bot b36c401ec7 Merge "Get rid of 'reversed' flag on transactions" 2013-10-04 06:18:06 +00:00
Roan Kattouw 10bf7b34ca Followup 571d6cac: when the selection changes, undo highlights
Ignoring all bounced change events led to the logic for unhighlighting
the previously selected FocusableNode being skipped. This caused a bug
where if you clicked a FocusableNode, it would stay highlighted even
if you then selected some text, until you highlighted another node
(which would then be highlighted forever, etc.)

Change-Id: Ia8d74ef85eaa47326d49ef6c0f395b44b90da4dc
2013-10-03 15:50:51 -07:00
jenkins-bot 2b46215a2c Merge "Make toolbars, toolgroups and tools toolFactory independent" 2013-10-03 22:42:58 +00:00
jenkins-bot 5ba2dcfe3c Merge "ve.Element: Fallback to body, window is not scrollable" 2013-10-03 22:27:37 +00:00
jenkins-bot c21c8556fc Merge "Make ve.Factory require static name property" 2013-10-03 22:03:26 +00:00
Trevor Parscal 61ddfb76e4 Make ve.Factory require static name property
Objective:
* Make ve.Factory behave like ve.NamedClassFactory
* Remove the only remaining use of ve.Factory (actions)
* Remove ve.NamedClassFactory

Change-Id: Ie302ef5ea31081de7ab0db6091058a59946aef4c
2013-10-03 14:52:19 -07:00
jenkins-bot c98624a7be Merge "When cloning the InternalList, pass through properties that aren't rebuilt" 2013-10-03 21:51:45 +00:00
Trevor Parscal 7297108a48 Make toolbars, toolgroups and tools toolFactory independent
Objectives:
* Pass a specific tool factory into a toolbar, allowing it to be used
  with different collections of tools and not depend on the
  ve.ui.toolFactory global
* Move syntax highlight editor tools to their own factory

Change-Id: I307bf180bd6817bc044bc474a77861e13f431ddb
2013-10-03 21:49:36 +00:00
Roan Kattouw 69ad031bff When cloning the InternalList, pass through properties that aren't rebuilt
InternalList.clone() assumed that all properties are automatically rebuilt
when a new document is built, but that's not true for .nextUniqueNumber
(or for .itemHtmlQueue for that matter). This meant that, in practice,
.nextUniqueNumber was being reset to 0 after auto/N numbers for existing
references had been assigned, but before assigning numbers to newly
created references. This caused all sorts of naming collision fun.

Bug: 54712
Change-Id: I1d087a5f3c23979d7d488e3ab32eb064ebc23e94
2013-10-03 14:43:20 -07:00
Trevor Parscal 1a7a5a9948 Allow menu tool groups to be wider if needed
Using a min-width instead of a width ensures it gets larger only if
needed.

Bug: 54870
Change-Id: I9953d21134d722547efa0cdbe32e1bc0c13d6093
2013-10-03 21:25:46 +00:00
Timo Tijhof f6d409e09b ve.Element: Fallback to body, window is not scrollable
Bug: 54928
Change-Id: Ifec0dae598f7fd99270588bd8ca77777a07e9669
2013-10-03 23:06:47 +02:00