Commit graph

2495 commits

Author SHA1 Message Date
jenkins-bot bc78624cfe Merge "Add ve.now utility function" 2013-07-31 21:56:56 +00:00
jenkins-bot ed8133e317 Merge "Link inspector bug fixes" 2013-07-31 20:54:46 +00:00
Ori Livneh ca98a473c2 Add ve.now utility function
On browsers that implement the Navigation Timing API, performance.now()
provides values with microsecond precision that are guaranteed to be monotonic
(i.e., they are not subject to skew due to changes to the system clock).
This patch adds a `ve.now` utility function that will use this API when it is
available and fall back gracefully to `Date.now` when it is not.

Change-Id: I377025fcb23cb26399b9e437e33c8afa138916af
2013-07-31 13:42:08 -07:00
Timo Tijhof 301eaa4088 mw.ViewPageTarget: Emit position event after toolbar is animated
In target#setUpSurface, both target#setUpToolbar and
target.surface#initialize are called. #setUpToolbar does an
asynchronous animation.

After that animation is completed we call target.toolbar.initialize
and target.surface.context.update.

Right now ce.ProtectedNode needs to update the position of its
shields when the CE Surface changes position (which it does when
the UI Surface changes position because of the UI Toolbar changing
position), and does so by listening to toolbarPosition.

Adding this event to allow it to listen to that instead.

Change-Id: I826986794630c04c34cef6da36ccb15ff7dde49a
2013-07-31 22:15:33 +02:00
Trevor Parscal db3da5d16b Link inspector bug fixes
Formerly known as "The greatest commit in the history of the world*".

* Within a 3 block radius of Drayton Park and Auburt Park, starting
from July 30th at about 9pm or so.

Bugs:

* (bug 51404) Allow escaping out of the link inspector when in creation
  mode (no text is selected, text will be inserted based on link target)
  and the text input is empty
* (bug 51065 and bug 51415) Keep model and view in sync when changing the
  link inspector's text input value and showing options in a menu
* (bug 51523) Either restore selection at the time of close to what it was
  before opening the inspector (when using back) or to what it was before
  closing (might be changed by transactions processed during the close
  method) - this makes it simpler and more natural when clicking away from
  the link inspector, even when there are changes that must be saved by
  the link inspector on close

Bonus:

* Use only the light blue highlight color for menu widget items - the
  checkmark already displays the selected item, the dark blue is just
  masking the current highlight position and confusing the peoples
* Remove links when the user deletes everything from the link inspector's
  text input and then closes the link inspector
* Replace select menu's evil "silent" selectItem/highlightItem argument
  with a new method called initializeSelection which sets both selection
  and highlighting to an item without emitting events - this is needed
  when synchronizing the view with the model so the model isn't
  immediately told to change to a value it already has
* Make the MWTitle lookup menu not flash like crazy as you type (this was
  caused by a copy-paste oversight overriding
  initializeLookupMenuSelection unnecessarily)

Bug: 51404
Bug: 51065
Bug: 51415
Bug: 51523
Change-Id: I339d9253ad472c2f42c3179edc84a83d27561270
2013-07-31 17:42:14 +00:00
jenkins-bot 6828804d27 Merge "Language Inspector UI" 2013-07-31 07:14:56 +00:00
jenkins-bot e8d9f09ecf Merge "ve.ui.Toolbar: Refactor floating logic for performance" 2013-07-30 22:31:47 +00:00
jenkins-bot 3585019892 Merge "Don't duplicate categories when unlisting" 2013-07-30 22:24:43 +00:00
jenkins-bot 40e712985c Merge "Add keyboard shortcut for 'clear' button" 2013-07-30 00:51:19 +00:00
jenkins-bot 19a2b7d018 Merge "Add the special 'clear' (12) button to ve.ui.Trigger" 2013-07-30 00:47:13 +00:00
Roan Kattouw 55aaf56038 Don't duplicate categories when unlisting
op !== operation in all iterations of this loop except the first,
and using information from one operation to apply another one
doesn't work very well.

The fact that undefined cast to a number is NaN rather than 0
is very unhelpful :(

Also fixed some commas that should be semicolons.

Bug: 52238
Change-Id: I4138c023c955f2866881084506e24bb8b6db5a4d
2013-07-29 17:23:42 -07:00
James D. Forrester bc3cc9bbdc Add keyboard shortcut for 'clear' button
Now Ctrl+\ (Cmd+\ on Mac) will trigger the 'clear annotations' button
on the current context. Ideally we'd also bond to the 'clear' keyboard
button (ASCII 12) but it does not seem possible to do that yet.

Bug: 51507
Change-Id: I300ec1ffa237e51418ec429be39001f820f053ae
2013-07-30 00:14:17 +00:00
Timo Tijhof 14343c7bf7 ve.ui.Toolbar: Refactor floating logic for performance
== Renamed methods ==

* enableFloating  -> enableFloatable
* disableFloating -> disableFloatable
* setPosition     -> float
* resetPosition   -> unfloat

== Scroll and resize event ==

Timeline for scroll event reduced from about half a dozen
"Recalculate style" and various forced "Paint" down to 0.

New timeline for scroll is clean (for me: from ~35 to ~59 fps):
* 1 Event (scroll)
* 1 Composite Layer

The composite layer action is the browser changing the viewport
to a different portion of the document drawing. Exactly the one
thing a simple scroll should do.

Timeline for resize event is still pretty crowded and low fps,
but it has improved. Further improvement would likely be around
using requestAnimation and going outside ve.ui.Toolbar.

== Changes ==

* New: ve.ui.Toolbar#initialize.
  Similar to what surface has. Users of Toolbar should decide
  whether to call enableFloatable, append it to the DOM at some
  point and then call initialize() once.

* Don't compute offset() every time.
  Eliminated by doing it once in #initialize. These 'top' and
  'left' offsets do not change.

* Don't compute outerWidth() and $window.width() every time.
  Reduced by doing it once in #initialize to compute the 'right'
  offset. Updating it only on resize.

* Don't set 'top' every time.
  This is already in the stylesheet. It was never set to anything
  else so the abstraction for it in #float has been removed.
  This also made it obvious that code for "ve-ui-toolbar-bottom"
  was unused and left behind. Tha class was only ever being
  removed from something (never added).
  The one addClass call for it was in a condition that is always
  false ("if top > 0").

* Don't set 'left' every time.
  Eliminated by doing it once in #float.

* Don't set 'right' every time.
  Reduced by no longer doing it on scroll. Done once in #float,
  and on resize after computing the new value for it.

* Remove no-op style operations.
  Wrapped methods in if-floatable, if-floated etc. to reduce a
  fair amount of easily avoided re-paint overhead.

* Avoid double re-paint in mw.ViewPageTarget.
  Though we prevent a lot of redundant re-paints now, whenever
  we do repaint we want to do it in 1 repaint instead of 2.

  ve.ui.Toolbar emits #toolbarPosition, which tells
  mw.ViewPageTarget to update toolbarTracker which would read
  the new $bar style properties and copy them over to the
  $toolbarTracker. However, this read operation forces the browser
  to do an immediate re-paint half-way just for $bar.

  Browsers only repaint when style properties are changed and
  JS has yielded. The exception to this is JS reading style
  properties: in that case the browser is forced to do those
  deferred repaints directly and reflect the new values.

  We can avoid this double repaint by passing the updated values
  as data instead of requiring the receiver to read the DOM (and
  thus a keep the deferred repaint). Now toolbarTracker can use
  them directly whilst the browser hasn't even repainted $bar yet.

== Clean up ==

* Redundant "border-radius: 0". This would reset something, but
  it never does. None of the things it inherits from set a
  border-radius. There is one subclass where toolbar is used
  with a border-radius (".ve-ui-surfaceWidget .ve-ui-toolbar-bar"
  sets a border-radius) which overrides this on purpose, so the
  default of 0 is redundant.

* Pattern "if ( .. ) addClass() else removeClass()" changed to:
  "toggleClass( , .. )"

Bug: 52014
Change-Id: I9be855148962eee068a77fe83e98eb20bbdcfeec
2013-07-30 01:47:54 +02:00
Timo Tijhof 44623c9b2a ve.copy: Remove obsolete copyArray and copyObject
These have been pointing to the same method for a while now,
we can safely remove these obsolete aliases and just use it
as generic copy.

* Each file touched by my editor had its new line at EOF fixed
  where absent
* Don't copy an otherwise unused empty object
  (ve.dm.Converter)
* Use common ve#copy syntax instead to create a link
  (ve.dm.Document, ve.dm.example)
* Remove redundant conditionals for isArray/copyArray/copyObject
  (ve.dm.example)

Change-Id: If560e658dc1fb59bf01f702c97e3e82a50a8a255
2013-07-30 01:44:22 +02:00
James D. Forrester f4882b3b49 Add the special 'clear' (12) button to ve.ui.Trigger
Change-Id: I407d9a026348e5385c6e3d3476970e64948fc2f6
2013-07-29 16:41:28 -07:00
jenkins-bot 0ec6008c32 Merge changes Icce6c192,If1bcc3ee
* changes:
  Make <nowiki>s non-experimental again
  Don't compare annotations directly with ve.compare()
2013-07-29 19:47:26 +00:00
jenkins-bot 7021e0ab46 Merge "ve.ce.Surface: Prevent focus loss on the document node in Opera" 2013-07-29 17:17:47 +00:00
Moriel Schottlender 59079978ff Language Inspector UI
This is the language inspector UI engine with ULS core.
The Language Inspector works alongside ULS to choose and change language
blocks in text. The inspector was based on ve.ui.TextInputWidget and
now changed to inherit ve.ui.Widget and display details in a table
instead of an input textbox.

Added jQuery.ULS module:
* Repository: https://github.com/wikimedia/jquery.uls
* Latest Commit 728f112ffc90b03b50c0109487886a2647f12020
* Taken 'src' / 'images' and 'css' folders into modules/jquery.uls

Bug: 47759
Change-Id: I3c9fd6c135c05a54f6c7fc28c5962fc0a6677806
2013-07-29 00:38:59 -04:00
Roan Kattouw 83e1888275 Don't compare annotations directly with ve.compare()
Annotations' attributes might contain DOM elements, which cause infinite
recursion in ve.compare(). Annotation classes can protect against this
by overriding getHashObject() to summarize DOM nodes, but that doesn't
help if that's not respected everywhere.

Instead, compare the hash objects, those are safe. This does not appear
to be a problem in practice, currently, because the nowiki annotation
is experimental, oo.compare() now short-circuits if a === b, and because
of optimizations in openAndCloseAnnotations() which lead to the relevant
compareToForSerialization() code path being taken very rarely.

Bug: 51948
Change-Id: If1bcc3eee4fd14d107db1935d89dcc5516643b53
2013-07-28 00:10:42 +00:00
jenkins-bot 6355d9937f Merge "Fix the newline bunny-hop bug" 2013-07-27 18:07:07 +00:00
jenkins-bot 4bdc621e62 Merge "ce: Don't set backgroundColor transparent for every node in debug mode" 2013-07-27 04:06:52 +00:00
Timo Tijhof 3b6810eeec ce: Don't set backgroundColor transparent for every node in debug mode
This only affects debug mode, but things look broken when the
background of every single node is set to transparent (e.g. a
<pre> looks weird with a white instead of grey background).

It also leaves the DOM dirty full of inline styles.

Though setting a grey background isn't guaranteed to be visible
either, and all of these redraws and stuff really slow things
down (we should perhaps only start doing these after the initial
document is painted).. the least we can do is undo it and not
leave it there.

Change-Id: I9abfd46765914828ad8618748be5716a8c6b185c
2013-07-27 04:05:07 +00:00
Ed Sanders a9d391272e Speed up openAndCloseAnnotations by using store indexes
By using annotation indexes only we can avoid a lot of
ve.getHash calls. This reduces the number of getHash calls
on load of [[:en:Argentina]] from ~60,000 to ~2,000.

Bug: 52013
Change-Id: I0bc9aa8feea5f7e4e90a5fcd829de57cab803c15
2013-07-26 18:11:01 -07:00
jenkins-bot cd898d07b6 Merge "Rename index to offset in AnnotationSet" 2013-07-27 01:06:01 +00:00
Roan Kattouw 4041d3f342 Fix the newline bunny-hop bug
We would dirty-diff "</span>\n<!-- comment -->\n<span>" to
"</span>\n\n<!-- comment --><span>", i.e. the second newline made
a bunny-hop to the left over the comment.

The actual bug turned out to involve a double bunny-hop, with
"</span> <!-- comment -->\n<span>" turning into
"</span>\n <!--comment --><span>", i.e. the newline bunny-hops
both the comment and the space.

This happened because outputWrappedMetaItems() didn't take
wrappedWhitespace into account when restoring meta items and
associated whitespace. I hacked a check for wrappedWhitespace into it,
but we should really just rewrite this pile of hacks into a unified
system for queuing and processing both whitespace and metadata.

Change-Id: I4375f4c07983ffec6877d0371aeaa9bf6e65fd6e
2013-07-26 16:24:27 -07:00
jenkins-bot fe40b86e74 Merge "Quick optimisation to avoid containsComparableForSerialization" 2013-07-26 23:14:01 +00:00
Ed Sanders f11db48234 Rename index to offset in AnnotationSet
To avoid confusion between IV store indexes and the index
within the set, rename them to storeIndex and offset.

Change-Id: Ic7d741bd5d39240d63fdc04a2df45658a64441de
2013-07-26 23:04:01 +00:00
Ed Sanders 017b947464 Quick optimisation to avoid containsComparableForSerialization
As that method makes expensive ve.compare calls, we can quickly
avoid most cases by testing AnnotationSet#contains first.

On page load this reduces the number of ve.compare calls on
[[:en:Argentina]] from ~6,000,000 to about ~2,000.

Also reduces ve.compare calls per backspace keystroke from
~300 to 2.

We can optimise this further, but this is a good simple start.

Bug: 52013
Change-Id: Ie3b4517fd13383c48acb64b3c4e82051c34e7484
2013-07-27 00:03:11 +01:00
Trevor Parscal f822e2b7c6 Cleanup code icon
Sharper!

Change-Id: I68a8895ca1bb652e09d66db4ce7abd68cf0a3e99
2013-07-26 13:07:40 -07:00
jenkins-bot b8ea6a22ac Merge "Code annotation button" 2013-07-26 19:41:34 +00:00
Ed Sanders fadd7c46a2 Code annotation button
Pretty straightforward, although we should start thinking about
grouping/hiding 'advanced' formatting options in the toolbar.

Making this button experimental for now until we've come up with
a way to deal with this problem.

Bug: 51590
Change-Id: Ieb1935b742aced4b883d8a194e6cb69be68473d0
2013-07-26 12:36:34 -07:00
jenkins-bot 8768d59e13 Merge "Code annotation icon" 2013-07-26 19:33:42 +00:00
jenkins-bot afcd539eb1 Merge "'CodeScript' => 'Code'" 2013-07-26 19:31:18 +00:00
Ed Sanders f689c8735b Code annotation icon
Change-Id: I16330c11a2f67a8b5fb09be70a809460b3731484
2013-07-26 11:21:36 +00:00
Ed Sanders 7c452a234f 'CodeScript' => 'Code'
I assume this was a copy-paste error from subscript above.

Bug: 51590
Change-Id: I8351fd7e272812017e0e9cfdd76e3da4745119d3
2013-07-26 11:26:51 +01:00
jenkins-bot 33f6588216 Merge "Regress RTL fix transclusion icon" 2013-07-25 22:38:05 +00:00
jenkins-bot 5fdc9abdc8 Merge "doc: Clean up spacing that caused <pre> or broken <ul>/<ol>" 2013-07-25 22:36:41 +00:00
jenkins-bot 7b84716b55 Merge "Optimise history stack truncation" 2013-07-25 22:11:30 +00:00
jenkins-bot 280e05afb1 Merge "Fix CSS lint error" 2013-07-25 17:21:55 +00:00
Ed Sanders 7874b39291 Fix CSS lint error
"Background image 'images/icons/italic-k.png' was
used multiple times"

Change-Id: Ib6a497021fe871c4597a80be91a259689b5d537b
2013-07-25 18:19:40 +01:00
Ed Sanders 7e9b4fafd3 Optimise history stack truncation
If undoIndex is 0 then we don't need to do anything, or even
emit the history event which is quite expensive as it triggers
various node redraws.

Bug: 52012
Change-Id: I09ca2d6cd0f4cbaf8316819dab0bd6edfc5de62c
2013-07-25 14:33:51 +01:00
Timo Tijhof 08610a4ecb doc: Clean up spacing that caused <pre> or broken <ul>/<ol>
Whenever there is more than 2 spaces (except the extra space
on a continued line of an @ tag, or the extra space on a
continued line of a list item) it causes a <pre> context.

Removed both spurious spaces that caused a <pre> and ones that
didn't but looked like it could.

When making an ordered or unordered list, the first item needs
to be on a new line and in block context (e.g. an empty line
before it). Otherwise it is rendered inline as 1. Foo 2. Bar
(such as in #rebuildNodes where both the ordered and unordered
lists were broken).

Change-Id: Id0f154854afbdc8e5a8387da92e6b2cdf0875f69
2013-07-25 04:02:50 +02:00
Moriel Schottlender c81228f8ea Regress RTL fix transclusion icon
The fix to the transclusion icon messed up the way inspectors appear in RTL
wikis. The rtl check/correction (inside 'this.embedded') seems to be the only
rtl fix necessary. Something completely different will have to be done to the
transclusion icon.

Change-Id: I2417e125c99de9b0c5fd922a47de43ed9952d6fd
2013-07-24 20:28:32 -04:00
Ed Sanders 541bd0b063 Add bold/italic icons for be-tarask
Also move 'en' into alphabetical order, because we're not special.

Change-Id: I4a34a570444655460d470deb1d624877a38d3adb
2013-07-24 16:35:23 +01:00
jenkins-bot 8e8aec5f3a Merge "Split continued link annotations on wordbreaks" 2013-07-24 14:43:45 +00:00
jenkins-bot 7b5af5bc79 Merge "Make ButtonWidgets more accessible" 2013-07-24 14:40:36 +00:00
Ed Sanders 049bbf7b73 Make ButtonWidgets more accessible
* Give them a role=button, and a default tabIndex of 0
* Listen for a keypress of 'space' and emit a click event
  (you'd have thought role=button would do this, but oh well)

Bug: 50047
Change-Id: I429ad165c95f34d26975daf81db18cc966802cde
2013-07-24 14:34:06 +00:00
jenkins-bot 12b250a929 Merge "Handle meta-only transclusions as meta items" 2013-07-24 14:29:21 +00:00
Ed Sanders cdfed7039f Handle meta-only transclusions as meta items
To achieve this we need to evaluate the DOM contents of
transclusion nodes to see if it consists solely of meta items
and whitespace.

To check for meta items we do a model registry match, but with an
additional parameter to exclude mwTransclusion types as a possible
result (as the first item may be a meta tag, but with a mw:Transclusion
typeof attribute).

Bug: 51322
Change-Id: I89a220350fb7e10e15f3682d21438539196a5846
2013-07-24 14:27:24 +00:00
Ed Sanders 3f3e0c0721 Split continued link annotations on wordbreaks
For now this approach is bit of a hack and will hopefully
be replaced with an ability to cursor either side of an
annotation.

Bug: 51463
Change-Id: I701e3d26e06a28fed2d4950b1d418eda80a1fac5
2013-07-24 11:50:26 +01:00
jenkins-bot 8b201c7dc4 Merge "Quickfix for Transclusion icon in RTL wikis" 2013-07-24 03:45:01 +00:00
Moriel Schottlender 5bb15c4332 Quickfix for Transclusion icon in RTL wikis
Added GUI-level and Page-level "getDir()" methods to get the direction
of the GUI and Page respectively in the ve.ui.Surface and ve.ce.Surface
respectively.

The correction to the direction-test condition in ve.ui.Context reflects
the new method of getting these directions, and fixes the problem with
the transclusion icon. The icon position depends on the wiki/page-level
directionality, regardless of the GUI-level direction.

Bug: 51819
Change-Id: I36cef115017542c461e6d757f1c8bfda92074607
2013-07-23 20:31:08 -07:00
jenkins-bot 292981746c Merge "Add bold/italic for cyrillic/georgian languages" 2013-07-24 02:24:56 +00:00
jenkins-bot 8b493a7e02 Merge "Add bold/italic for more latin langages" 2013-07-24 02:23:38 +00:00
jenkins-bot 6ca420ab60 Merge "Prepend section title to edit summary" 2013-07-23 23:02:15 +00:00
jenkins-bot 598b975171 Merge "RTL Fix for Category & Suggestion Popups" 2013-07-23 22:44:56 +00:00
Moriel Schottlender 12372b41c9 RTL Fix for Category & Suggestion Popups
Flipped the generated positions of the MWCategoryPopupWidget and the
suggestion popup in the TextInputMenuWidget. The RTL position within
TextInputMenuWidget is only adjusted if the popup appears inside another
frame. This fix also corrects the suggestion popup positions in general
when inside another frame.

Bug: 51490
Bug: 51828

Change-Id: I83436d50a4a0596fdae9526c3fc2804cf880a530
2013-07-23 15:43:06 -07:00
Ed Sanders 4e17496fa6 Prepend section title to edit summary
When section edit links are used.

Bug: 50872
Change-Id: I44cef7a892b4f2f22f60f8f7f531f4e9dcfe8363
2013-07-23 22:27:33 +00:00
jenkins-bot 6728b24f1c Merge "Add ve#graphemeSafeSubstring method" 2013-07-23 21:08:38 +00:00
jenkins-bot 2ceead1258 Merge "Ensure ve-ui-panelLayout-scrollable is actually scrollable" 2013-07-23 18:57:41 +00:00
Ed Sanders c6c6a431d1 Add ve#graphemeSafeSubstring method
Allows us to take a substring without splitting a multibyte grapheme.

Change-Id: I811bdc7f010d10bf3c9509a73677939486751fec
2013-07-23 10:45:23 +01:00
MatmaRex e6fd823d6f ve.ce.Surface: Prevent focus loss on the document node in Opera
Opera triggers 'blur' on the document node when clicking on any <a>
link and never trigger 'focus' until after the user blurs the document
node *again* (by clicking outside of it or pressing 'Esc').

This causes the change polling to stop (SurfaceObserver#stop is called
without a subsequent call to SurfaceObserver#start).

To avoid this let's bind a delegated 'focus' event on all <a> links
inside the document and refocus it whenever that happens.

Bug: 47793
Change-Id: I7962f59bd02e075f91e42e6514b390c0d0feb3ab
2013-07-22 21:09:52 +02:00
jenkins-bot e57d8709cf Merge "Array.prototype.splice polyfill for Opera" 2013-07-22 18:40:01 +00:00
Ed Sanders e7d423dd53 Add bold/italic for cyrillic/georgian languages
ru, ky, os, ka now covered

Bug: 51711
Bug: 51712
Bug: 51713
Change-Id: I07987361f18719e96f5cb1b5a2b5eb8987fbf207
2013-07-21 18:32:47 +01:00
Ed Sanders 1b5d950904 Add bold/italic for more latin langages
es, eu, fr, gl, hu, it, nl, pt(-br) all covered now.

Bug: 51702
Bug: 51703
Bug: 51704
Bug: 51705
Bug: 51706
Bug: 51707
Bug: 51709
Bug: 51710
Change-Id: Ie75cc0941245dffabf64f09d649982ba48fae340
2013-07-21 14:09:19 +01:00
MatmaRex 47edc8d7d0 Ensure ve-ui-panelLayout-scrollable is actually scrollable
Due to CSS specificity rules the styles defined for
.ve-ui-panelLayout-scrollable and .ve-ui-panelLayout-padded in
ve.ui.Layout.css were being overriden by more general rules for
.ve-ui-pagedDialog-pagesPanel .ve-ui-panelLayout in ve.ui.Dialog.css.

Bug: 51739
Change-Id: If2d5ec3168a874eb4f856450583d6c89967513df
2013-07-20 13:21:05 +02:00
jenkins-bot 47fec91adb Merge "Set Malayam to use B/I rather than A/A for toolbar icons" 2013-07-19 20:27:28 +00:00
James D. Forrester 7c477d3021 Set Malayam to use B/I rather than A/A for toolbar icons
This is how it is configured in WikiEditor; presuming that this is not
incorrect. :-)

Bug: 51314
Change-Id: If285c14d8a798c57924af04c1dabfe6cf53e018b
2013-07-19 13:19:07 -07:00
jenkins-bot 21e47c5a33 Merge changes I2edc46b6,Iea905f2b,Ia572fd06,Id81da87b,I98a7d3eb
* changes:
  Add a node class for mw:Nowiki
  Move getHashObject() from dm.Node up into dm.Model
  Allow annotations to render nothing
  Pass child DOM elements to annotations' toDomElements()
  Process annotations bottom-up rather than top-down in data->DOM
2013-07-19 19:11:38 +00:00
James D. Forrester 79aff53400 De-alienate <code>foo</code> blocks (code element)
Adding the <code> element as a matched text style annotation, plus some
tests (for all the other un-tested text styles as well, whilst I'm at
it).

We'll need an icon, a button and a way of the buttons not forever
extending the length of the toolbar to properly edit <code> spans, but
this is a start.

Bonus: unit test coverage for all TextStyleAnnotations

Bug: 51590
Change-Id: I5438bcf2ec6eeb2e50400f8013964f91c33ce455
2013-07-19 00:48:46 +00:00
jenkins-bot a2ea33fb95 Merge "Handle backspace correctly when in a slugs" 2013-07-18 22:20:05 +00:00
Trevor Parscal 61ba07d409 Reference dialog commingling
Objectives:

* Merge reference insert and edit dialogs
* Change workflow to put editing/creating a new reference first
* Add secondary page in dialog for selecting an existing reference

Changes:

*.php
* Cleanup unused files/messages

ve.ui.Dialog.css
* In the footer; make primary, constructive and destructive buttons
  appear on the right; all others on the left

ve.ui.MWReferenceSearchWidget.js
* Fix documentation
* Remove create option and reuse section header items

ve.ui.MWReferenceInsertButtonTool.js,
ve.ui.MWReferenceEditButtonTool.js,
ve.ui.MWReferenceButtonTool.js
* Merge reference button tools

ve.ui.MWDialog.css
* Remove body styles, use padded option of layout instead
* Update selectors as per merging of dialogs

ve.ui.MWReferenceInsertDialog.js
ve.ui.MWReferenceEditDialog.js
ve.ui.MWReferenceDialog.js
* Merge reference dialogs
* Add buttons to switch between edit and select mode

ve.init.mw.ViewPageTarget.js
* Update reference button name as per merging of tools

ve.ui.SurfaceWidget.js
* New widget!
* Encapsulates a "sub-surface"

Bug: 51152
Bug: 50458
Change-Id: I8265febf4fd8f64d2ac40470ff033bac68b24d99
2013-07-18 14:14:14 -07:00
jenkins-bot 565cb99e23 Merge "Update static loaders" 2013-07-18 16:40:10 +00:00
jenkins-bot 458c8757db Merge "Fix ordering of store items in converter tests" 2013-07-18 16:38:55 +00:00
Ed Sanders c414147b5a Handle backspace correctly when in a slugs
We need to detect if the endNode we are trying to move is
inside our original delete selection, and not perform the
move if it is.

Bug: 50076
Change-Id: Ib89706c8717d13829bf89e44c4fb39e16a00821e
2013-07-18 12:33:42 +01:00
Timo Tijhof 1c97668377 Update static loaders
Ran makeStaticLoader.php:
- Synced mis-match of css in demos.
- Added missing experimental.
  We originally had experimental in static. They were removed
  because the section became empty (not because we no longer
  wanted them in static loader). If we don't want them here, we
  should remove the entry from makeStaticLoader.php.

Change-Id: I275133d1cfebf174e54bf1b8f44465495949991a
2013-07-18 04:19:42 +02:00
Trevor Parscal 51ecf6d096 Fix for scrollable panels
Fixes mistake made in I50e996b9d2fde361238cde75e09baa5872e12223 which made scrollable panels not be, well scrollable.

Change-Id: I0ec59a1b76acf047b1a4d6de426a0ddb554a3e42
2013-07-17 17:17:01 -07:00
Trevor Parscal ef262dc241 Add padded option to layouts
Objectives:

* Add option to layouts to control whether it's padded or not
* Rename "scroll" option to "scrollable" to better fit with it's boolean value

Changes:

ve.ui.Layout.css
* Add styles for scrollable and padded options

ve.ui.StackPanelLayout.js, ve.ui.PagedDialog.js, ve.ui.ReferenceListDialog.js
* Update use of scroll option

ve.ui.PanelLayout.js
* Add padded option
* Rename scroll option to scrollable
* Switch to using a class for scrollable option, rather than hardcoding CSS properties

Change-Id: I50e996b9d2fde361238cde75e09baa5872e12223
2013-07-17 19:10:44 +00:00
Trevor Parscal 3da34d7107 Fix getAnnotationIndexesFromOffset for last offset in doc
If the element is undefined, it would stand to reason that there are no annotations there.

Just sayin'.

Change-Id: I2b66e7adc2b3af19df1a3f490ab479627807636e
2013-07-17 19:10:38 +00:00
Roan Kattouw 779099e660 Fix ordering of store items in converter tests
In the DomFromData tests, we put the provided storeItems in the store
first, then run preprocessAnnotations (which puts annotations in the
store). However, in DataFromDom we ran preprocessAnnotations first
(which puts annotations in the store), then ran getDataFromDom (which
is expected to put the asserted store items in the store). Because the
order was reversed between these two tests, it was impossible to write
a test for an annotation whose toDataElement function adds to the store.

Fix this by reordering the operations in the DataFromDom test, doing the
conversion first and only then running preprocessAnnotations on the
expected data. This preprocessAnnotations call will not write to the store
if the test passes, because all annotations in the expected data should
already have been put in the store by the conversion.

Change-Id: I8f741d96fe12590fd711542794570fb95b1132d0
2013-07-16 19:06:48 -07:00
Roan Kattouw 4098e47b8b Move getHashObject() from dm.Node up into dm.Model
This way annotations inherit it too.

Also add htmlAttributes to the hash, and implement getComparableObject()
in terms of getHashObject().

Change-Id: Iea905f2b430f8e51c6026065be17b89b9a03cfab
2013-07-16 19:04:53 -07:00
Ed Sanders 56ef8cb5b5 Create MWResizeableNode mixin to control defaultSize flag
Previously wasn't being updated to 'false' after a width/height
attribute change.

Bug: 50645
Change-Id: Id5dcd6998e0125757238426f8052505d131d712d
2013-07-16 23:13:40 +01:00
Roan Kattouw 46c5192477 Allow annotations to render nothing
This effectively unwraps the annotation. Annotations can do this by
returning an empty array from their toDomElements() function.

Right now this is only supported for annotations, but once the converter
is rewritten to be entirely bottom-up, this is trivial to support for
other model types, and could even be used to implement unwrapping of
wrapper paragraph.

Change-Id: Ia572fd0610afccccfe795c257c0de9d003330f13
2013-07-16 15:09:08 -07:00
Roan Kattouw 2942fa8fa0 Pass child DOM elements to annotations' toDomElements()
This is special-cased for annotations but should be supported for
all model types once the converter is rewritten to be bottom-up
entirely.

Add a toDomElements() stub to ve.dm.Annotation overriding the stub
in ve.dm.Model so there's a place for the new parameter to be documented.

Change-Id: Id81da87b8b83d556a3618cc6187b22443a1e37e6
2013-07-16 15:09:08 -07:00
Roan Kattouw 15a7822df1 Process annotations bottom-up rather than top-down in data->DOM
This means that instead of creating a DOM element for an annotation,
then appending stuff to that DOM element, we queue up the things to
append and only create the DOM element after we've built everything
that's going to be in it.

Most significantly, this moves the toDomElements() call to the close
function, which paves the way for passing in the annotation's contents.

Change-Id: I98a7d3ebb0f3eb8627c22348b48596906db2646e
2013-07-16 15:09:05 -07:00
Roan Kattouw ce3014c768 Remove superfluous clear() when pawning
We already call clear() 4 other times in this code path, including
one right at the end of change(), which is called right before this
clear() call.

Change-Id: I6d5ba5075e1b24a981546243977c6a8501748c5f
2013-07-16 00:37:51 +00:00
jenkins-bot a4558108b8 Merge "Adjust padding for surfaces inside dialogs" 2013-07-16 00:37:22 +00:00
jenkins-bot 55493f7f9e Merge "Reset context menu on selection change while inspector is open" 2013-07-16 00:34:16 +00:00
Roan Kattouw f9864e9288 Continue links
This isn't as simple as just dropping applyToAppendedContent = false
on LinkAnnotation, because browsers differ in their continuation
behavior. Firefox continues links, but Chrome doesn't.

To work around this, add a property indicating that the annotation
needs its continuation behavior to be forced.

Rename areAnnotationsCorrect() to needsPawn() accordingly.

Bug: 49931
Change-Id: Id6424af89c92bba2be87736e8a937e0f2067c007
2013-07-16 00:29:55 +00:00
jenkins-bot 0ffc4d15ca Merge "Remove field set label on reference edit dialog" 2013-07-15 23:56:16 +00:00
jenkins-bot 78d58e637c Merge "Make the clear button clear insertion annotations too" 2013-07-15 23:54:45 +00:00
Trevor Parscal 0ba331afdc Reset context menu on selection change while inspector is open
Objective:

* Make the inspector close and context menu reset when the selection is
  changed while an inspector is open

Changes:

ve.ui.PopupWidget.js
* Add isVisible method

ve.ui.Context.js
* Check if popup is visible when the selection changes and close the
  inspector and reset the context if it is

ve.ui.AnnotationInspector.js
* Don't update the selection when closing if the selection has changed
  since opening

Bug: 50895
Change-Id: Ie7f0b7ac76b0460b39ec002705172376e4e602dc
2013-07-15 23:51:40 +00:00
Roan Kattouw fd6238d62f Make the clear button clear insertion annotations too
There previously was no way to clear them other than to manually
unset each one.

Change-Id: I553d224595e424cb8a743ea70031503d1fe00b6a
2013-07-15 16:48:08 -07:00
Trevor Parscal 09f920fcac Remove field set label on reference edit dialog
Objective:

* Allow fieldsets to not have labels
* Remove label from reference edit dialog field set

Changes:

ve.ui.Layout.css
* Only apply negative top margin if fieldset label is being used

ve.ui.FieldsetLayout.js
* Only add label element to DOM if icon or label are used

ve.ui.MWReferenceEditDialog.js
* Remove label from reference edit dialog's first fieldset

*.php
* Remove unused message

Change-Id: I4a36e819ec6ef73aad80d3fb2f06000cb35ec109
2013-07-15 23:44:07 +00:00
Trevor Parscal 130e446e52 Single-click insertion
Objectives:

* Reduce the number of clicks and mouse maneuvers required to insert
  media, references or template parameters
* Make use of highlighting with mouse movement or arrow key presses,
  similar to menus, to suggest action when clicked
* Improve the way media search results look and feel

Changes:

ve.ui.SelectWidget.js
* Add mouseleave handler to un-highlight when the mouse exits the widget
* Document highlight events (already being emitted)

ve.ui.SearchWidget.js
* Propagate both select and highlight events from results widget
* Make arrow keys change highlight instead of selection
* Get rid of enter event, make enter key select highlighted item instead
* Provide direct access to results widget through getResults method

ve.ui.MenuWidget.js
* Use the selected item as a starting point if nothing is currently
  highlighted when adjusting the highlight position

ve.ui.Dialog.js
* Add footless option to hide the foot element and make the body extend
  all the way down to the bottom
* Remove applyButton, which only some dialogs need, and should be creating
  themselves, along with other buttons as needed

ve.ui.Widget.css
* Change highlight and selected colors of option widgets to match other
  selection colors used elsewhere
* Leave selected and highlighted widget looking selected

ve.ui.Frame.css
* Add background color to combat any color that might have been applied to
  the frame body in the imported CSS from the parent frame

ve.ui.Dialog.css
* Add rules for footless mode

ve.ui.MWReferenceResultWidget.js,
ve.ui.MWParameterResultWidget.js,
ve.ui.MWMediaResultWidget.js
* Allow highlighting

ve.ui.MWParamterSearchWidget.js
* Switch from selecting the first item when filtering to highlighting

ve-mw/ve.ui.Widget.js
* Adjust media result widget styling to better match other elements

ve.ui.MWTransclusionDialog.js,
ve.ui.MWReferenceListDialog.js,
ve.ui.MWReferenceEditDialog.js,
ve.ui.MWMetaDialog.js
ve.ui.MWMediaEditDialog.js
* Add apply button, as per it being removed from parent class

ve.ui.MWTransclusionDialog.js,
ve.ui.MWReferenceInsertDialog.js,
ve.ui.MWMediaInsertDialog.js
* Insert parameter/reference/media on select, instead of clicking an
  insert button
* Use 'insert' instead of 'apply' as argument for close method

Bug: 50774
Bug: 51143
Change-Id: Ia18e79f1f8df2540f465468edb01f5ce989bf843
2013-07-15 23:42:56 +00:00
Ed Sanders 267ccf9040 Compare annotations by name only when clearing/toggling
Otherwise links don't get removed as an empty link is not
comparable to a real link with an href.

Bug: 50461
Change-Id: Id8b421bd44cd5c427d0e5cd738c380bc2b1ea719
2013-07-16 00:05:11 +01:00
Trevor Parscal 64548428ca Adjust padding for surfaces inside dialogs
Objective:

* Make horizontal and vertical padding of surfaces inside dialogs equal

Change-Id: I8672a4506cdbda59795b12236526b048aaadfa58
2013-07-15 15:44:46 -07:00
jenkins-bot 4854b00770 Merge "Replace text strings with grapheme arrays in onContentChange" 2013-07-15 22:10:20 +00:00
Ed Sanders 4af4f7928d Replace text strings with grapheme arrays in onContentChange
Was previously generating incorrect transactions when document
contained multibyte characters.

Bug: 51140
Change-Id: Ie5f749768f970b2aef09e667f844d2ef5961207b
2013-07-15 22:57:40 +01:00
James D. Forrester 9b1bc14779 Set bold/italics icons for cs/he/pl; da/no/nn/sv
Per bug 51330, cs (Czech), he (Hebrew) and pl (Polish) should use the same icons
as English (B for bold, I for italics), rather than the generic As; da (Danish),
no (Norwegian Bokmål), nn (Norwegian Nynorsk) and sv (Swedish) should use those
that German (F for bold, K for italics).

Bug: 51330
Change-Id: I1d5937bed658d45ba6a18d8eb77e9e20d55a16cc
2013-07-15 12:29:04 -07:00