Localisation updates from https://translatewiki.net.

Change-Id: Id5148bca50d84afa3e1daa7ed5cfa81e64c39652
Localisation updates from https://translatewiki.net.

Change-Id: Ib8f404eb805a2ef5f848b926722ca9a3b198892c
Update grunt-css-url-embed

Includes my upstream patch to fix running on files
without images to embed.

Change-Id: Iff2fb692e68a64ecc552ce1aa4b48edaab097e10
Localisation updates from https://translatewiki.net.

Change-Id: Ic48bedc4cc91d6bf30ea2809196e8f2ccb39b26a
Localisation updates from https://translatewiki.net.

Change-Id: I7fd290801b97e8f15476d7bb0a753726b2dfc5ca
Localisation updates from https://translatewiki.net.

Change-Id: Ic00c0dd36d6e176b5e486bd4c6d6eba65f4133cb
ve.ce: Remove hacks from Surface#onDocumentKeyPress; add related IME test

We had a hack in place to filter out non-character keys, to prevent
unexpected content deletion (caused by pawning) when selection is not
collapsed and the user presses, for example, the Home key (Firefox
fires 'keypress' for it). Pawning is gone since 40101e42 and this
seems no longer needed.

Added an IME test for the described situation.

Bug: T69367
Change-Id: I277b92b9d11bfda01a92f3e615ca674feb920a1a
imetests: Add a regression test for Polish keyboard input

Using AltGr+a to input 'ą', then inputting 'a'.

I reverse-engineered how to do this based on David's older commits.

Bug: T69367
Change-Id: I94e52fc437af729ff8cfa814346d8c338233c612
Merge "ve.ce.TestRunner: Don't assume there is a 'changeText' before 'endLoop'"
ve.ce.TestRunner: Don't assume there is a 'changeText' before 'endLoop'

Necessary for the test being added in I94e52fc4 to pass.

Change-Id: I06c176c305e1c12c5e9fd3abcbd36d2706283240
Localisation updates from https://translatewiki.net.

Change-Id: Ib53a315ce5fabee397744639ad8786be99ccf3c8
Destroy toolbar dialog manager when surface is destroyed

Change-Id: I05e6f158ab69306a730d42b06b68a224ef7f3d6f
Merge "demo: Unbreak eventLogger.html and eventSequencer.html"
Localisation updates from https://translatewiki.net.

Change-Id: I8bc93460440a70e8744afe4b91fa31ae04521ef1
Update stylsheets from direction on init

Firefox ignores the disabled attribute so make sure they
are disabled programmatically on init.

Change-Id: Ib0249ec56daee9d7ff37521a7bdc94e38585cba4
demo: Unbreak eventLogger.html and eventSequencer.html

Change-Id: I853ace5012e7c1a29d6e386cfdac7b00d1fe58b1
Localisation updates from https://translatewiki.net.

Change-Id: I0b51f319355e788432df3bf12908a1c97707f7c7
Revert "Follow-up 2075a46: Fix RTL image build by embedding after flipping"

This fix actually overwrites the RTL stylesheet completely.
Need a fix that embeds and RTL flips assets in one pass.

This reverts commit 7ce4a63608ba841d509f095badbe1b90eee225d5.

Change-Id: Ic8de624de95cd4159515a69a6c564176067216e2
Remove this.$element on destroy but don't nullify

Bug: T84897
Change-Id: I794fa007358515022598dd3d66683beba94275a4
Fix typo in MobileContext

Change-Id: I4c2ff743deb1865fafbbad0297236d24ee2a2fd1
Actually remove ve.instances

Follow-up to 381aee1cf55100021d244db29f194c9b1d725edb.

Change-Id: I2a4fdab7d8b99297048632c238463b52a236532d
build: Update devDependencies related to Karma

Minor improvements.

Change-Id: I5ec3a6424db987c1addb1a1686eed0f012d756f9
Follow-up I4f080228: Re-remove PNG and minimisation-related files from OOjs UI

Change-Id: I608f9948ff885d1f1c1fb5379d16ee6802c29f79
Localisation updates from https://translatewiki.net.

Change-Id: I383dbd175244da132c37ce94e703aaafc206e531
Merge "Refactor debug bar dump methods and add hide button"
Improve support for multiple surfaces in demo

Change-Id: Ie462795d4259795ffb6a4514099470d1609beb34
Fix whitespace consistency checking when child has no whitespace property

Our whitespace consistency checks never check innerPre, because
we assume it was already checked when the first child's outerPre
was processed, and then code then clears innerPre. So if innerPre survives,
we assume that must be because there was no children. This is almost
true, but if the first child didn't have any whitespace data at all,
the code path that cleared it was never taken. In this case, make
sure to clear it as well.

EXCEPT if we're doing this from a content node, those never have
whitespace recorded on them. Of course. Sigh.

Change-Id: I8ad147f174040b7f9223c57ac8583c22e172a3d7
Merge "Record whitespace on generated empty paragraphs correctly"
Record whitespace on generated empty paragraphs correctly

Whitespace was never recorded on generated: 'empty' paragraphs.

This was almost never noticeable because the linmod output
triggered a separate bug in the data->DOM where whitespace
consistency isn't checked correctly. This meant cases like
<li>\n</li> produced crazy linmod output (with the whitespace
being recorded twice on the li and not at all on the empty paragraph)
but still round-tripped correctly. The only case where
this caused round-trip failures was <body>\n</body>.

Change-Id: Iee23f477714fb56ae6829abb842470b93a4037cc
Update OOjs UI to v0.6.0

Release notes:
 https://git.wikimedia.org/blob/oojs%2Fui.git/v0.6.0/History.md

Local changes to ve.ui.FormatTool.css to compensate.

Change-Id: I69622a4dbfc158ad0a3a595d907714f770af910e
Localisation updates from https://translatewiki.net.

Change-Id: I38597cf539b1cc3619ea113d9a5e8506762bee5c
Merge "Add 'done' button to find and replace dialog"
Merge "Add getter for toolbarDialogs in ve.ui.Surface"
Add 'done' button to find and replace dialog

Bug: T77933
Change-Id: I51bdd84bf0d2ca1c50c78c5184d960c00f9f23d9
Add getter for toolbarDialogs in ve.ui.Surface

We already have getDialogs(), and ve.ui.Context has getInspectors()

Change-Id: Ifb096b4f580bfbf58df459c24fe48b85730293d4
Merge "SpecialCharacterInspector: Don't auto-capitalise the headings"
Merge "Calculate unicorn offsets correctly"
Calculate unicorn offsets correctly

Use .childNodes instead of .children because we care about text nodes too.
Land next to the unicorn (was erroneously landing at the start of its parent).
Land on the inside of an empty unicorn.

Change-Id: I185f8c97d66e605b7147e71d9850189da6a5d350
Localisation updates from https://translatewiki.net.

Change-Id: I1a4c231daa91febd966ef8d148286a8e897cd84c
SpecialCharacterInspector: Don't auto-capitalise the headings

Although text-transform: capitalize; makes the i18n look a bit better in English,
this creates incorrect labels for some languages, such as Polish.

Bug: T78327
Change-Id: I4f4991462dd89febb7ade23e81bc066f350ecac0
Localisation updates from https://translatewiki.net.

Change-Id: I759515d78a738b6bd5f85c4a0a5c53d4add44b49
Localisation updates from https://translatewiki.net.

Change-Id: I43a0413fb9d7cd962ce20c20d810eb31d421c3f2
Fix demo CSS hack broken by OOUI change

Change-Id: Ia51bdb7a7fb502a1a847e98d9d6ca7f8fa194fd0
Merge "Death to isolation"
Merge "Factor out event handler binding in ve.init.Target"
Merge "Non-DOM-modifying selection"
Merge "Move ve.init.Target#destroy to a place where it actually ends up existing"
Non-DOM-modifying selection

Create a collapsed selection directly in handleLinearUpOrDownArrowKey, instead
of inserting, selecting and removing a $cursorHolder span. The original purpose
of the insertion technique seems to have been to give a non-collapsed selection
for the native action to work on, then delete the superfluous content
afterwards. However, since Ifd5000fc5e667cb9fd6db0e97cf8a03b4da45553 we have
been deleting the $cursorHolder *before* the native action, so the native
action acts on a collapsed selection in any case.

Also stop treating slugs specially, as there is now no text insertion to create
problems in them.

Change-Id: If507cc2bcc363c1d637409dfa191942c967a7c59
Merge "Stop propagation of events after handling trigger keys"
Update OOjs UI to v0.5.0

Release notes:
 https://git.wikimedia.org/blob/oojs%2Fui.git/v0.5.0/History.md

Local changes for the breaking change in Ie27bd94c.

Change-Id: I4f08022855ff3de103594155ccb41496bbec9152
Stop propagation of events after handling trigger keys

Prevents shortcuts from triggering multiple actions, e.g.
escape also closes the editor in MW.

Bug: T78201
Change-Id: Id419cd13dfa096573dafd4e922b1f4434536cdc7
Death to isolation

Introduces ce.Surface#(de)activate which is called when
windows are opened/closed. Deactivate removes the native
selection, stops the surface observer and redirects all
showSelection calls to a fake selection renderer, allowing
the native selection to be placed in another window (e.g. an
inspector) without appearing to lose your document selection.

Removes the extra key listeners hack for target/document commands
now they aren't isolated.

Bonus: Fix getClientRectFromNode to work from an arbitrary range.
Previously it always used the current selection's range.

Change-Id: I55c55439f93f9780eda2014c5a5f46270129e609
Convenience compareDocumentOrder method

Change-Id: I69529a4ad59c6c817581264083a261df510db0fe
[BREAKING CHANGE] Rename method cmpOffsetPaths to compareOffsetPaths

Change-Id: I701a2168b6eba1c0bc74fdc5cac37d67e26f8180
Factor out event handler binding in ve.init.Target

Subclasses that activate and deactivate will need
to unbind and rebind these.

In the future we should really consider putting the
concept of activation and deactivation up in
ve.init.Target rather than down in ve.init.mw.ViewPageTarget.

Change-Id: I4efbae614ee8e9610dbf71f2c238280f5351e45b
Move ve.init.Target#destroy to a place where it actually ends up existing

Methods placed before the OO.inheritClass() call are wiped out.

Change-Id: I76172a380d7d64b2c2b522866172b0cd3cccb597
Merge "Localisation updates from https://translatewiki.net."
Localisation updates from https://translatewiki.net.

Change-Id: Icf591c89a96c96ef5c98eb02c57117f29ab6b293
Merge "Mark primary buttons as progressive as well"
Mark primary buttons as progressive as well

In anticipation of Iee91d2c6 in OOjs UI

Change-Id: Ibc86460b8d59a8892244f27c7d3d180f51b59835
Merge "[BREAKING CHANGE] Make ve.init.target an OO.ui.Element"
Followup cf1e167: unbreak SurfaceWidget

SurfaceWidget needs to pass a reference to the surface
when setting up the toolbar.

Also reverse the order of operations in the ve.ui.Toolbar
destructor. Individual tools' destructors call .getSurface()
on the toolbar, so we have to unbind the surface after
destroying the tools, not before.

Change-Id: I5005a33be44abf062608fad0ac52c41e135e6ee7
[BREAKING CHANGE] Make ve.init.target an OO.ui.Element

Targets no longer take a $container argument, but generate their
own $element, which should be attached to the DOM by the caller.

Change-Id: Ie05cdd26ddebbe242b731bd277e5f613d08e0bee
[BREAKING CHANGE] Multiple surface support and demo

Refactor the toolbar so that it can attached and detached from
a surface.

Remove (en|dis)ableFloatable and replace with a config option. Toolbars
never change their buoyancy.

Have toolbars emit a null updateState when they are detached so they
can disable all their tools.

The target now lazily creates a toolbar when you call getToolbar.

Update the standalone demo to allow creating extra surfaces, with some
future to-dos:
* Refactor the demo toolbar into target actions and surface actions
* Fix the focus-stealing issue when changing surface while a dialog is open

Change-Id: Ic999ec166d8005e0368c0dc95c0a5593e6bf2945
Merge "Remove debug bar hiding now it is handled by the surface"
Merge "Delimit text nodes in debug observations"
Remove debug bar hiding now it is handled by the surface

Change-Id: Iaf87d316946e34fec769da00ecbd672929f06d7b
Delimit text nodes in debug observations

A DOM change can consist solely of splitting or joining text nodes. This can
have important effects in the browser (e.g. breaking Arabic ligatures) but is
completely invisible in HTML-serialized output.

This change uses modified HTML serialization, with each text node delimited
by <#text>...</#text> tags, to show the difference in debug observations.

Change-Id: If7e0de4845f73d75ce18244b7a205a1c6f7cec06
Refactor out trigger listening to allow target and document triggers

Introduce ve.TriggerListener which handles a set of commands.

Some commands can be triggered anywhere in the document, e.g. commandHelp.
Some commands can be triggered anywhere in a target (i.e. the surface
and any dialog spaces) e.g. findAndReplace. All other commands
can only be triggered from within a surface.

The target listener allows us to remove a hack from FindAndReplaceDialog.

For target/document listeners to work we need to add extra keydown listeners
to isolated windows.

Change-Id: I10857cc66526ca77560cb1e8e78ff1c1a08f3736
[BREAKING CHANGE] Refactor for multiple surfaces

Replace target.surface with target.surfaces, and introduce
the concept of an active surface at target.surface. By default
surfaces become active when focused.

Bonus:
* Move debug bar setup from target to surface.
* Move import rules to config.

Change-Id: I5c2afe424a3cc4e9973af4a657553f1634c9a7e1
Merge "Fix filibuster expansion bug"
Fix filibuster expansion bug

Change-Id: I2090deeb0bbc5e19b2f66237978591e3f170dc9a
Refactor debug bar dump methods and add hide button

Change-Id: Iadf9acc2f79cdbe4b33a0c0bbfab780fe992d111
Merge "Trim whitespace when annotating"
Trim whitespace when annotating

We should assume that the user doesn't want to annotate trailing
whitespace, as we do with the link inspector.

Fix trimOuterSpaceFromRange to detect any whitespace character.

Fix getCharacterData to always return a string.

Fix various documentation lies and omissions.

Add tests for getCharacterData and getText.

Change-Id: I16488b1afada9e8dd41482ce5b6d186544a94040
Merge "Normalize split text nodes correctly"
Localisation updates from https://translatewiki.net.

Change-Id: I767f176d5e453dd36133f77d2030053d1b740648
Normalize split text nodes correctly

Call .normalize() on the parent of the split text nodes, rather than on one of
the split text nodes itself.

Change-Id: I1dd9eb4bd523cf89d9a676cd9ac99d47ec253dea
Follow-up Ifa89a85e: Use '0' not '0px'

Change-Id: I2785008a0d34c52735b194900e9e228f1ece1508
Merge "Track state properly at the end of an event loop"
Merge "Fix the src attribute for non-debug chimeras"
Track state properly at the end of an event loop

Previously, doneOnLoop was only reset if the user set an after*Listener.

Change-Id: I5a043ee277504fe47c82d4c5409e54a8c39f2b10
Localisation updates from https://translatewiki.net.

Change-Id: I7aefc7f6a0b932f22bffeaf7565534c4579bee0a
Merge "ve.ce.TestRunner: Fix copypasta in JS documentation"
ve.ce.TestRunner: Fix copypasta in JS documentation

Change-Id: I7a9db1d9457e93e49f8bff1324e3f388f2636a45
Fix the src attribute for non-debug chimeras

Also set their width/height to 0px

Bug: T77905
Change-Id: Ifa89a85e779e8d100c52872667bf5a4990a25734
Merge "Regular expression find and replace"
Regular expression find and replace

Change-Id: Ifd0dce08a8d3166abdcaf6fe59b0b4a16c13407c
Localisation updates from https://translatewiki.net.

Change-Id: Ifb13a7b8c9abe037967668b4038cfc285cd6827b
Merge "bin: Update update-unicodejs.sh to parity with update-oojs.sh"
Merge "Localisation updates from https://translatewiki.net."
Localisation updates from https://translatewiki.net.

Change-Id: I40289de01a19289950ab6d8f92022033b177667a
bin: Update update-unicodejs.sh to parity with update-oojs.sh

Change-Id: I80e78eb8de78f81b7f046bc4f9bc647fff5cafc3
Use String#slice instead of discouraged String#substr

Follows-up 7004717af5.

Aside from the confusion and differences between substr() and
substring() and IE8 bugs with substr(), substr() was removed from
the spec as of ECMAScript 5. It's been standardised in the
optional Annex B section of ES5.

Change-Id: I1f9f46f73ea0c79ec7e4c726a86bfe3ffa1924d3
Update OOjs UI to v0.4.0

Release notes:
 https://git.wikimedia.org/blob/oojs%2Fui.git/v0.4.0/History.md

Local changes to update for I9ee6a9ec.

Change-Id: I8c81656d4f95138d7c187e71e52ee60b669a46a5
Merge "Ensure clipboard key is removed from paste target"
Merge "Localisation updates from https://translatewiki.net."
Localisation updates from https://translatewiki.net.

Change-Id: I117a3a69c27d928669f9ee496588770c17f0a978
Merge "navigator.appVersion -> navigator.userAgent"
Merge "Papaparse update per https://github.com/edg2s/PapaParse/pull/2"
Papaparse update per https://github.com/edg2s/PapaParse/pull/2

Checks document.body exists before attaching event listener.

Change-Id: I4adcddee85d425cf7e0bd63c316ca219634b2331
Ensure clipboard key is removed from paste target

Now that it contains a space, it is not stripped automatically.

Also fix important span check to be recursive.

Bug: T76749
Change-Id: If1c4a764c6b703c63c86a1e0e46cb68d25f83e8a
navigator.appVersion -> navigator.userAgent

Change-Id: Ide539d3b6dc0c505eebec842fc416cae3d69b4cc
Merge "Update IE detection to include Edge"
Merge "Fix find and replace highlights in RTL"
Merge "Ignore enter key when no results."
Update UnicodeJS to v0.1.2

Release notes:
 https://git.wikimedia.org/blob/unicodejs.git/v0.1.2/History.md

Change-Id: Ifcb7dbc3b1cfa9f0c600dd114dba8b37811c1f8f
Merge "ve.ce.Surface: Remove use of deprecated OO.ui.Element#onDOMEvent and #offDOMEvent"
ve.ce.Surface: Remove use of deprecated OO.ui.Element#onDOMEvent and #offDOMEvent

Bug: T76861
Change-Id: I57b8da116f265bf4e084e687da0ca0632fd16691
Fix find and replace highlights in RTL

Add noflip rule to container and only set 'left' CSS on highlight.

Bug: T76807
Change-Id: I4ce6fbb163234c195c5419015cfb333a87678700
Ignore enter key when no results.

Bug: T76811
Change-Id: I767d1f203a78f97446c623137948e7cb00e76ffb
Localisation updates from https://translatewiki.net.

Change-Id: I1b95744528a37d38b782e919b716ff5d763f42ba
Update IE detection to include Edge

The IE12 User-Agent no longer includes Trident, but instead
identifies itself as Edge/12.0

Change-Id: I0ef927af1b85706974a6f38b0ad45ee3f58f8be6
Localisation updates from https://translatewiki.net.

Change-Id: I32a44245342ab12d684aa8bcccb187553162364b
Merge "Use a chimera instead of &#xFEFF; in inline slugs"
Use a chimera instead of &#xFEFF; in inline slugs

Chimeras are single, unicorn-like <img>s. Using them instead of
&#xFEFF; (zero-width non-breaking space) seems to have the same effect
for cursor behavior, and does not involve text that we need the observer
 to ignore. With this change, typing in an inline slug works without pawning.
The typed text ends up in the inline slug's <span> before/after the image.
It gets SurfaceObserved correctly despite that, because the <span> isn't
treated specially any more.

Also, don't rebuild entire paragraph when inserting text in slug location.
We already didn't rebuild the paragraph when text was inserted
into an existing text node: instead we resized the text node.
But for cases where the text insertion creates a new text node
(when typing into a slug), we would still rebuild the entire paragraph.

Instead, add an operation to DocumentSynchronizer to insert a new
text node, and use this operation in TransactionProcessor when
a text node insertion is detected.

Now that TextNodes can be spliced into existing ContentBranchNodes
without rebuilds, set ce.TextNode's $element to an empty collection,
so onSplice doesn't try to insert a span that will then be removed
again by renderContents. This allows us to avoid rerendering
when SurfaceObserver generates transactions like these
(onSplice will no longer modify the DOM and renderContents
will notice that the rendering is already up-to-date).

Changes:
* Replace FEFF with img in inlineSlugTemplate
* Make most slug-specific logic apply only to block slugs
* Account for inline slugs in getNodeAndOffset's unicorn adjustments
* Stop pawning inline slugs; and kill pawning code completely now that it's unused
* Respect render lock in CBN setupSlugs; maybe this should be in onSplice instead?
* Update tests for new inlineSlug structure

Change-Id: Id360d90d6cf6adad29b1f5f14bc27b7dc8109851
Merge "Remove ve.instances"
Merge "Only run showSelection if one of the command successfully executed"
Merge "Rerender ContentBranchNodes when the selection anchor leaves"
Merge "Check the selection is in the correct surface"
Check the selection is in the correct surface

Previously, if the selection was in another surface, RangeState would silently
use a DM offset computed from the wrong document.

Change-Id: I87cff916690aca2094788bce7f97c95b594818eb
Merge "Go backwards through find and replace results on shift enter"
Merge "Find and replace tool"
Merge "Find and replace"
Allow language widget to filter on available languages

Use this in the demo to only show languages we have json files for.

Change-Id: Ia094e55d854f50af8b1831815d9cc1891753542e
Update OOjs UI to v0.2.4

Release notes:
 https://git.wikimedia.org/blob/oojs%2Fui.git/v0.2.4/History.md

Change-Id: Ic1afd83022ad8e6eee0ca89d94f6df23ba938684
Show entire expandable call tree in ve.ui.Filibuster

Previously, ve.ui.Filibuster observations showed the stack at state changes, but
the full function call tree could only be observed manually. This code displays
the entire call tree in a rudimentary interface, initially expanded at the state
changes but expandable elsewhere too.

Change-Id: Icfa39084f626ea4ac22cfcccf8e1beacedfc9478
Add getDescription method to selections

The description is just for debugging, so doesn't need localizing.

Change-Id: I4b1d32650a26af2cfc42b2121a413fed3a18a03b
Rerender ContentBranchNodes when the selection anchor leaves

This causes unicorns to disappear, hopefully allowing us to
get rid of some of the bookkeeping previously used to make that
happen.

It will also clean up redundant chimeras, once we start using those.

Change-Id: I95632cdab95f430540e2ed682a706d6cf371077f
Merge "Use unicorn client rect for adjacent collapsed selection"
Use unicorn client rect for adjacent collapsed selection

For a collapsed selection between two unicorn images, the nearest containing client rect is
actually that of the surrounding element, which can be arbitrarily wide. The unicorn's own
client rect is a better match for the cursor position.

Change-Id: I77894f24c1fee39343ce6652f999aaa9133cc511
Localisation updates from https://translatewiki.net.

Change-Id: I7408c000651518361743377238330d6cd4fe7b96
Go backwards through find and replace results on shift enter

Depends on I078874a6 in OOjs-ui.

Change-Id: Ia7069c73d7ab6fd89c8bd3ffca7345144929661d
Find and replace tool

Change-Id: I311b16c5aa5cfa96ac909bbd3aeebeae2a15a2c2
Find and replace

Bug: T50368
Change-Id: I8dc406ffe8455dedf35eef02a1909de2d79adeb0
Fix window manager logic

Instanceof check for dialogs requires checking the window is not an
inspector first as inspector is a subclass of dialog. Refactor this logic
into getWindowType and use that for customising functionality to
avoid this problem in the future.

Bug: T76076
Change-Id: Icad7c95794c7c1255314bf05b9339ed20f41afb3
Localisation updates from https://translatewiki.net.

Change-Id: I2fa28ded45817a5536d00129a6a0a93a8c0b75e6
ve.dm.Node: Fix typo in comment

Change-Id: I96b31f4c903edc20b1582f3bab83384eb793b03a
Localisation updates from https://translatewiki.net.

Change-Id: I3017b2dce15ac51a3f50d33acfb3b83878902a01
Remove ve.instances

A better API is provided by ve.init.target.getSurface(). Gadget
documentation has been updated to reflect this.

Change-Id: I823b492d1e3bc9496a359cb259b73240c3bf6ed0
Only run showSelection if one of the command successfully executed

Change-Id: I1192fcdca79c202559f99ccebc2f0ccbc8501f5c
Merge "Use complex change logic if there are changes not at the selection"
Merge "Move window managers to sub folder"
Merge "Update OOjs UI to v0.2.3"
Use complex change logic if there are changes not at the selection

The prior behaviour breaks IMEs that can change text distant from the
selection; e.g. ന്  --> ങ്ങ്  in ibus Malayalam swanalekha.

This reverts a change made in 72eb2825e5bfb1ee63dba29004bb9bbb2a96ef57 in Oct
2012, whose purpose was presumably to reduce re-rendering by avoiding complex
change logic in certain cases. This is no longer needed because ve.ce.Surface
changeModel now avoids re-rendering.

Bug: T53511
Bug: T56057
Change-Id: I308441c70364bc93a3966e233f5a85205a28fdeb
Merge "Followup 166a52b: don't disable tools that don't have commands"
Update OOjs UI to v0.2.3

Release notes:
 https://git.wikimedia.org/blob/oojs%2Fui.git/v0.2.3/History.md

Change-Id: Ia3d8a5a9df0efffd2b5cb1466e600cc0b77d7ef2
Followup 166a52b: don't disable tools that don't have commands

Using null and undefined to mean different things is ugly,
but I can't think of a better way to get us out of this mess
quickly right now.

Bug: T75965
Change-Id: I5344821ad36c8689c6c0d70e50ac0b3fcf599711
Only showSelection if checkSequences actually matched something

The unconditional showSelection in ve.ce.Surface checkSequences was breaking
most IMEs, because it removes the existing selection, which closes the
candidate window.

We are still calling checkSequences at a time when we are not certain it is
IME-safe to make changes, but in practice this is probably less dangerous,
because for most common IMEs there will be no candidate when one of the
currently recognized sequences matches.

Applying the model selection under setTimeout can conflict with IMEs that
cause multiple events in a single tick. This does happen in practice, e.g.
typing ASCII from within Korean IME, but it is an edge case and the fix is
more complex. We should investigate whether ve.EventSequencer afterLoopOne can
make this safer.

Change-Id: Id89e84b5deb818ff4f978ac13e75cf70880df7f0
Use selected annotations when replacing content

If you select some content which is consistently annotated
and replace it you'd expect your replacement to maintain
those annotations.

Change-Id: I6f6b0af1fd548bd5c20f7ba03f8c769c99bec999
Move window managers to sub folder

Also rename DesktopInspectorManager to DesktopInspectorWindowManager

Change-Id: I3d8179f9f34e7b7598a58141c4af06fb5bd3cfad
Merge "Editable blockquotes"
Merge "Followup 166a52b: unbreak tools that don't have commands"
Merge "Allow empty IME test suite"
Followup 166a52b: unbreak tools that don't have commands

As a bonus I tried to replace the usage of .static.commandName
with .static.getCommandName(), but it turns out MWPopupTool
subclasses OO.ui.PopupTool, which is not a ve.ui.Tool
so it doesn't have that method. GRRRRR

Bug: T75946
Change-Id: I4f17168ecaf70ce4d7cd175bf18319652ad7bc62
Allow empty IME test suite

Remove exception that was thrown when the IME test suite is empty.

We need this in VE-MW to avoid breaking things there.

Change-Id: Iefad9ae64ef60d83c9ebc567ccabbd9b1b69fcc3
Merge "Set ready delay to animation duration in VE WindowManager"
Merge "Switch to personal fork of Papa Parse"
Switch to personal fork of Papa Parse

Fixes async load issue. Will switch back if/when fix is
accepted upstream.

Change-Id: Id915beee555937e75dafc95e2bfaac1bcfbb2bae
Merge "Move toolbar scroll hack to surface"
Merge "Refactor WindowAction to include close and toggle methods"
Merge "Update PapaParse to 4.0.6"
Move toolbar scroll hack to surface

Instead of having the toolbar scroll the surface, just tell the surface
the toolbar's height and let it scroll itself into view. Knowing the
toolbar's height will be useful for other interfaces that need to know
if something is in view.

Change-Id: I854951de6aa6c9053013b9e35417508ed6a9451f
Update PapaParse to 4.0.6

Change-Id: If6581cc4571676c66de00142a09909a8db944f1f
Refactor WindowAction to include close and toggle methods

Change-Id: Icce535a0e1b99341417dd3808f2db669c57f9bc2
Merge "Create ve.ui.Sequence which matches commands to typed text"
Create ve.ui.Sequence which matches commands to typed text

Register two sequences:
- '<p>* ' creates a bullet list
- '<p>1. ' creates a numbered list (note this isn't '#' as that
  is MW-specific)

Bug: T53408
Change-Id: I6a4d71d845ecde460193466d9d8d12a0c9050c98
Localisation updates from https://translatewiki.net.

Change-Id: Idb5e4c85b642f8d8588f1bac843323bc475a3715
Merge "Reduce height hack on command help dialog"
Merge "Update inexplicably old version of PapaParse library"
Merge "Fix demo width now that OOUI sets max height"
Merge "Rename variables in surface#execute for clarity"
Merge "Always return boolean from an action"
Update inexplicably old version of PapaParse library

Change-Id: I54e4b6fec2813ac1bc9f5f9683458dc5116e63f4
Editable blockquotes

Bug: 51009
Change-Id: I9507219b0b399907eeae11520dc2328fb2a830ce
Reduce height hack on command help dialog

Any extra height needed for MW commands should be in MW.

Change-Id: Id177bdf7e1b8335c7dc033278df653487341ec45
Rename variables in surface#execute for clarity

Change-Id: Ice2c354f8b673c78c790a44cc2b4a3143bc0c0de
Fix demo width now that OOUI sets max height

Change-Id: I3d3c464cab6dd4d6812108b2daaca9724b66177f
Merge "Update OOjs UI to v0.2.2"
Update OOjs UI to v0.2.2

Release notes:
 https://git.wikimedia.org/blob/oojs%2Fui.git/v0.2.2/History.md

Change-Id: I889b41ca2cee87ab9aab373a11e64de9a536b095
build: Fix script paths to be /bin/.. not /bin/../.. which isn't a thing

Change-Id: I78eeeb033d3a2496c0be93fb22e7fd3004dc7aaa
Merge "Filter out comments from external paste"
Merge "build: Update update-oojs.sh and update-oojs-ui.sh scripts"
build: Update update-oojs.sh and update-oojs-ui.sh scripts

Change-Id: I5f35387ce2ac1d1e00a864cb59a5c9cf1245b689
Merge "Create 'preserveGenerated' mode for cloneElements and use in copy"
Merge "Remove data-parsoid removal hack"
Provide a FileDropHandler for CSV and TSV files

Introduced the "PapaParse" library, MIT licensed.

Change-Id: Idbe32c04e129c97c30a195dedfc7f3f4139b5f36
Provide a FileDropHandler for HTML files

Change-Id: I0dac125ffddbb012769a41c7b5a8d31fb97b7def
ve.ce.Surface: Move insert HTML path to DM

Provided through new ve.dm.SurfaceFragment#insertHtml and
ve.dm.SurfaceFragment#insertDocument methods via
ve.dm.Document#newFromHtml, so it can be used by other pathways.

Co-Authored by: Ed Sanders <esanders@wikimedia.org>
Change-Id: I17191f6ffc18cc1f0d780ae48a53d39ceec35643
[BREAKING CHANGE] Rename paste rules to import rules

Also used by drag and drop

Change-Id: I40d1d78861f23e06b079de5f3b99323628150099
Merge "Handle empty rowspan/colspan attributes correctly"
Merge "[BREAKING CHANGE] Change command list from whitelist to blacklist"
Merge "Removing padding override from LanguageResultWidget"
Merge "Refactor SurfaceObserver pollOnceInternal"
Removing padding override from LanguageResultWidget

Depends on upstream fix in OOjsUI, Ia4a47f2.

Change-Id: Ib76fa77802226d5d342cb8eaf01338980528b803
Merge "Emit ce.Surface#position after dm.Surface#documentUpdate"
Merge "Move getText from dm.Document to ElementLinearData"
Refactor SurfaceObserver pollOnceInternal

Refactor pollOnceInternal to make its logic clearer.

* Remove ve.ce.DomRange class (had misleadingly live node properties)
* Move much of the SurfaceObserver state to new ve.ce.RangeState class

Change-Id: Iccb6d39022ee06c8bd1fb687343efa160dbac44f
Localisation updates from https://translatewiki.net.

Change-Id: I1689d89209613189dde05b0a4994eaa5f0f3eaf5
Emit ce.Surface#position after dm.Surface#documentUpdate

Change-Id: I8372fa0eaaef41cf3b6182b756ba94f9711c7205
Move getText from dm.Document to ElementLinearData

Also add 'maintainIndices' flag which pads out element data
with line breaks so offsets can be easily mapped between
the data the string.

Change-Id: If41f10bf013641d693c074a6eed6d172a1340bc7
Merge "Pass through excludeInsertions in get(Linear)Fragment"
[BREAKING CHANGE] Change command list from whitelist to blacklist

Also have the toolbar automatically remove tools for which the
command is not available. This means surface widgets can define
their toolbars just by blacklisting commands.

Change-Id: If32d514a51bebb6614ca84f1061167e7fc50ecb0
Filter out comments from external paste

Bug: T71821
Change-Id: I00bd4dd0e01a11a53423ab78fdd1905dfd52df28
Merge "Improve logging"
Merge "Make debug bar controls narrower"
Always return boolean from an action

Command#execute expects this so it knows if the action was
successful.

Change-Id: I317fdf0bfc09d986f01901de78f03673787843a2
Localisation updates from https://translatewiki.net.

Change-Id: I0615fdac78397af67e83e0ac3165611896ecb603
Improve logging

* Refuse to log collapsed selections.
* Log all ranges on a table selection.

Change-Id: Ic5e3f56a0b51e3b035fa61b7594ccffbc1b14d72
Make debug bar controls narrower

* Merge dump model (on change), and replace with icon.
* Remove 'start'/'stop' from fillibuster. Toggle state indicates this.

Change-Id: I8eb27a192850bec175b120a576aec62fb0c14969
Pass through excludeInsertions in get(Linear)Fragment

Change-Id: I8ba1e488d3faf030a6d3a8fb101eeaf3a73f2d51
Set ready delay to animation duration in VE WindowManager

Eventually this should be measured by OOUI to account
for variation between themes.

Depends on I82bbc198 in oojs-ui.

Change-Id: I8d0cf1e1775e894632310580b30cfb4f100fd488
Tweak some ContextSelectWidget code after item→option update

Follow-up to 029fc7e22cfc551f5bde344d78bf734178a20387. Seems to have
slipped through the cracks, caused no visible issues.

Change-Id: I3d28feec3b3202dfdc771ea771d138e5e8bb00d7
Delete src/ui/widgets/ve.ui.ContextWidget.js

Unused. Follow-up to b141a7d23fc47938030cb6a742db51229770025e,
which copied a file instead of renaming.

Change-Id: I3ed8617b03b953b5c0e6d5374428329289272aec
Update OOjs UI to v0.1.0-pre (9ed4cf2557)

New changes:
649a6c6 [BREAKING CHANGE] Allow options with similar data
afbedc7 Add a getMenu() getter to ComboBoxWidget

Local changes for the breaking change to OptionWidget and sub-classes.

Change-Id: I7acd87722c063084f88b5ce9436ba156debe29a8
Update OOjs UI to v0.1.0-pre (8f8896196f)

New changes:
56587a8 [BREAKING CHANGE] Rename InputWidget#sanitizeValue → #cleanUpValue
4253739 Implement radio button widgets

Local changes:
LinkTargetInputWidget: Update for #sanitizeValue → #cleanUpValue OOUI change

Bug: 73156
Change-Id: If10927a4e595de9b6d0ad45182470e84f335683c
Update OOjs UI to v0.1.0-pre (23565e7519)

New changes:
0557719 Use README.md as doxygen main page
290f8a9 Remove accidental double try-catch from 76800b47
e7039d0 Revert "Revert "Show the modal overlay as soon as openWindow is called""
61ac646 Fix lots of spelling mistakes and typos
5b381ae build: Create a 'typos' task to detect common typos
f21c8eb FieldLayout: Only use <label> for InputWidgets
39e8522 Localisation updates from https://translatewiki.net.
16eb98d PHP: Reject malformed and potentially evil input when outputting HTML

Change-Id: Ie039a451cf03eaf21e16538cfca270b1d9b8f7f9
Merge "Consistently use ve.ui.WindowManager everywhere"
Consistently use ve.ui.WindowManager everywhere

We were using OO.ui.WindowManager except where we absolutely
needed to use ve.ui.WindowManager. Instead, consistently
use VE's WindowManager class everywhere in VE, so future
customizations to ve.ui.WindowManager will be applied
everywhere in VE.

Change-Id: Id6660a4b54a496eefa6c79e162570d402f95eab5
Handle empty rowspan/colspan attributes correctly

This commit Should(TM) fix all remaining rowspan/colspan
corruption issues.

No longer store rowspan/colspan values of NaN. Instead,
omit the rowspan/colspan attribute when the attribute
value does not parse to a number or is empty
(annoyingly, '' parses to 0). Always set the originalRowspan/Colspan
attribute if an attribute value was set, and use it if
the original value parses to the same number as the
rowspan/colspan (as before), or if rowspan/colspan
is not set (replacing the NaN check we used before).

Change-Id: I5db816071dccb7eff015509c7ce01b80758a47db
Merge "Fix z-indexes in core"
Localisation updates from https://translatewiki.net.

Change-Id: Ia211546bf4fefa74183bc2eddad91586293a7e6a
Merge "Fix lots of spelling mistakes and typos"
Fix z-indexes in core

The toolbar only needs to be z-index 1, not 100. The global overlay
needs to be above this and so is set to 2.

Bug: 73650
Change-Id: If8d7796826addf481ff491ca61138faad71b8806
Fix lots of spelling mistakes and typos

Change-Id: I76f4de0984f1feedaf7886bde8aa561a26321a04
Merge "Copy in some IE CSS hacks from ve-mw"
Update OOjs UI to v0.1.0-pre (d4cfcce969)

New changes:
f6adfbc Give help content box a reasonable line height for legibility
af5d71c Remove CSS hack for positioning popupButtonWidget
c0768f9 PHP: Add missing OOUI\Exception class
76800b4 PHP: Wrap __toString() in try-catch to avoid unhelpful fatals
d399920 Revert "Followup ca6a16f: use parent selector both for hiding and showing windows"
234cd9f Revert "Show the modal overlay as soon as openWindow is called"

Change-Id: I317b4a747389de35411aca4ffdbbc2306b5b74cc
Update OOjs UI to v0.1.0-pre (20c61ec865)

New changes:
20c61ec Follow-up Id9597fde: Restore toolbar-bar class

Change-Id: Ia16292b3ee46f5b38ee216927a9796a8fdf9235d
Copy in some IE CSS hacks from ve-mw

Haven't actually tested this in IE.

Bug: 73565
Change-Id: I013688c5916a97f50966e772e88d356fbc47db18
Update OOjs UI to v0.1.0-pre (1fa4eb7a73)

New changes:
549ff9a [BREAKING CHANGE] Rename *Menu and *MenuItem widgets

Update changes:
Changes were generated by running this script:
https://gist.github.com/catrope/ff387517a61fd0ad22af

File changes:

Scripts (src/ui/widgets)
- ve.ui.ContextMenuWidget.js → ve.ui.ContextSelectWidget.js
- ve.ui.ContextItemWidget.js → ve.ui.ContextOptionWidget.js
- ve.ui.MobileContextItemWidget.js → ve.ui.MobileContextOptionWidget.js

Styles (src/ui/styles/widgets)
- ve.ui.ContextMenuWidget.css → ve.ui.ContextSelectWidget.css
- ve.ui.ContextItemWidget.css → ve.ui.ContextOptionWidget.css
- ve.ui.MobileContextItemWidget.css → ve.ui.MobileContextOptionWidget.css

File content changes:

Scripts (*.js)
- ContextMenuWidget → ContextSelectWidget
- ContextItemWidget → ContextOptionWidget
- TextInputMenuWidget → TextInputMenuSelectWidget
- MenuWidget → MenuSelectWidget
- MenuItemWidget → MenuOptionWidget
- MenuSectionItemWidget → MenuSectionOptionWidget
- OutlineWidget → OutlineSelectWidget
- OutlineItemWidget → OutlineOptionWidget

Styles (*.less)
- contextMenuWidget → contextSelectWidget
- contextItemWidget → contextOptionWidget
- textInputMenuWidget → textInputMenuSelectWidget
- menuWidget → menuSelectWidget
- menuItemWidget → menuOptionWidget
- menuSectionItemWidget → menuSectionOptionWidget
- outlineWidget → outlineSelectWidget
- outlineItemWidget → outlineOptionWidget

Change-Id: I1347f16c10fe8252c53cc37f58d7ab5a47ab14ca
Update OOjs UI to v0.1.0-pre (7922a50558)

New changes:
491d279 Change document order of tools and actions to fix floating
25840d5 Add lang and dir attributes to the accelerator element
8a87ddf build: Update various devDependencies to latest
b0de093 Fixed RuboCop Style/AndOr offense
577ed71 Fixed RuboCop Style/AsciiComments offense
565251b Fixed RuboCop Style/EmptyLineBetweenDefs offence
328710e Fixed RuboCop Style/EmptyLines offense
f2a1811 Fixed RuboCop Style/NegatedIf offense
51e041a Fixed RuboCop Style/SignalException offense
6b3bc5c Fixed RuboCop Style/SpaceAroundEqualsInParameterDefault offense
9224811 Fixed RuboCop Style/NilComparison offense
6ff2b19 Fixed RuboCop Style/SpaceAfterComma offense
22c86e2 Fixed RuboCop Style/TrailingBlankLines offense
33fc646 Consistently use @return annotation
709546c Localisation updates from https://translatewiki.net.
6e6dfae build: Clean up fileExists config

Change-Id: I528111c92b89e0302d679ed817a98671035cd8aa
Localisation updates from https://translatewiki.net.

Change-Id: Id51635fd2e768435890317aeffc9381490b1b743
Use history as as global

Just like DOM interfaces such as document and location. And JS
constructors like Object.prototype, and libs like jQuery.
No need for the window host object.

Change-Id: I5bf53ace8eb5a20bcbd8bdfa9eea848651833adb
Localisation updates from https://translatewiki.net.

Change-Id: I0a896f09bce6577d610d58460eb1771881dd0980
build: Update various devDependencies to latest

grunt-css-url-embed: 1.0.3 -> 1.0.4 (1.1.0 and above will need local changes)
grunt-jscs: 0.7.1 -> 0.8.1
karma: 0.12.24 -> 0.12.25

No-op; note that the grunt-jscs change switches us from jscs 1.6.0 to
1.7.2, which provides some new options (unused in the Wikimedia preset).

Change-Id: Iffde19b7b55969c480b4d64826f4aecbe346746f
Update OOjs UI to v0.1.0-pre (f1abca8e82)

New changes:
5883e65 Add 'indeterminate' state to progress bar widget
fbe9248 Fix documentation for getRelativeSelectableItem
27f8805 Localisation updates from https://translatewiki.net.
2edfdaa Localisation updates from https://translatewiki.net.
40d08f0 Localisation updates from https://translatewiki.net.
ce8438f Update OOjs to v1.1.3
5721411 Prepare repository for RuboCop
f1abca8 Followup ca6a16f: use parent selector both for hiding and showing windows

Change-Id: I7b49bbc81e9b8ba501f0593daaacf7025f16bf00
Localisation updates from https://translatewiki.net.

Change-Id: Ide2f8edb303c1f4cf91edcc60e4b436252d130d1
Merge "Add tests for ve.instanceOfAny()"
Merge "Replace ve.getProp() and ve.setProp() with OO aliases"
Merge "Move mobile ContextItemWidget hacks into separate class"
Merge "Don't allow dropping inside a handlesOwnChildren node"
Merge "Move hasSignificantWhitespace and handlesOwnChildren abstracts to ve.Node."
Merge "Don't always use updateDimensionsDebounced"
Replace ve.getProp() and ve.setProp() with OO aliases

Were moved to OOjs in If99eb7732e

Change-Id: Iec8f1b346106f25f48b16399e42d0a8253c2a206
Merge "Update OOjs to v1.1.3"
Move mobile ContextItemWidget hacks into separate class

Removes CSS visibility hack and all other traces of mobile from
desktop code.

Change CSS to float 'edit' button right, otherwise it isn't visible
for long link targets. It's not possible to have the text ellipsis
and have text to its right in pure CSS.

Change-Id: I225df7970e113892cc08b44e53f22e32ce4dfee0
Merge "Safari copy-paste fix"
Create 'preserveGenerated' mode for cloneElements and use in copy

The copy operation should preserve the 'generated' internal property
so that source style is preserved.

Bug: 72426
Change-Id: I77e2a9936459a15f6fbb94817ffcad97ef75dcd6
Don't allow dropping inside a handlesOwnChildren node

Bug: 73368
Change-Id: I56f1f84adb8602d3bf78bbe2ca3a6ace41438e54
Update OOjs to v1.1.3

Release notes:
 https://git.wikimedia.org/blob/oojs%2Fcore.git/v1.1.3/History.md

Change-Id: I1bd75ea6f259ca8b35ca8e379a443788d4642f28
Merge "Apply comment changes using fragment"
Merge "Make changes to comment node before apply staging stack"
Apply comment changes using fragment

Protects against the underlying document changing while the
inspector is open.

Bug: 71706
Change-Id: Ibabc1cec7c39568a99d7bafc8976f4bdcf1bb90a
Make changes to comment node before apply staging stack

Otherwise we generate two history entries.

Bug: 72315
Change-Id: I12410c00f70f03419167eb86ebac351a62618d70
Merge "Update RangeFix library 0.1.0 -> 0.1.1"
Initialize mobile context as visible

Follow up to I2662df8.

Mobile context hides with a class for transitions so make sure it
is never display: none.

Change-Id: I71fa4a27e6695758eca25c7a89dc532b61aedd72
Safari copy-paste fix

Always place a nbsp; in the clipboard-key span as otherwise WebKit
browsers won't select it.

Fix clipboard-key detection to be recursive when using pasteTarget.

Fix getClipboardHash to be recursive.

Try to avoid https://code.google.com/p/chromium/issues/detail?id=318925
which causes spaces to be stripped if a newline starts with a node, by
letting the pasteTarget be wider.

Bug: 71718
Change-Id: Iba35ab3a2b382fe8d166bde3f6d6ca16ef40ed12
Remove data-parsoid removal hack

Bug: 72426
Change-Id: Iae18b6a1d9bd927cdd40e3593d525fd58a4ee868
Don't always use updateDimensionsDebounced

If the menu is shown but only moved after debounce, then it
visibly jumps from it's old position.

Bug: 73242
Change-Id: I7db94ec54cc2613a1a0cb3e86cf3a3724030901e
Localisation updates from https://translatewiki.net.

Change-Id: I5495c5f41ac0ae79fad6d8d175822fbdbb4fecf5
Localisation updates from https://translatewiki.net.

Change-Id: I37df0777ae394b164b757fb25a16463b9462b619
Merge "Use strict comparison for insertionAnnotationsChange"
Merge "Restore original rowspan/colspan rather than normalizing or overwriting with NaN"
Merge "Make table inserts directional"
Merge "Fix getDirectionFromSelection to work with table selections"
Move hasSignificantWhitespace and handlesOwnChildren abstracts to ve.Node.

Change-Id: I10ffa5097d7df60a37ab7725422d64c6d99f3e34
Add tests for ve.instanceOfAny()

Change-Id: I77f89873dda66cc935ff8b047324d7c583f9ee86
Use strict comparison for insertionAnnotationsChange

74fc34ac changed the condition for emitting insertionAnnotationsChange
from a.containsAllOf( b ) && b.containsAllOf( a ) to a.compareTo( b ).
The containsAllOf test was stricter: if b contains an annotation
that is comparable to one in a, but not the same, the containsAllOf
test would fail, but the compareTo test would succeed.

This caused a bug with annotations with htmlAttributes. If you edited a
document containing <b>Foo</b> <b class="y">Bar</b>, placed
the cursor at Fo|o, typed "x", then placed the cursor at Ba|r,
and typed "x", you would expect <b>Foxo</b> <b class="y">Baxr</b>,
but you'd get <b>Foxo</b> <b class="y">Ba</b><b>x</b><b class="y">o</b>.
This happened because the insertionAnnotations were set to <b>
when you put the cursor in "Foo", and were not changed when
you put the cursor in "Bar" because <b class="y"> is comparable to <b>.

Even the original containsAllOf test wasn't strict enough, because
it didn't take order into account: it would consider [b, i]
the same as [i, b], so you could still get the same broken behavior
with <b><i>Foo</i></b> <i><b>Bar</b></i> (although that seems to
be straightened out by the openAndCloseAnnotations() in the
converter in practice, but it was still being put in the DM wrong).

To fix both of these problems, use ve.dm.AnnotationSet#compareToStrict
which checks for exact equality: equal store indexes in the same order.

Change-Id: I2cb9ab66cc6e0933134cd313fe30d7d88e0844de
Localisation updates from https://translatewiki.net.

Change-Id: I7d935cf0a63638fbc6f1ade2f7474fa1133dddf7
Restore original rowspan/colspan rather than normalizing or overwriting with NaN

Store originalRowspan/Colspan as strings instead of numbers,
so we get the actual original value. Use the original value
if the number we're setting is not really different
(prevents normalization of "02" to "2") or is NaN
(prevents normalization of "2 blah" to "NaN").

Bonus: don't modify dataElement.attributes

Bug: 73430
Change-Id: Ic30e0d6f7bfe27c10e505b7c18fe9200f322cfc7
Merge "Give table overlay width so row context positions correctly in RTL"
Merge "Follow-up 2075a46: Fix RTL image build by embedding after flipping"
Follow-up 2075a46: Fix RTL image build by embedding after flipping

Change-Id: I7080d4f122179dfbe9d113caf7aae7114ec853b6
Make table inserts directional

Bug: 73379
Change-Id: I9d1b88525615bfe1fb6315af90fc568c6a25cfca
Fix getDirectionFromSelection to work with table selections

Change-Id: Ie5c46e4eb0fc40982a47adb7ddb47a949d9de411
Give table overlay width so row context positions correctly in RTL

Bug: 73378
Change-Id: I479c8a0eb52d1b1a77cdda8adba9a32ba114f9dd
Update RangeFix library 0.1.0 -> 0.1.1

* https://github.com/edg2s/rangefix/commit/66a529d0
  Fix for broken range.getBoundingClientRect behaviour in Safari

Bug: 73336
Change-Id: I9bcc6c3922ec6ed59927c3f6beb56d183d9c6ecf
Remove upstreamed ve.contains function

Moved to OOjs UI in I2a059933

Change-Id: I3c7532d999707db275383df186b439c8f148c99f
Update OOjs UI to v0.1.0-pre (fe4076af75)

New changes:
b758cff Localisation updates from https://translatewiki.net.
2584648 MenuWidget: Don't close menu when you click the scroll bar
16d057c Don't close PopupToolGroups when the scroll bar is clicked
fe4076a Localisation updates from https://translatewiki.net.

Change-Id: I1872d16e33e8ad8f4d0e13ce7533587ab3b0614a
Localisation updates from https://translatewiki.net.

Change-Id: Ic999aea078ed024b2bd26929b6e4d5fbb8889c56
Merge "Use .super in nodes, annotations, meta and lineardata implementations"
[BREAKING CHANGE] Remove the ve.bind function

Bug: 72156
Change-Id: I4db8998c6163cb8a977f82e5c0992cd06ba46e8f
Merge "Initialize context's $element as hidden"
Merge "AUTHORS.txt: Credit libraries as well as direct contributors"
AUTHORS.txt: Credit libraries as well as direct contributors

Also add missing MIT-LICENSE file for jquery.uls (it's dual-licensed).

Change-Id: I0af1db585244a987e1af906a79802efa1722a22f
Initialize context's $element as hidden

this.visible is set to false, so the view should be hidden too.

This was also causing a scrolling issue on load in Chrome.

Bug: 73208
Change-Id: I2662df89618efd2ad1a9032f89af420e73d96fbd
Use .super in nodes, annotations, meta and lineardata implementations

Change-Id: I5039a802d0add69b8977d1f37aaddb71b15ff90e
Localisation updates from https://translatewiki.net.

Change-Id: Ib41c708cb8d5791ad131919cd22ec2bd7cdd4670
Merge "Allow <meta> tags in GeneratedContentNodes"
Allow <meta> tags in GeneratedContentNodes

Meta tags can be made visible, and are used as such by MWMath.

Bug: 72539
Change-Id: I7976bfcf6c3ceacaffad41402294ea586112cc85
Move FragmentInspector initialization to initialize

Change-Id: I98e6b8b84d258eac9a7009d6d3d63667835b87af
tests: RuboCop checks .docs/CustomTags.rb

Bump RuboCop to 0.27.1 so it can recognize '.docs', see upstream bug for
details: https://github.com/bbatsov/rubocop/issues/1401

Fix minor whitespaces problem that `rubocop --auto-gen-config` did not
put to .rubocop_todo.yml file.

Bug: 63307
Change-Id: I0a640135ca8e63a8efd6e8dc0e982a05097c20aa
Localisation updates from https://translatewiki.net.

Change-Id: Ibfbeb9be72045afdf3f16e99d2c3f564ae1ca230
Merge "Create filedrophandlers folder for implementations"
Create filedrophandlers folder for implementations

Similar to actions/commands/tools etc.

Change-Id: I96d7b4c64a2c357c517aee76219fb65dd098847e
Update OOjs UI to v0.1.0-pre (05f0fefc3f)

New changes:
e784137 mediawiki: Replace instances of 0.3em border-radius with variable
9b47eff Update OOjs to v1.1.2
3ad3295 Localisation updates from https://translatewiki.net.
59e926f Murdering OptionWidget's `rel` config option
ca6a16f Show the modal overlay as soon as openWindow is called
69fb4a0 Localisation updates from https://translatewiki.net.
d579dbd Localisation updates from https://translatewiki.net.
af5f5b9 Match 'color' rules to 'background-color' rules for accessibility
f1efb3b .theme-oo-ui-textInputWidget cleanup
845bb0a Localisation updates from https://translatewiki.net.
05f0fef Add missing config documentation for PendingElement

Change-Id: Iec009d9e535cd4427c2bb1100e29cf78b4494152
Merge "Bold & italic icons for Armenian"
Bold & italic icons for Armenian

Change-Id: I19d38733a79d38c33c0c454e5e5026ba94fb900f
Merge "Move disabling logic from tools to commands"
Merge "Generic progress dialog for drag and drop uploads"
Merge "spinner.gif: Update with new version from Trevor"
Merge "Register select all as a command and perform programmatically"
Move disabling logic from tools to commands

onUpdateState should only ever call setActive. setDisabled should
already be determined by the command so that it can prevent itself
being called by triggers.

Change-Id: Ifb90d1cc95de8710c287ad9026a4257325209d92
Make caption tool available when caption selected

Currently is only available on table selection. Add in node
traversal logic to check if linear selection is in a caption
so captions can be removed when the cursor is inside them.

Change-Id: Ib1d8ad574886ce83f1fee782367b2697ab696d2d
Register select all as a command and perform programmatically

This fixes the following issues:
* Not working when a focusable node selected
* Not working when a table selected, now selects
  the entire table
* Sometimes not working when a table cell is being edited
* Potential to have a select all tool
* Generally being less at the whim of content editable

It does not fix the ce-false-first-or-last-child issue in Chrome.

Change-Id: Ica731c596af9e6e3495298105ef1e79ba5cccd63
Merge "Fix logic for ignoring (col|row)span=1"
Merge "Fix up/down arrowing off a focusable node"
Localisation updates from https://translatewiki.net.

Change-Id: I16fd9a6c57d571824878ce2a8ab5628286f3e3f6
Merge "Fix pasteSpecial command"
Merge "Support for generic file drop handlers"
Merge "TableContext: Simplify row/column overlays styles"
Merge "Position the table context relative to the first section node"
TableContext: Simplify row/column overlays styles

Use the same technique for rowContext as for colContext.

Change-Id: Ie00a7d0cd92fe6f1580e9edbc8536fc890c76a7a
Don't unmerge spanned cells when spanned cell is removed

Previously we inserted regular cells in place of every placeholder in
the matrix, which meant that deleting a row which happened to contain
a rowspanned cell would split the rest of the cell apart, and the
contents would be lost. (Same for columns.)

Now we only replace one of the placeholders with a new spanned cell,
appropriately smaller. The new cell inherits all of the properties
and content of the removed cell, with the span adjusted.

Bonus: When unmerging a header cell, all newly split cells also get
header style. Previously first row would get header style and the rest
would get data style, which was an accidental effect of how
ve.dm.TableMatrix#findClosestCell works.

Bug: 73213
Change-Id: I62e56657c18bc67be859ece882770ce008bc3838
Fix logic for ignoring (col|row)span=1

1 should only be kept if the original value was 1 (previously
was just if the original value existed).

This means unmerging a cell doesn't result in (col|row)span=1.

Change-Id: I188755ccd435b21fa9791263aa84ccc89633cd0e
Position the table context relative to the first section node

This avoids the column context appearing above caption nodes.

Bug: 72829
Change-Id: I3d790d716e41f5dc2a36cd02540ddadb1083f6a8
spinner.gif: Update with new version from Trevor

Re-generated as part of wider work.

Change-Id: Ic0f6d2825743ed7667704537508210e70ef545c7
Localisation updates from https://translatewiki.net.

Change-Id: If323253ee59ca2893afbd00ac6b07b9185104c81
Merge "Fix missed conversion of inlineMenuWidget to dropdownWidget in demos"
Fix missed conversion of inlineMenuWidget to dropdownWidget in demos

Change-Id: Ic75c0c82747427224d712288ab3856acaa7d77e7
Fix up/down arrowing off a focusable node

For block nodes, just move programmatically. For inline nodes, move
programmatically to the end of the node, then move natively.

Change-Id: I6d701850f9f48856d149bf962fa53f8b92c3c3d0
Fix pasteSpecial command

Change-Id: I5f2960984c463ebdac02165fb97548349c1a9f5a
Merge "Move most of ve.js to ve.utils.js"
Generic progress dialog for drag and drop uploads

Change-Id: I1e3f2218868b3de6db07b9b576e5ade60e68bfa0
Localisation updates from https://translatewiki.net.

Change-Id: I53bf953bba21aff11fa762d073bcca4abdb59281
Remove and restore selection for non-isolated dialogs

In non-isolated mode the only way to prevent accidental typing in
the document is by removing the native selection, so do this.

This unavoidably sets the model selection to null, so when the dialog
closes, restore the selection if it hasn't been already by an action.

Bug: 73097
Change-Id: I93f741734ff3d46397c1278c500ae3c124a3a14f
Merge "Fix non-linear selection handling in ce.Surface#focus"
Fix non-linear selection handling in ce.Surface#focus

Table selections were being handled kind of correctly,
but we weren't calling onModelSelect() for them, which seems
wrong. Null selections weren't being handled at all.

Run onModelSelect() and the deferred conditional
selectFirstContentOffset() call for all selection types,
and focus $documentNode as the default behavior for
selection types that don't have explicit behavior.

Without this, calling .focus() on a surface after
creating it didn't do anything, because its selection
was a NullSelection. This broke pretty much every
use of SurfaceWidget.

Bug: 73097
Change-Id: I764791bc7cf02fe02fc3ccf477bf304551274294
Localisation updates from https://translatewiki.net.

Change-Id: I42b7b4067806b4efc5d0e3bf937051ac8f27ff65
Update OOjs UI to v0.1.0-pre (12b66051ff)

New changes:
0bcb0a1 Style mediawiki theme checkbox
227aefa paralell -> parallel
51ee44c Remove nonfunctional $icon/$indicator code from OptionWidget
735ba0e Use Object.prototype.hasOwnProperty where appropriate
324b8cb Localisation updates from https://translatewiki.net.

Change-Id: I2919d80b9ea5231f45b1e14ae1393a0f7665ec0c
Update OOjs to v1.1.2

Release notes:
 https://git.wikimedia.org/blob/oojs%2Fcore.git/v1.1.2/History.md

Change-Id: If0634147a2a01e10c66acc3c8f335d3d15cf7180
Support for generic file drop handlers

Includes PlainTextFileDropHandler as an example implementation.

Change-Id: I1de3363a959d8297f73e650f2cc7fb6feb981d00
Merge "Use hasOwnProperty instead of 'key in obj'"
Use hasOwnProperty instead of 'key in obj'

Change-Id: I1c558388505a902d5b048f51d551c7ec09742c2b
Localisation updates from https://translatewiki.net.

Change-Id: Ie8e104209a3b5608f63af9e712dc2dfc1fd91894
Merge "Replace block drop logic with isAllowedChildNodeType check"
Merge "Add isAllowed(Child|Parent)NodeType to ve.Node"
Merge "Node method cleanups"
Move most of ve.js to ve.utils.js

So that ve.track.js can be loaded early in the future.

Keep ve.now() in ve.js because it's needed for track stuff.

Change-Id: I8b54c769767520ddb803978085f2ca7e2dd965bc
Merge "Create table cells with wrapper paragraphs by default"
Merge "Don't focus Edit HTML on load"
Create table cells with wrapper paragraphs by default

Change-Id: I3de1bbb6498e5843b0870de88a2ada191945c82f
Don't focus Edit HTML on load

Causes scrolling issues.

Change-Id: I7afa401d0fc6b410a32e39cde347c8778d2343ee
Replace block drop logic with isAllowedChildNodeType check

The only requirement for dropping a node somewhere is the parent's
willingness to accept it.

Bug: 72995
Change-Id: I3d24213ecf69a074c4b966ed0ffdf9736e9a21eb
Add isAllowed(Child|Parent)NodeType to ve.Node

Change-Id: If0a08cc0b5af5161bf3417537bb320cfb20f8e41
Node method cleanups

For methods which exist in dm & ce, move to ve.Node as abstract
and replace documentation in dm & ce with inheritdoc.

For methods which only access other methods available in ve.Node,
move to ve.Node (e.g. getRange).

Give getRange the same signature as getOuterRange.

Change-Id: I49ab9b76f503ff3e7355713d6551cb27476cfdde
Blur contentEditable node while destroying surface

This solves a problem in Firefox, where the cursor remains visible
after cancelling the edit and switching back to view mode.

Bug: 71852
Change-Id: I051ef92eeea932dddae2767cd9f2e93693e6371c
Update OOjs UI to v0.1.0-pre (b38d485723)

New changes:
5a88296 Further mute keyboard shortcuts when disabled
0cdba98 Allow errors to be warnings, and give continue rather than retry button
31a1cbb Normalize configuration initialization
42ce966 Populate LookupInputWidget on mousedown too
3ed0d9c Removing text-shadow from readonly/disabled text in TextInputWidget
68eb012 Add missing message docs for ooui-dialog-process-continue

Change-Id: Ie55491851f7509295fdddbc5229bab2a32e83e8e
Localisation updates from https://translatewiki.net.

Change-Id: I5392833eb37a3a718788059b8ce59fc733db25b1
Merge "[BREAKING CHANGE] Move selection restrictions from tools to commands"
Merge "Restore basic styling to toolbar in core target (only)"
Restore basic styling to toolbar in core target (only)

Most document editors expose B/I in the toolbar. Hiding
B/I was a MediaWiki-specific feature request (or even WMF
sepcific) and the MW target file already specifies that behaviour.

Change-Id: I697b3f47cac225142346c8a31c50c7dd5e8b2609
Merge "Protect against offset=-1 in insertContent()"
Merge "Support toDomElements returning an empty array"
Merge "Missed function rename from RangeFix change"
Merge "Disable desktop context on table selections"
Placholder -> placeholder

Change-Id: I40178739f988085ce6588f52b6ee3f5314747286
Support toDomElements returning an empty array

Change-Id: I7c526a206a5166b601c1e9dff679a195a0029e6a
Missed function rename from RangeFix change

Follow up to I7f6cb6cb.

Change-Id: I027b0ffba4c11031adb4ea12c50471b41472cc2f
Disable desktop context on table selections

Prevents link inpsector from trying to open on table cell
containing only a link.

Bonus: Disable links with CSS when in ce=false table cells.

Bug: 72802
Change-Id: Iac21496e897b9e06c5e4233384952e6625c55d4c
[BREAKING CHANGE] Move selection restrictions from tools to commands

Currently triggers (keyboard shortcuts) execute commands without
running these checks, so move them into the commands themselves.

Change-Id: I957a7989c21dfb6763aeecf167b0306bae89efa4
Protect against offset=-1 in insertContent()

The annotation code here is much much too simplistic.
We probably want to either use the insertionAnnotations,
or factor out the code that computes the insertionAnnotations
in ve.dm.Surface#setSelection.

Bug: 72558
Change-Id: I6cb35e12e92d8adc06453f87a3596ef8b57ec54f
Update OOjs UI to v0.1.0-pre (571f26d0ab)

New changes:
8ada8cd OOUI PHP: Use 'OOUI' namespace instead of 'OoUi' class name prefix
4c56ad5 More random documentation fixes
3eb27b9 Recompute ComboBox selection when adding/removing items
e596cc5 Followup d3367bb: make FieldsetLayout <label>s display: block;

Change-Id: I5525a6285f4f24fa0fd997482c1735bef5639dc6
Merge "Add support for dropping text/html from external sources"
Merge "Fixes to onDocumentDrop"
Add support for dropping text/html from external sources

Change-Id: Iaddc4a7e7cc42a468a62ae550637f3eaacb64e07
Fixes to onDocumentDrop

* Rename relocating to relocatingNode
* Remove setTimeout, we preventDefault the drop event
  so we don't gain any information by waiting for the event
  to happen.
* Prefix the JSON string in IE mode to avoid trying to process
  real text drops.

Change-Id: I0bd39b958944b6b3e308c51dcb37292694c710a8
Merge "Replace native range rectangle hacks with RangeFix library"
Merge "Add support for non-table nodes in tables (e.g. aliens)"
Merge "Disable cell editing when a context is opened"
Merge "Prevent clicks on focusable nodes in tables"
Add support for non-table nodes in tables (e.g. aliens)

Rewrite table iterator to return null when table cells
are aliens, and undefined when it reaches the end.

Fix table actions and selection adjustment to account
for the table matrix containing null entries.

Bug: 72717
Change-Id: I9109d814cc7854e306d02d846865e024c709416d
Merge "Set insertion annotations when typing over cell contents"
Merge "Catch backwards selection error in Firefox"
Merge "Add missing focus call to pasteTarget"
Add missing focus call to pasteTarget

Change-Id: Ibe8e10ee15ad5bcb479ad4e4462daa4cff88c4ea
Catch backwards selection error in Firefox

Bug: 72835
Change-Id: I6dce13c91436139894656a8bfcfb8fe0a6f96d20
Fix width of demo page dropdown

Change-Id: I1e00ce5b5e6473fe8ac34266da3b144de9c8e104
Set insertion annotations when typing over cell contents

Bug: 72831
Change-Id: Idb0e787f3fa331a0d7fc23e278c6b17a31cdc79c
Localisation updates from https://translatewiki.net.

Change-Id: I753a8f3304561be947ae145ad422999e9d62ca29
Follow-up Ifb7ffb1: Update demo.js for breaking OOUI change

Updated demo.js. We don't use InlineMenuWidget anywhere else, it seems.

Bug: 70968
Change-Id: I7c79f179c425dff5be0389b7ccc44dc530e708f8
Update OOjs UI to v0.1.0-pre (eee616d664)

New changes:
f2e316a JS/PHP comparison test suite tweaks
d6dbeb1 [BREAKING CHANGE] Rename InlineMenuWidget → DropdownWidget
2c53fc3 ButtonElement: Add 'font-family: inherit;' to support ButtonInputWidgets
ac42c94 More documentation tweaks
71b3ebc FieldLayout: Add 'help' config option support to PHP
5265427 OOUI PHP: Support RTL text direction
9204727 Clean up horrible things in LookupInputWidget

Change-Id: Ifb7ffb180033422b5c3abfe56eb63a5b44d6789e
Localisation updates from https://translatewiki.net.

Change-Id: I5b56f59a4d25d305297eb5cbac4fdd85da5fb1df
Merge "AUTHORS.txt: Re-update for late 2014"
Merge "[BREAKING CHANGE] Unisolate dialogs"
Prevent clicks on focusable nodes in tables

Before processing a click on a focusable node or rendering a highlight
make sure that it has a ce=true parent.

Change-Id: I0802440d9f9eeacd687d7d1ca890ebca7785aef1
AUTHORS.txt: Re-update for late 2014

Add Alex to principal authors (previously missing); promote myself there.

Add C. Scott, Niklas Laxström, Oliver Buchtala, Peter Coti, Steven Zhang and
Thalia Chan to the patch contributors list, based on git shortlog perusals.

Change-Id: Icbece1b8cda049b97a65f1e115b45de833938d87
Disable cell editing when a context is opened

The table context requires us to switch back to a table
selection, so do so.

Bug: 72803
Change-Id: I29da357de61ab645c497f192c24c23f8ce9bf821
Add sparse table demo and fix related selection bug

Change-Id: Ie8f28c3488cdc0750a99fa4f55dd9e1ebd0512d0
Localisation updates from https://translatewiki.net.

Change-Id: I3bb877e7e028895b963aefb65a1bb3be17c69207
Fix selection when inserting a caption

Change-Id: Ifad4cd11de0059dbc309da5b3c413ea98240292d
Merge "Table caption tool"
Merge "Support editing of caption nodes"
Merge "Refactor and fix table cell editing code"
Merge "Store intended table selection before expansion and use when translating"
Merge "Add table selection support to clear annotation tool"
Table caption tool

Change-Id: I122375bd152fe8d0179a5eca212d8c89d544125b
Support editing of caption nodes

As ce is set to false on the table (as required by Firefox)
override ce back to try on captions and hide focus styling.

Make sure click events get through by never using preventDefault.

Bonus: refactor out event.target to tableCellNode lookup into
getCellNodeFromTarget.

Change-Id: Ie2e0472b473fd8befbd80fbe70bee51577c39ae7
Refactor and fix table cell editing code

Instead of storing a fragment in the surface and a selection
in the table node, just store a fragment in the table node and
a pointer to the active table node in the surface.

Fix bug triggered when double clicking in already-editing cell.

Change-Id: Ie2f4aea0ca166c9e35d6a56930054c8d8155d257
Add table selection support to clear annotation tool

Change-Id: I825b731859c42ce1c417c761896dfccad2ff135d
Merge "Always emit context change on null selection"
Merge "Update OOjs UI to v0.1.0-pre (da4b0d5c14)"
Always emit context change on null selection

Otherwise transition from table to null selection doesn't
update the toolbar.

Change-Id: I5e6f7cdf1103633185d179065a75f8f19320a323
Store intended table selection before expansion and use when translating

This makes cursoring through merged cells more logical without
breaking the expectation that selections always cover merged cells.

Change-Id: I28dccfde5e02d44871f1828154faccd33d8332cb
Merge "Fix selection transitions between FocusableNodes and non-linear selections"
Update OOjs UI to v0.1.0-pre (da4b0d5c14)

New changes:
e830a4d Conf for doxygen based PHP doc
80ecf60 Semiautomatically compare and synchronise JS and PHP docs
521fa21 Move 'readOnly' from InputWidget to TextInputWidget
9130eb3 OoUiTag: HTML-escape everything by default
0488141 Generate and run a JS/PHP comparison test suite
c552fea ButtonInputWidget: Explicitly disallow setting value when using <input/>
ab69d96 Apex, MediaWiki themes: Move colour definitions into LESS variables
d3367bb Turn FieldLayout into a <label/>
8a38c10 Provide abstract getLookupCacheItemFromData in LookupInputWidget
da4b0d5 Set input/menu widgets to have a max-width expanding to 100% rather than hard-coded

Change-Id: Id3e280a03fc305dc5cb706bc1208246275d169cb
Fix selection transitions between FocusableNodes and non-linear selections

Selection transitions from NullSelection to FocusableNodes
were broken: if the selection was a NullSelection and you
clicked a FocusableNode, nothing happened.

Selection transitions from FocusableNodes to TableSelections
were also broken: if you had a FocusableNode selected,
then clicked into a table, the FocusableNode would continue
to be highlighted as if it were selected.

Bug: 72721
Change-Id: I862da3eb304edf50b82c16c7b0ab735f74d003bd
Merge "Don't create tables with a thead"
Localisation updates from https://translatewiki.net.

Change-Id: I54018b03c2a343de15d40c16537fb32979dda0c0
Don't create tables with a thead

There is no way for the user to see the difference between
thead and tbody, no way for them to manipulate this difference
(whether a cell is header/data is on a cell level), and
Parsoid doesn't understand <thead>s. Eventually we should
deal with this correctly, but right now that isn't feasible.

Change-Id: I7a45d42f761ab982f59a939b6368c5e59e4dea7a
Merge "Allow custom type and attributes when creating a table"
Merge "Merge cells tool"
Merge "Table header/data format tools"
Merge "Supporting copy paste of single table cells"
Merge "Support annotation tool on table selections"
Merge "Actions and context menus for manipulating tables"
Merge "ContentEditable implementation for tables"
Merge "Data model implementation for tables"
Replace native range rectangle hacks with RangeFix library

Change-Id: I7f6cb6cbdd2b4385fb8ca95c03795cbdd929a860
Provide a generic mechanism for mapping classes to attributes

Currently this is only used by MW nodes (BlockImage and Table)
but this may be useful to core or other extensions in the future.

Change-Id: I2db656351942be14d320b4221d2f268c02875b7a
Merge "Add table to test node hack as MWTable is coming"
Allow custom type and attributes when creating a table

For example MediaWiki may want to create an mwTable with
attributes to mark a table as a wikitable or sortable.

Change-Id: Ieadb2eb2d1cbfbc1cb1cb77bf5d6a355e7a03ab8
Merge cells tool

Change-Id: If0ee115468c13412c52e5dba122105cdaca28e3e
Table header/data format tools

Change-Id: Id9879aaeda6e5f5487b668d7bd1f445e4e8aa425
Merge "Remove font-size: 0.8em; rule for OOUI change"
[BREAKING CHANGE] Unisolate dialogs

We don't really need dialogs to be isolated, because we don't
really need to preserve selections.

Compensate for selection not being preserved by reselecting
the fragment on close in FragmentDialog.

Change-Id: Id425c56d9d246809962b10ecb88010e191c94410
Update OOjs UI to v0.1.0-pre (deccd11549)

New changes:
be1f468 Localisation updates from https://translatewiki.net.
de6d500 Localisation updates from https://translatewiki.net.
049b28f Localisation updates from https://translatewiki.net.
a926d7d Fix a number of documentation syntax issues throughout the codebase
df625c4 Use primary colours for progress bar
d721cc1 Localisation updates from https://translatewiki.net.
c3aa4e1 [BREAKING CHANGE] Apply font-size: 0.8em; to non-isolated windows too
140509d [BREAKING CHANGE] If no $overlay is specified, default to this.$element
deccd11 Localisation updates from https://translatewiki.net.

Change-Id: Idf1f1c047dd414edc8cb80a6187055fc811dc95e
Add table to test node hack as MWTable is coming

Change-Id: I1be5985144b07fa44aa9a0c28d449497249595fc
Remove font-size: 0.8em; rule for OOUI change

Compensates for Id25907c4c4 in oojs-ui.

Change-Id: I13791f55bf8acf1b00f5b5d8ebe779f82eb5a1ef
Recalculate toolbar size on window resize

Responsive skins may change margins and positions on window resize
so always recalculate the toolbar offsets.

Bonus: Remove old 'position' event which hasn't been used for a while.

Bug: 68916
Change-Id: I822865f21c1a7f505fba3c5cf9775c62e5dce669
Merge "Make link inspector not close itself in IE... again"
Make link inspector not close itself in IE... again

My hacks for making the blur/focus code not notice that
the selection moved seem to be working (but only in VE-MW,
not in VE core), but now the SurfaceObserver's polling
is noticing that the range goes to null instead, and that's
causing inspectors to close themselves at the first poll.

To work around this, stop the observer when an inspector
is opened, and restart it once it's closed. There should
be nicer facilities for this in ce.Surface, but right now
we just want to fix a critical IE bug.

In the future, there should be more advanced logic here
with fake selections, so we can un-isolate inspectors.

Bug: 72392
Change-Id: I0a7c6aed37c1688eb81d4ca0c9ded231f9fd68f1
Supporting copy paste of single table cells

Change-Id: I5b42afa8a0e41e0b036d67730489a1b3f206ef26
Support annotation tool on table selections

Change-Id: I471f03c5a18847b91579bbc8a14f91c81818eadb
Actions and context menus for manipulating tables

ve.ui.TableAction contains actions as well as a generic table manipulation API.

ve.ui.TableContext provides a context menu for performing those actions.

Change-Id: I261a4169108f5ec64926b9d7af9e352586ab800a
ContentEditable implementation for tables

ve.ce.TableNode provides some visual sugar via overlay to display the table
selection.

Change-Id: I3d5509315e6f09138409bcaf4e39914874082353
Data model implementation for tables

Introduces dm.TableMatrix, a companion for dm.TableNode that provides a
non-sparse representation of tables with spanning cells.

Also introduces dm.TableSelection for representing table selections.

Change-Id: Ib4afcbaf157fb64666f52c9650f3260bb42f2a3c
Localisation updates from https://translatewiki.net.

Change-Id: Iedbded743f43d0e29a72488403cf74a4df2c3d78
Merge "Remove mw-specific message"
Localisation updates from https://translatewiki.net.

Change-Id: Ie88655627aad32554957322e698ba3717fb31b3b
Localisation updates from https://translatewiki.net.

Change-Id: I25a1e7418af88cd15a9cf487e34f948199206e99
tests: Prepare repository for running RuboCop after every push to Gerrit

For now ignoring all problems.

Bug: 69245
Change-Id: I51a0a38d4a1153e7998229e875c2444b0118d2e9
Remove mw-specific message

Change-Id: I4a15d6f9aba6b363f4d921228b7db74e094c016a
Follow-up I2f34448: ve.ui.InsertionInspector.js was deleted, so remove from manifest

Change-Id: I4bd6badefa37c484a40946b94f55f88cc3f06ad8
Update OOjs UI to v0.1.0-pre (40de4dabe6)

New changes:
849a687 Mute text color of accelerators in tool groups
40de4da Remind people to run composer install

Change-Id: I91c369da9170b6561906d27d193ce42b02ade021
Merge "Increase inspector height by 1 to deal with Chrome opacity bug"
Increase inspector height by 1 to deal with Chrome opacity bug

Bug: 72338
Change-Id: I4d237bf52c93ddadaf6612f52c513660cc617ef4
Merge "Remove insertion inspector class"
Work around *another* browser bug in getBoundingClientRect

This time, the browser gets confused by the cursor position
that is actually two cursor positions: the end of a line & the
start of the next line.

Because all great bugs are released as trilogies.

Change-Id: I638757a27eec58ba7b25c7449582f47f546a0bd7
Remove insertion inspector class

Only subclassed once and provides almost no functionality.

Change-Id: I2f34448273757e23ba02995bb2f3d77bdd7895a6
Merge "Remove crazy space exception from link validity regex"
Remove crazy space exception from link validity regex

We were allowing a link target to be ANY RANDOM GARBAGE, followed
by whitespace, followed by a valid-looking URL.

Change-Id: Ic148379a70e60e9c4930d094f6b1d9ace7bd0311
Merge "Add button to debug bar to enable input debugging"
Merge "Prevent JS error in getNativeRange()"
Prevent JS error in getNativeRange()

When no range is passed, but there is also no native
selection, we would fall through and use a null range
in places where a non-null range was expected. Return
null in this case instead.

There is a larger problem where programmatically moving
the selection to a slug doesn't work (see bug), this
was just one symptom of it.

Bug: 72258
Bug: 72259
Change-Id: I0f2486af8d92803eb8dae36bcdfe1b3f540119bd
Merge "Add 'valid' event to MediaSizeWidget"
Update OOjs UI to v0.1.0-pre (531d497d3b)

New changes:
3cd90ee TextInputWidget: Allow changing 'type' attribute
8bf9c29 FormLayout: Accept HTML form attributes as config options
fadc51d OOUI PHP: Unbreak ButtonWidget
50b926c build: Introduce 'quick-build' task
8e71673 Make padding between popup and container configurable
e432f9f Fix anchor positioning on popups
16ae17a PopupWidget: Remove references to 'show' and 'hide' events
cfe286f Localisation updates from https://translatewiki.net.
272476b GridLayout: Set dimensions.visibility = '' again if we have a height and a width

Change-Id: Ia2a6125e0da7659b08252b4ea2c2ddd9f6baa88a
Add 'valid' event to MediaSizeWidget

Add a valid event whenever the validity status of the media size
widget changes. Also, slightly change the placement of the 'change'
event to make more sense; it should be emitted when actual changes
were made, which is in 'setCurrentDimensions'

Bug: 72155
Change-Id: I925a9fa50ac56b015fd3c4d47a0add9589e78f4f
Merge "ve.ui.FormatTool: Update heading size CSS for new OOUI version"
Update OOjs UI to v0.1.0-pre (44db8292bf)

New changes:
bcc2927 Display keyboard shortcuts in right gutter of toolbar menus
f73d2b6 Localisation updates from https://translatewiki.net.
42be2b7 Progress bar widget
9833d47 Fix consoles in widgets demo
83645c4 OoUiPHP: Improve theme singleton handling
b4f0bc7 Add composer.json, use it for autoloading

Change-Id: I8770f4359eb912e01371cd6843da6dd61d832c3a
Merge "Fix getAnnotationsFromRange when starting with an element"
Localisation updates from https://translatewiki.net.

Change-Id: I447537bac0d5b1cccef2396cc25b5a3c6b0482c1
Merge "Remove MW-specific mobile hack from core"
doc: Use wildcards for Desktop/Mobile …Context and …Surface for simplicity of extension

Change-Id: Ib057e3a3af61dd61d05f0be2e7c45ee35115a51b
Add button to debug bar to enable input debugging

Currently this starts showing unicorns.

Change-Id: Ibec4c6411f0d77e9998d3809486ff3f214b90f55
Merge "[BREAKING CHANGE] Allow tools to specify which selection types they support"
Merge "Handle paste events on the paste target"
Merge "Stage a space when inserting a special character"
Merge "Fix height calculation in fragment inspector"
Merge "Stage an empty comment node when inserting"
Merge "Fix scroll jumping in Firefox when pasting at end of line"
Fix getAnnotationsFromRange when starting with an element

Change-Id: I7fde427507e5003f1ed8ab2326dfc12811da10a2
[BREAKING CHANGE] Allow tools to specify which selection types they support

Change-Id: I3adb071b04461f630d1e2f66f3c141f297a3b91e
Handle paste events on the paste target

We may want to handle paste when a focusable node is selected.

Change-Id: I02f480ec219f25e90d2d78dda07b8bfa35edcdc8
Fix scroll jumping in Firefox when pasting at end of line

Change-Id: Ia230e9b866bf8dccd74f06e4fc6d38bd8caddf3f
Update OOjs UI to v0.1.0-pre (db065e5a9f)

New changes:
8e1a057 ListToolGroup: Implement collapsible/expandable tools
35b58b5 Introduce ButtonInputWidget
9ca3b79 FlaggedElement: Fix PHP notice
db065e5 Localisation updates from https://translatewiki.net.

Change-Id: I27a925d3f8799fe1f5635cb41de95f5d555d1f5a
Localisation updates from https://translatewiki.net.

Change-Id: I22f96c39ec5ef6004216f41f1594055da3ed0d86
ve.ui.FormatTool: Update heading size CSS for new OOUI version

* Use .oo-ui-tool-title-text selector rather than .oo-ui-tool-title
  to avoid styling accelerator keys.
* Divide all sizes by 0.8 (and round to 5%), as we no longer need to
  match the font-size rule on .oo-ui-tool-title.

Change-Id: I4dd3c55017e7edc25c7af30b5f4c9e103a475016
Stage a space when inserting a special character

Avoids the inspector pointing at nothing as the main document
loses focus. Also move insertion to teardown process.

Change-Id: I182e04b84a853e3e7b4742b3888c0c25e5244d42
Fix height calculation in fragment inspector

Change-Id: I2aa4983f3c5a5948331eeac0187530a283aae344
Stage an empty comment node when inserting

Avoids having an inspector pointing at nothing.

Change-Id: Ic20fab14800a533e46ed35dc75f34027ad373b15
Use better unicorn image data

* PNG with transparency
* Much smaller

Change-Id: Ib5a882e9a7e977acb41ca4c82e01074f30ca908c
Update OOjs UI to v0.1.0-pre (0d358b167a)

New changes:
630586d noflip left: 0; rule for overlays
03e5106 Rewrite OO.ui.Element.getRelativePosition() to be smarter
90d4eef Replace calls to OO.ui.bind( fn, ... ) with fn.bind( ... )
77f0cd3 [BREAKING CHANGE] Remove deprecated Minerva theme
3e415f0 Clean up unneeded use of bind()
21c5b18 PHP Implementation of OOjs UI
3eb2ee5 OOUI PHP: TitledElement
70b35b2 OOUI PHP: GroupElement, ButtonGroupWidget
2f0df0d OOUI PHP: Layouts: Field, Fieldset, Form, Panel, Grid
d856e81 OOUI PHP: Widgets: Icon, Indicator, Label, Input, TextInput, CheckboxInput
0d358b1 build: Fix PNG image generation

Change-Id: I2d02d29c267a1b0db0cd1e1c19b93f488d02a9c2
Merge "Update OOjs UI to v0.1.0-pre (99ec31d9b9)"
Merge "Get rid of toHashObject from ranges/selection"
Merge "Close inspector on model select"
Merge "Fix shift-click select on links in Chrome"
Fix shift-click select on links in Chrome

Chrome tries to collapse the selection when you shift-click on them
because it forgets they're contentEditable. Detect this and fix it.

Change-Id: Ic52af6d14413bffdddb895c82512f7eb56b87dd9
Close inspector on model select

Previously we were getting this by accident as dm.Surface.branchNodes
had no 'end' property for a collapsed selection, so you always got
a contextChange when you went from a non-collapsed to a collapsed
selection, even if you stayed in the same link.

Change-Id: I868e1be4dc46c091a246a723c492c77e4efd24c4
Fix broken node change detection

Currently this.selectedNode is always undefined.

Change-Id: Ia60661e22bf33bec7b863cefe35a6262c1a90c11
Fix contextChange events from annotations

'contextChange' should be emitted whenever the covered annotations
change, not just insertion annotations.

Bug: 72152
Change-Id: I6b680a7e6e2992764b59bfdce53ae99c3b5deb1d
Get rid of toHashObject from ranges/selection

toJSON is supposed to return an object, which is converted to a
string in JSON.stringify, so the getHashObject step is unnecessary.

Change-Id: I5d1f32eedfbcc5f8079eee890e76047bc85b1de3
Merge "Use local var instead of bind() for inline functions"
Use local var instead of bind() for inline functions

Follows-up d3f26e653a4c. Using .bind() makes sense for binding a
function reference, but when the function is inline, might as
well use a local variable.

* Reduces code complexity.
* Makes code slightly faster.
* Easier to read (no need to visually track which 'this' this is,
  variables have descriptive names).
* Easier to maintain.
* Better static analysis.

In terms of memory holding, the result is the same since inline
functions naturally hold on to the containing closure due to
lexical scope.

Replaced all instances of "}.bind" in src/.

Left instances of "identifier.bind" alone.

Example:

	var widget = this;
	promise
		.always( function ( opened ) {
			opened.always( function ( closed ) {
				closed.always( function () {
					widget.foo();
				} );
			} );
		} );

Instead of:

	promise
		.always( function ( opened ) {
			opened.always( function ( closed ) {
				closed.always( function () {
					this.foo();
				}.bind( this ) );
			}.bind( this ) );
		}.bind( this ) );

Change-Id: I797a3667c67d52568150be9be5d043d149f22077
Merge "Replace calls to ve.bind( fn, ... ) with fn.bind( ... )"
Replace calls to ve.bind( fn, ... ) with fn.bind( ... )

No more PhantomJS, so we should be able to do this.

Bug: 62762
Change-Id: I823f118a2f6643efa4f88c86010300e861894166
Localisation updates from https://translatewiki.net.

Change-Id: I1be1b6df176e7573e30f497982f492c32ec84040
Update OOjs UI to v0.1.0-pre (99ec31d9b9)

New changes:
6298415 ButtonWidget: Fix titled button
918ebed MediaWiki theme: Fix styling of SearchWidget
bd03644 Refine global event handling in non-isolated window managers
9a7633c WindowManager: Wait for window to open before trying to close it
5516490 Element: Correct method name reference in documentation
99ec31d Position popups and their anchors correctly in RTL

Change-Id: I4266c58ec1a2e6cee54ffc55891a5c2097f0222f
Fix clipboardData API path on copy

Newer versions of Chrome return undefined for DataTransfer#setData
however we can still check for the presence of a fully featured
DataTransfer object by checking for the 'items' property.

Unfortunately this isn't robust feature detection so we'll need to
monitor the situation.

Change-Id: I52fbbe7597f4779b07c619a1ce601b9a7f504cc4
Factor out selection of entire pasteTarget

Change-Id: I9fe66a8c60aacaa09617ff72fb2bf58a151d0652
Prevent observeration during copy and paste

Change-Id: I2b368b0d0ecf487b1559be85447ce36debe1effa
Update OOjs UI to v0.1.0-pre (1829141230)

New changes:
393fd80 TextInputMenuWidget: Handle undefined value properly when toggling visibility

Change-Id: I4f6a7f62803d441de53271c645f07f76d23b3d06
Update OOjs UI to v0.1.0-pre (98cecf304d)

New changes:
98cecf3 Support MenuWidget's config.widget being in a different document

Change-Id: Ifc30790e67926bbdda0a8d5ec9464e7046f984ea
Merge "Followup 2432cbf: add recursion guard to updateSlug"
Followup 2432cbf: add recursion guard to updateSlug

popStaging() changes the model selection, then onModelSelect()
calls updateSlug() which calls applyStaging(). This is bad, and
the only reason this doesn't fail spectacularly is because we
didn't have multiple active staging levels.

The only reason we even noticed this is because we were
re-getting the range from this.slugFragment, but this.slugFragment
had been nulled out by the recursive call to updateSlug(),
so we got a JS error. This fixes that, but we also
already had this range lying around, so use it.

Bug: 72095
Change-Id: Ie50805a12ec2af3f0e1d97a4e64751a9b74fc422
Merge "Fix paste by never polling while pasting"
Replacing push.apply with newly created ve.batchPush in VE core

Bug: 66206
Change-Id: I618b3022007c2cec5ca4237e42d48c4df431498f
Fix theme on mobile-dist

Mobile was moved form minerva to MW, but not mobile-dist.

Change-Id: I914a66ea57d07185517ca1bf3d578074d146dcb5
Fix paste by never polling while pasting

Follow up to I99b99e8 (unicorns) which causes a surface observer poll
in between beforePaste and afterPaste, setting the selection to null.

Change-Id: I3cdfe7963d0880d2b9e19e9a384d73c99e9c3b80
Update OOjs UI to v0.1.0-pre (d74a46ca6a)

New changes:
d74a46c Introduce oo-ui-window-inner-overlay

Change-Id: I3f325f3c514d334179de46d0ea092b48f13b9dfd
Merge "Add content-heavy table to demo HTML"
Merge "More flexible selection reporting in the debug bar"
Merge "Don't force focus after history action"
Merge "Fix typo in getSelectionBoundingRect"
Merge "Add CollapseToFrom/To to Selection API"
Merge "Remove unused wrongly named class from ve.ui.Context"
Merge "Remove unicorn debug styling"
Merge "Also make transitions when leaving slugs work again"
Merge "Fix icon opacity"
Fix typo in getSelectionBoundingRect

Change-Id: I330b82c60079b34198205f2b111d8681f520047a
Add content-heavy table to demo HTML

Change-Id: Ia97314f87da3db0aba3daf28d4d7623dc3cd7da3
More flexible selection reporting in the debug bar

Change-Id: Ib1b67e3860105b6e54494c373ed1688abba9dda7
Don't force focus after history action

These days the surface correctly takes focus if necessary so this
is unnecessary and may cause unwanted scrolling when the selection
should be in the paste target.

Change-Id: Ib5fc40515a8c8780a4fee6e928d1e6322a2b7409
Add CollapseToFrom/To to Selection API

Change-Id: I767a984ff882842b305419f86a7534b0627801e0
Localisation updates from https://translatewiki.net.

Change-Id: Ib331c814680d2e5c0e0da186b1a6ac0c3158b5b7
Remove unused wrongly named class from ve.ui.Context

Change-Id: Idce65e51a4a46e97a5d240b2b1316440084fc29b
Fix icon opacity

As of Ieb27c3fd1 apex uses solid black icons with opacity
set in CSS, so make VE icons consistent.

Change-Id: I01b3256e577877fd327a26db0151c6cc59052c7f
Remove unicorn debug styling

Change-Id: I4a5d190dc3571ed413cc5a04d579089b4ba6fbcd
Update OOjs UI to v0.1.0-pre (837b2f733e)

New changes:
d40dd30 build: Update grunt-contrib-uglify to v0.6.0
0d89c99 test: Load a theme for the test HTML file so the tests don't fail
f245aa4 Element: Remove test for deprecated onDOMEvent()
cd15f18 Follow-up I730e3d7d: Tab not spaces
a923881 build: Use Karma instead of grunt-contrib-qunit
381864c build: Use Chrome and Firefox for tests instead of PhantomJS
044faa5 Follow-up If2da01a2: Fix grunt watch
d6e7af8 Adding OO.ui.TitledElement as mixin to label widget
6385af7 MediaWiki theme: Add filled white background to toolbars
837b2f7 Revert "Try to stop user from tabbing outside of open dialog box"

Change-Id: I63d51311f73d1295a2a35ebadf7d9ac835dec5c7
build: Update karma and switch from PhantomJS to Chrome

* karma from 0.12.23 to 0.12.24
* karma-chrome-launcher from 0.1.4 to 0.1.5
* karma-qunit from 0.1.3 o 0.1.4
* qunitjs 1.14.0 to 1.15.0

Not testing with Firefox yet as that doesn't pass (yet).

Change-Id: Ia0ec7b8a2a0aab22c144c82b87ac79a25ad550ae
Localisation updates from https://translatewiki.net.

Change-Id: I77fef392ba2d663524d30e66fd85914ee4c3fe29
Remove MW-specific mobile hack from core

Moved to MW in Ica837abd.

Change-Id: I94491de87d9cc7d0ecbd971ae9efd4ef10850858
Also make transitions when leaving slugs work again

With some more hacking. This can probably be cleaned up
significantly if we change the CSS to account for the
fact that the old way of doing slug animations doesn't
exist any more.

Also I hate browsers.

Change-Id: I66c9149307b68ef02a03e700f108e12da80a991b
Merge "Replace pawns with unicorns for pre-annotations"
Merge "Make slug animations work again"
Merge "Get rid of trigger-happy slugChange event"
Merge "Stage slugs"
Make slug animations work again

Done in a kind of hacky way by re-wrapping the paragraph
as a fake slug. I'm open to better suggestions.

Change-Id: Ia59d3e3ad47f16381c8b386279d9a3d7648da842
Get rid of trigger-happy slugChange event

slugChange fired on every content change and every selection
change, which is way too often for an event that claims to
be slug-specific. While ce.Surface does need to check for
slug exits on every content and selection change, this should
be done in ce.Surface itself, not by emitting slugChange
any time anything remotely related to slugs could possibly
have potentially happened maybe.

Replace slugChange with slugEnter, which is equivalent
to what slugChange(true) used to be. Split up onSlugChange
into onSlugEnter (the if(newSlug) code path) and updateSlug
(the if(this.slugFragment) code path) and call the latter
from onModelSelect and onSlugEnter.

Also get rid of the range parameter to these events:
onSelectionChange, onContentChange, onSlugEnter and
updateSlug all potentially change the document, so this
range parameter will get out of date. Instead, use the
current selection, which will be updated for document
changes.

The pollOnce call in afterPaste was added to ensure
slugChange got emitted; this can now be removed.

Change-Id: Ie3531f71a1bae39ca57be0e641c71d18bc6aa9f5
Stage slugs

As soon the cursor is placed in a slug, stage the creation of
a real paragraph.

If the the cursor is moved out of the slug and it is still empty
then pop the staging stack.

If the staged paragraph is added to, commit the staging stack.

As part of this slugs are now CE=false to reflect the fact they
don't exist in the model until the are clicked (not just selected
over). This avoids strange behaviour with selections that only
start xor end in a slug.

Future to-do:
* Fix or kill animations as this breaks them
* Possibly:
  + Fix existing bug with left/right arrowing into a slug
  + Fix up/down arrowing into a slug now they're CE=false
* Kill getSlugAtOffset, and any other code which detects for the
  presence of a block slug.

Bug: 65052
Change-Id: Ic857215654eaf5ee32e19d7db1d83185f561f783
Merge "Switch mobile demo from deprecated Minerva to MediaWiki"
Merge "MobileContext fixes"
Localisation updates from https://translatewiki.net.

Change-Id: I424437190936d8854bf3d0530bb73156fa55dffa
Switch mobile demo from deprecated Minerva to MediaWiki

Change-Id: I77d57932785c74b5b7a5de4a2105bbaa177281b8
MobileContext fixes

Make MobileContext work in standalone with less ugly hacks.

Change-Id: I77081bafb6a21ccb0ef21ba64f823aed809ffd46
Fix documentation

Change-Id: I9270a16aaa78bccb8feec1befe813d14a6deec94
Merge "ve.ui.CommentInspector: Update size when the textarea gets resized"
Merge "Followup b8d8a5b: fix getNativeRange() in null selection case"
ve.ui.CommentInspector: Update size when the textarea gets resized

Depends on Ie06e3699 in OOjs UI.

Bug: 71427
Change-Id: Icecf37521d42cd689588ff440830e8d8fb4a8704
Merge "Followup b8d8a5b: pass selections, not ranges, to SurfaceFragment#clone"
Followup b8d8a5b: pass selections, not ranges, to SurfaceFragment#clone

Bug: 71825
Change-Id: Iaa15f2fac0a74cce15e7ac3496a34012896eec96
Followup b8d8a5b: fix getNativeRange() in null selection case

Invoking getNativeRange( someRange ) should work, even if
the selection is null. Only when the range argument is also
null should a null selection cause it to fail.

b8d8a5b broke this by unconditionally returning null if the
selection was null. This commit restores the original behavior.

Change-Id: I12dfa1d21e75b8d12a71b644b7ce1b4db2abfec5
Followup b8d8a5b: fix stray check for !selection

Bug: 71823
Change-Id: I5b9275b37b6f1d017e45cf57c0cbe48511b55835
Merge "Move Bartosz to principal authors section"
Move Bartosz to principal authors section

Change-Id: I4c0c3bad45e32c87ce3798b163e333a30e40ff3c
Add Sucheta to AUTHORS.txt

Change-Id: Id2f7647e7cdb770b7ba5615a63a0c868331f697b
Getting rid of ve.splitClusters in VE core

Bug: 57628
Change-Id: I65d4c58466c486c3eae8399a26a362c2a79586a5
Followup 2fcc4c0: fix bugs with selection-only polling

The optimizations in selection-only polling were too aggressive.
When the cursor moved to a different node and the next poll was
a selection-only poll, we would not update this.node because that
code path was skipped for selection-only polls. Changing the
selection by clicking with the mouse will cause both a
selection-only poll (from onDocumentSelectionChange) and
a full poll (from a timeout in onDocumentMouseDown) to occur,
but they can occur in either order, at least in Chrome.
Probably what's going on is that there may or may not be
a timer tick between mousedown and selectionchange, depending
on how fast the user clicks or something.

I think this is related to recent cases I've seen of inserted
characters at the end of a line ending up on the next line.
I would imagine something like this could have caused that:
* User clicks at end of line
* mousedown happens, sets timeout for full poll
* DOM selectionchange event happens, does selectionOnly poll
* Poll emits selectionchange event but does not update this.node
* Timeout fires, full poll happens
* Poll observes that DOM selection hasn't changed, does nothing
* User types 'A', causes full poll
* Poll observes this.node has changed, does not check for content change
* No contentChange emitted, 'A' not added to DM, DM and CE out of sync
* Subsequent polls do nothing because DOM selection didn't change
* User types again
* Poll observes 'B' was added, emits contentChange
* CE sees <p>HelloA|B|</p>, computes insertion offset 7
* DM doesn't have 'A', so "insert B at 7" is <p>Hello</p>|B|
* This is normalized to <p>Hello</p><p>B</p> and committed
* New paragraph is rendered but old paragraph isn't rerendered
* CE DOM now shows <p>HelloAB</p><p>B</p>
* User is confused and goes to Roan's desk

Change-Id: I6333590e46c6c7241b8974afe5e5dfed9d79c877
Merge "[BREAKING CHANGE] The Great Selection Rewrite of 2014"
[BREAKING CHANGE] The Great Selection Rewrite of 2014

Creates ve.dm.Selection, and abstract base class representing
a selection of some type over a DM document, which can contain
0+ ranges. To begin with create LinearSelection which contains
a single range (and so replace ve.Range in most places) and
NullSelection which replaces range === null.

For many actions (annotation actions, copy/paste, special key
handling) our current logic only makes sense for linear selections
so make it clear those are requried at the moment.

Future selection types e.g. table selections, will require us
to add in new logic where we test for selection type.

Change-Id: I2b6be9f1eff940e62048cc55356f61ceb416a32f
Localisation updates from https://translatewiki.net.

Change-Id: Ief19e68a000bd68d087010ba5c4379d46df3bf05
Merge "Emit change event when dimensions change in MediaSizeWidget"
Emit change event when dimensions change in MediaSizeWidget

Whether the dimensions are valid or not, the 'change' event should
be emitted when the dimension inputs are changed. This will cause
the dialog to revalidate the size widget in general and hide or
show the 'apply' button accordingly.

All changes for the widget value change the inputs themselves,
either by clearing them out or setting a different value. The
'hidden' changes (like those that set the max dimensions,
default dimensions, etc) are changes to the Scalable object
that emits its own changes.

Bug: 70861
Change-Id: Idb82d597d5b2b6664401208a54d33d26edbf6d31
Update OOjs UI to v0.1.0-pre (26dadbc60f)

New changes:
6c91643 Make buttons respond to :active events
9137aaf Move window overlay up to be a sibling of the frame
19d8c83 ComboBoxWidget: Append menu to $overlay option
eb0fcb8 InlineMenuWidget: Fix documentation
19d2c2b SelectWidget: Fix typos in documentation
495d281 TextInputMenuWidget: Fix typo in documentation
b4ae961 Toolbar: Correctly display "More" label on catch-all groups
32e769e Toolbar demo: Fix tool name mismatch
e9983b6 build: Clean up Grunt config and add missing csscomb run

Change-Id: I1ee2e51460c709fa01934ae7d58ac8411b124867
Localisation updates from https://translatewiki.net.

Change-Id: Ic83b1539205574ec41383d0a85f31800eac61971
Update OOjs UI to v0.1.0-pre (48980881f3)

New changes:
aafebc4 LookupInputWidget: Fix whitespace and documentation
cf89618 Element: Remove unneeded IIFE
4898088 build: Create minified JS and CSS distribution files

Change-Id: Iaea30c2429401be4061f30d98a8edc7cce5567b1
update-oojs-ui.sh: Exclude the minimised distribution files

Introduced by Ic8f8194. Also removing unneeded exclusion of non-existant
unthemed CSS file after Ieb27c3fd.

Change-Id: I42a7c32f6aeede42b0d3ab65ed53f3f8fdd252f5
Merge "Revert "ve.ce.Surface: Magic workaround for broken Firefox cursoring""
Revert "ve.ce.Surface: Magic workaround for broken Firefox cursoring"

Causes ugly-looking "NS_ERROR_FAILURE" exceptions in some cases.

This reverts commit 0d7eaf51767c4061b478610a035a3bc387c0973a.

Bug: 71580
Change-Id: Ief5c5369311e20a0fa8d6af5780c68bb6f5b9e2e
Localisation updates from https://translatewiki.net.

Change-Id: I91f5ffaab0a8d4b55bd8ae3e42b5da007fd3ee92
ve.ce.Surface: Magic workaround for broken Firefox cursoring

Bug: 70724
Change-Id: Iffef05d118f819afc8497cc771a789c8ce69128d
Localisation updates from https://translatewiki.net.

Change-Id: I7fee8432e82f5f5099885af201568e94b877c941
Update OOjs UI to v0.1.0-pre (30b0407428)

New changes:
3386c39 Make this.$.$iframe actually point to an iframe again
bb7bbf5 ClippableElement: Use 'overflow-[xy]: scroll' rather than 'auto'
71176eb TextInputWidget: Don't mix inner and outer heights in calculations
f1dd60e TextInputWidget: Work around Blink height miscalculation
954a369 WindowManager: Emit 'resize' event when a window is resized
3232d6f Try to stop user from tabbing outside of open dialog box
6c4baa3 Tool: Use FlaggedElement mixin to let tools be flagged

Change-Id: Ia0a0b45e5f210314592733114a05583973b011d6
Merge "Update OOjs UI to v0.1.0-pre (afa3241e8e)"
Update OOjs UI to v0.1.0-pre (afa3241e8e)

New changes:
8daef61 TextInputWidget: Add setValidation function to change pattern used to validate text
953c46c [BREAKING CHANGE] Create a MediaWiki theme
e2a3bae PopupWidget: Position body/anchor using 'margin-left' instead of 'left'
4f50c34 Correct the left positioning of a popup wrapper
afa3241 Move references to pending.gif to the themes that provide it

Local changes to compensate for new OOUI build system.

Change-Id: I32b12bc87b8895586a4917e1f896072b094ce2ca
Merge "Handle triple click with surface fragments"
Handle triple click with surface fragments

Also change the type argument of the currently-unused 'closest'
expandRange mode to be a instanceof check, instead of a
string type check.

Change-Id: I9282be1a01bd3559c3c565b3237d6ac7a274dada
Merge "Fix JS error in mostly-dead Opera compat code"
Fix JS error in mostly-dead Opera compat code

We totally forgot to bind it, and didn't notice because
it never runs except when you tab out of a dialog
in Chrome.

Change-Id: Iaa8b29deb7f7e7e7d6c521ce2a12a48dd0d14041
Followup b149390: fix dm.Surface's concept of "selectedNode" to match SurfaceFragment's

In SurfaceFragment, there is only a selectedNode if the selection
precisely contains a node. In Surface, however, the same name
was being used to refer to the node the selection is inside of,
even if the selection doesn't fully contain the node.

This led to problems when ui.DesktopContext assumed that
if an inspector is open and selectedNode is not null, we
must be inspecting a node. This is clearly not true,
because when the link inspector is open, the selection
is entirely within one TextNode. Worse, when the user
clicks out of the inspector but within the same TextNode,
the selectedNode doesn't change, and so the inspector
isn't closed.

Bug: 71373
Change-Id: Ib67fe72a029ef8c706495ab150e8316ae4038a18
Merge "ve.ui.CommentInspector.js: Fix documentation"
ve.ui.CommentInspector.js: Fix documentation

Change-Id: I89f825ea2f5f1a732277041ba379d58d4d053a3a
Merge "ve.ui.FragmentInspector: Remove #setDimensions"
ve.ui.FragmentInspector: Remove #setDimensions

This method is seriously sick and needs mercy killing.

Change-Id: Iff682f14d2dd0f8c779754b5fef681945c0d1c0e
Merge "Followup a618491: fix JS errors when slugging near annotated inline nodes"
Merge "Record and show observation times in ve.Filibuster"
Record and show observation times in ve.Filibuster

Change-Id: I35718643b8a42ee1f9f0effde2df9247bf81923c
Followup a618491: fix JS errors when slugging near annotated inline nodes

We were incorrectly assuming that this.children[i].$element
would always be a direct child of this.$element. This is not
true for annotated inline nodes, so if there was a slug right
before one, we would call x.insertBefore( y, z ) where z is not
a child of x, which understandably causes an error.

Bug: 71418
Change-Id: Ic5bf22106bb8711a2b325c4c183c4ed86ccafd34
Merge "ve.ui.CommentInspector.css: Fix documentation"
ve.ui.CommentInspector.css: Fix documentation

Change-Id: I81f01e1cfa78fb4993c151ad1c43bbecc4257c1c
Localisation updates from https://translatewiki.net.

Change-Id: I33e0e8fb5fa408ef3dc1dabb0b776e906490ef0a
Merge "ve.ui.DesktopContext: Fix comment typo"
ve.ui.DesktopContext: Fix comment typo

Change-Id: I1d5425a5338762ad33b6ba240d185ed148090e9d
DesktopContext: Ensure that inspectors/menus are fully visible when created

* Make the PopupWidget that hosts the inspectors/menus non-clippable.
  It shouldn't be big enough to need it, and that makes it impossible
  to scroll it into view.

* Scroll the PopupWidget into view after updating its dimensions.

Depends on Ib07a8362 in OOjs UI. Without that patch the popup widget's
$element is a 0x0 box, so scrolling it into view doesn't make the
entire contents visible.

Bug: 52526
Change-Id: I4e49a466d5becdfd3f84aab11de915cfa12468fa
Update OOjs UI to v0.1.0-pre (98e770ce46)

New changes:
888f1c6 Fix for endless loop in SelectWidget
28f6b94 PopupWidget: Make $element not be a 0x0 box

Change-Id: Id9c9e79e4a1fb4d3a42f7fec65c1360b3b192bfd
Merge "Fix getUsedStoreValues and allow a range to be passed"
Fix getUsedStoreValues and allow a range to be passed

Also add unit tests to prove it works now.

Change-Id: I94e72c0a5cd2b57c4a4ad33af94d8e8afffd9a62
Merge "Don't perform focus node native selection trick while dragging"
Localisation updates from https://translatewiki.net.

Change-Id: Ib0fad27e947ec9943e1f7297ed43fa0865450bda
Merge "Be more cautious about placing the cursor"
Merge "Fix some getSelectionRects edge cases"
Follow-up I99acd6c6: More files' header comment fixes

Change-Id: Icba21c6c06bc607977aa6115d2b8c333f4e83f15
Don't perform focus node native selection trick while dragging

1) The trick is so FF fires a copy event when there is no
text selected. In the case of dragging there will be something selected.
2) It breaks the native selection so you can't continue dragging.

Bug: 71139
Change-Id: I2663968b693c8992b942ab6d5b429d7552c34a5d
Fix some getSelectionRects edge cases

getSelectionBoundingRect wasn't using the focusNode fallback
from getSelectionRects so factor that out and use in both.

Fix the fallback to work when the focusNode is a text node (traverse
up to the nearest element node).

Change-Id: I4b14f4a20a6eb13748f1ba874065b8fc2623d870
Be more cautious about placing the cursor

If we can't find a content offset, check for a slug at 0, otherwise
give up. Don't assume it's safe to put the selection at 1.

Bug: 71187
Change-Id: I72556be6bdc45fc6ff62a4096ba19a26da18a91f
Merge "Account for WhitespacePreservingTextInputWidget#getValue being called early"
Merge "Account for isValid() becoming async"
Account for WhitespacePreservingTextInputWidget#getValue being called early

The new validation code in TextInputWidget causes getValue()
to be called from the InputWidget constructor, and this.whitespace
hasn't been initialized yet at this point.

Bug: 71246
Change-Id: Ib58812636f55eafef5c39468785c210cb0ac7827
Account for isValid() becoming async

TextInputWidget#isValid was added as an async function in OOUI,
but we already had a synchronous isValid() in LinkTargetInputWidget.

Call this function using its new async pattern in LinkInspector,
and get rid of the override in LinkTargetInputWidget in favor
of passing a regex in the constructor.

Bug: 71237
Change-Id: I6cff96aaa64f95114c612e43cce3556cb8c82145
[BREAKING CHANGE] Rename ve.Document.getNodeFromOffset to getBranchNodeFromOffset

Avoids confusion with getNodeFromOffset on the document node. Change
the check to use hasChildren (which is the same as "does it mixin
ve.BranchNode")

Move ce/dm shared code to ve.Document where possible.

Change-Id: I086abcfb0a4eae47bec441012c34ccb80e9cd895
Merge "Calculate selected node on change and emit contextChange"
Merge "Fix documentation in ve.Document"
Merge "Move deletion part of handleDelete logic to surface fragment"
[BREAKING CHANGE] Remove ve.isArray and use Array.isArray instead

Change-Id: I8069997548a3426cf3e71a6e87ec90716323e502
Fix documentation in ve.Document

Change-Id: I7660e86542b4df80252a1a3b3a2b523af99c1160
Calculate selected node on change and emit contextChange

What we were calling 'selectedNodes' were actually the start and end
branch nodes. In addition to this we also care if the inner selected
node changes, so emit a contextChange for that, and in context check
that for a change before closing an inspector.

Bug: 71131
Change-Id: I1596bb98189f8233e5a36f96a119f6b052c59360
Update OOjs UI to v0.1.0-pre (880100c45e)

New changes:
7ecfa7c TextInputWidget: Determine validity on blur and change.
e43584b Re-clip popups after resizing them

Change-Id: Iac7aed0e7cbe823ae5f78c641b8c0145334f95c8
Merge "Don't drop 1px rects for FocusableNodes if all we have is 1px rects"
Don't drop 1px rects for FocusableNodes if all we have is 1px rects

This avoids returning a null boundingRect unless we absolutely have to.

Bug: 70768
Change-Id: I06fbc1191ba567774691e755c5e071e049cf07e9
Merge "Tolerate null boundingRect in all code paths in DesktopContext#updateDimensions"
Merge "Tweak traverseUpstream documentation and code style"
Merge "Prevent page elements from displaying on top of highlights"
ve.dm.Surface: Fix documentation typo

Change-Id: I2ad37dc07eee0dac32de99b64bd99f39994c94f0
Merge "Make newFromTranslatedRange a method (translate)"
Prevent page elements from displaying on top of highlights

Use position: relative; z-index: 0; on .ve-ce-surface to create a new
stacking context [1], which prevents elements with z-index from being
positioned "higher" than .ve-ce-surface itself.

As .ve-ui-overlay has a z-index of at least 1 (possibly more in case
of some MW skins), elements that are part of .ve-ce-surface will no
longer be displayed atop overlay highlights, regardless of how high
their z-index is.

[1] https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Understanding_z_index/The_stacking_context

Bug: 70074
Change-Id: I6c312269998ef775bc852d391cd1d644a0566531
Merge "Add expand method to ranges, finish unit test coverage"
Tolerate null boundingRect in all code paths in DesktopContext#updateDimensions

We had code paths that protected against a null boundingRect,
but not all of them did, which caused crashes if you had
a FocusableNode with a null boundingRect.

Bug: 70768
Change-Id: I92ffdda47626b7638d2c86ad50217b42c45d1acd
Converter: Allow Nodes to return empty arrays if they want not to be output

Change-Id: I1224cdd87a41de4fa72a4e93d87ecdfcf525c769
Update OOjs UI to v0.1.0-pre (bab8befc94)

New changes:
5d58e70 Documentation: ActionWidget is non-framed by default
7c0834d Localisation updates from https://translatewiki.net.
948b303 build: Split test into a lint task for quickly running those tasks
bab8bef Localisation updates from https://translatewiki.net.

Change-Id: Ie28012a349f2171d15f76f86bf3e74e06a102fd4
Merge "SurfaceObserver should observe the surface"
SurfaceObserver should observe the surface

The clue's in the name.

Change-Id: I1941b87cbc70e195382e754dba3e64a2aa06d695
Localisation updates from https://translatewiki.net.

Change-Id: Ia512c63fbb7c647e9deb718213c4dba337bf5f87
Make newFromTranslatedRange a method (translate)

For consistency we use methods for range modification (e.g. flip, truncate)

Change-Id: I5d3596b40c9943bc0b037074a065d4f719bb1405
Add expand method to ranges, finish unit test coverage

Change-Id: I563f15f707191d4b0ed1f9b3ffbac4d64e1d6f93
Localisation updates from https://translatewiki.net.

Change-Id: Ie13b0d65b08294ee67edaf659406550a3ab42d72
Tweak traverseUpstream documentation and code style

Change-Id: I5438cb8bba8eca9395764e555f96dcdd4919ea21
Merge "README: Add devDependencies badge"
Merge "Replace boolean checks of getSlugAtOffset with hasSlugAtOffset"
Merge "Work around Chrome's Range.getClientRects bug"
Merge "Provide a method to get all the rectangles for a given selection"
Merge "Allow specification of range when getting selection rectangles"
Merge "Rename inlineRects to startAndEndRects everywhere"
Merge "Remove getSelection*Client* methods"
Merge "Separate computation of highlights from rendering"
Merge "Add getNativeRange method with optional DM range argument"
Update OOjs UI to v0.1.0-pre (f2c3f12959)

New changes:
f8e3599 Fix automatic sizing of windows
427b9a4 README: Add devDependencies badge
5018f7b build: Use csscomb to prettify the CSS
f2c3f12 Followup ec785c2: re-evaluate clipping state after positioning

Change-Id: I0e1d5d44a6e90a66cfa280c782b6e75ba44ce7c4
Merge "Refactor out finding of CE focusedNodes"
Merge "Follow-up cc657c4: Change strikethrough key command to not clash with Macs"
Merge "Emit 'position' and 'contextChange' events correctly"
Work around Chrome's Range.getClientRects bug

Do some DOM traversal so we only calculate for ranges which
Chrome can handle, then concatenate

See https://code.google.com/p/chromium/issues/detail?id=324437

Change-Id: I63c7a50f7efb73937b65c055675378f3b880e03e
Provide a method to get all the rectangles for a given selection

Change-Id: I46d30ef788cfe93defbc793ca678db886994622e
Allow specification of range when getting selection rectangles

Change-Id: I474aee6c202859c08df2fd1b40abc3d4e2bc370c
Rename inlineRects to startAndEndRects everywhere

Also rename outerRects to rects in FocusableNode

Change-Id: I8d3f2bc303495bf140710874c897b2477531236b
Remove getSelection*Client* methods

Maintaining two versions for one optimisation is too much work.

Change-Id: I92fdcc24c6114e5e02d5bc5b227b1660d2429e52
Separate computation of highlights from rendering

This allows us to ask the focusable node for its dimensions
without rendering a highlight.

Change-Id: I46ba279c840628ca1d7ebb4b71dd99f066bfd5fa
Add getNativeRange method with optional DM range argument

Allows getting of the native range for any DM range, not just the
currently selected one. Also handles edge cases and exceptions.

Change-Id: I63619cfb3c0e8a1e566668996b91a3ba0fa436d7
Refactor out finding of CE focusedNodes

getFocusedNode now takes an arbitrary range.

Change-Id: Ie59239ec5fa3493dfc8f6a6b200a9a5405a96c66
Emit 'position' and 'contextChange' events correctly

Emit position events after model transaction updates.

Emit contextChange events even when staging.

Focusable/ResizeableNode:
* No need to listen to model transact as that now triggers
  a position event on the view

Context:
* Don't listen to 'select' in the base class, just contextChange
  by default.
* Don't close inspector on contextChange if we have a selected
  node that hasn't changed now that they are emitted while staging.

DesktopContext:
* Connect model select and view position events to onPosition.

As a result of fixing context events, debounce the updateDimensions
handler.

Change-Id: I98e0559a993620f057e6036bfd8f6a21bf59e788
Replace boolean checks of getSlugAtOffset with hasSlugAtOffset

Change-Id: I68e295599d4b66642c7d81447e0ba0ccbe1602c4
Move deletion part of handleDelete logic to surface fragment

Bonus: Add range overriding via update method so we don't
have to call change([], range).

Change-Id: Id7c291b0fb9b7e517253d8b85b334a8be65756e1
Merge "Remove hard coded types from canHaveSlugBefore and fix logic"
Merge "Move getRelativeOffset, getRelativeRange, getNearestFocusableNode to model"
Merge "Add hasSlugAtOffset to DM document"
Merge "Calculate slug positions in the model"
Merge "Move sluggability methods to model"
Remove hard coded types from canHaveSlugBefore and fix logic

Move node specific behaviour into nodes:

* TextNode
  - Never slug

* ListNode
  - Slug before, but not after (as double enter lets you insert after)

Change-Id: I20df551d9b1b9c71d1688ba51de9edd9bad75f1c
Move getRelativeOffset, getRelativeRange, getNearestFocusableNode to model

Bonus: Remove ve.dm.Node.getOuterRange get override which was providing
less functionality than ve.Node.

Change-Id: I76f9476c25a64157165fe24fe889d7b9b1020451
Add hasSlugAtOffset to DM document

Change-Id: I3e9930e56c0e4d9978f73bd850f27a23230424e7
Follow-up cc657c4: Change strikethrough key command to not clash with Macs

Change-Id: I46c47023590628597154443fb763cf68756703fe
Merge "Update OOjs UI to v0.1.0-pre (ec785c2c64)"
build: Make headers atop dist files suitable for distribution

Previously we prependied the same header in dist as for in-repo files,
which isn't very useful once distributed as a standalone file. Also,
change all in-repo files' headers to simply be the copyright message
with a reference to http://ve.mit-license.org.

Also fixed grunt-build which was broken. Grunt "git-build" should be
part of `grunt test` not `grunt build` – this way you run grunt-build
for releases and it won't include the git commit hash.
This matches the setup we have in OOjs.

Change-Id: I99acd6c6a6748b2029bb653836fed00dd8b5d21b
Update OOjs UI to v0.1.0-pre (ec785c2c64)

New changes:
09e9d2c Fix documentation lies about dialog labels
ec785c2 Followup 6c862e8: position before AND after showing in TextInputMenuWidget

Change-Id: Ia1c9aa039503f0f18ac1da7748e7f87bfcdf7092
Merge "Make the trigger demo kind of work again"
Make the trigger demo kind of work again

Or at least make it not explode in a hellacious ball of fire.

Change-Id: I5923b57eff5be4f8c945adac7dd8f62d6f13955b
Merge "Followup cc657c4: make code and strikethrough key commands actually work"
Followup cc657c4: make code and strikethrough key commands actually work

Add them to surfaceCommands and CommandHelpDialog. Switch history and
formatting so the CommandHelpDialog doesn't overflow into three columns.

Change-Id: Id006a59dff608b6bbaaab066323f260435009f58
Merge "Update OOjs UI to v0.1.0-pre (24ac83a472)"
Localisation updates from https://translatewiki.net.

Change-Id: I11d80973d0053e72bf3dc9a404dea2589daa4373
Merge "Set size to default on 0 value"
Update OOjs UI to v0.1.0-pre (24ac83a472)

New changes:
91a7fab build: Bump miscellaneous devDependencies to latest
18c32c5 Localisation updates from https://translatewiki.net.
283e2a1 When updating the ideal size while not clipping, set that size
6c862e8 Update width of TextInputMenuWidget before fitting labels, not after

Change-Id: If825e0ec0e294b2569c98b5340be436ba896eceb
ve.ce.CommentNode: Correct comments formatting

Change-Id: I56dd3409306b23953b45406768ce9645b3aae2de
Merge "[BREAKING CHANGE] Create ve.dm.Focusable and store focusable flag there"
Calculate slug positions in the model

Change-Id: I4c5cb277facd29d6a69aac95e5bcff5d56bee89a
Merge "Followup 80dd016: avoid using XMLSerializer when not absolutely necessary"
Set size to default on 0 value

Make sure that the media size widget sets default size when the user
inputs 0 manually. Also revalidate the widget if the user types
non-numeric (invalid) characters.

Bug: 70861
Change-Id: I256d1ac87a052d3e8a909ca1294023d75af3886e
Followup 80dd016: avoid using XMLSerializer when not absolutely necessary

Because XMLSerializer is broken in Firefox: it URL-encodes hrefs.

Also move brokenness detection out of transformAttributes and into
parse/serializeXhtml.

Change-Id: I917944a16786040c57969c611f82192de29ee57b
Move sluggability methods to model

Change-Id: Ie189979baae202572bdf8936c9431b8b49f55d35
[BREAKING CHANGE] Create ve.dm.Focusable and store focusable flag there

Eventually all selection logic should be in the model, and as
focusable nodes behave differently, this information needs to
be in the model too.

Change-Id: Ib381510366f8c8ebb7a67af627178490ff6a736e
Localisation updates from https://translatewiki.net.

Change-Id: Ide8e898d25688a31c9de86a74a37ee6f09a72b35
Merge "Work around IE's normalization of style attributes by abusing XML parsers"
Work around IE's normalization of style attributes by abusing XML parsers

ve.parseXhtml() takes HTML that is also valid XML, and abuses
an XML parser to shadow the style and bgcolor attributes with
data-ve-style and data-ve-bgcolor.

ve.serializeXhtml() takes a document created with ve.parseXhtml()
and undoes the shadowing, restoring the attributes' original
values.

This is necessary because IE corrupts the values of the style
and bgcolor attributes by normalizing them. The original values
of these attributes are not accessible in any way that I could
find other than by using an XML parser.

These functions detect whether the browser bug is present,
so shadowing is not performed in compliant browsers.

Change-Id: I0fb47f7c91f6130788611466f72aa9bdff249b5f
Merge "build: Bump miscellaneous devDependencies to latest"
Merge "Add keyboard shortcuts for strikethrough and code annotations"
Update OOjs UI to v0.1.0-pre (49b64bdba7)

New changes:
c82b429 Work around position: fixed; bug in Safari
9e1432e Split out isPending, pushPending, popPending, etc. into PendingElement

Change-Id: Ifd213123adfc9c96de2f16379c8ed3d706c210f8
Merge "Update OOjs UI to v0.1.0-pre (073f37e258)"
Merge "ve.ce.Surface: Insert new paragraphs after empty nodes rather than before"
Merge "ve.ui.AnnotationInspector: Apply existing annotations to inserted content"
Merge "Strip Start/EndFragment comments from paste"
Update OOjs UI to v0.1.0-pre (073f37e258)

New changes:
845287a Update OOjs to v1.1.1
f7d11f7 Make popups position themselves correctly when dimensions change
073f37e Improve FieldLayout help popup appearance

Change-Id: I5829c833b418568d991e5ce89b04413d07cbc1ba
Localisation updates from https://translatewiki.net.

Change-Id: Ic14651b5ba1a1c7a6634a0e269134921646aa848
README: Add devDependencies badge

Change-Id: I7021e81907e59e2f2fcc0df83e0caa28b5cd33eb
build: Bump miscellaneous devDependencies to latest

Updates:
* grunt                  0.4.2 -> 0.4.5
* grunt-banana-checker   0.1.0 -> 0.2.0
* grunt-contrib-clean    0.5.0 -> 0.6.0
* grunt-contrib-csslint  0.2.0 -> 0.3.1
* grunt-css-url-embed    1.0.0 -> 1.0.3
* grunt-jscs             0.6.1 -> 0.7.1
* grunt-karma            0.8.3 -> 0.9.0
* karma                  0.12.17 -> 0.12.23
* karma-coverage         0.2.4 -> 0.2.6
* karma-sauce-launcer    0.2.9 -> 0.2.10

Change-Id: I2e033b316b14552c33008d8e53f3e4285a054e86
Strip Start/EndFragment comments from paste

Bug: 70799
Change-Id: I3460b04ebb00d5dfa021c31622dcf220e61a7e08
ve.ui.AnnotationInspector: Apply existing annotations to inserted content

Turns out this is already implemented, just not used. Blaming related
lines provided me with no insight why it was done this way, and I
don't see anything that this change would break.

Bug: 70534
Change-Id: Ibd77057405f5080e70265abc3043abcd07da9511
ve.ce.Surface: Insert new paragraphs after empty nodes rather than before

The code was checking the "at the start" case before checking the "at
the end" case, and for empty elements these are equivalent, so new
paragraphs were inserted before. Just flipped the order.

Bug: 59652
Change-Id: I0b748be6d84041a8f5f801bd63d7dcce36debebe
Add keyboard shortcuts for strikethrough and code annotations

Bug: 52597
Bug: 60257
Change-Id: Iace6f59791bc2050fa14daa70d16b1a17bda6125
Merge "Account for the case where a FocusableNode has an empty outerRects array"
Account for the case where a FocusableNode has an empty outerRects array

In this case boundingRect will be null, so don't try to modify it.
Also, ve.getStartAndEndRects() will return null, so check that too.

Bug: 70777
Change-Id: If67fe35b540b667d85b21f9bbbbe6a73caac2ddb
Merge "(Kind of) fix treatment of strange dir values"
ve.getStartAndEndRects returns null for empty rect lists

Currently returns {start:undefined,end:undefined} which is confusing.

Bug: 70770
Change-Id: I80d0632fd8b4b5e716b79966dc412cb9b9caa4ff
(Kind of) fix treatment of strange dir values

We don't really want <span dir="auto"> to be treated as a language
annotation. So only consider spans language annotations if they
either have a lang attribute, or a dir attribute that's specifically
set to ltr or rtl.

Also fix a bug where not having a lang attribute set would cause
the LanguageInputWidget to crash.

Bug: 70731
Change-Id: Ib41560526e7dcab1b4ab9813eea67dbe821a4001
Merge "Fix JS error due to typo in dm.Converter"
Fix JS error due to typo in dm.Converter

The typo was in an unused code path that only runs when
toDataElement returns null/undefined.

Change-Id: I741605fb3d1403f163dade7cbc3151aef23e46ec
Trigger selection update on selectionchange or mousemove events

Using the selectionchange event (or mousemove where not available) have
the surface observer update the selection immediately. Implement an
optimised pollSelection mode in SurfaceObserver for this purpose.

Bug: 59822
Change-Id: Ic7413c31c37f6fcd90ae1c724567298c772d517f
Cache $documentNode in surface view

It's used in a load of places and can never change.

Change-Id: I7bb472065d0459071d9246fe607d5d7c165bcddd
DomRange / getOffset edge cases

Return a null range if getOffset throws an exception, and throw
an exception if we get as far as trying to add the document length
(i.e. node is out of the document).

Change-Id: Idf0820bf29e257623fe262bf47935a01ec7985ed
Localisation updates from https://translatewiki.net.

Change-Id: I7c7a496af6d42b7aff53baf0b3d0542858fe1be2
Merge "Bind ve.ce.Surface#onDocumentMouseUp to the entire document on mousedown"
Bind ve.ce.Surface#onDocumentMouseUp to the entire document on mousedown

Otherwise a mouseup outside the surface is not detected.

Bug: 59822
Change-Id: I92b34624f84c55c5a6630e464c685d8fd83c4f43
Rename frequency to pollInterval in SurfaceObserver

Frequency is measured in Hz/s^-1. What we are specifying is
a time interval.

Change-Id: I0a46b3f6880ea2f02b217610148e5dd8018bcc1f
Convert all instances of assert.equal to assert.strictEqual

We don't tolerate == in our code, so we shouldn't use it in our tests.

Also replace notEqual with notStrictEqual, and assert.ok( val ) with
assert.strictEqual( val, true ) where val is generated by a non-native
function and we want to check it actually returns a boolean as well.

Fixed one test in ve.ce.test.js which was comparing x with [x].

Bonus: Fixed comments in ve.Range.test

Change-Id: I256dce8ef854f2581c7ad1029e55bf068d91508d
Merge "Add containsRange method to ve.Range"
Add containsRange method to ve.Range

Update and add tests.

Change-Id: I67aacf70f4e03c8734a048e74d42367eb3df6f26
Merge "Rangy's dead honey, rangy's dead"
Merge "Kill rangy: Vol. 2"
Merge "Kill rangy (almost)"
Merge "Split getSelectionRect into bounding and inline"
Rangy's dead honey, rangy's dead

The final use of rangy was checking if the native selection is backwards.
What we actually want to do is make up/down arrowing consistent in all
browsers when you have a selection.

The only case that needs fixing is when the browser doesn't support backwards
selections but the dm range is backwards, which we can detect easily.

Change-Id: Ifd5000fc5e667cb9fd6db0e97cf8a03b4da45553
Update OOjs to v1.1.1

Release notes:
 https://git.wikimedia.org/blob/oojs%2Fcore.git/v1.1.1/History.md

Change-Id: I2a78dcd147def3b02314c176e51accb2cefe872e
Kill rangy: Vol. 2

Write a minimal replacement for getPositionFromCoords, that is trivial
in Chrome and Firefox, and uses TextRange.pasteHTML in IE.

Bonus: work around IE's lack of type support in dataTransfer so drag and
drop actually works in IE.

Change-Id: I40830dde018759078324e4650d5acace1c1fa849
Kill rangy (almost)

Replace simple range getting and setting with native Selection/Range
api that is supported by Chrome/FF & IE10+.

Bonus: Fix documentation in ve.ce.DomRange, and variable names
in various places.

Rename getSelection to getRangeSelection to avoid confusion with
native method.

Fixme: Some tests in ve.ce.TestRunner were pretending to pass because
of a typo (startNode instead of startContainer). Have been logically
commented out with an if(false) but should be fixed in later.

Change-Id: If6f5f59f96b0787b0a4545d430dae3ef0b8deb4d
Split getSelectionRect into bounding and inline

Non-embedded contexts should always use bottom-middle of the bounding
box, unless that doesn't touch highlight, in which case we use the
bottom inline rect and place the context at the right corner of that
(or left in RTL).

Bonus: Rangy doesn't understand RTL so stop using Rangy and calculate
start and end positions ourselves.

Get rid of FocusableNode#getDimensions as the dimensions are
inside getBoundingRect.

Change-Id: I00ab986bacbf4e73714d810bc6ca109a5dd4df02
Localisation updates from https://translatewiki.net.

Change-Id: I2e473f5493e41a028a70980fd351aa43cba9f364
Update OOjs UI to v0.1.0-pre (f9c217dfa4)

New changes:
720debe PopupWidget: Toggle clipping -after- updating dimensions

Change-Id: I77f667b1eadc49096f2312a55157c070376be61e
Merge "Table demo"
Table demo

Change-Id: I10d0d2dbcd4bb2394bcc2b6a7d54519dbc7c6073
Update OOjs UI to v0.1.0-pre (1c5e409ab1)

New changes:
83193e5 Make tools wrapper display inline so tools wrap around actions
1c5e409 Add backgrounds and borders to dropdowns in Minerva

Change-Id: I93e35c207042fe5efdc3e01498405c9ec606c67a
Merge "Add a secondary label (Edit) to ContextItemWidget"
Merge "Update OOjs UI to v0.1.0-pre (cc3c62607c)"
Localisation updates from https://translatewiki.net.

Change-Id: I53935d3018dd0e79ad8d54468f930af714a8b499
Update OOjs UI to v0.1.0-pre (cc3c62607c)

New changes:
cc3c626 Make help button for FieldLayout frameless again

Change-Id: Ic6fecd07b680a544e165e2813fc92360d18ad2bf
Localisation updates from https://translatewiki.net.

Change-Id: Idd4cc55c5eec56795998b24d78661742fc62051c
Update OOjs UI to v0.1.0-pre (72f047e5d8)

New changes:
72f047e Followup 67f83f1: fall back to empty string to avoid 'undefined'

Change-Id: Ieb49700a48e2a2c7b00fec551e96ed7830dc3f01
Merge "ve.ui.AnnotationInspector: Explicitly permit inserting non-text data"
ve.ui.AnnotationInspector: Explicitly permit inserting non-text data

Added #getInsertionData, which is a thin wrapper for previously
existing #getInsertionText and explicitly supports returning non-text
linear model data.

Side effect: returning things that are not strings from
#getInsertionText will now fail horribly.

Change-Id: I40cd4d5a6e3512d89e61459252fd21225e3e7445
Update OOjs UI to v0.1.0-pre (8ad150e4e7)

New changes:
94b6415 Use grunt-svg2png to convert SVG icons to PNG for distribution
319052d window.svg: Fix XML validity
eab00f2 build: Remove documentation lies from 'copy' task
67f83f1 Make CSS transplantation work in IE10
8ad150e Make the background reset for dialogs in Apex work in IE10

Change-Id: I01efa40a98c4e2d23dea1060cd8116dd30a1ddcd
Localisation updates from https://translatewiki.net.

Change-Id: Ic187107b33bfd20dc1f4a38c7241442e93c6d1da
Fix conversion of non-paragraph content-containing nodes in sanitize

As it happens most browsers do a bit of sanitizing when you press
CTRL+SHIFT+V so this wasn't a real problem, but cleaning for consistency.

Also fix potential problem where the local cache of type wasn't updated
after a type conversion.

Change-Id: I8ffec4eedf7c4b5371c6443996be3d80fd5a0452
Add a secondary label (Edit) to ContextItemWidget

Hide it on desktop for now.

Change-Id: I7defa25cbba5263f9034bf63f39ad17e7b647c83
Merge "Followup de40432: fix JS errors in Firefox"
Followup de40432: fix JS errors in Firefox

Apparently getClientRects() can return an empty array
in Firefox if the element being measured is display: none;
and has never been visible. This seems to happen to the
surface in the media dialog when opened in insertion mode
(i.e. opening the panel the surface isn't in).

Catch this case in getClientSelectionRect() and return null.

Also make sure that the context's position isn't updated when
it isn't visible. The code was trying to do that, but the
visibility check was missing in one place (onSurfacePosition),
causing updateDimensions() to be called on an invisible context
which would then try to position itself against a surface whose
client rects couldn't be measured.

Change-Id: I761b8670091543fc3a6077e936d7872581f628bd
Localisation updates from https://translatewiki.net.

Change-Id: I49e980a040cdff94be227b1662b2a7236f6a8812
Merge "Absolutely eradicate absolute selection coordinates"
Absolutely eradicate absolute selection coordinates

Split getSelectionRect() into getClientSelectionRect() and
getRelativeSelectionRect(). The former returns a rect relative
to the viewport, the latter is relative to the surface.
Previously, getSelectionRect() would return absolute coordinates,
but we weren't actually using those directly anywhere, each
caller would perform its own translations.

Also make these functions return a real rect-like object
(with top, bottom, left, right, width, height) rather than
a Rangy-inspired { start: { x:.., y:.. }, end: { x:.., y:.. } }
style object.

Use the relative version in the context and the client version
in the toolbar. This allows us to get rid of translation
code in both places.

Bonus:
* Rewrite the toolbar's keyup handler to actually make sense
  and actually work correctly
* Centralize the iOS7 getClientRects()[0] hack in
  ve.ui.Surface#getBoundingClientRect
* Compute ve.ce.Surface's this.$window in a saner way

Change-Id: If1dcf159696f287cbfcd17c7bff51ad5913764d0
Merge "Remove lies about event objects being passed through"
Merge "Update OOjs UI to v0.1.0-pre (36d0c7dc3b)"
Update OOjs UI to v0.1.0-pre (36d0c7dc3b)

New changes:
01dd8a7 Make menus reevaluate their clipping when they change

Change-Id: Ibdb133ec9a327d1acc2c69e96cd5d8d015f7f332
Reorder CSS rules in ve.ce.Surface.css to make sense

It's hard to know what top: 0; means if the position
property is set five lines later.

Order should be position, top/left, width/height, other stuff.

Change-Id: Ib2a07a5b0c3f96c76a37afc1731111ea553f8560
Merge "Ignore focusin/focusout events on iframes"
Merge "Position the paste target just below the top of the screen"
Position the paste target just below the top of the screen

The paste target has a fixed position, and was at the top
of the screen (top: 0). This change moves it down a little
bit (1em) so it doesn't cause scrolling when it's typed in.

This fixes a few bugs that I couldn't find in Bugzilla:
* Typing while a focusablenode is selected scrolls the page up a little
* Copying and pasting scrolls the page back and forth

Change-Id: I85ad9e4e0e85b99825bf5322e621cbd74d80f21d
Merge "Update OOjs UI to v0.1.0-pre (4cef83f702)"
Update OOjs UI to v0.1.0-pre (4cef83f702)

New changes:
cde46d8 jsduck: Rename config file to jsduck.json (per standard)
7a6a0eb Fix documentation typo
060cf0c [BREAKING CHANGE] Element mixin refactor
e93f10a readme: Use <pre> instead of ```
9d15ebe Revert "Build with clean CSS"
db1b656 Automatically align popup toolgroups
4cef83f Don't use /** in CSS or LESS, use /* instead

Update changes:
* Update references to renamed classes
* Update calling patterns element mixins

Change-Id: Iae79d4c41b5c2427365d854058b41f6e1b75bd94
Merge "Don't use three different coordinate systems in getSelectionRect()"
Only focus the paste target if focusedNode has changed

in the view despite the model selection not changing, but this appears
to not/no longer be the case.

Restoring the check for next !== previous allows us to remove the hack
where we don't call onModelSelect while staging, which was breaking
the link inspector.

Bug: 70356
Change-Id: I22fae52d358db642827ead1af21e154f0e019735
Prefer String#slice over substr() or substring()

* String#substr and String#substring both exist but have
  different signatures which are easily mixed up.

  String.prototype.substr( start [, length] )
  > Supports negative start, but not in IE8 and below.
  > Takes length, *not* second index. E.g. `substr( 2, 3 )`
    returns `slice( 2, 5 )`.

  String.prototype.substring( indexA [, indexB] )
  > Doesn't support negative indices.
  > If indexA is larger than indexB, they are silently swapped!

  String.prototype.slice( start [, end] )
  > Supports negative indices.

* String#slice works like Array#slice and slice methods
  elsewhere (jQuery, PHP, ..).

See also
* https://www.mediawiki.org/wiki/CC/JS?oldid=1133318#Pitfalls
* I9b6dd682a64fa28c7 in mediawiki-core.

Change-Id: I221ef6ae6956ce20dd9bb74510500f747d04c3b1
Ignore focusin/focusout events on iframes

In IE11, when the focus moves into an iframe, focusout is
emitted on the element that used to have focus (which is correct)
and focusin is emitted on the iframe (which is incorrect).
Even worse, when the focus moves between two iframes,
focusout is emitted on one and focusin is emitted on the other,
while really from the perspective of the main document
nothing is happening.

This confuses the focus change code in ve.ce.Surface,
so ignore focusin/focusout events emitted on an iframe.

Ignoring these events fixes the bug where, in IE11,
the language inspector would close as soon as you
opened the language selection dialog.

Change-Id: I1236887f927df77e3bc2eaa9ec4ba07a69e3beaa
Merge "Factor out ve.dm.Transaction.pushReplaceInternal"
Merge "Create ImageNode mixin to share logic between Block & Inline"
Merge "Allow override of window manager in language input widget"
Merge "Fix `ve.dm.Transaction.newFromReplacement` when `removeMetadata` is true"
Factor out ve.dm.Transaction.pushReplaceInternal

This helps us keep the `lengthDifference` and "maybe include metadata"
accounting in one place.

Change-Id: I4d38c1e1f3936679758d04b3f83d0d311fdaa65c
Don't use three different coordinate systems in getSelectionRect()

The main code path in getSelectionRect() returns document coordinates
(through get{Start,End}DocumentPos()), but the fallback code path
added in fc09114 returns client coordinates (through getClientRect()).
Moreover, the focusableNode code path returns surface coordinates.

Callers were rightly assuming that the return value would always
be in document coordinates (or at least always in the same coordinate
system!), so the edge cases in which we used different coordinate
systems broke things.

Document this function as returning document coordinates, and
make this true by converting coordinates from other systems.

Bug: 69122
Change-Id: If7711efc6aad260b7dd75a4f7f0bddb4efaf6553
Localisation updates from https://translatewiki.net.

Change-Id: I69500d0463880863f533de516ab9ef8492a17bf2
Merge "Annotate inserted special characters"
Annotate inserted special characters

Don't know why this was set to false.

Bug: 60476
Change-Id: I05cbbe0a83e633ea4ace6b6be5dbb716c44e3236
Merge "Set expanded=false on command help dialog layout"
Allow override of window manager in language input widget

Use a non-isolated window manager in the demo.

Change-Id: I841606047a0316b0b45e199ea9569626456c48fa
Update OOjs UI to v0.1.0-pre (adfcf92c6a)

New changes:
7b51164 Fix click-block focus-loss prevention
e2a42c7 Update oojs to v1.1.0
adfcf92 Fix process dialog title text position

Change-Id: I1ba6a00d0aec1d44008ad0e674da29c3c69fb4ac
Update OOjs to v1.1.0

Release notes:
 https://git.wikimedia.org/blob/oojs%2Fcore.git/v1.1.0/History.md

Change-Id: I79cae83af6a4989255a62f7fefecb83d2386e3c8
Localisation updates from https://translatewiki.net.

Change-Id: Iae096be5665baf4fa988cfa08a61d07bc844ccca
Localisation updates from https://translatewiki.net.

Change-Id: If9045f5d602cd317f08a999629f0b6651cae801f
Set expanded=false on command help dialog layout

Fixes height calculation issue.

Change-Id: I8033924cb2905c13cf2408caf770f70e3ddcc3d8
Fix `ve.dm.Transaction.newFromReplacement` when `removeMetadata` is true

The `newFromReplacement` call was inadvertently ignoring its
`removeMetadata` argument, because the optimizations in `pushReplace`
were combining a remove and insert and throwing away the `removeMetadata`
flag in the process.

Change-Id: I4f1ae7982b06200ecde62101dc2558fc02c6e8d4
Merge "Use staging instead of undo in annotation inspector"
Localisation updates from https://translatewiki.net.

Change-Id: I00b6f00d52d5ea80603773f8ab1d488b8bce57f9
Use staging instead of undo in annotation inspector

Keeping track of possibly temporary transactions and undoing them
later is what transaction staging was designed for.

Rename and refactor flags for legibility.

Change-Id: I9a2b516a82213b6fd55e52485e40be482231fa2b
Merge "Track selectionBefore in staging transactions"
Merge "Only undo if an initial annotation was applied"
Track selectionBefore in staging transactions

We track the previous selection in normal transactions, but we need to
do this for staged transactions as well.

Bug: 70175
Change-Id: Ibd10911b7e88cff6a190b4e5736e319496f68efe
Make filibuster code debug only

Change-Id: Iafdf4ad22d6743155889925ffb63b2ec450aba93
Only undo if an initial annotation was applied

Previously we set isNewAnnotation even if annotation was null, and
then used this boolean to decide if we should perform an undo on
teardown. Change the property to appliedNewAnnotation and only set
it if an annotation was actually applied so we don't do a destructive
undo.

Bug: 70167
Change-Id: I27bd86fb45ad22309ca9dd7ed94ca3c309ff71f5
Call onTargetInputChange when the link inspector is ready

To trigger the validity checks so we can disable the Open button on ready if the target is invalid

Change-Id: I123a5559c9fde2772f3ede28de73b2f308b3bea8
Merge "Polyfill Node.prototype.normalize in IE"
Merge "Update OOjs UI to v0.1.0-pre (43f379c884)"
Localisation updates from https://translatewiki.net.

Change-Id: I30d193ae80ec296eab2c1e80d6ecd94c8ef9588b
Update OOjs UI to v0.1.0-pre (43f379c884)

New changes:
0473209 Standardize less imports and image rule generation
4ead033 Localisation updates from https://translatewiki.net.
596d4e9 Tweak behaviour to match description in demos
8846b27 Fix typo in documentation: "nodes" (pl.) goes wo. article
611703c Fix label text in RTL demo listing containing parentheses
93c4b43 Divide CSS properties between base styles and themes
6ede2d8 Reorganize theme system
3515f5a Build with clean CSS
a24c7af Make OO.ui.Window's $content a div again
ea0172d Followup 6ede2d8: fix popup font size
d72addb Fix remaining references to 'agora' not 'minerva'
f6468b8 build: Don't copy anything other than SVG and PNG files to /dist
43f379c build: Also whitelist GIF files in the copy task

Local changes:
Point build/modules.json to …minerva rather than …agora.

Change-Id: I76e47b0b53bc5652146dd24fc403591bcc54e18b
Polyfill Node.prototype.normalize in IE

There is a bug in IE11 where normalization sometimes leaves
empty text nodes behind. Additionally, there is a bug that
I don't quite understand where .normalize() won't combine
adjacent text nodes in dm.Converter output, but the same
DOM generated by hand normalizes fine, and a clone of the
converter DOM also normalizes correctly. I haven't been able
to isolate this bug, but I have seen enough that I don't
trust IE's .normalize() at all.

Add ve.normalizeNode() which wraps node.normalize(). Check
whether the native implementation is broken using the empty
text node case, and if it is, bypass the native implementation
completely and perform normalization manually.

Tests:
* Add ve.test.utils.buildDom() to build a DOM structure
  from a JSON description
* Add tests for ve.normalizeNode()
** The test suite triggers the manual normalization code
   by making the native .normalize() a no-op
* Stop excluding text nodes in ve.getDomElementSummary(),
  otherwise you get no useful output if the normalize test
  fails because of empty text nodes

Change-Id: I809632a985400494085a706ff07278e639f698c0
Merge "Followup 355be3ed: fix getOffset() behavior inside block aliens"
Only block language change if dir hasn't changed

Otherwise you can't change the direction unless the language code is
valid.

Change-Id: I7465bef78c37b86c766379692c2e146759536586
Merge "Try a bit harder not to create empty text nodes"
Merge "Trigger handleDelete inside onCut"
Trigger handleDelete inside onCut

Greatly simplifies the code by reducing duplication, and uses
the more complex selection fixup logic in handleDelete so that
cutting a focusable block node leaves the selection in a sensible
place.

Change-Id: Ia599a55af859e829e1a168e80f4929a09f72f330
Merge "Remove unnecessary execCommand('undo') from onCut"
Remove unnecessary execCommand('undo') from onCut

As we use onCopy to write data to the clipboard and this is
done entirely in the pasteTarget, the view is not modified by
the cut event, so there's nothing to undo. This is left over
from before we rewrote onCopy.

Bug: 58724
Change-Id: I2269e0ec409dc9eaa0826c78468d9cac554e0433
Localisation updates from https://translatewiki.net.

Change-Id: Idbcd6f0ae78c103ee908bd30164a0b7b26114a47
Merge "Fix the newline bunny-hop bug harder"
Merge "Check for selection in ve.ce.Surface#onDocumentFocus"
Check for selection in ve.ce.Surface#onDocumentFocus

Instead of checking if focus was caused by a mouse event, check if there
is a selection already.

This seems to work correctly both on desktop and iOS Safari.

Bug: 66697
Change-Id: Ief6c44cb6c5e25ccdff01f632a5f65a8abc4f3ed
Followup 355be3ed: fix getOffset() behavior inside block aliens

If you gave getOffset() a DOM offset inside a block alien, it
would correctly return the DM offset inside of that block alien.
This was broken in 355be3ed which caused getOffset() to count
text node characters inside of block aliens, which led to some
very strange results.

Fix this by making the lengthSum addition conditional on
canContainContent again, as it was before 355be3ed. Kept the
isWrapped addition conditional on !isContent, that part of
355be3ed was correct.

This was causing bugs in cases where the user was able to get
the cursor inside of a block transclusion, which IE allows.

Change-Id: I5cfb1df45ed9ff1497cb179b0f5c2f442cf1e106
Try a bit harder not to create empty text nodes

They get cleaned up by normalization anyway, but given that
we check for emptiness in all other places where we create
text node, we should do that consistently throughout this
function.

Change-Id: Ie0fd83bc56fbc9407b87c7c229188c6bf5336719
Localisation updates from https://translatewiki.net.

Change-Id: I39f21c41ed5770f77d9e6bdef9c302a8d39c19a9
dm.NodeFactory: Use .lookup() instead of .create().constructor

No reason to create a throwaway instance.

Change-Id: I4f4f9053d4cc0f23296b969141f473ea5daafe7c
Merge "Check IME simulations actually fail as expected"
Merge "Followup bbff57b, 8c71904: use getter for availableTools, again"
Followup bbff57b, 8c71904: use getter for availableTools, again

Bug: 69988
Change-Id: I00ad6c12216012bc5bcd1fdb3fb37701a8ce7d45
Merge "Update oo#compare usages"
Check IME simulations actually fail as expected

Previously, each IME test was skipped if failure was expected. Now, the test
harness checks that a failure actually happens, and that it happens at the
expected point in the input sequence. This way, if a change affects an IME
simulation as a side effect, it will be noticed, whether the side effect is
positive, negative or both.

Change-Id: I67656591a6b1af1f64163338bef5e94a3d3b6b78
Fix JS error in ce.LanguageAnnotation when dir is set but lang isn't

Bug: 69955
Change-Id: Ib7330af9007e95fcee3085e21d1f883d0005dba3
Localisation updates from https://translatewiki.net.

Change-Id: I580eb1e4e4687e6a2ee1ade687d7be6e51c35162
Add myself to AUTHORS.txt

Change-Id: I7adfd0155ee047a9da149a3dad38e60dc91f27af
Followup 8c71904: use getter for availableTools

This property was made lazy-initialized in the meantime,
so we can't access it directly any more.

Change-Id: I6bf79d85e1fdd837da1a620169de34e1cd814bbe
Create ImageNode mixin to share logic between Block & Inline

Change-Id: I90b543e1a91ab950ff9e857c038bf670dde5634d
Fix case in all annotation classes

Change-Id: Idcf109d5df4bd48cd5f5758e2a491d774ce91dc8
Fix case on language annotation CSS class

Change-Id: I3578a3eacd8c003133d46fc69e6a9246d5e2accb
Remove lies about event objects being passed through

onFocusChange is debounced now, so it doesn't get a jQuery.Event
object passed to it any more. It was trying to pass this
nonexistent object to onDocumentFocus() and onDocumentBlur(),
which were already ignoring it anyway.

Change-Id: Ic29cea2b15626715eb6ddaf4f87b5279ffae36b3
Remove broken ve.isMsie() function

It didn't detect IE11, which is all we care about right now.
Also removed selection fixup code in ve.ce.Surface that was dead
code because it was using ve.isMsie(): it doesn't appear to
be needed, at least in IE11.

Change-Id: Id88c688522fb67ebb45ebec324970c557a6ab60a
Merge "Basic block image (figure/figcaption) support"
Basic block image (figure/figcaption) support

Change-Id: Iddb3a5f57fd0ab965db00c2b148ab4f5e89b923d
Merge "Make focusables behave correctly when $element != $focusable"
Merge "Never embed the context when an inspector is present"
Make focusables behave correctly when $element != $focusable

When there is more to the $element than $focusable, handle mousedown
events on it and prevent default so the browser doesn't try and place
the cursor inside the ce=false element. Also use cursor:default.

Change-Id: I450537fd9239cef86838f22c082f0934f99a3487
Merge "[BREAKING CHANGE] Rename 'image' to 'inlineImage'"
Merge "[BREAKING CHANGE] Remove span-wrapping of images"
[BREAKING CHANGE] Rename 'image' to 'inlineImage'

Makes room for blockImage and makes it consistent with MW images.

Also remove unnecessary onClick event handling.

Breaking change: Renames class and DM type.

Change-Id: Icf94e498ad9be06a7d187e45cc0368773b9c5678
Update oo#compare usages

compare now allows comparisons to null/undefined.

Also as compare treats arrays as objects, when seeing if an array
is full of undefined's we don't need to construct a sparse array.

Change-Id: I34c5b2699982044e13943bb9b9f47c7a0f522e3b
Never embed the context when an inspector is present

Re-applies Ida871380 which was reverted during refactoring:

"Having an inspector launch over the context you are inspecting
seems like a bad idea."

Bug: 66542
Change-Id: I9fc6fabb6a04cc7847f25556674d6e09dcf012a0
Fix the newline bunny-hop bug harder

In I4375f4c07, I fixed a bug where " <meta>\nfoo" would dirty-diff
to "\n <meta>foo" in wrapper paragraphs. It turns out this was
still broken in the case where the newline was followed by an
inline node rather than text: " <meta>\n<span>" was still being
dirty-diffed to "\n <meta><span>".

This was caused by a special case for when a content node is inserted
into a wrapper, in which case wrappedWhitespace is cleared. That's fine
and necessary, but in addition to that, we also need to output any
buffered meta items and their whitespace, and clear nextWhitespace
so we don't later record the previous value of wrappedWhitespace as
outer whitespace in the content node's .internal.whitespace array.

Bug: 69861
Change-Id: Ie80a98512b350311832a8674fac892b378738df0
Destroy WindowManagers in Context and Surface destructors

WindowManagers are now destructible, so destroy them.

Bug: 69630
Change-Id: I392e001bc632637c5c100f3bc5f28a05518659e0
Update OOjs UI to v0.1.0-pre (d6008381aa)

New changes:
8c60d3c Create a combo box widget
944c47c Update oojs to v1.0.12
23f26c3 [BREAKING CHANGE] Set active and pressed on the buttoned element, not the button
55b861b build: Switch from grunt-recess to grunt-contrib-less
7205b2a build: Check for files' existence before building using grunt-file-exists
d600838 Make window managers destroyable

Change-Id: I6af60421093b5ec4604fe9a7f79bf18b5a5ecbf9
Remove global overlay classes when destroying MobileSurface

Classes that are set on body and html would not be removed before when
MobileSurface was destroyed.

Also increase MobileWindowManager's tearDownDelay to 300 (length of
closing animation for link inspector).

Bug: 69630
Change-Id: Ifabad4ae953478ef9050b96655338a29a84d58fb
Change comment to meta in whitespace test case to actually test whitespace handling

The point of this test case isn't to test comments, it's to
verify that the "newline bunny-hop bug" is fixed: whitespace
after metadata inside a wrapper isn't moved to before the meta.
This bug was fixed in I4375f4c07.

Change-Id: Ibdb748d46295da09c2fb8a2f6c6c41df7e3fa407
Fallback to node position when getting selection rectangle

Another common case on get(Start|End)DocumentPos failing is when
you are inside an empty paragraph. If focusNode is an element, just
use the left/right border of the element bounding rectangle as the
cursor position (depending on directionality).

Bug: 69122
Change-Id: I3c5087dff981868a8c5919b580990d8ae899e3c3
Rename getRelativeOffset to getBoundingRect and use in getSelectionRect

By return top/left/right/bottom we can simplify the calculations
in the one current use case.

It can also be used trivially in getSelectionRect.

Change-Id: Ia58afc145fecd5fb2bb07e2dd958eb1b7be112ea
Fix embeddable desktop context popups

Use the purpose-built isFocusable instead of instanceof
because FocusableNode is a mixin.

Change-Id: I48fab7253cad58f21ac334424f4d11d6ef19428a
Define kbd font-family explicity in case environment overrides

For example Vector in MediaWiki overrides to Courier.

Bug: 69643
Change-Id: I3c94b37d30d6bfc1d5169c63a76aee49c7d8b653
Merge "Queue up annotation changes to make operations safer"
Merge "Followup b141a7d2: make inspectors not close immediately in IE"
Update OOjs UI to v0.1.0-pre (466a8762ac)

New changes:
466a876 [BREAKING CHANGE] Make content isolation optional

Update changes:
* Use this.$content instead of this.frame.$content
* Update CSS to no longer reference oo-ui-frame
* Configure window managers to isolate windows, ensuring there is no
  effective change to VisualEditor's use of dialogs
* Remove OO.ui.Frame from categories.json

Change-Id: Ie645e097c4ae3a1a499d826b4b2805488173ccdb
Update OOjs UI to v0.1.0-pre (944c47c5fe)

New changes:
36ae086 Use a pollNode for every transplanted stylesheet, not just external ones
a1771ed Support nested style transplantation
8c60d3c Create a combo box widget
944c47c Update oojs to v1.0.12

Change-Id: I800bb36b80d04e165e9fa9b00ed8a5223f2d954b
Update OOjs to v1.0.12

Release notes:
 https://git.wikimedia.org/blob/oojs%2Fcore.git/v1.0.12/History.md

Change-Id: I5542d1cf5aad4d4fd78a04f6bea7a27cbabf055a
Don't blank .static in ve.dm.Document

inheritClass already sets it, and blanking it is harmful if the
parent class puts anything in .static. This used to not be an
issue as ve.dm.Document's parent previously didn't use .static,
but OO.EventEmitter recently added a static method.

Change-Id: I3991a72b6b6e9968166ac7ba4aef9cee794a608a
Re-sync bin/update-oojs.sh with equivalent script in MediaWiki core

Change-Id: Iaf52db137a773cdeb7894382f04aaae9d679ee91
Merge "ve.Filibuster: Scrupulous state logging"
Merge "Label 'insert' buttons with just "Insert" instead of varying by content"
Label 'insert' buttons with just "Insert" instead of varying by content

Change-Id: I23b0772aaade868a8ef3f581e36392ad1e4f0e58
Fix check for left/right annotations

We're only interested in annotations immediately to the left/right
so just take those and see if they are content offsets, instead
of using getNearestContentOffset, which breaks if you place it
inside a handlesOwnChildrenNode.

Bug: 68588
Bug: 68597
Change-Id: Ib791e5988078496411aa974afa0a90ebce10e737
ve.Filibuster: Scrupulous state logging

ve.Filibuster
* Wrap functions to log entry/exit
* Log state and stack at each function call
* Shortlist potentially significant state change observations

ve.ui.DebugBar
* Start Filibuster/Stop Filibuster button
* Tabulated observation HTML

ve.ui.Surface
* ve.Filibuster hooks

ve.ce.SurfaceObserver
* Call setTimeout through a method, to facilitate disabling

ve.EventSequencer
* Perform all calls through a method 'callListener', for clearer logs

ve.debug
* define ve.error

demos/* and others
* Minor and consequential changes

Change-Id: I559eba8bed17a7669b445d307c3866f2548f908c
Followup b141a7d2: make inspectors not close immediately in IE

The great and terrible dialog refactor removed the 200ms timeout
at the start of the ready process for inspectors. This was a good
change, but it did break inspectors in IE.

Internet Explorer does not handle multiple selections in different
frames correctly. We wrap inspectors in iframes so we can have a
selection in the main document and another in the iframe, but
this doesn't work well in IE. Once an input in the iframe is focused,
the selection in the main document is invisible and inaccessible.

When the dialog is set up, content <div> is focused (the refactor
made the <body> be focused instead, but I had to change that back).
This causes a focusout event (and also a focusin event on the iframe
which shouldn't be emitted, but that's harmless in this case), which
gets debounced. At that point, asking the main document what
is selected will still return the correct result. Then later,
the input inside the inspector is focused, and from that point
on asking the main document what is selected will return null.

If there is no timeout at the start of the readyProcess, then
the debounced focusChange handler won't run until after the
rangy selection has been nulled. But with a timeout, it'll
run after the focusout event has been emitted but before the
rangy selection is nulled, which is exactly what we want
(and also means the code works completely by accident).
In the long term, we should look into making inspectors
resistent to this kind of behavior (and, by extension,
non-isolation, perhaps?), but for now readding the timeout
with a length of zero appears to fix this.

Change-Id: Ib8b6abf8a9b7b73105e68d02e122ed8afda68405
Update OOjs UI to v0.1.0-pre (51f513f9d3)

New changes:
8019b96 Localisation updates from https://translatewiki.net.
1fbe3cc Localisation updates from https://translatewiki.net.
455bbb5 Localisation updates from https://translatewiki.net.
379c9da Localisation updates from https://translatewiki.net.
ff74dc3 Fix CSS transplantation in IE
5de13ef Localisation updates from https://translatewiki.net.
44fafb5 Fixing formatting of Agora (mobile) dialogs
d9b7f6a Adjust for border with box-sizing: border-box
a942c71 demos: Refactor tool groups to be re-usable between toolbars

Change-Id: I0ce44be7ecd8ab6fc0693c23bca22d1a8286e383
Merge "Add description to title attribute of focusable highlight"
[BREAKING CHANGE] Remove span-wrapping of images

This hack is no longer neccessary now that we no longer
use shields.

Breaking change: removes ve.ce.ImageNode.css

Change-Id: I33903a75ebde6d0930ca615710085b3efd2148a0
Default dimensions to null, not empty objects

Empty objects are truthy and elsewhere in the code we only
check for truthiness before trying to access properties.

Resolve duplicate methods for clear/unset dimesnions.

Fix logic for detecting dimension change in setters.

Change-Id: I922f538765c82766aaabfad62eef61bc4ac5acb3
Add description to title attribute of focusable highlight

Change-Id: Ie2ad552440693e69bcb6d69e6b45dbb7c7458528
Add an event to updating current values in scalable

The scalable object can have its current values change externally
but this change should propogate to other dependent objects.
Specifically, this is crucial to allow the media dialog to switch
an image without destroying and rebuilding a new scalable, but
rather just updating the current adjusted dimension values
directly, which are then updated in the media size widget.

This allows I4327c86a to work and update dimensions properly.

Change-Id: Idbb8b29db8e47afa9a658a02b2eaf2c3478edb48
Merge "Ignore whitespace when generating paste context"
Ignore whitespace when generating paste context

textStart/End offsets assume there is no inner whitespace so make
sure that is the case.

Bug: 69595
Change-Id: Ibfddaf94aaf7daedf05eec56821994f7f30ddd56
Merge "Factor out wordbreak detection code and run it for simple insertions too"
Merge "Add VE logo to repo and use in image demo and for branding demo page"
Merge "Add local image to demo"
Merge "Work around getSystemPlatform() race condition"
Merge "Make getParsedMessage() test actually test getParsedMessage()"
Make getParsedMessage() test actually test getParsedMessage()

Change-Id: I6b3b4d82cec7b5b2ed237a69a0ef526bdf258643
Work around getSystemPlatform() race condition

We have ve.ui.triggerRegistry.register() calls running from the
main file scope, which is evil for many reasons, but one of them
is that ve.init.platform may not have been constructed by that
time, causing JS errors because register() needs to call
ve.init.platform.getSystemPlatform() .

To hack around this, I made getSystemPlatform() and isInternetExplorer()
static, and wrapped the former with ve.getSystemPlatform() which
uses ve.init.platform if constructed and falls back to the
base class otherwise. A proper solution would involve not
running all these .register() calls in file scope, and cleaning
up the mess that is the platform system in general.

Change-Id: If014c52d7c4c4a1d2949ff262c35d64329d4f803
Fix path prefix for tests/index.html so it actually runs

Change-Id: I2512247f5ece56d4a2f283614b5ffd6d13d76c73
Factor out wordbreak detection code and run it for simple insertions too

Wordbreak detection was only done for "complex changes", not
for "simple insertions". This worked because we made sure to
always pawn at the edge of an splitOnWordbreak annotation
(through the forceContinuation property), so typing there is
a replacement (replacing a pawn), and that's considered complex
rather than simple.

However, to facilitate future changes as well as for general
non-WTF-y-ness, we should be consistent and also apply the
wordbreak logic for simple insertions. I still don't like
the wordbreak code that much, but at least this change makes
it look a bit less like it works completely by accident.

ve.ce.Surface#onContentChange:
* Factor out wordbreak logic to internal function
* Also call this function in the simple insertion code path
* Cache word break checks out of the loop
* Bail early if no word breaks detected
* Simplify complex change code by adding replacementRange variable
  (needed for call to filterForWordbreak() anyway)
* Replace instanceof check that's always true with length check
* Reuse values of previousStart and nextStart where possible
* Move computation of previousData, nextData and lengthDiff
  to initialization
* Rename dataString to nextDataString, now computed at
  initialization time rather than being recomputed in every
  single loop iteration
* Add TODO about sameLeadingAndTrailing being ignored

Change-Id: I9290782002dfc47f01c383278580ed0b754ab2e2
Queue up annotation changes to make operations safer

Currently an exception can be thrown with an annotate operation
partially applied to the DM, which would make it very hard to
cleanly revert should we ever catch that exception.

Bug: 68892
Change-Id: Idadb842d80bdf45b4d58489f4b3008644db0ad20
Add VE logo to repo and use in image demo and for branding demo page

Change-Id: I3273fad3d97d6c6d7845191eca6dc89e5595d78f
Add local image to demo

Change-Id: I0206120503d45378ed6b348f540263d6f1854bd8
[BREAKING CHANGE] Move modules to src and tests and i18n, UnicodeJS to lib

Move UnicodeJS into lib/ as it's now a library. Take advantage of this to move
modules/ve to src/ except for tests, which move to tests/, and messages, which move
to i18n/, moving the repo to be much closer to how others are structured.

Change-Id: Ic0f0354da9e1c38ec3ac349120ec9e3348b14556
Merge "Restore QUnit web UI"
Restore QUnit web UI

Change-Id: Ic314b9dc632774f52e0cf772b69c9bc7e6447d02
Make sure image attribute is cleared if set to null

If 'to' is null $.css acts as a getter, so in this case change
it to empty string to clear the style.

Bug: 69531
Change-Id: I61d132a11730b6d124e81635d2f930f7b17d9605
Localisation updates from https://translatewiki.net.

Change-Id: Ic28c69eaba7568e9ba95c0e1cf65ac18c116b50e
Embed CSS images in dist

Change-Id: Ia0e227eb6eada9367e22324bae6d4c85e30e5e02
Merge "Replace setModulesPath with addMessagePath"
Replace setModulesPath with addMessagePath

Modules path is only use for loading message files, and ve-dist
uses a different path to ve-dev, so allow all i18n folders to
be defined as a list.

Change-Id: Iaeb1392821e4f39ab04f9776cbdb6991edeb27e1
Followup 95ee357: make remapStoreIndexes() work again

Its implementation relied on getAnnotationIndexesAtOffset() returning
the indexes array by reference, but since 95ee357 it returns a copy.

Instead of modifying the annotations array by reference, modify the
copy and save it back using the new setAnnotationIndexesAtOffset()
method.

Also add tests for this function, we evidently need them. This
code was sort of covered by the paste tests in ce.Surface but not
very well. One of the paste tests started failing mysteriously, but
only in PhantomJS and only in the MediaWiki integration with no skin
loaded. It turned out PhantomJS was wrapping things in
<span style="line-height: normal;" class="Apple-style-span">
which was then stripped by afterPaste. However, by the time it was
stripped it was already in the IVStore of the internal dm.Document
that afterPaste uses, and so the store index of the <b> annotation
that was not stripped would differ between the internal document
and the main document. This should have been resolved by remapping
the store indexes in the data before inserting it, but because
remapStoreIndexes() was broken this didn't happen, and the test failed.

Change-Id: I3c9a4f8417107bfcd208cb9333fbbd188e13bb80
Localisation updates from https://translatewiki.net.

Change-Id: I105a16a6b3db236c79bd431ea8ded585a1e3b5be
Merge "Fix bad jquery 'append' instances"
Fix bad jquery 'append' instances

There are several incorrect usages of jquery .append() method that
uses an array instead of an argument list. This isn't the proper use
of the method and while it does work now, according to Krinkle,
this might stop working in the near future.

Change-Id: I76decb67db086bb387c27ab4b0ebd3af144d05b7
tests: Fix some minor issues flagged up by karma and related MW references

Change-Id: I33977884227ee61a40155ea3a08e3ef79384ddfc
build: Switch from qunit directly to karma for code coverage reports

Change-Id: I4b485c9cedff4bcbe05e442c8f77a4c2be2aa9a7
Merge "Show metadata in the debug bar"
Show metadata in the debug bar

Change-Id: I9c1d0fc16cb68b91e2f19cf75e9f5878fcf98114
Merge "Actually check annotations in paste test"
Merge "Add missing messages from MW"
Merge "Localisation updates from https://translatewiki.net."
Localisation updates from https://translatewiki.net.

Change-Id: I5ae3677d3c6a25421b0b80584cba533b1a218070
Add missing messages from MW

Change-Id: Ia1c2ca21e85961cfa4faddc76fd8673ffc9aaf39
Actually check annotations in paste test

Just checking that we get store index 0 doesn't inspire a lot of confidence.

Change-Id: I77156dec9dd2b06b00347ae3e23cc7c5f3a86adb
Merge "Add bidi isolation to language annotations"
Localisation updates from https://translatewiki.net.

Change-Id: I7913d390f7594f73edeca25706a45932fed67bd9
Add bidi isolation to language annotations

Create a bidi-isolation class to use in all bidi-isolation cases
and attach it to the language annotation. The specific bidi-isolation
class will help in the (many) cases where the method to isolate the
text in CSS changes.

Change-Id: Id0fa463b3e9baae9a55eceee583fa7c51cfb09f6
Update OOjs UI to v0.1.0-pre (0e50d2e336)

New changes:
1283a33 Localisation updates from https://translatewiki.net.
0e50d2e Initialise dir property and use a getter

Change-Id: I0a4d3d9e1ef3602f3829a65ea6ff22df3d218ce2
Merge "Fix `Transaction.isNoOp` test"
Fix `Transaction.isNoOp` test

Certain operations can emit `retainMetadata` as well as `retain`, and
still be no-ops.  Add a test case to prove it.

Change-Id: Ie01d917b83e9c8b486ac0539ae1b2c6dea9e18d1
Merge "Disable basic reference on mobile"
Localisation updates from https://translatewiki.net.

Change-Id: Id26ddaf459d61c7be9d27ab79285c14291bd8c88
Disable basic reference on mobile

Use `tool` property of tools to determine if a reference node should be
filtered out. We can't use the `tool` property instead of `model` in other
cases for whitelisting because of GeneratedMWCitationDialogTool
which is not exposed publicly.

Bug: 68897
Change-Id: I5a0d3d7623cdf58b2cc7a0dc41e22eed19a84914
Localisation updates from https://translatewiki.net.

Change-Id: I731f8375e5c3a3160d0de50aa01e1f9de98b7ea5
Localisation updates from https://translatewiki.net.

Change-Id: If90ee56114ea78c1ac20ce603a1ffdb4c02d8295
Merge "Set selection before focusing document"
Set selection before focusing document

Otherwise the selection is momentarily reset and the
page scrolls to the top.

Bug: 68589
Bug: 68708
Change-Id: I7151c00a90312fb127ebf2120383c19b771ef6c7
Localisation updates from https://translatewiki.net.

Change-Id: I96bcc9a4f5413d3631929dfc806eda3d923bcff1
Localisation updates from https://translatewiki.net.

Change-Id: I2fc6ce3ebb71f0ceb400fbabddaa8091ea647ad3
Have LanguageInputWidget return lang+dir, not an annotation

Move annotation-specific code into the language inspector so
that the input widget can be a generic lang/dir selector, not
just one that returns language annotations.

Use the new generic widget in the demo menu (with some CSS hacks).

Change-Id: I9e92bd2d6e732092a9bc44aff000030be933482f
Merge "Followup 23a949844: fix typo in class name for WhitespacePreservingInputWidget"
Followup 23a949844: fix typo in class name for WhitespacePreservingInputWidget

Bug: 68960
Change-Id: I1145cacd24d594012ccfe637698e0bae26dee3c7
Localisation updates from https://translatewiki.net.

Change-Id: I6edbcc601ef4ba8b0cbf6ed39735f60ff09beb22
Merge "Disable tools other than links and references on mobile"
Disable tools other than links and references on mobile

Temporary measure so that we don't show mobile context when we
shouldn't.

Change-Id: I19c4ed2aa361bec385ae7888ee62fc2cc916b9b8
Set a default language for ve.dm.Document if we can't guess it otherwise

We already do this for directionality (fallback to ltr), but not language; falling back
to en patches over a wider hole that allows this to come up.

Bug: 68808
Change-Id: I270ff9830ed791c0b42bbadfa89bf6f733d110ba
Update OOjs UI to v0.1.0-pre (dd294dc785)

New changes:
f9e65d6 Revert "Make scrolling in PanelLayout smoother on iOS"

Change-Id: I095717ce24aaa28835bb7869c43edb898f5291b9
Merge "ve.ui.AnnotationInspector: Stop truncating fragments to 255 elements"
Merge "ve.ui.AnnotationInspector: Allow content insertion without annotating"
ve.ui.AnnotationInspector: Stop truncating fragments to 255 elements

This was implemented for the link inspector in 2012, in Ibddf942c, as
a temporary hack, and has survived at least three total rewrites of
everything.

Even for the link inspector, this makes no sense:
* We don't even know if we're truncating characters or other nodes.
* We don't even know if we're making an internal or external link.
* We don't even know if the fragment will be a valid title.
* And we don't even know if a valid title needs to be shorter than 255 bytes anyway.

Change-Id: I0c005cb77045b1926aa98616b9a02da7aa6fb061
Localisation updates from https://translatewiki.net.

Change-Id: I889048ae82294bd1fc44459cd8414423cb09cff7
Merge "Fix expandRange( 'root' ) to not include the internal list"
Update OOjs UI to v0.1.0-pre (3d8475c0b3)

New changes:
feba6af Remove unused CSS classes
58af913 Remove direction style attribute
7463080 Restyle agora theme for mobile after window refactor
5708bdf Make scrolling in PanelLayout smoother on iOS
96b89c2 demos: Add right-aligned menu in toolbar demo

Change-Id: If38bbe6a7bc6c1452d2c56397344a3b75f5e46d5
Merge "Greatly simplify ve.ce.Surface#getSelectionRect"
Merge "Create a whitespace preserving TextInputWidget and use in CommentInspector"
Create a whitespace preserving TextInputWidget and use in CommentInspector

Creates a widget which preserves whitespace, but doesn't display it.

Change-Id: I019b37dc195d4c2a016c0439997d51711f89c573
Greatly simplify ve.ce.Surface#getSelectionRect

We were calling getBoundingClientRect(), and if any of the
coordinates we got back was zero, we'd measure the cursor position
manually by inserting a <span>, then locating it.

There were two problems with this. First, it broke IMEs because
they don't like DOM manipulation. Second, we weren't actually using
the result of getBoundingClientRect() AT ALL, ANYWHERE: we were only
checking it for zeroes, then throwing it away. To get the actual
return value we used get(Start|End)DocumentPos(), and it turns out
those work just fine even in cases where getBoundingClientRect()i
gets confused.

So, instead, just use get(Start|End)DocumentPos() directly, and get
rid of the call to getBoundingClientRect() and all the DOM manipulation
recovery code. The only case I observed where get(Start|End)DocumentPos()
don't work was in Firefox when the address bar is focused on load; then
they sometimes throw exceptions. But in that case we can get away with
returning null, which we already do if the range list is empty.

Change-Id: I9cf97244a1c80754d2844cb77ce101d3afa6bf5b
Merge "Use native style property names instead of jQuery's css map"
Merge "[BREAKING CHANGE] Fix camel-casing of countNonInternalElements"
Merge "Comment icon positioning"
Merge "[BREAKING CHANGE] Fix ve.ui.Overlay classes"
Merge "ve.ce.ResizableNode: Run find() once instead of 4x in showHandles()"
Merge "ve.ce.TextNode: Simplify #getAnnotatedHtml logic"
Merge "ve.ce.TextNode: Use getChar() helper"
Merge "Use getDescription for title attribute"
Localisation updates from https://translatewiki.net.

Change-Id: Ied0c861a9b006a3fbfa8bcb2c8e5636b620d8cd0
Use getDescription for title attribute

getDescription defines a tooltip-like description of a node, so
re-use this for the actual tooltip instead of duplicating logic.

Change-Id: If22a51970c35c4fade8f0b4246fa465fff526d00
Use native style property names instead of jQuery's css map

Only a handful left :-)

Follows-up 8e08e9f. See also 170f607ba699e46c in oojs-ui.

Change-Id: Icc5cd248cb5f6d94c376bc122df78994b87fb413
ve.ce.ResizableNode: Run find() once instead of 4x in showHandles()

Follows-up e699956799.

Change-Id: I78e29973d72fb205b874a6d28cfb41b1c7d10eff
Merge "Remove unused CSS classes"
ve.ce.TextNode: Simplify #getAnnotatedHtml logic

This is perhaps a tiny performance improvement and definitely a major
readability improvement.

* Pull `!significantWhitespace` condition out of the loop, merge the
  two identifal `if`s that result.
* Remove useless `i !== 0` and `i !== data.length - 1` conditions, we
  can never have a space on the first and last position because they
  have already been converted to nbsp above.
* Remove useless `data.length > 2` condition, it does nothing for the
  same reason (a string of two-of-fewer characters will never contain
  literal spaces at this point).
* Merge nested `if`s.

Change-Id: Ic832e06afac34600feb1a9d22ff421c12aa931ad
ve.ce.TextNode: Use getChar() helper

The repeated `if (array) {…} else if (string) {…}` check is ugly.
There already is a setChar() helper here.

Change-Id: I41ca00567aca2b891f8256fe4b0d0614ad5bb321
[BREAKING CHANGE] Fix ve.ui.Overlay classes

Rename to ve-ui-overlay-(global|local) and give the overlay
in the language input widget a global class otherwise it doesn't
shield the personal toolbar.

Breaking change: ve-ui-surface-(global|local)Overlay renamed.

Bug: 68486
Change-Id: Ia99d368a41ab581a2bd4e3e39d6fc6efe5e6ffb4
Comment icon positioning

* Tweak vertical position
* Add padding to make click target larger
* Add comment-in-heading test to demo

Change-Id: I7bf62e2f9422a2e6c1fdf7b1cfdcfa92e4642d61
Merge "Generate only one pair of snowmen for multi-sibling nodes"
Generate only one pair of snowmen for multi-sibling nodes

If you had a leaf node rendered as 3 siblings (i.e. $element.length = 3),
then ve.ce.getDomText() would return 6 snowman characters, but the
correct number is 2. Put in a guard against double-snowmanning these nodes.

Also clean up the surrounding code a bit:
* Use Node.FOO_NODE constants directly
* Get rid of check for Node.CDATA_SECTION_NODE (who uses that?!)

Add unit tests, combining the tests for getDomHash and getDomText, and
including cases to test all code paths, including this one.

Bug: 67992
Bug: 68147
Bug: 68151
Bug: 68733
Bug: 68740
Change-Id: Ibf64fc0d3d03c639b2ad0f434949e75a42cef9ef
Merge "Update OOjs UI to v0.1.0-pre (e9cf571db2)"
Merge "CommentNode: Change icon from orange to grey"
Merge "Copy annotation indexes before returning"
Update OOjs UI to v0.1.0-pre (e9cf571db2)

New changes:
1e7fcaa build: Remove over-ride on jscs's disallowQuotedKeysInObjects and make pass
170f607 Use native style property names instead of jQuery's css map
eb9b38f Localisation updates from https://translatewiki.net.
b812471 Unified demo page
6b06deb SVG fixes
970e35b Localisation updates from https://translatewiki.net.
bbfdfa8 Localisation updates from https://translatewiki.net.
9e8f965 Fix copypasta in WindowManager documentation
7fe05d5 demos: Rename demos.html to index.html for convenience
55beb80 demos: Add example of menu item with a long label
694e81c Update oojs to v1.0.11

Change-Id: I908933a4fa025d48e2d868a83039f7636356911c
CommentNode: Change icon from orange to grey

We have no other bright solid colours in Apex or Vector so it looks quite
out of place. Also it conflicts with the selection colour in FF/Linux.

Also swapped implementation to use the file from OOjs UI instead since
they're now equal. Made sure dimeneions and alignment stay the same. Couldn't
append an instance of OO.ui.IndicatorElement as it doesn't allow invisible
content (the em space for selection), using the underlying mixin instead.

Also removed top/bottom margin around the inline block which
previously caused the line height of the containing paragraph to
increase by 0.15em in both directions.

Change-Id: Ic2133b9a588050f5fc159cadf0e6f315ae701a10
Localisation updates from https://translatewiki.net.

Change-Id: I586b0792537a50434e6b4dcd2da0abe9a5c3374d
Merge "Add 'snowman' and '☃' in comment for greppability"
Add 'snowman' and '☃' in comment for greppability

Change-Id: I53ca642a199352cc5478c31028d595edb230de29
Merge "Function name fix"
Remove unused CSS classes

By searching for CSS classes that don't exist in the code.

Change-Id: Ib45f86beb96021cdbfa8272660d7416a0ccaa737
Function name fix

Change-Id: I831612dc467b463f52eed8434639204e645f6fc1
Localisation updates from https://translatewiki.net.

Change-Id: Ied5f4c0c3863a38ef66989be7c1bdd00cb7a3faf
ve.ui.AnnotationInspector: Allow content insertion without annotating

Needed by Ie4a633ed in mediawiki/extensions/VisualEditor.

I think this makes a bit more sense. Previously, you could only insert
content if you were going to annotate it – now, you can always insert
it *unless* you are going to de-annotate it. (Without this condition,
clicking the 'remove' button of an inspector for a collapsed range
would insert content, which is silly.)

This is technically a backwards-incompatible change, but it doesn't
break anything in core or MW as far as I can see.

Change-Id: Icc2e368ac2f7951f53981d834029ef8b8f075d61
Copy annotation indexes before returning

Otherwise modifying the set can change your original data,
which is bad.

Bug: 68677
Change-Id: Ia120b08ee385f881407696ce3c5d9cb606afe1c8
Move non-icon/indicator styles out of ve.ui.Icons.css

Change-Id: If27601ab80cdab374f8f17414ec0101145cd5c7b
Merge "SVG fixes"
SVG fixes

* Fix encoding
* Remove unused attributes
* Fix some IDs

Change-Id: I133977ddeb12cb4419f514821ec1001a6f31294a
Merge "Use shorthand for collapsed ranges"
Style MobileContext properly

It should show up below the main toolbar. This is a follow up to
Id8cc4b07905f777f667f36cbcc65e821847142d5. The styling will need to be
changed in the future if we want MobileContext to be rendered properly
outside of MW.

Change-Id: I13fa3dc4f85fd3413c5939c118d54f11f1e98076
Localisation updates from https://translatewiki.net.

Change-Id: If69d8beb8508e76176093749be348e461e02bdfc
Meta-fy empty comments as they aren't editable/useful

Change-Id: I8c7be0b4049e86bd405543759601ca8b5c99e63d
Generate fake comment nodes (spans) when copying

Comments are stripped by native copy/paste so use special spans
to store comment data for VE->VE copy/paste.

Change-Id: I7e1e5d5b4abb0c6ad49ed278e36ffcb86d835813
Fix copy paste of comments in Firefox

Copy hash was including comment nodes, but paste hash
wasn't (as they get stripped), so modify hash function
to only look at usable nodes (element & text).

Change-Id: I27b0a86e0175ccf2d71261cb8d36fd20aff900b8
Merge "Followup ab2d4cbe: Correct comment indicator's size"
Followup ab2d4cbe: Correct comment indicator's size

Sizes were all wrong (image was clipped).

Change-Id: I91618b414186dceaaa51fa60d4634cb5627fbfa6
Localisation updates from https://translatewiki.net.

Change-Id: I9a8c40ed3d018799dc2bbaee394986a2f6961fa1
Merge "Initialize defaultSize as boolean in ve.dm.Scalable"
Initialize defaultSize as boolean in ve.dm.Scalable

Change-Id: Ied7e3667d031bd513b5aace137e8e2e8ebad4285
Use shorthand for collapsed ranges

For consistency.

Regex replace:
 ve\.Range\( ([0-9]+), \1 \)
 ve.Range( \1 )

Change-Id: I2c4fff35db0a7ea65e7b59bdeb8d1a807bedb965
Merge "Remove transparent selection from focusable nodes in FF"
Merge "Highlight and bind events to $focusable, not $element"
Merge "Add @embed directive for resize-nw-se and resize-nw-sw icons"
Fix expandRange( 'root' ) to not include the internal list

Change-Id: I61752657f49a4e1709a63f012d5b1f6bc99dfc05
Add @embed directive for resize-nw-se and resize-nw-sw icons

Follows-up 0d7ee1a74a7ad9fbf4c.

These were making 2 extra http requests when first clicking a
resizable image on a page.

Change-Id: I9a16a23853899800238294975fb481cafcfe4001
Highlight and bind events to $focusable, not $element

Still use this.$element for setting classes and properties.

This reveals a masked bug in nodes which override $focusable/$resizable
and use generatedContent, as GC re-defines this.$element but doesn't update
this.$focusable/this.$resizable.

To fix this add in getters for focusable/resizable to GC node, and use them
to redefine those elements on render.

Change-Id: I2415bbcdf94bbb25773a37e4f3a5048a567bb025
Add a space to the comment node for selection highlighting

Change-Id: I82ff9329d7f04ad9068408c17f1545d4071d6360
Remove transparent selection from focusable nodes in FF

This only made sense when we had selection shields.

Change-Id: Ibec223976a580fc060dbab6e07f488d365dd6466
Merge "build: Remove over-ride on jscs's disallowQuotedKeysInObjects and make pass"
Merge "Followup ab2d4cbebf40: fix whitespace preservation in CommentInspector"
Followup ab2d4cbebf40: fix whitespace preservation in CommentInspector

.match() returns an array, not a string.

Change-Id: I6e4ea7a74035e2c89377291140886a41cdfb5428
build: Remove over-ride on jscs's disallowQuotedKeysInObjects and make pass

Change-Id: Ie9b99d99330e9eda4aa9683741c5f79d754bbf0b
Merge "SpecialCharacterInspector: Don't have a hard-coded default message for the JSON blob"
Merge "Update OOjs UI to v0.1.0-pre (a7ce4d48d9)"
Merge "Ignore staging events in CE surface"
Merge "Update context menu according to stricter rules"
Merge "[BREAKING CHANGE] Show comments inline to the user"
[BREAKING CHANGE] Show comments inline to the user

Add a CommentNode and allow for <!--comments--> to be rendered
as nodes in VisualEditor. Comments are now inspectable nodes
with the ability to view them, edit and add new ones.

For now, only show comments inside of content branch nodes;
comments in structural positions can often be shown, but sometimes
they can't be (if they're in the middle of a table for instance)
and detecting that difference isn't easy.

Breaking change: Introduces a new comment node which may break tests.

Bug: 49603
Change-Id: I05fcccdeb881d1af245077d2991bff4458031340
Update OOjs to v1.0.11

Release notes:
 https://git.wikimedia.org/blob/oojs%2Fcore.git/v1.0.11/History.md

Change-Id: Ib91e9c08b8d1da1d63d1a0fa1e18aa01301710b1
Update OOjs UI to v0.1.0-pre (a7ce4d48d9)

New changes:
6847186 Tests: Move …/test/… to …/tests/… to be the same as other repos
c2ee74f Handle touch events in toolbars and toolgroups
84b51fe Localisation updates from https://translatewiki.net.
a875313 Make TextInputWidget's autosizing work when setValue() is called

Change-Id: I9c26f04281f1988cacaaf7d72753e06419541873
SpecialCharacterInspector: Don't have a hard-coded default message for the JSON blob

We don't do it like this normally; why should this be different?

Change-Id: I66182da9cbcd1bc063369083f0582ed653580c66
Localisation updates from https://translatewiki.net.

Change-Id: I1d930f13b173c8cd9a49b9e23c064d45e21a70cf
Followup b141a7d23: don't display:none; the popup in the DesktopContext

We have to be very careful to hide the context and its popup using
visibility: hidden; rather than display: none; , because the latter
breaks all sorts of iframe-related things in Firefox.

This logic was mostly there already, but was broken by the great and
terrible dialog refactor (when DesktopContext's show() and hide() were
consolidated into toggle()). It's a mystery to me how the old code
even worked, because it looked like it should have had the same problem.

Bug: 68223
Change-Id: I54fbf03e91c2806548f6bc7fc9d9cfed53e6c90d
[BREAKING CHANGE] Fix camel-casing of countNonInternalElements

Also add minor optimisations.

Breaking change: function renamed.

Change-Id: Id3d6da8730eb81e4cab99c91521a7b6d1b46684a
Merge "Use the current document when evaluating activeElement"
Bind/unbind setResizableHandlesSizeAndPosition on focus/blur

Otherwise the resize handles are expensively repositioned for each
image on the page every time there is a transaction!

Change-Id: Ia6cf8de0da03472a517826acd2f64ba126ccf273
Merge "Remove Firefox listnode hack"
Merge "Add optimised method hasAnnotationsInRange"
Merge "Use proper methods for detecting data type in getAnnotationIndexesFromOffset"
Merge "Use native focus"
Merge "Fix calculation of affectedRange in transaction processor"
Remove onFocusableHistory listeners

This is already covered more efficiently by onTransact listeners
which only bind when focused.

Change-Id: I09913dd0d76716f10cf25f4b31fe4f8265f64a2c
Merge "Fix spacing inside fragment inspector"
Merge "Fix for cursoring into focusable nodes with up/down"
Remove is*ArrowKey functions

Three functions only used once.

Change-Id: Id949ac1e9492f04df6369bc09238bb0852b3e3bb
Merge "Add special case for up/down arrow key on focusable node"
Merge "Tests: Move …/test/… to …/tests/… to be the same as other repos"
Merge "Deprecate 'live' event in favor of 'setup' and 'teardown'"
Deprecate 'live' event in favor of 'setup' and 'teardown'

Mostly relevant to ve.ce.View and related mixins, this is a
cleanup for live events. Now while ve.ce.View still has the
internal this.live property, the events emitted are either
'setup' or 'teardown' and the code responds to each accordingly.

Bug: 55505
Change-Id: Ieddbf5c684eb0edc3130034de64eb284aeaebbda
Update OOjs UI to v0.1.0-pre (9cd400e3d5)

New changes:
a1b99bb Dialog title alignment and iframe size fixes
a30c514 Localisation updates from https://translatewiki.net.
e2e1a12 Localisation updates from https://translatewiki.net.
a6248f0 build: Update grunt-jscs (formerly grunt-jscs-checker) from 0.6.0 to 0.6.1
7710fe7 Set actions buttons to be framed by default
59ef352 Localisation updates from https://translatewiki.net.
6544476 Give MessageDialog actions 'action' properties
d10d0d9 Localisation updates from https://translatewiki.net.
91b11b4 Use native focus
f808d83 Add role attribute to a few widgets
8bd708b Special case for measuring clippableContainer == body

Change-Id: I56a21b2d652cc31748b369f26c0dc1cf5e0e81e2
Use the current document when evaluating activeElement

Change-Id: I859edf8d23169ac16fcc821b38892ad2a5ec5e6c
CommandHelpDialog: Make closing action 'safe' not 'primary' for consistency

All other single-button non-inserting dialogs use 'safe' for the 'get me out of here' action
button type; 'primary' (=> "Done") feels rather odd in context.

Change-Id: Ie1fcc997b2050e44a21bd79f13a756b144301cc1
Localisation updates from https://translatewiki.net.

Change-Id: Id549fb319199d4ca4ef0d81b2ccb285c82028bdf
Merge "Make the re-render flash more prominent"
Merge "Round up height of language inspector widget"
Add optimised method hasAnnotationsInRange

Selecting the whole document causes the ClearAnnotationTool to
aggregate all the annotations in the document and check if it is
an empty set. This can be improved with a custom method that bails
at the first sight of an annotation.

Change-Id: I2815d45a21454b11fbd04541469192b2da39511e
Use proper methods for detecting data type in getAnnotationIndexesFromOffset

Change-Id: Ib0c11fb20a733ef8795729cc34656309903466aa
Use native focus

It's faster.

Change-Id: I633ee7d2de49ed60ceb00cf11d27c5481fadc4c3
Fix calculation of affectedRange in transaction processor

Any insertion with two close nodes at the root (e.g. copy & paste
more than one paragraph) results in the whole document being
marked for rebuild. On large documents this is ridiculously slow.

To fix, decrement the minInsertLevel whenever we move into the parent
scope so we don't keep ascending the tree for siblings.

The fact 'minInsertLevel' exists as a variable but is never changed
suggests this is just a typo that has been lying around for 3 years.

Bug: 68301
Change-Id: Ifdcb29196e328e78a8273b0a385d3a3dff7d9144
Make the re-render flash more prominent

It's almost invisible in its current state making it useless
for its intended purpose of highlighting re-render issues.

Change-Id: I89656b4585aa3bb8a5b3672a9ea7f547c7848f61
Remove Firefox listnode hack

This doesn't appear to be necessary anymore, and .css is very expensive.

Change-Id: Icd40326339d1cec143917d6a4075a947c1169bd0
Localisation updates from https://translatewiki.net.

Change-Id: I88bb8aa0b49b482f630021288258ab2a40fc543c
Fix spacing inside fragment inspector

'Other' actions now use margins instead of padding.

Change-Id: I270c287fdac0972507d4bba477ef5bbcf9257a75
Localisation updates from https://translatewiki.net.

Change-Id: I2ee70c0106b00b7b78fb072fe13a2e771e5767a5
Tests: Move …/test/… to …/tests/… to be the same as other repos

As requested on QA mailing list.

Change-Id: I4d34faf1ac55432631cf5ecf9f6f8f742a4e4d89
build: Update grunt-jscs (formerly grunt-jscs-checker) from 0.6.0 to 0.6.1

Change-Id: I2dc1e88cdf98b1803231ed27aaa160a68a099407
Localisation updates from https://translatewiki.net.

Change-Id: I7d18b05f35da4a513229b8eb52c262031776b288
Round up height of language inspector widget

Change-Id: If47c66b93af16f65d177d4578d4f0676427b3394
Ignore staging events in CE surface

This prevents the document from stealing focus while live
editing a node.

Bug: 67326
Change-Id: If03a200ceadf16adffea497ca511d49bc687c31f
Update context menu according to stricter rules

* Connect to onContextChange instead of onModelUpdate
* Never emit context changes while staging

Change-Id: Id5d1dbb367d6e4e34d70bc8dd668b08bf928e4cd
Localisation updates from https://translatewiki.net.

Change-Id: Ifba7119ae6649955ed57826ac74691b93ab33fab
Fix for cursoring into focusable nodes with up/down

Due to Chromium issue 394728 it is possible to end up inside a
focusable node by cursoring up/down, and possibly in IE too.

Change-Id: Ife00f839d1e88a670d15c4251e4c26968ad00b78
Add special case for up/down arrow key on focusable node

Previously we just ignored these keystrokes, but we can use the
same temporary cursor fix we use for backwards IE selections.

Change-Id: I2a0bf8672fa2201e98a740a9b2141a9d1bd56755
Fix-up mobile context and surface

* No longer adding context to local overlay (will be added to toolbar in vemw commit)
* Pass overlays into window managers
* Construct overlay in the correct frame (top-level one)
* Remove animation of context (for now anyway)

Change-Id: Iafe64a6f4e5c83554be27a60b3b7b2536bf3298d
Bring back global/local specific CSS classes

This way we can target them individually.

Change-Id: I26782282d172d5ec3f484932157f4c67e3a19a91
Merge "Prevent deletion of focusable nodes by typing"
Update OOjs UI to v0.1.0-pre (97dbb50137)

New changes:
54460ce Prevent disabled tools from stealing focus
436ac66 MenuWidget: Add option to specify an extra widget for mouse events
e67bb70 Localisation updates from https://translatewiki.net.
a2ba412 Mellow out the shadows being applied to dialog content
085d3a5 Split toolbar demo in two and add action button demo, with labels
dfd5100 Allow FieldLayouts to have help text
5f30488 Localisation updates from https://translatewiki.net.
d544ffe Remove useless documentation, add more useful documentation
e93e7cd Get OOUI working with mobile again
eb6c68b demos: Add LTR/RTL switcher to icons demo
4b874d4 Use SVG check icon

Change-Id: Ifbfe396f6154cdc0f1946977a8cab3f2312768b4
Merge "Switch to 'custom' when MediaSizeWidget updates"
Merge "Add 'clone' and make 'getDimensionsFromValue' static in ve.dm.Scalable"
Merge "Remove lies from documentation"
Safely ignore requests to open unrecognized windows

Change-Id: I892f7ff43a7fd7c78be071986ccf3a7119dd1ace
Remove lies from documentation

Change-Id: I28d57afba967f58a7a8beff561acf42b2b77f1c7
Localisation updates from https://translatewiki.net.

Change-Id: Ic340eec579a7f901b3ee8b3a7e63c453b28c97d7
Prevent deletion of focusable nodes by typing

Bug: 67177
Change-Id: I2d6dbe7a544717f1a643db7cfc853bdb4bbe9d7d
Switch to 'custom' when MediaSizeWidget updates

When the user changes the dimensions in the MediaSizeWidget make
sure the 'custom' option is invoked for validation and event
propogation.

Bug: 67684
Change-Id: I88c3f3dcc7667b3ffdd2a8a8433cb47b82ba1531
Merge "Initialize data first"
Add 'clone' and make 'getDimensionsFromValue' static in ve.dm.Scalable

This is the first step to making sure that editing images is done
without affecting actual dm nodes. Make sure the scalable can be
properly cloned; also, make getDimensionsFromValue a static method
that can be called for calculations without having a scalable instance.

Change-Id: Icd5c37f0df5d6c89a9befcbfdeaf26ce15ab7108
Initialize data first

Normalizing on initializing data at the top of get*Process methods.

Change-Id: I8119870ec3142831911d7677ac6616be84cb7c8b
Localisation updates from https://translatewiki.net.

Change-Id: Ib40b26592138415e824f47868ba854df0e4e2197
Merge "Remove label from 'insert' menu, and instead use a large plus icon"
Remove label from 'insert' menu, and instead use a large plus icon

Change-Id: I8b57aac151d27b28f7349d3e93f88b08f88f29ec
Merge "Move 'language' tool from the insert to the styling menu, like in VE-MW"
Merge "Add toolbar menu labels to each group for consistency"
Merge "ve.ui.Toolbar: Optimise onSurfaceViewKeyUp performance"
Merge "Fixes to getRelativeOffset and getRelativeRange"
Merge "Documentation fixes in test utils"
Merge "Unit tests for showSelection"
Merge "Don't handle up/down on focusableNodes even if backwards"
Don't handle up/down on focusableNodes even if backwards

Bonus: Fix broken logic testing $element for falsiness, instead
of $element.length.

Bug: 67755
Change-Id: I94cf1ab2f62be6769d5de69700fd41b6724afb07
Unit tests for showSelection

Effectively covers testing of ve.ce.Document.getNodeAndOffset.

Split showSelection into getSelection/showSelection for testing.

Change-Id: I36724597cf14572699c2cf768fc5b59751b95dc0
Documentation fixes in test utils

Change-Id: I80ca653de262d597648c028080e6af1125429373
[BREAKING CHANGE] Remove generatedContents argument from afterRender

Anything in generatedContents that afterRender might want to know
about will already have been written to the DOM as this.$element.

Change-Id: I222fea6c4cbf8b4d38af4d5863ec1403c122f16b
Fixes to getRelativeOffset and getRelativeRange

Major refactor of getRelativeOffset/getRelativeRange functions.

* Skip over nested handlesOwnChildren nodes in getRelativeOffset by
  tracking depth instead of a boolean (as we do in ve.dm.Transaction).
* Ensure we never move backwards in getRelativeOffset (bug 67551)
* Fix behaviour around collapsing ranges with arrow keys
* Add many more test cases

Bug: 67551
Bug: 66604
Change-Id: Ic2da78b86e13cd51af058d884048d9549fc55abc
Merge "Fix alien test data"
Merge "Add toolbar action section to SA demo with keyboard shortcuts tool"
Make sure the document is focused when setting a selection

Without explicitly focusing the document (e.g. after coming back
off the paste target from a focusable node) it is possible for the
cursor to appear in the document, but for typing to happen in the
paste target.

Bug: 67432
Change-Id: I87c9c4fb08fa6c95dd26b8ab2da281333e9f3c16
Merge "Update reference to ConfirmationDialog to use MessageDialog"
Update reference to ConfirmationDialog to use MessageDialog

Change-Id: I01ecd69c183dec4e87531d77233e1ff272c8ecb1
Localisation updates from https://translatewiki.net.

Change-Id: I30b974309cc4ae9fb831243b60c6ca7b723e2291
ve.ui.Toolbar: Optimise onSurfaceViewKeyUp performance

Follows-up 1b9c077b83.

* Only run expensive height(), offset(), etc. when the toolbar
  is floating.

* Set the property directly instead of using "animate(, 0)".

Change-Id: Ia17f5a3e701a58537df341b7aafd6273b649d4e8
Prevent double counting of DM nodes in getNodeAndOffset

About grouped templates, for example, render multiple siblings
in the DOM, but still have a DM width of 2.

Bug: 67985
Change-Id: Id65e858b90bc7ab5a4d6ba715db30574691817b9
builderloader: Omit value for boolean "disabled" attribute per HTML5

Follows-up 2d4b5572a.

Change-Id: I8ad51219de520366473a325aa029e35c6dd0299f
Localisation updates from https://translatewiki.net.

Change-Id: I2119e7cc4c79a97e64f56c7d74cfffe01bc711ab
Add toolbar action section to SA demo with keyboard shortcuts tool

Change-Id: Ib1cf7b181c584c0cc147cd9807018f1893d71758
Widgetise demo menu

Also separate out menu functionality from the debug bar.

Change-Id: I04c1929c5279968ca3b0ec475681bd587ae58356
Move 'language' tool from the insert to the styling menu, like in VE-MW

Change-Id: I26befde69077c4f66b667f95641cedd820d59591
Add toolbar menu labels to each group for consistency

As the mobile side of VisualEditor adds more features, we will want to expose an increasing
number of these standard function menus to the user. Additionally, a couple of the existing
groups (history and link) provide no current functionality for their labels to be shown, so
are included only for completeness (new labels for the history, paragraph formatting, block
structure and text styling groups; the 'insert' group retains its use of the existing label
in advance of a better solution being found.

To see these in action, visit the mobile demo (…/demos/ve/mobile.html#!/src/pages/h1.html),
and click on each of the toolbar groups to witness the majesty that is a semi-unstyled dump
which we need to improve. :-)

This also fixes the label for the text styling block in the commands help dialog to show up
as such, and not (confusingly) as "formatting", as a clash with the block immediately below
it is unfortunate and inconsistent.

Change-Id: Iec7b82b3e1382f269bf4c26f96d17c1d2ba1cb00
Fix alien test data

Comments correctly said alienInline, but code had alienBlock.

Change-Id: I9c2220417cef2ce0a98be887ac76c50a9ab34680
Localisation updates from https://translatewiki.net.

Change-Id: Ic1b8c0b5ead9f1ffa86ab4962040a379fe857acd
Merge "Apply 'original size' to images"
Apply 'original size' to images

Trigger the proper event by using 'chooseItem' instead of 'selectItem'
in the MediaSizeWidget when changing size type.

Bug: 66863
Change-Id: I243cff5a2d56db48882c343a8bb91153edd96a43
Localisation updates from https://translatewiki.net.

Change-Id: Id9ad8a1fdb44f892e467c3ee0c1e4fe9e48521d1
Localisation updates from https://translatewiki.net.

Change-Id: I13eab95a23052529ce1995d7a53c6a7803676540
Merge "Show from/to of range in debug bar"
Localisation updates from https://translatewiki.net.

Change-Id: I60e4d0959b03b6f92de791c6e67f6a0da1120671
Show from/to of range in debug bar

Conveys more information than start/end.

Change-Id: Id8aaf943bf559cd2cafe8bfdd5a3ed5b215d1f4f
Localisation updates from https://translatewiki.net.

Change-Id: I273c2d8b32f7c833fcb0eb6c5a513f1a051dc82a
Merge "Revert "Skip over nested handlesOwnChildren nodes in getRelativeOffset""
Revert "Skip over nested handlesOwnChildren nodes in getRelativeOffset"

Breaks ve-mw tests, because:
* getRelativeOffset() can now apparently return -1, but
  doesn't document this
* getRelativeRange() uses relative offsets to construct
  ranges, so it returns ranges like (-1, -1)
* ve-mw tests for getRelativeRange() rightly fail
  when they receive ranges like (-1, -1)

This reverts commit 9b2102f796d28d9e938cbda7600694863d0805c8.

Change-Id: I1f2f0f497d2f87d1064d76806f9ea206caddcdc1
Merge "Revert "Restrict get relative offset to movements of +/-1""
Revert "Restrict get relative offset to movements of +/-1"

In order to be able to revert 9b2102f

This reverts commit 5d142a015596ebcc2b2e8a90fc5a1e41e67823e9.

Change-Id: I8fb41878ac2b352958e15d2e57a4fa27a755622e
Merge "Remove jquery.client"
Disable triple-click handling in IE

Because IE11's click counter is broken, the triple-click code
completely breaks editing in IE. For a real fix, we'd have to
reintroduce getClickCount() or whatever it's called, where we
keep track of the number of clicks ourselves.

Change-Id: Iaa8a5b8aed553f8dc296eca503d0aa5517a2c0e8
Add evil detection functionality for IE

We really shouldn't be doing browser sniffing, but for now
we have to do it to make Internet Explorer work. Eventually
(i.e. over the course of the next three months) we should get
rid of it.

Change-Id: Ia511ca9b5226d85520b57384e1b451d4d8be19a6
Remove jquery.client

Is unused in VE core.

Change-Id: I569513275ae485a8cf6843fbc63cb032022a27be
Check that the surface has a selection after focus

This happens in Chrome when the document starts with a figure,
although at the moment this is always masked by slugs.

Change-Id: I375c6de87a0795217e5e1348700ebad294c0bcda
Merge "Restrict get relative offset to movements of +/-1"
Merge "Skip over nested handlesOwnChildren nodes in getRelativeOffset"
Restrict get relative offset to movements of +/-1

Moving in steps of greater than one is never done, and
would break the handlesOwnChildren detection.

Change-Id: Ic34563d6fed4f7c0aa348cc82c20a72f9f7531fb
Localisation updates from https://translatewiki.net.

Change-Id: I46f944999b56771a58f40e69db66a29debf9ec00
Skip over nested handlesOwnChildren nodes in getRelativeOffset

By tracking depth instead of a boolean (as we do in ve.dm.Transaction).

Bug: 66604
Change-Id: Icad32a7cc25f006bc9c56519e9e3e6309e82bcfd
Merge "ve.ce.Surface: Prevent incorrect pawning in Opera 12"
Merge "build: Merge intro.css and intro.js.txt to intro.txt as they're identical"
Update OOjs UI to v0.1.0-pre (85cfc2e735)

New changes:
e450f32 Don't transplant disabled stylesheets
85cfc2e Localisation updates from https://translatewiki.net.

Change-Id: I6fe171cf8cd8e066779f6cf43918569906a9efa1
build: Merge intro.css and intro.js.txt to intro.txt as they're identical

Change-Id: I12cb7921558b86cc863057272ba1ae8c146bd96a
Merge "Followup 96ff968: use this.$element after it's initialized, not before"
Follow-up: If717ef98 – Re-add subscript and superscript removes to DM nodes

Bug: 53330
Change-Id: I53813ed4f294b9893fab3b8b8f1a98a5eb07aca8
Followup 96ff968: use this.$element after it's initialized, not before

Bug: 67437
Change-Id: I523b773f44915430653ceaf35db0eb5dc0daf019
Localisation updates from https://translatewiki.net.

Change-Id: I5c30b3a892874f0d23da72494e9694f21464b86b
Merge "Use CSSJanus to generate RTL stylesheets"
Merge "Update OOjs UI to v0.1.0-pre (432a76f7d4)"
Merge "In the toolbar, display superscript tool above subscript tool"
Use CSSJanus to generate RTL stylesheets

Depends on I3d8043c in oojs-ui.

Bug: 65057
Change-Id: I4b2b3fb4c5d90dce505d2c4c8c632b7b757ad91a
Update OOjs UI to v0.1.0-pre (432a76f7d4)

New changes:
ebfa365 Generate RTL stylesheets with CSSJanus
da83ad2 Set tabindex on button <div> instead of <a>
e2a6bb1 Add tabindex=0 and role=button to tool links
432a76f Run node-svgo to crush all SVGs whilst retaining readibility

Change-Id: Ieb775472b05acf42aada190a49f9f768ddcd5084
In the toolbar, display superscript tool above subscript tool

This ordering makes more sense to me intuitively. A quick glance at
other text editors also shows that, when they are placing these
options 'vertically', superscript always goes first.

It felt especially jarring in Polish, where the names for superscript
and subscript are essentially 'up-script' and 'down-script', and the
up and down were reversed.

(The change in ve.ui.AnnotationTool.js is incredibly stupid, but as
far as I can tell this is the only way. The toolbar doesn't permit
explicit ordering of the tools, only 'promoting' and 'demoting'
selected ones.)

Change-Id: I0e7c57328dcebf52876cbefa484f7d967fc63e43
Merge "Grunt: Create a distribution files for the ve module"
Merge "Provide the (currently-unused) external link icon in LTR and RTL variants"
Merge "Run node-svgo to crush all SVGs whilst retaining readibility"
Use globalOverlay as the contextOverlay in MobileContext

In DesktopContext we use localOverlay, but since inspectors
are full-screen on mobile, the localOverlay is actually
on top of the inspector. This caused link inspector suggestions
to not be shown.

Bug: 67399
Bug: 66753
Change-Id: I95883164797f6fb27659abf6445be98133c19581
Provide the (currently-unused) external link icon in LTR and RTL variants

Change-Id: Ifb2041545689d9e5ecfd9184cd46d59f4854157d
Run node-svgo to crush all SVGs whilst retaining readibility

svgo --pretty \
     --disable=removeXMLProcInst \
     --disable=cleanupIDs \
     --disable=collapseGroups \
     -f …

Change-Id: I7e867a51feebb2799e6d4cdca455ee7534ec6a24
Reenable mobile context and style it properly

Also, attach inspectors to the global surface instead of mobile context.

Change-Id: Ic4f288cdcb248b76ead57c048144c8909a16042d
Merge "Hide context tools when the model they match isn't "inspectable""
Hide context tools when the model they match isn't "inspectable"

Also disable double-click & enter in this case.

Move ve.dm.Node#isInspectable to ve.dm.Model so annotations get it too.

Bug: 67176
Change-Id: Icecc0bf0ffc3e22f02fcbefac6aeb04e415c96fa
Merge "Never embed the context when an inspector is present"
Localisation updates from https://translatewiki.net.

Change-Id: I6618e13d83cb1f7516dfc030348b0b542c6ecdf5
Never embed the context when an inspector is present

Having an inspector launch over the context you are inspecting
seems like a bad idea.

Bug: 66542
Bug: 67306
Change-Id: Ida87138040d4415064c1b36aa43d2ab4634af256
Merge "Prevent iOS Safari from following links"
Prevent iOS Safari from following links

This happens when the keyboard is closed. Upstream bug but broken
in all major versions so we need a workaround.

Bug: 65326
Change-Id: I8a99fa7d7c19a3c3468959935726a21059a582c5
ve.ce.Surface: Prevent incorrect pawning in Opera 12

Also cleaned up and added more comments for the magic used here.

Bug: 63630
Change-Id: Ice7b745f594ed3f8f1de709130c50c6850591d6d
Re-label "Clear formatting" to "Clear styling"

We use "formatting" to mean structural things like heading/etc. which aren't
removed by this tool, whereas we use "styling" for all the annotations which
it does remove, so this seems a better choice.

Change-Id: Ib8e10bafe784f077201d720267b541e62475536d
Merge "[BREAKING CHANGE] Remove generated content node wrappers"
Merge "Fix simulation of .prepend() in ve.ce.BranchNode#onSplice"
[BREAKING CHANGE] Remove generated content node wrappers

This prevents us from ending up with CE HTML like
<div><tr>...</tr></div>.

Remove all styles directly attached to GC nodes.

Bug: 67169
Change-Id: I60eb5d82e0114c38dfd3ce2b7bbda8aadb1ca2d6
Fix simulation of .prepend() in ve.ce.BranchNode#onSplice

Unrolling jQuery's .prepend() for performance is a good idea, but it
helps to implement it correctly. It was inserting elements in
reverse order, oops!

Change-Id: Ic0de79f591a2c921796a1e7bac50543d1f6733d9
Merge "Split out ve.{dm,ce}.TextStyleAnnotation into parts, add other annotations"
Split out ve.{dm,ce}.TextStyleAnnotation into parts, add other annotations

No inspectors/actions/buttons for now.

New: <abbr>, <samp>, <time>, <dfn>, <mark>, <q>, <kbd>, <var>.

Bug: 52664
Bug: 64376
Change-Id: If717ef98b9c9dd9d2f07e3f3119ffa4757055df2
Merge "Select highlights on touchend event"
Localisation updates from https://translatewiki.net.

Change-Id: I1fe1b66f0df1ed27569c72c2ab980ef88411ba21
Select highlights on touchend event

iOS doesn't fire mousedown on the first tap. As the DOM
is modified it only fires mouseover/mouseenter. Listen to
touchend as well so that highlights are selected with one
tap.

Bug: 66999
Change-Id: Ic8ed31291bdd1404aa2f1d1c97c6f4734e8459e2
Set XML encoding to utf-8 in SVGs

Change-Id: I45d5aab13b8aa973bbf55e2b11565d592fb6aed2
Merge "Fix up selection after deletion if at non-content offset"
Correct various things in rangy-position to make it work in IE

* Add semicolons at the end of statements where they were missing
* Do not conditionally define createDocumentBoundaryPosGetter(),
  jshint doesn't like that and the function is used outside of
  the block where it is defined

Fixing these things makes confusing errors in IE go away.

Change-Id: I18cc0abe23f649515e555cd9318f88bf91fc7ac1
Fix up selection after deletion if at non-content offset

Bug: 67213
Change-Id: I2d5afe29315680bacec57883a861ddb93b8f5b16
Merge "Add a ve direction class to all surfaces"
Grunt: Create a distribution files for the ve module

Bonus:
* Create demo using distribution file
* Fix CSS for when debug bar isn't present.

Bug: 66117
Change-Id: I83ebc801cdd051a8c13435e3ec11ffa20d1b7a9f
Remove old ce-surface classes

Looks like leftover code from the ES era.

Change-Id: I878c68ec72e75b010aafc089d0f3bc6e7688cc30
Add a ve direction class to all surfaces

Previously we were relying on a body ltr/rtl class which only
exists in MW.

Also position context relative to UI surface not CE surface
to match shields (in practice they have the same position).

Bug: 66494
Change-Id: If14e91ce135fdf15a7715fb7907e957abae79581
Use more standard format for displaying keyboard shortcuts

This affects both the tooltips on tools and the help dialog.
"CTRL + SHIFT + N" is ugly, let's instead use "Ctrl + Shift + N".
Note that this was overriden for Macs, that behavior is not changed.

Change-Id: Ifd1e8e01e5bee5bf7bc82731d5bea27794c6dfb9
Update OOjs UI to v0.1.0-pre (a63f03882e)

New changes:
0dafebd build: Only include source maps for test builds
a63f038 build: Move source map option from git-build to pre-test

Change-Id: I2b06b256e48106eac2090df6d4bf5f45349222f9
Follow-up I81663929: Use grunt git-build to ensure we get the hash

Change-Id: I92a85fb79d7fecc2c16818d2270e0ed0e885b812
maintenance: Simpler OOjs UI pullthrough-script

No need to run grunt test, given that the grunt build from npm install will
suffice for our needs.

Change-Id: I816639290874e4962d5dac7d580d314e3bd1cb16
Merge "Also annotate metadata in TransactionProcessor"
Merge "Always refocus the paste target when a node is selected"
Always refocus the paste target when a node is selected

The previous assumption was that if the paste target had a
selection it didn't need to be re-selected and focussed, however
it is possible for the paste target to keep a selection but lose
focus. As this event usually only fires when the paste target
loses focus, just remove the optimisation all together.

onFocusChange will ensure that no extra focus/blur events are emitted
(the reasoning given for this change in I466a64364).

Bug: 67178
Change-Id: I7c87b6da3aedf2923f75dc6f91c0d43b23847334
Update OOjs to v1.0.10

Release notes:
 https://git.wikimedia.org/blob/oojs%2Fcore.git/v1.0.10/History.md

Change-Id: Ib154a0c9cfc7c8b428671c9d77892361ea8d7e1b
Update OOjs UI to v0.1.0-pre (b9d403a678)

New changes:
a725505 Work around element sizing bug in Chrome
d7930fb build: Implement source maps for js build target
75ed129 build: Use isoUtcDateTime instead of yyyy-mm-dd in banner
b9d403a Make ConfirmDialog interpret clicking X as 'cancel', not as 'OK'

Change-Id: I3e92921245ce6d1d28d0ba42db0ae117e4021493
Localisation updates from https://translatewiki.net.

Change-Id: I001e85cf3e042357ba7a16db697beebe81d38470
Merge "Only allow slugs where paragraphs are allowed"
Only allow slugs where paragraphs are allowed

Add example to aliens.html to demonstrate this.

Change-Id: I2190d60132db9396953039d5330cae24d1550d2f
Merge "Demo page styling"
Merge "Update OOjs UI to v0.1.0-pre (9aad824bd6)"
FocusableNode: Use getClientRects()[0] instead of getBoundingClientRect()

In iOS7 a bug(?) means that getBoundingClientRect isn't relative to the
viewport, where getClientRects is. To make sure the relative
calculation is always correct, always use getClientRects.

Bug: 67063
Change-Id: Ib935c18274e1c065af9bad6a92e30a6073d12e1e
Demo page styling

Give correct borders to edit source box, and disable
debug bar when editing source.

Change-Id: I8a382c8dcdc09574e08ad18ee2292a73bb044ede
Merge "Correctly update full size in MediaSizeWidget"
Correctly update full size in MediaSizeWidget

Change the event calls to 'choose' instead of 'select' to make sure
they are triggered selectively; also, change the order of updating
the scalable and the UI when full size button is clicked to make
sure the size is stored and displayed correctly.

Bug: 66863
Change-Id: Ie224d40b56f848bccb13f3f6d15fe30ac41fc050
Merge "Use subtle border styling for unstyled tables"
Merge "Work around IE DOMParser bug in ve.createDocumentFromHtml"
Localisation updates from https://translatewiki.net.

Change-Id: I70d57362d67d038d8c735fcc4c6a117c63d3a248
Update OOjs UI to v0.1.0-pre (9aad824bd6)

New changes:
414c051 build: Update jscs and use new "wikimedia" preset
0401aff Accessibility: Set aria-hidden attribute on elements while dialogs are open
9aad824 Revert "Accessibility: Restore element focus when a window closes"

Change-Id: I1da7319c2ab284e93007db7f21c25db0c64b149f
Cache block drop position data before setTimeout

Bug: 67040
Change-Id: I79af6ad4683a4330aa95b55357d4333280e3edca
Use subtle border styling for unstyled tables

Change-Id: I174d4b925339a35db3120c540188f9bd7526b677
Localisation updates from https://translatewiki.net.

Change-Id: I599f3c3000177ef6eaa0e990965d9e7946931e3b
build: Re-enable validateIndentation

Upstream https://github.com/mdevils/node-jscs/issues/459 got fixed
and released in node-jscs v1.5.4. Our grunt package automatically
updates to 1.5.x so we can use this now.

Fixed pre-existing violations of indentation rules.

Change-Id: Ie5d15e2e2353cd2b16ade4f4a25f9fc02e43087e
Merge "Remove .inIme state from CE Surface"
build: Update jscs and use new "wikimedia" preset

Our coding style has been upstreamed as of
grunt-jscs-checker v0.6.0 (node-jscs v1.5.0).

Some rules were not previously enabled here.

* Disable validateIndentation due to upstream bug
  https://github.com/mdevils/node-jscs/issues/459
  (the weird switch cases we have in unicodejs.wordbreak.js trip
  the parser).

* Disable disallowQuotedKeysInObjects and requireSpacesInsideArrayBrackets
  for now (we can do that later, too many affected LOC).

* Fix missing space after comma (requireSpaceAfterBinaryOperators
  was previously missing ',' and '=').

Change-Id: Icb5b5415a2dd34172680d45c5a6b8cbf15189a4c
Remove .inIme state from CE Surface

The .inIme flag shows whether we have seen a compositionstart event with no
subsequent compositionend event. Unfortunately, this does not give any useful
guarantees about IME state (in particular, you can't tell whether there's a
candidate window open by looking at this). Therefore, we remove this flag and
change the way we handle IMEs.

Change-Id: If54ac913c891965ba1e647a1101c7d442363e225
Also annotate metadata in TransactionProcessor

Annotation transactions weren't taking metadata into account at all.
This caused nasty issues when annotating across a mix of data and
metadata.

Changed applyAnnotations() to apply annotations to metadata as well
as data. To be safe and conservative, I only applied this to metadata
offsets entirely inside the range, not to the offsets on the edges.
This means annotations with comments at the end will still cause
problems. We may be able to fix that by making annotations smarter
and having them make themselves disappear when only applied to
metadata. Alternatively, reunifying data and metadata into a single
band will resolve this ambiguity.

Also factored out common code into a helper function and cleaned up
applyAnnotations() while I was in there, removing unneeded variables
in favor of calls to ElementLinearData methods.

Bug: 52127
Change-Id: Ie93fe50a46b13c240a6f56a25a989e0c978b663f
Localisation updates from https://translatewiki.net.

Change-Id: Ibaba15e762b5a387a915dfd2e44aae09662fd30c
Work around IE DOMParser bug in ve.createDocumentFromHtml

DOMParser in IE doesn't like empty strings. If you feed it an
empty string, you get a document whose .documentElement, .head
and .body properties are all null. To work around this, map
the empty string to '<body></body>'.

This fixes lots of unit tests in IE, because
ve.createDocumentFromHtml( '' ) is used a lot in the test suite.

This bug affects both IE10 and IE11 (older versions of IE don't
have DOMParser).

Change-Id: I78a00df2823d3b1c386b8356771708dadb7f22e8
Update OOjs UI to v0.1.0-pre (7a0e222a75)

New changes:
ef2f66f Element: Add unit tests for focusin/focusout hack
54b09fd Element: Remove focusin/focusout hack in onDOMEvent
91ba7d3 Accessibility: Set role=dialog on dialogs
0447150 Accessibility: Restore element focus when a window closes
715f1ef Localisation updates from https://translatewiki.net.
9f343c0 Localisation updates from https://translatewiki.net.
6be64bc Tidy up SVG sources and fix pixel snapping
7a0e222 Fix scrollIntoView() in the case where the scrollable container is the <body>

Change-Id: I0190f4d45cca99788392cb81994b4d8ac7ef7c02
Merge "[BREAKING CHANGE (ish)] Track original data position in insertion operations"
[BREAKING CHANGE (ish)] Track original data position in insertion operations

This fixes the problem with the selection after a block
node drag and drop.

getModifiedRange now correctly accounts for closing & openings
that weren't originally defined by the user.

Bonus: Fix bug where getModified range wasn't ignoring
retainMetadata operations

Adds new properties to some operations so may break a deepEqual test.

Bug: 65716
Change-Id: If26cc0a2d492a6f9857804d22f50f6502682d893
Localisation updates from https://translatewiki.net.

Change-Id: Idff85864190f1ebf773c519e68b063712dda34ba
Merge "Catch rangy exception thrown in FF"
Merge "Remove old, unused version of rangy"
Prevent getOffset from return an offset inside a content node

Browsers will always find a way to place the cursor at a strange
offset, but we should take care to not return a DM offset where
insertions can't take place.

Bug: 66691
Change-Id: I16baa0c67325d859ffe756f8d0e190758f2b9190
Remove old, unused version of rangy

Change-Id: I7efad607728a2e17612d7e43223437ae1aa00af1
Catch rangy exception thrown in FF

Bug: 66734
Change-Id: I5b23d4fbcc7fdf926cecf49574cac02583835f07
Merge "Defer focusableNode selection fix until after native selection change"
Defer focusableNode selection fix until after native selection change

Bug: 66638
Change-Id: Id0d55eaff00bb5ee386d8f1a338804ddce5afeae
Merge "Test cases for annotating handles own children nodes"
Merge "Drag and drop of arbitrary selections"
Drag and drop of arbitrary selections

Bug: 49981
Change-Id: I1051ce9674dfc3b0d03a9d39de42ade9a17af589
Merge "Block item drag and drop"
Merge "Improve equalRange assertion and use in more places"
Remove repositionOnly argument from update

Follow up to I2adcdcfb5 which removed this argument from #show
so it is no longer used anywhere.

Change-Id: I59f1fe89a060ae7d13a93585536fe9426f7b7f12
Block item drag and drop

Bug: 51666
Change-Id: I6aa5d948488356223d345c41c6e3871ae5384202
Improve equalRange assertion and use in more places

We only need to compare from/to properties. Also check
for null ranges.

Change-Id: Ie1a0a23ab4fcb1a266a12fbb6d1e602a79f2c123
Shields are dead, long live getClientRects

Shields are evil for a number of reasons:
* The require us to modify the CSS and HTML of CE nodes,
  including generated content nodes which should really
  just be left alone.
* Shields (images) can't, or shouldn't, be appended to many
  types of element (void elements, tables)
* Don't work on wrapped inline text.

Instead, use the native Element.getClientRects for measuring
focusable nodes, which is super fast, and gives us the outline
of wrapped inline nodes.

After calculating all the rectangles they are filtered to exclude
any which are entirely contained by others.

An imaginary bouding rectangle is calculated which contains all
the rendered highlights, and is used to calculate the position
of the context menu.

Cons:
* Without permanent image shields, selecting over a complex focusable
  node doesn't render the selection as cleanly. This could be implemented
  later if really required, but performance issues need to be considered
  (e.g. on page resize every shield is recalculated).
* The rectangles calculated for wrapped text don't account for
  line height, so there are gaps between them. Future work could
  try to special-case this, but cases with multi-sized text or <sup>
  tags complicate the issue.

Bug: 52339
Change-Id: I09f1c08500ab48849880c6120501a25fca174b50
Merge "Replace <cite> with <span rel="ve:Alien">"
Merge "Indent demo HTML"
Replace <cite> with <span rel="ve:Alien">

<cite>s are currently alienated but they may be supported in
the future, so use the special RDFa type for aliens instead.

Change-Id: I907f75d4d23714d50f8b1f67592af8f7cb1e135f
Test cases for annotating handles own children nodes

Change-Id: I8524af46237a5dc1f4caba7fda8de9fc17b62386
Merge "Create highlight elements on demand"
Use cached surfaceView

Change-Id: I434ecfc91c7110a774b5f8ec5b8facc49dadc60b
Indent demo HTML

Change-Id: I8465ac3086299b756e29cbfbe6e27eb07bbd31b2
Edit HTML mode in demo

Change-Id: I743f83c82d22ae8a930bab80d0a2332f8327fc5f
[BREAKING CHANGE] Debug bar refactor

Move DebugBar from init to ui and set it up like we do
with toolbars.

* Move this.surface setting to constructor
* Change demo to create a new DebugBar on every page load
* Move setupToolbar into ve.init.Target from MW
* Rename setUpToolbar to setupToolbar

Change-Id: Ied519093723b76e6ed531e6188ee7848d4f0923c
Localisation updates from https://translatewiki.net.

Change-Id: I8eaee24dfb3f725b86edd72a01875dd81659291f
Merge "[BREAKING CHANGE] Make all focusable nodes clickable"
Merge "Revert "Fix shield CSS broken by Parsoid styles""
Revert "Fix shield CSS broken by Parsoid styles"

Parent Parsoid bug has been fixed.

This reverts commit 97edf35bbcf8b70f511688863493ff9cc5b8492d.

Change-Id: Id0b7653bd3a4a3da86987c76f5e795d486d71273
Merge "Remove margins from paragraphs inside table cells"
Merge "Trigger endRelocation on focusable drag end"
Trigger endRelocation on focusable drag end

It isn't usually called, but if it is onDocumentDrop might not fire,
(e.g. dropping back on itself) so call endRelocation here. It doesn't
matter if endRelocation is called twice.

Change-Id: I259fbfb0fe122c1bad7ea49fb7f5684821eca452
Merge "Fix shield CSS broken by Parsoid styles"
Fix shield CSS broken by Parsoid styles

Hack to be removed when bug: 66616 is fixed.

Change-Id: I6b35c66ddb0bbb112e711c405ea0a992784ac487
Create highlight elements on demand

Instead of guessing how many we will need then removing
them at position time if they are no longer visible.

Change-Id: I4b0b571997289426c4f7aac790adffc05198d2ba
[BREAKING CHANGE] Make all focusable nodes clickable

In practice anything with a primary command is also
clickable, so just merge the code.

Change-Id: I629d3da8d15ff1e70feadea01fac2a7a3f4748f5
Localisation updates from https://translatewiki.net.

Change-Id: I407ad707053511b1852f7ba911718d5d8be1f7be
Remove margins from paragraphs inside table cells

Bug: 65416
Change-Id: Ifd4aa46aa1f532ef364e2218a8ac8e18320f261e
Localisation updates from https://translatewiki.net.

Change-Id: I9cbdc54f66acd374208c40bbd339fd8489fa3734
Localisation updates from https://translatewiki.net.

Change-Id: I0be15b6d2745596340a842df552bfee5b2392167
Localisation updates from https://translatewiki.net.

Change-Id: I704af33bf8eeaa9b144e452e030fe8b9393268b0
Merge "Alien node styling"
Merge "Fix alien demo"
[BREAKING CHANGE] Move language functions to the platform

We now use language names in multiple places so we need a common
place where they can defined and overridden (e.g. MW can provide
localised language names from CLDR).

Change-Id: I52f2c31dd63d4e49dc4a1a6e66f5d5c01bc390ec
Alien node styling

Set highlight opacity on the $highlights group so it can be changed
for different highlights.

Give aliens the 50% focussed opacity when blurred, and a blue fill
when focussed.

Change-Id: I20c88c8545177f0a70ebc09aa54f845b14874038
Fix alien demo

mw:Alien no longer works in core, add ve:Alien.

Change-Id: Idfe9c678016b34c8514c469fcf11dc1199cf0e4f
Improved layout of language input widget

* Put 'Find language' in a layout
* Switch out text of button with autonym, give it a fixed
  width and ellipsis overflow for this purpose.
* Given button an indicator to show that it launches a
  select widget.

Change-Id: Icd1eae3a3006b1516f410c4000461ec66b33bcb1
Update OOjs UI to v0.1.0-pre (c5ae888f67)

New changes:
9eec766 Create 'next' and 'previous' indicators

Change-Id: I6fb6e1a121c66d26cd779f351392c0a3d5a140c6
Merge "Don't refocus the document in onModelSelect"
Rebuild .html files for ContextWidget addition

Change-Id: Ia3d2e75b7cc158b2474534e9ffa915a98ce6bec7
[BREAKING CHANGE] Update OOjs UI to v0.1.0-pre (9f4f250f88) for window process cleanup

* Change the timing of link inspector setup to work better with changes in
  window process
* Don't open link inspector suggestions on open anymore
* Use window isOpening() and isClosing() methods instead of tracking
  opening/closing status in WindowSet
* Remove fading effect in context menu
* Pre-calculate and use moving state for updating inspector with animation
  only when needed
* Increase inspector ready process delay to be just a little longer than
  the CSS transition, instead of 50 ms short of it
* Update use of closing/closed/opening/open events to use
  setup/ready/teardown events instead

New changes:
bf4ba74 Localisation updates from https://translatewiki.net.
a99acae Remove use of imaginary config option in OutlineControlsWidget
8db7499 Localisation updates from https://translatewiki.net.
7d7b9ce [BREAKING CHANGE] Window process cleanup

Bug: 66016
Change-Id: I2adcdcfb5b4435dfc77b6eadaa0481c8a1fb2699
Merge "Re-enable apply button in action dialog on close"
Re-enable apply button in action dialog on close

Instead of on push/pop pending, which allowed a double-click to double-apply.

Bug: 66389
Change-Id: I7612c2d956eaa635d6b97828fc2429ea7c2ea8f8
Merge "Special case for shielding of generated content wrappers"
toLowerCase language code when searching for autonym

User may (correctly) type 'en-GB' but autonym indexes on lower case.

Change-Id: I029f50f66a96a407a1102b19ed4cada9580eaa9a
Check language's direction rather than global direction in LanguageAnnotation description

We were showing things like "العربية (RTL)" even though Arabic's default direction is RTL.

Change-Id: I4c105fcc6dfb63bb12b05bc8b05b45fc419e6ada
Localisation updates from https://translatewiki.net.

Change-Id: If586eb6a74179ffa4805bbb687354dbe48c85e56
Merge "Make highlighting of context widget items less loud"
Make highlighting of context widget items less loud

Given that prior to switching to the context widget our only hover effect was a change in icon opacity, it seems safe to return to that, given the issues of the alternative.

Change-Id: I01fc44d4f9fd49d69a1fa797f38da72057cc791f
Centre callout on context menu for small focusable nodes

Now that we have long text in the context menu this looks better.

Change-Id: I9ae0850212e4e4c1e0be514543a362231d7577db
Special case for shielding of generated content wrappers

Only shield GC wrappers if they wrap content which can't be shielded,
i.e. text nodes or void nodes (childless nodes such as img or hr).

When we do skip GC wrappers, ensure all the child nodes are wrapped.

Add ve.isVoidElement in the same style as ve.isBlockElement.
Remove ve.isBlockElementType and replace with overloading of ve.isBlockElement.

Bug: 51933
Change-Id: I8a532b20c96dbca77a005aab2f98531365058107
Better measurement of focusable node for context menu

Measure the first visible shield instead of the $focusable
element to filter out zero-height wrappers.

Move all measurement functions to the focusable node for
consistency.

Change-Id: I837997618c46e9f780a22255cf97777b1a0da5a3
Don't refocus the document in onModelSelect

If the document needs to be focused it will already be. The extra
focus call can cause unnecessary scrolling.

Bug: 65882
Change-Id: I53963ccf903488a81e7965a12cdcc1cc35d50956
[BREAKING CHANGE] Merge RelocatableNode into FocusableNode

Because everything that is focusable should be relocatable.

Breaking change: RelocatableNode mixin no longer exists.

Change-Id: Ib51741e14619222b5b3e8f80ae542fbf69e58bb5
[BREAKING CHANGE] Merge ProtectedNode into FocusableNode

Because everything in VE is selectable and therefore focusable.

Bonus:
* Only render highlights with non-zero dimensions
* Wrap highlights in one div which takes the event handlers
* Move 'position' from UI to CE surface
* Emit 'position' instead of 'rerender' on a particular
  focus node after slug animation
* Emit 'position' on window resize (debounced by 50ms)
* Update context, redraw highlights and redraw size
  handles after 'position' event (Bug: 55789)
* Wrap plain image nodes in spans in CE so shields
  can be attached properly.

Breaking changes:
* ProtectedNode no longer exists
* 'position' emitted by CE instead of UI surface
* ce.Surface#replacePhantoms/Highlight replaced with
  #appendHighlights

Bug: 55789
Bug: 64563
Bug: 65616
Change-Id: I2ca68f120066edcfa00534948dd924c28ba0cd77
Localisation updates from https://translatewiki.net.

Change-Id: I399e1176abe5e564f9176c9398d445a3886a494a
Merge "Multi-surface fixes"
Merge "Cleanup target properties"
Merge "[BREAKING CHANGE] Remove $document cache from target"
Merge "Tighten up context menu items"
Merge "Update OOjs UI to v0.1.0-pre (99068355d6)"
Merge "Allow for the disabling of the MediaSizeWidget"
Tighten up context menu items

* Reduce vertical padding on context menu items
* Add some vertical padding to the menu

Change-Id: Ie6546ae0bc04ae899bc16778daa9a0a58282e287
Allow for the disabling of the MediaSizeWidget

Add a 'setDisabled' method for the MediaSizeWidget that disables
or enables the entire widget and sub-widgets.

Change-Id: Id1010798d30e2928358acb5694c429b9ab68ad57
Update OOjs UI to v0.1.0-pre (99068355d6)

New changes:
9906835 Make menu toolgroup take up less space and look more like a menu

Change-Id: I022b12fe0a239fbeda332fa4656088aa31354517
Merge "Reorganize initialization of default size in MediaSizeWidget"
Follow-up Ia2076a42: Mark getDescription() as @inheritable for Annotation, Node

Change-Id: I5c0fe88361629b5345cd028330098653d6926670
Use ContextWidget instead of toolbar inside context menu

First step in context rewrite, moving toward the context not just being a
toolbar, but also a description of what is currently selected, showing the
URL of a link, the file name of an image, the content of a reference, etc.

Changes:
* Add ContextWidget and ContextItemWidget classes
* Use ContextWidget instead of Toolbar within the context menu
* Retain the ContextWidget, only clear it's items (toolbar used to destroy each time)
* Simplify ToolFactory's getToolsForX methods into getToolsForFragment
* Add getSelectedModels to SurfaceFragment. which getToolsForFragment uses
* Handle additional cases where methods called on null fragments could cause errors
* Code cleanup in SurfaceFragment (whitespace and comments)
* Added methods to NodeFactory and AnnotationFactory to get the description of a model from a view
* Add initial descriptions for some CE nodes
* Make InspectorTool's onUpdateState handler use getSelectedModels
* Made desktop context's menu use a compensated size (since it's in the body)

Change-Id: Ia2076a4238288ca113103e9ffef8c06ff80a21a4
Update OOjs UI to v0.1.0-pre (15f4156bac)

New changes:
15f4156 Follow-up 2334482: actually clear items in clearItems()

Change-Id: I78e5896c5a835c16cce856bddc1abefb456068fb
Reorganize initialization of default size in MediaSizeWidget

Make sure that if the image has default size the media widget loads
properly with the placeholders; otherwise read the custom size and
mark as such.

Bug: 66149
Change-Id: Ia6bb041bfc050a48d8c40bbff4b73ed2893085e2
Update OOjs UI to v0.1.0

New changes:
371fcff Correct TextInputMenuWidget position for RTL
05467d3 Localisation updates from https://translatewiki.net.
2334482 GroupElement: Improve performance by avoiding .add() overhead

Change-Id: Ife8b1dc994070eff130cc0e4750a571d588149fa
Multi-surface fixes

* Don't ve.debounce the prototype function, otherwise deboucing
  occurs all instances, instead of per-instance.
* Check the range is from the right document in surface observer

Bonus: this.documentMousedownHandler is unnecessary duplication

Change-Id: I2f6837562182fd9cc498c25f57388a2e1e74690e
Localisation updates from https://translatewiki.net.

Change-Id: I5ba982d5ffb82c21d8f108cbb44d5e6b20e20778
Cleanup target properties

* Add getters for surface & toolbar
* Nullify references when destroying the target
* Removing caching of dmDoc in SA target
* Bonus: Remove unnecessary local target cache in demo

Change-Id: I954e32373b12f512a4a204f1fb9e91e105dc98ff
[BREAKING CHANGE] Remove $document cache from target

We have enough teardown issues without caching a jQuery selector
from 4 levels above. This would also be a pain to manage on a target
with multiple surfaces.

Also mostly being used for #focus which can be done more
properly with ce.Surface#focus.

Breaking change: targets no longer have a $document property,
use .surface.getDocument().getDocumentNode().$element instead
or .surface.getView().focus() for focussing.

Change-Id: I8d8047df9bf340003174a090ae280a34c1086179
Merge "Re-order special character mathematical symbols to be degrees, minutes, seconds"
Re-order special character mathematical symbols to be degrees, minutes, seconds

Rather than degrees, seconds, minutes.

Bug: 60626
Change-Id: I27524cdc9cc7fe366b794f1c3dc1cb7e620df3b5
Merge "Destroy old target before initialising new one in demo"
Localisation updates from https://translatewiki.net.

Change-Id: Ie8b92fdbc19056fbfbd334e5c3bbaf475e07b7af
Localisation updates from https://translatewiki.net.

Change-Id: I16aecde5b775f02c985f96ed784fc89a49b81a65
Destroy old target before initialising new one in demo

Change-Id: I51e06a96fe5ce65f08ebcc2c87f0a392db64fb95
*Actual* death and/or *actual* destruction

In Firefox, we were getting errors because surfaces and contexts
were responding to focus-related events on the window from beyond
the grave. This caused a JS error when closing VE from a dialog
(save dialog or confirm dialog) while a context was being shown,
and another JS error when opening another VE instance afterwards.

To prevent this from happening, make the destructors for these
classes actually destroy and unbind everything. Also move them
to be the first method below the constructor so it's easier
to compare the two, and break them up into sections, explaining
what each section does.

Added the following actions to each destructor:

ve.ce.Surface:
* Remove highlights div
* Detach eventSequencer
* Disconnect OOJS events
* Unbind focusin, focusout and mousedown events on document

ve.ui.DesktopContext:
* Disconnect OOJS events
* Unbind resize event on window
* Discard any deferred modelChange events (clear timeout)
* (why is the ui.Context destructor chainable?!?)

ve.ui.Surface:
* Call context destructor
* Disconnect OOJS events
* Remove lie about return value from (very overpromising) documentation

Bug: 66222
Change-Id: I7d2f2f28a70185bd638f23c9ba23a8221a9db2b8
Merge "Use this.$ where available"
[BREAKING CHANGE] Fix Node construction arguments

* Re-order the construction arguments of dm.Branch/LeafNodes
  so that the actually-used 'element' comes first.
* Fix various instances of incorrect documentation and remove
  duplication.
* Remove the 'length' argument from all LeafNodes except TextNode.

Future todo's:
* Remove the 'length' argument from TextNode (only used in tests)
* Remove the 'children' argument from BranchNode (only used in tests)

Change-Id: I81c60d4a40a39d65a57b18bd9c6bbc348825d4e2
Use this.$ where available

For consistency and to avoid performance hits when moving things
between documents.

Change-Id: I06de6f3f901268ca99a47428173391bea9863524
Merge "Calculate offset correctly in inline slugs"
Cleanup special character inspector CSS

Also make it wider and use its icon.

Change-Id: I593321fa39e60b25097e9e2b52e378fc61b7493e
Localisation updates from https://translatewiki.net.

Change-Id: I5f73b1493947548e06413528b3d1e3631c8b4330
Calculate offset correctly in inline slugs

The special case where we don't count text inside slugs was removed
in Ia1e4785e but not restored.

Change-Id: Ia1e4785e2c456a0391ff2af8af29ec5061f8d0b4
Merge "Inflict a gruesome death on ve.ce.getOffset() and reincarnate it"
Merge "Use this.$() in LanguageResultWidget#highlightQuery"
Inflict a gruesome death on ve.ce.getOffset() and reincarnate it

The old ve.ce.getOffset() code seemed to work but was labyrinthine and
incomprehensible. This is a rewrite from scratch that should be
easier to deal with.

Behavioral differences that the tests had to be changed for:
* The last cursor position no longer magically jumps over the internalList.
* Cursor positions inside of inline nodes now map to the offset inside
  the inline node, rather than the offset after it.

Change-Id: I324e42af4c87379ff2dee21e40b91fcf911f6769
Update OOjs UI to v0.1.0-pre (c9b9f8345d)

New changes:
c9b9f83 Allow programmatic selection of options while disabled

Change-Id: I16131011e757f0f29664ea971159d779ee03c5e0
Handle collapsed range properly in pushRemoval

ve.dm.Transaction.js
* For collapsed range, retain start data and return correct offset

Change-Id: Iceb286e6a33aa5fc451678158ab6433740991bd8
Use this.$() in LanguageResultWidget#highlightQuery

It might be more characters than $(), but it makes the code almost
thirty times faster: on my machine, running updateLabel() for a full
result (e.g on init) went from 1770ms to 63ms. This appears to be
because jQuery/Sizzle ends up going through some really slow code
paths when we append nodes from one document to a parent from
another document.

Made highlightQuery() an instance method instead of a static method
so this.$() is available. It wasn't overridden anywhere anyway.

Bug: 65512
Change-Id: Ib33249f3c2598b75fa1cc21fb6aefaf5755564fe
Merge "Only show debug bar when ve.debug is set"
Only show debug bar when ve.debug is set

Change-Id: Ie3da48a7ce9c66a96325e9494fc9b3ea0e570ba4
Update OOjs UI to v0.1.0-pre (cbc62ac803)

New changes:
47b147e [BREAKING CHANGE] Use promises for confirmation dialog instead of done event
bcbf56b Localisation updates from https://translatewiki.net.
997292b Localisation updates from https://translatewiki.net.

Change-Id: I913614c10485f87072cbe5f89e155004700bc8c5
Merge "Fix potential race condition with nulling out Dialog/Inspector fragment"
Merge "Apply 'default' or 'custom' size on load"
Fix potential race condition with nulling out Dialog/Inspector fragment

We can't set this.fragment = null; after calling the parent's close method,
because the closing operation may be asynchronous (that's why it returns
a promise!) and some of the deferred steps may use this.fragment.

Instead, null it out after the closing process has finished.

Change-Id: Icb5919616c33f4b769489b521e1a17f54a0b6649
Localisation updates from https://translatewiki.net.

Change-Id: Ic511e2a154f971259fb8bf548ed6d5ebe59d481d
Merge "Skip history#replaceState if not available"
Merge "Move comment down so DOCTYPE is on first line"
Skip history#replaceState if not available

For example, in IE9.

Change-Id: Ib1b29923dfb3aa8fee6c3890738f88b1552dce5b
Move comment down so DOCTYPE is on first line

DOCTYPE must be the first line otherwise, amongst other things, IE9
goes into Quirks Mode and dies (more) spectacularly.

Change-Id: I7d9fece71e2e07877ecb72e4265cf8ce9f287677
Grunt: Clean up

* Use jshintrc:true which lets grunt defer autodiscovery of the file
  to jshint instead of forcing it to '.jshintrc'. This allows us to
  override certain settings from a subdirectory, to match behaviour
  of standalone jshint.

* Sort modules.

* Use plain string instead of single-value array.

Change-Id: Ib5cd48f3ff0367b8fc84627c29e4fb32452087c0
Localisation updates from https://translatewiki.net.

Change-Id: I21155a10bf80377aa3c50bd53051f9ca4c59d4e8
Apply 'default' or 'custom' size on load

When loading the scalable object into the MediaSizeWidget we should
make sure that the process updates according to either custom size
or default size.

There was a bug where the size widget showed the dimensions of the
image with 'default' button clicked instead of making the dimension
inputs empty in the default case. This code fixes the issue.

Change-Id: I01f4d1a4d2eaa3f1685d4dcd525372b869076b5c
Update OOjs UI to v0.1.0-pre (6379e76bf5)

New changes:
f55ab55 Localisation updates from https://translatewiki.net.
6379e76 Followup 205fa98a, 8dd3460a: move away from isResolved()/isRejected()

Change-Id: I54e9109ff1927001cd2559f75e24b91e876f6cf6
Merge "Add a function to ElementLinearData to count all elements that aren't in internalList"
Add a function to ElementLinearData to count all elements that aren't in internalList

Needed to fix ve.ui.MWReferenceDialog.prototype.onDocumentTransact to work properly
with existing references.

Change-Id: I8ecbf387ac8dff02dc1fab8d41189edd6e9a8974
Merge "Update OOjs UI to v0.1.0-pre (527ad0ee5a)"
Localisation updates from https://translatewiki.net.

Change-Id: Ic44d600b3debab5e5b0bbc6a7015399eba28b168
Update OOjs UI to v0.1.0-pre (527ad0ee5a)

New changes:
50355d0 Localisation updates from https://translatewiki.net.
8dd3460 Resolve the opened promise after teardown
5153f85 Followup 205fa98a: fix incorrect use of .super

Change-Id: Id561fedb915ff94f7108b05c2e23513a390551f3
Localisation updates from https://translatewiki.net.

Change-Id: Ic74802ad7bc24c5fd1d6ba702ee3d04ea542b678
Localisation updates from https://translatewiki.net.

Change-Id: I89380bb90bb82dc9e89eec11efe0c31716d4df0b
[BREAKING CHANGE] Update OOjs UI to v0.1.0-pre (dd888aba5c)

Switch to using processes in windows (dialogs/inspectors).

Depends on I5f97185 in OOUI

New changes:
205fa98 [BREAKING CHANGE] Window refactor, introduction of Processes

Change-Id: Ib6a02ae4706df8ebb9330d794fcb1c5d0a084781
Update OOjs UI to v0.1.0-pre (0f101c6f5d)

New changes:
e86dae9 [BREAKING CHANGE] Emit a single event from confirmation dialog

Change-Id: I62baa48a5d0c064446c637009d37b6573c159f73
Merge "Update OOjs UI to v0.1.0-pre (469d40c88f)"
Merge "ActionDialog: Allow errors to be jQuery objects"
ActionDialog: Allow errors to be jQuery objects

Change-Id: Id17d150d7b2eed5f53e53beee94c34cbe1a9bbea
Update OOjs UI to v0.1.0-pre (469d40c88f)

New changes:
9af9116 Ignore SelectWidget mouseup events that started outside the widget
28a7ca8 Localisation updates from https://translatewiki.net.
469d40c Localisation updates from https://translatewiki.net.

Change-Id: I92446c6177ebe2c87821944175525f6f438cd2cb
Localisation updates from https://translatewiki.net.

Change-Id: Ice189ecf40b51abd2fe48af64e1b7ca346933d64
Localisation updates from https://translatewiki.net.

Change-Id: I62a98540a8a95baac9614bbd17388f97c09df3df
Merge "Optionally allow undo while staging"
Merge "Don't fix selection on document focus if focusedNode is set"
Merge "Remove last jQuery.browser uses with temporary ve.isMsie hack"
Remove last jQuery.browser uses with temporary ve.isMsie hack

Kick the last few cases where we detect IE into the long grass until
we can devote more time to IE support and fixing these issues.

Bug: 65404
Change-Id: Ifa6a45d12fae1690b63a874635a27ef7187e3723
Merge "Fallback options for receiving bad information into Scalable object"
Fallback options for receiving bad information into Scalable object

The Scalable object is updated with information from the API request
needed for original dimensions. Most of the code then checks whether
we have original dimensions before proceeding to use it.

However, when an API response returns invalid dimensions, the
dimensions object might be set to { width: undefined } which is then
processed as having dimensions object. Strictly speaking, however,
this is not a valid dimensions object and shouldn't be considered
as such.

This wrecked havoc on the calculations done with the aspect ratio,
and specifically the MediaSizeWidget's 'full size' and 'default'
buttons.

Changes made:
* Added a 'isDimensionsObjectValid' method to ve.dm.Scalable that
  tests dimension objects specifically to see if they are valid
  before update is done to any of the stored dimension values.
* Added originalSizeChange event to ve.dm.Scalable and a listener
  in ve.ui.MediaSizeWidget to make sure that the 'full size'
  and the 'default' buttons are only enabled when original
  dimensions are acquired, even if the API response is slow or was
  completed after the widget is already loaded.
* Fixed small typos in setDefaultDimensions in ve.dm.Scalable

Change-Id: I1242e8dadca4f2cf2737c366034a77edc5ce308e
Don't fix selection on document focus if focusedNode is set

Bug: 65866
Change-Id: Iff018d7809b6dfbb0bc831b4eb25607b4c724b76
Update OOjs UI to v0.1.0-pre (09b223d279)

New changes:
09b223d StackLayout: Clean up inconsistent event firing and documentation

Change-Id: I059c0bd4cc4efd599e61f9b2c70eec797c98f59f
Merge "Add createSurface to base target"
Localisation updates from https://translatewiki.net.

Change-Id: I9e9089aa0de2369af87966d9962974d03e8b374e
Merge "Update OOjs UI to v0.1.0-pre (7b283a9dcc)"
Update OOjs UI to v0.1.0-pre (7b283a9dcc)

New changes:
71d9671 Add more Agora dialogs styling
457a0ef Localisation updates from https://translatewiki.net.
c92ba96 Compute directionality for frame correctly
f3414b8 Localisation updates from https://translatewiki.net.
90fbb6f Localisation updates from https://translatewiki.net.
1d4d52a Localisation updates from https://translatewiki.net.
08d1c7b Add ability to put a header at the top of a toolGroup pop-up

Change-Id: I450b2177b6cff6198c6c7d9d231118d7ed70cc50
Convert toolbar structure group from bar to list

Change-Id: I84a4d948aeca995d32cd78840ce153f1d18adb2f
Merge "Dump raster support; turned out to be un-useful in practice"
Localisation updates from https://translatewiki.net.

Change-Id: Ib0bbc656a5815efb59fa97fe53d2f23f50709636
Localisation updates from https://translatewiki.net.

Change-Id: Ie04d568b676c07a0e7c4574888195228325f516e
Localisation updates from https://translatewiki.net.

Change-Id: I5f3a3b16a284eb3c355f31499bdcba19d46d7779
Optionally allow undo while staging

Change-Id: I93afcc0937d59c0367a36aa9a27b2e3fd27da6d8
Move DesktopContext.css into desktop module

Change-Id: I62e19d64b017db98b643daf755540dd706834986
Add createSurface to base target

Also override in SA target to create Desktop/MobileTarget.

Use this method in SurfaceWidget to create the correct surface.
for the current target.

Bug: 65642
Change-Id: I555935d2a9991d9d5d65f42d876e4a693ab871ad
Merge "Truncate undo stack before applying staged changes"
Merge "Remove IE check (and possible compatibility) from beforepaste/paste event switch"
Remove IE check (and possible compatibility) from beforepaste/paste event switch

Testing whether `beforepaste` is still needed for MSIE9+ is filed as bug 65714.

Bug: 65404
Change-Id: Iff8c4cb97d9c4e0823dd6694dcf9b5ae2a4e011b
Truncate undo stack before applying staged changes

Otherwise you have a messed up history stack.
Also set selectionBefore when empty to prevent it being null.

Change-Id: I2c0e35602a338d640ff32a873893b6052c966b5f
Merge "Register target globally"
Register target globally

Change-Id: I468d4eb4532c989f3efb855e8ba6d6f243afaa81
Merge "Add check icon for Apply button in ActionDialog"
Merge ".unbind() -> .off()"
Merge "Document that SurfaceFragment#getSelectedNode doesn't require selection"
Merge "Followup 682b4d0b88: bring this.isSetup back"
Document that SurfaceFragment#getSelectedNode doesn't require selection

Change-Id: Idaf20bb2a556c813154f86d9ca68d1e0e5f6a702
.unbind() -> .off()

Because .unbind() stopped being cool when jQuery 1.7 came out in 2011.

Change-Id: I55b260087104b680341810cb878c6d5003fdd163
Followup 682b4d0b88: bring this.isSetup back

682b4d0b88 removed the only line of code in ve.ce.ProtectedNode
that set this.isSetup to true. Consequently, it was always false,
and onProtectedTeardown would always short-circuit, so no ProtectedNode
would ever get torn down, which resulted in the expected chaos
of JS errors from event handlers that were never unbound.

Change-Id: Icc1748fd5acab4d97e80c88c3336e9d42b70e7ad
Localisation updates from https://translatewiki.net.

Change-Id: I50642081aebd7475b603e5eeb2ce8ae89ecc0785
Dump raster support; turned out to be un-useful in practice

Change-Id: Idb26804576b6a16a047ff30ca0740d9e2f0399b2
Add check icon for Apply button in ActionDialog

Required for Agora theme where the label is hidden.
Hide it on desktop to maintain previous appearance.

Change-Id: Ia0eccec08c5b6c221a8bcea2fedf0c7b0fb62652
Merge "Always cover inserted content in SurfaceFragment#insertContent"
Always cover inserted content in SurfaceFragment#insertContent

Even when fixupInsertion() moves the insertion point and normal translation
would result in a zero-length range at the originally requested insertion point.

Change-Id: I8c75c875caad48f28c3da3fe7cee395365c8814a
Merge "Add SVG to image demo"
Add SVG to image demo

Because testing, and it looks cooler.

Change-Id: I59bc54a704d089e07a44a1200d6b72fee9b3fc9d
Localisation updates from https://translatewiki.net.

Change-Id: Id8637133acc1e2724d2af306f7ef36c52675158a
Update OOjs UI to v0.1.0-pre (0436296667)

New changes:
a5086f2 test: Drop 'OO.ui' file prefix in test suites
03ed3e9 Support strings in FlaggableElement#setFlags
be7b458 ConfirmationDialog: Clean up setup() documentation
b9ae654 build: Enable jscs "requireSpacesInsideArrayBrackets" rule
0436296 Localisation updates from https://translatewiki.net.

Change-Id: Ibc9e1db4970147212779e386e99e069cea4eb4c8
Merge "Make $window a property of ce.Surface"
Merge "Phantom optimisations, episode II"
Make $window a property of ce.Surface

Used in multiple places so better just to cache on construction.

Change-Id: Ic98eb654956675707dc05d71b95c776d93d44257
Move DesktopSurface and DesktopContext to visualEditor.desktop

They should not be in core because visualEditor.mobile doesn't need
them.

Change-Id: I759af811bda05844a957cc24999c0b3932ab43d8
Phantom optimisations, episode II

Defer the building of phantoms until the first mouseenter event.

This should completely eliminate the load time problems with
complex pages on mobile.

Change-Id: I728a0f966de42e1b0cb0796effb95acff2196e50
Localisation updates from https://translatewiki.net.

Change-Id: I094e17602bc4f74401aaa99962cd5fc9f4fb3b3b
Update OOjs UI to v0.1.0-pre (0fbf6bd14e)

New changes:
ab5ebc6 Localisation updates from https://translatewiki.net.
39a1496 Make flags on buttons in confirmation dialog configurable

Change-Id: I15c0bf1855359ca32d07bf364dae93ab6e7cd469
Localisation updates from https://translatewiki.net.

Change-Id: Ic14336b57f76f8075e67c2cfb02e1c283216956d
Merge "Phantom optimisations"
Update OOjs UI to v0.1.0-pre (521a9e242b)

New changes:
1429076 Upgrade jQuery from 1.8.2 to 1.11.1
f14c3b2 Localisation updates from https://translatewiki.net.
8612e00 Localisation updates from https://translatewiki.net.
521a9e2 Window: Apply display:none after initialize, not before

Change-Id: I565c056252b831639d8ea91e71ee2b1f4617b06c
Localisation updates from https://translatewiki.net.

Change-Id: I6e671d405dc33f21e8c615c7b744f2102778b8e1
Localisation updates from https://translatewiki.net.

Change-Id: Ib7a89dd1642e2026b4f8aafd99239dabcf5eba78
Phantom optimisations

* Only compute .css('float') once other checks have been
  completed. This saves at least one call per node.
* Pre-compute .css('float') for comparison against 'float'
  and ''. This halves the total number of calls.

Change-Id: Ia33e861e1b83b72a1433001ef98d73d8a294faf7
Update OOjs UI to v0.1.0-pre (d4086ff6e6)

New changes:
a635ace build: Update jscs config
fd23e56 Localisation updates from https://translatewiki.net.
f5e6413 PanelLayout: Remove call to getDir()

Change-Id: I377fd459e88ca02186057fbd28fb4545db401b25
Localisation updates from https://translatewiki.net.

Change-Id: I17142ab9de3a6462c6d7ae27607e467ccf61e7f1
Merge "Remove Firefox cursoring hack"
Merge "Add test files to dependency tree"
Merge "Separate demo into mobile demo and desktop demo"
Merge "Pass HTMLDocument to convertToData"
Pass HTMLDocument to convertToData

Change-Id: Ia7db42b7727b8ca16ae837b2f7c2aa56fb17576e
build: Update jscs and grunt-watch

Continue specifying our coding style more accurately, and keep
following upstream refactoring that fixes bugs. This release is
mainly about getting rid of the unsable "sticky" operator sniffer
which has been deprecated in favour of using other rules instead
that are able to enforce this more accurately.

* requireSpacesInConditionalExpression: Enable.
* disallowSpaceBeforeBinaryOperators: Enable for commas.
* requireSpaceBeforeBinaryOperators: Add assignment operator.
* requireSpaceAfterBinaryOperators: Add assignment operator.

* disallowLeftStickedOperators: Remove deprecated rule.
  - Ternary covered by requireSpacesInConditionalExpression.
  - Rest covered by requireSpace{Before,After}BinaryOperators.

* requireLeftStickedOperators: Remove deprecated rule.
  - Comma covered by disallowSpaceBeforeBinaryOperators.

* requireRightStickedOperators: Remove deprecated rule.
  - Logical not (!) covered by disallowSpaceAfterPrefixUnaryOperators.

Update grunt-contrib-watch to latest upstream version.
Change log at https://github.com/gruntjs/grunt-contrib-watch/blob/v0.6.1/CHANGELOG#L1-L17

Re-order qunit tests so that unicodejs runs first. This makes
sense since we depend on it. If it contains errors, we want it
to abort after the unicodejs test fails, never running VE tests.
Whereas currently it would stop after a random failure in VE,
and never run the unicodejs tests.

Change-Id: Ifa1a1662e882a2d3d1b6e44991bb677ccfe6e3d8
Add test files to dependency tree

Change-Id: I03d70b76f48c09f5e41593b403809f8b5c041f9c
Separate demo into mobile demo and desktop demo

Change-Id: I957880e1866c9b2a02ff07d22009ef21116a28ef
Merge "inheritdoc lowercase"
Merge "Update OOjs UI to v0.1.0-pre (80f1797a5c)"
Update OOjs UI to v0.1.0-pre (80f1797a5c)

New changes:
9e4d2c6 Remove @abstract from classes which can be instantiated
0b43fbe Button accessibility
f61558d Add confirmation dialog
f52f1f2 Localisation updates from https://translatewiki.net.
d6849d5 build: Update jscs and jshint config
d0a5670 ConfirmationDialog clean up
513cb9d Auto-hide menus by default

Local change:
Register OOUI confirmation dialog with windowFactory

Bug: 50955
Change-Id: I38f5bb63a125bbab1617cb8b419c4ef0339f6168
Merge "build: Simplify building of module dependency list"
Localisation updates from https://translatewiki.net.

Change-Id: I1551b4568bfa28a069a2efee2d686823eb88107f
Merge "Fix desktop dialogs"
Merge "Load dependencies in correct order"
build: Simplify building of module dependency list

Change-Id: I598534c329178a182690a10009ac5c20718807df
Merge "Create phantom/shield nodes with methods not templates"
inheritdoc lowercase

Change-Id: I0067638881358e44ecda3b136892285e041cd27a
Load dependencies in correct order

Pre-concating the dependencies loads them in reverse order.

Change-Id: I676137204c20e6833008ec028cc9773f5a33edf2
Create phantom/shield nodes with methods not templates

Templates have the following problems:
* Static, so don't have access to this.*, hence the
  importNode hack.
* Run on file node, so potential load order issues
  with things like ve.msg.

Change-Id: Ia7f6a2b7ac10b111bcd7245aa96c8ec9bfb183fb
Use message function and correct message key

Fixes I48ff51af9.

Change-Id: Id6febe80a8a09f6b311a10a9e7a42573832388b4
Merge "build: [BREAKING CHANGE] Add dependency expression"
build: [BREAKING CHANGE] Add dependency expression

The main immediate effect of this is to remove the mobile-specific items
from the current built targets, all of which are intended to be desktop-
only. Later we can add mobile-specific build targets, but that is not to
be done trivially.

Change-Id: I9e888c87bd1fa6629c7481f1f3339ad25df61cbb
Localisation updates from https://translatewiki.net.

Change-Id: Ic4e7de9af9c3d79b11654bb18a86910374102f96
Fix desktop dialogs

Mobile specific classes weren't mobile specific.

Fixes I22d2ad941.

Change-Id: Ia2478f83c5930b843d48a5ef5c83c575a1155463
Localisation updates from https://translatewiki.net.

Change-Id: I7a87e7323a42ecc329e19202108d1207aff17885
Localisation updates from https://translatewiki.net.

Change-Id: Ibc37d832bf6bf266d11553928179c0b95116d853
Merge "Fix missing i18n for 'auto' language label"
Fix missing i18n for 'auto' language label

Tsk.

Change-Id: I48ff51af9325203f72462dc77358e6e303508fc9
Add HTML conversion button to SA demo

Change-Id: Ia440f610b858597b4bc3cb66197c470e8f12fd98
Remove Firefox cursoring hack

Firstly !msie !== Firefox, and secondly removing this code
gives the expected behaviour mentioned in the original bug (48289)
and matches Chrome's behaviour.

Change-Id: Idfce5134c312dd1b9f45608dcaefc0810749e375
Merge "Remove ve.ce.Surface#getClickCount"
Remove IE nbsp hack

Zero width spaces work in IE9 and above:
http://jsfiddle.net/edg2s/bCELm/2/

Change-Id: Ia415324a3fec47afd240614eda1d15aef16d5103
Remove ve.ce.Surface#getClickCount

1. It used deprecated $.browser.msie
2. IE9 supports event.detail

Change-Id: I9b87c51d231c3db6f04d0c914932b161deeaa355
Update OOjs UI to v0.1.0-pre (7b3672591f)

New changes:
5556abf demo: Make demo console more generic
142bd44 Dialog demos
6f65873 demo/widgets: Bring dev console back
32055e9 Minor refactor of widgets demo
d6b80e7 Watch dot files
7b36725 Localisation updates from https://translatewiki.net.

Change-Id: I8df89fd9404dfc443ec454958855e9c476241b8a
unicodejs: Add tests for hebrew letters in moveBreakOffset

Follow up to I3a99c7c54

Change-Id: I3e62691b5c654ecbe57a34f85f548961e69aab9a
Merge "Directionality fixes in SA demo"
Merge "Updating scalable default in MediaSizeWidget"
Merge "DebugBar tidy up"
DebugBar tidy up

* Remove validate view/model. Not very useful anymore and
  doesn't work with inline slugs.
* Shorter messages for SurfaceWidgets
* Disable 'Log range' when range is collapsed.

Change-Id: I186cbd6f8bc1c01695f1f71cee9759c654c5a692
Merge "unicodejs: Update moveBreakOffset to include 'HebrewLetter' category"
Merge "Special case for deleting the entire document"
Special case for deleting the entire document

As CTRL+A selects from 0 to data.length in FF, create a
special case that replaces the document with an empty
paragraph.

Bug: 64917
Change-Id: Ib48ef2ee5c49780fceadd4da234940930325eeef
Localisation updates from https://translatewiki.net.

Change-Id: Ic6be570db08a0b04ae4711f73406b1336cd3e8cd
Merge "Cache references in handleDelete"
Localisation updates from https://translatewiki.net.

Change-Id: Idfad2557a466fd2db05fd739f6548221e6cc9f9c
Directionality fixes in SA demo

* css('dir') was being removed after slideDown and not restored
* Pass directionality to dm document
* Add rtl.html demo which defaults to rtl

Change-Id: I14507e06672fe9373e624718c187ca79eb23680c
Fix watch list

Change-Id: I3e07d48f56fb29f0ac36fd7935c98af3576d8988
Merge "Fix Dialog support on mobile"
Fix Dialog support on mobile

* Set overflow: hidden on html and body, like when we open an inspector,
  to avoid vertical scrollbar.
* Animate the global overlay instead of mobile context (reuse sliding
  animation for Dialogs).

Change-Id: I22d2ad941d5e15af2a3abcf1b80ef96887c1ed8b
Localisation updates from https://translatewiki.net.

Change-Id: I9d7ef07d67a4f44cb35ed40773555830d1955287
unicodejs: Update moveBreakOffset to include 'HebrewLetter' category

Follow up to I7a4729d0 where we upgrade to Unicode 6.3 with the new
'HebrewLetter' category but which wasn't added to our custom word break
cursoring implementation.

Bug: 64872
Change-Id: I3a99c7c54318e98ada5a6f632a0eda1cc3af1b73
Cache references in handleDelete

Change-Id: I0f682f275ec9464940d5936dfbde28fa22a2a695
Updating scalable default in MediaSizeWidget

Updating defaults when scalable is attached to media size widget.
This makes sure the defaults are loaded initially; they will change
later by the scalable default change event.

h/t Roan for figuring this out.

Change-Id: Ie45419a9f88694484d072dbc28d451fdc0ba06c1
Update OOjs UI to v0.1.0-pre (7d2507b267)

New changes:
9ccab2d Use .isDisabled() instead of .disabled to support inheriting
8f2a439 Localisation updates from https://translatewiki.net.
5f49c04 Remove unnecessary space in footless dialog
11dde77 Make autoFocus default to true

Change-Id: I55c3f1da805b26f5d97ffd9aa0c69f4ab655cfe5
Fix command help for CTRL+1-6 on mac

Also simplify definitions where mac & pc are the same.

Bug: 64771
Change-Id: Ib18503bf1bcf64be3e7833ade0005f54c80e0de7
Localisation updates from https://translatewiki.net.

Change-Id: If1a0eb84278a4eac72a422c56f4a6cf83a7376b9
generateDocs.sh: Simplify

* Make more like mediawiki-core's mwjsduckgen.
  - Use bash set -e to have the script abort early when any
    part of it fails (especially the jsduck command).
  - Since it will abort early, we don't need to save the exitcode
    in a variable and return it again.
  - Don't "cd" into anything from the script, simply pass jsduck
    absolute paths instead.

Change-Id: I4bb25e004cac63b81428431b57513655f671376e
Localisation updates from https://translatewiki.net.

Change-Id: I9ee5c266afb261cbfb9e570885c0384b2e40c28f
Localisation updates from https://translatewiki.net.

Change-Id: I1d73e95531a36a4b29812fc9657cb4d40180000d
Merge "Update OOjs UI to v0.1.0-pre (9a6c625f5f)"
Localisation updates from https://translatewiki.net.

Change-Id: I85c887f075923a68df66cd45356b10152f48a85f
Update OOjs UI to v0.1.0-pre (9a6c625f5f)

New changes:
9a6c625 Fix regression in frame style scoping

Change-Id: I1f6da1382a94835ab7c2af2a27b14aa048aa1caa
Merge "Update OOjs UI to v0.1.0-pre (e6edd86d37)"
Localisation updates from https://translatewiki.net.

Change-Id: I154ad350329ac4919e2ba6ed2fef0a5b7e61cde9
Update OOjs UI to v0.1.0-pre (e6edd86d37)

New changes:
e1c2ae8 [BREAKING CHANGE] Cleanup widget focus/select/clear methods

Local changes to adapt LanguageSearchDialog and LinkInspector.

Change-Id: Ibe44f41e867e47af848493b4fcf68d0ded728892
Merge "[BREAKING CHANGE] Show matched string in LanguageSearchWidget results"
Update OOjs UI to v0.1.0-pre (301887f487)

New changes:
d641133 Add Agora theme dialogs

Change-Id: Ia6f31ba690f99cd724f56450d824da9b623a7bdc
Remove '*' selector for protected nodes

Add a 'shielded' class to nodes we actually shield and
select on that instead.

Bug: 52499
Change-Id: I208d8a3277da5237684a863dec90f03e7c92d59d
[BREAKING CHANGE] Show matched string in LanguageSearchWidget results

If the language is matched on something other than name, that
is shown on the right hand side, and in either case the matching
substring is emboldened.

Breaking change:
* Introduces new LanguageResultWidget class

Change-Id: I6e0e67ce8da8fdb8a480a7bf2bce557e7b4e0ff1
Update OOjs UI to v0.1.0-pre (bdbb9cfa55)

New changes:
471a8ca Rename intro.js and outro.js to have .txt extensions
250b0eb Localisation updates from https://translatewiki.net.
1eed712 [BREAKING CHANGE] Return promise instead of taking callback argument
92b5be9 Add getLookupMenu method to LookupInputWidget mixin

Change-Id: Ic17ca323b99dcb3bc6a70a54b7aaef41389ef5b9
Localisation updates from https://translatewiki.net.

Change-Id: Ic4b2edaccf88757ed4083faa4ad368a8a4636c2b
ve.ce.Surface: Remove font-size: 1em;

In the MediaWiki integration we want the surface to look the same
as in read mode. For that, it we would apply the same class (e.g.
mw-body-content). However, that class assumes its font-size in em
size to be relative to #content. It doesn't have to be a direct
child of #content (the extra nestings Surface adds are fine), but
our contains between #content and surface must not change the
font-size as that will affect the font-size of the content.

Change-Id: Ibcee8e6ee8356fa6c2575dd6203c5d1e3ea78e63
Update OOjs UI to v0.1.0-pre (70f1886a35)

New changes:
c486e35 Add info icon and alert indicator
5928259 Add a 'ready' event to the window open sequence
d2f1933 Improve info and alert icons/indicators
6d78021 Defer window 'ready' event to let rendering happen
7705a94 Add focus method to SearchWidget
70f1886 Improve alert and required indicators

Change-Id: I58ae4c8154d45b34e2dcd404a5d8c3c9bbffd32f
Localisation updates from https://translatewiki.net.

Change-Id: I7de0dc053d905ea3e3ce0052728ee3b1b89dff14
Merge "Remove surface blur hack now that windows take focus properly"
Merge "Use window 'ready' event"
docs: Remove JSDuck 4 options

The --meta-tags or --tags is already added by generate.sh.
It being in config.json as well makes JSDuck 5 throw for passing
an invalid option.

While at it, remove the JSDuck 4 case handling alltogether.

Change-Id: I2e1e89408328c614a89f6c4e408df90d1e346d76
Remove surface blur hack now that windows take focus properly

Depends on I5786458 in OOUI.

Change-Id: I403a1bb9b7271bf2e3e9f4535c1ecec84138e084
Use window 'ready' event

Depends on I5786458 in OOUI.

Change-Id: Iaf3e38c1ed48d7342b7ef39e12984e716ad64db4
Always fix up selection after ce.Surface#focus

Otherwise we get a broken selection in surface widgets. The bug which
this.focusing was introduced to fix has been fixed elsewhere.

Bug: 64399
Change-Id: Ie996812ccd6166f6cc348985271d720c9c484fa5
Localisation updates from https://translatewiki.net.

Change-Id: Id23ee81ce6e5bf8d0cc266b1388019c03d66f9b2
Update OOjs UI to v0.1.0-pre (b91660e612)

New changes:
db345e1 Add text config option to OO.ui.Element
47e272a Add aggregate method
beaa3be Localisation updates from https://translatewiki.net.
32fef8b Follow-up I0eddaaed91: Fix mistake in class name
62df7aa Followup 32fef8b5ee247: actually fix event aggregation, unbreak toolgroup disabling
e3a09eb Element: Make onDOMEvent fix focusout in addition to focusin
cc33eb6 InputWidget: DOM property is 'readOnly', not 'readonly'
59e9a07 Localisation updates from https://translatewiki.net.
c7109be build: Update jscs config and phase out deprecated jshint config
58c2862 Localisation updates from https://translatewiki.net.

Change-Id: I522dc397d95ec6bc7c849ea38ef77a1a2aa90ddd
Merge "Add ActionDialog and NodeDialog"
Add ActionDialog and NodeDialog

New base classes that provide common dialog functionality

ActionDialog
* Async-friendly apply changes process
* Apply button with label method, asserted at setup
* Default size, asserted at setup
* Error display, triggered by rejecting the deferred object returned by apply changes process

NodeDialog
* Generic selectedNode property management

Depends on Ibbec2ed in OOJS-UI

Change-Id: I70e88f673172604b7d6195ca8ce1f990021659ac
Localisation updates from https://translatewiki.net.

Change-Id: Ic2d34fa8ca59a4f91f47c1a699ebcc8071e9ef88
Localisation updates from https://translatewiki.net.

Change-Id: I0724295bd3f66abbe3fb1c9483720f960570d374
Merge "Only focus the surface on inspector close if range is not null"
Merge "Check for focus change on global mousedown"
Only focus the surface on inspector close if range is not null

Change-Id: Ibdaac8dfb44bd5d1159237f52ef2aab0c9b26eb3
Merge "Prevent focussing of the pasteTarget with tabIndex=-1"
Check for focus change on global mousedown

If the document is blurred (but still has a selection) it is
possible to clear the selection by clicking elsewhere without
triggering a focus or blur event, so listen to mousedown globally.

As we always check for a valid selection to trigger documentFocus/Blur
events it doesn't matter than many of these mousedowns aren't required.

Change-Id: Ic44e0f8efdca72a0ba4c5140d26cac909acaecaf
Merge "[BREAKING CHANGE] Simplify updateState params"
Merge "Move toolbar updateState code into separate method"
Merge "Clear the focusedNode when the document is blurred"
Merge "Comment onDOMEvent hack"
Clear the focusedNode when the document is blurred

Bug: 64451
Change-Id: I648b5364778f38e242268bdca8135836e19b07ba
[BREAKING CHANGE] Simplify updateState params

Replace full/partial annotations and nodes with fragment and
let the tool compute them as needed.

Add caching to SurfaceFragment#getLeafNodes now that it may
be called multiple times as selectNodes is expensive.

Also pass through directionality in case the tool wants to know.

Marked as breaking change for the API change to updateState but
shouldn't break MW.

Change-Id: I8ac9802f776d914c78c36b41a0f000484e9fabf0
Move toolbar updateState code into separate method

So that it can be called on intialize without a contextChange.

Change-Id: I2a3fa78b07dadd31963ff716339da5f7b75ff157
Localisation updates from https://translatewiki.net.

Change-Id: I7e738f1a31f5bda055eae426e927907299e7d25d
Prevent focussing of the pasteTarget with tabIndex=-1

We don't want people ending up in the hidden pasteTarget by
tabbing off the end of the document.

Change-Id: Ie38ce6a6f4604ddb036a1ffa35d24f6f0d0026f6
Comment onDOMEvent hack

Change-Id: I3e247858d6c6436d8ec775b20b48d20f8fe70fb1
Localisation updates from https://translatewiki.net.

Change-Id: I69f0878214ac12602a61a161d0c7d26e867c45cc
Re-render selection after deleting

This was already being done in most cases for some reason, except in
cases where two paragraphs were being merged.

Also fix documentation of ve.ce.Surface#focus to not state the opposite
of the actual behavior.

Bug: 64338
Change-Id: I841825e1be8149f5013170f86b82cc19cbc045c2
Merge "Language search widget"
Language search widget

Create a new Dialog for language search based on jquery.uls.data.

Change-Id: I21a9d7e4488f80ef59e3b3e9f5a711527fe48783
Update OOjs UI to v0.1.0-pre (0a7180f468)

New changes:
0a7180f Scope frame CSS to not affect child frames

Change-Id: I9da04aa07ffae0159bfa7bd0d5fe37f23dbc4f9a
Update OOjs UI to v0.1.0-pre (497baca586)

New changes:
6eed7c7 Add demo of auto-disabling toolgroup
8f066a6 Localisation updates from https://translatewiki.net.
58021ec Add clearFlags method to FlaggableElement

Change-Id: I770e4d2fbd8f768c49574fbc55db318ee59d0714
Merge "Look for comparable annotations when toggling"
Merge "Merge b/strong and i/em annotations"
Merge "Prevent SurfaceWidgets from focussing themselves"
Merge "Add debug bars to surface widgets"
Localisation updates from https://translatewiki.net.

Change-Id: I7943ee2a2b4e5c6521ab1d4a2503734250a045ee
Prevent SurfaceWidgets from focussing themselves

Bug: 63909
Change-Id: I45537ba813bc177667de75463e4e53e19378d3e3
Add debug bars to surface widgets

Change-Id: Ic0fff2e65c76562f986a6bc6f0a34f2d594d462b
Update built html files

Change-Id: Ied44643e0557a45fc9ce93d322f47fc66e6d4c21
Look for comparable annotations when toggling

* Add tests for AnnotationSet comparable methods
* Add test case for newFromAnnotation
* Add AnnotationAction tests

Bug: 64244
Change-Id: I1868130b2cba5d23b06a6ce57d2cc6db85fe986b
Merge b/strong and i/em annotations

Like we do with code/tt.

Change-Id: I4ad83c727b6abefdec915bd8f24331b3841cb3d8
Localisation updates from https://translatewiki.net.

Change-Id: I6378ca37a949b363d9b358d972c8f9ea9fbfc659
Merge "Prevent annotation inspector from updating selection if using DesktopContext#hide"
Prevent annotation inspector from updating selection if using DesktopContext#hide

Otherwise the user closing the inspector by clicking away from the inspector
doesn't leave the selection where the user clicked.

Bug: 63906
Change-Id: Ieeb205db1512f612dbf4f7d3effbd3ad75d41c6e
Merge "[BREAKING CHANGE] Merge dialog and inspector actions into window actions"
Fix path to spinner in ve.ui.SpecialCharacterInspector.css

Change-Id: I421b023c58996bb1ef6768ace998d2437e01621b
Localisation updates from https://translatewiki.net.

Change-Id: I5df63d5ed7530790376b51f7963bc7ef3e9dcb68
Update OOjs UI to v0.1.0-pre (d4baf57069)

New changes:
351db20 Localisation updates from https://translatewiki.net.
1a21253 Set up jsduck
d492a0f Revert "Add aggregate method"

Change-Id: I450ee1616e1aacdec38397a0b9ad2156e1868df5
Merge "Remove unnecessary overflow:hidden from block slug style"
Merge "Add focusing state flag to ce.Surface when programatically focusing"
Localisation updates from https://translatewiki.net.

Change-Id: Ieb6044bbd1b4ba28a7d6fe65416564e9d055c814
[BREAKING CHANGE] Merge dialog and inspector actions into window actions

This allows tools to use a generic name for either a dialog or an
inspector and different setups (desktop vs. mobile) can use different
implementations.

Change-Id: I762e57c685b16c8ec5a6116d28ea96de14b38be3
Merge "Add forgotten OOjs UI i18n files"
Add forgotten OOjs UI i18n files

Generated with update-oojs-ui.sh script of Id97a66df64, by-passing
the "No changes, already at version X" guard.

Change-Id: I325045b11e668e7f51edacba06945e68740e566b
update-oojs-ui.sh: Replace target dir instead of adding file copies

* A command like "cp dist/* $TARGET_DIR" does not remove files
  that were deleted in the release dist. Using rsync instead.

* Use bash -n or -z instead of "" and "x$VAR" == "x" tricks.

* The "git commit <dir>" doesn't properly take care of staging
  deletion of files removed by the update script, nor does it
  reliably (?) stage new files.
  Instead using a combination of "git add -u <dir>" (The -u
  stages deletion and modifcation of tracked files), and
  "git add <dir>" (stages modification and creation of files in
  that directory).

* Use "grunt test" instead of "grunt <default>" to make more
  explicit what is going on (no change in behaviour, default=test).
  And document why we don't use plain grunt-build without tests.

Change-Id: Id97a66df64d9e43e3c05388486b9f959108363c1
oojs-update.sh: Update to match version of script in mediawiki-core

See Ieb20978c8 in mediawiki-core.

Change-Id: I75ae843c352fe4c45dd5b7f8acf4c8dc2d8a5147
Remove unnecessary overflow:hidden from block slug style

Works around a browser bug in Chrome which results in the bullet
being hidden (https://code.google.com/p/chromium/issues/detail?id=365024).

Bug: 64117
Change-Id: Ia48011d9562f05dac4ffe7d7b434b068492aa0d0
Merge "Reorganize stylesheets"
Reorganize stylesheets

Match JS directory structures.

Change-Id: I20efce510dbbad872a9ae8febe3f4e763779ad29
Update OOjs UI to v0.1.0-pre (989950a4db)

New changes:
ff327f2 Localisation updates from https://translatewiki.net.
21bbbdb Add getCurrentItem method
ca0e453 Remove animation of grid layout inside booklets
b1c75fa Add aggregate method
df59f32 Add push/pop pending to Dialog
21c6d92 Make dialog overlays... overlaid?
989950a Localisation updates from https://translatewiki.net.

Change-Id: I8f123a74a445ae0a0158b2d93e874f20e75baaad
Localisation updates from https://translatewiki.net.

Change-Id: I46be36ea83f7e55cddd5fa65b9f8a5a4825c3923
Add focusing state flag to ce.Surface when programatically focusing

Such a focus should not trigger the content offset fix-up logic.

Bug: 64041
Change-Id: Iecc5e7f69cc74c4693efc6e95d2d89f22c289021
Merge "Tests for ce.Surface#getNearestCorrectOffset"
Merge "Clear inspector fragment from teardown(), not close()"
Tests for ce.Surface#getNearestCorrectOffset

Change-Id: I0acabc427fe28ffa77a15c62b284524496b2caaa
Localisation updates from https://translatewiki.net.

Change-Id: I6453498cd7148bba1c090a6c3c3891234d30880a
Clear inspector fragment from teardown(), not close()

close() has a recursion guard and in fact often does recurse,
if the inspector's teardown function causes a selection change.
Unconditionally clearing the fragment in this case will cause
the fragment to be null halfway through the teardown function,
leading to very weird JS errors.

Instead, clear the fragment from the end of teardown(), at which
point the subclass's code has already run its course. ve.ui.Dialog
already does this.

The only reason this doesn't currently break things is because we
have no inspectors that access the fragment after changing the
selection.

Change-Id: Ie97e5b2ef17b56ba4c4a77733e4bd3a5a32f1b71
Update OOjs UI to v0.1.0-pre (9d291a9222)

New changes:
b0a3738 Localisation updates from https://translatewiki.net.
722ad64 Followup 099f26ec: fix $content in FieldsetLayout
0a75f92 Check for left click and disabled state on ButtonedElements

Change-Id: If784929c4373be659f4c444c6352f900d21af41f
Merge "Call stopHistoryTracking() when destroying ui.Surface"
Call stopHistoryTracking() when destroying ui.Surface

Otherwise history tracking timeout keeps firing forever and the dm.Surface
never gets garbage collected.

We should really put start/stopHistoryTracking in initialize/destroy methods
in dm.Surface.

Change-Id: I8cb09f16d82a2717254a09e3b0df45477e115b5c
Restore call to dm.Surface#startHistoryTracking removed in I9f8b840c

Change-Id: Icbd02e1493e90d10550b8d334dcae06dea904c2c
[BREAKING CHANGE] Separate Widget styles properly

Creates new CSS file, fixed in MW by I84c1a3576b.

Change-Id: I6ceb3d97d1b8537db69a65a99496a721375ed2cb
Merge "Document focus/blur cleanup"
Document focus/blur cleanup

* Rename documentOn* to onDocument*.
* Document how these events are triggered.
* Pass through the jQuery event in case they want to use
  it in the future.

Change-Id: I01e40d83afe45307f43b10cffd223c9e293b0580
Merge "Fix initial selection when focusing in Firefox"
Fix initial selection when focusing in Firefox

* Move the code which fixes the selection to the first content offset
  to documentOnFocus, from ui.surface#initialize.
* Take the mouse events out of the event sequencers as 1. they don't need
  to be there and 2. the event sequencer is detached on blur, so mousedown
  wouldn't fire on focus.
* Set the initial dm selection to null so it notices a change to 1,1
* Kill dm.Surface#purgeHistory as it's never used and doesn't answer
  the question of what happens to the selection.
* Update various tests which assumed the surface initialised with a range.

Bug: 63943
Change-Id: I9f8b840ce185ef71760000d275eb9474879c077e
Merge "Only hide popups on selection change"
Only hide popups on selection change

Hiding on attribute change would prevent us having inspectors
which live-update their nodes.

Change-Id: If1250402f266772c3db1317d880a603068e70ba4
Merge "Add system to dm.Surface for staging changes"
Merge "[BREAKING CHANGE] Refactor history state methods to better suit uses"
Add system to dm.Surface for staging changes

Pushing to the staging state stack causes all transactions
to be stored in a list at the top of the stack. Popping the stack
undoes those transactions and returns them. Applying
moves the transactions down the stack or into the undo stack.

Change-Id: I607d37591eb3e239a59047be0472627d48d267b1
Merge "Localisation updates from https://translatewiki.net."
Localisation updates from https://translatewiki.net.

Change-Id: I96b63a8dd3082461c7e646957cc1aa0683da1248
Update OOjs UI to v0.1.0-pre (c58b498573)

New changes:
4bf6a2e Buttons return false on mouse down
c0eeb38 Only blur inputs within booklet pages when moving away
099f26e Make fieldset layouts render correctly

Change-Id: I657bb2073b892d3d8702d76fb476701d6085cdfd
Merge "Allow the context to close any open inspector"
Clear the surface observer when blurring

Otherwise it won't detect the cursor being restored to the exact
same place.

Change-Id: Ida027ba7bbb2eda9119ba4e00a2296c591f81627
Merge "Don't call select on a fragment if it's null"
Don't call select on a fragment if it's null

Bug: 63954
Change-Id: Ib0bb4c8548bd35c71dd1677af8548c2d66e71402
Allow the context to close any open inspector

Change-Id: I83883183117732033a8f99822d698ca18bc6f53d
Merge "Use document direction when a fragment has a null range"
[BREAKING CHANGE] Refactor history state methods to better suit uses

canUndo/Redo now check for disabled state (for use by history buttons)
and add a hasBeenModified method (for use by save buttons).

Change-Id: If7d7a3ea110b67d57375c20e57bd776ff03c40ad
Use document direction when a fragment has a null range

Bug: 63945
Change-Id: Ic856376bbee06cd8d20b0016653185b1dd288606
Debounce ce.Surface#onFocusChange

Change of focus can fire multiple blur and focus events but
we only need to compute the focus state once per cycle.

Change-Id: Ib27e9966d043866478fc459f579b08d4b55b125f
Update OOjs UI to v0.1.0-pre (8197f2cd2e)

New changes:
8197f2c Fix WindowSet#getCurrentWindow documentation

Change-Id: I058fb5a6a157771ab0ec97ad93c781c1b84c26f5
Merge "Add .focus() to SurfaceWidget"
Merge "Update OOjs UI to v0.1.0-pre (eba79af989)"
Code style typos

Change-Id: I485c9fedf32e6ff63fb885e76c20ec6cbb5b72ea
Add .focus() to SurfaceWidget

Change-Id: I5b63077eb744195d4d1509544d5eee5b5d6bb0fc
Update OOjs UI to v0.1.0-pre (eba79af989)

New changes:
036b066 Make demos point to symlinks to /dist and /lib for doc publishing needs
eba79af Followup d7cbc785a: focus iframe content div before open event

Change-Id: I100c02a7531c995556059d5c7b776f300307329b
Re-apply "Make the DOM hash ignore text node splitting"

This reverts commit 52437882d7a96e85942359c01fff92042f0cb469 and reinstates commit Ia04f7195ef6.

Change-Id: I42ff221d5a8f87f888a722f6e0bec48592286b20
Revert "Make the DOM hash ignore text node splitting"

Turns out to be very broken, causes out-of-order character
insertion while typing.

This reverts commit 32b7f47f1cc1c9bf0c021573c6a32a16d40b2ac1.

Change-Id: I71c6d8f380dea4c6b208bc97d5caeac73d377a54
Make the DOM hash ignore text node splitting

Chromium splits text nodes on cursoring. This should not be signalled as a
content change to the DM; therefore the DOM hash should not change.

ve.ce.js
* getDomHash: use a single '#' for any number of adjacent text nodes

Change-Id: Ia04f7195ef62ff35a1bc1da6f0c7b40bbcc3ae2c
Merge "Event sequencer cleanup"
Prevent pasteTarget selection while already selected

onModelSelect is used to restore focusable node selections when a
dialog is closed, but the logical refactoring to do this was overly
generous in that this.focusedNode was allowed to clear, and the
pasteTarget was re-focused, emitting extra unhelpful events.

Change-Id: I466a64364fa5c38f177354b28ebfad02fb9df1a0
Create ve#contains

A slightly more useful version of jQuery#contains.

Change-Id: I7ed4eef7e1f5ad38e1d31939d04dd411855166a2
Event sequencer cleanup

* Make most methods chainable
* Allow Function or Function[] as param in certain places
* Rename badly named variables

Change-Id: Ib0bb2713baa321707264664899449b9995e88baf
Merge "Fix typo in ve.dm.Scalable"
Detect document focus properly and allow null selection in model

The document is considered to be focused when it or its pasteTarget
has a native range. When it doesn't, the DM selection should be null.

Uses OO.ui.Element.onDOMEvent introduced in OOjs UI in 851fc18a.

(Second attempt after premature merge.)

Bug: 59868
Change-Id: I56ee6b1b00d22d2e68d4a4b032b4c9263599e730
Update OOjs UI to v0.1.0-pre (eca1fc20e7)

New changes:
d8cdf4d ButtonedElement: Use tabIndex property and "tabindex" attribute
004e9fe doc: Clean up (remove redundant @method and minor fixes)
f7c3dfb Fix styling of list tool group label when disabled
851fc18 Make OO.ui.Element.onDOMEvent/offDOMEvent static
d7cbc78 Prevent iframe windows from wiping parent document selection
eca1fc2 Fix jsduck errors

Change-Id: Ib98e42e3af9339b60ce81a9a797c152cc4ce93de
Fix typo in ve.dm.Scalable

this.dimensions should actually be this.defaultDimensions.

Change-Id: I4c4e71c936c989c5f8d78940316112ad8188ba1b
Followup 7e39f497: call parent method in DialogTool so disabling works

Change-Id: I0e0bf698dadbb5735d269bb0630759f8a0b69aa5
Merge "Put CommandHelpDialog keyboard shortcuts in kbd not div elements"
Put CommandHelpDialog keyboard shortcuts in kbd not div elements

Because they are.

Bug: 63767
Change-Id: I50494add8906d16cb8dbfd29c35d66f3d01f07a1
Update OOjs UI to v0.1.0-pre (729c7bbe31)

New changes:
729c7bb Removing zh-(cn|hk|tw) i18n files, per TWN policy change

Change-Id: I8489a7da79196945185355d688ea164f1ef02914
Merge "Remove zh-[hk|tw] in favour of zh-han[s|t]"
Remove zh-[hk|tw] in favour of zh-han[s|t]

Change-Id: I89a285f405d32a5170e5b8be4f4e3a46b5ef5df6
Merge "Exclude insertions in ve.dm.SurfaceFragment#isolateAndUnwrap"
Merge "Add excludeInsertion property to SurfaceFragment"
Merge "Add excludeInsertion to translateRange()"
Merge "Clean up lots of minor things in SurfaceFragment"
Exclude insertions in ve.dm.SurfaceFragment#isolateAndUnwrap

In cases where the separators we insert are adjacent to the range
we're isolating, we don't want the range to grow to include these
separators, as that breaks the subsequent unwrap.

This range growth doesn't usually happen, because the typical situation is:
[</list><list>]<li>|<p>Foo</p>|</li>[</list><list>]
(i.e. the list is being split but the listItem is not), but it's possible to get:
[</list><list>]<li>|<p>Foo</p>|[</li></list><list><li>]<list><li>...
when converting a list item that contains a nested list, in which case the
listItem does get split.

Bug: 63209
Change-Id: Iec3fecccf5d4ad545164f36ee73b7285f29c0e55
Add excludeInsertion property to SurfaceFragment

If set to true, this causes automatic range translations to exclude insertions.
This mode can be enabled and disabled using a setter, just like noAutoSelect.

Change-Id: I2e9b1b97e10c12fa8471f0d77dda17458ac65591
Add excludeInsertion to translateRange()

This allow us to deviate from the default behavior of including an
insertion that occurred on the range's boundaries.

excludeInsertion=false would translate Foo|Bar|Baz to Foo|BarNew|Baz

excludeInsertion=true would translate Foo|Bar|Baz to Foo|Bar|NewBaz

Change-Id: I592d0025e58e81698a00699c9fa69c4fe31e60bc
Clean up lots of minor things in SurfaceFragment

* Use isNull() to check for null fragments
** Update isNull() to check for !this.range
*** We were previously checking for !this.surface, but this.surface && !this.range is also possible
** Add null handling where missing
** Return a clone rather than this for null fragments in methods that return a new fragment
* Move willAutoSelect() and setAutoSelect() to a reasonable place and near each other
* Add clone() and implement methods that return new fragments using clone()
** This reduces the duplication of constructor parameters
* Break out range translation into getTranslatedRange()
** Use this in update()
* Add a change() method that calls surface.change() and autoselects if needed
** Use this to eliminate lots of !this.noAutoSelect && tx.translateRange duplication
** Get rid of lots of local tx variables that are no longer needed
* Document that getSurface()/getDocument()/getRange() can return null

Change-Id: Icb0c497290fa26db94f53fc859c08e37f99aee15
Merge "Clean up ve.dm.SurfaceFragment#isolateAndUnwrap a bit"
Merge "Fix ve.dm.SurfaceFragment#getSelectedNode"
Merge "Convert language name to lower case when looking for i18n file"
Fix ve.dm.SurfaceFragment#getSelectedNode

Because selectNodes() sometimes returns an array of two items:
the selected node, and a zero-length range in the text node after it.

This would result in getSelectedNode() not recognizing the selected
node, which caused a nasty bug: if you inserted a citation, then
tried to inspect it, the dialog would open in creation mode
and insert a new citation instead.

Change-Id: I9a5ba2c63aa5a9eb682d36e0d0c61428cef5e322
Merge "[BREAKING CHANGE] Pass fragments, not surfaces, to windows (reprise)"
Update OOjs UI to v0.1.0-pre (ac6848398c)

New changes:
dbfade7 Localisation updates from https://translatewiki.net.
b541846 Remove grey background from disabled MenuToolgrop in apex
1367d62 Localisation updates from https://translatewiki.net.
0e4427d Make field labels appear disabled in sync with the field
ac68483 Get rid of useless comments for classes

Change-Id: I6837dd0bb647fc0d4349a6c9919e27a8a41f0b8c
Merge "Refactor Scalable functionality"
Refactor Scalable functionality

This commit transforms Scalable into a calculation engine that is
delivered by objects with dimensions. The Scalable object is responsible
for all calculations and adjustments that relate to the dimensions
of a given object.

As a result, everything that relates to size calculation has been
touched.

On top of that, MediaSizeWidget has been adjusted to work with
Scalable objects and also display the dimensions through the
dimensions widget.

This is a breaking change, fixed in MW by change
I017a017924f544cc8bc9b7d8245335759ae0e890

Change-Id: Ie7ca3bbbe5d0287c7ce17d296c1827b8213ea950
Convert language name to lower case when looking for i18n file

i18n files use lower case names even though variants are usually
written in upper case (e.g. zh-HK -> zh-hk.json)

Change-Id: Iaa646f02b3dd3c61a80c3dd4f38d1cabda2f8478
Prevent context flashing on window resize

Change-Id: I422da46293e283c0b57d062cca225fc891c379da
Fix covering annotations logic

The previous code was only working in some cases by a combination
of state variables not being reset and good luck.

The new logic clears and re-applies a annotation iff:
* the initial annotation was non-covering
* OR the initial annotation was null
* OR the initial annotation is not comparable to the current annotation

Bug: 63386
Change-Id: Idd5cce0715acf61d8d39fd9180cf54ee5715d9bd
[BREAKING CHANGE] Pass fragments, not surfaces, to windows (reprise)

This re-instates commit 7203025af78.

Change-Id: Iff779f3f40d86b9a40f2a2a5fc276571f53797c1
Update OOjs UI to v0.1.0-pre (70932872ba)

New changes:
c93cd2b Use new OO#initClass method for base classes
967ea78 Switch over to grunt-banana-checker now that it's a real boy
4975b8d [BREAKING CHANGE] Death to initializeSelection
7093287 Don't assume selection is of an item, sometimes it's null

Change-Id: Id75ff64eed7baca4e9c2fdcd13fe987584fcf5b2
Merge "Revert "'The great ' + getRandom(classList) + ' rewrite of ' + new Date().getFullYear();""
Revert "'The great ' + getRandom(classList) + ' rewrite of ' + new Date().getFullYear();"

Temporarily reverting for dependency hell reasons. Will reintroduce soon.

This reverts commit 7203025af78dd42bffd3345d5270c1f0e7a91b80.

Change-Id: I303dba9d13a1b296e9316d903d5192d7dfe62daa
Localisation updates from https://translatewiki.net.

Change-Id: If55a165f97ca7c82d71ee613a2a8ac7980815f92
'The great ' + getRandom(classList) + ' rewrite of ' + new Date().getFullYear();

> getRandom(classList);
> ['ve.ui.Dialog', 've.ui.Inspector']

* Don't pass surfaces to windows, just fragments when they are opened
  Windows should only be interested in the model. The also need to know
  the range that existed when the dialog was opened as it will be cleared
  when the parent surface is blurred.

* Also pass content directionality from the view because RTL is evil

* Add getSelectedNode to SurfaceFragment as windows may need to know
  which node was 'focussed' when the dialog was opened.

Change-Id: Idd78bf9e4d50635b707bacce06f6c14babcf33a8
Use #isContentOffset instead of slug detection for word expansion

Because slug detection requires talking to the view, which is evil
(and soon-to-be impossible).

Change-Id: I5583452573a13d87f2865a2a6716384939059c5f
Set content directionality on the model

Currently we set it on the view then poll it from there using .css
which is evil. We can set this information on the model then have
the view apply the appropriate CSS.

Change-Id: I2065e17020dc89964b1040ddc4f8d11f9b742d24
Listen to close events on window sets to give focus back to the surface

Eventually the window set won't know about its surface.

Change-Id: Ia2bdf65e6c8ff70829d0b0cbb403a203be832e7e
Merge "Use new banana checker as a linter to avoid lacking qqq messages"
Merge "Re-sync generated files output from `grunt`"
Localisation updates from https://translatewiki.net.

Change-Id: Ia9597e3fdfe0a5eb4067bfca92b768f2ab6da7e6
Re-sync generated files output from `grunt`

Change-Id: I51b79d9ecfc534aed879775cf084fd20b6bfae9d
Use new banana checker as a linter to avoid lacking qqq messages

Change-Id: I0b11654b7e16e2f8473d21c6a0dcadab9dff158f
Merge "Apply annotations to partially annotated selections"
Debug bar fixes

* Show range on load
* Rename variables
* Show hash of annotations

Change-Id: Idbfb3ed67a20590b69a0ddeb21749c6e6eff5a70
Apply annotations to partially annotated selections

If the initial selection includes un-annotated data we should record
this so we can apply the annotation to the whole fragment, even if
it doesn't change.

Bug: 63386
Change-Id: Iae5e9de2260eccc494519a83766ed5342134351a
grunt: Run grunt-build as part of grunt-test and grunt-watch

Especially the latter is nice, but might as well run it as part
of test.

Change-Id: Icb95fca372866e1a23fb0ead2eb59584d71cc88f
Merge "Fix debug bar margins"
Merge "Inspectors should only hide on blur if the selection has been cleared"
Inspectors should only hide on blur if the selection has been cleared

This is currently impossible, but soon will not be.

Change-Id: Idb5db1dcc4ff8c56da6dd515706ac95cf863515c
Clean up ve.dm.SurfaceFragment#isolateAndUnwrap a bit

* Move tx variable into inner function
* Merge startOffsetChange and endOffsetChange into adjustment

Change-Id: I0f684ed11f89c067c9a20cd2c4eaf6b4aa50b8c7
Update OOjs UI to v0.1.0-pre (98570355f6)

New changes:
9857035 [BREAKING CHANGE] Fix some intialize -> initialize typos

Despite the breaking nature of the change, no local changes in VE-core.

Change-Id: Icffea33c8a09f59f3b89f005b954ad043bb358bd
Fix debug bar margins

Change-Id: I056ed657b7bcf344cc371cecfd98f17ac455c317
Update OOjs UI to v0.1.0-pre (eaa1b7f06d)

New changes:
468b1c8 Localisation updates from https://translatewiki.net.
3e2a5e1 Update OOjs to v1.0.9
eaa1b7f Add pressed state to option widgets and use instead of initializing items

Change-Id: I16eb3b4560c83e42c2d2c8922ff79f0492153fb0
Merge "Update OOjs to v1.0.9"
Merge "Separate out debug bar for use outside the demo"
Separate out debug bar for use outside the demo

Also add a destroy event so other targets know when to hide
the debug bar.

Change-Id: Ide1487250ee6c92ccf968784d429cd43ffe283f9
Merge "Restore selection after ListAction too"
Restore selection after ListAction too

Follows up on 4305ccbf. As its commit message said, IndentationAction
doesn't need this, but ListAction does need it for whatever reason.

Bug: 63154
Change-Id: I2e56cdd70986104b42f2844b9aabfa8089c3ef69
Update OOjs to v1.0.9

New changes:
9dbf1b8 EventEmitter: Improve test coverage for disconnect()
829e0c8 readme: Use HiDPI version of npm badge
7758735 Bump jscs to 0.4.1
39d37e0 Add OO#initClass method for initializing static in base classes
b5f4657 Tag v1.0.9

Change-Id: I151b752fd942a89fc7c66f1a71e073d09766d361
Minor documentation fixes

Change-Id: Id5ead1145a82e763bdb3763084e43694517088fd
Merge "Make getToolsForNode place primary commands first"
Merge "Make tools use commands"
Merge "Revert "Fix handlesOwnChildren check in getRelativeOffset""
Revert "Fix handlesOwnChildren check in getRelativeOffset"

Breaks ve.ce.Document.getRelativeRange tests in VE-MW

This reverts commit d6316f560ea65cd9451406b8d5b5124fe97c5d42.

Change-Id: Ibb06be60d330654669e69852814477fc91cedee7
Make getToolsForNode place primary commands first

Use command name matching between available tools and a node's primary
command (if set) to prioritize the primary command ahead of all others.

Change-Id: I7dd98804fc72b2ca198b01cf07f2acf131af67cb
Make tools use commands

* ve.ui.Tool provides an onSelect method that executes a command
* All tools should execute a command by name rather than re-implement the
  command execution from scratch
* Some things, like list style toggling, must be moved to actions
* Generalize "sticky" effect of tools to a static deactivateOnSelect
  property, which is true by default (and easier to understand)

Change-Id: I556a05a2744454f626c7992223f40172b4aba82e
Merge "Revert "Detect document focus properly and allow null selection in model""
Revert "Detect document focus properly and allow null selection in model"

Caused lots of bugs with null selections being dereferenced
and insertion of nodes by dialogs failing because the selection
is null when closing the dialog.

This reverts commit c3a2a8544c3621c5e1a1fca1214988fc2b79e1b6.

Change-Id: If91d059f2c7f1ee91759b3c7f4cef75433911601
Revert "Improve hasFocus check to compare the anchorNode to the parent"

This reverts commit ef6096aeca87deb47245f605ead141f10838d098.

Change-Id: I9d62a8411af578562b3bcbda85d53a9465e2baf5
Improve hasFocus check to compare the anchorNode to the parent

$.contains only checks if you are a child of the parent, we also need
to check if you are the parent as that happens when you select a
focusable node (anchorNode === pasteTarget).

Change-Id: Ib4b532b9cb5906be7d7cfb75f2c91d84e610760c
Merge "Skip over handlesOwnChildren nodes in newFromAnnotation"
Skip over handlesOwnChildren nodes in newFromAnnotation

Bug: 60804
Change-Id: I07bcfc47ac70996ca57cc186aaad0b7d24a9b17e
Merge "Update OOjs UI to v0.1.0-pre (8986c46d35)"
Merge "Emit event when insertion annotations change"
Merge "Adjust loop counters in word break detection when removing item"
Adjust loop counters in word break detection when removing item

Bug: 63333
Change-Id: Ie00e7f8eb5ce41b19f0df9977eee2916d6761b93
Support null ranges in the demo debug bar

The debug bar assumes ranges are never null. This also causes problems
with the 'Get range' button as pressing it blurs the document. To avoid
this just enable range logging onSelect all the time as it's pretty
useful and not very expensive (unlike 'Dump model').

Change-Id: I0a23bb7fb25b4259ee6ecf4b1b118c2974ee0b74
Update OOjs UI to v0.1.0-pre (8986c46d35)

New changes:
735cebc Filter calls to selectItem and highlightItem on SelectWidget
897b30f Return null in Element#getDocument
b5ede88 Add Element#isElementAttached
68df19f Disable tool groups when all its tools are disabled
1aaa507 Grunt-watch less files
e4dd7b2 build: Update devDependencies
64d6c32 Localisation updates from https://translatewiki.net.
b5c6db5 Localisation updates from https://translatewiki.net.
b9460cb apex/button: Reset border-color of disabled button when not hovered
32c4799 Localisation updates from https://translatewiki.net.
674165e Enable jscs for OOjs UI repo
d98b338 grunt: Add messageDocumentation task to ensure each 'en' message has a 'qqq'
d421dd6 demos/tools: Indentation fix

Change-Id: I47132b3bf41889b0c76e192c6c11ff9ab22896b4
Emit event when insertion annotations change

This will be needed for changes in pawning.

Change-Id: Ice8ab8eb1c24c45612c95f4b46985b8dab35c19e
Merge "Disable certain tools when surface has no range"
Disable certain tools when surface has no range

Change-Id: Ia44b093ed89f8a9782d7ca782ad00cbb4eafacc8
Merge "Detect document focus properly and allow null selection in model"
Merge "Bump jscs to 0.4.1"
Merge "Introduce ve.ui.Tool"
Bump jscs to 0.4.1

Change-Id: I256804cc181d941ea406c9cc5eb486ca3e71787c
Localisation updates from https://translatewiki.net.

Change-Id: Id5849ec511aed3c8e9862ccba05901b7954385fc
Style link inspector on mobile

Make sure that the global overlay is hidden only after the animation
finishes.

Change-Id: I32d94337a95db9a492b0c06015b482ec21176867
Merge "Fix handlesOwnChildren check in getRelativeOffset"
Fix handlesOwnChildren check in getRelativeOffset

We need to keep track of depth, not just a boolean state as handlesOwnChildren
nodes can be nested (e.g. an image caption in an internal list).

Also add test for basic handlesOwnChildren case.

Bug: 63208
Change-Id: I8055dfd87bbe9743482c089662c764cb1a969281
Localisation updates from https://translatewiki.net.

Change-Id: I40a3e40880ba776119e2b74160eba357fb30e717
Merge "Show VE demo error in VE"
Show VE demo error in VE

Saves us having to worry about how to style and transition the error message.

Change-Id: Ibbeb45dff457d82f91f068fd2d32e433a94d6a21
Actually use getRelative[Content|Structural]Offset wrappers

Change-Id: I53bc39632c3042dc2b404562d6b6346020b69561
Localisation updates from https://translatewiki.net.

Change-Id: Ia25e9268b908bdf200e25a18436700f7ac9a0264
Detect document focus properly and allow null selection in model

The document is considered to be focused when it or its pasteTarget
has a native range. When it doesn't, the DM selection should be null.

Bug: 59868
Change-Id: I130dd0790fe07d47ffe92c1451c43ff92415b2e3
Introduce ve.ui.Tool

So that we can provide ve-specific tool behaviour.

Change-Id: I4c1ab151d815b03394f82f8646c86743ee59b743
Merge "Localisation updates from https://translatewiki.net."
Localisation updates from https://translatewiki.net.

Change-Id: Ie667e2c9c89413709ab5eeb95c5f11b498209deb
Split-up theme-specific styles

Change-Id: I48c19640a287f443f07dfac926240851bc2d85d0
Update OOjs UI to v0.1.0-pre (23fb1b6144)

New changes:
41e01ca Add documentation explaining what's going on in GroupWidget
de8cd1d intro/outro: Keep local reference to OO inside closure
8bc207e Localisation updates from https://translatewiki.net.
5e1422e [BREAKING CHANGE] Use registry for tool group types
5d3ac51 Basic toolbar demo
ad53af5 Styling for disabled toolgroups
3529d6f Force visible label for MenuToolGroups

Local changes:
* Use new ToolGroupFactory

Change-Id: I65dded2d58bdca328190aef4a96bfcc7e5a6b3b0
Localisation updates from https://translatewiki.net.

Change-Id: I3c21e2d7461e7cb8752b6bcb8e3af9910f010767
Fix ClickableNode documentation comment to add a missing period

Change-Id: Ia349a5f20254e4a012ce0c26b26e2e632889e0a4
Update OOjs UI to v0.1.0-pre (e9e435be5e)

New changes:
e9e435b Move padding rules for OutlineItemWidget from core to skins.

Change-Id: I3216be2f26d2d452d2857b4545d9530e3dce4675
Update OOjs UI to v0.1.0-pre (e697490c9b)

New changes:
2889665 Fixes bug where InlineMenuWidget would "steal" DOM labels on selection
997e1a6 Increase width of toggle switch widget
2240802 Use less variable for travel distance
62efbdf Add disabled styling to InlineMenuWidget
93182d2 Promote zIndex of InlineMenuWidget options list
fc7143b Fix padding on icon in TextInputWidget
c9b6234 Add display: block; property to labelElement to make the text-overflow: ellipsis work correctly
e697490 Don't use transitions for opacity on hover for now

Change-Id: I8cac6e1cc2aca7c336f3ef145f39e126d051ec63
Use DOMParser in ve.createDocumentFromHtml() if available

This speeds up the tests significantly, at least in User Agents
that support DOMParser:

VE core tests in Chrome 33: 12.5s -> 5.2s
VE-MW tests in Chrome 33: 32.9s -> 20.0s
VE core tests in PhantomJS: unchanged at 9.4s (no DOMParser support)

Bug: 57586
Change-Id: Ie41cd0458e1814576fc91486208d4c81eef4b514
Merge "Protect against invalid/absent <base> in ve.resolveUrl()"
Merge "Add a <base> to every test document by default"
Protect against invalid/absent <base> in ve.resolveUrl()

If the document has no <base> and has nowhere to inherit a base URI from
(this is the case for documents created with real document creation functions
rather than the iframe trick), things like node.href will return empty string (!!)
if the href is relative. This is crazy, so detect this case and return the
original value instead.

Change-Id: If1dd4421d1eb0e73e3b86821f4e0aa5a82c851a2
Add a <base> to every test document by default

Use <base href="http://example.org"> if not specified.

Change-Id: Ifd90ad68a66a0e0ec1f76a707fbe37698771730d
Localisation updates from https://translatewiki.net.

Change-Id: I564deec36e8494c97c57d8f37cc32eb0bb88903a
Merge "Fix copyright year range for one file not updated to 2011-2014"
Merge "Add <base> for relative URLs in tests"
Update OOjs UI to v0.1.0-pre (1c7875205a)

New changes:
a14026f Move some styles to the Apex theme
9df7af9 Add basic styling for Agora theme
deefcf3 Localisation updates from https://translatewiki.net.
1c78752 Add initially enabled ToggleButtonWidget to demo

Local changes:
* Change local update script so that it also copies oojs-ui-agora.css.

Change-Id: Ica3db3d8786595ac650a2575307aefe96b2bc282
Localisation updates from https://translatewiki.net.

Change-Id: I30c5da1596a8db12c3885af894e6e3c08b1e8cc9
Add <base> for relative URLs in tests

Change-Id: Id20117cbec5097a83d564d26e693faef9b339871
Fix copyright year range for one file not updated to 2011-2014

Change-Id: I9f791d82a6e8fdb9da888a453dd671a2fc167c90
Update OOjs UI to v0.1.0-pre (3db4b6974d)

New changes:
4f4fc2c Localisation updates from https://translatewiki.net.
ea88cce Localisation updates from https://translatewiki.net.
37af34f Add the ability to clear the SearchWidget
1cd4b32 Make PopupWidget clippable.
81f2edc Localisation updates from https://translatewiki.net.
fa6e8e5 Make popup toolgroup labels a little closer to their icons

Change-Id: Ia463428610854ebace378399dfc9b853b6c8de93
Shut up warnings about calling cloneNode() with no parameters

The default value of the parameter is changing, so Firefox warns
when you call cloneNode() with no parameters. Instead, explicitly
call cloneNode( false ).

https://developer.mozilla.org/en-US/docs/Web/API/Node.cloneNode

Change-Id: I817dff372727641c2ff2beda68f7327cb9a8ac19
Localisation updates from https://translatewiki.net.

Change-Id: I8a246f2da8023d88ee832da21e15f319fb28fc86
Merge "Fix typo in documentation"
Fix typo in documentation

Change-Id: Ief67028a676865a530200e20f219c3c6ae91b01e
Localisation updates from https://translatewiki.net.

Change-Id: I955a4c1230ba897cd6c67804adc8a7686c458b01
Localisation updates from https://translatewiki.net.

Change-Id: Ie2d417f3871ee9641e90d49934aa552f12970327
Split up omnibus CSS files into per-item ones

Change-Id: Ifed261f9ac6e61712df18c828d4d8cb100e13a8f
Fix left-over autoAdd property that didn't get fixed with Idaf3041

Change-Id: I022f731fc3dc1d5c9b4df55fcbe1f6ff8b45d131
Merge "build: Clean up repo split left overs in Gruntfile"
Merge "Fix invalid use of border shorthand syntax"
Merge "Remove border-radius prefixes"
build: Clean up repo split left overs in Gruntfile

* Merge the two patterns in the jshint.all setting.
* Remove hardcoded 'modules/ve' in csslint.all setting,
  just use ** (like in jshint.all).
* Remove reference to inexistent 'modules/ve-mw'.

Change-Id: I4be2844ae8a743d28f843733fe3e7c42dc005a2f
Fix invalid use of border shorthand syntax

The shorthand syntax is:
 <border-width> || <border-style> || <color>

https://developer.mozilla.org/en-US/docs/Web/CSS/border#Syntax

Some browsers tolerate shorthand values in the wrong order if
they can find certain keywords (like "solid"), but that doesn't
make it right.

Change-Id: Ia244a50704d0f70e249766bb63c416019c27f821
Remove border-radius prefixes

We've already done this in OOjs UI and MediaWiki core

http://caniuse.com/border-radius:
* IE 9+ | FF 4+ | Chrome 5+ | Opera 10.5+ | Safari 5+

Using prefixes would get us FF 2 and Chrome 4 which we don't
support (even MediaWiki doesn't). Older IE, Opera and Safari
never had prefixed versions.

Change-Id: I52f987ddcef7f10ee678520bfc23b84bd03f9236
Update OOjs UI to v0.1.0-pre (3b434d5388)

New changes:
076b85e Split autoAdd into catchall and group specific settings

Change-Id: Idaf3041dc5fb40623b80e79b919a811d74b2e9ca
Use transaction comparison to decide to render or not

The previous approach has issues, mostly to do with this.getRoot()
returning null when a one-off node is created and not attached to a
surface. This uses a simpler (previously unworkable) approach which
doesn't depend on a reference to surface being available.

Change-Id: I4d1377950b72ffbc190c2b8cee8175e19674e34a
Merge "Propagate destroy calls down to children of branch nodes"
Merge "Add class to internal item nodes"
Merge "Update context on transact, in addition to select"
Propagate destroy calls down to children of branch nodes

Destroy is currently only called in cases where we create a one-off
node. This has not caused problems yet because we usually let go of DM
and CE nodes at the same time, but we should probably look into
performing cleanup during tree operations and calling destroy a little
more often.

Change-Id: I1cc71a971a728cf28967a21f4f34325b61669836
Add class to internal item nodes

It was totally missing dude

Change-Id: Icfe5f65178c96cc3e1b8f6d9385fa251235d17da
Update context on transact, in addition to select

* Cleanup documentation of ve.dm.Surface, LIES LIES LIES!
* Combine select with documentUpdate and debounce them so we don't
  double-update when there's a transaction that causes a selection
  change.

Change-Id: Iaff6d440cd39872a4a723ae65a34c52109667f41
Update OOjs UI to v0.1.0-pre (0f50cdc46c)

New changes:
6c014fd Revert "Use super to call parent methods"

Change-Id: I42fe1ec18793218cbc77ddb095891fb930a082ff
Actually add ClickableNode places

Change-Id: I4e5f638ef764c81bb98dddbe8484f0c907a5e600
Merge "Create mixin that tries to execute primary node command"
Create mixin that tries to execute primary node command

ve.ce.ClickableNode:
 * Attempts to execute the node's primary command on dblclick.
 * Nodes this is mixed into must emit dblclick on their
   overlayed elements

ve.ce.Surface:
 If node is focused and the enter key is pressed, the node's
 primary command will be executed.

ve.ui.CommandRegistery
 * Create method to get the node command

Bug: 50996
Bug: 54827
To be used by: I6b45018bdb7
Change-Id: I8df07f413d9e295b960b7d0c82224aa37fdd637e
Update OOjs UI to v0.1.0-pre (53f2410336)

New changes:
16a7989 Localisation updates from https://translatewiki.net.
c5339e7 Localisation updates from https://translatewiki.net.
48b5403 Fix documentation of toolFactory
6fc6d7b Use super to call parent constructor
b81b5f1 demo: Add ToggleSwitchWidget (disabled, checked)
a72a6e3 Use super to call parent methods
53f2410 Localisation updates from https://translatewiki.net.

Change-Id: I05ac905e559534f64ef5d6447b8ce5c2a31dafdc
Localisation updates from https://translatewiki.net.

Change-Id: I146ad0e127d8d40636cec7005b1a38cc3ce0d6ba
Merge "Prevent comparable annotations from being applied twice"
Check if newly focused slug is different to previous slug

The old logic only checked if we went from inSlug to !inSlug (or
vice-versa). The missed the case when we jump from one slug to another,
so instead change focus classes if the new slug is different to the last
one.

Bug: 62783
Change-Id: Ia2f33c4d4ce37d58a9661e3a837824f10ba6804b
Prevent comparable annotations from being applied twice

The annotation transaction builder should use #containsComparable
instead of #contains.

Bug: 52189
Change-Id: I139db1d9cad8c0fabefe17d86423c999478b97d1
Merge "Fix ContentBranchNode echo suppression at the ends of text nodes"
Localisation updates from https://translatewiki.net.

Change-Id: I3bcb7855fb2d6de9646ba26720959240278cd519
Refactor getToolsForNode and getToolsForAnnotation

* Switch getToolForNode to getToolsForNode to allow multiple tools to edit
  the same node, but still use inheritance to use the most specific tool
  in the chain
* Generalize the process of collecting compatible tools for an annotation
  or node and reuse that code in both methods

Change-Id: I7602909ed611d97abbf32549ab3576ba0be1eebd
Merge "Cleanup docs and method of tools"
Cleanup docs and method of tools

* Most tools had copy-pasted documentation, which is now just @inheritdoc
* Inspector and Dialog tools used "config" as a static property for data
  being passed into a dialog or inspector when opening, which is confusing
  since dialogs and inspectors (windows) take that argument under the name
  "data", now it's named in a way that is much clearer, dialogData and
  inspectorData respectively
* Dialog tool had logic that was broken for updating the state, since the
  result of getToolFromNode is a string, not a function - in any case it's
  not needed

Change-Id: I8b2eba1428ffb1d7950f11398244d94b82eaed8a
ve.ui.Trigger: Clean up indentation and documentation

* One value per line, not arbitrarily adjacent values based on
  virtual groups or inline comments. In object literals I found
  especially confusing the the colons sprinkled throughout a line
  (like in .keyAliases and .primaryKeyMap)

* Add missing @inheritable.
* Remove redundant @method.
* Phrase the method summary in the imperative mood.

Change-Id: I283309df7afb719a09a084aa5b52b386f54d1036
Merge "Remove incorrect documentation for the .static containers"
Remove incorrect documentation for the .static containers

We document members like static.foo as 'foo' (accompanied by an
@static mark), not as 'static.foo'. So it doesn't make sense to
document this implementation detail.

Much like we don't document the 'prototype' object as a property
either, and don't document methods as properties named
'prototype.getFoo' either.

Only a few classes had this.

* Add missing @inheritable.

Change-Id: I8e0ceefe31df17abeff19fcbc4fe450804711f45
Merge "Only insert slugs where paragraphs are allowed"
Don't try to return the document in getCoveredNodes

This happens when the range (0,0) is passed.

Bug: 62657
Change-Id: I115174b880641bbacb4424e178497e17031cebd8
Only insert slugs where paragraphs are allowed

Otherwise slugs are inserted into empty table rows and pawn
madness follows.

Bug: 53214
Change-Id: I1b5731028643813a77a109f8fbba1cb8ee6a8906
Fix ContentBranchNode echo suppression at the ends of text nodes

Rename selectionInsideOneBranchNode() to selectionInsideOneLeafNode(),
and use selectNodes() to check if the selection only covers one node.

This is needed because we don't just care about the selection being
within a CBN, we also want to steer clear of selections from a
text node across an inline node into another text node, those are
not "simple".

Change-Id: I85fe939d3709e65e7094cbc55f29bdeb673df15a
Localisation updates from https://translatewiki.net.

Change-Id: Iaea30f3f0ee78f20997afb10b4ddff2b39ac04b2
Merge "Make ContentBranchNode echo suppression work in CBNs that contain inline nodes"
Make ContentBranchNode echo suppression work in CBNs that contain inline nodes

getRenderedContents() would give you the reference-identical original DOM nodes
for inline nodes, which is good because that way the CE nodes retain their
this.$element references to them, but also bad because attaching these nodes
to the temporary wrapper detaches them from the view. With the existing
order of operations, this caused the comparsion to fail and a rerender
to happen, so we just always rerendered CBNs with inline nodes, but a
slightly different order of operations would have made the inline
nodes disappear instead.

Make getRenderedContents() return clones of these nodes, but with a
property pointing back to original. This property is not taken into
account by .isEqualDomNode(), so do the comparison with the clone,
and if we decide to rerender, resolve these clones back to their
originals before rendering into the DOM.

Text replacements in CBNs containing inline nodes (e.g. aliens demo)
now no longer echo changes; without this commit they always echo.
Replacing a character adjacent to an inline node stil echoes, but that's
a separate issue that's also causing replacing the first character in
any CBN to echo.

Change-Id: Idd75cae3c9555f5aca4568666db203b3a3bc98cb
Merge two Properties blocks in DesktopContext

Change-Id: I209e20c0ccd660218d3c65d716d35fb80ab84de9
Bring back localOverlayMenus, but only in DesktopSurface

* Move appending context to the constructor rather than the setupContext method
* Bring back localOverlayMenus (removed in Iee68ea9) but only use them for DesktopSurface

Change-Id: Ifb18774b34f4ddef0bf1fa0f29add8a08f2eea75
Style MobileContext as a dropdown drawer

csslint complains about the lack of -moz, -ms and -o prefixes but they
are simply not needed on mobile:
http://caniuse.com/#search=transform
http://caniuse.com/#search=transition

Change-Id: I5af85127c16e497f47f8e8cec383c684c2bb3c29
Merge "Split ve.ui.Context into DesktopContext and MobileContext"
Split ve.ui.Context into DesktopContext and MobileContext

DesktopContext handles more advanced positioning of the context menu and
inspectors on desktop. MobileContext is more basic and can be used on
platforms where context menus are not present (mobile/tablets).

Change-Id: Id3f5f3f39978836f084f7c7e15505e4b6aeb9b44
Add OOjs UI's sco.json i18n file

For some reason it didn't get added properly to the pull in.

Change-Id: I362422b023daab672c975d28365fa91178b8a66d
Split ve.ui.Surface into DesktopSurface and MobileSurface

This will allow us to set a custom Context (and probably other things
too) for desktop/mobile.

Remove Suface.$localOverlayMenus which is only used in ve.ui.LinkInspector
and attach link inspector directly to the context instead. This will
prevent MWLinkTargetInputWidget's lookup menu from scrolling together
with the surface on mobile in further patches.

Change-Id: Iee68ea9534531a21fb9aeae08642856ad4a511bc
Update OOjs UI to v0.1.0-pre (ac0cc69508)

New changes:
5c41645 Localisation updates from https://translatewiki.net.
c4651d5 readme: Use <br/> instead of <br> to satisfy gitblit's Markdown parser
5345806 Make it possible to configure LabeledElement to not use autoEllipsis
ac0cc69 Use boolean instead of bool in LabeledElement docs

Change-Id: Ia25c91f71d86bc6bd1ce1b012c376d5400561404
Localisation updates from https://translatewiki.net.

Change-Id: Id60760baa48e4358549912a4a604b8970d53533b
Update OOjs UI to v0.1.0-pre (46ccd5b3a7)

New changes:
3ab4d6d Balance margins around icon on iconed ButtonWidget
8d69f53 Add missing 75% transparency to add-item
2c0ae23 Add indicators to demo page
1700e98 Localisation updates from https://translatewiki.net.
262cb8d Localisation updates from https://translatewiki.net.
9247e3a Localisation updates from https://translatewiki.net.
0a078dc Localisation updates from https://translatewiki.net.
3027b13 readme: Fix broken Markdown list syntax
d7ab327 Update oojs to v1.0.8
4dd7320 Drop file "OO.ui" file prefix
7c607c2 Localisation updates from https://translatewiki.net.
46ccd5b Make dialogs a little taller

Change-Id: If0c875d9ebdd91848c512752ade31ab96f2bbc00
Merge "Split part of getOpeningHtmlTag out to getHtmlAttributes"
Merge "Add some more characters to the special character inserter"
Merge "ve.ce.Node: Emphasise slug transition with increasing outline offset"
Add some more characters to the special character inserter

Mostly just adding the capital variants of the accented characters and a few
further symbols as used on the French Wikipedia.

Change-Id: I0c622ce7b02f1f99147f78a79aedf6b75d5129b6
ve.ce.Surface: Document version number in focus workaround for Opera

Follows-up I7962f59bd02e075.

Change-Id: I93d37d5a511a958c30543606979f298e8945852f
Split part of getOpeningHtmlTag out to getHtmlAttributes

Change-Id: Iad198ec4f3c6a2a5c9471ffc788d26094bf8c66d
Merge "Add text direction to SA demo"
Merge "ve.dm.Converter: Refer to nodes instead of elements where appropiate"
Merge "Make 'comment' its own metaitem type"
Merge "Don't cause needless surface refreshes on overwriting."
Merge "Add ve.dm.Transaction.newFromReplacement"
Don't cause needless surface refreshes on overwriting.

WHAT DOES IT FIX?
* In the demo, select a letter in the middle of the text
* Press a letter key to overwrite it
* The 350ms grey flash no longer happens: ContentBranchNode isn't echoing changes

ve.ce.Surface
* use newFromReplacement when replacing text
* Return from handleInsertion.

ve.ce.ContentBranchNode
* Ignore changes which have no effect

ve.ce.Surface.test
* Update replacement tests

demos/ve/*.html
* New demo page

Change-Id: Ied06031e9f25ea6ac80c64035f04eef82ce46df0
Add ve.dm.Transaction.newFromReplacement

Factor out the main bodies of newFromInsertion and newFromRemoval
into pushInsertion and pushRemoval, and use both in newFromReplacement.

Change-Id: I48f9f72e4e905d1b42c4a429f91866ca3d875940
Merge "Fix JS error when pressing Enter with selection across multiple paragraphs"
Fix JS error when pressing Enter with selection across multiple paragraphs

When the selection spanned multiple ContentBranchNodes, handleEnter would
first get the node where the selection started, then perform a removal,
then do stuff with the node. However, the removal detaches the node in
this case (because it gets merged with another node, so that part of the
tree is rebuilt), which results in errors later on when we assume that
the node has a non-null parent.

Instead, perform the removal first, then grab the node.

Bug: 62235
Change-Id: Id6266eaa24c48bcbca3279fb8b6ca0e1ba18cce0
ve.dm.Converter: Refer to nodes instead of elements where appropiate

Data elements are still elements (even in case of text nodes or
comment nodes), but DOM nodes are only elements if they're
HTMLElements. This should make it harder to accidentally call
getAttribute or some other Element specfic property that isn't
provided by the Node class.

Also fixed incorrect indexing of local addWhitespace method. Was indexed
as public method of this class.

Change-Id: Ie224aff469ccaec472eadd2ae6f02811d54d649a
Make 'comment' its own metaitem type

Change-Id: Ie663ab4c841e55159e36b3a3a9ca3381fb8037cf
Merge "Make ve.dm.Converter assertions actually display message"
Merge "Stop special-casing comments and recognize them as tagName='#comment' instead"
Make ve.dm.Converter assertions actually display message

Longer term we should migrate these tests to the more common
format of an array of objects with a 'msg' key, rather than
an object of objects keyed by msg.

Before this change assertions in ve.dm.Converter tests ended
up like like "undefined: inner whitespace" and
"undefined (data hasn't changed)".

Change-Id: I9bedd8dab7918784038ae1b49b4e6a71bea54eb4
ve.ce.getDomText: Document node types and use .data instead of .nodeValue

I thought maybe it was using nodeValue as a shortcut for two
different properties between Text and CDATASection nodes, however
they both inherit from CharacterData and store it in .data.

* CDataSection (pre-HTML5)
  http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-667469212

* Node.CDATA_SECTION_NODE
  http://dom.spec.whatwg.org/#node

Change-Id: Ib4cd4417fd2b18b123f7bb78d1448d57fa9d78cc
Stop special-casing comments and recognize them as tagName='#comment' instead

Requires some conditionals here and there because comment nodes don't have
.getAttribute() or .hasAttribute(). Also update docs to say Node rather than
HTMLElement where appropriate.

Change-Id: Ibf57307d65f0597089e46c0bc38023417a8e7d8a
Localisation updates from https://translatewiki.net.

Change-Id: Ia1070754ad11356f0289f129b6850e76b6695044
Update oojs to v1.0.8

Code:
 http://oojs.github.io/releases/oojs-1.0.8.js

Release notes:
 http://git.wikimedia.org/blob/oojs%2Fcore.git/v1.0.8/History.md

Change-Id: I3ae46a0050d74c5c4fa9004455328e0661cab2dd
ve.ce.Node: Emphasise slug transition with increasing outline offset

The outline is outside the boundary of the box model and as such doesn't
affect the page flow (cheap transition on a separate layer).

Re-ordered some of the rules as it wasn't working otherwise due
to cascading weight.

Change-Id: I42717be02360a45890539062c587c46141ad61df
Merge "ve.ce.Node: Change slug color from darker grey to lighter blue/grey"
Merge "Restore error box to VE demo page"
ve.ce.Node: Change slug color from darker grey to lighter blue/grey

* Change border from darker grey to light grey
  (same grey as toolbar border)
* Change color fill from medium grey to light blue
  (50% opaque version of the blue in the gradient in the toolbar)

Makes it feel lighter in general, and (in MediaWiki context)
makes it less similar to the default style for <pre>.

Change-Id: I0b1cc06e900fade4a62a4befb16a411527992f7c
Localisation updates from https://translatewiki.net.

Change-Id: I3aa930272c21cca73a3091ee7c3d84d263e1d862
Restore error box to VE demo page

Had mysteriously disappeared. Also restyle to match the utilites box.

Change-Id: I586ba387237ca5a34e52eee41f9c35707443eced
Add text direction to SA demo

Change-Id: Id23da34be26c0ce706cd418a32c078c8699935f7
Merge "Use en-us spelling 'focused'"
Merge "Rerender focusedNode after slug collapse"
Merge "Have Protected/ResizableNode respond to rerender event"
Merge "Fix application of slug focus classes"
Merge "Add missing returns documentation to getSurfaceFragment"
Merge "Remove unneeded assignment"
Localisation updates from https://translatewiki.net.

Change-Id: I765b36292debcd49704f054a4515d6c687187fc5
Merge "Localisation updates from https://translatewiki.net."
Localisation updates from https://translatewiki.net.

Change-Id: I56fdcb9c5a53cf8d5be5d8cc3caed5d2af8c2c83
Remove unneeded assignment

this.inspectors is assigned a WindowSet instance in L40.

Change-Id: I7ac2995cd7811e6519ae109bea678a536bdf4e31
Add missing returns documentation to getSurfaceFragment

Change-Id: I14c7904227cf4de68cd6eb7384011c834b1220ed
Update OOjs UI to v0.1.0-pre (8b13d2b7f7)

New changes:
b983861 Fix OO.ui.ButtonOptionWidget documentation header
621a966 doc: Improve and fix minor issues in base classes
59665a2 Localisation updates from https://translatewiki.net.
d9a0a7d Add icon and indicator widgets

Change-Id: Ibeb5d5d600ad1c9d6dab049a3636031d9fef070a
Merge "Add oojs-ui-apex.css to modules.json"
Add oojs-ui-apex.css to modules.json

As it's required in the SA demo.

Change-Id: I0b77f29d5e14fca393d51ab7d5a4edd02aa59c4c
Use en-us spelling 'focused'

So that we're consistently wrong.

Change-Id: Ia3d37a4840b69e68c7fffb2b65f2613a17e35af5
Rerender focusedNode after slug collapse

There's a good chance it's moved on the page.

Change-Id: I9d0dec7dc486b9efe40a4762cbf3ee3a7f8bf0cc
Have Protected/ResizableNode respond to rerender event

If a node is rerendered we should reposition phantoms and
resize handles.

Change-Id: I673cf99acd70e72cff5494c91c8ff6b871e0119a
Fix application of slug focus classes

Bug: 62285
Change-Id: If248f732330846d9030d33aa0cacbe3ab26cf7c7
Merge "Bold/italic icons for fa"
Update OOjs UI to v0.1.0-pre (e1b23620c0)

New changes:
e1b2362 Rename OO.ui.MenuSectonItemWidget.less to the right name

Change-Id: I4683503f1b9a97a1af0ddb6e43d9edf9b7b08dcd
Merge "Update constructors of inspectors and dialogs as per changes in I345d6e6"
Update constructors of inspectors and dialogs as per changes in I345d6e6

This is harmless since the values were being passed through anyway.

Change-Id: Ieea995a2ea7cf50fd832dc8fef4a521f6dd0ae67
Merge "Alignment icons"
Alignment icons

Change-Id: I70a7c6c5d32384c09987ae856fe514b376b92f4a
Pass surface set into ve.ui.Dialog and ve.ui.Inspector

Changes in I52e6a28 seem to have stopped a bit short - and the window
set wasn't being passed into dialogs and inspectors, which means they had
no reference to the surface.

This change simply passes the surface reference, since that's what the
inspector and dialog classes actually stored.

Change-Id: I345d6e62fd5ef2ed621e61457fc3870fb7681884
Update OOjs UI to v0.1.0-pre (e4f6ce0156)

New changes:
b19e296 Localisation updates from https://translatewiki.net.
4813d30 WindowSet: Add support for overriding the creation a window
218d29f Localisation updates from https://translatewiki.net.
50fd396 Add more dialog sizes and make them switchable
22f405e Make it possible to toggle the outline in a booklet layout
e4f6ce0 Hack for preventing opacity-related rendering glitches

Change-Id: Ibe8932a19fcfed225ae9fccf25a7e68b1c621789
Merge "Special character inspector styling"
Special character inspector styling

Make it look more like a special character table:
* Fixed width character areas
* Larger font size
* No button styling

Replace the GroupButtonWidget with custom HTML now we
are no longer using button styling, and remove it.

Change-Id: I89d5c8cc0faacfbcffebb4e8799bf7adbadd995a
Merge "Cleanup SpecialCharacterInspector"
Merge "Add Ctrl+Shift+/ shortcut for the shortcuts dialog"
Add Ctrl+Shift+/ shortcut for the shortcuts dialog

Really what we want is Ctrl+? , which isn't necessarily
the same as Ctrl+Shift+/ depending on the user's keyboard layout.
The trigger system doesn't allow us to get around this right now
(and may not even be able to), see bug 62282.

Change-Id: I21353094be75e4a3bfcb5e693d18197657343e31
Merge "Fix rendering of multi-shortcut actions in shortcut dialog"
Fix rendering of multi-shortcut actions in shortcut dialog

Turns out we just needed to clear the float there

Change-Id: I6e1f9665fa1a0f7a6a561884af2ad17242c55fd3
Merge "Add cmd/ctrl+m as alternative shortcut for clear formatting"
Merge "Add cmd/ctrl+y as alternative shortcut for redo"
Add cmd/ctrl+m as alternative shortcut for clear formatting

Ctrl+M is used by LibreOffice.

Bug: 56453
Change-Id: I529dead75aa4015641cef667fe51eef2452c94ab
Merge "Support multiple shortcuts per trigger"
Add cmd/ctrl+y as alternative shortcut for redo

Bug: 52140
Change-Id: Id8d02be30e160f2a1c2cc3c72ed4d339b3945d32
Support multiple shortcuts per trigger

Change-Id: I59a10957f5aba05eb45fe00f6d4c9c5854a0a7b8
Merge "ve.ce.Node: Don't use padding or height in the slug transition"
ve.ce.Node: Don't use padding or height in the slug transition

These properties can unexpectedly transition in the wrong
direction due to us not being (and not wanting to be) in control
of these for regular paragraphs.

Increasing font-size slightly to make up the absolute difference
in size of the hover state with the height and padding gone.

Change-Id: I3ee215f869873420df7017b090c92ee37501746a
Merge "Support platform specific message in keyboard shortcuts dialog"
Merge "Make the 'full size' button optional"
Merge "Store previous range in breakpoint for undo"
Merge "Slightly strong shading on slug hover target"
Make the 'full size' button optional

Transform MediaSizeWidget's 'full size' button to appear only as an
optional configuration option. This is mainly used in the new correction
related to MediaEditoDialog type and default size change at
https://gerrit.wikimedia.org/r/#/c/115939/

Change-Id: Ie18e2e371f18f5e8ab37ad27810ff11e5ee92d32
ve.ce.Node: Clean up whitespace in rgba?() syntax

Change-Id: Id73ea3fd1248490e29daee83594f02d544f457cb
Slightly strong shading on slug hover target

Change-Id: I9bbcf17708e11a888c476a22d3d59a9e852758fc
Merge "Collapse block slugs and expand on hover/focus"
Collapse block slugs and expand on hover/focus

By default collapse the height of block slugs to about half the height
and expand on hover or focus with CSS. Show a dotted outline on hover
to make it clear you are inserting a new paragraph.

As the :focus psuedo class doesn't work on contenteditable's children,
toggle a class in the slug detecting code of SurfaceObserver.

Bug: 47790
Change-Id: Iab25fc6d5e21d0014482913e148c53b32d9652c4
Support platform specific message in keyboard shortcuts dialog

Provide platform specific codes and use command#getMessage
to format correctly.

Change-Id: Ic9896b63f738cfc5d81f236ae270b037a241d199
Update OOjs UI to v0.1.0-pre (8ac38a5c31)

New changes:
f0e179c Break up stylesheets into separate files to make a 1:1 ratio of JS and LESS
3290d40 [BREAKING CHANGE] Split styles up into base styles and a theme
0eef4f9 Make ButtonOptionWidget background transparent
ba28817 Remove /* OO.ui.… */ comments from LESS theme files
8dad3cd Actually add new ButtonOptionWidget theme to build

Incidental changes:
* Add oojs-ui-apex.css theme file to commit build script.
* Add oojs-ui-apex.css theme file to stand-alone demo.

Change-Id: Ic7e85439cfd15b0382668fc7225df461e18e906e
Store previous range in breakpoint for undo

We store ranges in breakpoints and apply them directly when redoing.
However when undoing we take the range and use Transaction#translateRange
to calculate the previous range. Apart from being buggy because
translateRange is theoretically impossible to do properly (e.g. when
ranges collapse to zero width then expand again) this is also overly
complex as we can just store the range as it was before transactions were
applied to the breakpoint.

Bonus:
* Correct offset in purgeHistory (although this method is never used)
* Remove unused param from breakpoint()

Bug: 62088
Change-Id: Ic19ef19cfbb1fabac9153bc0c4cd56e5dffdc2c4
Merge "Update OOjs UI to v0.1.0-pre (f3bc5c6c1c)"
Update scripts: Ensure clean master, latest npm dependencies, abort on grunt error

* Similar to the updateSubmodules script in mediawiki/extensions/VisualEditor,
  make it easier to run this script by not requiring the user to check out master
  first and ensure it is a clean upstream master and a topic branch etc.

* Run npm-install first to ensure dependencies are up to date.

* Abort if npm-install or grunt failed.
  Otherwise this can cause the update script to create a commit with the
  correct changelog but with a broken or outdated dist copy from
  the local working copy.

* Fix missing newline at EOF.

Change-Id: I200745fa518312be84725d5d858d4df611a41348
Update OOjs UI to v0.1.0-pre (f3bc5c6c1c)

New changes:
3372b3d Localisation updates from https://translatewiki.net.
d02bccd Localisation updates from https://translatewiki.net.
e01b627 Convert remaining browser-prefixed rules to LESS mixins
0e1cbd9 Allow focusing of inputs in booklet layouts without continuous pages
e87a54e Add maxrows option to OO.ui.TextInputWidget
f3bc5c6 Adjust the size when a textarea is inserted into the DOM

Change-Id: I4533194be25514e5d0cb56136fa0f2712b3e59f5
Cleanup SpecialCharacterInspector

* buildButtonList doesn't need to use a promise, it's
  just DOM manipulation
* Move showSpinner to before getCharList (the call which
  actually could be async)
* Have buildButtonList append contents to the DOM, no need to
  to store them as a property for later
* Check the characters list is empty before doing any fetching
  or building instead of just doing it inside getCharList and
  returning an unresolved promise

Change-Id: I9a2ba501438d686d3eb7237db9a1eaefc19a2b07
Localisation updates from https://translatewiki.net.

Change-Id: I0d39d9151996bea4a942ec8fffece5218506f502
Bold/italic icons for fa

Change-Id: I16158b21bb3dbe2c2dcd55f459a8d6d86a924a4a
Merge "Changeable UI language in SA demo"
Merge "Increase keyboard shortcut height hack to work in FF"
Changeable UI language in SA demo

Re-initialize the platform when the language is changed.

Bonus:
* Override OO.ui.getUserLanguages like we do in MW.
* Cache user languages on initialize and return in getUserLanguages
  instead of attempting to duplicate $.i18n's logic.
* Hackiness to support qqx mode.

Future:
* Provide a clean API for overriding the UI language.

Change-Id: Ie83122e8abc0cb129e7d02b9cc46332503746982
Remove MW-specific config and genericise tests in ModelRegistry

Bug: 53148
Change-Id: I26ddce93e1b2ff817fd4f4dde9c892996ab429cf
Consistency in test header comments

Change-Id: I9bfa667846834ddaf09c053469300f10cb51a2b3
Increase keyboard shortcut height hack to work in FF

Bug: 60180
Change-Id: I5aab8d5002f903e40aeb18aad8e5f0bb21950d5e
Localisation updates from https://translatewiki.net.

Change-Id: I8c773e6f31d8c3084838d6ba062f7b44268411e4
Update OOjs UI to v0.1.0-pre (51f922ba17)

New changes:
57f95fe Add OO.ui.InlineMenuWidget
2ebcd42 Localisation updates from https://translatewiki.net.
1ba6137 Make fieldsets and stack panels more compact
064484f Only pay attention to left mouse button events in PopupToolGroup
584ed14 Convert styles to LESS and implement grunt task
ad906c5 Add documentation for -1 tabIndex option, which disables tab indexing
3f962db Manage active state of BookletLayout pages
5f3ee83 Disable vertical scrolling in continuous layout mode
96ae071 Make text inputs gray when disabled
51f922b Refactor OutlineControlsWidget, add remove button

Change-Id: If83857915732c2d4615b653ce9e9d0fe9c20744b
Don't allow getNearestCorrectOffset to return -1

Becuase -1 isn't a 'correct' offset.

Bug: 62022
Change-Id: I7c5db90e32948eab7ad81f1095362fb75d997422
Merge "Blur the surface when a dialog is opened"
Merge "Don't show phantoms for hidden protected items"
Merge "Fix handleEnter in nodes that don't split"
Fix handleEnter in nodes that don't split

ve.ce.Surface.js:
* If Enter pressed in a node that splits, work as before
* If Enter pressed in a branch slug, insert an empty paragraph
* If Enter pressed after a content offset, handle from that offset
* If Enter pressed otherwise, insert an empty paragraph

ve.ce.*Node.js:
* Rename canBeSplit to splitOnEnter
* Set splitOnEnter to true in ve.ce.ContentBranchNode (inherited by subclasses)

Bug: 59911
Change-Id: I73f85522d6fe6c22002e5f9de6c9ba6d90aef7a2
Don't show phantoms for hidden protected items

Bug: 61390
Change-Id: I2a7405864e9c2b714effeb51c6ced374a7c2afa7
Blur the surface when a dialog is opened

Otherwise the user can keep typing into the doucment ce.

Bug: 62027
Change-Id: Ie6c7609a4d8b981b5336fcf95a3a877142e93509
ve.ui.MediaSizeWidget: Use lowercase types hint for primitive value

Follows-up 83bbf979c54af0e8c and d787eb708f2299ebd2d.

Change-Id: I456d011c61a205be48c8dcb1f417a216bfc44612
Merge "Allow annotations to remove other annotations"
Merge "Restore focus after node-destroying actions"
Localisation updates from https://translatewiki.net.

Change-Id: Idd72389ea470a96bd006ed20dce8ed0e026ce3fb
Restore focus after node-destroying actions

FormatAction does, and HistoryAction can, destroy nodes so we
need to explicitly restore the selection by focussing the document.

List/IndentationAction only wraps/unwraps content nodes, never
destroying them.

Bug: 57552
Change-Id: I0affff897342f4c3903ac7fc15b015d52b65f8ef
Allow annotations to remove other annotations

In this case, superscript should remove subscript, and vice-versa.

Bug: 53330
Change-Id: I5abaacd7389c6040b9906ddb61e46927754a41d6
A strikethrough Y icon, and set bold/italic/strikethrough for fi

Change-Id: Ia391fcf2cec4b7a18950119f88a5b5a3988fece7
Add italic S icon, and set bold/italic for ksh

Change-Id: I9f25165b21f5e1139c7c3da4712f7c7bd025688f
Merge "Add special case to de-indentation for slugs in listItems"
Merge "Check indentation was successful before trying again"
Merge "Bold/italic icons for ar"
ve.js: Remove unused hasOwnProperty reference

This was used by methods now part of OOjs.

Also:
* Removed redundant @method tag (was the only function literal
  left in this file with @method still).

Change-Id: Ibcce49dabe0944d920cdd3ebd7db737742123d9e
Bold/italic icons for ar

Change-Id: I30983e8f30ef535195dc6c737943622bc6fb150d
Merge "Add 'change' event to MediaSizeWidget"
Localisation updates from https://translatewiki.net.

Change-Id: I3c5a6f639c02319dc54fa16d4e5540f9ea2f5c0d
Add 'change' event to MediaSizeWidget

Make sure other elements can respond to MediaSizeWidget's change
event, fired on changing the current dimensions.

Especially important for Ib973ea2afa96090a4ba

Change-Id: Ie96fd7f64655a1ba89781e3a8106e580a4febebe
Merge "Allow enforce(Min|Max)Dimensions to be changed"
Allow enforce(Min|Max)Dimensions to be changed

Make sure that the flag to enforce limited dimensions is changeable.
This will be used in MW when the image type changes to thumbnail
(which requires a limit).

Change-Id: I362c7c378c5ccd7a83495b03e4429c9b93c1e9ee
Add special case to de-indentation for slugs in listItems

Currently we assume the grandparent in the list, but it could be
the parent.

Bug: 58060
Change-Id: I54e09e65061f133238af6c10ef596dbfae8d3d62
Check indentation was successful before trying again

If for some reason the indentation fails (although it really
shouldn't), we don't want to get stuck in an infinite loop.

Bug: 58060
Change-Id: Icf74c42a224d949e51727fd93a84c0b3bfa3e8d5
Merge "Add placeholders to MediaSizeWidget"
Merge "Resize handle images"
Merge "doc: Use lowercase types where primitives (not objects) are expected"
Add placeholders to MediaSizeWidget

Add the ability to adjust input placeholders in media size widget.
This is particularly aimed at the new 'default size' fix in ve-mw.
Unfortunately, we usually don't have the placeholder details when
the input widgets are instantiated, so the method added makes sure
these are cached, appear on 0 values and can be retrieved.

Also, the valid dimension check method was adapted to accomodate
a situation where the widget is empty but its placeholders have
data.

Change-Id: I27d5efda12b7e57291211269f1f5fbc610aef4ad
Localisation updates from https://translatewiki.net.

Change-Id: Ib8d23f5e6630d88b2c8b455ddd93269472d6dcc8
Update OOjs UI to v0.1.0-pre (68c91ae065)

Includes the great window refactor of 2014.

Also adjust ve.ui.Inspector and ve.ui.Dialog for the signature
changes in their parent constructors, but keep the windowSet
parameter for now. We use it to extract the surface and we should
probably do this differently, but for now this will keep things
working.

It turned out that passing in a windowSet in the place of the
config object actually worked surprisingly well, because it has
a .$ property and the icon and title fall back to static properties.
However, the media insertion dialog (footless) and the save dialog
(small) were broken.

Change-Id: I52e6a28e5a16e8806b9c155392e8775f68afa03a
Localisation updates from https://translatewiki.net.

Change-Id: I4b32a63c10a42d3e3d4bc098dd4a6f6d3eb148c2
doc: Use lowercase types where primitives (not objects) are expected

Fixed:
* ve.dm.MetaList.js (added in I74a9a2139)
* ve.ce.Document.js (added in Ifc01b8e5d)

Change-Id: Id758818ded5b892233bfc0d62f0f435da480c950
Merge "Update OOjs UI to v0.1.0-pre (93f94e059f)"
CONTRIBUTING: Refer to MediaWiki conventions for jsduck

Except for our custom annotations (hereafter called "tags" for
consistency with upstream jsduck and MediaWiki core), which are
still listed here.

Change-Id: If8b9339b075ca5367fc836252a68c276339d1099
jsduck: Have a default --meta-tags setting

Our custom bin/generateDocs will override accordingly, but
for production we want to default to jsduck 4. That way
we can use the generic macro instead of a custom job
to run the repo's bin/generateDocs.

We need that for mwext-VisualEditor because that also
needs other overrides, but for VisualEditor standalone
we can do plain jsduck.

Change-Id: I09507b048f1f487e3067853de959a56ab4d08723
Merge "Fix documentation error in ve.ui.LanguageInputWidget"
Fix documentation error in ve.ui.LanguageInputWidget

Change-Id: I51e73ca911bab9133d285fb9d51da6d31f05e0fe
Merge "LanguageInputWidget rewrite"
Merge "Add #compareTo to ve.dm.Annotation"
Update OOjs UI to v0.1.0-pre (93f94e059f)

Includes I52b2d6e which introduces autosize option to
OO.ui.TextInputWidget.

Change-Id: I42593d61396441360087ce02e8a140fc3af01934
Merge "Ensure we use our references to certain native or upstream methods"
Ensure we use our references to certain native or upstream methods

Checked:
 ve.cloneObject       (oo|OO).cloneObject
 ve.getObjectValues   (oo|OO).getObjectValues
 ve.getObjectKeys     Object.keys
 ve.compare           (oo|OO).compare
 ve.copy              (oo|OO).copy
 ve.isPlainObject     ($|jQuery).isPlainObject
 ve.isEmptyObject     ($|jQuery).isEmptyObject
 ve.isArray           Array.isArray
 ve.bind              ($|jQuery).proxy
 ve.indexOf           ($|jQuery).inArray
 ve.extendObject      ($|jQuery).extend

Found only 1 violation.

Change-Id: I1bcce42a8fdcb0ee9eb0d846c546165c88046f40
Localisation updates from https://translatewiki.net.

Change-Id: Ic323c9d66f835d42d13c0c44430040bb5d44d04e
LanguageInputWidget rewrite

* Move fields into OO.ui.FieldLayout's and remove most of the
  custom styling.
* Fix various bits of documentation.
* Convert properties back to local variables where not re-used.
* Simplify API so that the widget deals primarily with annotations.
  Remove #getValue and replace #setValue with #setAnnotationFromValues.
* Replace setTimeout debouncing with an 'updating' state flag.
* Remove 'Change language' from i18n as only used in MW.
* Inline 'initialize' into constructor.
* Remove initial values from config, never used.

Change-Id: If121603b5637eae72a4637197c6fcc94c1bc4c4a
Add #compareTo to ve.dm.Annotation

We have a compareTo function AnnotationSet, but not for
single annotations.

Change-Id: I8858715133ff657526fc12c21dff151b14fe795b
Resize handle images

Arrows instead of circles

Change-Id: Icca4ae9cee154a1d07433cb7632182a9cf2795a2
Remove .static.title from ve.ui.Inspector

It's trying to supply a default title message, but that message doesn't exist.
Inspectors should set titles anyway.

There's no need for ve.ui.Inspector to define this property either,
as it's inherited from OO.ui.Window.

Change-Id: I178716d852c4f81ebb34462575310ed01d6f7d72
Dialog: Fix inline comment to use /* instead of /**.

Follows-up c6ba29c56886d3ded. /** is indexed for less/css/js by
jsduck and expects a documentation block. Use /*, /*! or // for
non-doc comments instead.

Change-Id: If40dbbaa02a30cbfa38ca5df066322d81a0571dc
Merge "Fix ce#getOffset when cursor is to the left of an annotation."
Fix ce#getOffset when cursor is to the left of an annotation.

The assumption is that we always enter a text node at the end, but
this is not true if we are moving right.

We also throw away the directionality after the first recursion,
it needs to passed through for stepping into nested elements.

Bug: 52517
Change-Id: I47b987fd692ab08d5a35210388fc05e11b6a60fa
Merge "Fix SurfaceWidget documentation"
Merge "Allow getAnnotationsFromOffset to ignore close elements,"
Allow getAnnotationsFromOffset to ignore close elements,

This causes a bug in remapStoreIndexes where annotated elements
get remapped twice (once for open, once for close).

BUg: 61332
Change-Id: I867f593d424fc57f1a2ec4bbf4663cacbe405ed4
Fix layout of keyboard shortcuts page

Add a scrollable panel layout, and improve the height spacing CSS.

Bug: 60180
Change-Id: I07b3b05cd8a61db333b9594849cf4de346acd846
Merge "Fix shadow position in standalone toolbar"
Fix SurfaceWidget documentation

Although the Surface constructor can take data in various forms, there's
no reason why we shouldn't just require a document model for constructing
a surface widget.

MW usage fixed in I98ade6abd4.

Change-Id: Ie1ee9bd958b39712ba2c179dec20a0b0fcf0063e
Localisation updates from https://translatewiki.net.

Change-Id: I7deeeeb4922a6a99beeb4e6da5b4f3de899079b5
InputLabelWidget -> LabelWidget

Missed by the rename in Ib544f68fe1e20.

Change-Id: If7a332af15b1e8612ce16ba26a9d495dab0f8a38
Localisation updates from https://translatewiki.net.

Change-Id: I180864e1944c9100e925bbb4f585ff5e192919f4
Localisation updates from https://translatewiki.net.

Change-Id: I677dfa4fbc9593daf95e9ee02a9c0379b6767b27
Localisation updates from https://translatewiki.net.

Change-Id: Iafbdb604d9b3d2add78edbc2d6277a71d11078b3
Merge "Move commands into static getter so they can be overridden."
Update OOjs UI to v0.1.0-pre (424b40373e)

Also account for InputLabelWidget -> LabelWidget rename.

New changes:
51f7972 Fix occurrences of @mixin to be @mixins
424b403 FieldLayout, styling improvements and standardization

Change-Id: Ib544f68fe1e20e1fbe9dddc6cc501fdfa3de5852
Update OOjs UI to v0.1.0-pre (3a9a4c1da8)

New changes:
554683c Allow whitespace labels
3a9a4c1 Invert dependencies for OutlineItemWidget and PageLayout

Change-Id: I4337257afcce7e8d69381cb5472ad11f2951848a
Localisation updates from https://translatewiki.net.

Change-Id: I99f1af08730d8c82291f42f081b69410932e72dc
Fix shadow position in standalone toolbar

Was causing horizontal scrollbar to appear when not floated.

Removed question about what border-top does, at it obviously clears the
top border when floating the toolbar in standalone.

Change-Id: Ie1b7993abbd084facd39b93d2a7f664fe93e07fb
Merge "Only allow pointer events on shields inside generated content nodes"
Merge "Actually hide the size label when not in use"
Update OOjs to v1.0.7-pre (9c04f3e917)

New changes:
7b20b8a package.json: Update devDependencies
6c47d42 Implement generateDocs.sh script
9c04f3e core: Add a 'super' property to inheriting classes

Change-Id: I42b84fd6811f4e9582a8e13617d3850c3fce61f0
Update OOjs UI to v0.1.0-pre (7d3223b8f4)

New changes:
27832b1 Moved PNG icons to their own variant
06cf9a3 Make disabled state inheritable
4dd81c9 Removed some of the drop-shadows on buttons
88efa8e Localisation updates from https://translatewiki.net.
6c3e183 Add icons demo
f285a06 build: Concatenation task should not include 'default' in a variant
7d3223b Fix for clearing items in a group element

Change-Id: Ic349ab3215dd1e5cf90d8a2b1ad020c915f9cbac
Actually hide the size label when not in use

It was previously just made transparent, and when it's positioning got out
of sync it would act as an invisible click block.

Change-Id: I47f623b79323d85e90e88204bcb1b2d8f12b60f8
Only allow pointer events on shields inside generated content nodes

Often the wrapper and contents have different size and positioning
characteristics than the shields, and shouldn't be interacted with
directly. For example, a centered image has a 100% width wrapper with a
figure inside with a fixed width and horizontal margins set to auto. The
wrapper ends up being a click block to the left and right, when all we
really want to do is make the shields clickable.

Change-Id: I2c2c592d78025cfd983c20d263a0e600616c9ae1
Localisation updates from https://translatewiki.net.

Change-Id: I809030aa186a8f77fe1509a387dd6abfe0e3b421
Move commands into static getter so they can be overridden.

Also key groups by name. This makes it easiers for overriding classes
to add extra keyboard shortcuts (e.g. MediaWiki specific shortcuts).

Change-Id: I4d84df7b5992e83b2ac296865a64f301fe5b2e22
Add ve.Scalable to documentation listing

Change-Id: I3a39bcce8f520d774f87ab7e236752595e62f793
Merge "Update OOjs UI to v0.1.0-pre (a290673bbd)"
Update OOjs UI to v0.1.0-pre (a290673bbd)

Corresponding changes in VE:
* Wrap message keys in OO.ui.deferMsg
* Update CSS selectors as per new changes in use of OO.ui.LabeledElement

New changes:
508ed8b Localisation updates from https://translatewiki.net.
55f92ae package.json: Update devDependencies
4ea0ed8 Add instructions for how to generate the distribution files
74c9d4f Gruntfile: Don't forget to watch css files as well
379d65e Localisation updates from https://translatewiki.net.
1900e7b Document index argument correctly in addItems documentation
b279a3c Give menus of lookup widgets correct width and text size
3964c28 Only populate lookup widget menus asynchronously
72f4e7e Localisation updates from https://translatewiki.net.
3b61a8d Create new "settings" icon, move "settings" icon to "advanced"
e5ecea2 Refactor labels and titles to be consistent
dc93c91 Fix positioning in TextInputMenuWidget
53ec329 Fix indicator vs icon typo in IconedElement
c0f5658 Localisation updates from https://translatewiki.net.

Change-Id: Ib599b9bd5028e2df084fcc3da657aeb7f1569d2a
Localisation updates from https://translatewiki.net.

Change-Id: I018dd8b671d32ef14b10a42b06928bc78c129347
Localisation updates from https://translatewiki.net.

Change-Id: Ic342f108bf16269bb80d0e204dc33c79ea6bdbf1
Localisation updates from https://translatewiki.net.

Change-Id: I8bcc93c3d62e67e607095c9bd82cd592c260749c
Localisation updates from https://translatewiki.net.

Change-Id: I59e0ec6225af23c41c306e9c9b007297abe15681
Localisation updates from https://translatewiki.net.

Change-Id: I1e91872d1b27433590a9c35d9d274d27e3c9c473
Update jquery.client to MW's master (45192156d7)

Change-Id: Ie73fbf351eb6ff21376bf9a7da7aede8394ed076
Merge "Don't descend into handlesOwnChildren nodes in selectNodes"
Don't descend into handlesOwnChildren nodes in selectNodes

Otherwise bad things will happen, like applying format actions
to image captions.

Bug: 60969
Change-Id: I44f010b7450f2c2ebfe86114717908783fb8a88c
Merge "Undefined variables first in selectNodes"
Localisation updates from https://translatewiki.net.

Change-Id: I02873108713daf3776c50507dc099b07390d4d24
Undefined variables first in selectNodes

Change-Id: I514c4fe2491c24dfc1037bbeee173de12efd8f24
Merge "Make globalOverlay really global"
Make globalOverlay really global

Attach it to the global <body> rather than the local <body>

Bug: 60788
Bug: 60796
Change-Id: I3dea9ff9754ba6a67941d83bf2117e4c8fde3dc0
Localisation updates from https://translatewiki.net.

Change-Id: I783cbb098d00830970ed393886696de5cfc23244
Merge "The great image scaling rewrite of 2014"
The great image scaling rewrite of 2014

Separate out logic for aspect ratio locked scaling so it can be
shared between ve.ce.ResizableNode and ve.ui.MediaSizeWidget.

Change-Id: I5b4f0f91b8534725130978875a5b4cabb6b98bd2
Merge "Allow style attributes to be pasted from other VE instances"
Add 'forClipboard' mode to converter

This allows us to generate HTML for the clipboard without having
to worry about if it would confuse Parsoid.

Change-Id: Ib29972472d12a7da6228acecae695f385b7133ef
Allow style attributes to be pasted from other VE instances

Use the new data-ve-attributes to preserve styles when copying
between VE instances. Previously we always threw away styles as
we couldn't trust them not to be modified.

As the browser can also add in styles where there were none
(unlike RDFa attributes) we have to remove all style attributes
before restoring data from data-ve-attributes.

Change-Id: I71eb211c29edc2f71c614a541c74e2d89590b72e
Merge "Internal paste rules and type conversions"
Merge "Add paste rules to surface widget config"
Internal paste rules and type conversions

Separate out paste rules into external only rules, and 'all'
rules which apply to both external and internal pastes.

Also add support for model type conversions, e.g. headings to paragraphs.

Change-Id: Id995f41d5f5bca4b8f31306e3b3ce25745e30ecc
Localisation updates from https://translatewiki.net.

Change-Id: I44e0e1fa458fd98ec00efa4b66a3992d7d8376c8
Merge "Localisation updates from https://translatewiki.net."
Merge "A better label for the original size button"
A better label for the original size button

Simpler is better for users.

Change-Id: I6cf55aacf7f8863d0de88e33bebe795ec589a29a
Localisation updates from https://translatewiki.net.

Change-Id: I48ffef27a89b8abb0fd87e04d07b5c9cb4f51557
Add paste rules to surface widget config

Change-Id: If37ede716ca5940f3149237913e410f3de0c1a4f
Use new jscs options, disable deprecated JSHint checkstyle options

* Migrate coding style options to node-jscs
  JSHint is for code quality, jscs for code style.
  As of JSHint v3, it will remove all the coding style options.
  For now they're still supported but we should migrate away from
  them. Between v0.2.6 nd v0.3.2 of node-jscs, they've introduced
  all options they were missing compared to the options being
  deprecated by JSHint, and implemented them much better actually.

* Rename our interface to unicodejs properties to be camel case.

* Fixed style violations that JSHint previously missed:
  - Mixed tabs/spaces in various files.
  - Non camel case identifier in unicodejs and ve.qunit.js.
  - Illegal trailing whitespace in ve.ui.InspectorTool.js.

* Update devDependencies to latest upstream versions.

Change-Id: I0fce45d98c5f3ef3a9036ca6a1482519bc19dbec
Merge "Localisation updates from https://translatewiki.net."
Merge "Update oojs to v1.0.7"
unicodejs: Make tool executable, fix path

* The file has a hash bang, but wasn't executable so it still
  required running like `$ python ./tools/unicodejs-properties.py`

* When called from a parent or sibling directory, it wrote to
  an unexpected file path. Fixed by expanding relative to the
  script's directory instead.

Change-Id: Ia369b98cdeb87845af3e6777e9bcf6bf04ec4592
Merge "Upgrade UnicodeJS to Unicode 6.3 spec"
Localisation updates from https://translatewiki.net.

Change-Id: I4d5b9340ef9b9a0f9cde7be9475826d92cac57f5
Upgrade UnicodeJS to Unicode 6.3 spec

*properties.js files generated from unicodejs-properties.py

* Added Hebrew_Letter, Single_Quote & Double_Quote to wordbreak
  plus a few rules around them.
* Added verbose documentation to grapheme break to assist in
  future upgrades.
* Update script to comment files as generated.

Change-Id: I7a4729d084073ea2af1b912dd3f6f52614076d3d
Update oojs to v1.0.7

Code:
 http://oojs.github.io/releases/oojs-1.0.7.js

Release notes:
 https://github.com/wikimedia/oojs/blob/v1.0.7/History.md

Change-Id: Ib9bbd45e2db914059906bb337819a57d12debd68
Localisation updates from https://translatewiki.net.

Change-Id: Ie8a05bcd808b40b5fe5a4db39ff12cb25f32236c
Check target container is attached to ownerDocument

Not global document as that will cause problems with iFrames.

Change-Id: I0e7afa563b1180270c4119bd9a9c2fd5272b031d
Merge "Show % scale on ResizableNodes"
Merge "Only call setOriginalDimensions when non-null values are provided"
Show % scale on ResizableNodes

Requires original dimensions to be provided.

Implement on ImageNodes using naturalWidth/Height.

Change-Id: I2719ddd0dae73db4927aff592a565560c6a1d5dc
Merge "Attach container to DOM before initialising target in demo"
Merge "Make keyboard shortcuts dialog footless"
Merge "Fix balancing of data in cloneSliceFromRange"
Fix typo in ve.ce.Surface test message

Change-Id: I6f4782fee2b82bb8809047d572a0738b097520a2
Merge "Tests for RDFa attribute preservation"
Merge "Minor clean up and doc fixes"
Merge "Simplify toDomElements"
Minor clean up and doc fixes

* Remove commented out arguments.
* Fix broken reference to OO#getHash (doesn't get linked, class
  is indexed as OO not oo).
* Fix broken reference to ve.dm.Converter#getDomSubtreeFromData.
* Consistently index abstract methods as @abstract.
* Fix broken list (list needs to be a new block, will be parsed
  as continuation of paragraph otherwise).
* Fix broken @extends (doesn't take value in curly braces, was
  being parsed as literal text part of the class description).

Change-Id: Ie4135bb8c9cbb9affd4680a30c2f081cf55e0e68
Merge "Simplify toDataElement"
Localisation updates from https://translatewiki.net.

Change-Id: Ic1ac5cca71c62f3f25288b445a4528efcfce6508
Only call setOriginalDimensions when non-null values are provided

Otherwise the button is never disabled.

Also assume that dimensions objects are always just width/height
as specified in the documentation.

Change-Id: I9530ed4257e88b90d4073b9d21d7a7490aa16f7b
Attach container to DOM before initialising target in demo

Otherwise toolbar measurements fail and it collapses

Bug: 59720
Change-Id: Ia296f073b40abe4a5193927b8da960a5d54c99df
Fix balancing of data in cloneSliceFromRange

Optimise case where no balancing is required by simply comparing
startNode to endNode. This solves the issues the code was having
dealing with [partial text node]/[leafNode] sibling pair, as these
don't need balancing.

Also fix the flow so that the context wrapping occurs even if the
nodes are balanced, which fixes the cases where the selection is
balanced, but still doesn't have enough context for copy/paste.

Add some test cases that were still failing in the old code.

Bug: 60117
Change-Id: I65e251c0608f0b6c214ef64e407e0f466af4eb83
Localisation updates from https://translatewiki.net.

Change-Id: I4b85671d802ca8402e5e4566e83295126c3414a1
Merge "Fixing ButtonWidget call in MediaSizeWidget"
Make keyboard shortcuts dialog footless

Because the footer is empty.

Change-Id: Iab3211c173c11ef8a89516be367fe59dafd8d66f
Tests for RDFa attribute preservation

Probably should've written these first...

Change-Id: Id75c58b3db5b6b6f3c3ff6bea9c96976d44eeeff
Fix RDFa attribute protection loop

Was accidentally set to start at length-2 after debate over for/while loops.

Fix for Iae87a6e145d92eb.

Change-Id: I7a97648edff02f131f16bc3a746409e41c3dd3f4
Simplify toDomElements

If the model matches a single tag name, toDomElements will return
a plain tag of that type by default. Remove any implementations
which don't override this.

Change-Id: I0ac83c4eaff3c203f6126080fb6c695fee4faf83
Simplify toDataElement

Replace 'type': 'foo' with 'type': this.name where applicable. This
makes inheritance easier.

Also implement { 'type': this.name } as the default in ve.dm.Model and
remove any implemenetations that don't override this.

Change-Id: I54943588c5cc23218ae1332a137b311fb4608b5f
Merge "Adding a MediaSizeWidget"
Adding a MediaSizeWidget

The widget is responsible for presenting width/height values and storing
original media size values that aspect ratio is calculated from.

Change-Id: I3d0f9348a52ac39f68dd09394778369026928c9d
Resolve URLs against correct document when copying.

Also provide the target document to the converter when converting
so nodes can relativise URLs against the correct base.

Bug: 58136

Change-Id: I86fe6c2f41e5498d4faf690fb10c0516cfbef247
Merge "Protect RDFa attributes from obliteration"
Protect RDFa attributes from obliteration

Firefox decides to not keep some attributes when copying, so JSON
encode them in a data attribute.

Bug: 59145
Bug: 59154
Bug: 59170
Bug: 59171
Bug: 59173
Change-Id: Iae87a6e145d92eb98f46367318230c4c6fc2f4ed
Fix up result of selectNodes

Exclude empty selections in unwrapped nodes.

Bug: 60117
Change-Id: Ifa2ed0c1d315d78fdf7fbb6d13fca37e19445b1e
Add internalList nodes to example data

So they can be used to create full documents in other tests.

Change-Id: I34d8959b3cea92ef9ebfc0ab00a0d19abae93494
Update OOjs to v1.0.6-pre (e284c5fed7)

New changes:
c723873 package.json: Set npm dependencies at fixed versions
d27e989 Set up node-jscs, pass it, and configure in local Gruntfile
e284c5f Update build notice and licence file for 2014

Change-Id: I3aceb1b204b441502c46d24b0de8ecd9656e031c
Fix Document#selectNodes error documentation

Change-Id: Ieb087baf3565c3db0bf8bd248f8269de6b22e6f7
Fix exception thrown by findEndOfNode

Also rewrite init/while/increment as a for loop.

Bug: 60117
Change-Id: I17442499d3d2bd3fcb8710e238e10786779e4ee9
Merge "Script to update the oojs-ui and oojs distributions"
Script to update the oojs-ui and oojs distributions

Change-Id: I8fe8d6e4de70346873dfd457e50d01676076fa3d
Merge "Update OOjs UI to v0.1.0-pre (11632fcada)"
Update OOjs UI to v0.1.0-pre (11632fcada)

New changes:
113e3ac Adjust button styles
09051dc Cleanup unused messages
6d4df49 Add titles to tool groups

Change-Id: Iaf7726150d0cf8c820a37c232504f37364cfdf10
Fix toolbar indicators in demo

Change-Id: If55ed64fb30507b38a22c35483267bf3a166cf40
Merge "Generic language inspector"
Generic language inspector

* Remove ULS dependencies
* Use toggle widget for direction
* Make AnnotationInspector more configurable, and be able to add to
  insertion annotations when used on a zero-length selection
* Make language annotations apply to appended content
* Allow language inspector for pre-annotation
* Cleanup API of language widget to be annotation-oriented
* Use new ButtonOptionWidget

Change-Id: Ie74d98283c2b2fdd2d6070f6a5f69d2d39d41aaa
Merge "Fix JS error when closing autonumbered link inspector with invalid title"
Prevent newFromAttributeChanges() from creating no-op transactions

Previously it would generate transactions changing an attribute
from 'foo' to 'foo' if you asked it to.

Change-Id: Ie4f58b9ff60c5b945ac22154fedcf839692a1a51
Fix JS error when closing autonumbered link inspector with invalid title

targetInput.getAnnotation() is null in that case, and getNodeChanges()
didn't account for that possibility.

Change-Id: Iace57d657e3779ca3512b3d4e740bf97f294f7d1
Update uses of Push/IconButtonWidget to ButtonWidget

Separated this commit form Ie74d98283c2b2fdd2 as it is causing
master to fail.

Change-Id: If4f6ee6c13a70afdf5653d1e83d71bfbdc80f9c0
Update OOjs UI to v0.1.0-pre (d9bab13)

d9bab13 The Great Button Refactor of 2014

Change-Id: I8be8dcd9f4803de60adcc971a56252f0c91bff9f
Update OOjs UI build (88b2871)

88b2871 Fix png transparency on required.png
670c468 Add i18n

Change-Id: I6428a8a293e1c3f35c9ec775e412c1e931403cc8
Merge "Clean up CONTRIBUTING.md and README.md for VE core"
ve.init.Target: Fix $document property documentation

It was indexed as a property named "The".

Change-Id: If165a797f36ae5be1e9673ddf2c80385ca09a48e
Clean up CONTRIBUTING.md and README.md for VE core

Change-Id: Ia4074af11cdf21678a7939f38e4019ee107d3213
Add method to show only specified resize handles

Depending on how an image is anchored we may not want to show
all the resize handles.

Change-Id: Ib668f6ec1c6f3f84ebf11d5a6ea1c210d0afb9aa
Merge "Make min/max dimensions configurable on ResizableNode"
Merge "Make config default to an empty object in ResizableNode"
Keyboard shortcuts dialog

Provides a keyboard shortcuts help screen triggered by CTRL+/ (?).
Currently we can only register commands per surface, so the command
won't trigger when other dialogs are open.

Bug: 52844
Change-Id: I806343b42c5fc63d82cfa64277841790984a9757
Make min/max dimensions configurable on ResizableNode

Make default range (1-Infinity) instead of (1-1000).

Change-Id: I723edd28986ea0870d205305ed1b14e05f86874e
Make config default to an empty object in ResizableNode

Makes property initialisation cleaner.

Change-Id: Icf0218938bde27f8516ff49ce7771a362007e50d
Merge "Refactor converter test utils to run single test cases"
Refactor converter test utils to run single test cases

This is so we can custom setup/teardowns per case, e.g. in
MWConverter tests.

Required by Id251afe65193f

Change-Id: I0090d1dfccc18348fba5f98e96dd6b82b8740537
Update OOjs UI to v0.1.0-pre (af97c1caec)

New changes:
7ebde47 Add indicator labels
7793a33 Add required indicator
2eb41b1 Allow indicators on option widgets
10ba7a5 Pass indicator information through pages to booklets
ef8b4a3 Bugfix: Allow dynamic registering of new tools
d1e4664 Revert "Bugfix: Allow dynamic registering of new tools"
c1f9ef2 Abstract page/outline item relationship
ba2faca Fixes for tool group re-population

Change-Id: I3a6352df96a409d4fb23a4732f2a4beda205a97a
Merge "Update OOjs UI to v0.1.0-pre (49cf241725)"
Update OOjs UI to v0.1.0-pre (49cf241725)

Change-Id: I0a1faef11a1e7e6ea3e44275c85f2efafae4dc9a
Merge "Always use absolute URLs in external links in the clipboard"
Merge "Check for valid offset when calculating insertion annotations"
Merge "Move initial selection to first content offset"
Add sticky static property to inspector tools

Used for inspectors that insert content that isn't inspectable after
insertion, such as inserting a special character.

Change-Id: I1b7bce824a8f95c6debd8c394b58beb32dd5d49b
Merge "Fix descriptions of ve.dm.Surface#change tests"
Fix more copyright headers not updated to 2014

Change-Id: Iaf4127691062cd588550fdecb932095a6bedc200
Always use absolute URLs in external links in the clipboard

When writing relative links to the clipboard using clipboardData the
full path information is lost, so make sure all links are absolute.

Bug: 58136
Change-Id: I7ba039dbbf14648510c154ad99d418eeee23b084
Fix descriptions of ve.dm.Surface#change tests

Change-Id: I818046db608dad13e249998981a7c810f1d18c66
Check for valid offset when calculating insertion annotations

In rare cases getNearestContentOffset can return -1. We check 'left'
is not -1, but not 'right'.

Bug: 59972
Change-Id: I15efbd49262ff12f9d56f79304fde10fff10eb59
Merge "Add 'get range on change' toggle button to standalone demo"
Fixing ButtonWidget call in MediaSizeWidget

OO.ui.PushButtonWidget is no longer used, instead the call is made to
OO.ui.ButtonWidget

Change-Id: I8dab934e9830ba176435f898d267d90763ebfaf4
Add 'get range on change' toggle button to standalone demo

In the same way we have 'dump model on change', allow testers to
continuously monitor the current range.

Change-Id: I9a63c0cdd96b21958c1c4a6c52fab0e502dc4d29
Move initial selection to first content offset

This stops weird selections when the document starts with an
image or other block element.

Bug: 58248
Change-Id: Ia58535cf50f578f6dc8ed599281fd6ef9f1568c4
Add method to fully destroy a target

Destroys the surface, toolbar and removes the container from the DOM.
Surface#destroy takes care of removing overlays.

Use this method in the standalone demo.

Change-Id: I2e98f8d0ba90ff725c5f0218be941c00a6fa2c8e
Merge "Fix scrolling back and forth on copy/paste in Firefox"
Fix scrolling back and forth on copy/paste in Firefox

Both on copy and on paste, Firefox would sometimes scroll the
document and scroll it back. On paste, it seemed to happen most reliably
when pasting into a slug.

Fix by restoring the scroll position immediately each time the focus
changes, as opposed to restoring it only after the last focus change
while yielding in between focus changes.

Change-Id: Ia592d0e8399b8896ffc0e18115e470d3ce91128f
demos: Support back/forward navigation

Listen for the onhashchange event so that one can use the browser's
native Back and Forward navigation.

Change-Id: I490dda2d826327adf29da2ffaef3122f406c6995
Merge "Replace dump model loop with event triggered dump"
Replace dump model loop with event triggered dump

Change-Id: Ia7bb40d07d3789837884b52ec966f5ca042967fc
Merge "Always use current surface on demo page"
Merge "Do not use global document"
Do not use global document

Use OO.ui.Element's getElementDocument instead of global document

Change-Id: I07365da32c49421d0fe235cb4ca66245f8d48986
Merge "Make DefinitionListItemNodes splittable"
Always use current surface on demo page

Now that we generate new surfaces on page switch, ve.instances[0] isn't
always the current surface. Use currentTarget.surface instead.

Change-Id: Ie0263017ba76029ad6fe6f8e543a58826b618324
Merge "Bump copyright notice for 2014"
Bump copyright notice for 2014

Change-Id: Ibc5e207e693c0441363233d528351be7b63df101
Merge "demos: Load ve.debug.js in the demo"
demos: Load ve.debug.js in the demo

Change-Id: I17d187889a9e82306f2f3da766de0cd1a2bec992
Add dumpModelLoop button to demo

Add button to dump model every 500ms

Change-Id: I220ef1a37bdf8ca66071372b19f2abd0d1f8f4ef
Make DefinitionListItemNodes splittable

This makes editing definition lists suck less, because pressing Enter
in a definition list item will no longer create two paragraphs in the
same list item, but instead split the list item.

Change-Id: I2a91c0705fd6092097a55e223e537f89acd47f4e
grunt: Minor clean up in buildloader task

* Rename src/dest to target/template.
  The src/dest properties are special in grunt and trigger
  the built-in file task utilities (such as pattern expansion
  and also turns them into an array if not already).
  Our task, however, doesn't support multiple sources or
  destinations and was bypassing it (not this.files but directly
  as this.data.src).
  To avoid confusion (a grunt user looking at this Gruntfile would
  assume it is okay to use an array and patterns in src/dest),
  and to reduce a small amount of overhead in grunt populating
  this.files for us, use different names instead.

* Remove hardcoded "__dirname + '/../../'" prefix from the
  file.read() call. It defaults to expanding relative to the
  Gruntfile root. Hardcoding this made the task not re-usable
  from the MediaWiki extension repository that submodulese this
  one (and includes this task from lib/ve).

Change-Id: I1b897f0a7479dfee1d46875eee6bda649f74e943
jsduck: Clean up categories.json

* Consistent whitespacing ([""] vs [ "" ]).
* Re-order more logically:
   - General
   - Integration
   - DM
   - CE
   - UI
   - Tests
   - Upstream

Change-Id: I8ee701c999fd30680dca961b983df5ad19046f21
Remove modules/syntaxhighlight

Forgot to remove this when removing modules/ve-mw

Change-Id: I66184d97d075d6d78ce4edff2d1f63bd1a1c102a
Followup c41b6002: change index.html.template as well as index.html

Change-Id: I73dbaab20a6a870dcf0b27e05752596cc808e65b
Fix jsduck by removing references to MW-specific things

Change-Id: I4a1ab04a8f7466e1f642afae25226a4b274d2cd4
Update .gitreview and remove MW-specific things

This is the first commit in the new VisualEditor core repo,
previously all of this code used to live in the
mediawiki/extensions/VisualEditor repo.

Bug: 45342
Change-Id: Idaab1d1e3462654772f17d87ee6e3bb0916ca4af
Move libraries to the lib/ directory

Didn't move unicodejs because it doesn't have its own repo
and is currently mastered in this repo

Change-Id: I14ab4bd641077d993ac235d8bcdcf8e50a1a72a7
Localisation updates from https://translatewiki.net.

Change-Id: I639ee73b173299883c724c28bff1da32971970f9
demo: Fix initial load and add error handling

* Check the check on first load and use if present.
* Default to first menu item.
* Handle errors.

Change-Id: I85b83050732946c8a1c9d2d30cf0c2ad11606fa2
OOjs UI to v0.1.0-pre (04754daaa9)

Changes:
* 04754da (HEAD) Change label of disabled switch to 'disabled' in demo
* 33c379f        BookletLayout: Sync outline with panels via focus instead of scroll
* ca53b7e        Fix checkboxes so the value can actually be set
* eb77c91        Refactor ToggleWidget, add ToggleButtonWidget, ButtonGroupWidget
  ----
* 5ffe63d (prev) Spell removable and movable using modern English

Change-Id: I7f1e0cd92c6eb8346da35b59a293759f2c72d7a9
Merge "Documentation fix in MWBlockImageNode"
Documentation fix in MWBlockImageNode

Change-Id: I8203474b8816197421ee18c5513b4c7235adb1da
[browser test] replace single quotes with double quotes

Change-Id: I569c31b389a9678e2d99709073511711e7e628e3
[Browser test] New test for switching between editing modes

1) Using native page-objects methods for dealing with Javascript alerts.
2) Added tags to feature file per reviewer comment.

Change-Id: I3e9d9ae16f1c880878c8e198c647376a0b9aed37
[Browser test] New test for multi-edit workflow

1) Per reviewer comments, moved some of the verbosity
   from feature to steps file in order to make
   the feature file a little more readable.
2) Using random strings for the text of each edit
   in order to make every edit unique.
3) Removing a commented line that wasn't needed.

Bug: 57654

Change-Id: Ib8b15964436d9c24556fac32977a64e2d5f22044
Merge "MWBlockImage new DOM fixes"
Clean up Target properties

Move target.surface from mw.Target to Target
* All targets use this, let's standardise it.

Move target.$document from mw.ViewPageTarget to Target
* It was initialised with null in mw.ViewPageTarget, but the
  assignment happened in mw.Target. So it should be moved up
  at least to mw.Target.
* Since it is useful to have in sa.Target as well, moved it up
  to the abstract Target, and implemented in sa.Target and
  immediately used in the standalone demo where we were already
  duplicating the find( '.ve-ce-documentNode' ).

Add missing target.setupDone = false; in sa.Target

Add missing target.toolbar to Target
* Was used in all subclasses, but never initialised in any of
  the constructors. Let's standardise this property name as well
  (instead of initialising it in three places).

Move target#event-surfaceReady from mw.Target to Target
* sa.Target uses it as well, and considering Platform#initialize
  is already standardised in the abstract class, Target#setup
  being deferred is most likely to happen in each target as well
  so let's avoid different events being invented for the same
  thing and consistently use 'surfaceReady'.

Change-Id: Ia8bde188a4cde7e1615c2ae9c5b758eefc5d9cb7
demo: Convert VisualEditor standalone demo to pure HTML+JS

Change-Id: I9a93abce933e91881e553c0bdb26f31065cf4cda
Merge "grunt: Update devDependencies"
Merge "Clean up HTML files, Gruntfile and remove index-phantomjs-tmp hack"
Merge "grunt: Update grunt-contrib-jshint use built-in jshintrc parser"
Merge "Remove unused .csslintignore"
Merge "Prevent getSaveFields from returning a property named undefined"
Prevent getSaveFields from returning a property named undefined

Change-Id: Id7326ee8b951ba2219d3ea6767370ece9aba3c23
MWBlockImage new DOM fixes

MWBlockImage
* Remove properties which just cache model properties. We can get
  fresh values from the model whenever needed and this just causes
  problems keeping them in sync.
* Tidy up DOM documentation indentation
* Merge setupCaption and setCaptionVisible into updateCaption. The
  caption's visibility can be calculated inside the method from
  model attributes.
* No need to generate figcaption on init, updateCaption  will do
  this for us
* Storing full view and model in this.caption is unnecessary,
  just store this.$caption (view.$element) and this.captionVisible
* Append the caption directly to the figure now there is no container
* Simplify setCaptionVisible
* Add in fix to account for border to figure width
* updateSize can get values from the model if they are not provided
* Remove unnecessary styles being set on this.$element.

MWImageCaption
* Generate as a figcaption instead of a div for direct attachment

MWImage
* Missing docs

CSS
* Cleanup reset styles, remove redundant add in required
* Fix margins for left/right floats to match .tleft/.tright
* Use more specific selector for inner border (thumbimage) to avoid
  matching shields.
* Remove unnecessary frameless styles, it has no border by default.

Change-Id: I52e0e10b465bb9761c2e4be28c98bec37b0dd2ca
Localisation updates from https://translatewiki.net.

Change-Id: If44e14fd60106a123c8a7cfc6f4b70163a6ec3b5
Rebuild VisualEditor.i18n.php – 2013-12-18 19:57:00

Change-Id: I1d1a1256893ecf4489d64e7cf395a6b5d7598d73
[browser test] Prefer string interpolation instead of string concatenation

Following Ruby coding convention[1].

Also fixes "no implicit conversion of nil into String (TypeError)"
error.

1: https://github.com/styleguide/ruby

Change-Id: I3bcf9ba08476117921de7d5a242f3726d8b05efb
grunt: Update devDependencies

Change-Id: I0076d07e2029039283984dd2ae0b0e775b3e00c0
Move additional module loading from mw.Target to mw.ViewPageTarget

This resolves some experimental mode dependencies on Mobile integration.

Bug: 58551
Change-Id: Id6c498ae19a5d5b1e5d1698f5e149a9b5d6f3b26
Clean up HTML files, Gruntfile and remove index-phantomjs-tmp hack

Consistently:
* Use <!DOCTYPE html>.
* Use lowercase element tags.
* Indent <head> from <html>.
* Use <meta charset="utf-8">.
* Indent <script> and <style> content from open/close tag.
* Put <link> before <script> when in <head> (in ve/test).
* Use .html instead of .php for indexes where PHP is no
  longer used.
* Use the same license header as we use elsewhere (/*! instead
  of /** and no @file)

Gruntfile:
* Include the new .js files in jshint (demos/**/*.js).
* Order buildloader keys in the same order as the directories
  they go to (alphabetically).
* Add missing jshint patterns:
  - .docs/**/*.js
  - build/**/*.js
  - modules/ve-wmf/**/*.js
* Add missing qunit test:
  - qunit.unicodejs
* Add missing watch patterns:
  - .jscs.json
  - qunit.unicodejs

Also:
* Moved relatively large pieces of script into separate files
  so that they are less repeated (though .template) and also
  able to be linted properly.
* Fixed jshint warnings in newly-created trigger.js and demo.js.
* Moved <script> elements already in <body> to bottom of <body>
  (in ve/test and eg-iframe).
* Moved <script> in eg-iframe from <head> to <body>.
* Fixed buildloader grunt task to use a non-\n whitespace match.
  for the start as well, the newline before the placeholder was
  being stripped.
* Removed the (now obsolete) index-phantomjs-tmp hack.

Change-Id: I7c5a371b82f69f367a8e1c11673d2f37868bc931
grunt: Update grunt-contrib-jshint use built-in jshintrc parser

Use built-in jshintrc option for 'jshint' config instead of
parsing manually and strippig comments.

node-jshint itself has supported comment parsing for a long time
(which is why our Jenkins build, which doesn't even use grunt,
has no problem with our .jshintrc file).

But the grunt task never exposed this parser, until v0.6.4.

Change-Id: Ia45a44ac49c943845a11d3fc7a0127776e99ed2a
Remove unused .csslintignore

This file was for the Jenkins job of csslint (since it doesn't
use the Gruntfile), now that it does, this file is redundant.

See also 94b213bd1ec33a2 in oojs-ui.

Change-Id: I62c2eb9cf62ebb15a19158f4913bf8a18597c7d4
Fix paste tests to work in phantomJS

PhantomJS doesn't play nicely with document.execCommand and complex
HTML. For testing the attribute stripping, use the clipboardData
path. Add in a special clipboard key value that allows us to manually
trigger this from the tests ('useClipboardData-0').

Change-Id: I0de842095a6a9a766f0f9a2249064ca7707283c8
Merge "Replace makeStaticLoader with a grunt task"
Merge "Fix mw.util dependencies"
Merge "Move visualeditor-languages-tool message from ve to ve-mw"
Merge "Alphabetize msgs-ve"
Merge "Split ext.visualEditor.mwcore out of ext.visualEditor.core"
Merge "Use jquery.i18n for standalone i18n"
Merge "Allow ve.init.Platforms to asynchronously initialize themselves"
Replace makeStaticLoader with a grunt task

'grunt build' builds modules/ve/test/index.php, demos/ve/index.php
and .docs/eg-iframe.html from the associated *.template files.

Got rid of the JS-based SVG/PNG switching logic. Instead, we now
just use SVG unconditionally. We'd already dropped browser support
for browsers that don't support SVG anyway.

Change-Id: Iba2e68f17904687cb13e793a410e095f28f1b13c
Fix mw.util dependencies

ext.visualEditor.base doesn't and shouldn't depend on mw.util,
but some other modules do. viewPageTarget.init has a dependency
on mw.util meaning that if VE is loaded through it, we'll always
be fine, but for correctness (and support for other targets),
explicitly indicate the dependency on mw.util for every module that
uses it.

Change-Id: I63821938d899897088799bde4d46b04cd2f9a3e2
Move visualeditor-languages-tool message from ve to ve-mw

I intially thought it was associated with the language inspector, but
it's not, it's the label for the languages pane in the meta dialog.

Change-Id: I478e3951862a25eee056e3df6cc3c9f9f7d9d935
Alphabetize msgs-ve

Change-Id: I79294c8b3a80d25eeeb03a84bc04b3d670ce6a14
Split ext.visualEditor.mwcore out of ext.visualEditor.core

* Split files according to ve / ve-mw paths
* Split messages according to msgs-ve / msgs-ve-mw
* Update dependencies accordingly
* Remove ve-mw/ hack in makeStaticLoader.php, no longer needed

Bug: 45342
Change-Id: I6cb89606c307e27e237a1e9b56b94dfdcd310f41
Merge "Empty empty.html"
Use jquery.i18n for standalone i18n

VisualEditor.php:
* Make jquery.i18n a dependency of ext.visualEditor.standalone

makeStaticLoader.php:
* Remove ve.init.platform.addMessages() call with PHP-generated messages
* Add fake module for jquery.i18n
** Needed because the module might come from MW core
** Also add special treatment for fallbacks.js and language scripts

ve.init.sa.Platform.js:
* Remove basic message system, replace with jquery.i18n
* Add initialize method that loads messages for current language and
  fallbacks

ve.init.sa.Target.js:
* Wait for the platform to initialize before actually doing things
* Add .setup() method to allow callers to short-circuit this process
** This is convenient for callers of ve.init.sa.Target in the test suite

ve.ce.test.js:
* Use existing ve.test.utils function for creating a surface

ve.test.utils.js:
* Call .setup() on the target so we can get a surface synchronously

ve.init.Platform.test.js:
* Make these tests async, wait for the platform to initialize
* Allow for missing messages to be output either as <foo> (MW)
  or foo (jquery.i18n)
* Get rid of message clearing code, namespace test messages instead

Change-Id: Iac7dfd327eadf9b503a61510574d35d748faac92
Localisation updates from https://translatewiki.net.

Change-Id: Ifd7b23212032c27448a6204b7d77acef8524c961
Empty empty.html

Some test data was accidentally commited but this should be empty.

Change-Id: If84b4b2a06fcc3b3aeaeedf4624e2040cdbfc2c2
Merge "Strip trailing linebreaks on paste due to Chrome bug"
[Browser test] New transclusion template search

Per Bug: 58406, updating search criteria for
tranclusion templates to work with existing
content in beta labs.

  Please enter the commit message for your changes. Lines starting

Change-Id: Iac6919d234bd298034cc3c3d90ec62239a3fd0df
Allow ve.init.Platforms to asynchronously initialize themselves

We'll need this for the standalone platform to load jquery.i18n messages

Change-Id: Iacb9fcb2d5750711187f7d72d53d8c7d54c6f30b
Localisation updates from https://translatewiki.net.

Change-Id: If5925a9a9e9ecd1fc44921d1f91f3cc31c23cae7
[Browser test] Additional waits for SauceLabs timeouts

Applying same fix that was applied earlier to "bullets_steps.rb"
since that relieved frequent timeout behavior seen with tests
run via SauceLabs.

Change-Id: I0c924a315cd2bf4821a9155a1d1dcd052910e50e
Strip trailing linebreaks on paste due to Chrome bug

When pasting into a selected paragraph, or emptying a paragraph Chrome
adds a linebreak. Our paste into empty uses a selected paragraph for
context so the converter picks up this extra linebreak.

It is possible that this breaks are intentional but not likely
so better just to trim than to leave the user with a break which
doesn't even render clearly.

Bug: 58347
Change-Id: Ia6b22cdaeedf1a75bb529c9a5312add9c3ce182c
Merge "Add useful HTML in toDomElements for refs and templates."
Add useful HTML in toDomElements for refs and templates.

For the benefit of pasting out of VE.
Use data-ve-ignore where necessary to avoid the HTML being
used on the way back in to VE.

Change-Id: Iabe678c4246c1d1f51abb058b6e750811fdf9bea
Merge "Move index label generation to the model"
Localisation updates from https://translatewiki.net.

Change-Id: I6930c50f3e0a6410e70f9817e953d490895dfe86
Localisation updates from https://translatewiki.net.

Change-Id: Ic4dd2f71419cd76a4deb220c1947e4eb4040ff16
JSCS fixes

Change-Id: I11032f05eaee1e8c895e06ebbc9c329cbc70c8c0
Move index label generation to the model

Also make available as a static method so it can be used by the
converter. We will need this for generated HTML for the external
clipboard.

Change-Id: Ief843ac10cd6c6e4b25e09a007625d363792adff
Merge "Update jquery.i18n to f6102aa4feddf3623c9fba3a3d31592c58204b58"
Merge "Move language inspector messages to VE core"
Merge "Reformat English JSON files"
Merge "Fix buildi18n-json.sh to be consistent with TWN's build scripts"
Merge "Rebuild VisualEditor.i18n.php"
Move language inspector messages to VE core

They conceptually belong in VE-MW, but right now the language
inspector is used in the VE standalone, and not having the
messages breaks it.

Change-Id: I0f84c6ee6c6142581c895515a2bd2a6caf4e511d
Reformat English JSON files

They were never reformatted by the TWN export

Change-Id: I24b455d7897a4dba89993a8eeaad2fa68933ae1e
Fix buildi18n-json.sh to be consistent with TWN's build scripts

Use spaces instead of tabs, and don't put a newline at the end
of the file.

Change-Id: Ice8dcec18acd9370e6885dd863a920ad779e0248
Merge "Fix the standalone toolbar to not demote heading1"
Rebuild VisualEditor.i18n.php

Change-Id: Idf167d3f3b604ff23df050741c68e3b024897c93
Fix the standalone toolbar to not demote heading1

The duplication of the toolbar definition is ugly but we don't
have a better system to say "give me the same except demote this
one thing" right now.

Change-Id: Id74ed1a18aee4a947992bdd626702f578bbace14
Merge "Add a getDirectionFromRange Method to ve.ce.Document"
Update jquery.i18n to f6102aa4feddf3623c9fba3a3d31592c58204b58

From https://github.com/wikimedia/jquery.i18n/tree/f6102aa4feddf3623c9fba3a3d31592c58204b58

Also rename jquery.i18n.messages.js to jquery.i18n.messagestore.js ,
somehow these files are named differently between the version in ULS
and the version in github and I didn't pick up that change when
switching between them.

Change-Id: Icd78c1374969f1ea539938237d405a8aeecd1dd7
Localisation updates from https://translatewiki.net.

Change-Id: Ied0dc7cfda9706146529f47f10c089963f80e0d7
Add a getDirectionFromRange Method to ve.ce.Document

getDirectionFromRange returns the direction property of the ce nodes under
that range. That method is mostly useful to recognize the overall block
direction of a selection or fragment.

The method is currently used in the following locations:
* ve.ui.Toolbar onContextChange - as a means to recognize the current context's
  block direction for the icon directionality.
* ve.ui.MWExtensionInspector - if the selection is text and not an existing node
  the input directionality adjusts to the context direction.

Bug: 57421
Change-Id: Ifc01b8e5dc0a2fe39d221e59e452c5cfad709a2d
Merge "Check values property exists before removing attribute"
Merge "data-ve-ignore attribute for elements to be complete ignored by the converter"
Merge "Fix hashes in MW toDomElement functions"
[Browser test] Add waits for SauceLabs happiness

1) when_present waits to deal with SauceLabs sluggishness
2) Restore a "sleep" method for running test locally

Change-Id: I692befa5da607cf2468e3a56eb9b634a17f8deb2
ve.EventSequencer onLoop: minor consistency change

Change-Id: I2102c7eb3f8865ef403b01d8975359a4a212bf6c
data-ve-ignore attribute for elements to be complete ignored by the converter

This is for HTML we generate for the benefit of the external clipboard
(i.e. pasting into other applications).

Change-Id: I1c5ff4760f17e1981a78a0bc44f8e296454bb065
Fix hashes in MW toDomElement functions

Hashes weren't using the new [ object, config ] set up so were
never matching the store. Also added a check to see if the
originalDomElements actually exists before trying to use them
(they may have been removed by a clone operation).

Change-Id: I886e369ced9a9d2e0e457ced9c21b2a7a8e55d58
Update oojs to v1.0.6

Code:
 http://krinkle.github.io/oojs/releases/oojs-1.0.6.js

Release notes:
 https://github.com/wikimedia/oojs/blob/v1.0.6/History.md

Change-Id: Iaf7cd26b09d709f67f1947ebf14f751654d8b36e
Move "visualeditor-toolbar-insert" to ve, not ve-mw

Fix mis-placed message breaking stand-alone.

Change-Id: Ibffff67105e6877a61ba68eafc6395e598a36f82
Check values property exists before removing attribute

Apparently the values property is optional so an
exception is thrown if it isn't set.

Bug: 58421
Change-Id: Ied2a1adb2818fb3f516c1cbde263a675ceb84446
Merge "Add JSON->PHP conversion script for i18n"
Check InternalList node exists when rendering MWReferenceList

If you've just pasted in a reference and a list the internal list
nodes may not have been rebuilt yet.

Bug: 58242
Change-Id: Ib10b81f4023194791f789f3e7dda393f2e355ea3
Add JSON->PHP conversion script for i18n

Apparently the .i18n.php shim is causing problems in both production
and beta labs, so for now we'll just generate the .i18n.php file
from the JSON files.

The first half of the conversion script is identical to the shim.

Change-Id: Id606584197d7efcff6fff29ea22cd35dd744b55e
Merge "[Browser test] Update Firefox + Selenium versions."
[Browser test] Update Firefox + Selenium versions.

Change-Id: Iea8b5dea546140da58759da2db3150f85e1a553f
[Browser test] Updates to use new Insert menu

"Insert" menu replaces "More" menu for
accessing some advanced markup features.

Change-Id: I57635b54f3a5b2b72f754747bdb836fe1bfda5ec
Localisation updates from https://translatewiki.net.

Change-Id: If498cb7858a02cdc647d26251f35625c93e158e0
Merge "Use the same new toolbar for media and reference dialogs"
Merge "Update jquery.i18n to 255b10492507f78acd547cfab71eef403018d76f"
Use the same new toolbar for media and reference dialogs

With blocks comment out where they're not wanted.

Bonus: Actually make the pasteSpecial command available in these
contexts.

Bug: 58404
Change-Id: Ic77c252ddc9ae54019b2d86ee5f8a6f4febf4292
Direction adjustment to <figure> styling

Adding @noflip to align-left and align-right in the <figure> css styling
rules and removing the need to resize the Branch Node div element on center.

Change-Id: Iec6e589ba9ecdf32c1a0934b9eb05ee3fd42af66
Update jquery.i18n to 255b10492507f78acd547cfab71eef403018d76f

From https://github.com/wikimedia/jquery.i18n/tree/255b10492507f78acd547cfab71eef403018d76f

Change-Id: I77398f35c9f5465ba6fd224f35b6a863269a7d38
Merge "Make commands aware of their symbolic names"
Merge "Render CE MWBlockImageNodes as styled <figure>s"
Merge "Add getDomSubtreeFromModel to converter API"
Merge "Rename getDataFromDom to getDataFromDomSubtree"
[Browser test] Update to use new text styling menu

Also removed some duplicated code and
added test cases for bold and italic styling.

Change-Id: I181c208dd1165ea52bd4c49eb00c2eaae41ef05f
Add getDomSubtreeFromModel to converter API

This means we no longer have to inject the store/internalList etc.
state into the converter manually before generating DOM.

Change-Id: I9d1f5f2592a7c5bf4ad404416b79ad65afd83b9c
Rename getDataFromDom to getDataFromDomSubtree

To match its inverse getDomSubtreeFromData, and to make clear
that the input can be any subtree, not just a full document.

Change-Id: I4853bb6def0059eda43f86f0dcb6dd44309dc35d
makeStaticLoader: Update fake standalone init module

* Don't add ext.visualEditor.base to it, and strip of ve-mw stuff
** .base doesn't contain ve-mw stuff any more, so no stripping needed
** Instead of appending .base, just load .base and create a
   separate fake module for Standalone init.

* Don't manually register .sa files
** Instead use ext.visualEditor.standalone, it's right there.
** Add missing CSS file to .standalone.

* Documented the purpose of 'Dependencies' and removed scripts
  from that fake module that don't fall under that rationale and
  instead add them as regular modules (rangy, unicodejs).

* Removed weird 'jquery' dependency in 'ext.visualEditor.core'
  module. This is strongly recommended against, and might
  actually cause jQuery to be reloaded due to outstanding bugs
  in core with the state machine in the startup queue (jquery, mediawiki).

* Unlist unused 'jquery.client' dependency in makeStaticLoader.
  As per the module definitions in VisualEditor.php, this is
  only used by the .mediawiki module. Grepped modules/ve/ and
  found 0 uses.

* Update dependency order to roughly match the dependency tree
  as it is specified in ResourceLoader (e.g. rangy is for .core,
  not .base).

* Keep fake modules out of ResourceLoader.

Change-Id: I2a31543e5ad2fc39f5980fea855172108eda4428
Merge "Add a note to the top of the i18n shim explaining what it is"
Add a note to the top of the i18n shim explaining what it is

Change-Id: I07a6abf0d85e4ec692bb25414d65c226977b69f7
Rebuild static loaders

Had apparently gotten out of sync

Change-Id: Ib2d576ec5b5db2fe6fec468fd053dfc8a029747a
Support modules registered from hooks in makeStaticLoader

Change-Id: I7205a1a07f0127dc91cfa159d2a8b4de92192188
Rename misspelled variable $parsedMesssages

Change-Id: Idc2e9ccf5960807242305c43b8acb28b7fb64073
Combine ResourceLoader::register() calls

Build an array of modules to register, then call register() once.

Change-Id: I2040ff12e2660260698bca783a7be50308687011
Merge "Fix issues with copy-pasting MWTransclusionNodes"
Merge "Add recursion to removeHtmlAttribute"
Fix issues with copy-pasting MWTransclusionNodes

ve.dm.MWTransclusionNode
* Implement getClonedElement to remove originalDomElements
  and originalMw. We don't want to put these in the clipboard
  as there is no guarantee they are the rendering of the current
  set of parameters (a refresh may be in progress) and they may
  confuse the converter on the way back in.
  Remove about attribute to prevent about grouping of duplicated
  nodes.
* Set an extra attribute to flag that the outputted DOM doesn't
  have any generated content attached to it that can be stored
  on load.
* Check for said attribute in toDataElement and skip the
  storeGeneratedContents step. This will trigger an async update
  of the generated contents on paste.

ve.ce.Surface
* Call cloneElements before writing to pasteTarget so data in external
  clipboard is stripped of generated contents.

ve.dm.Node
* Only strip data-parsoid as other attributes may be meaningful.

ve.dm.mwExample, ve.dm.Node.test
* Update tests

Bug: 58241
Change-Id: I3e15cc97e94747647078204a0b398e6ac3ec6382
Add recursion to removeHtmlAttribute

This is pretty straightforward because the htmlAttributes data
structure is so simple...

Change-Id: Ie46fcc0715c4aecb984e73dc81a5297673f2c3ea
Render CE MWBlockImageNodes as styled <figure>s

This change is meant to transform the current block image node rendering
in ContentEditable from the nested <div> structure to a <figure> tag more
closely matching Parsoid's output, with CSS to style it the same. This is
mostly so we can work with and display attribute changes, like 'type' and
'alignment', without constantly destroying and rebuilding nested <div>
structures.

This change also includes all the attribute changes that will be called
when the media edit dialog changes image type, alignment, size, etc.

Node: The mw-classes 'thumb', 'thumbinner' and 'thumbcaption' are
preserved in the structure of the <figure> but CSS designers should note
these styles are no longer necessarily attached to <div> elements.

Bug: 53436
Change-Id: I40065acd9fd59d30f94b5336736d4986e8de15aa
Initial re-styling of the toolbar

Move all text styles, and the remove styles button, into a new 'list' toolbar
group, using the text-styles icon. Less-used text styles (strikethrough, code
and underline) are demoted, with remove styles at the end, and bold and italic
promoted.

Now re-label the "More" catch-all to now be "Insert", which is what's left.

Change-Id: I66a1bba347ea64e540106b1090995b3117a8b1b2
Make commands aware of their symbolic names

This introduces a small reorginization of how commands are registered so
that they are associated with their corresponding symbolic names.
This change is mainly to aid with event tracking, but it might be
generally useful for other things as well.

Change-Id: I2ccf4522f786a54c1f5395008b7b0333a1fa6072
Merge "Re-label the formula inspector to not be LaTeX"
Merge "Strip empty spans after style attributes have been removed"
Strip empty spans after style attributes have been removed

We already do this for removeHtmlAttributes mode.

Add tests in ElementLinearData and ce.Surface. Get rid of unused
clipboardHtml param in ce.Surface tests as it is unused and replace
with clipboardKey flag which tests the VE->VE paste path.

Change-Id: I0cd82a37d6e765ecab489dc22f642ebbcfbb5387
Merge "Format MW example HTML"
Merge "Move removeHtmlAttribute into ve.dm.Model"
Format MW example HTML

For readability

Change-Id: I7e58fd71a0a34e2e11bf93b1f088e4c87795b748
Move removeHtmlAttribute into ve.dm.Model

Make available only as a static method so you don't accidentally
change a node without using a transaction.

Change-Id: If27442b502ec176a58e75ef4f9afa5119d06dcc5
Re-label the formula inspector to not be LaTeX

Because users like to understand labels.

Bug: 53251
Change-Id: Iab24371161f278f07e516478a864d957859c32ae
Merge "Localisation updates from https://translatewiki.net."
Localisation updates from https://translatewiki.net.

Change-Id: Ia3cd64ae99a564324c09a134eb32aacbbf269e75
Merge "Don't select nodes inserted by a dialog, but drop cursor after"
Followup 5d7673eb: still adjust width/height when positioning fails

ve.ui.Context#updateDimensions does two things: it updates the position
of the popup by measuring where the selection is, and it updates the
width and height of the popup by measuring the contents of the inspector
or the context menu.

In some cases, measuring where the selection is fails, and
ve.ce.Surface#getSelectionRect returns null. This seems to only happen
1) in phantomjs while running the test suite and 2) when an inspector
is opened and doesn't adjust the selection while opening. I suspect
it has something to do with the selection not having been recently
set or the documentNode not having focus, but I haven't investigated
this in depth yet.

Prior to 5d7673eb, the editor would simply crash of the position
measurement failed. 5d7673eb changed this to just bail completely if
the position couldn't be measured, but that's also wrong. Without a
position measurement, we can't update the position of the popup, but
we can still adjust its width and height, and we should.

The failure to adjust the popup's width and height in this case was
causing a bug where opening the link inspector with the selection
set exactly to what the inspector would expand it to would cause the
popup's width and height to never be adjusted, and most of the inspector
to be invisible.

Bug: 58301
Change-Id: Ia6504e0a7b0cd1affbff2632e9f573684f1d5dcb
Merge "Add language code to language dialog"
Move resetting of paste state variables to after afterPaste

So that if the function bails with a return they are still run.

Bug: 58346
Change-Id: Ibd0f194e9c31e2b023dbd00a13ade51785f78ae6
Allow tables to contain captions!

Captions were not in the allowed lists of children for tables.
This causes an exception to be thrown if you try to do fixUpInsertion
on a transaction containing captions.

Bug: 58318
Change-Id: I866e015c14e787830c45da93dfed9d2119fb0865
Add language code to language dialog

Bonus: give both the language name and page name
lang and dir attributes.

Further bonus: reintroduce message that was deleted
earlier with all of its original translations.

Change-Id: Id137ff9a069799b6c09574b72f450eac6665d144
Merge "Rename big/small stack to undoStack & newTransactions"
Merge "Text style icon"
Merge "Put the shim from 9abad038 back (was reverted in b9bbf60f)"
Merge "Remove ve-pasteProtect class when falling back to clipboardData"
Localisation updates from https://translatewiki.net.

Change-Id: Ic5d1dee35d8347ea461681eacc51f1e2e0789e81
Remove ve-pasteProtect class when falling back to clipboardData

We already do this on the pasteTarget.

Change-Id: Idcc7ed34daebfb5ed14925eb5ee8526d1001a2f1
Fix paste sequence in Firefox

It appears that if the pasteTarget is given focus too close to the
range being set it may not take effect in time. Moving up to before
any of the selection setting logic seems to fix the issue.

Bug: 58283
Change-Id: I9bfb0ab6952863496fb3548e6804cb347d52cc57
Put the shim from 9abad038 back (was reverted in b9bbf60f)

The shim triggers bug 58249, but that's not as bad as we thought.
It turns out LocalisationUpdate still finishes despite the scary
exception, it just skips VisualEditor and finishes the rest successfully.

I will work on making the LU error more useful, and eventually
making it support JSON blobs, but the shim isn't causing a
lot of damage for now.

Change-Id: I92f11524d891e901f1a089dd8cad1232478a5ee4
Merge "Add missing tests to FlatLinearData"
Merge "Organise Flat/ElementLinearData methods and tests"
Merge "Remove references to 'document' in LinearData classes"
Add missing tests to FlatLinearData

Change-Id: I5a5f2c55928359951c4b811b75662517cec07540
Organise Flat/ElementLinearData methods and tests

Move containsElementData to FlatLinearData next to isElementData. Move
tests for both methods to FlatLinearData.test.js.

Change-Id: I07a192f5925da7cc763efe5e41427f1f47d85850
Merge "Sync JSON i18n for 1a5bdd5"
Sync JSON i18n for 1a5bdd5

Change-Id: Ib9c7219e4f9ae5893439eec7059519d2f24cd5f2
Remove references to 'document' in LinearData classes

This is left over from when all these methods where in ve.dm.Document.

Change-Id: Iec18aeddc7c8575f72550053c6278ff37a1d6000
Merge "Check the selection has collapsed after pasting"
Merge "Show full language names in the MW language dialog"
Check the selection has collapsed after pasting

In Chrome you can paste the empty string which triggers
the paste events but doesn't change the paste target. This
results in the insertion of the context character on empty
lines. To avoid this we can detect if the selection we put
around the context character is still there and abort the
paste.

Bug: 58138
Change-Id: Ib73465a2376cd316dbac6ce2567ecb64bc500307
Merge "Revert "Shim for VisualEditor.i18n.php that reads JSON blobs""
Revert "Shim for VisualEditor.i18n.php that reads JSON blobs"

This reverts commit 9abad0385ded8c18466cefbc3b88722678b4ed50.

I guess for now we'll just have to keep these in sync manually until MW core is updated.

Bug: 58249
Change-Id: I243303bdcbd048248776866fa12a17fc8279b80f
Don't select nodes inserted by a dialog, but drop cursor after

It used to be that when you closed a dialog, the thing that the dialog
inspected or inserted would be selected. For insertions, the selection
will now be collapsed immediately after the inserted node.
For modifications, the original behavior was kept, as it makes sense to
keep selecting the node that the user had to select in order to access
the dialog. For removals (only possible in the transclusion dialog),
the selection ends up as a collapsed selection at the location where
the removed node used to be; this was already behaving correctly,
as we get this behavior for free with offset translation.

Bug: 54957
Change-Id: Ibd14e8084d67a9ee85e3bac075c3fb50f27b05b2
Merge "Don't move the cursor to the top of the page after closing a dialog"
Don't move the cursor to the top of the page after closing a dialog

And other focus behavior fixes.

ve.ce.Surface.prototype.focus:
* Restore focus to the pasteTarget if a focusedNode was selected.
  This function is invoked when a dialog is closed, and we were
  always focusing the documentNode, which means the selection was
  restored incorrectly when the selection was really in the pasteTarget.

ve.ce.Surface.prototype.documentOnFocus:
* Don't rerender the model selection if the documentNode was focused but
  a focusedNode is selected. Otherwise the user can never deselect a
  focusedNode.

ve.ce.Surface.prototype.onModelSelect:
* Rerender the selection even if prev === next. This function was
  already called as a means to rerender a lost selection, and it didn't
  work if it so happened that the selection was still the same and was
  on a focusedNode.
* Clear the surfaceObserver state when moving focus from the
  documentNode to the pasteTarget. If we don't do this, then placing
  the selection back in the documentNode at the exact same place where
  it was before will not be noticed by the observer.

ve.ui.Context.prototype.onSurfaceFocus:
* Hide the context only when an inspector is open, not just when the
  context popup is visible. This ensures that the context is still
  hidden when the user clicks out of an inspector, but fixes a bug
  where the context was hidden when the selection was restored on
  an inspectable focusedNode.

Bug: 58090
Change-Id: I0658f025a9c6005d769fd0291380fcb9c1ba4f32
Merge "Only strip style attributes on rich paste from VE"
Localisation updates from https://translatewiki.net.

This is a full export of the recently converteted i18n of
VisualEditor. The conversion script should generate output in
this format, so that future diffs for localisation updates
remain as small as possible.

Change-Id: I03c3223f51027b97d7962553e80afd741991c9af
Only strip style attributes on rich paste from VE

Stripping all HTML atributes (to avoid CE-added styles such as
'font-size: 1em;') also strips data-parsoid which can cause
round trip errors. As an improvement only strip the style
attribute.

Bug: 58136
Change-Id: I34386bd847d1cf0583317a8b07916e43ff7af029
Shim for VisualEditor.i18n.php that reads JSON blobs

For performance we might also want to provide a conversion script
that generates a static PHP file.

Change-Id: I6a72bb3ec23c90fc5740327a7e46b4d805562779
Add missing specialcharacters messages to JSON blobs

These were accidentally dropped when I rebased my commit
that imported all i18n messages into the JSON files.

Change-Id: I2f5611f3dbe1a31134426184a9d5648ffc751947
Convert all i18n to JSON blobs

Split the i18n messages into four groups:
* oojs-ui (moved to the oojs-ui repo in a separate commit)
* VE core
* VE-MW (MediaWiki-specific things)
* VE-WMF (Wikimedia-specific things)

The VE-WMF group is new, and we'll split WMF-specific code out into
it later, for now it's just messages associated with that code.

Each language has its own JSON file at modules/MODULE/i18n/LANG.json

Kept messages in VisualEditor.i18n.php as the master copy, because
TranslateWiki can't deal with the JSON files just yet. Added a script
to rebuild the JSON files from the PHP file.

Change-Id: I94e084b2f10994f41324fd08a05ff7f8391ea2eb
[Browser tests] maintenance for remove parameter/template buttons

Change-Id: Ia04ddc5aa18f412bb2e02ee45dcfdc421b3ec64a
Localisation updates from https://translatewiki.net.

Change-Id: Ic9e1017e3fc867016a6d04cc95250eb899791c04
Rename big/small stack to undoStack & newTransactions

Becuase big/small stack doesn't really mean anything.
Bonus: rename the transactions property of the stack item from
'stack' to 'transactions'.

Bug: 49754
Change-Id: I361dda49f4c1e58a541df5b9e478cf20957939a1
Merge "Localisation updates from https://translatewiki.net."
Localisation updates from https://translatewiki.net.

Change-Id: I68afe24adc4fd1d9f24cc2ae01a180e583c3f7be
Merge "Add jquery.i18n files and RL module"
Add jquery.i18n files and RL module

Imported 09f7c9e40fc3bd502 from
 https://github.com/wikimedia/jquery.i18n/tree/09f7c9e40fc3bd502

Change-Id: I9bc4759202a0475bcf52230e0c57a877cc848773
Text style icon

Change-Id: I63befa2fcbfcdc4dbdf81e4c31296d12b6508591
Merge "Use proper conditional registration for jquery.uls"
Merge "Followup 418f2606e03b82a5ae0afc853406c7e9f2d1e35f: put <?xml tag back."
Followup 418f2606e03b82a5ae0afc853406c7e9f2d1e35f: put <?xml tag back.

These aren't optional in SVG files. Browsers will display them without,
but dropping them breaks MIME type detection, which breaks data URI
embedding: the underline-u icon was being embedded as data:text/plain,...

Bug: 58119
Change-Id: Ia790877fcd536f2714626ccf47beadd09cb4fac9
Merge "mw.Target: Fix document focus scroll bug"
Merge "Spell removable and movable using modern English"
mw.Target: Fix document focus scroll bug

Follows-up I55ef2622c9eacc which activated code introduced in
mw.Target in commits before that one that caused a change in the
execution order.

Hiding of page content (regular wiki page content provided by
original view request) must happen before the surface document is
focussed.

We used to hide the content from mw.ViewPageTarget#setUpSurface,
which is called from #onReady, which focusses the document after
setUpSurface is done.

Most of this code was moved to mw.ViewPageTarget#onSurfaceReady
which is the listener for the surfaceReady event emitted from

If our surface document gets focus while the original wikipage
content container is still there, the view port is forced to
scroll down because our surface is the next element sibling after
the wikipage container in the DOM.

And browsers (apparently Chrome is not affected) naturally retain
scroll position even if the elements above the one you "scrolled to"
disappear.

We can't (and shouldn't) move the hidePageContent call because
that's the responsibility of the Target subclass, so instead
moved the document focus to below the hidePageContent which is
now also part of the responsibility of the Target subclass.

Also:
* Removed target.surfaceOptions reference because that property
  does not exist. We never passed a second argument here, and
  whatever this was intended for, doesn't exist.

Bug: 58089
Change-Id: I230fbd5401cbd6e3b9450c7f156650409be8ef16
Merge "Revert "Revert "Remove dual-type support for Languages and Categories"""
Revert "Revert "Remove dual-type support for Languages and Categories""

The Parsoid team says the cache is clean of old language /
category types, and would like us to use the new types
for newly generates languages/categories.

This reverts commit d8dcafe25bf3c0ce1fb07b43bf3e8c97e1ba574d.

Change-Id: I0cffd5d299624230f3805f9468b2497f392c12c0
[browser test] Headings now include a buffer space

Confirmed with James F that this was an intentional Parsoid
change (and not a bug).

Change-Id: I21d7eba4675eaf7250267003516585e96069b4e6
Merge "Fix svg sources to start at (0,0) not (-0.5,0.5)"
Fix svg sources to start at (0,0) not (-0.5,0.5)

Change-Id: Ib7e0e18620512272f6c66ec9f81f7d4d38feedfa
Spell removable and movable using modern English

Also...

* Update OOjs UI to v0.1.0-pre (5ffe63d088)
* Make template parameter text boxes shorter (3em down from 10em)
* Reorder extendObject calls to not modify incoming config objects
* Allow level option to default to 0, rather than specifically defining it
* Use icon button widgets with remove icons for parameter, placeholder,
  template and content removal buttons

Change-Id: I29db9d814fab5cf4debd0fc7bab6f51475cb0f94
Set up node-jscs, pass it, and configure in local Gruntfile

Let's experiment with this via our local Gruntfile. If it works
fine we can install it in Jenkins (similar to node-csslint).

Verify through $ npm install && npm test;

Fixed all outstanding violations.

Also:
* Added syntaxhighight to ignore.
* Added imetests (which contain unformatted JSON) to ignore.
* In ve.dm.ModelRegistry#matchTypeRegExps, removed redundant
  !! cast from the [+!!withFunc] statement which was hitting
  a bug in node-jscs. All callers to this local private function
  pass a literal boolean true/false so no need to cast it.
* Removed "/* key .. , value */" from ve.setProp, though this
  wasn't caught by node-jscs, found it when searching for " , ".
* Made npm.devDependencies fixed instead of using tilde-ranges.
  This too often leads to strange bugs or sudden changes. Fixed
  them at the version they were currently ranging to.

Bug: 54218
Change-Id: Ib2630806f3946874c8b01e58cf171df83a28da29
Updated Ruby gems

Checking if selenium-webdriver 2.38.0 fixes cursor problem in Chrome.

Change-Id: I4467ed4ec1b3d7007f4293e3791f41502ce05959
[browser test] Chrome seems to not honor when_present() correctly

1) Added another sleep statement which seems to fix the issue locally.
2) Modified a link page element identifier.

Change-Id: Ic0006f18752d3625bc244d924a7a8a9fac2d5221
Show full language names in the MW language dialog

Bug: 54086
Change-Id: I099ac552638d666a447eb3aeaef68329ffacdfce
Insert special character tool

A tool to add special characters and diacritics to text.

Also added a new button type ve.ui.GroupButtonWidget that includes a
group of PushButtonWidget objects and returna the individual button's
value upon click

Wikis can edit <visualeditor-specialcharinspector-characterlist-insert>,
a JSON string, to include their own desird special characters to insert
through the tool.

Bug: 50296
Change-Id: I26d1f437feef1c8b61ed3be5f74ef524b33baf49
Use proper conditional registration for jquery.uls

Previously worked by checking for the UniversalLanguageSelector
extension, now actually checks for the modules themselves.

Change-Id: I99b1bfabb1953579d3aaa661ab0a4d824a7fe656
Merge "Revert "Remove dual-type support for Languages and Categories""
Revert "Remove dual-type support for Languages and Categories"

'Cos Parsoid caches things for ages.

This reverts commit 114a24f1d30571da248864dfdd53a1fbd08b5f4a.

Change-Id: I8b2f4d982becea36ddc06b29b3a48660fa0f3a44
Only remove and insert a Category if it's changed

The CategoryPopupWidget's popupClose() method was checking for the
category having changed by comparing its sort key value to the existing
one, but it failed to account that null !== ''.

Change-Id: Idb6a84dc32706d90dea70dceb0b9b3a26ed70110
Merge changes I51e74b32,Ibaa14d20

* changes:
  Refactor Transclusion and Meta dialogs to use BookletLayout
  Update OOJS UI to v0.1.0-pre (592e1d6401)
Merge "Special character icon"
Special character icon

Change-Id: I779ebf3dc30bf40514be0380a24ba72ee86a5524
Refactor Transclusion and Meta dialogs to use BookletLayout

Use OOJS-UI's newly-extended paged dialogs (in e08eb2a03b) to refactor
how the Transclusion and Meta dialogs work, splitting out the code for
each of the panels into its own file and simplifying extensibility.

The Meta dialog (ve.ui.MWMetaDialog) now has two self-managing panels:
* ve.ui.MWCategoriesPage for categories and the default sort key
* ve.ui.MWLanguagesPage for language links

The Transclusion dialog (ve.ui.MWTransclusionDialog) now has four:
* ve.ui.MWTemplatePage for a template's primary panel
* ve.ui.MWTemplateParameterPage for each parameter of a template
* ve.ui.MWTemplatePlaceholderPage for a placeholder to insert a template
* ve.ui.MWTransclusionContentPage for non-template transclusion

Additionally, the Transclusion dialog has been slightly cleaned up:
* Replace add/remove events with replace events in transclusion model
* Actually return and resolve a promise (as documented)
* Get rid of "origin" info in template models
* Add method for adding required parts

TODO:

* Decide how and when we will choose between advanced transclusion and
  template dialogs
* Work out design issues with how template descriptions will be visible
  and how adding parameters will work if only showing parameters in
  outline
* Add preview to template dialog
* Consider ways to further improve pages for use in continuous mode

WARNING:

* Right now the template dialog gets overridden by the advanced
  transclusion dialog because they have the same symbolic name and the
  latter is registered later than the former. To test the template
  dialog, just change the symbolic name of the advanced transclusion
  dialog.

Change-Id: I51e74b322aec9a4c3918e6f792bdb3d318060979
Update OOJS UI to v0.1.0-pre (592e1d6401)

Change-Id: Ibaa14d20af212987e9abf5bf12668992e5a80da2
Merge "Remove dual-type support for Languages and Categories"
Merge "Merge getDataFromDom and getModelFromDom"
Merge "Separate data/metadata split and node tree loops"
Merge getDataFromDom and getModelFromDom

Now getDataFromDom is no longer called externally, we can merge these two
methods to provide one API endpoint. Also now we have deleted getDataFromDom
we can remove the 'Recursion' disambiguator from the internal function.

Also now that the whitespace info doesn't need to be passed around, implement
it as a simple return value get function.

Change-Id: I9c667e9b90443d12660b731347d7535ccb1a17cd
Separate data/metadata split and node tree loops

It's not much of an optimisation to combine these loops but
separating them gives us greater flexibility.

Move the building of the node tree to happen lazily when
getDocumentNode is called.

In the rich paste path we can now create the DM without building
the node tree and remove the metadata.

Change-Id: I10b4bc486ff8ff8037158aa6dfd45aac87557d42
Localisation updates from https://translatewiki.net.

Change-Id: Ic5fb1783848c326729af523e619740e144c2046b
Merge "Prevent content selections ending up inside handlesOwnChildren nodes"
[browser test] Changed readme file so that it points to mediawiki-selenium

Bug: 56089
Change-Id: Ia0f5d0a36337d883c4066a866aada98d849b8315
[Browser test] Removing hard-coded MEDIAWIKI_USER value

Per this QA mail list discussion:
http://lists.wikimedia.org/pipermail/qa/2013-December/000799.html

Change-Id: Ide3bafe9b69eb5769eb99d0a3989d0e909f512ea
Prevent content selections ending up inside handlesOwnChildren nodes

The delete logic sees the caption inside the image as a valid place to
put a cursor and therefore a valid range to delete up to. This means
paragraphs can be merged into image captions by backspacing them in.

Add in a flag that keeps track of whether we are in a handlesOwnChildren
node so we can skip over them.

Bug: 57927
Change-Id: I19e91d2d3a871806d207cbd419f4a45e41d69dc0
Merge "Don't strip HTML attributes from inspected links"
Remove dual-type support for Languages and Categories

The new form was implemented in Parsoid and deployed in October, so enough time
has passed that there is no longer any need for VisualEditor to support the old
type.

Bug: 56009
Change-Id: Ief2e584345ccdb0e7eb44ab16c4bc14f7c14f5ec
Conditionally register oojs and oojs-ui

Only register them if they aren't already registered, so we're compatible
with versions of MW core with and without oojs.

Change-Id: I5dbb480e8330ceaf0531c194b8ef6cc6c65f537e
Merge "Revert "Update OOJS UI to v0.1.0-pre (d047752ccc)""
Revert "Update OOJS UI to v0.1.0-pre (d047752ccc)"

Still broken, this time because PagedOutlineLayout / BookletLayout
usage wasn't updated.

This reverts commit c6cfe763bbc96543ffa6a3679c7148d909bcbc67.

Change-Id: If0d37d396ecf3bb09f026d4432c5d7e30f040085
Always use #getDocumentNode.

Because if you only sometimes use a getter you're just wasting your time!

Change-Id: Idd38976f77b58e322d527cecca9f9c36e3ad9318
getDataFromDom -> getModelFromDom

Following on from getDomFromModel, this returns a document model
instead of element linear data. The only instance that hasn't been
replaced is in rich paste, where we need to sanitize the converted
data before constructing the document model.

This should be cleaned up in a later commit.

Change-Id: I37a2b641632af2cb515e3409deed5cd1fa358af5
Remove duplicate method setUpSurface from ViewPageTarget

Was already implemented in the parent class. Moved setPasteRules() so it
would still get run, everything else had already been moved.

Change-Id: I55ef2622c9eacc8b46bd3487919165bccfc347d5
Merge "Change signature of getDomFromData and rename"
Localisation updates from https://translatewiki.net.

Change-Id: I6261f0832b5b8938e980c6bcec330364f0fc4135
jscs: "var\t" -> "var "

Only 2 hits.

Change-Id: Ie8c5c39a49f620891bae8582dcc0d2f151e50e21
Merge "Update OOJS UI to v0.1.0-pre (d047752ccc)"
Remove ooui-inspector-* messages

Move existing uses over to the already existing visualeditor-inspector-*
messages.

Change-Id: I6da7f3d61256d1c2b4c1f9583da8bc59a2d7473d
Update OOJS UI to v0.1.0-pre (d047752ccc)

Also, as OOjs UI's StackPanelLayout was renamed to StackLayout, and the
showItem() function to setItem(), fix uses in VisualEditor.

Change-Id: If153e5e7c3a7c60e3d62e20aac8fabd4eaaa73c2
Change signature of getDomFromData and rename

Currently it takes 4 arguments which are all properties
of the document model, so just pass the model instead and
access the properties later. Rename to getDomFromModel.

Change-Id: I0c378a04dc08b9b90bdc3984f8fa8c4acfe0b667
Merge "Revert "Update OOJS UI to v0.1.0-pre (d047752ccc)""
Revert "Update OOJS UI to v0.1.0-pre (d047752ccc)"

This reverts commit 32e0850507e9f48eabb77586c274d1add9a32e1f.

Change-Id: I429b6e6172cb58ded5cad3cf63e8437a9d26ffd5
[Browser test] Restoring a missing page element

Earlier check-in for a VE media interface test
inadvertently re-named a page element that
should not have changed.

Change-Id: Iac1ef365e9cb3912977c8a89f3158ad9d122c93d
Merge "[Browser tests] Prefer double-quoted strings in Ruby code"
Merge "Fix spurious MetaList events"
Update OOJS UI to v0.1.0-pre (d047752ccc)

Change-Id: Ic8e5e8176b35be702ad7a995918fc746f8b1176d
Add direction classes to Toolbar based on context

Add rtl/ltr-related classes to the toolbar based on cursor context, so
certain icons can change based on inline and block directions.

Change-Id: I1b6e450226bf8da820fb622f28c1c3062c534bb0
[Browser test] New test for VE media interface

Updated to capture changed iframe positioning of some page controls.

Change-Id: I3864e04935eca1ae7c9d70df42fd34ce58e90d66
Fix spurious MetaList events

Moving items around in the MetaList only works if all deletions are
done before all insertions. This was almost but not completely true:
when moving an existing item we would delete it and immediately re-
insert it, meaning that if there were multiple items being moved
there would be a removal after an insertion.

Instead, let the insertion loop re-insert the moved items while
making sure not to emit insert events for them. This is how I
originally intended the code to be structured, but I thought that
duplicating the insertion would be equivalent to protecting the
emission of the insertion event. Clearly I was wrong.

This fixes weird bugs where categories sometimes appeared twice
in the category dialog depending on where the category was in
the list and what the exact length of the list was (i.e., whether
the binary search in the MetaList found the first or second item
with identical offset and index).

Change-Id: I4cd131052dda396add7a0e2dbe2383bb5c1b5721
Fix naked request for save dialog's summary in save

Sometimes a save is not a save, but a switch to the wikitext editor; in this
case, the save dialog doesn't exist, so don't assume that it does.

Bug: 57947
Change-Id: Ic2df7d2066ba03564ed531e1d31351cd27441abe
Fix csslint warnings

Also:
* Added modules/syntaxhighlight to csslintignore because
  it is broken right now, so it's hard to fix those warnings
  without being able to verify it.
* Fixed a typo in the grunt-watch config that accessed an
  inexistent property.

Change-Id: Ib81572506786b6a1203c454d1b2b91bb6ae2a3de
Merge "Close inspectors when surface is focused but selection doesn't change"
Localisation updates from https://translatewiki.net.

Change-Id: I7c9f6edab0f559e6c1c14d49ac83922c0f818d20
Merge "Clear cache key when deactivating target"
Merge "Move activating/deactivating to ViewPageTarget"
Blacklist all versions of IE, as IE11 is now out

… and is completely broken still.

Change-Id: Ib8ddd40892688bd919ccc9d690e7bd3f2de6645e
Merge "Use a global resizing flag on the surface to hide phantoms"
Merge "Pressing enter in a list with no nearby content creates a paragraph"
Merge "ve.ce.Surface.handleEnter tests"
Merge "Genericise runSurfaceHandleDeleteTest to work with other 'handle' methods"
Merge "csslint: Add .csslintignore file and update gruntfile"
Clear cache key when deactivating target

And other state too, while we're at it.

Bug: 57905
Change-Id: Ifd2744c841f302764cf57c13f4a760cbe80fa2e0
Move activating/deactivating to ViewPageTarget

That's where they belong IMO, since ViewPageTarget is the one that
has .activate() and .deactivate(), and mw.Target doesn't retain any
state (apart from some caching things).

Change-Id: Ia6cf5bac9054163d54ab492d691d8ce9d6a3bb90
Merge changes I8c8b2d49,If2124c68,I786b63ab

* changes:
  Split apart onSaveError logic for other mw targets
  mw.ViewPageTarget: Remove unused onTokenError handler covered in onSaveError
  Create base MobileView config and target refactor
Split apart onSaveError logic for other mw targets

Change-Id: I8c8b2d4900b511a65cff4c554cf7ef89d6d39ea9
mw.ViewPageTarget: Remove unused onTokenError handler covered in onSaveError

Change-Id: If2124c68aab0d313f4ddd698014d2a4296bbabb8
Create base MobileView config and target refactor

Changes include:
* Target mobile for ve dependencies
* Create mobile view constructor
** Some tools like dialogs are excluded for now
* Refactor mw.target to permit code reuse
** Split out pageTarget view functionality from core init methods

Change-Id: I786b63ab57518fc6af7761501259ed66592f70e3
Close inspectors when surface is focused but selection doesn't change

It's possible for the user to put the cursor back from the inspector
in the surface without triggering a selection change, if the selection
was collapsed and they clicked in exactly the right spot.
In practice, this can happen if the link inspector is open in creation
mode and the user clicks to drop the cursor at the same position where
it was when the inspector was opened.

When this happens, the inspector wouldn't close, because it only closed
in response to selection changes. If the user then typed something,
weird things would happen.

To prevent this state (cursor is in surface but inspector is open) from
occurring, close the inspector and hide the context when the document is
focused. This fixes the link inspector creation mode issue, and it also
causes the link inspector to no longer briefly remain visible after the
user has clicked out of it.

Bug: 56976
Change-Id: Ib70fc13031873009a175e4b049a07694a87ce25d
Merge "Make veaction=edit work regardless of user preference"
csslint: Add .csslintignore file and update gruntfile

Add .csslintignore file for the csslint run by Jenkins.

Also updating our Gruntfile for local usage to include demos,
which Jenkins is going to include as well (as it uses an ignore
blacklist instead of whitelist).

Change-Id: I9114cfc54e82f090f0fcf62155ef7c1a9261548d
Merge "Re-order command registry to match toolbar order"
Merge changes I177877bf,I49a02b5d

* changes:
  Use visibility: hidden; for the ui.Context and its popup
  Followup eb95d7b0b2: don't hide the inspectors WindowSet at all
Merge "Fix JS errors when inserting references"
Use visibility: hidden; for the ui.Context and its popup

They contain iframes and those need to not be display: none;
in order to make Firefox happy.

Bug: 57568
Change-Id: I177877bff3c3b18bfc87ee4e6afa7e60fea26ffc
Localisation updates from https://translatewiki.net.

Change-Id: I4ef6e82d38f98bb2c6373bea1d9ffec985b5e250
Followup eb95d7b0b2: don't hide the inspectors WindowSet at all

There's no point in hiding the WindowSet if we've already closed the
open window in it. In fact, there's no point in hiding a WindowSet
pretty much ever.

Change-Id: I49a02b5d255b266eb9e0a537cb64082eb0ad5e4b
Fix JS errors when inserting references

ve.ui.MWReferenceDialog.prototype.teardown:
* Pass ranges rather than nodes to transaction builders
* Don't do a removal in insertion mode, we know the removal range
  will be empty

ve.dm.Transaction.newFromDocumentInsertion:
* Correctly splice the edited internalItem into listData in the case
  that newDoc isn't a document slice of doc
* Rename range to spliceItemRange for clarity
* Introduce spliceListNodeRange and set it to either newDoc's
  listNodeRange or doc's depending on whether newDoc is a slice of doc

Bug: 57683
Change-Id: Iae7de7701ae86bed89b707038407243d82249e1a
Merge "Use visibility: hidden; to hide inspectors"
Use visibility: hidden; to hide inspectors

Using display: none; on the inspectors WindowSet causes Firefox to
neglect to load CSS in the inspectors' iframes, which means the frame
never initializes and the inspector never opens.

Bug: 57568
Change-Id: Ia1a0ce78754fa1318a7d439abe1f0e2f86420e7a
Merge "Add focus and blur events to ce.Surface"
Pressing enter in a list with no nearby content creates a paragraph

Currently we assume getNearestContentOffset will give us something
sane however it can return -1 when there is no nearby content and so
an exception is thrown. In this case we have to create an empty
paragraph to place the cursor in.

Change-Id: Ic6c19da881e47ff6be45cdaa4b71bfcc1c654796
ve.ce.Surface.handleEnter tests

Change-Id: Ic30cd4e116029be85822f73dcb84938e641bc4b9
Genericise runSurfaceHandleDeleteTest to work with other 'handle' methods

We will want to reuse this test runner for handleEnter and handleInsertion.

Change-Id: I7489bf2d20fa17b1c164ff20e0cfcd9b9d5102d2
Re-order command registry to match toolbar order

Bonus: fix grammar in DialogAction comment.

Change-Id: I0fdf5f028f7191b0d662456ec1506490d7439a1a
Merge "Tear down the save dialog and remove it from memory on surface teardown"
Localisation updates from https://translatewiki.net.

Change-Id: Iba1328c19f95b6fe3cfad87c1e4752a2074ec844
Merge "Render MW extension node wikitext with XML"
Render MW extension node wikitext with XML

MW extensions are XML not HTML, so we shouldn't build them as XML
to prevent HTML specific rules being applied, such as <source>
always being self closing.

Bug: 54577
Change-Id: I84af4a29cd1c4ae4d1db4f70a4012a8ad0f98bf6
Localisation updates from https://translatewiki.net.

Change-Id: I976bfc2217745b29ff5b7778077dda89bc8f2bf9
Merge changes Icb404af8,Ib6efc2a5,I6d48f8ee

* changes:
  Make autonumbered external links inspectable
  Always remove the annotation when the remove button is clicked
  Add abstract getAnnotation() method to AnnotationInspector
Make autonumbered external links inspectable

When the target of an autonumbered link is changed to a URL, it's kept
as an autonumbered link and its target is updated. When the target is
changed to a MediaWiki page, the autonumbered link is removed and
replaced with an internal link with the text set to the target.
So for instance, if you inspect [http://www.example.com] and change
its target to "Foo", the result will be [[Foo]].

The core of this commit adds support for inspecting nodes to
ve.ui.LinkInspector. This support should probably move into a
class in between AnnotationInspector and LinkInspector, perhaps
called HybridInspector or something, but I'm deferring that for now.

LinkInspector allows changes to inspected nodes to be reflected either
as attribute changes on the node, or by replacing the node with something
else. MWLinkInspector uses this feature to replace the autonumbered
external link node with an internal link annotation when the target is
set to an external link.

Bug: 53505
Change-Id: Icb404af84c24574438e4de3ef05bbd1993b593f7
Localisation updates from https://translatewiki.net.

Change-Id: Ieac5d8326e80acf72160b4a3a60f295c1577f86f
Don't strip HTML attributes from inspected links

When you inspect a link, then close the inspector immediately,
nothing should change. However, AnnotationInspector was comparing
the generated annotation and the existing annotation by hash, and so
would consider an annotation with htmlAttributes different from
one without. This meant that inspecting a Parsoid-generated link
and then closing the inspector would cause a transaction to be
processed that removes the htmlAttributes from the annotation.

I believe a similar issue also existed for annotations with attributes
like origTitle and hrefPrefix, although I didn't reproduce this.

The fix is to have AnnotationInspector compare annotations by the
hash of their comparableObjects, rather than their hashObjects.

Change-Id: I848ffc2b7e7b2c67754a0ece3af105ffafa837ec
Add focus and blur events to ce.Surface

Didn't bother to deduplicate blur-focus event pairs that occur when the
focus moves from the documentNode to the pasteTarget or vice versa
(this happens when switching between normal selection and FocusableNode
selection).

Change-Id: If1ccd2fbf11de956b6c2364ae81b9dc20a1bf409
Localisation updates from https://translatewiki.net.

Change-Id: Iae9280bb9373b27f0764afbc19da57f7de280ea6
[browser test] more shuffling of elements among iframes

Change-Id: I1a60e2370fc436702d983705d7360563f5483242
Always remove the annotation when the remove button is clicked

Remove weird check that prevented a removal from happening if the
subclass's getAnnotation() method returned null.

This caused a bug where if you inspected a link, typed an invalid
link target (e.g. '|'), then clicked the remove button (trash can icon),
the inspector would close but the link wouldn't be removed.
However, if you typed something that was a valid link target (or didn't
touch the input at all), the remove button would work as expected.

Change-Id: Ib6efc2a5827b109c6b38185e6d89b7bb29b13a75
Add abstract getAnnotation() method to AnnotationInspector

It was relied on, and all subclasses had one, but for some reason
it wasn't defined as an abstract method.

Change-Id: I6d48f8ee666bd339be87744840c6edb4abb56dbf
Tear down the save dialog and remove it from memory on surface teardown

Otherwise the old save dialog will still be around if the user sets up
another surface (e.g. a second edit), but won't be attached to the DOM.

Bug: 57654
Change-Id: I23c10849a212534bdd0600637d8ad4fa3ebc4fb7
[Browser tests] Prefer double-quoted strings in Ruby code

Bug: 57597
Change-Id: I4ddc3f20d03bf3e66b04234be529c3eaa29be9e0
[browser test] elements moved among iframes

Change-Id: Icc9f3f4422dfed063073724f8b610e75fd967b2d
ve.js: Coding style fixup for 6f2090aac6

Change-Id: I5ef9d590b5cc573df64f1c9099c79207c471cfb6
Merge "Note language links need to be edited on Wikidata"
Merge "Revert model to use simple UTF-16 code units"
Merge "mw.ViewPageTarget: Use ve-activated class on the html element"
Merge changes If814e178,Id133431e,I38d63e31,I16d575b6

* changes:
  Plain text paste with paste special
  Use rare unicode characters for paste placeholders
  Rich paste
  Add fixUpInsertion to newFromDocumentReplace
mw.ViewPageTarget: Use ve-activated class on the html element

This allows things outside of VisualEditor to style themselves
differently while the editor is active.

Bug: 57555
Change-Id: Ief6b5f53096dd5eeb43a72a7bb182a2c04ec97ca
Localisation updates from https://translatewiki.net.

Change-Id: I20b98ddc532ac32388cabd63c9125b71cb7399b3
Merge "Also apply autonumbering CSS to links in generated content"
Merge "Fix moving over an image with the arrow keys in Firefox"
Revert model to use simple UTF-16 code units

This is a prerequisite to browser-based grapheme cluster handling, which
is needed so left/right cursoring and backspace behave as users expect.

modules/ve/ve.js
modules/ve/ce/ve.ce.Document.js
modules/ve/ce/ve.ce.js
* Revert cluster-aware splitting to trivial javascript code unit splitting
* Rewrite ve.splitClusters as a trivial compatibility method (remove soon)
* getClusterOffset/getByteOffset use unicodeJS.graphemebreak.splitClusters

modules/unicodejs/tools/unicodejs-properties.py
modules/unicodejs/unicodejs.graphemebreakproperties.js
modules/unicodejs/unicodejs.js
* Allow grapheme break tests to work with surrogate pairs

demos/ve/pages/minimal.html
demos/ve/pages/multibyte.html
demos/ve/pages/unicode.html
* replace file with more precise tests

modules/ve/test/ve.test.js
* Remove reference to grapheme-based splitting (which is no longer used)
* Correct typo

Bug: 53757
Bug: 51472
Bug: 51596
Bug: 51846
Change-Id: Ife34c87ebe40bc1689298b592eec5c0cdc2f7589
Plain text paste with paste special

Register ctrl/cmd+shift+v as a trigger which sets a flag for the
next paste event.

When the paste special flag is set, modify the sanitizeData method
to strip all annotations, and any elements other than paragraphs.

Bug: 53781
Change-Id: If814e1786ffa805b52ab32f4a06f52da743fd9af
Use rare unicode characters for paste placeholders

Helps with bug reporting, like the snowman and pawn.

Change-Id: Id133431eea987442c8b50a05821ebd54649b26b9
Rich paste

Allow pasting of rich (HTML) content.

ve.ce.Surface
* Use a sliced document clone for converting to DM HTML (copy)
* Add full context to pasteTarget before copying
* Add ve-pasteProtect class to spans to prevent them being dropped
* Implement external paste by converting HTML to data and inserting
  with newFromDocumentInsertion
* Remove clipboard key placeholder after read so they aren't picked
  up by rich paste. Hash no longer includes the placeholder.
* Detect the corruption of important spans and fallback to clipboard
  data HTML if available.

ve.dm.LinearData
* Add clone method for copy

ve.dm.ElementLinearData
* Add compareUnannotated for use by context diffing.
* Add sanitize method for cleaning data according to a set of rules.

ve.dm.Transaction
* Add range parameter for inserting a range of a document only,
  e.g. stripping the paste context.

ve.dm.Document
* Implement sliced document clone creation so that DM HTML
  is generated correctly in onCopy

ve.dm.DocumentSlice
* Replaces LinearDataSlice. Now has two ranges for balanced data
  and data with a full context.

ve.init.Target.js
* Define default, loose, paste rules (just remove aliens).

ve.init.mw.ViewPageTarget
* Define strict MW paste rules:
  + no links, spans, underlines
  + no images, divs, aliens
  + strip extra HTML attribues

ve.init.sa.Target, ve.init.mw.ViewPageTarget, ve.ui.Surface
* Pass through and store paste rules.

Bug: 41193
Bug: 48170
Bug: 50128
Bug: 53828
Change-Id: I38d63e31ee3e3ee11707e3fffed5174e1d633b42
Fix moving over an image with the arrow keys in Firefox

There was a bug when you moved over an image with the arrow keys:
if your selection was on an image and you pressed an arrow key, the
selection would move but focus would remain with the paste target
rather than going back to the document node, which caused strange
symptoms (immobilizing the arrow keys and scrolling horizontally)
in Firefox.

Bug: 57600
Change-Id: Iaf6a49787dd2fd2f3f88abd0d1f5ae512fd3fd68
Also apply autonumbering CSS to links in generated content

We had CSS that applied to our rendering of autonumbered links,
but not for raw <a rel="mw:ExtLink"></a> tags appearing in
generated content like templates.

Bug: 57420
Change-Id: Ic1585ecb1a133d16b7393ce0ce38a11b76cc2239
Remove the toolbar tracker

We were using it for the pop-out save dialog, but now that the save
dialog is real dialog, we don't need it any more.

Change-Id: I72697b5502d5f3fd19f2369a754a62d614af715b
Merge "Use InputWidget facilities in byte limit counter"
Merge "Don't build out save dialog when initializing editor"
Merge "Share code between conflict resolution and the edit source switch"
Make veaction=edit work regardless of user preference

Move the userPrefEnabled check out of isAvailable and instead check
it in-line with isAvailable for setting up the tabs with CSS, but
not for the veaction=edit function.

Bug: 55900
Change-Id: I23984e377ff3fc797e921546492b8c73a5101235
Localisation updates from https://translatewiki.net.

Change-Id: I70d8a96d3babae153047a263df0a77bd22711be0
Merge "Move setting of minor/watch defaults from MWSaveDialog to Target"
Use InputWidget facilities in byte limit counter

* Don't use setTimeout() within a change event, because change fires
  after the text has already changed
* Don't use .$input.val(), use .getValue() instead
* Don't use .placeholder()
** Reaching into .$input is bad
** Any use of .placeholder() is TextInputWidget's responsibility
** All browsers we support also support placeholder natively
* Remove .editSummaryByteLimit from ViewPageTarget, unused
* Remove ve.bind() wrapping, we already have var saveDialog = this;

Change-Id: I380575fec8d02d1191bfc1f3f235b94c64cd23b6
Don't build out save dialog when initializing editor

The save dialog DOM is pretty big, so building it on demand
like every other dialog out there seems like a good idea.

Change-Id: I02077c3e45f01d3467d41616eb879bd1d608a82b
Share code between conflict resolution and the edit source switch

Each used their own implementation of building a form and submitting it.
The edit source one wasn't passing in the oldid, which caused edit
conflicts.

Also introduced a separation between form fields (for the action=edit UI)
and API options, building one from the other.

Bug: 56835
Change-Id: I38547b4ba1827f4028a2255109cba2a57cd59e8a
Move setting of minor/watch defaults from MWSaveDialog to Target

It looks like it also came from there originally, because it uses
this.pageExists which doesn't even exist in MWSaveDialog. This caused
all pages, even existing pages, to be watched when 'watchcreations'
was set.

This logic really belongs server-side, though.

Bug: 56206
Change-Id: Idf500383b27a93136dc0cfdd60a2e7b2607af95c
Event Logger: collect IME functionality info

ve/ce/SurfaceObserver.js
* Do not setTimeout if frequency === null

demos/ve/eventLogger.html
* Standalone event logging script

ve/test/ce/imetests/*.js
* JSON event logs for various tests/browsers/IMEs

ve/test/ce/ve.ce.test.js
* Add an IME test

VisualEditor.hooks.php
* Add test files

Change-Id: I50e89d5a289f3fcb4fe2a6835a2ec96fb497242c
Test Surface with IME-like event sequences

* modules/ve/test/ce/ve.ce.TestRunner.js
Class to interact with the CE Surface and document in tests

* modules/ve/ve.EventSequencer.js
Wrap setTimeout/clearTimeout calls (for easy replacement in tests)

Change-Id: I2e2407e2b169ae77237c87bf8857b3026cc7efce
doc: Add Node to the list of built-in types

https://github.com/senchalabs/jsduck/issues/502

Change-Id: I4463f512849c7b21bc88e085c078079f50dffe6b
Note language links need to be edited on Wikidata

It wasn't true when we wrote this message, but now most of the language
links on most of the wikis are edited via Wikidata, rather than source
editing mode, so tweak the message accordingly.

Bug: 51816
Change-Id: Id11d1af397314030c3c74aa029974fcdfd9e10df
Merge "Consolidate edit section handling code in ViewPageTarget"
Consolidate edit section handling code in ViewPageTarget

Move generation of initial edit summary from setupSaveDialog() to
restoreEditSection().

This allows us to get rid of the properties tracking whether both
halves of the edit section handling had happened, because they're
now in the same method.

Moving setupSaveDialog() down so it runs after restoreEditSection();
this is needed for the communication via this.initialEditSummary
to work correctly.

Change-Id: I06a9c5cf5c752acea8a2ac25d0ffb6ac61cfe986
Fix 1919fffc: forgot to add getInnerWhitespace() in one place

Change-Id: Ia90d671100ae445ef414c6aff7b27d078ba82ffc
Update OOJS UI to v0.1.0-pre (e5ef1e5b28)

Change-Id: I07c911756b6247d9d541841fb4bab3ac09b2d8d3
Localisation updates from https://translatewiki.net.

Change-Id: Ic5d686274996eb4ec2682f428c2c7464d5460071
Localisation updates from https://translatewiki.net.

Change-Id: I0c9b3260c1f411efb877395732c6e9d89b847867
Merge "Use serialization cache in MW integration"
Use serialization cache in MW integration

Add prepareCacheKey() which submits HTML for serialization and saves
the resulting cache key, and tryWithPreparedCacheKey() which uses that
cache key (if available; if pending, it waits for it) for API requests.
Implemented save(), serialize() and showChanges() in terms of
tryWithPreparedCacheKey().

When opening the save dialog, run the conversion, cache it, and fire
off a prepareCacheKey(). Then use the cached conversion for save/diff/
serialize. This means we don't convert multiple times, and it causes
the prepared wikitext to be used.

Bug: 55979
Bug: 56011
Change-Id: I1d56fe88d312e9810a57d56a285ccdf4f1facf42
Merge "Implement serialization cache in VisualEditor API"
Merge "Fix crash in MWExtensionNode creation mode"
Merge "Fix icon opacities"
Fix icon opacities

* parameter.svg had no opacity set
* replace.svg had a document opacity of 80% in addition to the normal 75%
* re-rendered parameter.png (syntaxhighlight doesn't have png's yet)

Change-Id: I9c990fefaf4f5a7536b884b92523408146d7b2c7
Make save dialog ready for async initialization

initialize() is currently called synchronously, but once the CSS
transplantation code is fixed and it goes back to being async, that'll
cause problems.

* Add this.setupDeferred and use it to defer setupCheckboxes() until
  after initialization
* Move code populating the edit summary from ViewPageTarget into
  MWSaveDialog and use .setValue() rather than manipulating the
  TextInputWidget's DOM. Defer this until after init as well
* Move clearing of the diff from ViewPageTarget into MWSaveDialog,
  and don't connect it to the transact event at startup, only when
  we've actually shown a diff
* Remove swapPanel( 'save' ) from ViewPageTarget, instead do this
  on setup in the dialog itself

Bonus:
* Document events
* Get rid of onFooButtonClick handlers in favor of array syntax

Change-Id: Idcdae5e013340f4519db4387bab507e714d47941
Merge "ce.MWTransclusionNode: Don't pass token to parsefragment API"
Fix crash in MWExtensionNode creation mode

We can't get the directionality from the focused node if there isn't one.

This doesn't add any logic to determine the directionality in creation
mode, filed https://bugzilla.wikimedia.org/show_bug.cgi?id=57421 for that.

Change-Id: I3ff8d48f19c7beef5e24b55712a26d86efa5812a
Localisation updates from https://translatewiki.net.

Change-Id: Id6e208a19eaf356252bc7778ea6b53eaff169974
Localisation updates from http://translatewiki.net.

Change-Id: I4d5313d5f417efc5b7ac93f7dd064665f8e7e1f9
Merge "Recompute auto-numbered reference listKeys when merging internalLists"
Merge "Fix reference to insertItem() in MetaList, was renamed to insertMeta()"
Add fixUpInsertion to newFromDocumentReplace

In order to do this we have to separate out the removal
operation from NDFR, so it becomes newFromDocumentInsertion
(again, although actually, for the first time). As NFDI is
an insertion we can just run fixUpInsertion on the data
part of it.

In order for the removal operation to be a proper removal
we have to allow metadata removal (the default is to merge it).

Change-Id: I16d575b61b9796e7e889f2c27cfe02b4a40b7639
Recompute auto-numbered reference listKeys when merging internalLists

This fixes some of the problems with pasting references.

It's a bit overzealous in that references get renumbered even when
replacing, which is unnecessary but doesn't actually have any
noticeable effect.

Unfortunately, the internal list state depends so much on the converter
having run that we now need to add yet another hack, to set the counter
to the appropriate value.

Change-Id: I3c6514ce600af4f4c037f419554d34b5a5c86a63
Pass the mw.user directly into {{GENDER:}}

Apparently we can do that ^^

Change-Id: I646bc7df29ad2ae605148089a53f1b5b238dca22
Merge "Store inner whitespace of the body and compare it on conversion"
Implement serialization cache in VisualEditor API

Add paction=serializeforcache, which serializes the given HTML, stores
the resulting wikitext in memcached, and returns a cache key. This
cache key can then be passed instead of HTML to paction=diff or
action=visualeditoredit for quick diff/save operations using the
cached wikitext, or to paction=serialize to just retrieve the wikitext.

This lays the groundwork for front-loading serialization in the editor,
and for avoiding the double serialization that occurs when the user
first views the diff, then saves.


Bug: 55979
Bug: 56011
Change-Id: I223b1717890632c39e2509967149551f807119f8
Use __DIR__ instead of dirname( __FILE__ )

Change-Id: I7ea4cb82ec7b3c6077a7485b0fb618d4c1dd00f9
Clean up uses of 'this' in mw.ViewPageTarget

* Use 'this' instead of 'viewPage' in setupSaveDialog()
* Unwrap unnecessary .each() in restoreEditSection()

Change-Id: I45d0c9714d59e195d0c4413ed3dbe9cbabe45e9d
Replace raw oojs-ui files with v0.1.0-pre (0267100ab3)

Change-Id: I792bc0335269976ff29433227b6fa562a1026aeb
[Browser test] Expanding test with additional text markup types

Change-Id: I3141993f1527dfdeea66ac2a52ee7c8be384f198
Localisation updates from http://translatewiki.net.

Change-Id: I69bdc2e43985f5de574bb3ddd64b3415c30a320f
Merge "Prevent link-annotating MWReferences"
Prevent link-annotating MWReferences

As it isn't sensible wikitext.

Bug: 56250
Change-Id: I7ec03f87ad69645c2877ee7a399950f3967a1362
doc: Fix existing violations detected by JSDuck 5

* Fix invalid @param name (mixup of type and param name).
* Fix incorrect reliance on inferred name for ve.Range.
  @class uses the below function to guess its name, however
  if @property is encountered, the @class block ends. Thus
  it was indexed as a nameless class.
* Separate @property definitions because combining them like
  that doesn't work (it silently ignored everything after the
  first "from" property).

Also:
* Add some missing @static to static methods in ve.Range.
* Remove a few redundant @method while at it.

Change-Id: I8357c30711a4830af0b68b18350352c457a607f3
Merge "doc: Get rid of 'static' property container in jsduck index"
doc: Get rid of 'static' property container in jsduck index

Us grouping the inheritable static properties that way is an
implementation detail that is polluting the index and makes
it harder to refer to individual identifiers.

It also causes problems under JSDuck 5 because that version is
more strict about defining properties (Foo.static.bar) of which
the parent is not defined in the index (Foo.static), we'd have
to add a sea of `@static @property {Object} this.static` all
over the place. Might as well hide this implementation detail
and just consider them static properties (just like we already
do for "private" properties).

Change-Id: Ibf2ebf7752aabc2b75b6ac6fa00e2284a181a600
[Browser test] Add Review Changes workflow per reviewer comment

Change-Id: I50d0defb3c4f51f317a497d0f805859e961b8f7f
Add inputFilter function to InputWidget

Change-Id: I6abc5281c70f01c26cfa181c37ed3240bda3eb3e
Account for sanitization changes properly in InputWidget

setValue() doesn't do anything if this.value === value, but with
sanitization it's possible for that to be true while the value in
the DOM is out of sync and needs to be changed.

The fix is to check for this.value changing and the DOM changing
separately.

Change-Id: I5f571445f5729f5477902c155a4ee9588b7194a8
Combine all the saveError.* track events

Instead just use saveError, and indicate the type of error in the data.

Change-Id: Ibc33b108c1f8f3aa0841ab7f0886a35d99525195
Localisation updates from http://translatewiki.net.

Change-Id: I7db3b66ebb543e01f3c1570b08e1a221fcff7fe6
Merge "Restoring messages that seem to have been deleted prematurely."
Restoring messages that seem to have been deleted prematurely.

ooui-inspector-close-tooltip and ooui-inspector-remove-tooltip are
still in use by OO.ui.

Change-Id: I241acc5f2b7822adeeab626efc1c5b12384ae54b
Fix path to oojs in eventLogger.html

Change-Id: I2e434da15ac64d1dd38a251be187d975af938222
Merge "Only replace meta-data from dialog if it has changed"
Only replace meta-data from dialog if it has changed

Previously we had a defaultSortKeyChanged value that lied - it was
possible for the value to be changed A -> B -> A by the user mid-
edit. However, the meta dialog assumed that defaultSortKeyChanged
wasn't lying, so blindly changed the meta item to the new value,
causing an unnecessary meta change if the user had done a no-op.

Now the value is renamed to defaultSortKeyTouched, and we actually
detect for content changes, and only change the meta item if a
change is actually needed (be that a removal, a replacement, or an
insertion).

Change-Id: I13022090bd7561a460a1151013e2b7d2a029f4dd
Merge "Document the fact that ve.dm.MetaItem#replaceWith takes a plain object"
Document the fact that ve.dm.MetaItem#replaceWith takes a plain object

Also encourage callers to pass plain objects unless they know what
they're doing; it's almost always wrong to pass in a MetaItem.

Change-Id: I8e8ef8ac7f77ec9f929d797e467b9c9d1140d721
Merge "Fix whitespace issue that eluded me in c4b349db4"
Merge "Add event logger to collect IME functionality info"
Fix whitespace issue that eluded me in c4b349db4

Change-Id: I5159a70929ac52fdc78b873f10853fa4420b992b
Add event logger to collect IME functionality info

This will be used to collect event traces from various IME/browser/OS
combinations that can then be used to drive unit tests.

Change-Id: Id604161b568cd412b44fe9979aff45d1fe7f054a
Merge "Guard against undefined listener arrays in EventSequencer"
Guard against undefined listener arrays in EventSequencer

Change-Id: Ida3ba2eaf92cdacaf1ca1294905226fda05c0884
Merge "Point to the "Help" button instead of the "Beta" button for feedback."
Localisation updates from http://translatewiki.net.

Change-Id: Ie44ddea7e555510e96342609f70410ec6bf7955d
Point to the "Help" button instead of the "Beta" button for feedback.

The "Beta" button was removed a while ago, so the old text is now
misleading.  Also changed it to double quotes to be consistent with
other use cases.

Change-Id: I4ccb53fea02d1029fce2d8d0f7ba8613e8672fe7
Localisation updates from http://translatewiki.net.

Change-Id: Ic39562e311e8b335e0e2a32753cc5609a37c1da5
Localisation updates from http://translatewiki.net.

Change-Id: If46fecf856bef5c1ef4514b05ff150e1ea9a0dee
Merge "Make generic localization utility for lang code keyed objects"
Make generic localization utility for lang code keyed objects

Utilize in OO.ui.IconedElement and ve.dm.TemplateSpecModel

Change-Id: I0883a73cb478d4f7509f61aebed2b2957ddb9ce8
Localisation updates from http://translatewiki.net.

Change-Id: I46a6fefed1e6f2992588e09de1f45bf8534b509b
[browser test] Additional UTF-8 editing test string

Change-Id: Iaf894043462e114e0845fc3016396ab4f51fa21b
Fix reference to insertItem() in MetaList, was renamed to insertMeta()

Change-Id: I9c14568e43987ef5354995a0ea76f93ca8bff921
Merge "Add OO.ui.ToggleWidget"
Merge "Make inspector tools active when content is inspectable"
Merge "Make tools disable correctly"
Add OO.ui.ToggleWidget

Compact toggle widget with short labels for on/off states.

Change-Id: I582e81126d5f1564302409c1b262e28e4a9505ac
Make inspector tools active when content is inspectable

This was a regression that occurred when the toolbar was refactored
recently. The correct and previous behavior was if the cursor is in a
location where the context would show an inspector tool, that inspector
tool should be active in the toolbar.

Change-Id: I8ac2b1bd21b843db30e3e9f951702378007e139a
[browser test] identifier for Link close element changed

Change-Id: Ia923c775315af9f0cd7017e0b02e621b3d9112b4
Rename remapInteralListIndexes() to correct typo

Change-Id: Iebd2cebfd1a323b40d35ffbe1b908b0b7cb6c826
Merge "Fix docs for ve.dm.Model.getAttributes"
Localisation updates from http://translatewiki.net.

Change-Id: Ifc8ee0848e7aaffb256ded8c43b3ddb1b87e2ffc
Fix docs for ve.dm.Model.getAttributes

Prefix is optional

Change-Id: Idb436ba4755b79dfab07dc8e8266b1716a26b58b
Make tools disable correctly

* Respect disabled state when handling clicks
* Style disabled tools in lists correctly

Change-Id: I14dffa3248ffa5d32403c6145381cfabdc2d7ff1
Cleanup after window refactor

Related to: I82c4fed8bcb3fb5630938c8bc4dd9b2d5f1a8c1d

Change-Id: I4cc280725315fee0c5dd042479d4373cc0cdd0b4
Merge "Use mw.util.getUrl instead of mw.util.wikiGetlink (deprecated)"
Use mw.util.getUrl instead of mw.util.wikiGetlink (deprecated)

Change-Id: I72afbbd909ce2394d54f78d465bd8ad245c1694f
Merge "Guard against detached nodes in ve.ce.GeneratedContentNode#doneGenerating"
Use a global resizing flag on the surface to hide phantoms

Otherwise you get rendering issues when you resizing adjacent
resizable nodes and you drag over the other node.

Change-Id: Ie70833fa6ae38879b70a19e8d7ecec13a1d54e92
Localisation updates from http://translatewiki.net.

Change-Id: I8074572fae263f9eb4e404170cb35cbadcd1dacd
ce.MWTransclusionNode: Don't pass token to parsefragment API

As of 46f40dc, we've split the VisualEditor API backend and the
part containing the parsefragment method no longer needs
an edit token.

This gets rid of the warning that started appearing after 46f40dc:

{
 "warnings":{"main":{"*":"Unrecognized parameter: 'token'"}},
 "visualeditor":{"result":"success","content":"<p>foo\n</p>"}
}

Change-Id: I36f79fa8ae48cdbec1b3506953418561ef2ff828
Localisation updates from http://translatewiki.net.

Change-Id: I20148f3abe2e53b2b81f9c9dde2153d67cb1f27a
Guard against detached nodes in ve.ce.GeneratedContentNode#doneGenerating

The generation promise can get resolved (e.g. AJAX request can complete)
after the node has been detached. In that case accessing this.model.doc
will fail, so check for this in doneGenerating().

Also attempt to abort the pending promise on teardown.

Bug: 56649
Change-Id: Ia55f1c2c8dc3a3619c0b50795e50fcae4bc6471f
Merge "Fix edit source switch in Firefox"
Fix edit source switch in Firefox

Previously was failing for two reasons:
1. FF requires the form to be attached before submitting
2. options.watch failed because of FF's annoying Object.prototype.watch

Bug: 56767
Change-Id: I7b3d349f057f5b87f823ce788b4143f817af5303
Localisation updates from http://translatewiki.net.

Change-Id: I4f694fd5a99641533eb08fc4f21a361240af4613
Merge "Window refactor"
Force LTR direction in MWSyntaxHighlightDialog

Syntax highlight editor shouldn't rely on GUI language directionality
but always allow for LTR text editing.

Bug: 56780
Change-Id: Iae7f9eee20ffb9a003830503865458918f5e1df3
Window refactor

Changes:

* Cleanup the window API to use more consistent and intuitive methods - we
  now use initialize/setup/teardown instead of
  initialize/onSetup/onOpen/onClose as methods which are overridden, and
  use open/close methods to control the window
* Change events around to have opening/open and closing/close events which
  act as before/after points during the opening/closing process
* Make WindowSet and Context respond to windows being opened, rather than
  opening them directly
* Fix a LinkInspector creation mode bug where the initial text doesn't get
  reset
* Move inspector, a VisualEditor concept, back to VE
* Cleanup naming of SurfaceDialog, SurfaceToolbar, etc. to use shorter
  names, they were given Surface* names when the generic ones were also in
  VE, but now the generic ones are in OO, so they can return to their
  original names

Change-Id: I82c4fed8bcb3fb5630938c8bc4dd9b2d5f1a8c1d
Merge "MWExtensionInspector input direction based on content"
MWExtensionInspector input direction based on content

In general, the direction of the MWExtensionInspector textarea
should be dependent on the directionality of the node it is editing.

The only exceptions are <hiero> and <math> that need to have their
textarea LTR always; these two inspectors' directionality definition
is overridden in their onOpen() method.

Bug: 56779
Change-Id: Iac5c1c3bf2c61b9fa36c9588c1734c91ca4305c4
Merge "Add shortcut commands for underline & sub/superscript."
Merge "Adapt beta features icons for RTL"
Merge "Add <ref> tags to wikitext detection regex"
Merge "Slight refactoring of global VE language variables"
Slight refactoring of global VE language variables

Grouping multiple $out->getTitle()->getPageLanguage() calls 
and updating its use instead of the global $wgContLang

Change-Id: I1bc0e83cbd31a95b1716665314e082d5ed9113ea
Adapt beta features icons for RTL

Split the current icons to rtl and ltr versions.

Rename all the current mentions of beta icons to ltr and rtl,
even those that don't yet exist or are commented out.

Change-Id: I96be20515cc9d84d2d71ac7e65d97d72d96636b0
[browser test] one more variable string no longer hard coded

Change-Id: Ifa4917442707d0c83799ea7e018ae1c4aa7bb4c6
[browser test] edit string no longer hard coded

Change-Id: I8d9e9ae2cafa18a9a680abdca8c4224ef10a08b6
Add shortcut commands for underline & sub/superscript.

Underline is particularly important as CE will apply underline
formatting automatically when you press Ctrl+U but the
SurfaceObserver will not notice it, leading to inconsistency
between the view and the model.

For sub/superscript I've used the Google Docs key mappings as these
appear to have the fewest conflicts with existing browser shortcuts
and there isn't much consistency between desktop clients anyway
(Word and Open/LibreOffice use completely different shortcuts).

Bonus: reordered command lists to be consistent with UI layout.
Change-Id: I92998e42f9bcfb932d44e8f483811efd538e5981
Add <ref> tags to wikitext detection regex

Bug: 56755
Change-Id: Ib7279401601147420441e77e4796b94fe91ac956
Merge "Add a whole bunch of new ve.track() events for instrumenting loading and saving"
Add a whole bunch of new ve.track() events for instrumenting loading and saving

Renamed events:
* performance.domLoad --> performance.system.domLoad
* performance.domSave --> performance.system.domSave

New events:
* performance.system.activation: total load time
* performance.system.domDiff: timing of paction=diff; like .domSave
* performance.system.domSerialize: timing of paction=serialize; like .domSave
* behavior.lastTransactionTillSaveDialogOpen: time from last transaction
  until user opened save dialog
* behavior.saveDialogOpenTillSave: time from save dialog opening to user
  clicking save
* behavior.saveDialogOpenTillReview: time from save dialog opening to user
  clicking review (skipped when a cached diff is shown)
* behavior.saveDialogClose: when user closes save dialog; duration is time
* performance.user.saveComplete: time from user clicking save to successful
  save completion; 'retries' indicates # of badtoken retries
* performance.user.saveError.*: time from user clicking save to failure;
  'retries' indicates # of badtoken retries
** performance.user.saveError.abusefilter
** performance.user.saveError.badtoken: token was bad and we prompted the user
** performance.user.saveError.captcha
** performance.user.saveError.editconflict
** performance.user.saveError.empty
** performance.user.saveError.spamblacklist
** performance.user.saveError.unknown
* performance.user.reviewComplete: time from user clicking review to diff showing
* performance.user.reviewError: time from user clicking review to diff failure
  since dialog was opened

Change-Id: I9815fa637d34c766c163e181d2f9527d3f32a7c3
Merge "Fix image resize handles update on surface change"
Merge "Restore selection when editor is refocused"
Localisation updates from http://translatewiki.net.

Change-Id: I4366816b15e4f477021a6f94c2eb3e25fd692715
Restore selection when editor is refocused

When the editor is focused, the selection goes back to the start of
the document. This was remedied in the .focus() method, but not in
response to native focus events, so when external code blurred then
refocused the editor, the selection would move to the top.

This broke section editing on wikis where ULS is installed: the
selection would be initialized at the start of the section, but then
ULS would load and blur the documentNode (by focusing the pasteTarget)
and then focus it again, so the selection would move to the top.

Instead of restoring the selection only in .focus(), restore it in
response to focus events on the documentNode. When this is done,
saving and restoring the scrollTop is no longer needed.

Bug: 56651
Change-Id: I14700174ee092f9b208215d31a7d1871078a89bf
[browser test] input string no longer hard coded

Change-Id: I361b3ea025e405d1fc5a2e12c3c85d177147b90d
Localisation updates from http://translatewiki.net.

Change-Id: I98da6500d27ee875387677665cd5e1fce4b22395
Merge "[browser test] add a test to edit with utf8 strings"
Merge "Make sure all links have target=_blank in the save dialog"
Make sure all links have target=_blank in the save dialog

Anything that uses getParsedMessage could contain a link.

Change-Id: I523edd935c4989e5929fca8891651c2287af973a
Localisation updates from http://translatewiki.net.

Change-Id: I684c1fb09fed13621a13ed63aee1451edd2b39af
Merge "Support private wikis by forwarding Cookie: headers to Parsoid"
[browser test] add a test to edit with utf8 strings

Change-Id: I88e475ee98bc8f696c1a1d0ad108c12a48fe7eee
Send the old category and language types to Parsoid for back compat

Change-Id: If67d822e1a22bc24aa0c816952081dc614f6e686
Fix image resize handles update on surface change

The resizing handles under ResizableNode are created in the location of the image
but if the page is edited and the image moves relative to the document, the handles
remained where the image was previously and not where its updated location is at.

This code fixes that bug by changing the CE event listening to the model's 'transact'
instead of 'history', and clears the cached offset when a 'transact' event happens.

Change-Id: Id0e4296dd89b24839ba68a534ca77d73c23b7434
Localisation updates from http://translatewiki.net.

Change-Id: If3bfcb58e16a5296d50b674f8003b1d245219e07
Merge "Work around crazy Chrome bug"
Work around crazy Chrome bug

When the ListToolGroup in the toolbar (the "More" section) is scrolled
down such that the top tool is partly obscured, and you hover over the
bottom half of the "More" button, the top tool displays a hover effect
and using the scroll wheel will scroll the list rather than the page.

This is because the list has a box-shadow that's 1em tall, and the
height of the "More" button is 2em. And in Chrome, pointer events
"work" even in the box-shadow area. Roan reported the Chrome bug at
https://code.google.com/p/chromium/issues/detail?id=314291

This change works around the bug by making the tools in the list
inline-block instead of block; for some reason the bug only affects
block elements.

Change-Id: I4ea3f41c91d0ff5d5cc150fe8acc3427f0ab5f3a
Slightly rephrased visualeditor-preference-language-description

To make it easier to understand and to translate.

Change-Id: I6d6bff9889422eb55be2fd14672569b251ead1de
More CSS fixes to the demo page.

Some ve-ui classes not converted to oo-ui, and toolbar -> surfaceToolbar.

Change-Id: I4b40ae6154c3ba619a266b7586983dd259853f6d
Merge "Fix appearance and messages on demo page"
Fix appearance and messages on demo page

Some 've-ui-toolbar-bar' classes hadn't been converted to OO.ui so the
toolbar had no border. Also removed a useless rule in mw.ViewPageTarget.css.

SA platform didn't override OO.ui.msg to use the ve.msg so no messages
were getting through.

Change-Id: Ieb5bc3c98d1c435ec194b201b517a688cd9b02b9
Merge "Fix metadata issues in newFromDocumentReplace"
Fix metadata issues in newFromDocumentReplace

* Our metadata insertions now need to be the same length as the data
  insertion, not one more, so:
** Remove the +1 in the listMetadata splice
** Shorten the metadata variable by dropping the merging of the
   metadata right before and right after the internal list; it was
   also including the metadata right after the internal list twice
*** We still need to deal with this in some way though, left a TODO
** Fix the metadata insertion test for these changes
* Fix null reference keys in the test data; we made all references
  keyed a while ago, but this test data was never updated for that
** The remapping of reference data doesn't remap auto/N keys yet,
   left a FIXME for that

Change-Id: I8ef4e6ee7c1808574d81d0b83294848afd400cd7
[browser test] Updated Ruby gems

Change-Id: I8c298efe8dd1abbb42b5c42ee0b8075a0aad9acf
Merge "Add OO.ui.Element.getDir"
Add OO.ui.Element.getDir

Stop using this.$.frame.dir - a horrible hack made of duct tape
and bubble gum.

Or perhaps rather, masking tape and post-it-notes...

Change-Id: I53690e4485974b95edbdd255c0b96c2f639c5261
Merge "Rename this.$ to this.$element, and this.$$ to this.$"
Rename this.$ to this.$element, and this.$$ to this.$

Objectives:
* Rename this.$ to this.$element
* Rename this.$$ to this.$
* Get rid of the need to use this.frame.$$
* Rename OO.ui.Element.get$$ to OO.ui.Element.getJQuery

Changes: (using Sublime Text regex patterns)
* Replace "get$$" with "getJQuery"
* Replace "\.(\$)([^\$a-zA-Z])" with ".$element$2"
* Replace "\.(\$\$)" with ".$"
* Replace "'$$'" with "'$'"
* Set this.$ to null in constructor of OO.ui.Window
* Set this.$ to this.frame.$ in initialize method of OO.ui.Window
* Replace "\.(frame.\$)([^\$a-zA-Z])" with ".\$$2"

Bonus:
* Use this.$() in a bunch of places where $() was erroneously used

Change-Id: If3d870124ab8d10f8223532cda95c2b2b075db94
Localisation updates from http://translatewiki.net.

Change-Id: If88d02e7665ed066cbe85ed2de9f096f0a3682dd
Localisation updates from http://translatewiki.net.

Change-Id: I08bfd179b75cda0a022b7cc5fb02489823758d11
Followup 6ec34a3deed: prevent focus loss on tool clicks

Change-Id: I7b756013ac234ad80937466a5881a1f92d8723d1
Merge "Expand highlighting support for syntaxhighlight module"
Provide a default implementation for OO.ui.msg

Just a simple message map in English. Also document localizaton-related
things in OO.ui

Change-Id: Ie74762238ca66747776610157c838dd75a864463
Support private wikis by forwarding Cookie: headers to Parsoid

If configured to do so, the VE API will forward the Cookie: header to
Parsoid. This allows VisualEditor to be used on read-restricted wikis.

Bug: 44483
Change-Id: If4a0cf1e5785b332ec9b014b783412805cf8af75
Get rid of OO.ui.extendObject and OO.ui.indexOf

Replaced uses of extendObject with $.extend . Replaced the one use of
OO.ui.indexOf with Array.prototype.indexOf because that's what
everything else was already using.

Change-Id: I63f40989057b8065ec977efafbf68d6e22c8e679
Merge "dm.MWTemplateSpecModel: Resolve translations through the TemplateData API"
Localisation updates from http://translatewiki.net.

Change-Id: Ifa1355bc7ae03cc2a45d1f723006667b4dce0b92
Merge "Add reset method to toolbar"
Add reset method to toolbar

Make toolbar resetting code reusable.

Change-Id: I4e796309fc721622c313f6ec5121b4d011c25c51
Add 'classes' and '$content' config options to OO.ui.Element

Makes it easier to setup elements in a single call.

Change-Id: I6aba6ca121972b984401d845d0e7253049c490e4
Merge "Fix: getDataFromDom tests should check for body or head"
Merge "Fix: files missing from demo and test runner"
Merge "Button tool to switch to edit source with changes"
Button tool to switch to edit source with changes

By serialising the current DOM, and injecting it into a form we can
end up in the source editor with our VE changes converted.

Bug: 50687
Change-Id: Iafcc02a737d9c6c3a59dce1caff130d47ca25650
Merge "mw.Platform: Only add split lang codes with a dash"
Merge "dm.ModelRegistry: Fix documentation for #addType"
[browser test] Removed visual_editor from file names

No longer needed, since the files are now in VisualEditor repository.

Change-Id: Id677c2630ff5a1ae2d49f62058d0d4fdebeaf381
Store inner whitespace of the body and compare it on conversion

Calculate and store the two inner whitespace values of the body in the
dm.Document. When converting back, make sure the first/last nodes
pre/post outer whitespace matches the inner left/right whitespace
of the body.

Bug: 54964
Change-Id: I45f1ffd63669f25a6cae878400bfe21719ed58ee
Fix: getDataFromDom tests should check for body or head

This wasn't updated when Roan split html into body & head, so
0 tests were running!

Change-Id: I4396b94426b2009f20707d64bf3d0f1ae651dbc8
Fix: files missing from demo and test runner

Change-Id: I783384a28147c9c7cdfdcb6639fea1f197cffb54
dm.MWTemplateSpecModel: Resolve translations through the TemplateData API

Also removed comment in ui.MWTransclusionDialog that was
copied from dm.MWTemplateSpecModel.

Bug: 50888
Change-Id: I9dcfef3ae65fe716bae91f703f9169171448797a
mw.Platform: Only add split lang codes with a dash

It was returning ['en', 'en'] instead of ['en'].

Change-Id: I3fcf44b39b09b99997e558c1fa636e5fcbff15ad
dm.ModelRegistry: Fix documentation for #addType

* Method is private.
* Code example and bullet list were rendered badly due to a
  single line break having no meaning in markdown (this makes
  80-char linebreaks easier). Need an empty line to separate block
  elements (e.g. paragraph from list, and list from next paragraph).
* Fixed #register reference to be a doc link instead. The invocation
  parenthesis look confusing (imply it needs no arguments).

Change-Id: Ib6cab4599ec3e310ec4355bdb1d60b1e53429c69
Add visualeditor-enable-mwmath preference to default user prefs

Stopping a warning for an undefined index created by I28862f3e62f5c.

Change-Id: Ic4ce78c769706332dc399d9b876af01c84845b9b
Use new BetaFetaures message fields

Depends on Iccf52b789682d in the BetaFeatures repo.

Change-Id: I45ac87e9c715a3bcb1663c83329e1581bcef7907
Localisation updates from http://translatewiki.net.

Change-Id: I83ca16b236954b6e5ff5fcb25b8e7d982dba1494
Merge "Rename 'formulæ' to 'formulae'."
Merge "[browser test] changes make it convenient to click Refs icon"
Rename 'formulæ' to 'formulae'.

Everyone loves a ligature, but within our codebase we should
be consistent, and sadly that means using en-US, not en-GB-archaic.

Also having non-basic latin characters in filenames is a bit
of a pain for developers.

Similarly for the i18n message, the ligature should go in
MessagesEn_gb if anywhere.

Also in this commit, re-saved the BF thumbnails as plain SVG.

Change-Id: I21a2bf040bed132d3f1c73c916c731d36e0ad852
[browser test] changes make it convenient to click Refs icon

Change-Id: I9a9ca50357601e9d254a8c86e172a497ca839387
[browser test] changes make it more convenient to click Transclusion icon

Change-Id: I21e5a0f11f58c7f199d9c36c2ac65705c295b397
[browser test] disabled indent/outdent are now spans not links

Change-Id: I8b8788f4c92219480936360efe7153ab093c274e
Merge "Convert the mass Beta Feature into feature-level ones, enabling formulæ"
[browser test] remove OS-specific part of elements using :title

Change-Id: I1d6db5b6bf9bec44f5646ed8f7096ce462a5707c
Merge "[browser test] fixed Cucumber tags"
[Browser tests] Fix a couple of stray ve-ui classes that moved to oo-ui

Change-Id: Ie89c0b1312b3150e7a3d9144d771a8996f0f606d
Merge "Allow direct opening of pages in the meta dialog"
Merge "Use a toolbar for the actions buttons in ve.init.mw.ViewPageTarget"
Merge "Add OO.ui.PopupTool"
Merge "Support programmatic tool titles"
Merge "Isolate links within OO.ui.Tool"
Allow direct opening of pages in the meta dialog

Objectives:

* Hamburger menu in actions area of toolbar
* Add tools that open specific pages in the meta dialog
* Fix support for using setPage in ve.ui.PagedOutlineLayout
* Allow passing setup config objects through window open calls
* Add dialog action, similar to inspector action
* Fix incorrect or missing documentation

Change-Id: I2d2c9b87554fb2a0c90ed6944a58b38a37efa712
Use a toolbar for the actions buttons in ve.init.mw.ViewPageTarget

Change-Id: I260059802379d8cab8ca175b7d7d32813e3ff10a
Add OO.ui.PopupTool

Tool that launches a popup when clicked.

Change-Id: Ie35b51f8160ad3fb844491e2799656413d4029c0
Support programmatic tool titles

Just override OO.ui.Tool.prototype.getTitle. The default implementation
uses the same static property as before.

Change-Id: I80fd95142cafac0e136cfe3031c16c371625b469
Isolate links within OO.ui.Tool

This allows other content to be added without it being nested inside an
<a> which results undesired visual and functional effects.

Change-Id: I667878fe4ae682712094a61bb4b411ac5fb999c7
[browser test] fixed Cucumber tags

There was no space between a couple of tags in a couple of files.

Change-Id: I1fadc61e41a4a0e210739106f5f8b28b2a460f01
Merge "Detangle triggers from OOUI"
Detangle triggers from OOUI

Changes:

* Pass toolGroup into tools instead of toolbar
* Split tool labels into title and accel
* Make toolbars provide accelerator labels
* Remove getLabelText method since it's not being used and is likely not useful
* Make tools update their own labels
* Only show accelerator information for triggers that are active in the surface
* Make surface toolbars listen to commands being added and update tools accordingly
* Introduce command object to encapsulate command info

Change-Id: Ieac4bfa63b63ac0a9dee154af3007a33b4d447ff
Document the 'small' config option in OO.ui.Dialog

Change-Id: I55f439ae348279a9a9289c113de4802719166964
Merge "Split oojs-ui from ve.ui"
Split oojs-ui from ve.ui

* Move and rename generic parts of ve.ui to OO.ui
* We now have a UI test suite because ve.Element (outside ve.ui)
  is now part of oojs-ui, so it needs a test suite.
* Added to the MW test run (just like we do for unicodejs).
* Updated csslint config (also added ve-mw and syntaxhighlight
  which were missing).

oojs-ui still depends on the TriggerRegistry in VE, this is addressed
in a follow-up commit.

Change-Id: Iec147155c1ddf20b73a4d15d87b8742207032312
Convert the mass Beta Feature into feature-level ones, enabling formulæ

Make every module that was formerly part of the experimental module its own
Beta Feature. For now, all of them are commented out except for formulæ editing
(mwmath). The "experimental" Beta Feature bucket is no more, but the preference
remains so that it can be set to both true and hidden on MediaWiki.org to let
all the different experimental flags.

The feature icons, previous mis-named "logo" and mis-identified as "screenshots"
are now renamed. One for the mwmath Beta Feature has been added (the rest need
creating before those can be enabled). The i18n descriptions now each identify
that the feature is an experimental one, and that caution is needed.

Change-Id: I28862f3e62f5c78aca33f11265aced1db67f4725
[browser test] workaround for VE bug probably caused by https://bugzilla.wikimedia.org/show_bug.cgi?id=56274

Change-Id: I2b872966399ecb6eb60da619eb9af52ae33f3aca
Localisation updates from http://translatewiki.net.

Change-Id: Ifdacd3e4f4da4f131c3515d7e10614d813a1c8c7
Merge changes Ia6ca85bc,I919135eb,Ia18bd8fc,I49dfc81f,Ia234f174,I06425e2c,Ia192331b,I5624ae07

* changes:
  Get rid of dmRendering hack in ve.ce.MWInternalLinkAnnotation
  Render resolved URLs for href and src attributes in CE
  Give ce.Annotations a reference to their ce.ContentBranchNode
  Track the original HTMLDocument in ve.dm.Document
  Create CE nodes and annotations with the correct $$
  Add ve.resolveUrl for URL resolution
  Don't render href as src in MWBlockImageNode
  Rename 'html' to 'body' in converter tests
Merge "Resolve rendered URLs according to the provided <base>"
Merge "Filter DOM load/save deferreds through ve.track callback"
Merge "Remove ve.ce.Surface.static.textPattern"
Merge "Re-word visualeditor-preference-enable to not specify NSes"
Merge "Add a placeholder into an empty transclusion"
Re-word visualeditor-preference-enable to not specify NSes

Bug: 56205
Change-Id: I9d7786b34beecede60d229878000423907ac7cb1
Merge "[browser test] don't run cursor test pending Bug 56068 and review"
Merge "[browser test] organize tags for running in beta, test2"
[browser test] don't run cursor test pending Bug 56068 and review

Change-Id: If7f7b063398adef822f1a4d1bfa385f1517b8533
[browser test] organize tags for running in beta, test2

Change-Id: I706cd995c9e8c5529782621288e24952cd6b3b63
Get rid of dmRendering hack in ve.ce.MWInternalLinkAnnotation

Centralize href computation in getHref(). Because getHref() is provided
by the generic LinkAnnotation class, the subclass implementation is
now simpler.

Bug: 51487
Change-Id: Ia6ca85bc84b4f4453b572285836adb631e8d0683
Render resolved URLs for href and src attributes in CE

URLs are resolved according to the <base> URL from the Parsoid DOM.
For instance, a link can have its href set to '../Foo' in the DM, and
the target will show up as '../Foo' in the link inspector, but the CE
rendering will be <a href="http://localhost/Foo"> (assuming Parsoid sent
<base href="http://localhost/wiki/Bar">).

Bug: 48915
Change-Id: I919135eb758c82361525078f276ca193dc4c4820
Give ce.Annotations a reference to their ce.ContentBranchNode

This gives them a way to reach the dm.Document, which is needed
for ce.Annotations to do URL resolution.

Change-Id: Ia18bd8fc3510ad1b627644cd2c6ebcf148254e05
Track the original HTMLDocument in ve.dm.Document

Add it as an optional parameter to the constructor, and create a new
one if omitted.

This is going to be used to resolve URLs according to the right <base>,
but really that's a hack and we should come up with a better way to
track metadata from the <head>.

Change-Id: I49dfc81ff793d73e08a20e502d681a15613d23f7
Create CE nodes and annotations with the correct $$

Most of CE wasn't passing through $$ at all. Also fix CE tests that
weren't passing the required surface parameter to the ce.Document
constructor.

Change-Id: Ia234f174050f4b2666ec20e8acc24c6aa4305202
Add ve.resolveUrl for URL resolution

Use it to replace fullUrl in the tests

Change-Id: I06425e2c90a08a6f622e083f9297444f6f4672e8
Don't render href as src in MWBlockImageNode

<a src="..."> isn't a thing

Change-Id: Ia192331b88f17480f4285697e024bda25078968b
Rename 'html' to 'body' in converter tests

Because that's what it is now since 'head' was added. Also removed
the wrapping <body> tag (now added by the test runner) and renamed
normalizedHtml to normalizedBody.

Change-Id: I5624ae076c5e661d2789e499cd28e8282c885409
[browser tests] add the double-logout fix to the other Before clause

Change-Id: I23e73d0c91b9d7f77fb8390fcae22ac00ce086e1
Resolve rendered URLs according to the provided <base>

This is done by using the computed property value rather than the
literal attribute value when rendering href and src attributes.
Helpfully, this provides perfect URL resolution natively in the browser,
which means the document's <base> is respected and all that good stuff.

For GeneratedContentNodes, we also need to find all DOM elements inside
the rendered DOM that have href or src attributes and resolve those.
This is done in the new getRenderedDomElements() function, which the
existing cleanup steps (remove <link>/<meta>/<style>, clone for
correct document) were moved into.

In order to make sure that the computed values are always computed
correctly, we need to make sure that in cases where HTML strings
in data-mw are parsed, they're parsed in the context of the correct
document so the correct <base> is applied.

We still need to solve this problem for models that actually store and
edit an href or src as an attribute. I'll post more about that on
bug 48915.

Bug: 48915
Change-Id: Iaccb9e3fc05cd151a0f5e632c8d3bd3568735309
Remove ve.ce.Surface.static.textPattern

It hasn't been used for a while.

Change-Id: I7d004f38bc76ef8a794294a7c685ada73ab7855e
Merge "Don't corrupt categories/langlinks with new types"
Localisation updates from http://translatewiki.net.

Change-Id: I7cf3010cef91413e4a3b704b86b45c83879f05b1
Localisation updates from http://translatewiki.net.

Change-Id: I188bb6fc2d463a42203edb958ec245c24be31935
Merge "Fixup selection after ContentBranchNode rerender"
Merge changes Iaba76ac1,Ib15c39f3,If5a3b4d4,I44425d26,I8f162894

* changes:
  .change( null, foo ) -> .setSelection( foo )
  Remove SurfaceObserver locking (unused)
  Implement ve.dm.Surface.prototype.undo() and redo() in terms of change()
  Enslave dm.Surface to dm.Document
  Remove dm.Surface's 'change' event
Localisation updates from http://translatewiki.net.

Change-Id: I50ac1c99bcabad044e30618fb2a947789f6ccced
Merge changes Ifeb1a1fc,I521eff00

* changes:
  Migrate away from using the 'change' event in dm.Surface
  Make dm.Surface's 'select' event more useful
Fixup selection after ContentBranchNode rerender

ContentBranchNode renderContents changes the browser selection, so we
need to change it back.

ve.ce.ContentBranchNode.js
* When rerendering, set a flag on ve.ce.Surface

ve.ce.Surface.js
* On model documentUpdate, reapply selection if flag set

Change-Id: Ib8a168e6ec674b9d8021423f21f7acca75c2fd7c
.change( null, foo ) -> .setSelection( foo )

Change-Id: Iaba76ac17888a7825f5a9cd1c383d4f429454278
Remove SurfaceObserver locking (unused)

The SurfaceObserver lock guarded against setTimeout calls, but the lock
was only ever used synchronously.

Remove 'lock' and 'unlock' events. Instead, re-sync the SurfaceObserver
by listening to the 'documentUpdate' and 'select' events.

Signed-off-by: Roan Kattouw <roan.kattouw@gmail.com>
Change-Id: Ib15c39f3d25677da70625581b3b2765ae66994b4
Implement ve.dm.Surface.prototype.undo() and redo() in terms of change()

...or really changeInternal(), so we can avoid adding undo transactions
to the undo stack.

Also get rid of the pattern where undo() and redo() return a selection
which the caller then has to restore, and instead just restore the
selection.

Bug: 53224
Change-Id: If5a3b4d4162e9f0713ee9cd26e79a66efe52770f
Enslave dm.Surface to dm.Document

* Replace surface 'transact' event with 'documentUpdate' event
* Have surface listen for all document transactions and update selection
  as appropriate (as well as emitting 'documentUpdate')
* Implement change() in terms of setSelection()
** Queue 'contextChange' events so contextChange is only emitted once
** Use this.transacting flag to prevent setSelection() (which is called
   because the model emits transact events) from doing too much
** Behavioral change: lock/unlock now emitted separately for
   transaction and selection changes

Change-Id: I44425d260ec70758f99d13f99e41f5c993d260c2
Remove dm.Surface's 'change' event

ve.dm.Surface.js:
* Stop emitting 'change' and remove its event documentation

ve.ce.Surface.js:
* Listen to 'select' instead of 'change'
* Perform a CE surface update after model-based keydown handling

ve.dm.Surface.test.js:
* Stop asserting that 'change' is emitted

Change-Id: I8f16289493e835d890709c6dfe093d04c18522b6
[browser test] Workaround for the problem when Cucumber hook executes twice

Bug: 56116
Change-Id: I99bf48b1452647b42edd97dc47e8664b08b7667a
[browser test] Use the latest version of mediawiki-selenium gem

Change-Id: I14baca7b9cfb6a76a4e026ea5c6673b87ced3c0f
Localisation updates from http://translatewiki.net.

Change-Id: I7aabcf823be64924fd40b0733ac1d6aa23529871
Merge "Split ext.visualEditor.experimental into specific modules"
Filter DOM load/save deferreds through ve.track callback

Binding ve.init.mw.Target#onLoad and the anonymous function which calls ve#track
with timing data to the resolution of the same deferred makes the timing
measurement sensitive to how long it takes ve.init.mw.Target#onLoad to yield,
which in turns depends on whether the requisite ResourceLoader modules for
setting up the editing surface are ready. This muddles the definition of what
we're actually measuring, making it dependent on a race condition.

This patch moves the tracking call to a filter function through which the jqXHR
deferred is threaded. This ensures that the 'duration' datapoint on the domSave
and domLoad events captures just the time spent talking with the API.

Change-Id: I6e162014a4043d4ff9422131ae87fb25d0ab4c29
Split ext.visualEditor.experimental into specific modules

Math, hiero, language and alienextension are now each in their own
module. Kept the experimental module for backwards compatibility,
it just has all of its constituent modules as dependencies.

MWExperimentalTool.js was split up, and ExperimentalTool.js was
renamed to LanguageInspectorTool.js.

Change-Id: I63b49dfbdb59dc9a494049553cc0c01e89e48826
Merge "doc: Adding missing @static to a static dm.GeneratedContentNode method"
Use jsdifflib for QUnit diff

Because QUnit's inline diff is terrible for large diffs,
especially when there are block whitespaces changes.

Change-Id: I786fb981b02777ede38c4bee261f9e32f8f908ed
Merge "Revert "Followup c41f96c: doc parameter in ve.dm.InternalList constructor is not optional, remove check""
Revert "Followup c41f96c: doc parameter in ve.dm.InternalList constructor is not optional, remove check"

> Uncaught TypeError: Cannot call method 'connect' of undefined

This reverts commit fb4dcf30302aa8ab449ce9f7870f3b55a0326223.

Change-Id: I9db92e7bf339260d8de0a9406842bdb241b8ee80
doc: Adding missing @static to a static dm.GeneratedContentNode method

Follows-up 62c06d0.

Change-Id: I7746ab1d0a445c69e29a0fde96773a89b4108dd5
Merge "Make category suggestions dropdown appear below the input box"
Merge "Followup c41f96c: doc parameter in ve.dm.InternalList constructor is not optional, remove check"
Merge "Add Moriel Schottlender to AUTHORS.txt and authors string"
Merge "Added SVG logos in new style, rm'd old pngs"
Localisation updates from http://translatewiki.net.

Change-Id: Ie35d9436bf267ee758f9bfa773a26c06d6dcee66
Migrate away from using the 'change' event in dm.Surface

Instead, listen to 'select', or to 'transact' on the dm.Document.

This commit only fixes uses outside of the dm/ce.Surface ecosystem.
ce.Surface still listens to 'change'.

ve.init.mw.ViewPageTarget.js:
* Rename onSurfaceModelTransact to clearSaveDialogDiff and bind it to
  the document's transact event instead
* Rename onSurfaceModelChange to checkForWikitextWarning and bind it
  to the surface's transact event. This is needed because the function
  inspects the surface's selection, which isn't yet in a consistent
  state when the document's transact event fires

ve.ui.MWReferenceDialog.js:
* Rename onSurfaceChange to onDocumentTransact and rebind accordingly

ve.ce.ProtectedNode.js:
* Get rid of onSurfaceModelChange
* Instead, bind positionPhantoms to the document's transact event
  directly, and only bind it while phantoms are visible

ve.ui.Context.js:
* Rename onChange to onModelSelect and rebind accordingly
* Rename afterChange to afterModelSelect
* Drop check for undefined selection, no longer needed now that we're
  listening to a finer-grained event

ve.ce.Surface.test.js:
* Listen to 'select' instead of 'change'

Change-Id: Ifeb1a1fc5427696f2aae5441d4b54dde366793e0
Make dm.Surface's 'select' event more useful

It was previously emitted before the selection was updated and with the
old selection as a parameter. Instead, emit it afterwards, and make sure
it's emitted even if the selection changes because it was translated
for a transaction.

Also correct its event documentation, which seems to have been copied
from a UI class somewhere.

Change-Id: I521eff0095959572587c0ecffd24dbf322e12d82
Add Moriel Schottlender to AUTHORS.txt and authors string

Change-Id: Id6e540aaa4d7b51e068a41f8eceba6b386fa2064
[browser test] Moving shared code to mediawiki-selenium Ruby gem

Bug: 53579
Change-Id: I4ef8b63f485b0274f252cf95e566f0484615e8cf
Merge "Use update rather than show in focusable node re-render"
Defer selection-triggered updates in ve.ui.Context

Move selection change handling (closing the popup if open, and updating
the context toolbar) to .afterChange(). Every time .onChange() detects
a selection change, it schedules a call to afterChange(). These calls
are batched so that multiple selection changes in the same tick cause
afterChange() to be called only once.

Deferring these updates causes them to no longer occur while a 'change'
event is being emitted. This means that if an inspectors' close handler
calls .change(), that call is now no longer nested inside another
.change() call and doesn't run afoul of any render locks set by the
caller of the outer .change().

Bug: 54675
Change-Id: Iae2f41a83b5d64251a54e42303100e84a5c25561
Ignore change events while opening and closing inspectors

AnnotationInspector changes the selection from both its open and close
handlers, which can cause recursive calls to .hide() and .update()

Change-Id: Ic334f9b8b335fe1aaac2dc98dc6ea9fd9d5707ff
Merge "Use a sane recursion guard in ve.ui.Context.prototype.hide()"
Merge "Fix typo in documentation for ve.ce.View.prototype.getModel"
Use update rather than show in focusable node re-render

Update checks if there's actually a context menu to show. We also need
to pass through the parameters for show.

This was causing the last-shown context menu to appears after resizing
an inline image (which has no context menu).

Change-Id: I8f46f71e2fba6896fe10054f0d2a679c6f23eb9c
Merge "Followup 1878c7c5: fix check for nonexistent property .draggingAndDropping"
Remove simpleArray utilities from ve.js and use oojs instead

Change-Id: I23710ff50378f4069b8a0dea89f0491884acd377
Merge "Update oojs to v1.0.5"
Update oojs to v1.0.5

Code:
  http://trevorparscal.github.io/oojs/releases/oojs-1.0.5.js

Release notes:
  https://github.com/trevorparscal/oojs/blob/v1.0.5/History.md

Change-Id: I1117bd5bef70783039db18849f85215fcb346ada
Followup bb03e8f: fix toolbar floating

Small mistake splitting the ooui commit, whoops

Change-Id: I166df38234f432ab2ef00e7d156e49cba16ede99
Add bin/ directory with updateStaticLoaders and generateDocs

Adding a symlink in .docs/generate.sh because of Jenkins and
possibly other uses.

Change-Id: Ieb56852d0d0b978fbc1cbb873204d9e457cf969c
Merge "Rename ui.Tool.static.canEditModel to isCompatibleWith"
Merge "Rename oo.js to oojs.js per library name"
Merge "Remove oo from ve.js closure"
Merge "Remove ve.Factory and ve.Registry and use oojs instead"
Merge "Cache multiple requests for $resizable's offset"
Merge "Recalculate $resizable offset when positioning resize label"
Cache multiple requests for $resizable's offset

Both the resize handles and the size label position themselves
using $resizable's relative offset, so we can optimise by
caching that result.

Change-Id: Ic225b15cfcece8d5c2e782e1e667d854f805c6fb
Recalculate $resizable offset when positioning resize label

Because it can change. Currently the resize label is not
positioned correctly if you use three of four resize handles.

Change-Id: I1a28bc57fda1097c94047fd7690ad8d403cdd478
Merge "Localisation updates from http://translatewiki.net."
Localisation updates from http://translatewiki.net.

Change-Id: I93cd3eba912f2ae9aac9e1fb45cb38ae7d775e3a
Rename ui.Tool.static.canEditModel to isCompatibleWith

Change-Id: Ic7583f0966946c870f38a2e7ad06e558238c8794
Rename oo.js to oojs.js per library name

Change-Id: I9f02a4438a18243022506b5a2fcc445af03aa945
Remove oo from ve.js closure

Instead use OO directly. Also remove ve.createObject, which is
unused now that ve.Registry and ve.Factory have been moved to oojs.

Change-Id: I3470b6660107ddd0bdf4a43c50d191a1bb1cc4d8
Remove ve.Factory and ve.Registry and use oojs instead

Change-Id: I2717300e6cc6102296a2b8d063d344fa5897c825
Remove ve.getHash and use getHash from oojs instead

Change-Id: Ib688a3ba0ab07e0d0dc328a3878440756d1103fe
Update oojs to v1.0.4

Changes since v1.0.2:
* Added oo.getHash
* Added oo.Registry
* Added oo.Factory
* Bug fixes for oo.EventEmitter

Code:
  http://trevorparscal.github.io/oojs/releases/oojs-1.0.4.js

Release notes:
  https://github.com/trevorparscal/oojs/blob/v1.0.4/History.md

Change-Id: Iafc49bd148a50b19e5e9f0a0add056ad858533de
Rename @emits to @fires so we're forward compatible with JSDuck 5

Instead of using @emits in both, use our custom @fires in
production (JSDuck 4), and in the future it'll just naturally
use the native one.

This way we can also index oojs without issues, which seems to
have started using @fires already.

Change-Id: I7c3b56dd112626d57fa87ab995d205fb782a0149
Merge "Fix save dialog crash on load error"
Added SVG logos in new style, rm'd old pngs

Change-Id: I1f77c645a9fc92bc2a81391107ddb3a54ef37a50
Use OO.EventEmitter instead of ve.EventEmitter

Change-Id: Ie35e5f51a8d3c0d7f4fa46230b7b37112df610b9
Fix save dialog crash on load error

If there was an error loading the HTML from Parsoid, ViewPageTarget
would try to tear down the save dialog, which caused a crash because
the save dialog doesn't exist yet at that point.

Change-Id: Ia50756a19cb775be96b90e87b642eb2a38f254ce
Localisation updates from http://translatewiki.net.

Change-Id: Icec2461d9f8fb25f7fb3378d3999f4095503c0bb
Fix typo in documentation for ve.ce.View.prototype.getModel

Change-Id: I176898bc6714bd240ca0776406d11c60f2b2fd96
Merge "Add requirements to BetaFeatures hook"
[browser test] cursor feature was not tagged @login

Change-Id: I587ad033c93078d8e626840de3b3eedc73b83516
Use a sane recursion guard in ve.ui.Context.prototype.hide()

The previous recursion "guard" relied on the recursion to occur for
the function to work correctly, which was very confusing. Additionally,
it didn't actually work: if the inspector's onClose handler changed
the selection (which is common), .hide() would recurse and the recursion
guard didn't catch this (inspector wasn't undefined yet). Fortunately
all that did was call .close() on the inspector again, which was caught
by .close()'s own recursion guard.

Instead, simply use this.hiding as a recursion guard, and refactor the
function so it doesn't do two different things depending on whether it's
expecting recursion or not.

Change-Id: I09eb9229530468ee319ca53b730784a3f632375d
Followup 1878c7c5: fix check for nonexistent property .draggingAndDropping

It's always been named .relocating

Change-Id: I2fcb28cdad037880759420986d8010ee5711d691
Merge "Add a node type for numbered external links"
Localisation updates from http://translatewiki.net.

Change-Id: I8d5789a9324d2db53d6f618d7dd2d041ed73a3ac
Add a node type for numbered external links

Since I0f0a826c in Parsoid, numbered external links are now empty
<a rel="mw:ExtLink"></a> tags. This means we have to put in a node type
for them to prevent them from being considered empty annotations and
getting converted to alienMeta.

MWNumberedExternalLinkNode is protected and focusable to avoid making
the link text (which isn't editable) clickable. It isn't inspectable
yet, we need to work on that.

Bug: 53505
Change-Id: I83f69695f3974089e51a84e799f31ab6ed879e05
Localisation updates from http://translatewiki.net.

Change-Id: I4bf14a6a85bf34125b4982578d476a2a0cf7f5d7
Remove ve.{inheritClass,mixinClass} and use OO instead

Change-Id: I8df9226a358a76b661eab6e967ff0d63d361f691
Merge "Document constructor params for dm.MWMathNode and dm.MWExtensionNode"
Document constructor params for dm.MWMathNode and dm.MWExtensionNode

Follows-up Ib909c5fb02.

Change-Id: Ia3dfbabc8dde9f1e65e8fbb0e4d67f868031247a
Expand highlighting support for syntaxhighlight module

Part of the ongoing effort to expand the amount of languages that can be
highlighted by syntaxhighlight module to match that of SyntaxHighlight
GeSHi extension.
The module now separates language names with their file names.

Change-Id: Iaf907ebeadc9432719a45f4e9e8d580bb32ca668
[Browser tests] identifier for anonymous warning changed for test2

Change-Id: Idfdd6db441205280373f8d24bf0a693b46eed1af
Merge "Split out popup functionality from ve.ui.PopupButtonWidget to ve.ui.PopuppableElement"
Merge "Localisation updates from http://translatewiki.net."
Localisation updates from http://translatewiki.net.

Change-Id: I199fc47c1034f877d4f8777569d867024d59261f
Merge "Rename performance.parsoid.domLoad to performance.domLoad"
Merge "Use .done()/.fail() instead of 'success'/'error'"
Split out popup functionality from ve.ui.PopupButtonWidget to ve.ui.PopuppableElement

Change-Id: I522d852d81d9674723a3262da3f030417f4fc3be
Merge "Followup 8a4058584: use a single media source for rerendering images"
Merge "Follow-up 8dfbc5baa: Really don't select unselectable items"
[browser test] Updated Ruby gems

Change-Id: I78cbac61ca534957a39474a82306aaa954ab9de1
Follow-up 8dfbc5baa: Really don't select unselectable items

SelectWidget would refuse to select unselectable items on mousedown or
mousemove, but would happily do so on mouseup. This meant unselectable
items weren't actually unselectable.

This broke the link inspector: if you clicked on the text
"External link", for instance (a ui.MenuSectionItemWidget), that "item"
would be selected, the link target input would be cleared, if you exited
the link inspector in any way the link would be unlinked, and any new
link inspector you opened would have a completely non-functional dropdown.

Change-Id: I7faa3d23b51b9cb93e68414584b9f433ea1f656a
Make category suggestions dropdown appear below the input box

Right now it's anchored to the bottom left of the category widget as a
whole, even if the text box is pushed farther to the right by existing
categories.

Change-Id: I7f2ca12b82d17c27fb3b87cb819a2a99a9fed108
Don't corrupt categories/langlinks with new types

Parsoid changed these types from mw:WikiLink/{Category,Language}
to mw:PageProp/{Category,Language} in I0f0a826c. We had previously
added support for them in 4d91e4ed but code overwrote the new types
with the old ones on the way out, triggering the DOM corruption warning.

Change-Id: I768ec2ffd623e5a01f18959277786697603a97f0
Initialize the save dialog correctly even if the sanity check failed

A very weird if statement caused pretty much all logic for displaying
the 'save' panel to be skipped if the sanity check had failed. The
result was that all buttons were displayed at the bottom of the
save dialog, even those that don't make sense in that context.

Change-Id: I628ebc05830fb25d67ff181852a1e56f0e25dee9
Use .done()/.fail() instead of 'success'/'error'

'success' and 'error' are deprecated.

Also make all generateContents() promises abortable.

Change-Id: I8f95e9386f7749e635ce3715389896a0ccdb7523
Followup 8a4058584: use a single media source for rerendering images

The code asked all media sources for a rerender and used whichever one
came in first, which meant that it might potentially render the wrong
image, or reject the promise if one source served an error response
before a good response from another source arrived.

Also reject the promise if we can't find an image source in the response.

Change-Id: I6b516ad41b8a9e2abd440625bb76f3e1abb54520
Followup c41f96c: doc parameter in ve.dm.InternalList constructor is not optional, remove check

Change-Id: I2d699483330d84647cb256272535dde6b8f2437c
Merge "Show a label with the current dimensions while resizing"
Use CSS for handling empty labels

Objective:
* Use CSS to control the styling of empty labels

Changes:

ve.ui.LabeledElement.js
* Remove emptyHtml static property
* Add/remove ve-ui-labeledElement-empty class when setting label

ve.ui.ToolGroup.css
* Hide empty labels inside popup tool group handles

ve.ui.Widget.css
* Hide empty labels inside icon button widgets

ve.ui.Toolbar.js
* Only apply default catch-all tool group properties if they were previously undefined

ve.ui.IconButtonWidget.js
* Remove emptyHtml static property

Change-Id: Icd3f772942e74b547e926829c181e914182feb75
Add a placeholder into an empty transclusion

If a template was setup without a default output and returns an empty result
to the transclusion, the user could not access the template dialog because
there was nowhere to hover over to get it visible. This commit checks the
output from the template after it was rendered with the given parameters
and if it returns empty, it adds a placeholder to the output so to give
the users way to access that template's transclusion dialog and edit
or remove it.

Bug: 55810
Change-Id: Ib842b401e74d79b6382cada6bb7c6048b713977c
Merge "Cleanup on save dialog cruft & fix updateWatchLink"
Cleanup on save dialog cruft & fix updateWatchLink

Change-Id: I730003726db0164e1bef8bddcd45e31df1373618
Merge "Re-render images after resize"
Rename performance.parsoid.domLoad to performance.domLoad

See
https://gerrit.wikimedia.org/r/#/c/89347/2/modules/ve-mw/init/ve.init.mw.Target.js
for the reasoning. Ori offered to adjust the consumers for this.

Change-Id: I835f0752ab3a4c8ad56eec437668423ba8b81c24
Localisation updates from http://translatewiki.net.

Change-Id: If5332dacaac7292368f082c1e77bf11e0f7ee173
Merge "ve.track: add topic-based analytic event subscription"
ve.track: add topic-based analytic event subscription

Replace ve.trackRegisterHandler with two methods: ve.trackSubscribe and
ve.trackSubscribeAll. The former takes an additional string argument 'topic',
which specifies a string prefix on which to match event names. The callback is
only called on matching events. The latter, ve.trackSubscribeAll, binds a
handler to all track events, regardless of topic.

This patch simplifies argument-handling by eliminating variadic ve.track calls
in favor of a single object that encodes all event data. The loose coupling of
track event emitters and subscribers makes relying on unnamed positional
argument conventions brittle; property access works better.

Change-Id: I3b58ce0f48ad3c9b56fcaa9c2226cc79bbcd4051
Show a label with the current dimensions while resizing

* Add config option to disable if required
* Centre label within resize handles
* Only show when resizing
* Sexy opacity transitions, rounded corners and multiplication
  character

Bug: 54297
Change-Id: Ic49430ce3302f780ae4b05d1fa29e14db1192c84
Re-render images after resize

Using the MW APIs get a resized version of the image and use
GeneratedContentNode to cache the url.

Bug: 55697
Change-Id: I418f7e1464663f447d46de7ffc29aa5f52d23b12
Remove -ms-transition

Because it never existed.

Change-Id: Iaae7e8f11efb0a9853130bcdad8b643c06a1eed8
Merge "Log DOM save timing; update existing ve.track calls"
Merge "Match text selection background colour to node highlight"
Merge "Language widget ULS call fix"
Merge "Misc UI fixes"
Merge "Rename storeDomElements to storeGeneratedContents"
Merge "Resizable node live preview"
Resizable node live preview

Resizes the $resizable element as you drag.
Can be disabled by setting the 'outline' config option.

FocusableNode
* Redraw on resize

ProtectedNode
* Destroy and prevent creation of phantoms on resize

MWInlineImageNode
* Correctly pass this.$image to ResizableNode

Bug: 54298
Change-Id: I7d6d345af8bb4712bbf154072b4704943a5a620d
Regenerate static loaders to include newly added ui.layouts

Follows-up 4efc6ca.

Change-Id: I51f3c861c88f93bf76f6c0f16ab0c3928b30b839
Merge "Use dimensions cached in resizeInfo for resize calculations"
Merge "Split out setResizableHandlesPosition in ResizableNode"
Merge "Add more resize events"
Misc UI fixes

* Followup 75270e24: use this.surface directly in MWMetaDialog
* Document that MWDialogTools need a SurfaceToolbar
* Namespace CE events and CSS classes with ve-ce- rather than ve-ui-
* Namespace SurfaceToolbar CSS classes correctly and put them in their
  own CSS file

Change-Id: I9e70917d9c220b39e68833f67ed49fae7f7cbe6a
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
Merge "Convert MWBlockImage dimensions to numbers and update tests"
Localisation updates from http://translatewiki.net.

Change-Id: Id14c11417b382fe94b8ce118419f4e8a524dbdfe
Use existing ve config for pluginModules

Change-Id: I16a50f342e0794a98e648afc7251e8341270e9c9
Convert MWBlockImage dimensions to numbers and update tests

MWInlineImage already does this but it wasn't copied over to
MWBlockImage.

Change-Id: I9f34182b30ae72beb7b5c3d5fde2f08185cba663
Merge "'clearMessage' is a method of MWSaveDialog, not ViewPageTarget"
'clearMessage' is a method of MWSaveDialog, not ViewPageTarget

Fixes a small casualty left behind by 972c9a46b7.

Bug: 55726
Change-Id: I8cf8418dede002068fb1090d940b09c3bb91c196
Merge "Enable VisualEditor using Beta Features"
Use dimensions cached in resizeInfo for resize calculations

The logic requires the size of $resizable when the resizing started.
This is already stored in this.resizeInfo, but for some reason the
code recalculates every time, which is both inefficient and wrong
(but not a problem at the moment as $resizable doesn't change size
until resizeEnd).

Change-Id: I37a3c98e24b9e7d5e1970212975cef5ce9ef8a99
Split out setResizableHandlesPosition in ResizableNode

Change-Id: I254fc1851abdc7477e2067d1a6b5406f286e8668
Add more resize events

'resize' is actually 'resizeEnd'. Added 'resizeStart' and 'resizing'
which is triggered on mouse move.

Change-Id: I13c6e426cbcc965b3db50082c5294ca76979fe57
Localisation updates from http://translatewiki.net.

Change-Id: I6dd841140bbc62cf049c2f380b04c4ff122d55ca
Localisation updates from http://translatewiki.net.

Change-Id: I99b5282ccb09a08c2f8c88d57245a4043d37a77c
Log DOM save timing; update existing ve.track calls

* For consistency with target.loading, target.saving should be either a boolean
  false or a jqXHR, with the latter type indicating a pending save attempt.
* Rename 'DOM Retrieved' topic to 'performance.parsoid.domLoad' (and thus
  inaugurate a convention of hierarchical, dot-separated topic names).
* Add a 'performance.parsoid.domSave', which is a near-mirror of domLoad, but
  measures the time it takes to save a DOM.
* Remove three old ve.track events, because they are not used and because their
  name and signature are not consistent with current usage.
  - page-save-attempt
  - page-save-success
  - page-edit-impression

Change-Id: I54602394eee5d6d9229c01d868cb366c9f56b2c3
Remove ve.isMixedIn(), it's unused and it's evil

Change-Id: I5a5fc4c8eb56530dbac3bc32122faf20b8c92aa5
Localisation updates from http://translatewiki.net.

Change-Id: I832205a23908ceddb3ac864a1dead3ba7b79faf6
Merge "Make makeStaticLoader.php pass phpcs"
Merge changes I160e55ad,Idd0592d6,I4d403f1b

* changes:
  Remove ve.ce.Node.prototype.onAttributeChange
  Remove ve.ce.ImageNode.prototype.onUpdate
  Remove .tagName from ce.MWInlineImageNode
Make makeStaticLoader.php pass phpcs

Change-Id: Ibdf95ca3c3047d497b05cbe195f8b839f111f12e
Merge "[browser test] icons appear hovering when cursor is on object"
[browser test] icons appear hovering when cursor is on object

Change-Id: I296445d0ec11f375ddb30f293ec3542ccc6332d6
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
Merge "Fix empty document length check in MWReferenceDialog"
Merge "ve.ce.Surface.getSelectionRect() can return null"
Merge "Add .isFocusable() to ve.ce.Node as a shortcut"
Merge "Stop using ve.isMixedIn() to check if a node is focusable"
Add .isFocusable() to ve.ce.Node as a shortcut

Change-Id: Ia2d3023100859e94f25bf50ed7298370b8d57c42
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
Add requirements to BetaFeatures hook

Change-Id: Ifc809f49e1cf03015dbb295b6b092b4181edc38b
Enable VisualEditor using Beta Features

Change-Id: I76ba788751dacc24cdbc667b4d24f1656f0ade44
Match text selection background colour to node highlight

This was probably correct by default on OSX but Ubuntu's
default theme uses an orange highlight, and Windows uses
dark blue.

Change-Id: I601c2d27f6d928b38799f3a6502de5be1dccc199
Merge "Generalise the way extra modules are loaded"
Remove ve.ce.ImageNode.prototype.onUpdate

Was empty.

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

Change-Id: Idd0592d6f30388c9952e110ff6fff008bb465877
Remove .tagName from ce.MWInlineImageNode

Was unused, because this.$ is always overwritten in the constructor

Change-Id: I4d403f1b89351fb7d23131f944406d5a088fdeef
Generalise the way extra modules are loaded

Change-Id: Icd453421b022a6450d1358edbe2132e49ca0b3bf
Merge "Make MWInlineImages resizable"
Merge "Resizeable node updates context after mouse up"
Localisation updates from http://translatewiki.net.

Change-Id: Icca7dea6c4c55e435bff7f3131c20be74a4cb146
[browser tests] remove cruft and order page.rb file

Change-Id: I7d7cba0256e1d2631cdc4b73026c89cb5c85e0f5
Make MWInlineImages resizable

Because they are.

Change-Id: Ib2ff3ac6e9c5ed896486c93c48697d232b892493
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
Merge "Remove SyntaxHighlight from the experimental set"
Merge "Use ve.ui.PushButton instead of ve.ui.Button in ve.ui.SyntaxHighlightDialog"
Remove SyntaxHighlight from the experimental set

This completely disables it while we fix the issues it causes.

Bug: 55533
Bug: 55453
Change-Id: I76e5d81957187535aab870e6ddbd1dbbb88f1315
Use ve.ui.PushButton instead of ve.ui.Button in ve.ui.SyntaxHighlightDialog

Change-Id: I1b30e300492e682a477615a70fc7319c1b6d794e
Merge "Snap resizables to a grid when the shift key is held"
Snap resizables to a grid when the shift key is held

Defaults to 10px.

Change-Id: Idf760c446778b437edbc3cb209b04cbee1d96fb7
Language widget ULS call fix

Because of the change to ButtonWidget, the button returned false after
onClick and as a result, ULS dialog didn't open.

This fix adds a fake 'href' value to the PushButtonWidget instance
in ve.ui.LanguageInputWidget so clicking the 'change language' button
continues to evoke ULS.

(Notice, this widget will soon be split into ve-MW with a smaller fallback
widget in core, but for now, this fixes the fact ULS doesn't appear when it
should)

Change-Id: I32eabdc5ee1b3681c20c756f45a3257c7a0b5681
ui.MWLinkTargetInputWidget: Fix crash on invalid input

Though the initialisation works since core has been fixed, there
are still plently of cases where we take real user input that can
genuinely be invalid.

Most notably, you couldn't make a link to [[.com]] because the
link input widget would crash on an exception from mw.Title.

Even after core was fixed (and ".com" is now valid), one still
couldn't make that link. This time because '.' is an invalid title,
and we create a Title object for that while typing ".com".

ve.ui.MWLinkTargetInputWidget#getLookupMenuItemsFromData:
* Guarded against mw.Title throwing by using newFromText
  and checking it first.

ve.ui.MWLinkInspector#static.legalTitle:
* Removed in favour of checking whether newFromText returns a
  truthy value.

Change-Id: I580bfccb83f86be3ad7e83d31f0834e1cde7df9c
Convert try/catch uses of mw.Title to newFromText

`new mw.Title` throws on invalid input. Converting uses to
mw.Title.newFromText instead and converting try/catch to if/else.

mw.Title in general (regardless of which constructor) has been
improved in core. It will no longer crash on pages where the page
title was a false hit for invalid (e.g. we couldn't load VE on
[[.com]] because the js parser thought it was invalid).

However, though the initialisation works since core has been
fixed, there are still plently of cases where we take real user
input that can genuinely be invalid.

In cases where the code did not catch exceptions and there was
no obvious way to handle it, I left it as is (let's revisit them
in a separate commit). It would be an exception either way, and
I'd rather see "mw.Title: Parser error" than
"TypeError: null does not have method getNamespaceId".

Change-Id: I5b1b23d56d39cdb7ecb0809e3d721992e0c30f54
Merge "Fixes for Trevor's crazy half-baked commit"
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
Merge "Localisation updates from http://translatewiki.net."
Localisation updates from http://translatewiki.net.

Change-Id: I39dd30af22a5c64dd4aa7340841aa0142f2d09f2
[browser test] update references for proper iframes, new workflow

Change-Id: Icafbbcac9a70401bd87ea87e6dbb94ea9a6c3726
[browser test] up arrow no longer exists, use X instead

Change-Id: I79684633b69ad48b4ce291e2bd6e12d14564cca6
[Browser tests] Sort all the elements for Links tests to proper iframes

Change-Id: I873cfaccf7211f379eadc6574edbe8de8c2e15f1
[browser tests] editing controls to proper iframe

Change-Id: Ifc24e4fcc0fe4688ee8e8b277f54fe2582dcadaf
Merge "Prevent deletion of FocusableNodes from a collapsed selection"
[Browser tests] transclusion elements to new 3rd iframe

Change-Id: Ia1a02ece54c44d3bfb0dd985fec97e9c8d5b9d59
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
iframe

Change-Id: Id771991a89e1cf836c7f19083df22edb38ffc6c8
Fix empty document length check in MWReferenceDialog

We now initialize the surface in the dialog with a 4-element linmod
(paragraph, /paragraph, internalList, /internalList) rather than a
2-element linmod. This broke the code that disables the Insert button
in the reference dialog when the surface is empty.

Change-Id: Id733e654a628b1294e697ad4ef3f2f6fe1a9c869
Localisation updates from http://translatewiki.net.

Change-Id: I6e384e4e91128e63ae6dd106ce6b7d116939d7e4
dismiss latest warning iframe

Change-Id: Ic1c5099f1531174140c2033212da35632a6188cc
id for ip warning changed

Change-Id: I6623751228be1aa550ec8c7e1e3071a38563ada0
ve.ce.Surface.getSelectionRect() can return null

Document this fact and update callers to check for a null return value

Change-Id: I095041157cc0e24e48662f40690b4928bb8d829a
Merge "Destroy test surfaces"
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
Merge "Localisation updates from http://translatewiki.net."
Localisation updates from http://translatewiki.net.

Change-Id: I133c28a9c5da3de808ba6fdb0462a2425cc9eb10
Merge "Move skin support into $wgVisualEditorSupportedSkins"
Merge "Fix initialisation errors in EventSequencer"
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
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
Move skin support into $wgVisualEditorSupportedSkins

$supportedSkins is mostly an artefact of the currently-unrefactored init code that
will have a sub-class for each skin (so skin's maintainers can add VisualEditor
support without hacking around inside VisualEditor itself), but until then let's
split it out into a global configuration variable at least, so that they have a
hope.

Change-Id: I0742cea6469678c5599768340dfb1f6d2f4debf4
Merge "EventSequencer: New hooks for useful moments"
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
Merge "Track DOM retrieved events"
Merge "The amazing mystery of scrollTop and onscroll"
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
Merge "Make dialogs, inspectors windows and window sets generic"
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
Merge "Refactor out data processing from ve.dm.Document constructor"
Refactor out data processing from ve.dm.Document constructor

Also make collection of metadata and construction of nodes optional.

Change-Id: I02ba6d2199caccaf9fe9dcfba58eefa7b52c52b1
Merge "Use FlatLinearData for storing converter results"
Localisation updates from http://translatewiki.net.

Change-Id: I9e69cd0eb52daae552d3bc7797d45425c291cbd4
Merge "Remove PagedDialog from test files"
Merge "mw.ViewPageTarget: Fix broken firstHeading transition"
Merge "mw.ViewPageTarget: Fix incomplete teardown sequence in #deactivate"
Merge "Follow-up 6ec34a3de: Fix bug and exception in edit notice button"
Remove PagedDialog from test files

Fix for patch I5efa2f893f4b which only removed one reference to the file.

Change-Id: I89b9f30ee8309e1cba0ed98a74238ba671b76a59
Localisation updates from http://translatewiki.net.

Change-Id: I94d2a04cc60c7464514931e50bd9168313e7f4db
Follow-up 6ec34a3de: Fix bug and exception in edit notice button

After 6ec34a3de the edit notice button was no longer hidden by
default if there were no notices. The alert icon was always
visible (when clicked it would show "0 notices").

In addition, on any page (except pages with edit notices) it
would throw a fatal exception at load time because method .hide()
doesn't exist.

As a result, current master shows an incomplete toolbar (e.g. not even
a Save button!)

Change-Id: Ib6e91c4756664c25fbb7403ef54b4fffcc0f9938
Change X-Parsoid-Performance header value indicating cached response

The header should comprise 'key=value; ' pairs rather than 'key: value', and
the key name 'cached-response' is less tied to the particulars of the current
Parsoid storage setup (which is being revised). Follows I8085fdba3.

Change-Id: I8bcf947763512ba700793974ab0c48d65c171bbb
Revert "Localisation updates from http://translatewiki.net."

That commit removed message 'visualeditor-help-tool' for some reason.
Could be a race condition (relatively new message), but unlikely as other
translations of that message were not removed and are still in the file.

Anyway, reverting so they can try again. And to avoid this messages's
translations from being deleted next time translatewiki reads this from git.

This reverts commit 73f829904688fa729001976eda8f85213f37ace2.

Change-Id: If457b61e3fd3703a59ee67a9a0c26b0c9a36d0d4
mw.ViewPageTarget: Fix broken firstHeading transition

Class ve-init-mw-viewPageTarget-pageTitle added various
transition settings that were never used. Meanwhile, we're doing
fadeTo which sets inline opacity css every X ms until the
animation is finished.

* Changed the inline jQuery animation  to use css transitions
  instead.
* Removed the inexistent and obsolete ms-transition declaration.
* Removed ":visible" from selector query. This makes the selector
  more performant (since :visible is a proprietary Sizzle keyword)
  and it was obsolete anyway. The classes don't affect display none/hide,
  this is handled naturally by the browser now.

Change-Id: Ibdfb442ff6c743ef16b514a7696796ee27821887
mw.ViewPageTarget: Fix incomplete teardown sequence in #deactivate

When deactivating before the surface became active (e.g.
this.active is still false, as case is the case when Parsoid
isn't running), the teardown sequence was incomplete.

Most notable, the page title (h1.firstHeading) was still dimmed
after cancelling the alert for Parsoid error, eventhough
everything else was shown and restored.

* Moved call to #showTableOfContents in #deactivate up for
  consistency with #activate.
* Added call to #restorePageTitle in #deactivate so that the
  title is restored even if the surface didn't activate yet.
* Removed calls to various methods in #tearDownSurface that
  were already called by #deactivate.

Now activate/deactivate and setUpSurface/tearDownSurface are
in balance.

Change-Id: Ibb2fbf0e5ab9b6a028d4e139c13aa7ff8c82be82
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
Localisation updates from http://translatewiki.net.

Change-Id: I177eaf486feb16e7831d877b7e7b5e396d3ebe4f
Track DOM retrieved events

When the editor finishes retrieving the target DOM, fire a 'DOM retrieved'
analytic event with the following properties:

* Response time in millisecond.
* Response size in bytes.
* Whether request was a cache hit.
* Value of X-Parsoid-Performance header (or null if unset).

jQuery.byteLength is now a dependency for ext.visualEditor.mediawiki.

Change-Id: I74d3964238927645e847b6e215991bd6b1ebad59
Fixup for IconButtonWidget load order

Was loading out of order in test HTML.

Change-Id: Iac56fac0432ad634a3ce0c636c7b863b9ddc950e
Merge "Prevent context menu from flickering after FocusableNode redraw"
Merge "Toolbar action widgetization and UI refactoring"
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
Merge "Have API pass through 'X-Parsoid-Performance' header from Parsoid"
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
Merge "Refactor ve.ui.PagedDialog"
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
Have API pass through 'X-Parsoid-Performance' header from Parsoid

Change I1d7fd94f2 to Parsoid adds a custom header on Parsoid HTTP responses,
'X-Parsoid-Performance', which contains data about how long it took Parsoid to
handle the request. This patch makes the API pass through the header from
Parsoid to the client, where it will be logged as an event (along with
additional datapoints that are only available on the client). When the request
is fulfilled entirely by Varnish, the XPP value is replaced with
'backend-varnish-hit: true'.

Change-Id: I8085fdba35c860eaaa4df020d06d1d45d4ea5813
The element has different title on a Mac

It is "Edit this page with VisualEditor [ctrl-option-v]".

Change-Id: I54d72c63f07826106e8fbb0de0828dd82b67c766
Merge "Get rid of 'reversed' flag on transactions"
Fix name of syntaxHighlight icon file

It's referred to as url(images/syntaxHighlight.svg) in
ve.ui.MWSyntaxHighlight.css

Change-Id: I32391abc895caff9746ea5a4956a54c4c176c573
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
Merge "Make toolbars, toolgroups and tools toolFactory independent"
Merge "ve.Element: Fallback to body, window is not scrollable"
Merge "Make ve.Factory require static name property"
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
Merge "When cloning the InternalList, pass through properties that aren't rebuilt"
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
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
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
ve.Element: Fallback to body, window is not scrollable

Bug: 54928
Change-Id: Ifec0dae598f7fd99270588bd8ca77777a07e9669
Merge "Change ve.dm.DocumentSlice to a mixin to ve.dm.LinearData"
Change ve.dm.DocumentSlice to a mixin to ve.dm.LinearData

Document slice only ever contained linear data, with extra functionality
to preserve the range. It pre-dated LinearData, but now we should
refactor it to reflect its purpose.

Change-Id: Ifc908f7526c83a43a51372c8d2494d7260e7facd
Merge "Localisation updates from http://translatewiki.net."
Localisation updates from http://translatewiki.net.

Change-Id: I7c9afb21878a33ceb8fa954073f7b38b8e433d68
Merge "Rename getDocumentSlice to cloneFromRange"
Rename getDocumentSlice to cloneFromRange

We already getSlice which returns a ve.dm.DocumentSlice, so using
the word slice in this method is very confusing. What we are actually
doing is creating a ve.dm.Document from a range. Also remove argument
overloading as it's not particularly helpful and would make the new
name a lie.

Change-Id: I93da3419510410b170396e6765fbe2a87f9795be
Get rid of 'reversed' flag on transactions

The way we implemented undoing transactions was horrible. We'd process
the original transaction, but with a reversed=true flag. That meant we
had to keep track of the 'reversed' flag everywhere, and use ternaries
like insert = reversed ? op.remove : op.insert; all over the place to
access transaction operations. Redo then worked by reapplying the
transaction. We would verify that this was OK by tracking whether the
transaction was in an applied state or an undone state.

This commit makes it so every transaction can only be applied once. To
undo, you obtain a mirror image of the transaction with tx.reverse(),
then apply that. To redo, you clone the original transaction with
tx.clone() and apply that. All the code that had to use ternaries to
check whether the transaction was being applied in reverse or not is
gone now, because you can only apply a given transaction forwards,
never in reverse.

Bonus:
* Make ve.dm.Document's .completeHistory a simple array of
  transactions, rather than transaction/boolean pairs
* In the protection of double application test, clone the example
  document properly; it modified ve.dm.example.data, which was "fine"
  because it ran .commit() and .rollback() the same number of times

Change-Id: I3050c5430be4a12510f22e20853560b92acebb67
Followup 5592ea26: bind native focus/blur events instead of jQuery events

In jQuery 1.8, if you focus something using jQuery, the jQuery focus
event fires before the jQuery blur event, which is wrong. If you focus
something natively, the events do fire in the correct order.
See http://jsfiddle.net/WGy9h/4/ .

Fortunately, the native events always fire in the correct order, so
listen to those instead. Normally, we're not concerned with the order,
but in ce.Surface we bind the same focus/blur handlers to a pair of two
nodes, and then if the focus moves from one to the other, we'll get
confused by the events being emitted in the wrong order.

Change-Id: Ia585b42b6deb74ba55a2d55ce1922b1e04d85e81
Merge "Add specific message for empty ref group list"
Add specific message for empty ref group list

Currently we just say 'group ""' which is a bit weird, so
instead have a specific message which talks about the
'default group'.

Bug: 51873
Change-Id: I4a17f15ee18175fac11b36b102a06cc9714426ee
Merge "Localisation updates from http://translatewiki.net."
Localisation updates from http://translatewiki.net.

Change-Id: Id80733f48437f7e2b2af4cfcb6dbb55e9076d684
Merge "SyntaxHighlight node support"
SyntaxHighlight node support

Update: Switched to generic ve.ui.Toolbar and ve.ui.Tool for consistency
with VE in general. Changed searchbox to floating and hidden by default.
Call for search using shortcut key. Overriden ESC key.

Node handler for <syntaxhighlight>'s Rdfa type.
Embedded in VisualEditor.php with its own ResourceLoader module.
Use $wgVisualEditorEnableExperimentalCode in LocalSettings.php
to load the module.

Supported languages (for testing): text, javascript

Features:
(1) Internal mechanisms:
	(1.1) Tokenizer. Tokenize input code string.
	(1.2) Highlighter. Highlight based on predefined rules.
	(1.3) Syntax checker. Validate based on predefined rules.
(2) SimpleSurface:
	(2.1) Auto indenter. Works with (){}[] blocks.
	(2.2) Reformatter. Reformats spaces and remove trailing
	whitespaces.
	(2.3) Language selection dropdown.
	(2.4) Basic editing. Insert, deletion, selection.
	(2.5) Clipboard & edit history support.
		(2.5.1) Undo (Ctrl + Z), redo (Ctrl + Y)
		(2.5.2) Copy (Ctrl + C), cut (Ctrl + X), paste (Ctrl + V)
	(2.6) Search & replace. Ctrl + F to quickly move focus to search
	box.

Bug 47742

Change-Id: I4adede9e05fd2236cee50ce03f597e8ff6b1914d
Make "Welcome to VisualEditor" gender sensitive

Add GENDER keyword to "Welcome" since it's a gender-sensitive
word in some languages (e.g. Romance languages)

Change-Id: I6a3da40b286bb1abd2aff360dab3b386deb13420
Add optional i18n parameters to MWDialog titles

This change allows for the Username to be sent in MWBetaWelcomeDialog
title so the i18n message can support {{GENDER:}} parameters.

This change arose from the need to provide GENDER support when translating
the welcome message from Change-Id: I6a3da40b286bb1abd2aff360dab3b386deb13420

Change-Id: Iae70fbaa5be822d571a0d75704cfeca4eabd2fe8
reset @make_selectable_line properly again

Change-Id: I1efa45f639bc4a7cdd764be3f5c23ba2ef2605e9
reset @make_selectable_line properly

Change-Id: I8bd55b2ddc55b8368826af58903e7f988058b325
Use element.textContent in ve.getDomElementSummary

.text() returns empty for comment nodes, where textContent returns
the contents of the comment node.

Change-Id: I5e2798a6dba9d0f8fc13d5c0f78fe1fd255f1ebe
Localisation updates from http://translatewiki.net.

Change-Id: I4db60b156eba2b37a9edf6597bab413acf4aa3df
Merge "Localisation updates from http://translatewiki.net."
Localisation updates from http://translatewiki.net.

Change-Id: I839aff2a9313b91564b729a5f21bf54da958ca02
Merge "refactor to use Scenario Outline and REUSE_BROWSER env var"
Make cursoring over a FocusableNode work again

When you cursor onto a FocusableNode, it's selected, and we focus the
paste target as part of our hack to make copying FocusableNodes work
in Firefox. But then when you press the arrow key again, that event
isn't picked up by anything, and you can't move the cursor off the
FocusableNode using the keyboard.

Fixed by attaching the EventSequencer to this.$ (which is the parent
of $documentNode and $pasteTarget) and listening for focus/blur on
both $documentNode and $pasteTarget.

Bug: 54443
Change-Id: I7bddcfa9fa6f38908e315c97623bd27133daa98d
Merge "Don't bounce selection changes DM->CE"
Don't bounce selection changes DM->CE

ve.ce.Surface.js
* changeModelSelection: store selection temporarily for bounce detection
* onChange: do nothing if bounce is detected

Change-Id: I758e7a72a5690463f12f456419c6e471dd29a9db
Merge "Add more tests for ve.ce.Surface#onContentChange"
Merge "Typing into an annotation next to a word break keeps annotation"
Follow-up to 9b999622: don't slug paragraphs that contain just a text node

Bug: 54791
Change-Id: Ide8b5320fae2622085f183c771173ef7190406ed
Localisation updates from http://translatewiki.net.

Change-Id: Ifb66bf8f154c6b7df30f7c2c5ff777adbe90240b
Merge "ce.BranchNode: Insert slugs based on CE children length, not DM"
ce.BranchNode: Insert slugs based on CE children length, not DM

Due to Firefox' Ctrl-A creating an outer selection (0,len) as
opposed to inner select like in Chrome (1,len-1), deleting leaves
the document completely empty (with no cursor anywhere in the
document).

However, setupSlugs() wasn't inserting a slug because the internal
list still existed (so this.model.length !== 0).

Using this.$.children().length instead.

Bug: 50947
Change-Id: I1517ebcc5b31e2544559b851174482b0c872b24b
removedItems[i] is already an item, no need to pass removedItems[i].item

Bug: 54727
Change-Id: Iff8e9c8f1dc7a701d4773bf15817897a871d9e98
refactor to use Scenario Outline and REUSE_BROWSER env var

Change-Id: I65970c0df35bcac48f16899090cadc8df8c560c6
indent/outdent is conceptually different than bullets strings

Change-Id: I8fec64d6d01148f18588a8af7336e9791f88640b
Merge "Move repeated code for creating a test ve.ui.Surface in utils"
Merge "Fix JS error in ve.ui.ClippableContainer"
Add more tests for ve.ce.Surface#onContentChange

Change-Id: I8ad12ca086d4dadce82a954ee015af2cc3bbd7cc
Typing into an annotation next to a word break keeps annotation

Logic was failing because we were passing the index of the annotation
within the AnnotationSet, instead of the index within the Store, to
containsIndex().

Bug: 54332
Change-Id: Ibfd9abe6e4b44d9db744e0c5019418eee12f84a4
Move repeated code for creating a test ve.ui.Surface in utils

Pattern is used in half a dozen places, so let's use a utility function.

Change-Id: I3e2d0024f0a2887c32ba96537195dd374a11c560
Merge "Implement live preview in MWMathInspector"
Fix JS error in ve.ui.ClippableContainer

Sometimes, .clip() would be called when clipping had already been
disabled again, and accessing this.$clippableContainer would cause
an error. This happened to me when typing quickly in MWLinkInspector.

This probably happens when enabling and disabling clipping right after
each other in response to the same event, such that the setTimeout()
for the initial clip is run after clipping has already been disabled.

Change-Id: I0f85ea5f10955188bae51160e1c88eca858ea1bf
VE link not immmediately present since opt-in change, especially in Chrome

Change-Id: Ia0baff017b3b887f06182b1c8630b2270bc8823b
Implement live preview in MWMathInspector

250ms after the user stops typing, we rerender the node with what they've
typed so far.

Bonus:
* When using MathJax, tell it which node to rerender
* Avoid crash when trying to unwrap wrapper paragraph

Change-Id: I623eef48e40d480cc98766cf7daf75dacd0bde19
Merge "Fix timing of rerender event in GC nodes"
Merge "Introduce newFromDocumentReplace() transaction builder"
Prevent context menu from flickering after FocusableNode redraw

Pass an extra parameter to show() to let it know when the menu is
just being moved, and therefore doesn't need to perform the fade-in
transition.

Change-Id: I2cf2ff07db6cc7d226f3d626755792a06dfcbe54
Fix timing of rerender event in GC nodes

Move the triggering of the rerender event into an overridable method
'afterRender'. Some nodes don't have the correct dimensions
immediately after rendering their DOM elements as they may need
to wait for images to load, or for a script to run (e.g. MathJax)

Change-Id: If204f665dcb2fd69d00a183279056d11188ddd74
Merge "make test DRY, use Before hook"
Merge "'Config' -> 'Configuration' in all comments"
make test DRY, use Before hook

Change-Id: I6f127e675a3c9e7b6126c0f052dce781d1103b52
Merge "Missing param comments in methods updating popup widget"
Missing param comments in methods updating popup widget

Change-Id: Id90ba76719472fe0b61e9d232b5cf72f086af915
Merge "Allow MWExtensionNode to render with arbitrary text/attributes"
Merge "Pass config object from ce.GeneratedContentNode.update() to forceUpdate()"
Merge "Make undo work for changes to MWExtensionNodes"
Introduce newFromDocumentReplace() transaction builder

Replaces newFromNodeReplacement(). newFromNodeReplacement was very
simplistic and didn't support metadata or internal list items, so
if you had comments or references inside of the data you were editing
(reference contents or an image caption), they'd get mangled.

With this, you can do:
newDoc = doc.getDocumentSlice( node );
// Edit newDoc
tx = ve.dm.Transaction.newFromDocumentReplace( doc, node, newDoc );
surface.change( newDoc );

and that takes care of metadata, internal list items, and things like
references that reference internal list items.

ve.dm.Document.js:
* In getDocumentSlice(), store a reference to the original document
  and the number of items in its InternalList at the time of slicing
  in the created slice. This is used for reconciliation when the
  modified slice is injected back into the parent document with
  newFromDocumentReplace().

ve.dm.InternalList.js:
* Add a method for merging in another InternalList. This provides a
  mapping from old to new InternalList indexes so the linear model data
  being injected by newFromDocumentReplace() can have its InternalList
  indexes remapped.

ve.dm.Transaction.js:
* Replace newFromNodeReplacement() with newFromDocumentReplace()

ve.ui.MWMediaEditDialog.js, ve.ui.MWReferenceDialog.js:
* Use getDocumentSlice/newFromDocumentReplace for editing captions/refs
* Change insertion code path to insert an empty internalItem/caption, then
  newFromDocumentReplace into that
* Add empty internalList to new mini-documents

ve/test/dm/ve.dm.Transaction.test.js:
* Replace newFromNodeReplacement tests with newFromDocumentReplace tests

ve-mw/test/dm/ve.dm.Transaction.test.js (new):
* Add tests for newFromDocumentReplace with mwReference nodes

ve.dm.mwExample.js:
* Add data for newFromDocumentReplace with mwReference tests

VisualEditor.hooks.php:
* Add new test file

Bug: 52102
Change-Id: I4aa980780114b391924f04df588e81c990c32983
Various context menu display issues

* Check the popup fits within the node horizontally as well
  as vertically before embedding.
* Calculate the position of the node relative to the document.
  Previously we assumed the parent was the document and so used
  jQuery#position but this is not the case if a custom $focusable
  is passed to FocusableNode.
* Forcefully re-show the context menu on resizable node mouse up.
  This is apparently done automatically by a redraw event, but if
  the user just clicked on a resize node without dragging the context
  menu would be lost.

Change-Id: Id477a30827c9393a446e9c44466c83dabc7e0ab4
'Config' -> 'Configuration' in all comments

Because the former isn't a real word.

Change-Id: Ie6ed15f9e390b357bbaa768b57f3c3fd7cf21181
Merge "Fix use of removed function isUniqueListKey"
Merge "Fix variable names in newFromInsertion"
Fix variable names in newFromInsertion

Documentation says third argument is 'data' when in fact it is
'insertion' which is then re-used as the result of fixupInsertion :/

Change-Id: I17c959f858eddddc90a6fa839da0d32da69a784f
Fix use of removed function isUniqueListKey

Function was removed in eb647434363c4b but one caller was still left,
which caused VE to throw a JS error when opening the reference dialog
to insert a new reference.

Change-Id: I827381bfe3bdeecdbaa1fba55a09b3e8e03575a6
Allow MWExtensionNode to render with arbitrary text/attributes

The config object in GeneratedContentNode exists for this purpose,
so let's use it :)

Change-Id: I567c3eee5fc26979aa0dff93071a9c461d27058b
Pass config object from ce.GeneratedContentNode.update() to forceUpdate()

This is obviously necessary, but wasn't done, so calling update()
with a config object was broken.

Change-Id: I30d67bcb117885c792c0f08ea55d60cb294de18b
Make undo work for changes to MWExtensionNodes

If you changed the contents of an alien tag extension, then tried to
use undo, the change wouldn't be undone, but the undo state would
toggle.

This was because we only kept one copy of the data-mw object for these
nodes and modified that one copy. Instead, create a new copy every time
we modify it, so we can actually go back to previous states.

Change-Id: Ib4d5d460a6fdda9c3b0968f269585d620b47fdd8
Merge "No more configuration overrides"
Merge "Add abstract method for getMediaSources."
Delete empty nodes instead of merging into them

When you press delete inside an empty node (e.g. Heading) that
node should be removed, instead of the paragraph beneath it being
merged into and effectively converted. If the heading is non-empty
then merging is still the correct behaviour.

Also add in test case.

Bug: 50254
Change-Id: If9cee79feb4b4ee9d7c367e392b00fee5e8c0669
Merge "Detect collapsed range inside focusable node in ve.ce.Surface#onChange"
don't run VE test on beta for anon, since VE is now opt-in

Change-Id: If6690ff82c23fe69544d087efb51ae4c6b1891fb
Detect collapsed range inside focusable node in ve.ce.Surface#onChange

When the document starts with a focusable node, and we try to initialise
the selection to [1,1], the current logic does not detect that as being
on the focusable node and tries to do a native selection.

Bug: 54446
Change-Id: Ib515c435314c35c4e9b3802da117b963b3ef4169
Merge "Allowing for config data when instantiating dialogs"
Merge "Revert drag marker GIF to previous version"
Merge "Add basic ve.ce.tests and fix documentation"
Merge "Updates to support jsduck 5.x"
Tests for handleDelete in ve.ce.Surface

Trigger fake delete/backspace events and assert changes to the DM.

Change-Id: I69659a3e49b6520376cac3c795e8a96e7fbda9ae
Merge "Don't apply attributes to GC wrapper"
Don't apply attributes to GC wrapper

this.$ on a GC node is just a wrapper, so shouldn't take the
HTML attributes from the model, otherwise you may end up with
double borders and padding.

Change-Id: I5641df341c9b118461e7e8fb89266dd300e09755
Merge changes I9e065aa4,Iac7649f4

* changes:
  MW*ImageNode's can't take link annotations
  Node annotation blacklists
No more configuration overrides

In various places in the UI code, certain properties of config objects
were overridden and in some cases the configurations were documented as
private as a strange hack to prevent them from being advertised in the
docs.

I, Trevor, have been convinced of the error of my ways, and gladly
reverse this situation, allowing all configurations to always be
overridden when desired, while still allowing default values.

Change-Id: I242e3b1902dec8e09eeea38fa64381e69ee04215
Merge "Extend SurfaceToolbar into TargetToolbar"
Merge "Add opacity-setting class to GC nodes when generating"
Make more types of node relocatable

In this instance, MW(Extension|Reference|Transclusion)Nodes.
In general anything that is focusable should probably be relocatable
by default. We should considered this when we sorting out the
focusable/protected/relocatable mess in the near future.

Change-Id: Ifc55e251cba3e875798d5103540d02ad651399ad
Merge "Cleanup action methods"
Merge "Ignore all node attributes in clipboard hash"
Merge "LanguageAnnotation Touchup"
Localisation updates from http://translatewiki.net.

Change-Id: I67f756e170bdacac9f9cf6e775090844682b5ff9
ve.Element: Account for getComputerStyle returning null

Follows-up 143b086c74.

When the page settings dialog is opened, ve.Element.getBorders
gets called twice and in both cases, style is null in Firefox:

* HTMLLIElement
  classList: "ve-ui-widget ve-ui-optionWidget ve-ui-outlineItemWidget
   ve-ui-outlineItemWidget-level-0 ve-ui-optionWidget-selected"
  childNodes: [object HTMLSpanElement, object HTMLDivElement]

* HTMLDivElement
  classList: "ve-ui-layout ve-ui-panelLayout ve-ui-panelLayout-scrollable
   ve-ltr ve-ui-pagedDialog-outlinePanel"
  childNodes: [object HTMLUListElement]

Bug: 54322
Change-Id: I86264007c2d5b4930640a352b8896dff2d0d9ce5
LanguageAnnotation Touchup

Fixing a couple of mishaps in the language annotation, including adding a
getComparableObject in the ve.dm.LanguageAnnotation class.

Change-Id: Ia28900df55969f60576cfd716c70ffc1ba5f4c27
ve.Element: Clean up logic

* Remove redundant ' ? true : false'.
* Reuse loc instead of repeating win && win.getComputedStyle.

Change-Id: I753121f358d3ffc190869a64f44af3daa0ce5a42
Updates to support jsduck 5.x

Change-Id: I16123e91370cb6a7785060c749530953f4c3ddf4
Add basic ve.ce.tests and fix documentation

Also add TODO's for untested methods.

Change-Id: I905f3ecf17e4ea5ec33fdded4c7683340e08b549
Add opacity-setting class to GC nodes when generating

So that they appear 'greyed-out' while updating.

Change-Id: Icbc92d293517beb72d64e4011b0cd5197820de9a
Ignore all node attributes in clipboard hash

Some browsers normalise attributes (e.g. Firefox makes
URLs absolute) so we have to remove them from the clipboard
hash to make the comparable.

Bug: 54377
Change-Id: Iadc4d886a5345b28370cbfa31eb665661e577eeb
Localisation updates from http://translatewiki.net.

Change-Id: I962368781399438d9cde4ced035b30520812cd80
Quote page name in notifications

This improves the appearance, particulary for multi-word titles.

Change-Id: I4d7bdb034acab6b7c6e3f87bc23dcdefd54c301b
Localisation updates from http://translatewiki.net.

Change-Id: Ie3b34a6dc2060ffbc922de68842f84ed27f1b79b
Merge "Use a frame wrapper for all highlights on MWBlockImageNode"
Localisation updates from http://translatewiki.net.

Change-Id: I87e53a744a3da1f4413474d58e32de5144f99af0
Merge "Only listen for copy/paste on documentNode and pasteTarget"
Fix exception thrown by converter when data ends in text

Conversions usually end in a close tag so this hasn't been a problem
before, but the mini-conversion we do in onCopy may not be balanced.

Change-Id: Ia2db29f116ca84ee886b4c5cafd4ac45cd926b79
Only listen for copy/paste on documentNode and pasteTarget

As these are the only places we want to override the events.

Bug: 54375
Change-Id: I8a4e207f38508cdaf35cd869f267dd9f1059c83d
Prevent naming collisions when generating unique reference names

Simply generating ':3' as the "unique" name for the 4th reference
doesn't work. Even if getUniqueListKey() had been used, that only
checks for conflicts with names that have already been encountered
(i.e. occur in <ref> tags that precede the current one), not for
conflicts with names that first occur further down in the document.

The solution is to generate names at serialization time, when we
have full knowledge of which names are in use. Internally, we use
'literal/<name>' for names that literally appeared in the source,
and 'auto/<number>' for unnamed references. Then at serialization
time, we translate 'auto/<number>' to 'literal/:<number>' if needed
(i.e. if the reference was reused).

ve.dm.MWReferenceNode.js:
* toDataElement()
** Prefix listKey with literal/ or auto/ as appropriate
* toDomElements()
** Map auto/ listKeys to unique names
** Don't try to unset the name if not present (was unsetting a property
   that didn't exist anyway)

ve.dm.InternalList.js:
* Remove now-unused isUniqueListKey()
* Rewrite getUniqueListKey()
** Make prefix configurable
** Take previously generated unique keys into account
** Map the same old key (auto/N) to the same generated key (literal/:M)
* Add getNextUniqueNumber() as a source for auto/N numbers: previously
  used the length of the itemHtmlQueue, but that only works during
  conversion, not from the UI dialog

ve.ui.MWReferenceDialog.js:
* For new references or conflicting names, generate an auto/N key and
  let toDomElements() deal with actually mapping that to name

ve.dm.InternalList.test.js:
* Rename listKeys to new style
* Split the test case into two groups so we can test multi-group cases
* Add tests for getUniqueListKey()

ve.dm.mwExample.js:
* Rename things to new style
* Modify the test case so it attempts to trigger bug 54341

Bug: 54341
Change-Id: I726fb83e6fb66ffec643d996768a854ec9474b3d
Localisation updates from http://translatewiki.net.

Change-Id: I389a84c96592d9239a7204e73f31df3c0f215278
MW*ImageNode's can't take link annotations

Because there's no sane wikitext to handle that case, and Parsoid
will just output garbage.

Bug: 53151
Change-Id: I9e065aa46d88f6bed9c47127b3e002ec2e1fec5a
Node annotation blacklists

Allow nodes to specify a blacklist of annotations which can't be applied
to it.

Bug: 53151
Change-Id: Iac7649f4b38d8bfa94c64f734634afd45a5afc53
Merge "Don't break core's parserTests if VisualEditor is installed"
Revert drag marker GIF to previous version

When we switched all base 64 encoded blank GIFs to the "stable" version,
we created a regression that prevented proper styling of the drag marker.
This restores the correct drag-drop experience.

Change-Id: I9c2a195fd866a5919245667a436106772debcffd
VE bullets, numbering, indents, outdents

Change-Id: I0394c9d6f89e9a723d070b517560685d003f7bef
Don't break core's parserTests if VisualEditor is installed

VisualEditor's hook changes the edit section link, which changes the
output of certain parser tests so that they no longer match the
expected text.  Use the `ParserTestsGlobal` hook (which cleans up
after itself when the parserTests ends) to disable the
`onDoEditSectionLink` hook when we're running parserTests to avoid
the spurious failures.

Change-Id: Ic958d88f443ac37ba304d3256e2bb5ea2fde820d
Describe commit message guidelines in CONTRIBUTING.md

Add a brief note pointing to the gerrit commit message guidelines.

Change-Id: Ia5d9a167b9510d09831e4d90daa0179af07ed5d3
Minor doc fixes to `ve.dm.Transaction`.

Correct the return value descriptions for the `newFromMetadataInsertion` and
`newFromMetadataRemoval` methods (which appear to have been cut-and-pasted
from another method).

Change-Id: I019b0ef9c75ff47fc0f2df8c95da9d090710a5a8
Clean up VisualEditorDataModule and document ve.version

* Check in #getGitHeadHash now ensures a false value is
  cached as well.
* Made ve.version.id being false when invalid more stable
  since we now rely on this as of eeb3ac3b19b02.
* Added documentation for ve.version.

Change-Id: I164aa9ebaa7f8a4d1e8f2210af76e06b23abef09
Merge "Fix check for preformatted when stripping whitespace"
Merge "Hide version info if not available"
Merge "dm.Surface: Initialize selection at (1,1) instead of (0,0)"
dm.Surface: Initialize selection at (1,1) instead of (0,0)

Code with a similar purpose was added in 568e0e5701 but got lost
when some things were moved from ve.Surface to ve.ce.Surface in
5012ed10.

Initializing the selection at (0,0) was known to cause problems before,
and since 789d0caf093b breaks editing of empty documents: typing in an
empty document begins in an inline slug, but SurfaceObserver doesn't
notice typing in an inline slug unless the ce.Surface pawns it, which
is OK because insertions in slugs are always pawned, but the pawning
logic believes the cursor to be at offset 0 where there is no slug
(it's at offset 1) and so it doesn't pawn.

Bonus: update tests and add descriptions for dm.Surface.change tests

Change-Id: Id72314d0fe650dacc7cdb842f5cea2f3bfba5145
Merge "Fix function naming conventions, comments and whitespace"
Merge "Always use multi-part format for transclusions"
update class for suggestion list element

Change-Id: Id4e653ec0400609d1aa19de55a7080ec122216d7
Always use multi-part format for transclusions

The Parsoid team has changed their spec to always use multi-part
format even for one-part transclusions. This commit changes VE's
output format to always be multi-part, but still accepts single-part
format on the way in.

Change-Id: I6b3156b0b599ad042bb52d7f53dcdeb1c4a0954a
Rename CODING.md to CONTRIBUTING.md

This triggers a bit of special linkage from github -- in particular, when
an issue or pull request is created, github will direct the user to
read CONTRIBUTING.md first.

See https://github.com/blog/1184-contributing-guidelines for details.

Change-Id: Ib0d23977fd87ec0b1515ff43345da158bc5f939b
Merge "Updates to README.md and CODING.md"
Updates to README.md and CODING.md

Describe how to report bugs, install grunt, and run tests.

Update jsduck instructions.

Fix path to license file in package.json.

Change-Id: I276ff0ea4324f027dafc044a86fa564b2439089a
Merge changes I899d2b3c,I0272fe38,I7ad24e7f

* changes:
  Rewrite MetaList.onTransact
  Allow replace operations to replace metadata as well
  Fix processing of double metadata replacements
Updated Ruby gems

Cucumber 1.3.6 seems to be problematic:

gems/cucumber-1.3.6/lib/cucumber/rb_support/rb_language.rb:122: warning: redundant nested repeat operator: /^** This is a new line/

Updating the rest of the gems too.

Change-Id: Ia173312baa178a45d648fc537c8abf914144bbd5
Localisation updates from http://translatewiki.net.

Change-Id: I5ebb1852910ad152ad7eb6c0748823b8fb12632d
Fix function naming conventions, comments and whitespace

* Convert some spaces to tabs
* Move private function to top and document
* Give constructor a global name

Change-Id: I7ec144303d32b1bb454b4164222601c263fb75bf
Merge "Scroll into view support"
Merge "Remove ve.log debugging calls from EventSequencer"
Extend SurfaceToolbar into TargetToolbar

Toolbars may want to control the target as well as the surface (spoiler alert!).
The new TargetToolbar has a pointer to its target as well as its surface.

Change-Id: I928316d9e23ac3f3de3e76c34ef0ac3d27855ab3
Scroll into view support

Objectives:

* Scroll when needed to show highlighted (with keyboard) or selected (by
  any means) options in select widgets
* Allow clipping and automatic scrolling for certain elements when they
  are otherwise going to be rendered partially out of view

Changes:

*.php
* Add links to new file

ve.ui.Widget.css, ve.ui.Dialog.css
* Removed unneeded x-axis overflow rules

ve.ui.ClippableElement.js, ve.ui.Element.css
* New mixin, adds visible area clipping support to an element

ve.ui.PopupToolGroup.js, ve.ui.MenuWidget.js
* Mixin clippable element

ve.ui.OptionWidget.js, ve.ui.OutlineItemWidget.js
* Add scroll-into-view configuration for option widgets

ve.ui.SearchWidget.js
* Scroll items into view when highlighting with keyboard

ve.Element.js
* Add getBorders, getDimensions, getClosestScrollableContainer and
  scrollIntoView static methods
* Add getClosestScrollableElementContainer and scrollElementIntoView
  methods

Bug: 53610
Change-Id: Ie21faa973a68f517c7cfce8bd879b5317f536365
Localisation updates from http://translatewiki.net.

Change-Id: I8645acb1de1d7184d003cff3cd9a8bac8112a1a7
VE support on beta is now reliable, run tests there

Change-Id: I82e42f24a6950680770bf6fc2b11e554d95224b6
Remove ve.log debugging calls from EventSequencer

Change-Id: I642acf09e7ed52d6dbf4312e054134b264c3428d
Hide version info if not available

Sometimes GitInfo returns a version ID of false if it can't
find the right files. In this case we should hide the whole
message as it is meaningless.

Bug: 53050
Change-Id: I71161df7588aa9311bc1fdf6b064cc6d8c155f61
Fix check for preformatted when stripping whitespace

Previous was checking by string match to 'preformatted' which didn't
match 'mwPreformatted'. Now using node factory to see if
hasSignificantWhitespace is set.

Bug: 54083
Change-Id: I1be2d4568df7848e08074d200fb374acd508f6fa
Localisation updates from http://translatewiki.net.

Change-Id: I10466e65b4e06dbdfc09975ee9154bac2d22f6a9
Localisation updates from http://translatewiki.net.

Change-Id: I6cbb341a79f062e803a29f63fcdc87301ee4f1d9
Localisation updates from http://translatewiki.net.

Change-Id: I240ad4a4903701ff1d1345082ab5e28777c8b515
Fix merge conflict breaking localised bold/italic icons

Bug introduced by change Ic97a636f9.

Bug: 53094
Change-Id: I4bf0bd4d340dfbad26a0d729de866985f81d14aa
Merge "Transactions: Add trailing retainMetadata when there is trailing metadata."
Merge "Move text style tools out of experimental"
Fix pawn on pre-annotation and keypress

modules/ve/ce/ve.ce.SurfaceObserver.js
* pollOnceNoEmit method to update SurfaceObserver's benchmark text

modules/ve/ce/ve.ce.Surface.js
* pollOnceNoEmit from onUnlock

Change-Id: Idb14a6aea723c42109b3825478766799d4abef22
Move text style tools out of experimental

These were meant to have been de-experimental-ised with the toolbar
commit; oh well. This moves the following text styles from being in
"experimental" mode to being regular annotations:

* Code
* Strikethrough
* Subscript
* Superscript
* Underline

Change-Id: I21be2dc844b47b825d7a1e48a592067166ecd122
Transactions: Add trailing retainMetadata when there is trailing metadata.

Ensure that all transactions move the cursor past the trailing
metadata, if present.

Change-Id: I869c75f8cfabe1e14bb66d8e627d0b750bde46af
Rewrite MetaList.onTransact

The previous implementation couldn't deal with transactions that
replaced both data and metadata at the same time (rather than replacing
data while moving metadata around), and extending its approach to
deal with that case would have made it much more complex.

So I rewrote the algorithm from scratch. The previous implementation
scheduled deferred moves for existing items, but immediately processed
insertions and removals. This is problematic for replacements and
maintaining the order in the binary search list. So instead, this new
implementation builds an array representing what the new item list
should be, then processes insertions, removals and moves in the correct
order to achieve that state.

It looks like the previous implementation didn't always work correctly,
which was masked because the test suite passed full=false to
assertItemsMatchMetadata(). This rewrite fixes this.

Also remove setMove/applyMove from MetaItem, because we don't need them
anymore and they're evil anyway; and add isAttached(), because the new
algorithm needs it.

Change-Id: I899d2b3c94c2cfa55823879bca95456750f64382
Allow replace operations to replace metadata as well

This was already possible in the operation structure by using
removeMetadata and insertMetadata, but no transaction builders
generated transactions like that.

With this change, pushReplace() can be instructed to overwrite the
metadata with arbitrary data rather than collapsing it by passing the
optional insertMeta parameter.

Change-Id: I0272fe38e053161c738591cf0a7b447a0827d4dc
Fix processing of double metadata replacements

Transactions that replaced metadata twice at the same offset
(with retainMeta-replaceMeta-retainMeta-replaceMeta) were broken
because the processor for replaceMetadata didn't advance the
metadata cursor.

Change-Id: I7ad24e7ffb4c39b40ec9c347db301f8e28f3692d
Localisation updates from http://translatewiki.net.

Change-Id: I4800c86c515d79ba80008305ddcd98c67945f80d
Merge "The Great [...] Rewrite of 2013: Clipboard edition"
Cleanup action methods

Changes:
* Remove reference to inspector close method, which didn't actually exist
* Use more spacy array syntax for all action methods

Change-Id: I08ee2d262acc7b39456766fb4a0b490da88ad041
Merge "Fix off-by-one error with metadata-mutating transactions."
Fix off-by-one error with metadata-mutating transactions.

Add some test cases for documents with trailing metadata, and fix an
off-by-one error in the metadata-mutating transactions (since the
document metadata array is one larger than the document data array).

Change-Id: I8f049466e03ed55010dfcf0a35702536edfa7b0a
Merge "Integrate with BetaPreferences"
Allowing for config data when instantiating dialogs

Currently, WindowSet open method uses the Window factory to call up
the instantiation of a new dialog or inspector class. This commit will
also allow sending further config options to these classes if needed.

Specifically, this will also allow the use of ve.ui.Context.js for
block inspectors that are not dependent on current selection or current
location of the cursor.

It will also let us generalize the dialog/inspector window instantiations
by adding in any needed config settings on call.

Change-Id: If14384d74ab91ef01b1c7641ff84f327f2a12112
Merge "Refactor CE Surface to reduce event feedback"
Localisation updates from http://translatewiki.net.

Change-Id: Ia3310953fd2191dc30dcb30ad415b4f50b15bab2
Refactor CE Surface to reduce event feedback

Restructure SurfaceObserver methods so that the method calls are more precise.

modules/ve/ce/ve.ce.SurfaceObserver.js
* Move timing code into startTimerLoop / stopTimerLoop / timerLoop
* Move poll logic into pollOnce

modules/ve/ce/ve.ce.Surface.js
modules/ve/ui/ve.ui.Surface.js
* Change all surfaceObserver calls to use new API

Change-Id: I0085e4a53c5a776733dce6944b867b8d2228ba4b
The Great [...] Rewrite of 2013: Clipboard edition

Firefox:
* Doesn't fire events without a selection, so when all we have is a
  focusable node, create a dummy selection in the paste target so the
  browser triggers an event on command+C.

Clipboard keys:
* Instead of just creating a text hash which may or may not match up
  with the plain text in the clipboard data, just convert the clipboard
  store into an array and use the index as the key. Also prepend a
  random number (clipboardId) so on paste we can verify the copy came
  from the same CE document.
  The text hash is now used for validation if only HTML is written
  to the clipboard.

HTML:
* Instead letting the browser grab CE HTML, always get DM HTML from
  the converter as it is cleaner (no phantoms, linefeed markers, extra
  class names etc.), and will make cross-ve-instance pasting easier
  in the future.

Clipboard overriding:
* Always override the clipboard with the above HTML, either using
  clipboardData.setData if it is available (webkit) or by throwing
  the HTML into the pasteTarget and selecting it during pre-copy.

Bug: 53375
Bug: 49396
Bug: 52096
Change-Id: Id0f39c10818047bb4b8922e97cead153a770757f
Integrate with BetaPreferences

Look at logo Michael.

Bug: 52686
Change-Id: I3cfada2ea264184698de5f322c1fe5041b37b8c8
Merge "Add alt attribute to core image nodes"
Merge "Use EventSequencer for CE Surface events"
Define RDFa types in ve.dm.MWInlineImageNode once and reuse whenever possible

Change-Id: I62ec12a6b71b60b15a4200722b8963d4cfd1b582
Merge "Localisation updates from http://translatewiki.net."
Localisation updates from http://translatewiki.net.

Change-Id: Ice539ebb4112f9df7fe3ea33945d729832c52b33
Delete ve-mw/test/index.php, it's broken and unmaintained

Change-Id: I5153fde7897b5d6c3d6f1222c3c56593d256dac7
Merge "update tests for latest release- no issues found"
Merge "Always deep copy when writing to and reading from the fake clipboard"
Localisation updates from http://translatewiki.net.

Change-Id: I077144b0792b6e11fb8d866088dd372c4aa374be
Add alt attribute to core image nodes

Also update and refactor tests.

Change-Id: I96d08faed42118b713af8011c5d6befb760e65c9
Merge "doc: Fix incorrect syntax"
Use EventSequencer for CE Surface events

Change-Id: I662b164b7bff16ec957f3e06004e477be27282b0
Timoize the EventSequencer into a sleek, purring monster

Change-Id: Ia925d76d9a41b777861621724ced4db8371786b8
Merge "Replace renderingEnabled toggle with lock counter"
Replace renderingEnabled toggle with lock counter

modules/ve/ce/ve.ce.Surface.js
* remove methods enableRendering/disableRendering/isRenderingEnabled
* add methods incRenderLock/decRenderLock/isRenderingLocked
* Consequential method call changes
* try-finally blocks around incRenderLock/decRenderLock pairs

modules/ve/ce/ve.ce.ContentBranchNode.js
* Consequential method call changes

Change-Id: Icb71bf536c7bad3a6c0c6512a2efb9565b5bd086
Localisation updates from http://translatewiki.net.

Change-Id: I67077ef175e1ba8ef7d2e13cdfa73972b95d7a6c
doc: Fix incorrect syntax

These are not considered errors in jsduck 4.x but are in 5.x.

Though we don't specifically want to support 5.x yet, these are
actually genuine errors that were already causing incorrect
documentation to be generated, even under 4.x (it just doesn't
warn for these under 4.x).

Not from 5.x warnings, but fixed while at it:
* Removed more redundant @method
* Added a missing @returns for ve.Range#flip
* Added newline at EOF

Change-Id: Idc22b46b082a813e8e1761403e1ebf908bf690c4
update tests for latest release- no issues found

Change-Id: I84830927a72a908fa4b676ccdbbd33afd8835638
Remove no-insertion metadata corner case from `ve.dm.Transaction.pushReplace()`.

This version pushes a `replaceMetadata` operation after a `replace` to
fixup trailing metadata if there is no inserted region and the removed
region includes metadata.  This avoids a corner case where the
size of the metadata arrays inserted/removed in `Transaction.pushReplace()`
do not match the size of the data arrays inserted/removed.

We remove the now-unused `Document.getMetadataReplace()` method.

We also adjust `MetaList.onTransact()` so that it continues to work
properly when the number of metadata entries in `replace.insert` is
not the same as the number of metadata entries in `replace.remove`.

Change-Id: I1d600405b855ca1cb569853bb885b0752df47173
Correctly preserve metadata in `Transaction.newFromUnwrap`.

The `Transaction.pushReplace` method has a corner case if the removed
region has metadata and the inserted region is empty.  This works fine
unless there are two adjacent `pushReplace` operations, which can occur
in `Transaction.newFromUnwrap`.  Fix this by having `pushReplace` look
at a preceding replace and correctly merge the two operations if
possible (in particular in the tricky case where the previous case has
a zero-length insertion).  Pleasantly, this can be done without a lot of
special-casing code in `pushReplace` or `newFromUnwrap`.

Add test cases verifying the `newFromUnwrap` works correctly (both
in commit and in rollback) when there is metadata present.

Change-Id: I6cfec0d2b1823dad724422f018a3c73dc0c7f186
docs: Minor improvements

CODING.md
* Document the procedure for adding a new javascript class

ve.dm.MWExternalLinkAnnotation.js
ve.dm.MWInternalLinkAnnotation.js
ve.dm.ElementLinearData.js
ve.dm.LinearData.js
* Add whitespace line before preformatted code to fix a
  rendering bug

Change-Id: I54443ea3d4799328655d279f379d4ddc176c50a0
Add abstract method for getMediaSources.

Change-Id: I8c51d91a1f8ad1a8c688a6dd3de8ac53d4f8d3f9
Merge "Apply DOM changes in onProtectedSetup and onProtectedTeardown instead of constructor"
Merge "Define RDFa types in ve.dm.MWBlockImageNode once and reuse whenever possible"
Define RDFa types in ve.dm.MWBlockImageNode once and reuse whenever possible

Change-Id: Iebb2081dee4555f459adaa4cb9b802c283cf4827
Sort i18n messages

Change-Id: Ic736fd63aa76c324edb67b303aadb269221ab213
Apply DOM changes in onProtectedSetup and onProtectedTeardown instead of constructor

It's important in case of replacing root element ($) of a node, so new element
does have CSS class and contenteditable property set.




Change-Id: Icf14e2164e89114e6b7c10672b782d02f4c5daac
Merge "Fix doc comment in ve.ui.Surface.js"
Merge "Add group to internal list items in test data"
Merge "Fix ridiculous MetaList test case"
Localisation updates from http://translatewiki.net.

Change-Id: Ia59933d9eea977a1aa294468b63fb46ce78510de
Fix doc comment in ve.ui.Surface.js

Change-Id: I3784ff22bde13440ad63b042337ae38e07661995
Add group to internal list items in test data

Previously we were just omitting the first parameter to
queueItemHtml()

Change-Id: Ib4b6d2877d6cfe6b8469a300f89a4a54cbec6da3
Fix ridiculous MetaList test case

Doing retainMetadata followed by a replace (not replaceMetadata)
doesn't make any sense and its behavior is undefined, so don't do that
in the test suite.

Change-Id: Ica032b0a5122d24e40e43e3eb43fea940270aece
Merge changes I247d1b68,I5a8ca28a

* changes:
  Fix getOffsetFrom(Element|Text)Node for annotated aliens
  Add test for getOffsetFrom(Element|Text)Node
Fix getOffsetFrom(Element|Text)Node for annotated aliens

* Replace addOuterLength with a recursionDirection as we only
  want to add length when the first recursion was to the left,
  and add nothing if we recursed to the right.
* Use isContentEditable which is the proper calculated boolean.
  contentEditable is often just (string)'inherit' :/
  Mercifully this works in in IE.
* Only check for the IE ce bug if we aren't recursing at all.

Bug: 53766
Change-Id: I247d1b68484cb510335b5f6789269ec254376cfe
Add test for getOffsetFrom(Element|Text)Node

Assert the result at every offset in the DOM.

Change-Id: I5a8ca28a7ee22c49d23077ad6993499ec726bbb3
Merge "Exclude tools from catch-all menu in media and reference edit dialogs"
Merge "Internal lists render nothing in the CE"
Merge "Reference core bug 53774 in bug 49000 comment"
Exclude tools from catch-all menu in media and reference edit dialogs

Change-Id: Ic3c94099fa1db5b1a40ac2a2dbf17562cb36c73b
Internal lists render nothing in the CE

Previously they were rendering hidden spans.

Remove hiding from internal items as they have no rendered parent.

Change-Id: Iacc12715900123cd5ab0ddefa713e57e9bea0d1b
Always deep copy when writing to and reading from the fake clipboard

Otherwise, changes to deeply nested structures like template blobs or
references will leak from the data model into the clipboard data.

Change-Id: I85d8d311f676d45856f30b3747e7383c70c95460
Merge "Improve welcome dialog support for large fonts"
Merge "Insert images after selection, not in place of it"
Merge "Fix context menu position for small inline nodes"
Improve welcome dialog support for large fonts

Objective:

* Make the welcome dialog work with smaller fonts by increasing its
  size a bit, and also making its contents scroll vertically if needed

Changes:

ve.ui.MWBetaWelcomeDialog.js
* Move content into a scrollable and padded panel layout element

ve.ui.MWDialog.css
* Remove padding, now provided by panel layout

ve.ui.Dialog.css
* Remove min-height override, inherited value is fine
* Use max width and height instead of setting them directly

Bug: 52667
Change-Id: Ie35b041e13ef18ffcacef6d9e70439e4e1351e0a
Merge "Merge undefineds into undefined rather than []"
Quickfix Language Tool

Correcting the language span tool so the ve.ui.LanguageInspector has
static name changed from 'language' to 'meta/language'

Change-Id: I66fd3d2558663c9f1304365a11fd1276e204a7e7
Fix context menu position for small inline nodes

The context menu was being positioned incorrectly for small inline
nodes, such as references or small templates. This fix moves the context
to the bottom, as well as placing it on the right or left in LTR and RTL
directions respectively.

Change-Id: I55de2a6464d0544e32118bf95dbb85c33354f025
Merge undefineds into undefined rather than []

ve.dm.MetaLinearData.static.merge( [ undefined, undefined, ... ] )
returned [ [] ], make it return [ undefined ] instead. This allows
us to lazily use the merge function to create metadata without having
to worry about denormalizing undefined to [] all over the place.

Change-Id: I41fe6472c2185a6315119a546a73765966d013d3
Merge "ve.EventSequencer: Post-event listening"
Reference core bug 53774 in bug 49000 comment

Bug: 49000
Bug: 53774
Change-Id: I1f26c7ac770daca06ae3c87742c1b3e3d2b17e41
Localisation updates from http://translatewiki.net.

Change-Id: I47b498ccfde188fc872b1d1e549c857b9c5c20a7
ve.EventSequencer: Post-event listening

modules/ve/ve.EventSequencer.js
* Class to sequence pre-event and post-event listening correctly

demos/ve/eventSequencer.html
* Plain HTML example page for testing EventSequencer and event sequences

Change-Id: I4ddb10a30c2f44015136a7978a185d0b13f0690b
mw.ViewPageTarget.init: Don't add class ve-available when unavailable

In commit e1f8ee7 the return statement was moved into the
userPrefEnabled check, however addClass( 've-available' ) was
still unconditional. This has now been restored.

Change-Id: Ia59bfed93a8849a529cc3b9d1d2e0619d65240d4
Merge "Collapse metadata on any removal."
Merge "Cleanups for ve.dm.Transaction"
Cleanups for ve.dm.Transaction

Avoid making a copy of the entire data array by using `doc.data` and
`doc.data.getLength()` instead of `doc.getData()` and
`doc.getData().length`.

Get rid of some unnecessary conditionals in `Transaction.newFromWrap`: the
`tx.pushReplace()` and `tx.pushRetain()` methods will already gracefully
no-op if the replaced/retained region is empty; we don't need to add
extra control flow to handle that case.

Clarify offset math in `Transaction.newFromWrap`.

Fix a minor bug in `Transaction.newFromInsertion`: the final retain didn't
account for the length of the removed region, if `doc.fixupInsertion`
creates one.  (This usually doesn't happen.)

Remove an inaccurate TODO in `Transaction.pushReplaceMetadata()` -- it is
no longer a straight copy/paste of `Transaction.pushReplace`, so a refactor
isn't really called for.

Change-Id: I7d86a2449978365d69d4a5ed43116c2e9945475d
Merge "Offer the typed text as a link suggestion if the page is valid"
Merge "Kill domAttributeWhitelist in favor or renderHtmlAttributes"
Add keyboard shortcuts for formatting tools

Objective:
* Add keyboard shortcuts for paragraph, heading 1-6 and pre-formatted

Testing:
* Using [control+num] triggers appears to work well on Chrome, Safari, Firefox and Opera on Mac

Changes:
ve.init.Target.js, ve.init.mw.ViewPageTarget.js
* Add formatting commands to targets
ve.ui.MWFormatTool.js
* Add mediawiki specific format tools and commands
ve.ui.CommandRegistry.js
* Add commands for all formatting tools
ve.ui.TriggerRegistry.js
* Add triggers for formatting tools

Bug: 33512
Change-Id: I5d6176eff50aa3cea72aed226ca06512629412d4
Merge "Make tools generic and add fancy tool groups"
Localisation updates from http://translatewiki.net.

Change-Id: Iaac510e2649c4d6344d9d55fec3cd4261ee4a593
Insert images after selection, not in place of it

Bug: 52460
Change-Id: I69ce4c2473d57fd585df0c602359c1d0f60a58f7
Make tools generic and add fancy tool groups

Objectives:

* Got rid of mw prefixing in tools, inspectors and dialogs
* Simplify tool classes so they can be generically used as items in bars, lists and menus
* Add support for a catch-all toolbar group
* Simplify tool registration, leaning on tool classes' static name property
* Move default commands to command registry
* Move default triggers to trigger registry
* Get language tool working in standalone

Change-Id: Ic97a636f9a193374728629931b6702bee1b3416a
Localisation updates from http://translatewiki.net.

Change-Id: Ia8fdac964f88f6903c8c075b8b39eee61a3c6495
Localisation updates from http://translatewiki.net.

Change-Id: Ia19233cf6f01ca3673385164675ffebbd0197756
Collapse metadata on any removal.

In ve.dm.Document.getMetadataReplace(), we used to only merge metadata
if the amount removed is larger than the amount inserted.  But this
could end up putting metadata in odd positions, for example if you
have Foo[[Category:Bar]]Baz and you delete 'ooBa' and replace it with
{image}xxx{/image}, then the category ends up inside the image.

We should always merge metadata when a segment is deleted, so that it
appears outside any new structure added.

There's a weird corner case here when a segment is removed but no
insertion is made: the removed metadata then needs to get glommed onto
the next element.  We extend the insert/replace metadata array
when this happens.

Bug: 53444
Bug: 53445
Change-Id: I51d55fb370b473273f9cf152fdd0f356377d4109
Merge "ce: Use a better transparent pixel image"
ce: Use a better transparent pixel image

See also http://stackoverflow.com/a/13139830/319266:

> Some are unstable and cause CSS glitches. [If] you have an
> <img> and you use the tiniest transparent GIF possible, it
> works fine[. if] you then want your transparent GIF to have a
> background-image, then this is impossible. For some reason,
> some GIFs such as the following prevent CSS backgrounds (in
> some browsers).
>
> == Shortest (but unstable) ==
> data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
>
> == Stable (but slightly longer) *use this one* ==
>
> data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
>
> Also: don't ommit image/gif. This will break in several browsers.

For the record, this is not limited to rare browsers.
It also affects latest Chrome in some cases as confirmed by
Christian (it'd be white instead of transparent in some cases
when uses as a css background-image without border).

Change-Id: If9ff8a0820c217b6c23e3335944907939a37bef7
Merge "Include param label in search index"
Merge "Round trip alien extensions correctly when edited"
Round trip alien extensions correctly when edited

ce.MWExtensionNode
* Build up the wikitext for round-tripping using jQuery, and pass
  through the attributes from data-mw

dm.MWExtensionNode
* Use a static getExtensionName to correctly get the extension
  name from the dataElement (as the getMatchRdfaTypes hack won't
  work for MWAlienExtensionNode's)

dm.MWAlienExtensionNode
* Implement new static getExtensionName function

Bug: 53543
Change-Id: Id4e83c14ec68c3b3970d05317477f19aaf31abe4
Use a frame wrapper for all highlights on MWBlockImageNode

This prevents the highlight for a centred image being full width.

Change-Id: I4d5a46766276e36f5720f330a5a856fe2906cd72
Include param label in search index

Bug: 51670
Change-Id: I7f398bf26bf69d81b19fd258fddd490a6a81176c
Offer the typed text as a link suggestion if the page is valid

Currently we only offer the normalised page title from the server
so 'iPhone' only suggests 'IPhone'. With this fix we offer the typed
text as the first suggestion if it matches via mw.Title, so 'iPhone'
suggests ['iPhone', 'IPhone', ...]

Bug: 50452
Change-Id: I05cc0cd19537cbfa682d7aac0f9640decea282b5
Merge "Allow phantoms and focus areas to be overridden"
Allow phantoms and focus areas to be overridden

And actually use this functionality on MWBlockImage to
highlight centred images correctly.

FocusableNode
* Actually use $focusable to render the highlight correctly

ProtectedNode
* Allow a $phantomable element to define which element to
  highlight on mouseenter
* As phatoms are built off shields, make sure a shield is
  given to $phantomable

RelocatableNode
* Allow a $relocatable element to define which element the
  relocatable marker is measured against

ui.Context
* Use $focusable (when available) for positioning the popup

Plus some documentation fixes

Change-Id: I370337239af4fc935cd86757b3ce03011bae5ba8
Localisation updates from http://translatewiki.net.

Change-Id: Ib9e3550d805b70a970426ce867d5bb23211fc6c5
Merge "Re-build reference search index so they can be used mid-edit"
Re-build reference search index so they can be used mid-edit

The search index was only being built on initialization, rather than at
the time the list was being shown. By moving it to be built on open
the list will always be fresh. Also, just after building the index, we can
enable/disable the select existing button based on the number of
results.

Bug: 51689
Bug: 51848
Bug: 52000
Change-Id: Ib38b1b227edc3d61dc49fa58999358e7adf11b08
Merge "Expose version information in the client"
Merge "VisualEditor: RTL entries don't receive dir="rtl" in Page settings / Languages"
use regexp anchors to prevent false matches

Change-Id: Ib13b85986e3df431b0f900fea38165197411370e
VisualEditor: RTL entries don't receive dir="rtl" in Page settings / Languages

We call isRedirect to get the real language code instead of the site code.
Post-factum, lang attribute is added as well for each entry.

Bug: 53503
Change-Id: Ia6bf63a7cbe3c7b99ed05d0bd0fdd33190550c98
Expose version information in the client

By passing in the information via a ResourceLoaderModule this
gets around any concerns with performance (version information
is read from the file system).

The version information is appended to the beta toolbar dialog.

Bug: 53050
Change-Id: I7836e1d4003416cbb7e18e3435aa87d82fd5c2e2
data: Rename MessagesModule to DataModule

Also..
* removed an incorrrect comment referring to the old module
  name (standalone didn't use the VisualEditorMessagesModule).
* made it use debug mode to determine whether to minify or
  prettify the js code.

Change-Id: I493007649fba27e7faab0cf743eded5f68714c50
Cursor fix after link insertion

When a link was inserted, the cursor position was backwards (at the
beginning of the word rather than its end) - this commit fixes that
problem.

Also, thanks for the help Ed!

Bug: 53560
Change-Id: I04fe1ca4c9126898e7bf85cdf519794d66b4f38b
Merge "When pasting, try to use original range"
Merge "Always give references names. Ignore if used once."
Merge "Add David to author lists"
Add David to author lists

Change-Id: If46dc34381e5cc7c3fbfc9886868cd1a63bf7a47
Merge "Set contentEditable using jQuery#prop"
Set contentEditable using jQuery#prop

Also always use strings 'true'/'false' for the value, because
it is a string property (spellcheck, however, is a boolean)
and always use a capital second 'E' in the name.

Change-Id: Ia4e1f9edfd8f236fe81df190e6a68729d7b52243
Merge "Followup 41a4b3fb: use .not()"
Merge "Add dual detection for types that Parsoid is about to rename"
Merge "Add ULS to the standalone"
Merge "Actually move the experimental LanguageInspector messages into the experimental module"
Add ULS to the standalone

Also rerun makeStaticLoader

Change-Id: If9fae5dc5ea37567c50ab5d462308ff05e053c8c
Actually move the experimental LanguageInspector messages into the experimental module

Change-Id: I91453bfa535b1b5a8c6c495a5857977a646434d6
Fixing inspector popup position

The inspector popup should appear relative to the position of the related
calling method - either relative to the cursor (like in links and language)
or relative to the focusableNode (like in templates/transclusion).

Bug: 50905
Change-Id: I07f58d0c6561adecbec560fc24bcb6e590f2cd9f
Merge "AnnotationInspector insertion over blank selection"
Merge "Move contentEditable=false to protected node"
Merge "Rename 'DOM Changes' => 'DOM changes'"
Add dual detection for types that Parsoid is about to rename

Bug: 53432
Change-Id: If404585f9a118b4155ceb46fbe8e467b41ec6b29
Move contentEditable=false to protected node

Because that's where it should be.

Bug: 53507
Change-Id: I9afffea238a774b884d4d2434d3523e4c4e445b2
Rename 'DOM Changes' => 'DOM changes'

Because we don't use title case in comments

Change-Id: I5cdd3241aba0727a3cd5d0ded972ae54abf1efd0
Moved VisualEditor Selenium tests from browsertests repository

Requested by James Forrester at QA mailing list:

http://lists.wikimedia.org/pipermail/qa/2013-August/000339.html

Bug: 53467
Change-Id: I915b4e41d32c9190ccea73f2b3bce9a53918fe80
Always give references names. Ignore if used once.

This avoids problems when unnamed references were copy-pasted.

Knowing that key is always non-null simplifies a lot of logic
elsewhere.

Bug: 53365
Change-Id: I3a23123ae732d9583814d38dd880a0cdf691fd5d
Merge "Fix typo (was comma instead of semicolon)"
Merge "Check clipboardData exists before accessing it"
Fix typo (was comma instead of semicolon)

modules/unicodejs/test/unicodejs.wordbreak.test.js
* fix typo

Change-Id: Ieef78b4f51054b760217c8e2f12a4510857ee88a
Check clipboardData exists before accessing it

Bug fix for browsers which don't have an event.clipboardData
property. The check is done correctly in onCopy but not onPaste.

Change-Id: I3cdf4c0358aa145dcb70c2c103d08a0002001fd4
Merge "Add support for single scripts, styles and debugScripts"
Add support for single scripts, styles and debugScripts

Objective:

* Make makeStaticLoader.php compatible with ResourceLoader module
  definitions that use a string instead of an array with a single element
  when describing a single file

Changes:

maintenance/makeStaticLoader.php
* Cast styles, scripts and debugScripts to array when iterating over them

Change-Id: Ib91daba732c2035145c479467a0b6b9ca3155659
AnnotationInspector insertion over blank selection

This commit fixes two issues with insertion of annotations in blank space:
* LanguageInspector issue with inserting an language annotation inside any
  whitespace (selection of space between words or collapsed selection in
  blank line)
* AnnotationInspector issue with collapsed selection inside slugs. If
  the marker was in a slug collapsed selection, activating
  AnnotationInspector would expand the range to the closest word (on the
  next paragraph). This commit makes sure the expansion for the next word
  only happens if the selection is outside a slug.

Change-Id: I144eccefba16131a3d2ec6a3181adf47a15d6cc0
Disable inserting/changing references when surface widget is empty

This listens to change events on the surface and checks to see if
there is more than just an empty paragraph node.

Bug: 53345
Change-Id: Ic8fa84d7cdcbffd154178939d0ec8c2c4f86c415
When pasting, try to use original range

This functionality was (accidentally?) removed by I8f8a240a. It
stops us from over-zealously balancing data when we can get away
with just pasting the original selected range (e.g. it always wraps
collections of text and content nodes in another paragraph).

Bug: 53364
Change-Id: I93fa56c4e43083993c310e0050087e9d1de1e08b
Merge "Detect outdated pending post KeyPress handler"
Detect outdated pending post KeyPress handler

modules/ve/ce/ve.ce.Surface.js
* Schedule the post-keypress async handler in a way that can be cancelled.
* Cancel it and run the handler immediately if another key event happens.

Bug: 53079
Change-Id: If139ff3230c10caa616743f71659c4606d290310
Followup 41a4b3fb: use .not()

I claimed that it didn't preserve text nodes, but it does. It's just
that there's a bug where it doesn't preserve text nodes if the selector
passed to it is too simple, but 'link, meta, style' is complex enough
to avoid triggering this bug.

Change-Id: Id4a60dc87b8d4c613bc7013641b116dd7c331ac1
Actually use GeneratedContentNode in AlienNode

ce.AlienNode was mixing in GeneratedContentNode, but wasn't actually using
it properly. This commit fixes this so that AlienNode can benefit from
the <meta>/<link>/<style> stripping code in GeneratedContentNode.

Also added a getHashObject() function to dm.AlienNode to summarize the
domElements attribute because ve.getHash() chokes on it otherwise.

Change-Id: Ief3be94f9730297abe0e3c57506b81a8ff1d136d
Merge "Language Inspector Default Fix"
Merge "Give document real focus after cut"
Merge "Copy-paste data fixes"
Merge "Don't render <meta>/<link>/<style> tags in GeneratedContentNode"
Don't render <meta>/<link>/<style> tags in GeneratedContentNode

There is no good reason why we'd render these tags, and their presence
causes Chrome to crash while cutting across them.

Bug: 50043
Change-Id: I611e3907cf20fa27dbef89ea941d0b787a44ba4f
Merge "Make ve.dm.Surface.{start,stop}HistoryTracking idempotent."
Make ve.dm.Surface.{start,stop}HistoryTracking idempotent.

Add a little robustness, guaranteeing that we don't end up with multiple
history tracking tasks running, leaking one, or try to clear a non-running
interval.

Change-Id: I41db2d6fefc7f45f150aa14ecefc648760ad6200
Avoid crash after ve.dm.Surface.purgeHistory().

The selection property is never null; it is initialized to Range(0,0).
If it is set to null in purgeHistory(), the next call to
ve.dm.Surface.change() will crash.

Change-Id: Ia45c0ba26291e8ad09c445fdf2323710b5ab409f
Kill domAttributeWhitelist in favor or renderHtmlAttributes

domAttributeWhitelist wasn't actually being observed. Instead, we
already had the code in place to treat renderHtmlAttributes as a
boolean/whitelist/blacklist hybrid, it just wasn't used that way
yet.

This makes the interface nicer and fixes the bug where all attributes
(including data-parsoid and even things like onmouseover) were
rendered by CE.

Change-Id: I02e266c7c7dc197ed845164b7a705d786846a33b
Give document real focus after cut

If only a FocusableNode is selected the document doesn't have
real focus, so we must do it manually.

Bug: 53362
Change-Id: I781f59dda7f2884ff02f6688c2c8c037ac7ed1a6
Copy-paste data fixes

* Assign cut/copy/paste events to the document so that
  they are triggered when the CE doesn't have real focus
  e.g. only a FocusableNode is selected
* Use clipboardData.setData when available. The key can
  be stored and retrieved perfectly in text/xcustom but
  this technique doesn't work in FF or IE
* Just use text content for key as this is what is written
  to the clipboard, so this can be used directly without
  having to get the content from the pasteTarget.

Bug: 48604
Bug: 49396
Change-Id: Ib3702f9441f6ee3fa34ec071f00994dd7e591d99
doc: Restore and clean up documentation for Platform subclasses

- Added missing @inheritdoc so that generated documentation is
  not empty.
- Fixed type of mw.Platform#getMessage from (implied) @property
  back to @method.
- Removed notes from mw methods. They are prepended instead of
  appended, thus overriding the useful single-line summary
  of the method with this random note. Description should either
  be replaced entirely (e.g. no @inheritdoc) or inherited.
- Rephrased a few description to be consistent with the others
  (e.g. "Get .." and "Add .." instead of "Gets .." or "Adds..").

Follows-up cbe35632f1.

Change-Id: Ie55bb9e18f1524b706f0e195300170e4d552bf73
Localisation updates from http://translatewiki.net.

Change-Id: I53d192d6c9707607e73a898e5f0fb67dc0893de2
Language Inspector Default Fix

Fixes the situation where there's a language set but not a direction.

Change-Id: If353b36ff0700717f1b8fd917b39c230de5ec272
Localisation updates from http://translatewiki.net.

Change-Id: I053f2b2ff32b39698b2787ec5dc5655d517df117
Localisation updates from http://translatewiki.net.

Change-Id: I71613b21444c5f3f93e9e466117fafed408706dd
Localisation updates from http://translatewiki.net.

Change-Id: Ib524732b1df65c6a1f1b102635b339056a29a1bd
Merge "Modify regex to allow section links as valid titles"
Reverse the progress image for RTL

The reversed image was created by Ebraminio using
convert loading.gif -flop loading2.gif

Bug: 51401
Change-Id: I264d9368cf8fd030ff34540e50e0038aa42ece16
Localisation updates from http://translatewiki.net.

Change-Id: Ib19ff7142926f19d7f27a0c160be4fc4aee588a6
Modify regex to allow section links as valid titles

Bug: 53219
Change-Id: I552d0128de2c1ca683e30ae6d4b9fb137b827c7d
Merge "Fix copy and paste of backwards selction"
Merge "getAnnotationsFromRange should only ignore non-content data"
Fix copy and paste of backwards selction

Was previously broken as getSlice was using ve.Range#equals to
compare ranges which is direction-sensitive.

Bug: 51538
Change-Id: Ib58d1d8fd11b62388c111a5da66171d13a9db9c2
Merge "Spruce up VisualEditor's README file."
Spruce up VisualEditor's README file.

Convert to Markdown, for better rendering in github.  Link more
prominently to install instructions in the README, also mention
Gerrit and the code style and API documentation.

Change-Id: I8e26fea108c32f37078e363f1af18eaf28b83516
Merge "Don't emit Surface changes back to the Surface"
Use mw specific names for commands

Objective:

* Use the MW link specifically, since the target/command system doesn't
  understand the group/id/extension concept yet

Change-Id: I8b756fa0bb55468312bb30d45ac5b943ff7362b5
getAnnotationsFromRange should only ignore non-content data

Currently ignores all non-element data, but element content (e.g.
images) can be annotated.

Added test cases and updated the test runner to only compare
store indexes for a more readable output.

Bug: 50127
Change-Id: I234586a28072811c8288aab56f6abaaa0da0c88d
Localisation updates from http://translatewiki.net.

Change-Id: Ib82999c8871732792abe806bdc59e5a87380740b
Don't emit Surface changes back to the Surface

modules/ve/ce/ve.ce.SurfaceObserver.js
* add emitContentChanges argument to poll (and start and stop)

modules/ve/ce/ve.ce.Surface.js
* Pass emitContentChanges=false to calls to start/stop in certain places
* Explicitly pass emitContentChanges=true elsewhere, to preserve prior
  behaviour

modules/ve/ui/ve.ui.Surface.js
* Explicitly pass emitContentChanges=true to poll

modules/ve/test/ve.test.js
* Escape non-BMP unicode text literals (to prevent potential editor
  problems)

Bug: 50105
Bug: 50346
Bug: 50631
Bug: 51477
Bug: 52716
Change-Id: I19ec7eaa0e3224cbfc7e7188e964183d7393c9a7
Replace <alieninline> with <cite>, a valid HTML tag, in demo

Otherwise weird things happen, like protected nodes don't render.

Change-Id: I3c515fbccf64d7497353c832818b21e2ca66c592
Merge "Toolbar API"
Toolbar API

Objectives:

* Make it possible to add items to toolbars without having to have all
  toolbars know about the items in advance
* Make it possible to specialize an existing tool and have it be used
  instead of the base implementation

Approach:

* Tools are named using a path-style category/id/ext system, making them
  selectable, the latter component being used to differentiate extended
  tools from their base classes, but is ignored during selection
* Toolbars have ToolGroups, which include or exclude tools by category or
  category/id, and order them by promoting and demoting selections of
  tools by category or category/id

Future:

* Add a way to place available but not yet placed tools in an "overflow"
  group
* Add a mode to ToolGroup to make the tools a multi-column drop-down style
  list with labels so tools with less obvious icons are easier to identify
  - and probably use this as the overflow group

Change-Id: I7625f861435a99ce3d7a2b1ece9731aaab1776f8
Merge changes Id2328d6e,I840b689d

* changes:
  Remove language variants from bold/italic now we have fallbacks
  Implement fallback langauges
Merge "Remove duplicate comments from platform code"
Merge "Subscript is one word (and so is superscript for that matter)"
Subscript is one word (and so is superscript for that matter)

Objective:

* Unify the capitalization of subscript and superscript

Change-Id: I5a7fbc2d864c896ebb26177cf05c7adddacd8829
Remove language variants from bold/italic now we have fallbacks

Bug: 53094

Change-Id: Id2328d6e7f89cd9deddde67b57cd7e3fc55683e6
Implement fallback langauges

Return an array of languages instead of a single language. Languages
containing hyphens return themselves along with the root code e.g.
'en-GB' => ['en-GB', 'en']

Change-Id: I840b689d0021d865f93d16d075473a2ed0a9f0d8
Remove duplicate comments from platform code

Inherited methods don't need to repeat documentation.

Change-Id: I05c4efe8e4a394411922add5f11259d47d44e3bb
Localisation updates from http://translatewiki.net.

Change-Id: Idd09eb782a44fd604282edf7818ecc27d0bb2e22
Merge "Fix issue in 7673a398"
Merge "Correct unicode range in legal title regular expression"
Merge "Change be-tarask to use Te instead of Te-El for bold"
Correct unicode range in legal title regular expression

The old regex was lifted from PHP, which matches on UTF-8 byte sequences.
In PHP, [...\x80-\xFF]+ matches any bytes with the high bit set, which
by the particular properties of UTF-8 will match any sequence which
represents a Unicode character above U+007F.

In Javascript, regex matching is on UTF-16 Unicode code units, so we
don't have to do byte sequence matching (and cannot do so). So the
equivalent Javascript regex should use [...\u0080-\uFFFF]+, to match any
code unit above U+007F directly. (It also matches surrogate pairs, by
the particular properties of UTF-16, so any Unicode codepoint above
U+007F is matched).

Change-Id: I674b89f757b60331dd1cb23fd7ff8b18775012e9
Merge "Increase line height in beta warning"
Merge "Preserve selection when inserting references"
Merge "Don't change config during toolbar setup"
Preserve selection when inserting references

Some browsers (e.g. Firefox) change the CE range when the dialog
is opened, so after the first surfaceModel change (to modify the
internal item) the surface's selection is modified, and the reference
is inserted in the wrong place.

Bug: 52159
Change-Id: Ia5da33b95a599ba78f308cf0554279ad44616f50
Minor syntax error

End of line comma instead of semi-colon.

Change-Id: I6e8d56e378b2a0f8846d18c413b0cccfb9b780d0
Change be-tarask to use Te instead of Te-El for bold

Bug: 53094
Change-Id: Ia442285e0d3f868fdda0bf06b8bb8f034c6c039f
Don't change config during toolbar setup

Problem: When the toolbar is created twice with the same config object,
the second time around the tools are still bound to the old surface

Reason: The tool config is overwritten such that symbolic names of tools
are replaced with instances of tools, bound to a specific surface. The
second time around, the creation fails (silently in a try-catch) and then
the already translated list of tools is used to create a new toolbar
filled with old tools still bound to the wrong surface.

Solution: Leave the config object alone, and instead build a new list of
tool instances while iterating through tool names.

Bonus: Don't fail silently. Using a try-catch to detect whether a
requested tool is supported masks other errors, and is evil. Instead,
just do a lookup and skip tools in which the lookup's result is falsey.

Change-Id: Ic43ec29173e556592bb3db9399ff83787e0a6857
Merge "Revert "Don't emit Surface changes back to the Surface""
Revert "Don't emit Surface changes back to the Surface"

This reverts commit 1987d3aa2bd97a6ea9961f4909103165c03634b5.

Change-Id: I5aaa6b0c743fbf6292030f566b6f7d993de740a7
Localisation updates from http://translatewiki.net.

Change-Id: I9f90aa03b9fdda135177d31ca436e85201b810c3
Increase line height in beta warning

See bug for screenshots.

Bug: 53045
Change-Id: Ia4e97f42786cb8ced9ab1c94b1cce9f4abd17750
Don't emit Surface changes back to the Surface

modules/ve/ce/ve.ce.SurfaceObserver.js
* add emitChangeEvents argument to poll (and start and stop)

modules/ve/ce/ve.ce.Surface.js
* Pass emitChangeEvents=false to calls to start/stop in certain places
* Pass async=false in the onDocumentKeyDown call to stop
* Explicitly pass emitChangeEvents=true elsewhere, to preserve prior behaviour

modules/ve/ui/ve.ui.Surface.js
* Explicitly pass emitChangeEvents=true to poll

modules/ve/test/ve.test.js
* Escape non-BMP unicode text literal (to prevent potential editor problems)

Change-Id: Ia96efad0c808b9a02e508bbfda65fdf4f5cedeff
Localisation updates from http://translatewiki.net.

Change-Id: Ia82ef889266c4506feb6f79e56c4a3096f7fcc41
Localisation updates from http://translatewiki.net.

Change-Id: Icb4b717e15df1c3f87a79f1a7b6f6a9c3992a18f
Merge "Localisation updates from http://translatewiki.net."
Localisation updates from http://translatewiki.net.

Change-Id: I6a3c30e123f4d8713925c4f3b743dbaa593b47b4
Build link-less images with <span> not <a>

toDataElement part fixed in  I6d496f7. This fixes the
toDomElement part so we don't trigger a round trip warning.

Bug: 51963
Change-Id: I27a7579890d669a8b980710db1bafe066b744236
Merge "Check for past/future state in undo/redo before setting breakpoint"
Check for past/future state in undo/redo before setting breakpoint

This isn't a problem when using the UI buttons as they get disabled
but the command keys can still trigger these methods.

Also fix hasPastState to include check for small stack. This fixes
an existing bug where the undo button doesn't become active until
~1s after the first change is commited (i.e. after the small stack
is committed to the big stack).

Bug: 52113
Change-Id: Idbd34953c805620881a609409290256462af80a5
Merge "Create a subscript tool"
Merge "Create a superscript tool"
Merge "Create an underline tool"
Merge "Fix traversal for images with link=''"
Merge "LanguageInputWidget Generalization"
LanguageInputWidget Generalization

This commit prepares the LanguageInputWidget to handle both annotation
and node, so it can be used as the GUI for both the LanguageInspector
and the LanguageBlockInspector that's coming up.

Cleaned up the way annotations are read into LanguageInspector and
AnnotationInspector. The attributes are kept in the Widget (without regard
to what datamodel they will serve) and are then read from the inspector.
The LinkInspector had to be adjusted slightly to accomodate a small change
in the AnnotationInspector too.

Change-Id: I17954707c00ffc4c32fbb44a6807a61760ad573c
Fix issue in 7673a398

The update event passes in a transaction object, which was interpreted
as a config object and fragmented the cache. Explicitly wrap the
update() call in an event handler to make sure the config parameter is
undefined.

Change-Id: I641c68230b92d23626fb8b12aeab6a8904a35bcc
Use internal ve.track to log events

This patch rounds off change I29740fa7a by replacing calls to EventLogging's
eventLog.logEvent with calls to VisualEditor's ve.track. ve.track publishes
events by providing an interface, ve.trackRegisterHandler, which event handlers
use to subscribe to VisualEditor events. By making it the responsibility of the
web analytics framework to register itself as a handler, VisualEditor can
remain decoupled from (and indeed ignorant of) any particular event logging
implementation. This allows VisualEditor to be integrated with many different
web analytics platforms with nothing more than a bit of glue code for mapping
ve's event semantics to those of the target platform.

The practical difference that this makes is that it frees VisualEditor from
having to know about EventLogging or from having to load EventLogging
components, which means we can remove quite a lot of gnarly code. My current
plan is to migrate the code for registering and loading the 'Edit'
schema module to Extension:CoreEvents, which is also where I'll commit the
handler for VE events. (CoreEvents exists precisely to provide an organized
place for persistent but WMF-particular instrumentation.)

Once this patch is merged and deployed, the following two configuration
variables may be removed from mediawiki-config:

- $wgVisualEditorEnableSplitTest
- $wgVisualEditorEnableEventLogging

Change-Id: Idfdf692668d2adfbe029e8f0c4ff9e96c60ff741
Create a subscript tool

Bug: 51612
Change-Id: Ia05e09a411213cbc035ad9dd3d3156d57f8e102c
Merge "Localisation updates from http://translatewiki.net."
Merge "Add ve.track, a generic dispatch of analytic events"
Localisation updates from http://translatewiki.net.

Change-Id: Icef4cb792f89c5c36c3fc3b79ed0a5008fe0bd1d
Fix traversal for images with link=''

We were assuming images were wrapped in <a> tags. Images with
link='' are only <span> wrapped.

Bug: 51963
Change-Id: I6d496f719cfbbc7556c55f0a660cb192040f29de
Create a superscript tool

Bug: 51611
Change-Id: I74b6418542927eeeb7e80d664a30fcaf07b93a13
Create an underline tool

Bug: 51609
Change-Id: I65246d7eeb154950c35a1cb70909a113080c2323
Reposition context menu after rerender

Add rerender event to all image loads in MWExtensioNode.
MWHieroNode's implementation of onParseSuccess is now the same as
its parent so can be deleted.

Change-Id: Iaa4999372f1ba88a7bdf1490fc3f8640af77ceae
Fix MWAlienExtensionNode's extensionName in ce update

Create getter for extensionsName which is overriden by
MWAlienExtensionNode.

Also removed angle brackets around Alien title as the inspector
already has an angle bracket icon, and a '<' close button.

Change-Id: Ice8c5d73ed621f8e585b5f372788666f8c5aeb50
Fix logical conflict from I8feefd9e8

onUpdate was renamed to update. Also neither event was
actually implemented so have just removed them.

Change-Id: Iaae1661a99f97272fa42c71223fc2cb832d50c66
Merge "mw.Target: Removed unreachable badtoken recovery code"
Merge "Support previews and concurrent updates in ce.GeneratedContentNode"
Merge "Prevent the creation of invalid MWInternalLinks"
Merge "Fix rendering of inspector for embedded buttons"
Merge "Allow inspectors to not show the delete button"
Localisation updates from http://translatewiki.net.

Change-Id: I09f393358ff404728e856712f51d7bffbb8efb7b
Fix rendering of inspector for embedded buttons

Previously we assumed that embedded icons mean we weren't
dealing with an inspector, but that is not always the case
(e.g. MWExtensionInspector).

Bug: 52845
Change-Id: Ifc5b054568661cb9badf6d7991f512b81e649b36
Allow inspectors to not show the delete button

This functionality makes sense for annotations, but not for extensions.

Change-Id: I64fea941f8e01d0464eb9a045257f4810d789d60
Localisation updates from http://translatewiki.net.

Change-Id: I40e6390e0088541e4e1da0b4eb136bc9ff732446
Localisation updates from http://translatewiki.net.

Change-Id: I464c61ff1e48b40f5c2c22169f44c5b985541990
Localisation updates from http://translatewiki.net.

Change-Id: I007bc086ebb70124cca68d24eabc2e3f7acec62a
Localisation updates from http://translatewiki.net.

Change-Id: I354e3f30e3a905384793f0c819ebd99882894e16
Localisation updates from http://translatewiki.net.

Change-Id: I31170014c38dd3f8afddeca9799a5ef30113a357
Merge "Generic support for multiple tags in TextStyleAnnotation"
Generic support for multiple tags in TextStyleAnnotation

Bug: 52477
Change-Id: If8e2f541adb045f9b84a913829a5b7430ca83299
Localisation updates from http://translatewiki.net.

Change-Id: Iec31684111c51604cff49e1d20cbf7912ff57576
Merge "Darker toolbar group border"
Merge "Alien extensions"
Alien extensions

VisualEditor.i18n.php, VisualEditor.php
* Button title
* New experimental files

ve.*.MWAlienExtensionNode.js
* Very basic extension of ve.*.MWExtensionNode

ve.ui.MWAlienExtensionInspector.js
* Default to inline-block for wrapper. Should probably
  get rid of styled wrappers for GeneratedContent eventually.

ve.ui.MWAlienExtensionInspector.js
* Basic extension of MWExtensionInspector. Override title to
  use tag name e.g. '<easytimeline>'. Could be changed in future
  to 'Extension: easytimeline' or similar.

*.png, *.svg, *Icons*.css, ve.ui.MWAlienExtensionButtonTool.js
* Angle bracket icon for button (open to suggestions)

ve.ui.MWInspector.css
* Make extension inspector text input tall by default.

Change-Id: I07f0686839192cad3cd8dfd3233ae907fe5cdf6a
Darker toolbar group border

Roan and I think this is way too light. The only way
I can tell it's a group is by mousing over all of
the icons back and forth really quickly :)

Increasing to 10% alpha.

Change-Id: Iab55bf64921de5247d10d611318e545efe74fe4a
Merge "Handle <tt> as textStyle/code"
Support previews and concurrent updates in ce.GeneratedContentNode

GeneratedContentNode didn't track concurrent updates at all, so a
race condition was possible: if the node was updated a second time
before the first update had been rendered, the second update might
render first and then be overwritten by the other one.

To prevent this, we track the promise associated with the current
render. If a new update is launched while a previous one is still
pending we attempt to abort the old one by calling .abort() on it,
and ignore any future resolution or rejection from it.

Also allow rerenders based on non-model data by calling
.update( { config object } );

Change-Id: I8feefd9e8fb6c41d06b8b20131e3be5e37954e83
Fix deprioritization of regex matches in ModelRegistry

If you had an HTML element that was matched by two models, one with
a direct string match and one with a regex match, then the string
match would beat the regex match (which is correct) if they both
specified a tag name, but the regex match would win (which is wrong)
if they both didn't specify a tag name.

The fix is to only check for tagName === null if we're in tag-agnostic
mode (tag === '').

Change-Id: I9943611111e4c4ff498cdd95b7b3e72f95fb413b
Allow customisation of ui.Window titles

Provide getTitle() so subclasses can do something fancier than just
set a message.

Change-Id: I5eb82f70e39a991fa577aae4b0e7344908134d89
Localisation updates from http://translatewiki.net.

Change-Id: I70cce8923d59e78b6461b89d2ee3e51030d076d6
Merge "clean up: Consistently use MW instead of Mw in constructor names"
Don't set a group for VE ResourceLoader modules

The grouping behavior is unnecessary for the main payload, and
actively hurting us for the init-init module.

Change-Id: I111e28e5c759bf43412c5b1432ec9c8a2102d7dc
clean up: Consistently use MW instead of Mw in constructor names

Most of 'em already do. Fixed the remaining ones.

Change-Id: I1a7ccb27dd66a33265dcaddaa7d34953d328ff87
Hieroglyphics support

Mostly as a demonstration of how easy this is with MWExtensionNode.

The icon was chosen with the following criteria:
1. Recognisable (the ankh is quite common in popular culture, right?)
2. Doesn't look idiotic to academics (I've consulted an Egyptology
   PhD and they can confirm it's not the glyph for penis)
3. Renders well at <16x16

That said it does look a little like a stick man...

Bug: 43118

Change-Id: I9f9e8af501401866bfeecf0eec3690a705fbd4db
Create base MWExtensionNode for simple extension support

MWMath and other simple extensions all behave in a similar way, e.g.
<tagname>Foreign syntax</tagname>.

This creates a base class that should make supporting such extensions,
and editing their contents in a plain text box, very simple.

Change-Id: Icc0acb33fe32704f71dacb552d9dfa3142eaef2b
Add .static.getMatchRdfaTypes() wrapper

This allows abstract classes to specify RDFa types based on a static
property overridden by a child class. The default implementation is to
just use .static.matchRdfaTypes.

Change-Id: Ic71fc552a6a1626d94f998e9517af971e8198e79
Create strikethrough text style button

Experimental to avoid making toolbar too long

Bug: 51610
Change-Id: I1eb5b1361d6058a6e1533ab62c0aa7e21c9fc090
Merge changes Ic3a64363,Ib5ae8f70,I738209d1

* changes:
  Add ve.ui.ToolGroup and use within toolbar setup
  Cleanup tool styles
  Make drop down tool work with generic toolbars
Add ve.ui.ToolGroup and use within toolbar setup

Objectives:

* Use a class for toolbar groups to add more functionality later
* Rename addTools method to setup

Changes:

*.php
* Add link to new file
* Move ui element classes up for more general use

ve.init.mw.ViewPageTarget.js, ve.init.sa.Target.js, ve.ui.Context.js,
ve.ui.SurfaceWidget.js
* Update use of addTools method

ve.ui.Tool.css, ve.ui.Toolbar.css
* Move styles between sheets

ve.ui.Toolbar.js
* Rename addTools to setup
* Use ve.ui.ToolGroup objects when building tools

ve.ui.ToolGroup.js
* New class, encapsulates tools

Change-Id: Ic3a643634a80a8ac7d6f6f47f031d001c7efaee7
Cleanup tool styles

Objectives:

* Make drop down tools look more like buttons and less like inputs, since they aren't text input and are buttons
* Make context toolbars inside surface widgets render correctly
* Show outlines of groups on hover to hint tool relationships
* Make neighboring active tools look cleaner

Changes:

ve.ui.Tool.css
* Merge ButtonTool and DropdownTool styles as much as possible
* Add styles for DropdownTool active states
* Only round the corners of the first and last tool in a group
* Soften the borders between consecutive active tools

ve.ui.Toolbar.css
* Add border to groups on hover

ve.ui.Widget.css
* Isolate surface widget toolbar styles by using stricter selector

ve.ui.Tool.js
* Fix incorrect capitalization of class name

ve.ui.SurfaceWidget.js
* Add classes to toolbar and surface for better style targeting

Change-Id: Ib5ae8f705ef1e9c481e5bdf8c8dcef9c1eb22c4d
Make drop down tool work with generic toolbars

Objective:

* Remove ve.ui.DropdownTool's dependency on ve.ui.SurfaceToolbar so it
  can be used with any ve.ui.Toolbar

Changes:

ve.ui.DropdownTool.js
* Bind onBlur to document mousedown in capture mode instead of trying to
  add more and more things we are listening to which is a losing battle
* Refactor activate/deactivate mode changes
* Get rid of isEnabled check - surface should disable toolbar, the tools
  shouldn't be checking if the surface is enabled after the fact (also,
  this is harmless and doesn't change any actual interactions)

Change-Id: I738209d17649358c2f9812f9abac576960af867b
Merge "Actually fix bug 47793 for Opera for real this time"
Localisation updates from http://translatewiki.net.

Change-Id: I93c22817d1dc21188f92e1eedb201e7ec3ddf1ad
Localisation updates from http://translatewiki.net.

Change-Id: I8a0255f89942e2d00afbd42979f825f33af9c2f2
Merge "Update reference to renamed init.setupSectionEditLinks method"
Actually fix bug 47793 for Opera for real this time

I trusted you guys when you told me to use DOM .focus() instead of
jQuery's .focus() and didn't test well enough :( The former doesn't
work, the latter does.

Follow-up to I7962f59b.

Bug: 47793
Change-Id: Iddfb8d7c99325b6c7a5d151948b57cfa5f0a6a62
Localisation updates from http://translatewiki.net.

Change-Id: I881f8de862a74a0a48acbc9a02de501cc227eb58
Tweak comment to explain isAvailable and what mw.libs.ve means

Change-Id: Ie5df644b0e70871345950afa188545279c3ee91c
Update reference to renamed init.setupSectionEditLinks method

Follows-up e1f8ee7890

Change-Id: Ib9e6c8cf472f656052adca4fbd87630ec1aaf697
Localisation updates from http://translatewiki.net.

Change-Id: Id6ff98a3d1f486689653cb9b16206ebdda72a815
MWMath: Fix broken usage of old ve.copyArray method

Was missed or conflicted during the migration to ve.copy.

Change-Id: I2bb528212043a1be65ca9ae5b514981e18749fa2
Add ve.track, a generic dispatch of analytic events

This patch adds ve.track; it provides a means for VisualEditor code to log
various changes of state that are of potential analytic interest. This is done
without coupling VisualEditor to a particular analytics framework by providing
a method, ve.hook.registerHandler, by which event data may be routed to a
particular analytic framework for processing and dispatch.

ve.track uses a $.Callbacks-like object for tracking analytic events which can
remember an arbitrary number of past events. This is done by maintaining an
array containing the arguments of past calls and maintaining a counter for each
callback indicating its position in the queue (i.e., how many events it has
already received.) This ensures handlers are called for each event, including
events which were fired before the handler was registered. This allows the
load-order of VE and analytics components to remain unspecified.

Change-Id: I29740fa7a0ac403e484e0acee6dfcadaf6fc4566
ve.ce.MWTransclusionNode: Check for API errors

See ApiVisualEditor.php#parsefragment.

Error code is also incorrectly about Parsoid, method
parseWikitextFragment does a FauxRequest to MediaWiki. Fixed
error.info. Keeping the same error.code for now for consistency.

Bug: 52483
Change-Id: Ic473ae4a5c1e9706140f6ec4cc8157fadd02c318
Handle <tt> as textStyle/code

Also store the node name so we round-trip correctly.

Bug: 52352
Change-Id: Id1fc85540804f5724ac7ded649a2d3ed0eb26770
Merge "Localisation updates from http://translatewiki.net."
Localisation updates from http://translatewiki.net.

Change-Id: I7b47bb093731680a4c3a23a51e2510740709fb24
Merge "Split ve.ui.Toolbar and ve.ui.SurfaceToolbar"
Split ve.ui.Toolbar and ve.ui.SurfaceToolbar

Objective:

* Make it possible to make a toolbar without a surface

Changes:

*.php
* Links to new file

ve.ui.Toolbar.js, ve.ui.SurfaceToolbar.js
* Split toolbar into generic and surface specific classes

*.js
* Update symbol names

Change-Id: Ice063a2fb67b5ce5155cdc96a0d47af49eee48cb
Merge "mw.ViewPageTarget.init: Setup "source" links even if VE is not available"
mw.ViewPageTarget.init: Setup "source" links even if VE is not available

Follows-up ced2a8a which moved the tab layout to the server-side
and changed it to set up "source" tab and section links always
everywhere (even if VE would not be availabe in the namespace
or browser).

The JS logic (which continues to exist to take care of pages
cached before we moved it to PHP and/or to fix up pages cached
with a different configuration in the future) didn't do this yet
causing the "Edit source" tab to inconsistently appear on pages
for anonymous users viewing pages where VE is not available.

Change-Id: Ic575b3fcef17e636adaa338abc7748a4388ed9a9
Merge "Make the link to the user guide open in a new window"
Make the link to the user guide open in a new window

Bug: 52475
Change-Id: Ia83ec459edb730bbc2adf5712586fdac269b7e00
Merge "Remove inserted leading whitespace"
Remove inserted leading whitespace

This is bit of a hack, as leading whitespace could be
significant if styled with white-space:pre.

Long term VE shouldn't be editing the user's HTML, and
should just highlight potential formatting issues.

We avoid the stripping in preformatted elements as we
expect they will have that styling.

Bug: 51462
Change-Id: I654d98e17dd604cb2a192831ff3f3597f95b9962
Merge "Allow more things to be inserted into captions"
Allow more things to be inserted into captions

Specifically: transclusions, formulae & references.

Captions also allowed to contain other images and reference lists
but we should probably not encourage that.

Change-Id: Ia1c99e51640a3f9ee53281a1e3ebd67dc13c8990
Merge "Only skip past empty keyedNodes sets if key exists"
Merge "Include element HTML in QUnit summary for diff"
Merge "doc: Add missing @static to static ve.Element methods"
Fix notice caused by not passing the WebRequest object by reference

It makes no sense that we should have to pass this by reference but
if we don't do it, we get a PHP notice.

Bug: 52466
Change-Id: Ibc8e33c4776a325cd32b6526dacc200994a73f7f
Only skip past empty keyedNodes sets if key exists

Otherwise unkeyed references won't be listed!

Bug: 52427
Change-Id: I8bbce955f584cca046e23d07aab8440f1e733657
Include element HTML in QUnit summary for diff

Because trying to work out how broken your test case is
by looking at two (potentially multi-page) serialisations
of the DOM summary is a pain in the arse. Diffing two
HTML strings may highlight the problem much more clearly.

TODO: Is it possible to defer the calculation of the HTML
infused summary object until we have determined the assertion
has failed. Otherwise we're slowing down our tests for no
reason.

Change-Id: I873bf2479ab81d15389792bd59d15580da63941a
ve.ui.Toolbar: Use closure instead of ve.bind for event handlers

Code speaks for itself, see also bug 52441.
Though not introduced by 14343c7bf7, that made the bug worse.

Bug: 52441
Change-Id: Ie2b80b22df03eb563de8812a47fb25152527e786
doc: Add missing @static to static ve.Element methods

They were incorrectly showing up in generated documentation
as instance methods.

Change-Id: I3668311d9e6bc25d63a1f49cc7a1abe4f6f350aa
Expand beta message a bit.

Change-Id: I6a49da57540d1702d4477619fb002f9fa0a314de
Merge "Beta welcome dialog"
Merge "Move edit tab generation into PHP and make it more configurable"
Beta welcome dialog

For configured wikis, show a dialog that welcomes the user to the
amazing and fantabulous world of VisualEditing, which is not only full of
wonderment and joy but also may lead to increased popularity and love.

The dialog only shows up once (uses a cookie).

Change-Id: I8e7c4dc2c63b36594378a543b9d66291395eebcf
Don't override link target input value while typing

In some cases this would make VisualEditor be way too aggressive in
forcing you into the first matching page.

Bug: 52420
Change-Id: Ie0a793853d884ee0abf490a99c5214082e9dbf27
mw.ViewPageTarget.init: Fix pageExists/isViewPage behaviour

"Let me clarify this for you" - Timo

Follows-up 1984c3ca46cceb.

Bug: 49000
Change-Id: Ia094aa9aae1da1ba11dbaef827e305cbcf08f9b4
Fix edit links on special pages

Added wgIsArticle to isViewPage checks, otherwise we were attempting
to load VE dynamically on Special:Move/Delete, which resulted in a
broken h1 title and odd behavior off the 'Read' tab.

Also added !wgIsArticle to pageExists. This is a bit of a hack because
we don't have any info on page existence in the JS on these pages
(I think?). But it's better to display 'Edit' for a page that doesn't
exist, than 'Create' for a page that does.

Bug: 49000
Change-Id: Ib47e5524d41e6066b362e0f5645750c769de5193
Localisation updates from http://translatewiki.net.

Change-Id: Ie054b70bd8de960be99bb63bc721074b69cf98b3
Prevent the creation of invalid MWInternalLinks

By testing against a regex of legal title characters we can determine
if the entered text is a valid internal link. If it isn't we should
prevent the link inpsector from creating/changing the annotation.

Bug: 33094
Change-Id: Ia1df602601e4e82fc351279e432c28c425f5157a
Merge "Remove obsolete comment about GuidedTour and EventLogging"
Merge "Added credits for English messages"
Added credits for English messages

Change-Id: I04c33ae4941207333b9d3b438dc07a34c6d5b597
Remove obsolete comment about GuidedTour and EventLogging

The AddNewAccount hook does not require them.

Change-Id: I2ce7f0de0f059fdf24522240aaf08d1c6faaecab
Remove registration of nonexistent hook function

Hook was part of survey code which I removed in I8be6198a6. I neglected to
remove the statement which registered the hook handler, however.

Change-Id: Ia4e2a7854b3a2a5cbbe4da7657f7afe18f3c1d6a
Merge "Use new class to detect Cite errors inside templates"
Use new class to detect Cite errors inside templates

Bug: 51337
Change-Id: I1cd9e2beaa64a84ddc6d690fbc483f16d9350b68
mw.ViewPageTarget.init: Don't depend on mediawiki.user

Follows-up 5036099. We don't have that dependency.

Change-Id: I2bdf397a0e575f3f0fb82b905c92c34278b39037
doc: @return -> @returns

Follows-up 8f05cdbf70.

Change-Id: Id2b68e521ab68862f0f635925708a35d10795342
doc: Add placeholders for unindexed methods

Not having a description yet is fine, but they should at least
be indexed as blocks so that they are searchable and listed
in the jsduck generated pages. jsduck defaults to @method + name
of prototype property. And it even guesses parameters sometimes.

Search: \n\n([a-zA-Z\.]+\.prototype\.[a-zA-Z]+)
Where: modules/ve,modules/ve-mw
Where-Not: modules/ve/test
Replace: \n\n/** */\n$1

Added @return in a few places where it was easy to add.

Change-Id: I830c94cc7dbc261bd7a077391f930cbfff165f9d
Merge "doc: @inheritDoc -> @inheritdoc"
Merge changes I9ca43005,I68f9258f

* changes:
  ve.init.mw.ViewPageTarget.init: Pass default values
  VisualEditor.hooks: Sort keys
Merge "ve.ui.Toolbar: Emit position event on toolbar instead of surface"
Merge "ce.ProtectedNode: Use surface initialize event instead of toolbarPosition"
ve.ui.Toolbar: Emit position event on toolbar instead of surface

mw.ViewPageTarget is currently getting events from both the
platform target toolbar and context menu toolbar because the
event is emitted from within the toolbar to the surface.

Instead we're now emitting it on the toolbar itself and it is up
to the binder to access the correct one and listen to its events.

Bug: 52317
Change-Id: Ibd8053768e82b1df91081bd77a172628ea855db7
Merge "mw.ViewPageTarget: Emit position event after toolbar is animated"
ce.ProtectedNode: Use surface initialize event instead of toolbarPosition

Follows-up 867ec44a9.

Because:
- #toolbarPosition is emitted more than once (so this
  should at least have been a once() bind, not a connect)
- It is emitted for more than 1 toolbar (includes context menu
  toolbar)
- Semantically incorrect (we want to know when the surface changes
  not the toolbar)
- We want to get rid of that event entirely and this is the last
  use of it.

Change-Id: Ica5ed04052f48fe84607abab72bcf65f97d689ed
Merge "Add ve.now utility function"
doc: @inheritDoc -> @inheritdoc

Follows-up db3da5d. Also scanned code base for more matches but
looks like those have been cleaned up already.

Change-Id: I62d1c4367e1ed7b7162d7b688227dfa5dca562aa
Merge "Link inspector bug fixes"
Localisation updates from http://translatewiki.net.

Change-Id: Ib0b384998feab8599ba784d119304ee2d908a1af
ve.init.mw.ViewPageTarget.init: Pass default values

Though this is already handled by Ie50b63ba5064e85d26 for the
server-side, and that should automatically reflect to the
client-side. Since we're dealing with cache conditions in
wmf-production where the user.options manifest does not yet
contain an entry for these relatively new preferences, lets
transfer the default value here as well. This does not affect
logged-in users (since their user options are always up-to-date
and embedded in the page).

Also made ve.support.es5 be casted to boolean. Previously it
would be a reference to JSON.stringify (if supported), or the
bottom value of whichever feature the browser didn't support.
Doesn't change any behaviour but should make things slightly
more performant when this value is evaluated.

Change-Id: I9ca430051ae6f4e603c2d89982e540e455055255
VisualEditor.hooks: Sort keys

Change-Id: I68f9258f739532ca30d2fdc91e62d6a2f87a5180
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
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
Revert "Localisation updates from http://translatewiki.net."

Based off old version, re-added removed messages and re-un-sorted keys.

This reverts commit 93b74fe25c6c09aac03ef0d0c337667cd1248027.

Change-Id: I8eb45ca7aeb611176decb4cd4f6dd89b60b92db7
Localisation updates from http://translatewiki.net.

Change-Id: I86b6ce2d9fa9a29ce4041187a8421a2f11788ad8
Merge "Remove gender micro-survey from VisualEditor"
Merge "Add dependency check for MW1.22/wmf11"
Add dependency check for MW1.22/wmf11

And perhaps-overly lengthy explanation as to why this is needed.

Bug: 51606
Change-Id: I225bfbe7923434f3c363562de6226ddf618b834b
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
Remove gender micro-survey from VisualEditor

The 'ext.visualEditor.genderSurvey' module was introduced in I2b4aba6a9
for the purpose of instrumenting a short-lived microsurvey that would be
concomitant with the deployment of VisualEditor. The survey has now run
its course; this patch removes its code.

Change-Id: I8be6198a66957d792757a5312e9e71b3c8cdd1e3
Merge "Language Inspector UI"
mw.Target: Removed unreachable badtoken recovery code

This code caught badtoken errors on load, but we can't get those
any more since the API module was split and we no longer send a token
on load. badtoken handling on save is done in mw.ViewPageTarget.

Bug: 51253
Change-Id: Idb172ee46b7142681d41e593eacd9600b8f11a9a
Merge "Fix badtoken handling broken by 7557dd39ed3"
Fix badtoken handling broken by 7557dd39ed3

7557dd39ed3 make the badtoken handling code unreachable. Revert that
change, and fix the rest of the function to deal with the possibility
that editApi is undefined. Let handling of the read-only mode error
and any other errors fall through to the bottom of the function.

Change-Id: I0673f2bb629e5cc9449675c1074d283e3926e1d5
MWMath cleanup

VisualEditor.php
* Add CSS file

ve.ce.MWMathNode.js
* Wrap the image in a span, so GenerateContentNode doesn't
  try to nest an image inside an image
* Remove unnecessary attribute setting
* Only pass unwrapped image to deferred.resolve
* Retrigger MathJax rendering

ve.ce.Node.css
* Use inline-block for image wrapper

ve.dm.MWMathNode.js
* Mixin GeneratedContentNode and implement getHash
* Copy over functionality of MWTransclusionNode:
  + Just store data-mw for attributes
  + Store orignal(DomElement|MW|Index) for selser

ve.init.mw.ViewPageTarget.js
* Add mwMath to the toolbar

ve.ui.MWMathInspector.js
* Remove static.InputWidget, not required in this architecture
* Use multiline TextInputWidget
* Only update mw attribute
* Allow creation of new math nodes

ve.ui.MWInspector.css
* Set height of TextInputWidget

Change-Id: I520f8ccc9f89a2ce70aa1d9e02ed0c6cacbecc2f
Merge "ve.ui.Toolbar: Refactor floating logic for performance"
Merge "Don't duplicate categories when unlisting"
Remove the DM 'about' attribute from references and reference lists

It's totally unnecessary, and actually caused a bug where new references
got about="undefined", which caused Parsoid to about-group adjacent
new references together.

Bug: 52228
Change-Id: Id40d53c72a35412d612ae9441ae3d561622c1bec
Merge "Ref in references support"
Merge "Revert "Check MW version before loading VE""
Revert "Check MW version before loading VE"

Doesn't play nice with the version we use in production :(

catrope@tin:/a/common$ mwscript eval.php enwiki
> wfUseMW('1.22alpha')
MediaWiki 1.22alpha required--this is only 1.22wmf11

This reverts commit f673725f10223709252e0bf2de76cc493edec312.

Change-Id: I6d022eef001f80198c6c4be20586f334cb8e0262
Merge "mw.ViewPageTarget: Fire 'wikipage.content' hook after saving"
Merge "Check MW version before loading VE"
Merge "Partial revert of gerrit 8ed6dfa5423 to avoid i18n mis-links"
Localisation updates from http://translatewiki.net.

Change-Id: I322a1108e65556e5535a24fc132e17b3ebc55653
Partial revert of gerrit 8ed6dfa5423 to avoid i18n mis-links

Bug: 52276
Change-Id: Ie72ac3f33e1abda03a6fdcf54c5b0e7615302fad
mw.ViewPageTarget: Fire 'wikipage.content' hook after saving

Bug: 51565
Change-Id: I5b6dcd3cb425d2763cc3069e3cbc04be7a57af4c
Ref in references support

When we encounter a ref tag inside the mw-data of a references
tag, we pass it off to the converter and store it as nested data.

In toDomElements we convert any nested children and write them
back to mw-data if changed.

As refs in references are invisible we exclude them when generating
the references list in ve.ce.MWReferenceListNode.

Bug: 51741
Change-Id: I31d06616849a00449df0fc77f3b33e46207cdc7f
Set links in wikitext warning to load in new window

Bug: 52093
Bug: 49820
Change-Id: I20ef246b6382ce801ce7a2cb0c82bc698471b88e
Check MW version before loading VE

Currently >= 1.22alpha

Bug: 51606
Change-Id: If45830b9e7636e8e53671d6160914d50e51f1e0f
Merge "Add keyboard shortcut for 'clear' button"
Merge "Add the special 'clear' (12) button to ve.ui.Trigger"
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
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
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
Add the special 'clear' (12) button to ve.ui.Trigger

Change-Id: I407d9a026348e5385c6e3d3476970e64948fc2f6
Merge "Fix trigger demo"
Fix trigger demo

Objective:

* Make trigger demo work

Changes:

demos/trigger/index.html
* Include new dependencies: oojs, unicodejs
* Update use of ve.Trigger, which is now ve.ui.Trigger

Change-Id: I973375821625629b3dfc3f30f07fc8ec699d24ce
Merge "mw.ViewPageTarget: Clean up nested binds and triple model/connect"
Merge "Use postEdit mw.hook for save notifications"
Use postEdit mw.hook for save notifications

The core changes to postedit in I778b18b that this depends on were
deployed to the cluster as part of 1.22wmf11.

Bug: 39632
Change-Id: Id4a8bc22c09a552ef79670b0d4fc4a70df07ec33
Merge changes Icce6c192,If1bcc3ee

* changes:
  Make <nowiki>s non-experimental again
  Don't compare annotations directly with ve.compare()
Merge "Properly clone the document for the sanity check"
Merge "Localisation updates from http://translatewiki.net."
Localisation updates from http://translatewiki.net.

Change-Id: I4f0e702ed6045b8534ff7cec828b1d94a7f84864
Unblacklist Opera >= 12

Opera 12 seems to work well enough, but I'm not confident enough to
whitelist it just yet.

Opera 15 is basically Chrome with a different interface, so it should
work perfectly, but it's barely out of beta and untested right now.

Bug: 36000
Change-Id: Ia80a6f53f8c128ef52d0bfde1828fdc132046afb
Merge "ve.ce.Surface: Prevent focus loss on the document node in Opera"
Fix 429587d: set default value for visualeditor-enable to 0, not 1

With our current config, 429587d would have enabled VisualEditor by
default on all wikis, which is not what we want to do. We can make the
-enable preference default to true in the extension if we really want
to, but that requires a change to wmf-config as well.

Change-Id: I95664588e5e4e3d6caed90e1c83accc9434ecd49
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
Localisation updates from http://translatewiki.net.

Change-Id: Iad0cd2f537c417944fcbd218b4ab0388209ea11b
Make <nowiki>s non-experimental again

Change-Id: Icce6c19243b82c46a6c48004065d93453bb4f8eb
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
Merge "Fix the newline bunny-hop bug"
Merge "ce: Don't set backgroundColor transparent for every node in debug mode"
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
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
Merge "Rename index to offset in AnnotationSet"
mw.ViewPageTarget: Clean up nested binds and triple model/connect

Change-Id: I67cabfdf0247dd0951b7d4f26c99d621aa2f7b0d
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
Merge "Quick optimisation to avoid containsComparableForSerialization"
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
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
Properly clone the document for the sanity check

Previously, we'd clone the data but convert it in the context of
the existing dm.Document, whose nodes had pointers to elements in the
old data array, not to the cloned ones. Because dm.MWReferenceNode
has logic like if ( something === dataElement ), this caused the sanity
check conversion to behave slightly differently compared to the real
conversion that happens on save, and so a references corruption
bug went unnoticed.

Change-Id: I79a42ae21f91cb8eb410ae26ea638036db19e217
Merge "Localisation updates from http://translatewiki.net."
Localisation updates from http://translatewiki.net.

Change-Id: If56fd14a291b3c8af9947bfefbe52df35ce6eceb
VisualEditor.php: Set default preferences values

This not being here caused and causes various unexpected
scenarios to evolve around preferences being falsy (undefined)
or set to 0, and inability to distinguish between a user having
not set the preference, the preference not existing due to cache
or the preference being disabled explictly by the user.

Change-Id: Ie50b63ba5064e85d26dad8b622554bbe809c2634
VisualEditor.php: Re-order and clean up

Match the conventional layout for this file.

Change-Id: Ic437c1a9423af47a3a1f3068afec6daa4ba7eefc
Cleanup code icon

Sharper!

Change-Id: I68a8895ca1bb652e09d66db4ce7abd68cf0a3e99
Merge "Make sure 'user.options' is loaded before 'ext.visualEditor.viewPageTarget.init'"
Merge "Consistency in MW*ButtonTool comments and naming"
Merge "Code annotation button"
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
Merge "Infrastructure for loading plugins in the MW integration"
Merge "Code annotation icon"
Merge "Alphabetise icon styles in ve-mw"
Merge "'CodeScript' => 'Code'"
Make sure 'user.options' is loaded before 'ext.visualEditor.viewPageTarget.init'

The function init.isAvailable uses mw.user.options, so this dependency needs
to be specified.

Change-Id: Ia2c87a32f692da2347ad670cdbcf6d6e6d171f15
Code annotation icon

Change-Id: I16330c11a2f67a8b5fb09be70a809460b3731484
Alphabetise icon styles in ve-mw

Change-Id: I6d0e5aa7e17abbe88c6bd06e7e9c605cdb5ad9a1
Consistency in MW*ButtonTool comments and naming

Change-Id: Id71c7f862e43125599ecfc6eeb27719e1891489d
'CodeScript' => 'Code'

I assume this was a copy-paste error from subscript above.

Bug: 51590
Change-Id: I8351fd7e272812017e0e9cfdd76e3da4745119d3
Merge "Fix MWBlockImageNodes' default horizontal location code"
Fix MWBlockImageNodes' default horizontal location code

Introduce method ve.ce.MWBlockImageNode.getCssClass and use it instead of
accessing ve.ce.MWBlockImageNode.static.cssClasses - it gives a better
way of handling special cases.

Bug: 51995
Change-Id: I236b08c8345a10d144f392ec37fd130cf5f7737d
Merge "Fix font size for overlays in Monobook"
Merge "Regress RTL fix transclusion icon"
Merge "doc: Clean up spacing that caused <pre> or broken <ul>/<ol>"
Merge "oojs: Update to upstream v1.0.2"
Merge "Optimise history stack truncation"
Localisation updates from http://translatewiki.net.

Change-Id: If4f801da0325564e1480b4207b06ef7eecefc076
Merge changes If571bb99,I2e3637af

* changes:
  Parse category names correctly
  Rename 'CategoryList' to 'Category' for consistency
oojs: Update to upstream v1.0.2

* http://trevorparscal.github.io/oojs/releases/oo-1.0.2.js
* https://github.com/trevorparscal/oojs/blob/v1.0.2/History.md
* https://github.com/trevorparscal/oojs/compare/v1.0.1...v1.0.2

Change-Id: I7378b7cbef55243845d3f4cbc96406b3267c8c01
Merge "Fix CSS lint error"
Fix CSS lint error

"Background image 'images/icons/italic-k.png' was
used multiple times"

Change-Id: Ib6a497021fe871c4597a80be91a259689b5d537b
Merge "Add bold/italic icons for be-tarask"
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
Parse category names correctly

Category names containing colons now parse correctly.

Bug: 51902
Change-Id: If571bb9922399c5a5f77f0b304bec3f2b6f5f7dd
Rename 'CategoryList' to 'Category' for consistency

Change-Id: I2e3637af38b789e588ce186497238f197e5fd5d3
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
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
Fix font size for overlays in Monobook

Bug: 50058
Change-Id: I751682c4bc51299c15e7efef487ae32e70049b16
Merge "ve.ce.MWBlockImageNode: Use this.constructor to refer to class"
ve.ce.MWBlockImageNode: Use this.constructor to refer to class

Minor clean up for maintainability.

Change-Id: I14729cba683964177ef807dca1139e3887a767ad
Fix the save button disappearing on certain pages in Firefox

If the first thing on the page is an image, then we'll try to select
it in Firefox, and get a JS error because .data( 'view' ) is undefined.

It turned out that MWBlockImageNode's onSetup() didn't call the parent
implementation, and all the way up in ve.ce.View.onSetup is where
we set .data( 'view' )

Bug: 51986
Change-Id: I0de3692566b0aa02a229054e07767e45fd5d4a49
Localisation updates from http://translatewiki.net.

Change-Id: I5d4210481c8a2ec625c4726bf2c42af1535bd237
Merge "Fix copyright warning, which wasn't populated due to a missing .end()"
Fix copyright warning, which wasn't populated due to a missing .end()

Change-Id: I1a04a40415f3fcf8d11b49e5c90672ee625a85f7
Put <nowiki> edting in experimental for now

Bug: 51948
Change-Id: I18c89e8fba04a1ad515e5db611381a4c937853e5
Add bold/italic icons for be-tarask

Also move 'en' into alphabetical order, because we're not special.

Change-Id: I4a34a570444655460d470deb1d624877a38d3adb
Merge "Split continued link annotations on wordbreaks"
Merge "Make ButtonWidgets more accessible"
Merge "Show error when trying to save in read-only mode"
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
Merge "Replace "Edit source" by "{{int:visualeditor-ca-editsource}}""
Merge "Show newarticletext(anon) when creating a new page"
Show error when trying to save in read-only mode

We already correctly show the read only error if the user tries
to load VE which the database is locked, but if the database gets
locked after they've loaded VE, we also need to show the error
when they try to save.

Bug: 51636
Change-Id: I7a56f1b4387e7ea594a2a7f939c81626c9eee834
Merge "Set 'notminor' if minor edit box not checked"
Merge "Handle meta-only transclusions as meta items"
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
Set 'notminor' if minor edit box not checked

In order to properly override the minor-edit-by-default setting
if it is used.

Bug: 51515
Change-Id: Ic49d47971a795c7efd860a962cfe13b89d2bb95a
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
Show newarticletext(anon) when creating a new page

Bug: 51459
Change-Id: Id8509c6c8b92a0355b97d7661affe749fcdfdcba
Replace "Edit source" by "{{int:visualeditor-ca-editsource}}"

Spotted by Siddhartha_Ghai
http://translatewiki.net/wiki/Thread:Support/About_MediaWiki:Visualeditor-beta-warning/hi

Change-Id: I50e3b9c33c71056158b947cd69579411776888b5
Render check boxes from EditPage

EditPage has a lovely getCheckboxes() function which includes the
minor and watch checkboxes as rendered by MW core, as well as any
checkboxes extensions like FlaggedRevs might have added. Output
these in the API, render them, and send their values back.

ApiVisualEditor.php:
* Build a fake EditPage, get its checkboxes, and return them

ApiVisualEditorEdit.php:
* Pass through posted request data to ApiEdit, which passes it
  through to EditPage thanks to Idab5b524b0e3 in core

ve.init.mw.ViewPageTarget.js:
* Remove minor and watch checkboxes from the save dialog template
  and replace them with a generic checkbox container
* Have getSaveOptions() pull the state of all checkboxes in
** Special-case minor and watch, and pass the rest straight through
** Move normalization from true/false to presence/absence here, from
   ve.init.mw.Target.prototype.save(), because here we know which ones
   are checkboxes and we don't know that in save() without
   special-casing
* Remove getSaveDialogHtml(), we don't need to hide checkboxes based on
  rights anymore because in that case the API just won't send them to us.
** Moved logic for checking the watch checkbox down to where the same
   logic for the minor checkbox already is
* Unwrap getSaveDialogHtml() in setupSaveDialog()
* Access minor and watch by their new IDs throughout

ve.init.mw.Target.js:
* Get and store checkboxes from the API
* Pass all keys straight through to the API

Bug: 49699
Change-Id: I09d02a42b05146bc9b7080ab38338ae869bf15e3
Merge "Hide contentSub completely"
Hide contentSub completely

Previously it was faded out to 60%. contentSub contains FlaggedRevs
stuff we don't want around in the editor, and contains the revision
navigation when editing an oldid, which James decided also shouldn't
be visible when editing.

Change-Id: Icdef98f756ce92a32d276d6eeb22c9de04640d8b
Merge "Set target=_blank for links in the edit notices"
Merge "Quickfix for Transclusion icon in RTL wikis"
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
Merge "Add bold/italic for cyrillic/georgian languages"
Merge "Add bold/italic for more latin langages"
Create temporary preference to disable VisualEditor during beta

This preference will allow users to opt-out of VisualEditor during the beta
if they so choose. We do not re-use the alpha enablement flag because (a) this
would lead to a confusing preference description, and (b) because opting in
and then out of the alpha is not the same user choice as opting out of the
beta period.

Change-Id: I0f0a1b5eb21703ad422d007cab65c75ac1aa6fd8
Set target=_blank for links in the edit notices

Change-Id: I63bbf557fa94cda7435614ba7d743e22a148fdce
Merge "Image insertion alignment fix"
Image insertion alignment fix

This removes the initial alignment (either left or right) from new
inserted images, letting the wiki decide the default positioning.
Also, it makes sure that VisualEditor positions the image properly
(according to wiki defaults tright/tleft for ltr/rtl) when editing.

Bug: 51851
Change-Id: I25b966cf6f2736437509ea7e70bfda1bdbc79021
Merge "Prepend section title to edit summary"
Merge "RTL Fix for Category & Suggestion Popups"
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
Prepend section title to edit summary

When section edit links are used.

Bug: 50872
Change-Id: I44cef7a892b4f2f22f60f8f7f531f4e9dcfe8363
Merge "Add ve#graphemeSafeSubstring method"
Merge "mw.ViewPageTarget.init: Move conditionals client-side"
Merge "Ensure ve-ui-panelLayout-scrollable is actually scrollable"
Localisation updates from http://translatewiki.net.

Change-Id: I5ae55bd0eebf9cb3ed07bb715d8d11de92cfb070
mw.ViewPageTarget.init: Move conditionals client-side

Load the module always and have the conditionals on the
client-side so that we can change these without running into
problems with the new conditions not being rolled-out quickly
for anonymous users because the load queue is in the HTML
and cached for 30+ days.

This also allows us to fix above problem retroactively in wmf
production by just adding a mw.loader.load for this module
in something like MediaWiki:Common.js or something else that is
already in the cached load queue (temporarily, until the cache
has rolled over).

Removed unreachable code for loading ext.visualEditor.splitTest.

Change-Id: I21114960a88d224747447f2dc83d17d160f5f066
Merge changes I310e638a,I397ac16a

* changes:
  hooks: Only check relevant page title instead of both
  Don't set ignoreHidden=true when calling User::getOption
Add ve#graphemeSafeSubstring method

Allows us to take a substring without splitting a multibyte grapheme.

Change-Id: I811bdc7f010d10bf3c9509a73677939486751fec
Localisation updates from http://translatewiki.net.

Change-Id: I0e24aeda71307e8db8cf89f0fcf4bdd006b5137e
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
Merge "Array.prototype.splice polyfill for Opera"
hooks: Only check relevant page title instead of both

The relevant page title is equal to the native page title
if we're on a regular page (e.g. both are Foo on Foo and on
Special:MovePage/Foo one is Special:MovePage and the other
Foo). In that case there is no point in checking both, especially
if it is with the OR condition.

Change-Id: I310e638a73312afea421a399ce4c6ea9b4254cbf
Localisation updates from http://translatewiki.net.

Change-Id: Id9e57dfcbf8d78d26f1a9aeaaceafe7ca865d19b
Add bold/italic for cyrillic/georgian languages

ru, ky, os, ka now covered

Bug: 51711
Bug: 51712
Bug: 51713
Change-Id: I07987361f18719e96f5cb1b5a2b5eb8987fbf207
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
Localisation updates from http://translatewiki.net.

Change-Id: I51dd75f64dd4c4e52dff5b634916ca7a57bb59c2
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
Don't set ignoreHidden=true when calling User::getOption

This parameter is confusingly named, but the purpose of it is
is to undo what wgHiddenPrefs does. So instead of returning the
default value and ignoring the value previously stored in the
user's preferences, setting ignoreHidden=true would instead give
us the stored value dispite it being no longer visible on
Special:Preferences.

We also don't need to do $defaulOverride since the default (null)
is falsy already.

Change-Id: I397ac16aae4a2ed02687dff8552548c662f5d9bb
Localisation updates from http://translatewiki.net.

Change-Id: Ib49dd61483779454cc6dd4442c452baa533abf9d
Merge "Set Malayam to use B/I rather than A/A for toolbar icons"
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
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
Merge "mw.ViewPageTarget.init: Expose support.visualEditor"
Merge "Math Node UI (Bug Fix)"
Math Node UI (Bug Fix)

Fixed two bugs found after merging:

1. Opened the Math node inspector without editing
anything, then clicked somewhere else on the page,
it crashed.

2. Similarly, opened the Math node inspector
without editing anything, then clicked the
"Cancel" button to cancel the edit, it crashed.

Both of these problems are fixed by this patch.
The issue was with using the getFocusedNode() in
the inspector onClose function to save changes.

Also, I included some minor changes relating to
the last code review. =D

Change-Id: I6e200f2a228b71dc5af5aa9843c461f43b926f8d
mw.ViewPageTarget.init: Expose support.visualEditor

Refactor a few things to make it easier for scripts to see
not just whether mw.libs.ve is present but also whether it
allows the user to activate VisualEditor.

Change-Id: I50da8d9a260207d4ec1c43254dfe738f91386a9e
Merge "De-alienate <code>foo</code> blocks (code element)"
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
Maths icon for inspector menu as well as inspector itself

As not done by 992cb43de5ffa05e84b2f665d155e6812b591b02 (whoops).

Change-Id: I29e9452e8bc85ec256f46ddfa4f5000f5fcd2ba4
Merge "Now we have a maths icon, let's use it"
Now we have a maths icon, let's use it

Change-Id: I057f74975c0cb61bee54733fd4153ab0f75416d5
Merge "Handle backspace correctly when in a slugs"
Merge "Use ve.ui.SurfaceWidget for image captions"
Merge "Reference dialog commingling"
Use ve.ui.SurfaceWidget for image captions

Objectives:

* Make use of the new ve.ui.SurfaceWidget.js for image caption editing

Changes:

ve.ui.MWDialog.css
* Remove styles that are no longer needed
** -body class isn't needed if you contain the content in a layout and
   configure it to be padded
** Toolbar styles are now part of surface widget

ve.ui.MWMediaEditDialog.js
* Wrap caption fieldset in an editPanel (also nice because we may merge
  this dialog with MediaInsert and use a stack panel layout in the future
* Replace surface and toolbar with surface widget which manages both

Change-Id: I1b7e0e2ec1cfa30879360a7ebde2b0f35d26aca5
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
Localisation updates from http://translatewiki.net.

Change-Id: Ic2eea58a2cc5f5acb1d61b3401bb47bbc3e51379
Merge "Math(s) icon"
Math(s) icon

Change-Id: Iaf5766d2d7751fdaf34161276b7ecf4f73456d91
Merge "Update static loaders"
Merge "Fix ordering of store items in converter tests"
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
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
Fix for scrollable panels

Fixes mistake made in I50e996b9d2fde361238cde75e09baa5872e12223 which made scrollable panels not be, well scrollable.

Change-Id: I0ec59a1b76acf047b1a4d6de426a0ddb554a3e42
Merge "Default $wgVisualEditorNamespaces to $wgContentNamespaces"
Merge "Add padded option to layouts"
Merge "Localisation updates from http://translatewiki.net."
Localisation updates from http://translatewiki.net.

Change-Id: I249b4aa4e5060e193201c5664c231243097794fe
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
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
mw.ViewPageTarget: Show AbuseFilter warning in save dialog

Misc:
* Updated signature of #showMessage to include allowing
  an array of nodes to be passed. We pass this to jQuery#append
  so we're just extending the explicitly documented subset of
  things it could already do due to passing to jQuery#append.

Bug: 50472
Change-Id: I3f56820a4f14b0684bfa265e3eb5e3820f2a3513
Default $wgVisualEditorNamespaces to $wgContentNamespaces

The domains which contains articles are those from $wgContentNamespaces,
which by default is just array( NS_MAIN ).

Bug: 51527
Change-Id: I1f1356f1950c542ae05095a9ebd7b3d66ceb4e40
Add a node class for mw:Nowiki

These represent <nowiki> tags. If the user doesn't edit the text inside
the nowiki, we round-trip the <span typeof="mw:Nowiki"> wrapper cleanly,
but if they do edit it, we unwrap it. This then triggers re-escaping
in Parsoid, and prevents cases where the user edits the text to no
longer need escaping but Parsoid still wraps it in <nowiki> because
of the <span typeof="mw:Nowiki"> wrapper.

In order to detect whether the contents have changed, the nowiki
annotation stores a copy of its contents. To avoid infinite recursion,
we have to exclude this attribute for hash generation.

Bug: 47678
Change-Id: I2edc46b6d87d2f91e952efcb09c0edae5166958f
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
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
Make beta notice more informative and increase CSS width.

Point out that the software may have issues, and point users to the "Edit source"
link explicitly.

Change-Id: Id84d76887038a3a6a9e11a203f19dc3db7703e6a
Merge changes Icdc2730e,I9e4264a7

* changes:
  mw.ViewPageTarget: Add support for spam blacklist
  mw.ViewPageTarget: Swap captcha and badtoken logic in onSaveError
Merge "Create MWResizeableNode mixin to control defaultSize flag"
Run UnicodeJS tests from Special:JavaScriptTest/qunit

Previously they were only run from the dedicated standalone test
which meant they weren't being run from Jenkins.

Change-Id: If22456f0031c68b0c1e7621b35b1e79c0664da15
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
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
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
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
mw.ViewPageTarget: Add support for spam blacklist

Bug: 50826
Change-Id: Icdc2730e5fc644c9030a6648702e071934f5ad62
Remove 'visualeditor-feedback-link' from RL module

It is already loaded by VisualEditorMessagesModule in
content-language. It was added here in error and caused it to
be replaced with the user language version at run time.

Bug: 47730
Change-Id: I82304bea0a5eadbe254beccd1899621d0bd0be46
Localisation updates from http://translatewiki.net.

Change-Id: I14f0e3f4d6e6e936feb31abf1bfd1d4429135313
Fake superscript style for references generated as spans

This is a hack because Parsoid should just generate <sup>s.

Bug: 50978
Change-Id: I0c418b4f70640b8212d4a58a6f33a0821f7338c4
mw.ViewPageTarget: Swap captcha and badtoken logic in onSaveError

This way if both are the case, the user (or VE, if possible)
will deal with badtoken first instead of potentially having to
solve the captcha twice (as each handling of the error does - and
should - end with an early return).

Change-Id: I9e4264a7001ffa9654bfab02cc955aa36ff5b6aa
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
Merge "Adjust padding for surfaces inside dialogs"
Merge "Use template icon on template placeholder pages"
Merge "Reset context menu on selection change while inspector is open"
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
Merge "Remove field set label on reference edit dialog"
Merge "Make the clear button clear insertion annotations too"
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
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
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
Merge "Clarify wikitext warning to indicate "Edit source" option (rather than asking the user not to type wikitext)."
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
Clarify wikitext warning to indicate "Edit source" option
(rather than asking the user not to type wikitext).

Change-Id: I3d6635a68f6542fc30e1e344233b7e585e0ad78f
Adjust padding for surfaces inside dialogs

Objective:

* Make horizontal and vertical padding of surfaces inside dialogs equal

Change-Id: I8672a4506cdbda59795b12236526b048aaadfa58
Use template icon on template placeholder pages

As opposed to using a parameter icon - which just doesn't make sense.

Change-Id: Idbe42a1b91a0691d1cf83dde4221ce3aac09d0fa
mw.ViewPageTarget: Surface error messages from core edit api

Previously we only looked at error info/code from the root of
the API response, not the ones from the root of the response
that action=visualeditoredit forwards from action=edit.

This changes the message for e.g. AbuseFilter from:

 > Error: Invalid error code

to:

 > Error: Hit AbuseFilter: [name of triggered filter]

Also changed default error for other reasons (e.g. hooks of other
extensions that we don't yet have specific support for) to "Unknown error"
instead of "Invalid error code".

Bug: 50472
Change-Id: I3b32eddafd8fff83f323606f9922ac60b5d3b58e
Merge "Replace text strings with grapheme arrays in onContentChange"
Replace text strings with grapheme arrays in onContentChange

Was previously generating incorrect transactions when document
contained multibyte characters.

Bug: 51140
Change-Id: Ie5f749768f970b2aef09e667f844d2ef5961207b
Merge "Set bold/italics icons for cs/he/pl; da/no/nn/sv"
mw.ViewPageTarget: Refetch token if session expired

* Rephrased visualeditor-savedialog-error-badtoken to emphasise
  that it is the old session that become invalid, not the one
  the user started browsing with since in a different window.
* If the session changed, the user will be asked whether they
  agree to save with this new session instead.
* We explictly update mw.config so that future save attempts
  in the same window compare against the correct environment.
  Without this there are two problems when saving and then
  making a second edit in the same window and saving that:
  - It will bring up the same question again (user A -> user B),
    which is annoying.
  - If the user logged back in again (new session, but for
    user A again) it would silently try with that new token
    without asking, thus saving as user A when the user still
    thinks it switched to user B. It switching back automatically
    is not obvious since we asked them from A->B, so we should
    also ask the other way around.
  This can be reproduced by opending ve-edit logged-in, then
  logging out in a new window, save, confirm anon, save,
  open edit again, log back in in a new window, save open edit
  in the old window, confirm new logged-in, save.

Bug: 50424
Change-Id: Id055eca1886f85aeaf615f645de29898afc0373c
Localisation updates from http://translatewiki.net.

Change-Id: I44dfffeba679eee88c28e29149315b9ced7584bb
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
Merge "Extend empty document check to check for meta-only data"
Merge "Move common linear data methods into LinearData.static"
Merge "Actually use op.retainMetadata in structural replace mode"
Extend empty document check to check for meta-only data

An empty document is one which contains no 'real' data, so
we should check for meta-only documents when deciding whether
to add in a wrapper paragraph.

Bug: 50289
Change-Id: Ib3ebf0717aa0c6c51fd1d0b14e95de50b2842647
Move common linear data methods into LinearData.static

Some methods apply to all types of LinearData. Also moved to
static so they can be used by the converter on raw data.

Change-Id: I79066d6d3ccde48aea7c0848d56ef86bc70f6656
Merge "Fix i18n typo in abf3671 spotted by PleaseStand"
Fix i18n typo in abf3671 spotted by PleaseStand

Change-Id: I592f3c4e2d4004d15609897986672f170a52fa5d
Merge "Warn users when they are typing wikitext"
Warn users when they are typing wikitext

Without making the code much more complex (and possibly create
performance issues) the warning will fire on pages which already
contain escaped wikitext (when that text is edited). I think this
should be a small enough minority that it won't be an major annoyance.

Bug: 49820
Change-Id: I0f67ec04b890f4add9247be6126bdc086b6ae72f
Merge "HACK: Don't merge adjacent annotations from Parsoid"
HACK: Don't merge adjacent annotations from Parsoid

Adjacent annotations should not be merged if they both
originate from Parsoid. This is a hack because this logic
should be in Parsoid, not VE.

Bug: 49873
Change-Id: If1e23e3039178300d72b1c0c585931417bb603b5
Localisation updates from http://translatewiki.net.

Change-Id: I88d9c92fab77ce9fac8d00286d144566a03be29f
Actually use op.retainMetadata in structural replace mode

It was being used correctly in the textual replace case, but it was
omitted in the structural replace case. This caused rare, insidious
metadata placement bugs that I haven't been able to reproduce outside
of newFromDocumentInsertion testing, but this might explain some of
the odd category bugs that have been reported.

Change-Id: I1424e482303853f285e4516a93c9609076648eff
Merge "Fix uses of addPart to make them async friendly"
Merge "Make link inspector re-usable by splitting it up"
Merge "Fix annotated element alien metadata inside wrapped paragraph"
Localisation updates from http://translatewiki.net.

Change-Id: I96e09b7bb12ad6969e05ba71bee03cb92d49971f
Fix annotated element alien metadata inside wrapped paragraph

Add check that we can close the wrapper to meta items, also
annotate them correctly.

Bug: 51235
Change-Id: Idd4a2304f588ea74b9a9814ce86c1fd0c026e441
Make link inspector re-usable by splitting it up

Objective:

* Make the majority of link inspector, which is generic to any annotation,
  usable for other annotation inspectors

This was merged earlier (f7107fa20dc0) but broke master, so it was
reverted (092fa74deef). This commit also incorporates 5dcf5d1c49082d.

Change-Id: Ib9190dee66ce064d69962f9c4c5b3a710be8ad07
Merge "Optimise png images with optipng"
API: Remove loading of unused globals

* non-edit doesn't use $wgVisualEditorUseChangeTagging.
* edit doesn't use $wgVisualEditorEditNotices.

Change-Id: I4ebbf855ca92ca1541013ce68a58e019b405137f
Merge "i18n: Sort message keys (again)"
Fix uses of addPart to make them async friendly

Problem:

Adding or moving templates or content resulted in the incorrect item
being selected.

Diagnosis:

Although recently we solved a few issues by making addPart async, it
caused some other issues where callers of addPart were assuming
otherwise

Solution:

Return a promise from addPart which is resolved after the part is
actually added and setup callers to use the promise when needed

Changes:

ve.ui.MWTransclusionDialog.js
* Use promises to auto-select new or moved parts

ve.dm.MWTranclusionModel.js
* Make addPart return a promise
* Resolve promise when queue is processed
* Automatically remove existing items before adding them in different
  locations at the time of processing the queue we don't yield between
  removing and adding

Change-Id: Ie43c5b89ca4ed34d5f797714e19c9a7e1824cdec
Preserve unused Parsoid template properties

Problem:

Parsoid has a property called "i" which we don't use, but they need for
round-tripping purposes. Since we were generating a structure from
Parsoid data and then generating data from the structure without
preserving properties we didn't use, it was getting lost.

Solution:

Abstract creating a template from data vs. creating it from name. Make
only templates have an origin argument in their constructors, so and
set it within a set of static constructors that create a template for
either data or a template name. Store the original data in the former
case, and use it as a base when serializing.

Changes:

ve.ui.MWTranslcusionDialog.js
* Remove no-longer-needed mw global declaration
* Move most of the addTemplate function to a static constructor in the
  template model class

ve.dm.MWTransclusionPartModel.js,
ve.dm.MWTransclusionContentModel.js,
ve.dm.MWTemplatePlaceholder
* Remove unused origin argument/property/getter
* Add serialize method (if needed)

ve.dm.MWTranclusionModel.js
* Move template/parameter generation from data into static constructor
  of template model
* Move serialization to part classes

ve.dm.MWTemplateModel.js
* Add mw global declaration
* Stop passing origin to parent constructor, store it locally instead
* Add original data property/setter for preserving unused properties
  when round tripping
* Add static constructors for generating a template from data or by name
* Add serialize method

Bug: 51150
Change-Id: Ide596a0ca0ae8f93ffce6e79b7234a1db7e0586c
i18n: Sort message keys (again)

Change-Id: I258466be47cda414f10150d49d592da61a323a5a
mw.ViewPageTarget: Improve error message for badtoken error

Previously all it did was surface api response error.info,
which surfaced underneath the edit summary form as mere:
"Error: Invalid token".

Bug: 50424
Change-Id: I60169b42701ae3b88e54626c4ff7050549e6ef55
Merge "api: Split save action into separate API module"
Merge "Adjust toolbar group margins for equal vertical alignment"
Merge "Don't change edited transclusion nodes to <span>s"
Merge "Remove "Tag: " prefix, now that they're in MW core"
api: Split save action into separate API module

This allows us to make the token no longer a requirement
for non-save actions while still using the built-in system
for token verification.

Update documentation for "oldid" since it is not required even
outside (paction=save). In fact, if we require it VE loading
fails because it doesn't pass oldid unless it has to when
restoring a specific version.

Bug: 50424
Change-Id: I7b1b50a43648b1cc40a984340846efdb0ba2ecc9
Bump gender survey width to 475.

Change-Id: I37336f1d8f962e31d6a241106384c542879f6e67
Merge "Normalize image titles in cache to prevent duplicates."
Localisation updates from http://translatewiki.net.

Change-Id: I6656f68985534c1b9a7de5dd1814b26909c2b799
Adjust toolbar group margins for equal vertical alignment

Change-Id: I4596e50c941b1cb628f2ccba983d4b60b7939174
Normalize image titles in cache to prevent duplicates.

Bug: 50158
Change-Id: Ic86e063086917f739f53b4374b29f77bffd4ac1a
Merge "Auto-add required params for user added templates"
Merge "Tighten up outlines and fieldsets"
Auto-add required params for user added templates

Objectives:

* Automatically add required parameters to templates that users create
  using the GUI, without touching existing templates loaded from data
* Cleanup some confusing terminology and APIs

Changes:

ve.ui.MWParameterSearchWidget.js
* Remove special logic for skipping aliases, which are no longer included
  in the list of names given by getParameterNames

ve.ui.MWTransclusionDialog.js
* Add origin arguments to constructors of transclusion parts
* Re-use onAddParameter method during initial construction of parameter
  pages
* Add required template parameters for user created template parts

ve.dm.MWTransclusionPartModel.js
* Add origin argument/property/getter for tracking where a part came from

ve.dm.MWTransclusionContentModel.js,
ve.dm.MWTransclusionPlaceholderModel.js,
ve.dm.MWTemplateModel.js
* Add origin argument pass through

ve.dm.MWTranclusionModel.js
* Add origin arguments to constructors of transclusion parts

ve.dm.MWTemplateSpecModel.js
* Rename origin to name - was a bad name to start with and will be even
  more confusing with the new part origin property
* Add isParameterAlias method
* Make getParameterNames only return primary names, excluding aliases

ve.dm.MWTemplateModel.js
* Update use of parameter origin, now called name

Bug: 50747
Change-Id: Ib444f0f5a8168cd59ea52a6000ba5e42ccdc2a24
Tighten up outlines and fieldsets

Objective:

* Make outline widgets and fieldset layouts take up a little less space

Bonus:

* Fix option icons always showing up on the first item because the option
  wasn't position relative

Changes:

ve.ui.Widget.css
* Add position: relative to option widgets
* Cleanup unused background properties for outline items
* Reduce padding for outline items
* Move icons to match padding changes

ve.ui.Layout.css
* Reduce margins for fieldset layouts, including using a negative top
  margin to compensate for the overly tall legend

Change-Id: Ida6147b8171dcb4152ca9be0e099a5f9b81ac1c0
Prevent escaping of piped links in wikitext parameters

Also in this commit is a fix to the regex for brackets in general
as previously it was grouping multiple pairs together which was
making the stack count incorrect.

Bug: 50801
Change-Id: I2cd825eaa7242e37a6317286cb8f9a4a78e693e2
Actually run all the tests

Some of the ones that were moved to ve-mw disappeared from index.php
(the MW-only test runner) and/or VisualEditor.hooks.php (the runner for
Special:JavaScriptTest that's also used by Jenkins).

Add the missing tests, and rename the SurfaceFragment test. We can't
add the ViewPageTarget test to the index.php file in ve-mw because
it only works when running inside an actual MediaWiki instance.

Change-Id: Iec34f2029f5f9c34855b4d79ef70db5751461a96
Don't change edited transclusion nodes to <span>s

This is harmful because we don't know whether <span> is acceptable
in context. They're not allowed in <tbody> for instance, and so if
we replace a <tr> with a <span> that breaks things.

Instead, use the nodeName of the first original DOM element.

Change-Id: I95ea9f13985767123f692706c6cc71fefd74d517
Merge "Reuse the rules variable"
Reuse the rules variable

Change-Id: I8ce666dad712a99e471930132e3d123dfcf5466d
Merge "Work around Firefox's excessive style security paranoia"
Work around Firefox's excessive style security paranoia

Apparently it's possible for a stylesheet's .cssRules to be accessible,
but for the individual items' .cssText not to be, in which case Firefox
throws a nice security exception that kills the entire editor.

Wrap all inspector of cssRules in a try-catch, and fall back to cloning
the ownerNode if anything weird happens.

Change-Id: I0187ad308e395e92aea587c00fd8d8eb0280822e
Merge "jquery.client: Update to upstream from 92f06b4a in mediawiki/core.git"
Merge "Hide ref errors inside MW transclusions"
Merge "Add notices for pages protected from creation"
Merge "Add protected & semiprotected notices to api."
Merge "Retain original param names and ignore leading/trailing whitespace"
Merge "When normalizing category titles with mw.Title, use getMain method"
When normalizing category titles with mw.Title, use getMain method

This will get the name attribute plus this extension

Bug: 50702
Change-Id: I57298ef34b413002f1506b499903b73a18969e68
Retain original param names and ignore leading/trailing whitespace

Objectives:

* Trim leading or trailing whitespace that parsoid may have left on
  parameter names
* Preserve the original name for round-tripping cleanliness
* Ignore leading or trailing whitespace when entering new parameter names
  in the parameter search widget
* Consider aliases when listing suggested parameters

Changes:

ve.ui.MWParameterSearchWidget.js
* Use hasParameter method instead of using indexOf - uses map lookup
  internally, which is much faster, and also take aliases into account
* Trim query input value to prevent leading or trailing whitespace from
  being considered when filtering known or creating unknown parameters
* Take aliases into account when showing filtered results

ve.dm.MWTransclusionModel.js
* Use original name when round-tripping

ve.dm.MWTemplateParameterModel.js
* Store original name for round tripping, and trim the original name for
  other uses
* Add getOriginalName method

ve.dm.MWTemplateModel.js
* Add hasParameter method, which currently just does a map lookup, but can
  do other processing in the future

ve.dm.MWTemplateSpecModel.js
* Add isParameterKnown method

Bug: 50715
Bug: 50717
Change-Id: I36a5e93ca8938ac3401a6e274647597704700468
Hide ref errors inside MW transclusions

Bug: 50423
Change-Id: I661493ab2ff2d1ddb5d1a8266ceeb4f155075150
Localisation updates from http://translatewiki.net.

Change-Id: I644c9a9cc989bf983a7b2edbca6c5e84037bb24a
Add notices for pages protected from creation

Change-Id: I829c104e1c62e0ad2b48d526447b1ede8408bc6f
jquery.client: Update to upstream from 92f06b4a in mediawiki/core.git

Change-Id: Ica5079f45a4dd1bd24847829a338e54ffc731bda
Merge "Bind listener to keyup to capture arrows & better math for scrolling."
Bind listener to keyup to capture arrows & better math for scrolling.

Listen to keyup to properly capture and respond to up and down arrows.
Rewrite calculation for scroll to better follow toolbar obscured cursor.

Bug: 48787
Change-Id: Ia46fb15ec9a8c07b3945b53a6545897ca23e59fa
Add protected & semiprotected notices to api.

Bug: 50415
Change-Id: I2966a31b909e44aa371dfe84cb68c264420e35a7
Merge "Add hooks and classes, initially to support GuidedTour"
Remove "Tag: " prefix, now that they're in MW core

When If21eaed41 gets merged, the custom of writing "Tag: Foo" will be obviated
by MediaWiki core having this itself. Consequently, once that is merged, we should
remove them from VisualEditor's messages. (Not removing from the non-English
messages per standing guidance from the Language Engineering team.)

Bug: 49602
Change-Id: Ibdd8053c1df950522379f8b05d260b71593d4741
Merge "Language Inspector: CE / DM"
Language Inspector: CE / DM

This is the infrastructure for the Language Inspector prototype, defining
the dm and ce pieces of the <span lang='xx' dir='yy'> annotations. It also
sets up a visual indicator for language blocks (with informational tooltip
for the user while editing. The UI is built on top of this.

Bug: 47759
Change-Id: I239eef5124e29369ea9c5d8c0f49b2f6a61bc053
Merge "Focus link inspector input prior to lookup."
Focus link inspector input prior to lookup.

Since the menu only shows while it's input is focused, input must be focused
prior to suggestions being popuplated.  Fixes race condition where
look up request is near instantaneous.

Change-Id: Icf645d051415ac3ee9e15bc85f22f29dc9b64666
mw.ViewPageTarget.init: Document use of mw.libs.ve to test presence

The presence check used to be against the VE global, but we
recently made that impossible without providing an alternative.

Though by accident, mw.libs.ve has become the new way to check
for presence.

Change-Id: If85695525777a71dde467675052d2ede4e52c9b7
Add hooks and classes, initially to support GuidedTour

* Hooks for activation, deactivation, save dialog state change,
  and tab setup.
* Class for save button (needed to point to it in a clean way).
  Also done for cancel button to be consistent, though GuidedTour
  doesn't currently use this.

Change-Id: I4a0e0631d513fb09c3408f2f36a0de0bd51e1a37
Merge "Lock surface while inspectors are animating open"
Merge "jquery.client: Update to upstream from ce3e67e1 in mediawiki/core.git"
Merge "Make parameter search widget have a horizontal limit"
Merge "Tool and context menu size and alignment fixes"
jquery.client: Update to upstream from ce3e67e1 in mediawiki/core.git

Change-Id: I5b21a2a48ba3fde53370758bac7f1b8a65c4c04f
Make parameter search widget have a horizontal limit

Objective:

* Cut off really long parameter names with ellipsis

Changes:

ve.ui.Widget.css
* Use ellipsis when option labels get too long

ve-mw/ve.ui.Widget.css
* Limit the size of a parameter result widget label - this is a hack, but
  since there are strange bugs with using ellipsis together with % based
  width, it's the best we can do for now

Bug: 50800
Change-Id: Idbfa336d2bba376b0d078fdd0ece65926d610d81
Merge "Remove dead CSS code"
Merge "RTL Improvements"
Tool and context menu size and alignment fixes

Objectives:

* Make context menu toolbar consistently sized and aligned, especially
  in monobook

Changes:

ve.ui.Toolbar.css
* Remove vertical line between groups, just use whitespace
* Switch from padding to margins to avoid size calculation issues

ve.ui.Tool.css
* Remove tiny margin on button tools, tightening them up a bit
* Replace 50% 50% with center center

ve.ui.Context.css
* Switch from padding to margins to avoid size calculation issues
* Use different margins depending on text direction
* Reverse the 0.8em rule used in the dialog - this is a hack, it should
  be cleanup up later with a better strategy for normalizing the size
  of text within VE elements

Change-Id: If65f12382625efa33777e284bd23a94dc509436a
Remove dead CSS code

Reference counting indicates these styles are not in use, so they can now be safely garbage collected.

Change-Id: I432f73490eeb00ff414f150fcf26c718607bac95
mw.ViewPageTarget: Explicitly release our copy of linmod data

Follows-up Ic0c6d190c9b78 which introduced a full linmod copy in a
scope that is also accessible by other closures (namely the
callbacks to jQuery.Deferred #done and #always, and setTimeout).

Though in theory engines may be able to garbage collect it,
I doubt it. Though browsers probably destruct the setTimeout
callback I know  at least the closures pass to jQuery.Deferred
are not released by jQuery, so an engine would have to
understand these other functions well enough to know it doesn't
access the `data` variable.

Let's release explicitly to be safe.

Change-Id: I11000edcad4690dcce53b6e9d1a45bf2ab82fbcb
Lock surface while inspectors are animating open

Objective:

* Prevent input while the inspector is animating open

Changes:

ve.ui.LinkInspector.js
* Disable and then re-enable the surface while the inspector is opening

ve.ce.DocumentNode.js
* Remove opacity changes on disable/enable

ve.init.mw.ViewPageTarget.js
* Change the opacity of the document when save dialog is open

Bug: 51075
Change-Id: Ic7910a666b33b41b57b035a15cf1f8c9264e7111
RTL Improvements

Objectives:

* Make option widget icons correctly placed in RTL
* Make embedded context toolbar correctly placed in RTL

Approach:

Use separate elements for icons within option widgets which have more
flexibility when rendering in either LTR or RTL when compared to CSS
background position. The simpler approach, using CSS background
position offsets, isn't cross-browser compatible at this time.

Changes:

ve.ui.OutlineItemWidget.js
* Remove custom icon implementation, using parent class implementation
  instead

ve.ui.OptionWidget.js
* Add icon option, which adds an icon element only if an icon was
  specified

ve.ui.MenuItemWidget.js, ve-mw/ve.ui.MWParameterResultWidget.js
* Add override for icon config option
* Document icon config as private

ve.ui.Context.js
* Add detection and special handling for positioning embedded context
  toolbar when rendering in RTL

ve.ui.Widget.css
* Add styles for option widget's new icon option
* Add styles to make indentation still work for outline item widgets
* Adjust styles for menu item widget as per changes in option widget

ve-mw/ve.ui.Widget.css
* Adjust styles for parameter result widget as per changes in option
  widget

Change-Id: Ibfa4b613e0fd7902f8a2c78b5717de402c5f82b8
Merge "ve.dm.Surface: Fix incorrect @return for #getDocument"
ve.dm.Surface: Fix incorrect @return for #getDocument

This returns a ve.dm.Document object, not ve.dm.DocumentNode
(very different classes).

Change-Id: Ia8d4eda3e4a51cef58ab816453703a33c8d5f7d5
Merge "Affordances for MenuWidget to be optionally focusable."
Merge "Defer conversion in the sanity check"
Merge "Be sure lookupMenu input is focused before showing"
Be sure lookupMenu input is focused before showing

Resolving this bug reveals a completely unrelated bug where hitting
enter while making a link prior to the input being focused, the
selected text gets replaced with a new line.

Bug: 51075
Bug: 49941
Change-Id: I61a90eeaa40b8b66886c17152544c46fa8ca396a
Merge "Revert "Add support for <blockquote> elements""
Revert "Add support for <blockquote> elements"

Whoops, merged too soon. The dropdown part of it doesn't
actually work right.

This reverts commit 3c51ebad93480c4f52215c83859e8022b7103cf5.

Change-Id: Ieafbf18ca8a43b07e33a787772abbc77aef63e4c
Merge "Add support for <blockquote> elements"
Localisation updates from http://translatewiki.net.

Change-Id: I434dbca8e5fc80919b9e77ee9f4507cd96705718
Defer conversion in the sanity check

Conversion is apparently pretty slow on large articles, so put it inside
the setTimeout(). We still need to copy the data array synchronously
though.

Change-Id: Ic0c6d190c9b782f8c643d00d335f0e004d860bcf
Add support for <blockquote> elements

Bug: 51009
Change-Id: I7ba1635e4f856a021e1a7a2d26a8714230c9364a
Affordances for MenuWidget to be optionally focusable.

* ve.ui.MenuWidget.js
MenuWidget no longer creates an embeded input element by default.
In the case of no configured input element, we bind the keydown
handler to window with addEventListner while using the useCapture
flag.  This nicely prevents elements lower in the dom from triggering
( document node ) Supported in IE9 and above and all modern browsers.

* ve.ui.ListAction.js
Since MenuWidget is no longer stealing focus from the surface,
we no longer need to restore focus after a list item conversion.
This is the end goal, as browsers like Chrome like to scroll to
the top of elements that gain focus.

Bug: 50792
Change-Id: I5b6969bca1a58b040708f8ac9d3dc8b07ddf9e6b
Array.prototype.splice polyfill for Opera

Apparently they can't get their basic ECMAScript right. In 2013.

It doesn't come up that often, because you don't splice an array with
more than 256 elements every day. Only implemented in ve.batchSplice
for now, as that function does handle thousands of elements routinely.
Other callers of .splice() can simply use that instead.

Bug: 50385
Change-Id: I281a61d55c6f7df5f28627a1df80f2a001110607
mw.ViewPageTarget.init: Clarify reason for FF12 / FF14 blacklist

Follows-up I7a9dddb693091f.

Change-Id: I49a952f6b1714808cd4f063c48cf3102997f8746
Blacklist Firefox 13 and 14 too

Firefox 13 and 14 were the cause of links magically turning into [[./Foo]].
Once the immediate rush of deployment is over, we'll want to investigate as
to why and hopefully find a way to unblacklist FF.

Bug: 50720
Change-Id: I7a9dddb693091fa1e44b4325e77b9e4f55e5c193
Merge "mw.ViewPageTarget.init: Only bind edit section links on view page"
Merge "mw.ViewPageTarget: Fix incorrect retention of the wrong oldid"
mw.ViewPageTarget.init: Only bind edit section links on view page

The handler for the Edit tab already is in this conditional,
for edit section we were making the assumption that they only
ever appear on a view page, but that's wrong. They're also shown
on a diff against the latest revision of the page.

Bug: 50925
Change-Id: I802e548cbcdc03cfca66129466668854604bc3e7
mw.ViewPageTarget: Fix incorrect retention of the wrong oldid

* Only pass the oldid to the API from #load if we restoring from
  oldid in the url. Otherwise load the latest version.
* Setting 'restoring' from mw.Target instead of mw.ViewPageTarget
  so that we don't rely on mw.ViewPageTarget in mw.Target#load.
* Fix the API to not require 'oldid' to be passed.
* Fix the API to actually return the 'newrevid' property. It
  was doing a no-op on a $result that is never used due to the
  same variable being overwritten with the result of parseWikitext.
* Moved updating of wgCurRevisionId to mw.ViewPageTarget as it
  belongs there (possible future inline editors probably act
  on a different page than the main one). Also made it only
  update if it isn't undefined, so that a null edit doesn't
  result in wgCurRevisionId being unset.

Bug: 49943
Bug: 50441
Change-Id: I221e5038f95eadf6d87013e80f12394f0376a293
Merge "Make all annotations additive"
Merge "Separate out UnicodeJS tests properly"
Merge "Drop mw:ExtLink/URL support"
Localisation updates from http://translatewiki.net.

Change-Id: Icf828cf3171a868c14cb7c2db30692fcb9c85e25
Localisation updates from http://translatewiki.net.

Change-Id: Ic28f51ba1ef4f1eb80bea69cdc131cec8994b4e2
Merge changes I4d7533af,Ib909c5fb

* changes:
  Math Node UI
  Math Node Matcher
Math Node UI

Show an inspector with inputwidget when the user clicks a math
node. The data of the math equation is shown in the
edit box, it can re-render the math tag image when
the inspector is closed, and save the change when
saving the page.

TODO:
* Change the icon from link to math
* Translate title by translatewiki in i18n
* Other further UI improvements

Change-Id: I4d7533af25186cc39cc4bc6a4326d222ffd6db19
Math Node Matcher

This patch creates two files handling math node matching,
which are:
ve.dm.MWMathNode.js - a basic version of toDataElement
and toDomElement functions work
ve.ce.MWMathNode.js - math formulas in VisualEditor are
clickable and render as img tags

Change-Id: Ib909c5fb02e385c88050f42d02d207ab6a97d0dd
Localisation updates from http://translatewiki.net.

Change-Id: Id3a95220459e85d156529e28636712434a27578f
Localisation updates from http://translatewiki.net.

Change-Id: I631fcfc2a3eaf6f30f88e8bbeb44109f9045e75d
Make all annotations additive

Any annotation could have a style attribute which has
a compound effect, and this also prevents roundtrip
errors. Button tool logic should prevent any annotation
from being applied twice which shouldn't be.

Bug: 49755
Change-Id: I8502a55cd2b195d28d0e2ecd63f15de670f80d60
Fix CSS lint error ('0px' => '0')

Change-Id: If9bfd8b061c0cd8240980cbd4ee4db5f24d40104
Merge "makeStaticLoader: Update output and re-sync"
Merge "Add missing ve-mw ve.ce.Node.css"
Merge "Moved embed statement where it does something"
Merge "mw.ViewPageTarget.init: Move edit section to top init"
mw.ViewPageTarget.init: Move edit section to top init

Since we're now only loading the light-weight init on page load,
the section editing wasn't just deferred to after page load (like
it was before), but wasn't happening at all until you clicked
"Edit" (at which point the library loads). It only worked when
going back to "View" after "Edit".

Contrary to tab layout, edit section handling needs to be
accessible both in the top init and in the main target class
because we need to run it both at run time and after the user
has saved a page when we show them the updated page without
refresh. This is why we need to transfer the method at run time
and give the main class access to it as well.
Can't wait for bug 50707 to get rid of this mess...

Bug: 50731
Bug: 49993
Change-Id: Iab9c81222df7f1084179c3643d158374a89ca14b
Merge "mw.ViewPageTarget.init: Add missing "accesskey-ca-editsource" message"
Merge "Blacklist Firefox 11 and 12 Bug: 50780"
Blacklist Firefox 11 and 12
Bug: 50780

Change-Id: I6461f066443223dfd5f6d73aeea0c87cbbdb81d0
Page settings fix-fix

This re-fixes the fix to the frame fix. fix fix.
Two things changed: Background position flipped to the right properly
(was somewhat off before) and text-alignment flipped as well.

Bug: 49613
Change-Id: I0aa317ef674537d20d7ed64e74eaa3cfe8030c8c
Separate out UnicodeJS tests properly

Also fix some comment & whitespace inconsistencies.

Change-Id: I71717643678445590820e174e6ed2e5ac58103c2
Optimise png images with optipng

Change-Id: Id014ad0a0aa99c9440360e32d2e10bc99fa64738
Moved embed statement where it does something

Followup to Ibdc2410cc

Change-Id: I5e665f5d720366650c362ed603693a223c96ee77
mw.ViewPageTarget.init: Add missing "accesskey-ca-editsource" message

Added the wrong one, message "accesskey-ca-ve-editsource"
doesn't even exist. It worked locally but that was probably
a lucky race condition or cache.

Follows-up 10fd1a3, b21fe5f.

Bug: 50725
Change-Id: Ie87f8c6861dfe010c038ddb103aa5ea56cd57d24
Localisation updates from http://translatewiki.net.

Change-Id: I05fb211278f6b6e975fa26b8cf0448c7c5d5fc0a
Drop mw:ExtLink/URL support

Because Parsoid has.

Bug: 50734
Change-Id: Id2c893467c5063cc29cd9a91203406b86a3abfbe
makeStaticLoader: Update output and re-sync

This was broken after 92c38ea removed ve-mw files from the
static loaders but didn't update makeStaticLoader.php so
it was harder to keep the files in sync and a few minor issues
on the documentation pages.

Since the files are still mixed in the non-mw modules the only
way to exclude them is to do what was manually done in 92c38ea:
Filter out paths starting with "ve-mw/" from non-mw modules.

Change-Id: Id58ee89ac18c63c01719dc11ec7a07ddeee3ea0b
Add missing ve-mw ve.ce.Node.css

Follows-up 92c38ea, which duplicated the existing one but forgot
to change the path from 've' to 've-mw'.

Change-Id: Ia95d26501aa9ab52e33394500bb51a733acf4658
Merge "Revert "Make link inspector re-usable by splitting it up""
Revert "Make link inspector re-usable by splitting it up"

Breaks MWLinkInspector initialization behavior

This reverts commit f7107fa20dc0e10999faf0d867840a446a669a52.

Change-Id: If93d1092eeb14f6ba23e6368834a6f80df765d21
mw.ViewPageTarget.init: Remove harmless debugging code for ES5

Was accidentally kept in Ic8b0004ab5288fa9.

Change-Id: I1c95189437e3e74c5e2884d14c1ccf000ef0c178
mw.ViewPageTarget.init: Add msg key "accesskey-ca-ve-editsource"

Was accidentally removed in Ic8b0004ab5288fa9.

Change-Id: I003e11f7b9ff44982ccc869fecf7e30300202574
Merge "Split off setup from the rest of mw.ViewPageTarget"
Split off setup from the rest of mw.ViewPageTarget

Initialisation initialisation? It's time to rename ve.init
to ve.platform and ve.init.Platform to ve.platform.Environment,
but that'll come later.

* Moved support detection and skin set up to separate class-less
  file.
* Swapped usage of ve.msg for mw.msg.
* Callback of edit tab now does an mw.loader call to fetch
  the actual VisualEditor libraries.
  Though mw.loader won't load the same thing twice, we would
  bind a callback each time. To avoid instantiating ViewPageTarget
  more than once we use a Deferred.

Bug: 50542
Bug: 50608
Bug: 50612
Change-Id: Ic8b0004ab5288fa91bb29d496485b93ffd8d977e
Listen to keypress in ve.ce.surface.$ rather than window

Bug: 50538
Change-Id: Ifddf1bae1ee799ec3467a81c597702fc3f8be089
Add @inheritable to modelClasses in annotation inspector

Change-Id: Ic9b2a9c530a85d36078337d20ca8252efaf74c99
Merge "Make link inspector re-usable by splitting it up"
Make link inspector re-usable by splitting it up

Objective:

* Make the majority of link inspector, which is generic to any annotation, usable for other annotation inspectors

Change-Id: I1f7e9c13537105da7aa0351c9c92e8af5eb5a3f4
Revert "Address error caused by changing focus from context menu to window."

Just a proof-of-concept that this would work on Opera. I'm figuring out
what was this for initially...

This reverts commit 30dadb6c8c1b684fecfc066b003c92e78ae66124.

Bug: 47794
Change-Id: Ie4f1334e0beb7ba7d4f4aa3b42464fa219c4778c
Merge "Fix focusable highlights"
Fix focusable highlights

!$element.is( ':visible' ) - jQuery .is() returns boolean based on the
parameter.

$element.not( ':visible' ) - jQuery .not() returns a filtered jQuery
collection with elements matching the parameter removed.

Change-Id: Iedf55f3453514ee710bbb6d702bbf9a5570a4a1d
Localisation updates from http://translatewiki.net.

Change-Id: I8c11d92d466b3a00371cbcc6ed7906d969670ae7
Merge "Add container option to popup widgets"
Add container option to popup widgets

This actually fixes a hack done in a previous commit where an undocumented
surface option was being passed, but not always. And in some cases there
were uses of the popup which didn't really have a surface to pass in.

Change-Id: I08b5dc2dc879f6abd1b16d1d66ac1d8b5624f673
Restore callout image white-space

Oops.

Change-Id: I24039e7f4ee83cc26c7d600252ac8b9290eeda19
Remove MW stuff from standalone demo

Change-Id: Ia5307c1b148e09108debb869f020e402a4e6e4d8
Merge "Allow annotations to be additive"
Allow annotations to be additive

Set a static property on big, small, sup, sub to allow them
to be added multiple times to an annotationSet.

Fix the converter to count out annotations when opening/closing.

Bug: 49755
Change-Id: Ifbede9345a66434022dbd681eada447ab81ab025
Template parameter adding

Objective:

* Allow browsing, searching and adding documented parameters

Changes:

ve.ui.MWTransclusionDialog.js
* Replace regular text input with ve.ui.ParameterSearchWidget
* Fix uses of $(), this.frame.$$ is correct

ve.ui.Dialog.css
* Change rules for addParameterFieldset to make search widget auto-size vertically

ve.ui.Widget.css
* Add styles for ve.ui.MWParameterResultWidget

ve.ui.MWParameterSearchWidget.js, ve.ui.MWParameterResultWidget.js
* New classes
* Provides a way to search and select parameter for a template
* Displays parameter label, name, aliases and description

*.php
* Links to new files and messages

Change-Id: Ie5dbe8c44ce5d64c4b49b09517fb66cd30dd7304
Merge "Dir fix for iframes and widgets"
Dir fix for iframes and widgets

This fix adds a directionality property to the frame objects so directions
can be inherited and manipulated inside the frame <body> tags.
There are also several corrections to flipping positioning of panels
in the GridLayout and of the icons in fieldsets and labeled elements
so they appear properly (right instead of left).

I've added a 've-rtl' / 've-ltr' class to frame content divs to serve as
selectors for rtl fixes and general language fixes. Most CSS corrections
would likely be fixed when CSSJanus works in iframes, but the selectors
would still be useful.

This sets the stage for directionality inheritance inside iframes,
and fixes most of the problem with the Page Settings window in RTL wikis.
It also fixes all the labels with icons across VE interface.

Bug: 49613
Change-Id: I418e669b0999552167683352acb365a4249ab9cc
Merge "Icon cleanup"
Icon cleanup

Objectives:

* Remove "big" icons, which we don't use anywhere
* Remove unnecessary crap from SVG files
* \r\n -> \n

Change-Id: Iedfcaf43e4e15acd4ae3a2671ba7b2e3d9c2f4b4
Merge "doc: Fix incorrect documentation in template data model"
doc: Fix incorrect documentation in template data model

Per the TemplateData spec:
* Most message values can be null, though they're never undefined.
* 'deprecated' is actually {boolean|string}.

For us:
* Make #isParameterDeprecated always return a boolean
* Add #getParameterDeprecationDescription to get the explanation
  of why a parameter is deprecated
* getParameterDescription doesn't need to pass 'null' for fallback
  since that's the default fallback.
  And it may return null or string.
* #getParameterSets returns an array of Set objects, not an array
  of strings (see spec for more information).

Change-Id: Iee788bc8fa6f0545085a0f154b77b8176f770dd2
Merge "Make local overlays local to surface and remove insane z-indexes"
Merge "Emit select null on selected item removal"
Merge "Select widget relative item fixes"
Make local overlays local to surface and remove insane z-indexes

ve.ui.Surface.js
* Make local overlay a child of ve-ui-surface and a sibling to
  ve-ce-surface elements.
** This keeps local overlays relative to their surface and eliminates the
   need for insane z-indexes.

ve.ui.PopupWidget.js
* PopupWidget boundaries are now relative to ve-ce-surface and no longer
  protrude out

ve.ce.Node.css, ve.ui.Window.css
* Removal or replacement of insane z-indexes.

ve.ce.FocusableNode.js, ve.ce.ProtectedNode.js, ve.ce.ResizableNode.js,
ve.ui.Context.js
* Translate offsets from local overlay

ve.init.mw.ViewPageTarget-monobook.css,
ve.init.mw.ViewPageTarget-vector.css
* Skin specific z-indexes for global overlay

ve.init.mw.ViewPageTarget.js
* Applied direction specific mw class to ce.Surface vs ui.Surface to
  prevent mw content styles from being applied to ui elements.

ve.ui.Dialog.css
* Adjustments to surface inside of dialog so that relative offsets for
  local overlays can be properly calculated.

ve.ui.Surface.css
* Explicitly force .ve-ui-surface to be relative so that it's children can
  be relatively positioned.

ve.ui.Widget.css
* Removal of unnecessary font-size properties now that local overlay is
  sibling of surface.

ve.js
* Added get relative position helper method to translate position offsets
  from target parent

Bug: 50241
Change-Id: Ibadce404a2286bc5dcec48f0d9da89004dbbd867
Merge "Localisation updates from http://translatewiki.net."
Localisation updates from http://translatewiki.net.

Change-Id: Ia57ea5446ae7c561736d9df1458d7a7e55ce7af0
Merge "Disconnect bound reference list events on teardown"
Merge "Resizing Images Sometimes Sets Unusable Size"
Merge "Category moving improvements"
Resizing Images Sometimes Sets Unusable Size

Resize handle event handling was set up to bind on focus and
unbind on document mouse up. The problem is that focus can be
set programmatically and sometimes more than once. This would
cause the image to be properly resized once, but immediately
resized again to 0x0. Now, before binding events to the resize
handles, all resize handle events are unbound.

Change-Id: I22b7902d303b5ca43e132c121d743d6815980fc6
Correct Rendering for Block Images After Resize Undo

If a block image is resized and undone, there are lots of problems.

* The block image gets the wrong size. When rolling back the
transaction, height and width are passed as strings.
MWBlockImage tries to set the width to: width + 2. A 300px image
became 3002px.

* Resize handles didn't reposition and resize

* Relocatable drag marker didn't reposition and resize

* Focusable highlights didn't reposition and resize.

Change-Id: I8792b567b77da90ce5a2ad132e306705c5706606
Disconnect bound reference list events on teardown

Reference lists would never disconnect, and some transactions would cause them to be "updated" even though they don't have a document anymore.

A way to test this is to insert an image in a document with some references. When you click apply, it crashes.

The solution was to make sure we actually disconnect from the internalList and listNode on teardown.

Change-Id: Ieb0354938b68fe5e7965f61f9ccce07cd6fb1120
Merge "Search widget key commands"
Merge "Avoid self-references, and refer instead to "source mode""
Avoid self-references, and refer instead to "source mode"

Messages like "This element cannot yet be edited in VisualEditor"
presuppose an awareness on the user's part what VisualEditor is,
but ideally, we want the software to be invisible. Where we want
to refer to behavior of the software, we should characterize it
using language that is discoverable by the user.

Change-Id: Ia4ef7aca1501cf9cf0f772f82ac2b0a99ca53a63
Merge "Simplify UI text from Caption content to Caption"
Simplify UI text from Caption content to Caption

Suggested in
https://translatewiki.net/wiki/Thread:Support/About_MediaWiki:Visualeditor-dialog-media-content-section/he

Change-Id: I2cc48aa710bfc1ce302ef02a12aa2679a3cf0dc3
Fix for edit links, RTL wikis with LTR interface

Added both bidi-isolation and directionality. Since the directionality
has to come from the user interface (and not the wiki dir itself) I had
to read the $('body') direction. The other option could be adding a
mw.config.get().userLanguageDir that picks up the interface directionality
on top of the wiki directionality.

Bug: 50543
Change-Id: I9a00e9545a46f13750ab0d118b23d05573ee1a2e
Search widget key commands

Objective:

* Enable navigating search results using keyboard up and down keys
* Bubble up query input enter events

Changes:

ve.ui.SearchWidget.js
* Route query input events to emit
* Add handler for keydown events
* Support navigating through the list of results using vertical arrow keys

Change-Id: Ia2e4b27075a8ab2e29a69294e9f7847e8f5a3f83
Merge "Fix display of 'please check this edit' tag"
Merge "Blacklist Firefox <= 10 per reports that it's broken"
Fix display of 'please check this edit' tag

Change-Id: I09f8926f7f65f092cf37eb661d90602677d04924
Blacklist Firefox <= 10 per reports that it's broken

Bug: 50534
Change-Id: I732a6cceb0790bf22488e4db292b62c43276783f
Emit select null on selected item removal

Issues:

* Selected item is removed, but no select even was emitted

Changes:

ve.ui.SelectWidget.js
* On remove, emit select null when removing a selected item
* On clear, emit select null always

Change-Id: I1a94b0f8a841611b20e09f6c02f37fb9589e85c3
Merge "Per its own documentation, make showMessage()'s wrap default to 'warning'"
Select widget relative item fixes

Changes:

ve.ui.SelectWidget.js
* Make getRelativeSelectableItem properly loop around
* Replace confusing and broken getClosestSelectableItem with getFirstSelectableItem since that's the only use case we had for it anyway

ve.ui.PagedDialog.js, ve.ui.LookupInputWidget.js
* Update calls to getClosestSelectableItem to use new method

Change-Id: I2399d01a45c43d1ad663ed6c6de156e796065306
Make GenderSurvey a number, not string.

Change-Id: I86f528070be66ae617337bb5df64951aad9b5f58
Category moving improvements

Changes:

ve.dm.MetaList.js
* Auto-initialize index to the end of the list (like the docs claim) even when not providing an offset

ve.ui.MWCategoryInputWidget.js
* Cleanup fix for not offering to move the last category to the end

ve.ui.MWCategoryWidget.js
* Allow pressing cancel on the meta dialog after moving a category to the end without crashing

Change-Id: I45059bda022639f7942f1799a42ecf8a4d962df0
Per its own documentation, make showMessage()'s wrap default to 'warning'

This was producing some lovely <visualeditor-savedialog-label-undefined>
garbage.

Change-Id: I0852fea9088738d9a93e25bd3b104b9aa07c256d
Merge "Add GuidedTour survey about user gender"
Add GuidedTour survey about user gender

Disabled by default, enabled with $wgVisualEditorEnableGenderSurvey.

Change-Id: I2b4aba6a95a33474c3e68423d478aa78e57d86ad
Merge "Some basic async code in the initialization"
Some basic async code in the initialization

Break setUpSurface into a bunch of parts that setTimeout() each other.
This breaks the initialization of the editor as a whole up into the
following phases:
0) Receive AJAX response, parse HTML
1) Build linear model data
2) Build DM tree
3) Build CE tree, CE DOM, create surface
4) Initialize surface, some UI initialization
5) Launch sanity check, remaining setup, unlock editor

This is a bit hacky right now, we'll probably want to refactor later.

ve.dm.InternalList.js:
* Allow construction without a dm.Document

ve.ui.Surface.js:
* Allow construction based on a dm.Document

Change-Id: Ibf48a7e85cd7376c8f6205ed165ff57e71e34c35
Localisation updates from http://translatewiki.net.

Change-Id: Ifec1fe1b5e20f43dc9adf05a42c36f910db0bee7
Merge "Restore focus to documentNode on convert"
Restore focus to documentNode on convert

Since format dropdown tool is the only tool where we actually lose
focus to the documentNode, we must restore focus so that firefox
and chrome will display a cursor after converting content branches.

Bug: 50338
Change-Id: I4059b2688565570e0efc21078035775b7aed49e1
Merge "Don't underline the 'user guide' link when hovering the tool menu"
Don't underline the 'user guide' link when hovering the tool menu

There are wider issues about sub-tools here, but this fixes the most glaring issue
for now.

Change-Id: I5ff2d67642daea2f84ccc56fe391eee9ca01d099
Merge "Allow creating lists in block slugs"
Merge "mw.ViewPageTarget: Show save errors in save dialog instead of alert"
Merge "Add user guide link to beta icon drop down"
Add user guide link to beta icon drop down

As part of this, put the 'help' icon next to the beta icon, make the
text not greyed-out (now that it's an actual action) and provide the
link.

On hover, all three items get underlined, which is irritating, however.

Bug: 50476
Change-Id: Id65968072b7134f5864bbd96acf34fd0c23fe17c
Merge "Preserve the contents of secondary reference definitions"
Merge "Fix bug where whitespace in an empty node was doubled"
Merge "Fix reordering of metadata bug"
Allow creating lists in block slugs

Previous when the selection was collapsed and the cursor was in a block
slug we'd get a JS error thrown. This fixes that, though it could do with
a refactor in time.

Bug: 47947
Change-Id: I596ea9bc553f563e3dc7689c518c7d1319ac1dc3
mw.ViewPageTarget: Show save errors in save dialog instead of alert

To trigger a save rejection from the api, set:
 $wgSpamRegex = '/spam/i';
and making an edit adding the word "spam" to a page.

Class changes:
* Rename message system in the save dialog from "warning" to
  "message" as it will now contain both warnings and errors.
  (css class, class property, method names, ..)

Localisation:
* Remove ugly hardcoded and wikitext-requiring "'''Warning:'''"
  prefix from the warning message, instead have a message for the
  word "Warning" and re-use this in #showMessage for each message
  of type "warning" (bolding applied in code instead of in i18n).
* Rename visualeditor-savedialog-dirtywarning to
  visualeditor-savedialog-warning-dirty and remove from
  VisualEditorMessagesModule.php as it no longer requires pre-
  processing from the server.

Clean up:
* Re-alphabetise the order of some messages.
* Clean up duplication and redundant logic in mw.Target#onSaveError
  and mw.ViewPageTarget#onSaveError.

Bug: 50350
Change-Id: I3daf631fb0d62ba88e05aa50c77c9940d61395a0
Merge "Minor performance optimization and cleanup in FocusableNode"
Minor performance optimization and cleanup in FocusableNode

Change-Id: I4385b07c35e330a43827c891b94460424986526d
Make node resizing happen inside onAttributeChange

This change fixed not yet reported bug that undo/redo for resizable nodes wasn't working.

Change-Id: Id61389bc6dcfffdd6df1d22cdb5c85e58513fb8c
Merge "Simplify ve.ce.ResizableNode by removing code for 'transition' which is not used anyway"
Merge "Make toolbar look correct with non-standard browser font size settings"
Make toolbar look correct with non-standard browser font size settings

Assumption about toolbar height never exceeding 88px is not correct. At
least in Chrome, after setting in advanced configuration font size to
"Large" instead of "Medium", the toolbar's height is 110px and part of it
is transparent. Because it is transparent user can see content behind it
when scrolled down, which makes for a not really good experience.

Change-Id: Ibdc2410cc4ab29bfe774961fc062d172386975d4
Preserve the contents of secondary reference definitions

We currently change <ref name="foo">Foo</ref> ... <ref name="foo">Foo</ref>
to <ref name="foo">Foo</ref> ... <ref name="foo" /> , because know
that the second ref tag isn't canonical and so we blank it.

Instead, we now preserve the contents of all ref tags that come after
the canonical one.

Change-Id: I45a51a879271890fe46c4184f1029f12d27af678
Fix bug where whitespace in an empty node was doubled

<table>\n\n</table> round-tripped to <table>\n\n\n\n</table> because
we would store '\n\n' in both the innerPre and innerPost fields.
Fixed by not setting innerPost if the element is empty.

Change-Id: I0393bfaf9793fdebc8fff72c8760113fa69bb2bd
Also annotate empty annotations

The converter wasn't setting .annotations on meta items created to
represent empty annotations, which meant that HTML like
<i>Foo<b></b></i> would end up as <i>Foo</i><b></b> in the linmod.

Change-Id: I13d7d9820beeee1e8c3673e08051361d6c6ac4cd
Fix reordering of metadata bug

If you had <meta /><b>Annotated text</b> in a wrapper paragraph,
the converter would swap them and output the linear model equivalent
of <p wrapper><b>Annotated text</b></p><meta />.

This happened because the meta item was queued, and annotations didn't
trigger metadata queue flushes. The fix is to trigger a metadata queue
flush whenever we're about to write something that isn't itself queued.

Change-Id: I168abc0392fbec5503271d1653ee5c38518f857d
Simplify ve.ce.ResizableNode by removing code for 'transition' which is not used anyway

Change-Id: I561395cab3271a93f43d14d17db0c2dcee74ae4a
Merge "Improve async template data loading"
Merge "Add ability to disable for anonymous users"
Add ability to disable for anonymous users

This adds a new config variable, $wgVisualEditorDisableForAnons,
defaulting to 'false', which disables VisualEditor for not-logged-in
users. This only makes sense where the visualeditor-enable setting is
set to 'on' for all users; it will be used but briefly.

Bug: 50000
Change-Id: I7418c7d96a79b17e717abfba1af8c5df3141e591
Improve async template data loading

Objective:

* Fix issue where async behavior of addTemplate caused templates to be added in the wrong order

Bonus:

* Get rid of special adders for transclusion parts, just construct objects outside and use addPart

Change-Id: Ibe579f033873446376d72d3bd1b9f92d9f361de5
Merge "mw: Implement support for ConfirmEdit and FancyCaptcha"
mw: Implement support for ConfirmEdit and FancyCaptcha

* 'captcha' property from ConfirmEdit API is already exposed
  in ApiEdit and ApiVisualEditor through the 'edit' property
  in our response data.
* Add parameters 'captchaid' and 'captchaword' to ApiVisualEditor
  and mw.ViewPageTarget#getSaveOptions. ApiVisualEditor will
  forward these to ApiEdit which forwards them to FancyCaptcha.
* We display the captcha through a saveDialog warning.

Bug: 50356
Change-Id: Ia7d2102cba89d00ec8508e846061023b330ece4f
Merge "mw.ViewPageTarget: Support for non-paragraphs in #showWarning"
mw.ViewPageTarget: Support for non-paragraphs in #showWarning

We need this for captcha's. They'll be added and displayed as
a warning, and cleared like all others. But they shouldn't be
wrapped in a paragraph and aren't delivered as html text but
as a jQuery object (can't serialise to static html since we'll
have to keep a reference to the TextInputWidget and what not).

Change-Id: I3734fbd3c6f0270094db014bbc76d065a73ab918
Merge "mw.Target: Use saveError's third parameter for response data"
mw.Target: Use saveError's third parameter for response data

This parameter was documented as "HTTP status text" but this
was incorrectly copied from other events. The actual code
never passed anything other than null.

Now documenting it as API response data (if available, else null)

Change-Id: I88c8c525f3ca53fd47de634aec469be372884cfc
Merge "ve.ui.TextInputWidget: Fix TypeError when config is undefined"
Merge "Make loading VE work on Opera again, attempt two"
Merge "Move colon to make it bold too"
Localisation updates from http://translatewiki.net.

Change-Id: I4112ca869980947884249f7af5e3cc08bb749b06
Make loading VE work on Opera again, attempt two

Once more, with feeling. Expanding the solution implemented in I1ab60665.

Bug: 50417
Change-Id: Ie0f552a0598068abc3f00bdc09cfb67230525a72
ve.ui.TextInputWidget: Fix TypeError when config is undefined

Parameter config is optional (both in the parent class and here),
this subclass forgot to add the fallback.

Though in a plain subclass the local fallback isn't needed
(parent class takes cares of it), in this case it is needed
since the constructor directly accesses config.multiline etc.

Change-Id: I3f9b73efb6c40a29efa221e1654b1247baaca281
Move colon to make it bold too

For consistency with other MediaWiki extensions

Change-Id: I023cea932775e6d089942ff0c52f8aee99bfe2a3
Merge "Firefox misplaces cursor when moving between lines"
Merge "ApiVisualEditor: Rename editResult to result"
Merge "ApiVisualEditor: Separate save/diff switch case"
Merge "Stop floated transclusions floating out of themselves"
Stop floated transclusions floating out of themselves

This is done by setting renderHtmlAttributes to false, for both block
and inline transclusions.

Bug: 49925
Change-Id: I975cf1de3b273a5189e6edf7db937c4388fa4fbe
Use template data for new templates and fix alias bug

Objectives:

* Use template data for templates added to a transclusion using
  the list controls
* Cache template data between different instances of the dialog
* Allow placeholders to be replaced with templates asynchronously
* Save http request and abort pending requests on close

Also:
* Fix breakage of (unused) method getParameterAliases
  (dont delete aliases)
* Remove unused method getTemplateSpec.

Bug: 49778
Change-Id: I391e51cb900ef5560455d6f3d4d2a8b99ed2b034
ApiVisualEditor: Rename editResult to result

$editResult is confusing as it is the same as ['edit']['result']
as one would expect.

Change-Id: I8cf39359307f39450f53331ce885d2ad420168ce
ApiVisualEditor: Separate save/diff switch case

They no longer overlap (except for 3 lines of code). The
double switch case for save/diff 90% of the body being if-save
and elseif-diff doesn't make sense.

Change-Id: Ic6f014393e72901bb5ab4449d946d94b87429e52
Merge "ve.dm.MWTemplateSpecModel: Implement getParameterOrigin"
Firefox misplaces cursor when moving between lines

When the cursor is programmatically moved, as we need to do
from time to time, Firefox's internal reference for the appropriate
cursor location on nearby lines is maintained, creating an
unexpected experience.

The fix is to wiggle the selection. This tricks Firefox into thinking
that it adjusted the selection natively.

Bug: 48289
Change-Id: I75e7e4467ec1c3faf344709886b9be5b1423cd3e
Don't draw highlights over hidden elements.

Rational is that you wouldn't want to highlight something that is not
visible.  And, obtaining offsets for hidden slugs in this case does not
return correct values.

Bug: 49818
Change-Id: Ic2818423c26f5bbb2c056c3c94740d822be4f1b8
ve.dm.MWTemplateSpecModel: Implement getParameterOrigin

Change-Id: I5970cbefd8eba9afcf37dff90d0f2a72b4bd7627
Localisation updates from http://translatewiki.net.

Change-Id: Id6a1a3cade03355049f713585407e005aa699c8b
Merge "Disable inspection of references with unknown contents"
Disable inspection of references with unknown contents

Ed & Roan:
 Disable editing of references of which we are unable to find the
 source (e.g. <ref name="x"> without a target, or when the target is
 currently nested in something we don't yet process such as inside a
 <references> block or a template).

Timo:
 Improve UI to not be a regular focusable node where the inspector just
 won't show up but add a not-allowed cursor and explanatory tooltip.

James:
 Fix messages to refer to VisualEditor instead of "the" VisualEditor.

Change-Id: Ib2bca092ce13c9187fa8b27ad6a6404cae02aea2
mw.ViewPageTarget: Add sanity check for DOM roundtrip

The sanity check converts the linear model back to DOM, then
compares this DOM to the original DOM and rejects the deferred
if they are not equal.

The DOM creation has to be done synchronously (before we unlock
the surface), but the actual comparsion can be (and is) done
asynchronously.

To make the UI flow of the save dialog easier we just keep the
save button on the toolbar itself disabled until the sanity
check is done. Though this should finish before the user starts
editing the document (let alone start saving), we do add a class
to the button to indicate a progress cursor.

To simulate a slow sanity check, set the setTimeout in
startSanityCheck to 5000, load VE, make a change, hover the
button, and see it change from disabled + progress-cursor to
enabled after 5 seconds.

To simulate the sanity check failing, change !== to === in
the first "if" in startSanityCheck.

Bug: 47521
Bug: 50067
Change-Id: I04f71fe8e00c6257fbc953cc9de3323e24709b0f
Merge "Reference insertion, new and existing"
Reference insertion, new and existing

Objectives:

* Split reference dialog (at least for now) an edit and an insert dialog
* Add reference search widget for selecting an existing source, or
  choosing to add a new one
* Abstract reference names, don't allow editing them and generate them
  when needed
* When editing groups, move the internal item and update all references
  to it
* Resolve name conflicts when moving a reference to a new group by
  generating a new list key

Bonus:

* Add getNodeGroups method to internal list
* Add getUniqueListKey method to internal list
* Add destroy functionality to ce.node to release events and references

Bug: 49733
Change-Id: Ib244ff6ad9b4cee1decfd9b9e1d3d4e9cdcfb78c
Merge "Automatically focus on the query input on insert media dialog open"
Merge "Unhack detached protected CE node shields"
Merge "Fix class attribute preservation for images"
Automatically focus on the query input on insert media dialog open

Change-Id: I03d44d09e3abfffb67adeba5ebe3a52451cc5be5
Merge "Option widget improvements"
Unhack detached protected CE node shields

Objectives:

* Make protected CE nodes only add shields when attached to a surface
* Remove hack in reference list node used to work around this issue

Change-Id: I48d4478558b49037b80b6131e1b2e01dc4f9ec47
Merge "Pasted content is annotated"
Merge "Fix edit | edit source link tabbing in Firefox"
Fix class attribute preservation for images

* Port the class preservation logic from BlockImage to InlineImage
* Add preservation for unrecognized classes
* Add the logic for collapsing spaces in the class attribute in more
  places

Change-Id: I26faad7e00ab2f0a0f5d076552e56b32c692ae74
Fix edit | edit source link tabbing in Firefox

When you selected the "edit" link by tabbing, the links would expand.
In Chrome, you could then tab to the "edit source" link, but in Firefox,
the links would just contract back and you couldn't reach "edit source".

This happened because in Chrome, the "edit source" link is already
considered to be focused when the blur event happens on the "edit" link.
But in Firefox, this is not the case: the blur fires first, and only
after that does Firefox determine what to focus next.

Fixed by waiting 100ms to contract after blur, just like we do on
mouseleave.

Change-Id: I9a38b629ca5e580003d82a3dca8dbf7564486fa0
Put the link inspector in the menus overlay

Change-Id: Id8446e0a9d9b0dd7bd04f48405b6818fa39a86e6
Local Overlay Stacks

After a spirited discussion, localOverlay is getting some children.

* localOverlayBlockers - UI elements that are meant to prevent
interaction with the element. This includes Phantoms and
Highlights.

*localOverlayControls - UI elements that are meant to be
interacted with in order to modify the element. This includes
resize handles and drag marker.

*localOverlayMenus - UI elements that should always position
above all other controls. This includes the context menu.

Bug: 50159
Change-Id: Ic69c2ad275389a31c9fbaf47f3665dcdbb7ac2af
Pasted content is annotated

Applying insertionAnnotations to pasted content.

Change-Id: I8f8a240ae8970624c34ae005290acc77cea73180
Merge "Fix bug where the floating toolbar was on top of the save dialog"
Merge "Don't compute the end offset to pass to insertMeta()"
Merge "Close dialogs on escape"
Option widget improvements

Objectives:

* Make options unable to be selected or highlighted when disabled
* Add default styles for selected state
* Fix line-height for option labels
* Use default cursor when field is disabled

Change-Id: I8a535cd6b259b092c2abce27ddb10882cdde6cf5
Close dialogs on escape

Objective:

* Make the escape key close dialogs, like pressing the X button
* Auto-focus the iframe on window open

Bonus:

* Add ESCAPE and SHIFT to ve.Keys and use instead of hardcoding numbers
* Use ve.Keys in some other places too

Bug: 49809
Change-Id: Ibf1fce5e24efcd83d9e1465c3cdaac24ff3fb45d
Move some of MediaSelectWidget into SearchWidget

Objectives:

* Break apart MediaSelectWidget for re-use
* Rename classes to follow search/result naming scheme

Change-Id: I65aab3dc3d41e31af13e2754e77b7dd185ac90f1
Merge "Get rid of mw-figcaption class (Parsoid does not use it anymore)"
Merge "Init surface after toolbar is setup vs. before."
Don't compute the end offset to pass to insertMeta()

Omitting the offset causes insertMeta() to automatically use the
end offset, so we don't need to compute it in two places. The two
computations were also slightly different.

Change-Id: I55543fdd113a6a986899c093733191df948acb2e
Init surface after toolbar is setup vs. before.

This fixes all tools being loaded with proper state on mw integration.

Bug: 50141
Change-Id: I501b1efec2a2eedbf16a191a8be6b96b02290e09
Get rid of mw-figcaption class (Parsoid does not use it anymore)

Change-Id: Id4aed15b7db6a3a42bb75637c3d31b52677a8a4d
Fix logic for populating reference content

Force clearing of mwData.body if setContents is unset, and clear
mwOriginal when cloning.

Change-Id: I3150b5da7b50e14f400602c5842994e242ad182a
Fix bug where the floating toolbar was on top of the save dialog

The save dialog has z-index: 3;, which succeeds in overlaying it on the
toolbar in its normal position, but fails once the toolbar starts
floating, because the floating toolbar has z-index: 100;

In practice this meant that if you were scrolled down and the toolbar
was floating, you could open the save dialog just fine, but you
couldn't close it because its controls were below rather than on top of
the toolbar.

Hacked around this by detecting the floating-ness in the toolbarPosition
handler and setting a class on the toolbar tracker accordingly.
There may be a more elegant way to fix this; an actual UI engineer
should figure that out, not me :)

Bug: 50324
Change-Id: I8c6ab1026705d00baa20f115255d0d7e74ee72bf
Fix getClonedElement

Change-Id: I019d1a5bd753ac5be7bda459ad85354265a55e3d
Merge "Invoke getClonedElement() on each element on copy"
Fix treatment of elements in addAnnotationsToData()

It should skip annotating elements, but doesn't.

Change-Id: I28fa83832748eb76fa9238e52074bb785ab1cf49
Merge "Fix escapeParams in transclusions to not escape other transclusions"
Merge changes I45028ed2,I934888ce

* changes:
  If cursor is obscured by toolbar, on keypress scroll to cursor.
  Don't advance cursor when adding new line at start of node
Invoke getClonedElement() on each element on copy

This ensures that attributes and properties that are supposed to be
stripped on copypaste are actually stripped.

Bug: 49307
Change-Id: I8c90f4a0b33acba6eea3180cc077f8dc440e6e7b
If cursor is obscured by toolbar, on keypress scroll to cursor.

Bug: 48735
Change-Id: I45028ed2f13148332518badd5f4647d4d652884e
Merge "mw.ViewPageTarget: Performance improvements for section edit links"
Fix escapeParams in transclusions to not escape other transclusions

Use a stack counter to work out if we are inside a another template
call.

Bug: 49854
Change-Id: Ic0b97520b1696c3cf292111c7052502d5ccad648
mw.ViewPageTarget: Performance improvements for section edit links

Follows-up I4b9c47fd65a700a:
* Remove unused closingBracketSymbol.
* Moving veSectionEditUri and sectionEditUri inline as it is
  only used once. This will allow it to be easily dereferenced
  (instead of likely staying in memory due to being claimed by
  remaining closures "expand" and "expandSoon" which will
  continue to claim and enjoy access to this scope.
  Also changed it to use the attr() callback so that we
  don't access `$editLink.attr( 'href' )` twice.
* Add various comments explaining this non-obvious approach.
  Though it makes sense (eventually) and more elaborate details
  are in the original commitmsg, that is no excuse for a 100 line
  function without a single comment, especially with all these
  things going on.
* Use "shrink" instead of "contract" (seems more common in
  context of web UI elements and less ambgiuous in English).
* Remove redundant toString in `new mw.Uri( veEditUri )`.
  Aside from redundant, it also had more overhead (serialising
  uri object to string and re-parsing). It revoked its ability
  to make an efficient clone by taking the mw.Uri object as input
  as opposed to having to parse it again. mw.Uri#clone does the
  same internally.
* Avoid variable names like $this, that or self. Using a more
  descriptive name instead.
* Re-use $closingBracket instead of using last() 3 times which
  makes 3 clones of the jQuery object with the same last element
  in it.
* Refactor odd swapping of closingBracket-hide and
  middleBracket-clone-show.
  It now keeps the original opening/edit/closing in tact and adds
  devider/hidden/edit-source/outerClosing at the end.

Change-Id: I5f093f2927b769fed0c6d1a40f99e73f9b653b9a
Localisation updates from http://translatewiki.net.

Change-Id: Iacd23ddc7096a766606a8b76e04ce285b96fc2d8
Don't advance cursor when adding new line at start of node

Bug: 48735
Change-Id: I934888ce727258cf3feb3e28d822e507554da701
Merge "Fix comparison of MW internal links"
Merge "Separate out MW specific converter tests"
Fix comparison of MW internal links

We need to normalise titles so 'user:foo_bar' == 'User:Foo bar', and
we also need to some HTML attribute removal as links from Parsoid
will have href and rel set (again, this should be fixed in by Parsoid
when the do the merging at their end).

Bug: 49985
Change-Id: I5fb5bfc69c344ca4ce4803d7b6116074648a8d7e
Separate out MW specific converter tests

They are only run in the MW test runner, where the MW dependencies
are available. Create a ve.test namespace for storing shared
test runners.

Change-Id: I079cb18b1c73614d25a12c5d6afcf0700469e52e
Merge "ve.ui.ViewRegistry annihilation"
ve.ui.ViewRegistry annihilation

Objectives:
* Associate models with tools, rather than dialogs and inspectors
* Move tool/model association utilities to ve.ui.ToolFactory
* Obliterate the view registry

Notes:

The only special case for leaving modelClasses definitions in place is
for the linkInspector. It uses these for selection expansion.
Because tools can now override the static canEditModel method, we can
dynamically evaluate a model, rather than be restricted to only
comparing classes. This will be useful for disabling editors for models
that are for some reason incomplete or otherwise broken and cannot be
safely edited.

Change-Id: I7adf254990112d90f1f808593a9111afc7a116b5
Followup to 39fdb135f88b: not everyone has a Mac, so check e.ctrlKey too

Bug: 49993
Change-Id: I5245ab19ae16b79d2c562c05b94649a58e04a4fd
Fix overlay for Monobook

Because of the z-indexes of major elements of the mono book
skin, and because the overlay containers are appended to the
body, the overlays can't be positioned between the surface and
the toolbar. Before this fix, the overlays are appearing beneath
the surface. This fix will retain proper positioning of the overlays
between the surface and the toolbar for Vector, and will overlay
everything in Monobook.

Later, we will have the overlay container more tightly integrated
with the surface to avoid this stacking problem.

Change-Id: Ibb1553099cc1e35e6a0928a99b584885508ca5b6
Merge "ve.isInstanceOfAny utility function"
ve.isInstanceOfAny utility function

Convenient way to check if an object is an instance of one or more classes.

This should probably be moved to oo.js.

Change-Id: I2be55d9501cf62fde006281f1cf4813095b39b41
Merge "mw.ViewPageTarget: Don't handle edt tab clicks from special mouse buttons"
mw.ViewPageTarget: Don't handle edt tab clicks from special mouse buttons

Regular mouse button click is normalised to which=1 by jQuery.

Change-Id: I08a711d8251613144ba6b463d4d240aedd98bb2a
Merge "Remove the preference to use the wikitext editor for editing sections"
Merge "Show "edit source" section edit links in addition to VE ones"
Merge "Position toolbar if loading with non-zero scroll offset"
Merge "Localisation updates from http://translatewiki.net."
Remove the preference to use the wikitext editor for editing sections

No longer useful now that I4b9c47fd exposes both ways of section
editing.

Change-Id: I93958413b4b6ad870306d9f06f540cdde47f7499
Localisation updates from http://translatewiki.net.

Change-Id: Idb10326e14f5054366488cc57ef415ece81983ea
Discourage (ab)use of H1s, and relabel them

Re-label the headings in the MWFormatDropdownTool with MW-specific
headings per bug 43334, reduce the size of the dropdown's contents a
little to make the headings less vibrant, and move the H1 option to the
end of the list to further discourage its use.

Note that there are some issues with the underlying structure here and our
ability to split the repos into VE-core and VE-MW will need this to be
refactored.

Bug: 43334
Change-Id: I5a58b4dcebd6ceae0ffcd24f663429f25bdc3db9
(Re-)Add ability to work even if preference is hidden

We want to mark the preference as hidden as we then subsequently remove it.
However, if a preference is hidden and we don't set ignoreHidden=true, then
it will always fail to trigger VisualEditor, which is sad. Consequently, add
this awful hack until deployment of VisualEditor is true for all wikis.

(We may want to refactor this enablement code a bit - it's a tad ugly. I've
added some more spacing just so you can see what's what, but…)

Change-Id: Ia43c9241b53dddb3dcb8b3edfb3b5163e19e18b1
Merge "Expand recursive call protection in ve.ui.Window#close"
Merge "Preserve scroll position after dialog close"
Prevent overlapping link annotations

Use the 'all' mode of SurfaceFragment#getAnnotations to correctly
handle the selections which include linked and non-linked text
in the LinkInspector.

Bug: 50208
Change-Id: I1cab7f3cc4fc9589eced01ad38c59fe5b9622a57
Expand recursive call protection in ve.ui.Window#close

Focussing the view leads to another call of 'close' which
must be protected against.

Bug: 50140
Change-Id: I8c68468a95cddbc7efb222cf3a1f9868b2949285
Position toolbar if loading with non-zero scroll offset

The scroll event doesn't fire if the page is already scrolled
when ve is loaded.

Change-Id: I5b5a2dff2055d9ff1a8b2a2e0016a3fe7aaf22fb
Preserve scroll position after dialog close

Bug: 49977
Change-Id: I8cc12ba7845eebc6199fbcd2d355bf0d5f38264b
Merge "Fix callout position when popup widget has been moved"
Merge "Fix reserialization of mw-data.body.html"
Merge "Set href attribute of newly inserted image to image title"
Merge changes Icbf9ac6c,I1e7a1e67

* changes:
  Prevent visual effect on disabled toolbar buttons
  Remove use of filter property for CSS opacity
Fix reserialization of mw-data.body.html

This bug caused all references containing complex content (e.g. links
or templates) to be dirty-DOMed and reformatted by Parsoid.

ve.dm.MWReferenceNode.js:
* Parse the original body.html and check if it's semantically equal to
  the new value. If so, don't set it.

ve.dm.Converter.js:
* .normalize() the converter output to remove empty text nodes and
  merge adjacent text nodes

ve.dm.example.js:
* Update reused reference test to have body.html absent, not empty
* Add a link to one of the reference tests so this bug is triggered
** The link's attributes are ordered specifically so that toDomElements
   will reorder them, at least in Chrome (may behave differently in
   other browsers)
** This test fails without this fix in place

Change-Id: Idc091a14422fbb117a3d06fc6bb9497768086fc3
Merge "Reposition phantoms on init"
Reposition phantoms on init

When the toolbar animates, the position of the surface changes.
ProtectedNode now listens for the toolbarPosition event and
repositions the phantoms.

I also tried moving the localOverlay to be a sibling of the surface
(instead of child of body), but the same problems persisted.

Bug: 49853

Change-Id: I8ae1c8f66c6083b4ffee7107a78a298126e1064c
Merge "Don't depend on iframe load events"
Merge "Fix z-index of local overlay"
Fix z-index of local overlay

Local overlay z-index is positioning overlay items (phantoms, etc)
above the floated toolbar. The overlay container is a sibling to the
toolbar's parent and is later in the DOM. z-indexing is
unnecessary and has been removed.

Bug: 50096
Change-Id: Ib46f66b1d1bea36d761f793e9966e09db6e675ca
Prevent visual effect on disabled toolbar buttons

Bug: 33113
Change-Id: Icbf9ac6cff5e3f914268fe14d1b430609dedd49e
Remove use of filter property for CSS opacity

Was used for IE8 support, no longer needed.

Change-Id: I1e7a1e676022dd7607c808bd44848cbf22a9e958
Don't depend on iframe load events

It was discovered that nested iframes inside firefox do not fire load
events: http://osdir.com/ml/dev-apps-firefox/2010-03/msg00134.html

Since we no longer care when the iframe is loaded, changing the frame
onLoad method name to load and manually calling it was sufficient.

Bug: 50115

Change-Id: I65c0c404a2a384566701b1c6b1bb978e0b99c90d
Merge "Don't drop annotated comments in wrappers"
Merge "Revert "ve.dm.Transaction: Implement newFromDocumentInsertion""
Set href attribute of newly inserted image to image title

I'm not sure if that's the long term solution, however for now it fixes bug 49844 and bug 49848.

Change-Id: I75dbbfdd248a6f5696252ef3a2d7ca6ede0fa156
Revert "ve.dm.Transaction: Implement newFromDocumentInsertion"

Broke reference insertion because it removed
newFromNodeReplacement(), which is still in use.

This reverts commit 1765e39b40ea1af68c90924a8866bf6f624a7361

Change-Id: I043997715474ad4850329ff903eb7a8c61c8b453
Merge "Localisation updates from http://translatewiki.net."
Localisation updates from http://translatewiki.net.

Change-Id: Ief601e0ee402b3cedbb654f06434217f24e6c1a5
Don't drop annotated comments in wrappers

HTML like <td><span>Foo<!--bar--></span></td> would lose the comment
when converting to linmod, and so we'd drop the comment when converting
back to HTML.

This happened because we were queueing up meta items to possibly move
them and their whitespace out of the wrapper paragraph even if we were
inside of an annotation and there was no way we could move things out
at all. The fix is simply to detect these case and not queue up meta
items in that case.

[12:11]	marktraceur	Let the comments hit the floor, let the comments hit the floor
[12:11]	marktraceur	(to the tune of the Drowning Pool "Let the Bodies Hit the Floor")

Bug: 50071
Change-Id: I5a844e2e0655bc1db152b3805718324ca0bb04df
Fix callout position when popup widget has been moved

We calculate an overlap offset for when the popup widget has been moved
to avoid going out of the viewport, but that offset is only applied to the
body and not the callout.

Change-Id: Ib9d08d60ccfa6562378640c526faf1e8363abbba
Only use HTML attributes when comparing annotations for serialisation

The UI still needs a simplified version of annotation comparison
so it can clear/set annotations, whereas for serailisation we need
to compare selected HTML attributes (and once Parsoid is fixed,
compare all attributes).

Change-Id: I1a5521a3f51ea373a21cfbc9a007a2381c12f4fe
Proper handling for block level frameless images

Change-Id: Idd438dd256e1877ee7c18b8286a2c32fe2326f23
Do not add empty <figcaption> to <figure> tag

Change-Id: I7527f88e05318bfa6f0dbd5663294e7f0dd31a3e
Merge "Don't set rel="mw:thumb" on the <a> inside a block image"
Merge "Use this.$$ for $relocatableMarker"
Don't set rel="mw:thumb" on the <a> inside a block image

Causes DOM diffs

Change-Id: I54bd90cfcbdff4baa06f67cbeb2865dca357be19
Merge "(bug 50113) Do not display captions for block images which are neither frame nor thumb"
Merge "Preserve the class attribute for block images"
Merge "Preserve the <a> inside of a reference <span>"
Preserve the <a> inside of a reference <span>

This was a big gaping DOM diff that's been in there since the beginning,
but which we only found today.

Change-Id: Ie4e791b212ddd3210bc1d5c11308452bb57ae3ce
(bug 50113) Do not display captions for block images which are neither frame nor thumb

There is still a problem that those images would get inspector for opening media edit dialog
displayed, and that dialog let's edit caption, which does not make sense in this case, however
that should be a separated bug.

Change-Id: I24491979bc7a27d2380924e48cb677b01e9f8f9b
Merge "Don't put slugs after internal nodes."
Don't put slugs after internal nodes.

Bug: 50132
Change-Id: I3818ebe9816e7d781233f087b15694bf7ba12965
Merge "Clean up static stuff in dm.GeneratedContentNode"
Clean up static stuff in dm.GeneratedContentNode

Remove enableAboutGrouping from GCNode and move it to the subclasses
so we can have GCNodes without grouping.

Having matchTagNames there doesn't make sense now that GCNode is a
mixin rather than a base class.

Also removed unused .static.generatedContent property.

Change-Id: I2b5350e70b7829cf009c752d066919e5a3593db0
Merge "Place cursor at start of paragraph, not heading, when section-editing"
Merge "Scroll to correct offset after using a section edit link"
Place cursor at start of paragraph, not heading, when section-editing

Also checks for subheadings, i.e. we keep moving forward one sibling
as long as the next sibling is a heading of higher order than the
previous one. If the heading is of the same or lower order then we
assume there is an empty section, so we just stop.

Bug: 49563
Change-Id: I6fcc463aeeae40278f5caf04ae251c8ecfe65472
Setup section edit links again after page save

Bug: 49620
Change-Id: Idf938c0dc8535c30ce63a05d56abeee210a67380
Localisation updates from http://translatewiki.net.

Change-Id: I09ab01a8a27702ad56f7e26938f4dd8fa7519bd5
Preserve the class attribute for block images

Build the new set of classes as an array (avoiding the leading space),
and only set it if it differs from what was there before. This avoids
reordering the class attribute.

Change-Id: I863ec8de2e7637f76690c4e0b7db5e153fb7e408
Scroll to correct offset after using a section edit link

Needs to wait 200ms so it account for toolbar height.

Bug: 49563
Change-Id: I3a57e64f54289a3263814b4fbfe00c63de4a490b
Use this.$$ for $relocatableMarker

Change-Id: I39d4b8bc4f7c88068ad7e290130389f6c532743d
Code style fix: (X) -> ( X )

Change-Id: I7f3ac95621f70d9a89e70e9a51905673240cb51f
Merge "Implement triple click functionality"
Merge "Store original DOM elements of transclusions"
Store original DOM elements of transclusions

Prevents changing of DOM attributes on unmodified transclusions
as they can clash in the store.

Also use 'original' over 'orig' consistently.

Bug: 50079
Change-Id: Ib13bb206c49b1f5b186e40632a5c109def0f042e
Merge "ve.dm.Transaction: Implement newFromDocumentInsertion"
Implement triple click functionality

On detecting a triple click the nearest non-content node
is selected.

Bug: 38011
Change-Id: Ic80d24581535766714d80104222924f7a0d20f1a
Merge "Clean up inconsistent variables in ReferenceNode/TransclusionNode"
Clean up inconsistent variables in ReferenceNode/TransclusionNode

Made them match the local variable names in MWRefereneListNode.

Change-Id: Id314779323c3a7347cfcd6f40b0e2b63e4d9b0c5
Fix empty inspector popout bug in Firefox

Due to some sort of mysterious race condition (probably deferred reflow)
calling this.$menu.show() set style="" rather than style="display:block;"
because Firefox believed the parent was still hidden.

Work around this by removing display:none; from the context's CSS rules.
We don't need it because we always manually .hide() these things anyway.

Bug: 50073
Change-Id: I29e210aba9a6265d8364ff8ae49408cb4c2428b9
Merge "Pass full data (including meta) to converter in references"
Merge "Preserve data-mw verbatim if unchanged"
Pass full data (including meta) to converter in references

Previously we were just passing a slice of the visible data, instead
of using getFullData.

Bug: 50059
Change-Id: I3bbea49132ef4a720a147ba9b170c39a0c00f711
Preserve data-mw verbatim if unchanged

Previously we would reserialize the JSON blob in data-mw even if we
didn't change it, which potentially reordered keys and caused a DOM
diff.

Bug: 50066
Change-Id: If0a5bcc67d3a172de0e8839cfda11efacfbf36ff
Merge "mw.ViewPageTarget: Blacklist IE9/IE10 until blocking issues are resolved"
Merge "Allow metadata to be annotated"
Merge "ve.dm.MWTemplateSpecModel: Expand parameter aliases"
mw.ViewPageTarget: Clear slide history when closing the save dialog

Bug: 49481
Change-Id: I297a7d1458e5a1c33b9dcb85272fe5f40893dd88
ve.dm.MWTemplateSpecModel: Expand parameter aliases

We were previously ignoring this data leading to situations
where a template that can be invoked like {{foo|1=bar}} and
{{foo|thing=bar}} (where the template data documents param
thing with alias '1') will show up in the editor with no
parameter information or label for the 1= call, but will show
up for the thing= call.

Now they are properly aliases so both will appear the same
in the editor dialog.

Bug: 49838
Change-Id: I37ec0e152df905844ac58ed1834fca29dccb4eec
mw.ViewPageTarget: Blacklist IE9/IE10 until blocking issues are resolved

Bug: 49187
Change-Id: I2ee2e33c89cac58863c9911fc3ad250c72a46206
Merge "Remove unused mw.notify msg keys from ext.visualEditor.core module"
Localisation updates from http://translatewiki.net.

Change-Id: Id326581d28c047d89b520c166774eeb001a76911
Allow metadata to be annotated

To prevent dirty diffs when inline metadata appears inside annotations.

Bug: 50060
Change-Id: I40da3d5e8e987571195142304b1a853e177e36ff
Remove unused mw.notify msg keys from ext.visualEditor.core module

These 3 mw-notify message keys:
* visualeditor-notification-saved
* visualeditor-notification-created
* visualeditor-notification-restored

Are only used by ve.init.mw.ViewPageTarget.js, which is part
of ext.visualEditor.viewPageTarget, not ext.visualEditor.core.

Change-Id: Ib094c0a2934856b90349a9f8890a20feebf0837c
Merge "Restore selection after dialog close"
Merge "Resize focus highlights on generated content update"
Move references out of experimental

Bug: 39599
Change-Id: I1551ddaa3d52c4827c7dcac2a02e31859769890a
Merge "Create ref list insertion tool"
Create ref list insertion tool

Fixes (follows-up I1b48ef5240, I6daff5c596):
* Invalid html passed to jQuery constructor.
* Use prop() instead of attr() for boolean values.
* Use append() instead of html() when appending nodes instead
  of parsing html.
* Rename shadowed variable name clash 'mw' to 'mwData'.
* Fix odd construction where we parse '{}' to create an empty
  object.
* Have ve.ce.MWReferenceListNode#update perform changes off-document
  in a detached tree.
* Fix deep property access that can fail. mwData is set to
  either JSON parse of data-mw attr or empty object.
  Accessing mwData.attrs.group needs to be guarded by whether
  mw.attrs is indeed set.
* Have `mw` and `about` attribtue in references list roundtrip
  (especially mw which can data we aren't editing/re-creating).
* Add missing 'refGroup' property to MWReferenceListNode's
  data element (similar to what MWReferenceNode already has).

Change-Id: I67e4f378ccd04e97361d8e58ae57db5353075756
Merge "ve.ce.BranchNode: Use DOM rather than jQuery in #onSplice"
Merge "Use DOM methods rather than jQuery in setupSlugs()"
Merge "getRenderedContents() optimizations"
ve.ce.BranchNode: Use DOM rather than jQuery in #onSplice

Change-Id: I75337048e9ae81c95333da5c0277dbf7dc562b1c
Use DOM methods rather than jQuery in setupSlugs()

Also use .importNode() rather than .cloneNode() so the slugs are
created in the right document.

Change-Id: Ia0b6ee5f4e4ef0fbcc9a3fe16f20587da027ae2e
getRenderedContents() optimizations

* Use plain text rather than HTML in TextNode
** Bypasses HTML parsing, and doesn't cause regeneration of nodes like
   appending to .innerHTML does
** We were only using HTML so we could use entities, so replace those
   with \uNNNN sequences
* Use native DOM functionality rather than jQuery
* Inline flushBuffer()

Change-Id: I7c6376b55cc0f1420a01a77b365b073fe1636263
Localisation updates from http://translatewiki.net.

Change-Id: I0fba494fc41c9334aa98354325be16f1c8f83b2a
ve.dm.example: Use jQuery#toArray instead of jQuery#get

Better for performance (lower level, #get calls #toArray when
called without arguments) and more semantically correct.

Change-Id: I8e615674e51fd148367fd397bd169fa203a240ad
Restore selection after dialog close

Change-Id: I534e38633700191782a7b088de0ae46a5f800fa8
Resize focus highlights on generated content update

Create a new rerender event. Also added a check to see
if the node is actually focused.

Change-Id: I9f74e82f72a9ddfd1e4a9ab7d1c0c8289b6525e8
Merge "RelocatableNode for Inline and Block Images"
RelocatableNode for Inline and Block Images

HTML5's drag and drop has a ton of benefits and a couple of
limitations. To achieve a native drag marker, an image tag helper
is used to indicate the size of the relocatable node. Chrome
shades the marker gray natively, Firefox is styled to match.

Change-Id: I755b698a3d968cc7e6ff125109d68ac83fd8a8a2
Merge "mw.ViewPageTarget: Use native .focus() rather than jQuery's .focus()"
Merge "Don't build the CE tree and DOM for the internal list"
mw.ViewPageTarget: Use native .focus() rather than jQuery's .focus()

jQuery's implementation does some sort of traversal, so on large pages
it took 300-400ms just to focus the document node.

Change-Id: I0de95d8800a1aedeb19b27d204dfd8fd08cec533
Don't build the CE tree and DOM for the internal list

This is a waste of time, because we hide it anyway. This took
quite a bit of time for long articles.

Change-Id: I1bcfd5b908c89dc2e08d5520e8870b145177ca10
Merge "Match data inserted from MWMediaInsertDialog with MWBlockImageNode"
Merge changes If3d01346,I4e5317f1

* changes:
  Fix incorrectly written CSS that was affecting all table cells on the page instead of cells in mwMetaDialog only
  Fix for rendering block images
Merge changes I379bc2b3,I99acbd16

* changes:
  Straighten out variances in parent method invocation
  ve.ui.MWReferenceDialog: Clean up
Localisation updates from http://translatewiki.net.

Change-Id: I0c54d3b8390cc9881006625270f906b511fd0c0a
Merge "Fix logic in link input widget"
Merge "Remove format tools from mw reference dialog"
Merge "Delete default sort key if set to empty string"
Merge "Fix splitClusters usage in ve.ce.Surface#onContentChange"
Merge "Allow UI context to update when selection is from 0"
Match data inserted from MWMediaInsertDialog with MWBlockImageNode

Change-Id: I145beba19a8f69f6fd8c29302350c399b4c51c55
Fix incorrectly written CSS that was affecting all table cells on the page instead of cells in mwMetaDialog only

Change-Id: If3d01346d7267aec444d573ac83516083a3689bc
Straighten out variances in parent method invocation

Follows-up I99acbd1699:
* "Parent method" comment
* Remove redundant slice() call to convert arguments to array,
  native JavaScript methods that take array-like arguments such
  as Function#apply and Array#slice are both compatible with
  the Arguments objects, no need to convert it. Most invocations
  already did this right but a few were recently introduced again.
* Removed silly "Document dialog." descriptions.
* Removed a few redundant "@method" tags in the near vicinity
  of code I changed.
* Fixed function invocation to be either on one line or
  one parameter per line. Having all arguments on one line
  but the name + "(" looks confusing as it suggest there
  is only 1 parameter. Same as object literals:
  so:
  { foo: 1, bar }
  or:
  {
    foo: 1,
    bar: 2,
  }
  not:
  {
    foo: 1, bar: 2
  }

Change-Id: I379bc2b32603bcf90aba9b4cd0112e7f027d070e
Fix for rendering block images

Change-Id: I4e5317f128f2b3f6742e7ed280c96fde37f52bb4
Merge "Change nested annotation test to test recursiveness"
Change nested annotation test to test recursiveness

Change-Id: I16f39bd0f6e2b6719ff26f69a561145bb4ca0c2b
ve.ui.MWReferenceDialog: Clean up

* Optimise initialisation by building the tree from the bottom up
  and applying the class last.
* Actually document the dialog. Documenting it as "Document dialog"
  is useless and confusing. If there is no documentation yet, leave it
  empty so it is included in jsduck's optional "no_doc" warning list.
* Remove the redundant "Call" prefix in the parent method description,
  we don't do this else where either.

Change-Id: I99acbd1699b2c99a2c9b58f34dc1e07bea58203d
Merge "Handle nested empty annotations"
Merge "mw.ViewPageTarget: Move non-annotation buttons to a new tool group"
Merge "Workaround for adjacent annotations bug"
Merge "There is no need to apply CSS changes (width and height) to an image inside ve.ce.MWBlockImageNode because it is already handled in ve.ce.ResizableNode"
There is no need to apply CSS changes (width and height) to an image inside ve.ce.MWBlockImageNode because it is already handled in ve.ce.ResizableNode

Change-Id: I416008688b967cbbbe3e585abb3be9924ca47dc6
Add reference icon

Objectives:

* Introduce new icon for a reference
* Repurpose existing reference icon for references block

Change-Id: I1bfcdbeda3b9730d62d6b264ef72921e93623f7e
Handle nested empty annotations

At the moment we create an alien meta item if an annotation
wraps contents of zero length, however we also need to handle
nested empty annotations, i.e. where the contents is other
empty annotations (i.e. alien meta items).

As alien meta items simply preserve DOM elements we don't
mind what type of alien meta items they are, so this also fixes
the case of an annotation wrapping another alien meta
e.g. a comment or <meta> tag.

Bug: 48605

Change-Id: I98d88b341efcd6384ee1fda5d6d7e1e1acb107aa
Merge "ve.dm.MWTransclusionModel: Don't create undefined normalisation target"
Fix logic in link input widget

Previously pageExists thought matchingPages was an indexed object when
in fact it was an array. This didn't manifest as a bug as we subsequently
check the normalised URL in the correct manner (using indexOf), but it
did remove the optimisation of not running mw.Title if there was an exact match.

Change-Id: Ic616cbfa0d7ed5447e032dd1f772779db2dc19e5
Remove format tools from mw reference dialog

Because you can't put a heading in a reference.

Bug: 49715
Change-Id: Ic823a90398dafca1caf8fa4142d98133ab661d7c
Workaround for adjacent annotations bug

Until this is fixed by Parsoid, this is a dirty hack that compares
HTML attributes on annotations, excluding data-parsoid. Obviously
we shouldn't have any parsoid specific code so this should be removed
as soon as it is fixed properly.

Bug: 48194
Change-Id: Ibb18b4f653c664e8ab7876498dc8395d878f7aaa
Delete default sort key if set to empty string

Bug: 49724
Change-Id: Ie3caaf4811f87911444462f83d511c0cc46c0716
mw.ViewPageTarget: Move non-annotation buttons to a new tool group

Change-Id: I04784357d3590c43af90c60da4b5a67bbf10ac70
doc: Clean up documentation related to ES5 in ve.js

Also removed redundant ve#filterArray.

Change-Id: I80a2e7fdfdb8f26510196995044124afeda4e682
Fix splitClusters usage in ve.ce.Surface#onContentChange

Was previously doing the text slicing before the cluster split
using substring, instead of after using splice.

Bug: 49233
Change-Id: If9c0860e2fe7b01eb0b27aae67c671062799a0fa
Merge "mw.ViewPageTarget: Move save dialog out of toolbar tree"
Update initialisation scripts for demo, test

Apparently we should be keeping these up-to-date by
running makeStaticLoader :-)

Change-Id: I06f5cdad64b67bb10b6c6a470c818fc9c688560f
ve.dm.MWTransclusionModel: Don't create undefined normalisation target

The API gives us normalisation information about all titles,
including titles of which it couldn't provide any template data.

Spec storage should only have properties with valid values
(has property means to have a valid value, like database). The
absence of this check was causing it to turn this:

{
  pages: {
    'Template:Unsigned': { params: { .. } }
  },
  normalised: [
    { from: 'foo bar', to: 'Foo_bar' },
    { from: 'template: unsigned', to: 'Template:Unsigned' }
  ]
}

into:

{
  pages: {
    'foo bar': undefined
  },
  normalised: [
    { from: 'foo bar', to: 'Foo_bar' }
  ]
}

Bug: 49493
Change-Id: I0b661744d0388345561897c9631f15e691737031
mw.ViewPageTarget: Move save dialog out of toolbar tree

Bug: 49275
Bug: 49361
Change-Id: I2fbc4c8af943f1b096b8912191924961405d5c47
Localisation updates from http://translatewiki.net.

Change-Id: Iadc784cacdaadf18f7d2cc7d2c2fcf147b98cfa0
Allow UI context to update when selection is from 0

Previous condition was put in as part of I9ed6f9fb as a
temporary fix for bug 42842. However this code was causing
the popup widget to not appear for items at the start of
the document. It appears the bug it was put in to fix
has since been fixed elsewhere.

Bug: 49421
Change-Id: I8bcdea0f7a6951216bf8368865d23ef6246880ea
Delete/don't insert transclusion if object is empty

The transclusion dialog lets you completely delete all templates
within it. If this happens we should delete the node completely, or
not insert it if it's a new instance.

Bug: 49831
Change-Id: Ic5d4fbf73f3d1be9cf877bc8b98096de9e98991a
Merge "Match MediaWiki's rendering of non-thumb/-frame block images"
Match MediaWiki's rendering of non-thumb/-frame block images

Change-Id: I43ad72ef2d6b650692e1a0fd4460e4dec70fde7f
Merge "ve.ui.PanelLayout: Set default to span accross available space"
ve.dm.Transaction: Implement newFromDocumentInsertion

This function builds a transaction that takes a document slice and
inserts it back into the document it came from, applying any changes
that were made.

This makes editing document slices simple:
    slicedDoc = doc.getDocumentSlice( captionNode );
    // Edit slicedDoc using a surface
    tx = ve.dm.Transaction.newFromDocumentInsertion( doc, captionNode, slicedDoc );
    surface.change( tx );

Specifically, newFromDocumentInsertion replaces the node's contents
with the document's contents (meaning any changes made to the node in
the meantime are lost). It also merges the stores internal lists
of the two documents and remaps indexes accordingly. This means editing
of references inside of references is supported.

This functionality is not specific to slices, and can also be used to
safely insert data from a paste buffer, with internal list data being
transplanted correctly.

ve.dm.MetaLinearData:
* Make merge( [ undefined, undefined, ... ] ) return undefined rather
  than [].

ve.dm.Document:
* In getDocumentSlice, store a pointer to the original dm.Document in
  the new one, and also store the length of the internal list. This
  allows us to figure out which internal list items the two documents
  have in common when we insert the modified slice back into the main
  document.
* In getMetadataReplace, optionally take the inserted metadata as a
  parameter, to allow for operations that insert both data and metadata.
  Per Ed's review, rewrite this function to return null rather than {}
  if no metadata needs to be replaced.

ve.dm.InternalList:
* Add method to merge two internal lists

ve.dm.Transaction:
* Remove newFromNodeReplacement and replace it with newFromDocumentInsertion.
* In pushReplace, optionally take the inserted metadata as a parameter.

Change-Id: I786ee7bad796aa54bc242993b4de3ad18ad0773e
Merge "Always float toolbar to top of page, not last branch node"
ve.ui.PanelLayout: Set default to span accross available space

Without these properties set, the layout is collapsed into a 0x0px square due to the
parent having overflow-x: auto; and no width/height set.

Change-Id: I77aef8afa3327b11f453196badcdfad3f51f7c3d
Merge "Add resource attribute to newly created images"
Merge "(bug 49837) Handle correctly figure tags with typeof="mw:Image""
(bug 49837) Handle correctly figure tags with typeof="mw:Image"

Change-Id: I6bc74973671e7046130278b9658bb8f6f62904a1
Add resource attribute to newly created images

Bug: 49596
Change-Id: Ifbde0f5a4c8eb01df7b429abbb8ab0d4431c1c6f
Localisation updates from http://translatewiki.net.

Change-Id: Ibdb1d5a893254ac66f0d940023b78a0e6dfe326c
Merge "One method onAttributeChange in ve.ce.MWBlockImageNode is plenty"
Merge "Fix inconsistencies and errors with Dialog onOpen/Close"
Always float toolbar to top of page, not last branch node

The check for the toolbar not overlapping the last branch node
'fixes' an edge case where the user has scrolled too far, and
the viewport is shorter than the last branch. A more common
problem caused by this is that if the last branch is very tall
the toolbar disappears whenever you scroll past it.

Bug: 48662
Change-Id: I1c7662f2b6f1ced6f80dec16c6ed69a8cc0c06c8
Merge "Ignore shortcut keys inside key press handler"
Fix inconsistencies and errors with Dialog onOpen/Close

Removed inherited (and often wrong) documentation, replaced direct
usage of onApplyButtonClick with more standard onClose handling,
and one case of calling the wrong parent method.

Change-Id: I86ed16860e996b42c141a6499eefb9084d759a72
Ignore shortcut keys inside key press handler

Bug: 49732
Bug: 49760
Bug: 49816
Change-Id: I8f814a0f369c470038896041f157b3dbd0d7f1a7
Merge "Media content message should be in general, not experimental, code"
Media content message should be in general, not experimental, code

Change-Id: I41f61eb9dd9dccee8bb0be3e12736b5f713dca45
One method onAttributeChange in ve.ce.MWBlockImageNode is plenty

Change-Id: Ibcf93047c93e411c6c7167720e5d92a311d647f1
Merge "Transclusion editor template naming goodness"
Transclusion editor template naming goodness

"Template" parts should be labeled with a normalized version of what you would actually write inside a set of curly brackets.

Change-Id: I4b9c541a01da86cb078d38012e5a9fead2fa233c
Merge "Make media insertion queries less horrible"
Make media insertion queries less horrible

Objectives:

* Clear this.titles when resetting, otherwise results are shown once and
  then blacklisted forever.
* Attach done() before always(), so done() gets called first and not
  after always() has dereferenced the request object.
* Remove use of imaginary variables like this.loading, which were never
  set, and were referencing even more imaginary methods on other imaginary
  objects like this.request.abort()...

Change-Id: Ifbe74346f68b6a91f425b56a2696fd1e46b61e02
Support for editing captions of block images

Bug: 38129
Change-Id: I02207e78f5c28eaccd9bc97a48baa78280192255
Merge "Added ve.ce.FocusableNode mixin to ve.ce.MWReferenceListNode"
Move transclusion editing from experimental to core

Change-Id: Ibd0915e367d105170e6b88e3b46c2d54659ce962
Merge "Add templates from toolbar"
Merge "Fix transclusion button message"
Add templates from toolbar

Change-Id: I0aa21bed13d1dbc693c1db03eab903af55a1517a
Merge "Handle media select widget empty queries properly"
Fix transclusion button message

Change-Id: I90cdb600ffb6e7d80cf6042b50ef0bf8a22c6cbd
Handle media select widget empty queries properly

If the query is cleared, we should still clear all items and abort any
loading that may be going on. We should still not try and load results
for an empty query though.

Change-Id: If23c6e0469247b1c1c47ab85b9a5a010e8a4fe26
Improve template title normalization logic

Only remove the namespace prefix if it's in the template namespace,
and prepend a colon for main namespace titles.

Change-Id: Ie910bae172274e36c7c9a675a631a0876ff13ed1
Don't show Template: in the outline for template items

1. It's redundant and ugly.
2. We already have an icon.
3. It's unnatural for anyone used to working with templates.

Change-Id: I821e124158a14679e411324620dc9d7c40252383
Template and content adding

Objectives:

* Allow adding content or templates within a transclusion
* Add template placeholder to model and view which resolves to nothing
  when saving (thus disappearing if not resolved)

Changes:

*.php
* Add links to new messages and files

ve.ui.OutlineControlsWidget.js
* Organize controls into "adders" and "movers"

ve.ui.Widget.css
* Add styles for adders/movers sections of outline controls
* Make adders appear on hover to reduce clutter

ve.ui.Icons-*.css
* Add icon for "add item"

ve.ui.Dialog.css
* Add styles for add template fieldsets
* Make placeholder items in the outline italic

ve.ui.PagedDialog.js
* Pass adders config to outline controls

ve.ui.MWTransclusionDialog.js
* Add support for adding content and templates

ve.dm.MWTransclusionModel.js
* Add addPlaceholder method

ve.dm.MWTemplatePlaceholderModel.js
* New class, pretty much an empty part
* Using this makes the UI much easier to work with - no need to special
  case the outline control for new items
* Because it's not supported specifically in
  ve.dm.MWTransclusionModel.getPlainObject, it produces nothing and goes
  away naturally on apply

Change-Id: I3478560fb53ba2ccd3fb26bafb6a61e6415565eb
Fix copyDomElement issues

* Fix bug in MWTransclusionNode sometimes passing a NodeList rather
  than an array (caused an error because NodeLists can't be .map()ped)
* Use copyDomElements in ce.AlienNode as well

Change-Id: I11c6483d3c062047be80f75a3fac03f13bff9662
Merge "Copy DOM elements properly, into the correct document"
Copy DOM elements properly, into the correct document

* Provide a utility for copying an array of DOM elements into a
  different document
* Copy the DOM elements returned in toDomElements(), otherwise weird
  issues arise when the same data is converted to DOM twice

Change-Id: Ie927420624f0d4af0692e18d1bc6f952c8013d61
Make MWTransclusionModel#addTemplate take target object instead string

Change-Id: I6067e9de7d6029c36938b2758dffe4afdb0bf2ad
MWTransclusionModel: Make #getPartById support a param model id

Change-Id: Ia2829ef2c24f63ce46e05790aa089fca563bc563
Whitespace cleanup

Change-Id: I49417b95a6c4c2538715e09b74ed3607f6741c3a
dialog: Remove background color body

This was causing strange rendering problems, and it's really not even
needed.

Change-Id: I130e9e5c5f2c5ab99b5245de6c0243e9be9cf558
Merge "ve.ui.IconButtonWidget: Extend css transition from 100ms to 200ms"
Merge "ve.ui.LookupInputWidget: Hide lookup input widget menu when empty"
ve.ui.IconButtonWidget: Extend css transition from 100ms to 200ms

Makes make it look nicer.

Change-Id: Ib7c1021a31f607b6e697f16fe797358c0167acee
ve.ui.LookupInputWidget: Hide lookup input widget menu when empty

Change-Id: Iac397c2ddcb7ea54c751485bdd922f7b19494d1e
mw.ViewPageTarget: Use ES5 methods instead of strict mode as test

In aaa5ad2 we introduced a feature test. However though we do require
ES5, we don't (yet) use strict mode. It is an easy and solid one to
feature test, but it the unfortunate reality is that IE9 does not fully
support ES5. Strict mode is among the features it didn't (correctly)
implement. As a result commit aaa5ad2 locked out IE9 completely.

Replacing it with a more explicit (and harder to maintain) test that
does pass in IE9. We now need to be very careful about using ES5
features in our code. It has to be in this list here to avoid breaking
in a browser that doesn't support it.

Change-Id: I77b623e15a0791bfaa2cd835e43107cefb3c25f5
Merge "Move notification messages to correct module"
Merge "Use the latest revision's timestamp for basetimestamp"
Localisation updates from http://translatewiki.net.

Change-Id: I9d1c9d12981d693909a4413018aefa3ae7c90903
Merge "Only undo on MWMetaDialog close if small stack is non-empty"
Merge "doc: Tag ve.ui.Window static properties as inheritable"
Move notification messages to correct module

They're called from ViewPageTarget, so that's where they should be
registered.

Change-Id: I294aad1b43021bdadae24319b99f93cd960fe908
Use the latest revision's timestamp for basetimestamp

Bug: 49390
Change-Id: Icacaa5101386e52309278c8d9871ca1193aa86a9
Element fixes

Objectives:

* Make get$$ work with empty jQuery selections
* Reset the $items selection when clearing a group

Changes:

ve.Element.js
* Add existing context property to possible solutions

ve.GroupElement.js
* Reset this.$items after detaching them

Change-Id: I73b46649d7ecd5045941086c4e1bb3241c8f4ef3
Merge "Store originalIndex instead of mwOriginal in Transclusions"
doc: Tag ve.ui.Window static properties as inheritable

Also updated outdated reference to dialog in demo.

Change-Id: I6c9997d4b4059348b400f592d6ae95cd9f43996c
Merge "Correctly distinguish between Deferred and Promise"
Correctly distinguish between Deferred and Promise

Deferred is read-write, Promise is read-only. Document and return
the correct types.

Change-Id: Icfd6efb07b222c73d49b97ddbfe6565b8542ad00
Only undo on MWMetaDialog close if small stack is non-empty

Added return boolean to ve.dm.Surface#breakpoint to indicate if
and transactions were pushed to the big stack. Use this value in
MWMetaDialog to see if we need to undo on close.

Added tests for ve.dm.Surface#breakpoint.

Bug: 49630
Change-Id: Ieb2e9e361afe057af93c4d374acc85df58bfb4c3
Store originalIndex instead of mwOriginal in Transclusions

Slightly more efficient way of seeing if the template has changed,
and results in a cleaner set of data element attributes.

Change-Id: I1507520005bfb8a88bfa6038dac5c3b15506425d
Merge "Actually normalize page titles correctly in MWLinkTargetInputWidget"
Actually normalize page titles correctly in MWLinkTargetInputWidget

matchingPages contains titles with spaces, but .toString() returns titles
with underscores, so normalizing with .toString() is incorrect. Use
.getPrefixedText() instead.

This caused a bug in the link dialog where, if the link was an internal
link pointing to an existing page with a space in its name, the "New page"
section would be displayed but would be empty, and the link's target would
be displayed in the "Existing page" section but colored red.

Change-Id: I59d8b87b996d80da1b25124b942bd2b72ef50845
Fix fatal error on user registration due to hook fail

Hooks need to return true if they succeed. Fatal errors in production.

Change-Id: Ie5ec5881a8d158bd675dbb6db4540f02fd33290d
Merge "Address Krinkle's review comments from I51c441d61"
Address Krinkle's review comments from I51c441d61

See <https://gerrit.wikimedia.org/r/#/c/69161/1/modules/ve/init/mw/ve.init.mw.splitTest.js>.

Change-Id: I14442070c0998d724d67ec41cca813ef5bce2c19
Test case for 95733390dc87894fe85b3479a9268fe2d797b26e

Change-Id: I8c2e239e945466f3e46c92efab03f7e615bc6887
Use indexes in .children, not .childNodes, for attribute preservation

The difference is that .children excludes non-element nodes (text nodes
and comment nodes). These can't have attributes anyway, so there's
nothing lost by skipping them, and this way we avoid bugs where a
text node split causes the indexes to be off.

(Text node splits are probably due to an interaction between whitespace
preservation and paragraph unwrapping, and aren't necessarily bad. We
just shouldn't rely on indexes into .childNodes)

Change-Id: I905a50e1c299ebafcbd4eaa0f938b06a1b5849ff
Merge "Split test: instrument edit events for standard editor interface"
Localisation updates from http://translatewiki.net.

Change-Id: I2fdd442caa83b2bce4af36980f76623dff39d4a5
Added ve.ce.FocusableNode mixin to ve.ce.MWReferenceListNode

So its selection looks better after a user clicks on it

Change-Id: I4343a67d7b488c42e40270d25b9b4104a07872fb
Split test: instrument edit events for standard editor interface

This change adds 'page-edit-impression', 'page-save-(attempt/success)',
and '(section-)edit-link-click' events to the standard (non-VE) editor
interface, mirroring the events we added to VE. This makes the event data
usable for split-test analysis.

Change-Id: I51c441d61daa18d58ca7f62a9e5f07902a099050
Fix selectNodes() bug with empty non-content branch nodes

These kinds of empty nodes shouldn't occur since the converter fills
them with empty paragraphs, but selectNodes() should still behave
correctly for them.

Change-Id: Ia37f3db1c2a84b842e2311cf70642fa66af04d91
Refactor selectNodes tests

* Move them from ve.example.js to ve.dm.example.js
** Also move lookupNode() and createDomElement() there
** Delete ve.example.js because there's nothing left in it
* Make main example document implicit, but allow override
* Specify nodes as arrays and do the lookup later
* Specify range and mode separately rather than calling selectNodes()
  during construction
* Construct statically rather than in a function
* Use expect( cases.length );

Change-Id: I620e949c5e612b32eaa57c5d9b60cc91f9ddbf02
Merge "grunt: Also delete QUnit temp files when test fails"
grunt: Also delete QUnit temp files when test fails

Move post-qunit task to qunit.done event which fires both on
success and failure.

Define pre-qunit + qunit as a group test 'unit', so they can
be run from the command line (previously 'grunt qunit' would
fail) as 'grunt unit'.

Also add override comment to css file using non-standard
property so csslint passes again (follows-up b2fbe35).

Bug: 49431
Change-Id: I5079d00a63d43276a12dd78c306bb3819470631d
Merge "Fix logical conflicts from the transclusion merge."
Merge "Add ability to run a 50% split user test with VisualEditor as default"
Merge "Code style fix: @return -> @returns"
Merge "Build the internalList linmod even if it's empty"
Build the internalList linmod even if it's empty

Otherwise fun exceptions occur when you have a <references /> tag
with no <ref>s, for instance.

Also disregard the internalList in the data->DOM conversion, to prevent
a nasty interaction where the whitespace information on the last element
is considered invalid because it doesn't match the internalList's.

Plus test updates from hell because this touches ve.dm.example.data

Change-Id: I62881d9fc27fa081123856d1b35a6021af469271
Fix grammatical error

Change-Id: Iff809c799199a10f7895e4896c4baadaa189b270
article -> page

Change-Id: I843f1f559bdab9c36797812b39e081ae43c9c9b2
Code style fix: @return -> @returns

Change-Id: I26daca6313bf09055af8f980ba0065782257fd54
Fix logical conflicts from the transclusion merge.

Change-Id: Ic9d708cdba74c908d14839def5050c8825134c56
Merge "Remove handling of old 'editsection' class"
Merge "splitClusters uses Grapheme Cluster Boundary rules"
Localisation updates from http://translatewiki.net.

Change-Id: I3ea2e3765665eacbdbc7a7a19d7bd5df13b0a18a
splitClusters uses Grapheme Cluster Boundary rules

unicodejs.graphemebreak.js
* New file: singleton class with splitClusters method
* On load, builds graphemeBreakRegexp from unicodejs.graphemebreakproperties.js

unicodejs.js
* Remove old splitClusters method (was just a placeholder)
* Change "conjunction" -> "disjunction", for consistency and correctness

unicodejs.textstring.js
* Use new splitClusters method

modules/ve/ve.js
* Use new splitClusters method

unicodejs.wordbreak.text.js
* Add new splitClusters test
* Refactor charRangeArrayRegexp test to use splitClusters

PHP files
* add unicodejs.graphemebreak.js, unicodejs.graphemebreakproperties.js

.docs/categories.json
* add unicodeJS.wordbreak class

Change-Id: I8f512e2fc2c46eb4b5f00994a8dac88f3c8f7dd2
Localisation updates from http://translatewiki.net.

Change-Id: Ice2073e38a0c30259622846b6a6909f07c8ddabc
Remove handling of old 'editsection' class

It's been replaced with 'mw-editsection' and all cached renders on
Wikimedia wikis have expired by now. All backwards-compatibility
occurences have been removed from MediaWiki core already.

Change-Id: Id3731222445b588de8aec0e86892879ac4472636
Add ability to run a 50% split user test with VisualEditor as default

Will only run if $wgVisualEditorEnableSplitTest is set to true. To be removed
once VisualEditor is fully deployed.

Bug: 49604
Change-Id: I5c603ece309d61641d32ccc9eff5ea2890d5b816
Merge "Handle deletion programmatically always"
Handle deletion programmatically always

Change-Id: Ic68f80d92d32169ff60258b81a438e342b136128
Reference name and group editing

Objective:

* Allow editing reference groups and names in the reference dialog

Bonus:

* Modify attribute transaction builder to support multiple attribute
  changes in a single transaction

Changes:

ve.ui.MWReferenceDialog.js
* Load ref name and group from model
* Save ref name and group, if changed, to model

ve.ui.ListAction.js, ve.ui.Transaction.test.js, ve.ce.ResizableNode.js
* Update use of newFromAttributeChange to newFromAttributeChanges

ve.dm.SurfaceFragment.test.js
* Add test for new changeAttributes method

ve.dm.InternalList.js
* Missing new line at end of file

ve.dm.Transaction.js
* Change newFromAttributeChange to accept an list of attribute changes and
  produce a single transaction that applies one or more attribute changes
  at once

ve.dm.SurfaceFragment.js
* Fix bug in getCoveredNodes where the wrong mode name was being used
* Add changeAttributes method, which applies attributes to all covered
  nodes and allows filtering of which types of nodes the attributes are
  applied to

ve.dm.MWReferenceNode.js
* Actually write key and group back to DOM
* Separate onRoot functionality into addToInternalList so it can be called
  separately (similarly onUnroot/removeFromInternalList)

ve.ce.MWReferenceListNode.js
* Clone internal item CE node before appending to avoid rendering bug.

*.php
* Add links to messages and sort them

Change-Id: Ic4121e4fcfc09265d5863af6f078cdeb77926c8e
Merge "Add group field to reference dialog"
Merge "Localisation updates from http://translatewiki.net."
Localisation updates from http://translatewiki.net.

Change-Id: I8b44f6f5172520a84416217fa0df19c10692702a
Merge "Outline controls"
Outline controls

Objectives:

* Allow reordering items in outline widgets using an outline control
  widget
* Use an outline control widget to reorder transclusion parts

Changes:

ve.ui.SelectWidget.js
* Emit add and remove events

ve.ui.OutlineItemWidget.js
* Add movable config options
* Add isMovable method

ve.ui.OutlineControlsWidget.js
* New class
* Displays move up/down buttons which are synchronized with an outline
  widget
* Doesn't actually move items (since an outline widget is probably
  data-driven) just emits events

ve.ui.Widget.css
* Add disabled style for icon button widgets
* Add styles for outline controls widget

ve.ui.Icons*.css
* Add missing icon styles

ve.ui.Dialog.css
* Add styles for outline and controls in editable paged dialogs

ve.ui.GroupElement.js
* Fix bug where items are insertions are in the wrong place when "moving"
  them

ve.ui.PagedDialog.js
* Add editable config option which shows outline controls under the
  outline
* Pass through movable config option when creating pages

ve.ui.MWTranclusionDialog.js
* Configure paged dialog outline as editable
* Add initialize method to connect outline controls widget events
* Make addPart method automatically add parameters when templates are
  added
* Add handler for outline controls move event which re-orders parts
* Make parts movable (params are automatically ordered, so they aren't
  movable)

ve.dm.MWTransclusionModel.js
* Add addPart method and use it within the addContent and addTemplate
  methods
* Fix documentation lies
* Add getPartFromId method

*.php
* Add links to new files and messages

Change-Id: I919d4c3e9b85d07a97a99c0b2e8739a859bdf2b1
Log user ID; 'pageViewSessionId' to alphanum string

By default, EventLogging uses INT columns for integers, which pageViewSessionId
overflows. I changed it to a STRING type in the schema and am now generating it
using 'mw.user.generateRandomSessionId()'. I also introduced a 'userId'
property, per bug 49585.

Bug: 49585
Bug: 49586
Change-Id: Iddb9eb9c64b55b25445ddf9e474d312b685978a6
Add group field to reference dialog

Change-Id: Icf9ea348cd97bdb09ddf18769f53c01ea5a8b7ef
Pass selection to ve.dm.Surface.change when pasting over text

Bug: 49551
Change-Id: I7497b5195961e46718c7382409a66b7eec1162a9
Kill attribute order preservation

Per the bug report, it's useless because Firefox does not preserve order
in the .attributes array (but sorts it alphabetically instead), and so we
actually get the same exact behavior regardless of whether we use ordering
cleverness or just a straight-up plain object: order is preserved in Chrome,
and alphabetized in Firefox.

Bug: 48980
Change-Id: I1463d06db4900083dd4c565292bbabef09194b43
Merge "(bug 48335) Use more generic approach to filter out non-character key presses."
Merge "(bug 43082) Fix problem by calling surfaceObserver.stop( true ) first - before calling handleEnter."
Fix section edit preference language

Change-Id: Ibad97bea238d0b76f809335b9a8814007da3f02d
Merge "Update 'wgCurRevisionId' after successful save"
Change wording of new preference per James

Change-Id: I95443fcde120d1d6020ef4f3397adacd016668f5
Send section edit links to VE by default

Add a preference to disable this behavior. Requires rewording by James.

Bug: 49260
Change-Id: I5ce7ea8c1e47e8243b619fc61aa957f767d22b48
Update 'wgCurRevisionId' after successful save

Also updates the EventLogging code to use a computed property for
'wgCurRevisionId'.

Change-Id: Ida648c77f56c0e455d6fb49a779a831734f6776b
Merge "Localisation updates from http://translatewiki.net."
Localisation updates from http://translatewiki.net.

Change-Id: I7b1f8e917eac6eafff630dfcee64e4e975c9f1b7
Merge "Improve category widget styling"
Improve category widget styling

Objectives:

* Get rid of the border and ensure pixel-perfect positioning of the input.
* Always render the arrow on the top right of the category item
* Make the popup positioning based on the arrow div's position and size

Bug 49420
Change-Id: I3ad4ff1c41e6108161b5b7c8718c676eb850de68
Merge "Add ability to log analytic events using EventLogging"
Add ability to log analytic events using EventLogging

This change adds a '$wgVisualEditorEnableEventLogging' configuration
variable, accessible client-side as
'wgVisualEditorConfig.enableEventLogging'.

When true, the 'schema.Edit' ResourceLoader module will be loaded on the
page, and calls to ViewPageTarget.logEvent will forward to
mw.eventLog#logEvent.

When false, the module is not loaded, and ViewPageTarget.logEvent is a
no-op.

The change also adds a few calls to ViewPageTarget.logEvent to log certain
editor actions, documented in https://meta.wikimedia.org/wiki/Schema:Edit.

Change-Id: Iccd171d7cde15b0302d1b4c292bcbcc2a4b337ef
Merge changes Ic189011e,I7617a35b

* changes:
  Make references dialog scroll
  Make fieldset layout icons optional
Merge "Category popup fixes"
Merge "Transclusion editing"
(bug 43082) Fix problem by calling surfaceObserver.stop( true ) first - before calling handleEnter.

Change-Id: I35c892581943057acbf9ddd638576e998cc82c1a
Category popup fixes

Objectives:

* Make category popup show "Category" rather than missing message -
this is more similar to other popups like inspectors, which identify
what that thing is that you are working on
* Fix alignment of icon and label in category popup

Changes:

ve.ui.Widget.css
* Make popup title align properly with the remove button

ve.ui.MWCategoryPopupWidget.js
* Update message key

*.php
* Add new message

Change-Id: Ia8051125bbc9bde47ceb931e1ebf42b2955481ff
Transclusion editing

Objectives:

* Rename just about every use of "template" to "transclusion"
* Make a proper data structure for transclusions
* Abstract away template data
* Use more template data in the user interface
* Allow adding parameters
* Allow removing templates, parameters and content

Changes:

ve.ui.Dialog.css
* Add rule to place add param controls on a single line

ve.ui.MWTemplateDialogs.js
* Move template spec loading into transclusion class
* Add remove button for parts and parameters
* Add parameter adding form
* Use template data for labels and descriptions

ve.dm.*
* Add new transclusion data structures

*.php
* Add links to new files

*.*
* Rename all things "template" to "transclusion"

Bug: 39598
Bug: 49403
Change-Id: I3bcf924a3e179cb65f19e833277a39dfd3dad8bd
Make references dialog scroll

If the content in the sub-editor gets big enough, this can be a problem.

Change-Id: Ic189011e64090186d87a397b2b047057a97f2a3d
Make fieldset layout icons optional

Change-Id: I7617a35bd9e8322d0b9f8e225885ccbe5fa230ee
(bug 48335) Use more generic approach to filter out non-character key presses.

Change-Id: Ie00becf1162f145134f006b0b4514ba874de9c43
Revert "Localisation updates from http://translatewiki.net."

Overwrites I2af295a009121236d46c0705f85d3722dfb72aae

This reverts commit 78044e6cd540711e0dfb5f1bbe4a1fc75cef6091

Change-Id: I17e5fe0ea9026a2fca94237686739b14060b8eea
Localisation updates from http://translatewiki.net.

Change-Id: I6bfe49fd013591dfb020b86ccb10b48608650990
Media display and insertion no longer an experimental feature

Media item dialog for settings; drag-and-drop placement; caption
editing still to come.

Bug: 37870
Change-Id: I547e06dcdb92e19f0159660314187c4f1a62f3ed
Merge "Sort out i18n strings"
Merge "References dialog cleanup"
Sort out i18n strings

Sort them alphabetically; trim unused ones; give descriptions for missing ones;
only use the needed messages in the ResourceLoader payload.

Change-Id: I2af295a009121236d46c0705f85d3722dfb72aae
Merge "Store empty annotations as alienMeta nodes"
Merge "Store alien meta items' dom nodes only"
Cleanup unused dialogs

Objectives:
* Remove unused dialogs

Changes:

*.js
* Remove unused stuff
*.php
* Cleanup links to files and messages

Change-Id: Ie670afa3aef1757151e385bf922464b85f662a7d
Store empty annotations as alienMeta nodes

Not a perfect solution, but better than deleting them completely.

Bug: 48605
Change-Id: I0f3a194f629b054f193a61af105733a555775d79
References dialog cleanup

Objectives:

* Remove the whole toolbar subset thing, it's up to the creator of the
  subsurface to know what is and is now allowed, and the commands were
  still passing through unfiltered
* Correctly separate initialization from opening - fix issue where opening
  the reference dialog multiple times will keep adding more and more
  controls

Changes:

ve.init.Target.js
* Remove getToolbarSubset method

ve.ui.MWReferenceDialog.js
* Add toolbar tools and surface commands configs to reference dialog,
  including the things that are safe to use in references
* Move creation of field sets and reused controls to initialize method
  to prevent re-creation each time the dialog is opened
* Move static initialization stuff to the top near the other static stuff

Change-Id: I1c8577d17c506bac76e61b2b036655c59ef5a218
Merge "Replace alpha notice with beta label hiding the feedback link"
Store alien meta items' dom nodes only

We don't need to decompose and rebuild alien meta items
as they are uneditable, so just store the dom node and return that
in toDomElements.

Update test cases and several tests now need to use
assert.deepEqualWithDomElements.

Change-Id: I4d2eed267dac7855cb929a17d7aef566eaf0e287
Merge "mw.ViewPageTarget: Implement veaction=edit history state"
Actually fix bug 48556

Turns out that by skipping the last item, the following logic which
depended on that item being in the existing items list failed to keep
it's grubby hands off it.

Yes, I know I +2'd it. Shame on me too.

Bug: 48556
Bug: 48565
I93ce05f7cbb28313a3f0827539f0528c366aeb7e

Change-Id: If48e001b92c217bee0a35b6da41d1c1ff0e3271c
Replace alpha notice with beta label hiding the feedback link

Bug: 48428
Change-Id: I725beec4e76dadfb1ccca873758f8f37b7f58a73
Merge "Set sort keys on click-out too"
Merge "Improve langlinks styling in meta dialog"
Merge "Add missing documentation for category widgets"
Improve langlinks styling in meta dialog

Change-Id: I88d6d374d34dc08ecf46053cfc639c03ec23f8bf
Localisation updates from http://translatewiki.net.

Change-Id: Icd89869d643a9413d7f9230fad4a2b857cad5693
Add missing documentation for category widgets

Change-Id: Idd01bb8d01363cb2eaf311abae8fa5ecf7b36f0e
Merge "Text input widget enter event"
Merge "Improve input widget value sanitization"
Merge "Paged dialog upgrades"
Set sort keys on click-out too

Was previously only set on form submission, but there was no button so
you had to press the Enter key

Bug: 48555
Change-Id: I256d2b21bc2306959f6d6a0373386054b21dadfe
Merge "Don't offer to move the very last category to the end"
Merge "Break words in the category dialog"
Merge "Clean up incorrect use of regular expressions in CategoryInputWidget"
Clean up incorrect use of regular expressions in CategoryInputWidget

getLookupMenuItemsFromData() constructed a regex from user input
without escaping. I don't *think* there are any injection
vulnerabilities here but at the very least it triggers exceptions
when the input is, say, a backslash. Instead, use .lastIndexOf() which
allows us to efficiently check whether a string starts with a certain
prefix.

getLookupCacheItemFromData() was stripping out the Category: prefix
using a regex that hardcoded Category: (so failed to detect localized
prefixes) and used global replacement, which meant that strings with
multiple occurrences of 'Category:' were handled incorrectly. Instead,
use mw.Title to strip the prefix. Also move away from .map() because we
may need to drop a result if it doesn't pass mw.Title validation.

this.categoryPrefix still has a few legitimate uses left, so keep it
around but set it to the localized namespace prefix rather than Category:

Change-Id: I6547f9df2e94fe81f6aefb9286e547425137344b
Text input widget enter event

Objective:

* Add an event to single line text input widgets to detect when the enter
  key has been pressed

Changes:

ve.ui.TextInputWidget.js
* Retain value of multiline config option
* Add key press handler to detect pressing of enter key
* Emit 'enter' event when enter key is pressed if input is single line

Bonus:

* Add missing documentation for multiline config option

Change-Id: Id9c64343f4a2ea8f0f45213fd2b59ca87c805b24
Improve input widget value sanitization

Objective:

* Prevent undefined and null from being converted to 'undefined' and
  'null' when given to setValue by converting them to empty string instead

Changes:

ve.ui.InputWidget.js
* Move all sanitization to one place
* Improve sanitization by adding cases for undefined and null

Change-Id: I8817a8fcac271e560a9e49887c68a035293866d4
Paged dialog upgrades

Objective:

* Add functionality to paged dialogs to work with the pages and select
  them programmatically

Changes:

ve.ui.PagedDialog.js
* Keep track of the current page name
* Add setPage method, which is can be used publicly and is also used
  internally when items in the outline are selected
* Add a page content config option which auto-appends to the inside of
  the page
* Add removePage method for removing pages by name
* Add getPageName method which gets the current page name

Change-Id: I2a2f0c329d274796b8c9e7572ecff8294f472f7f
Use the correct $$ in the meta dialog

Change-Id: Id23228c67eb4e50b3912b6148374e459b0f59b34
Merge "Fix conversion of byte to grapheme offsets/lengths"
Fix conversion of byte to grapheme offsets/lengths

Missed one case in ve.ce.Docuemnt#getNodeAndOffset.

Bug: 49246

Change-Id: Iff1dfb90130685bb710821f8386cfa2f296f2f95
Merge "When editing meta items, modify them rather than rebuiding them"
Break words in the category dialog

Of course CSS is perfectly standardized and wonderful, so we need a bunch
of duplicative and non-standard rules.

Also fix the mixin in MWCategoryWidget

Change-Id: I24da0ddb29d2886c450da362fee47d22da8e631d
Don't offer to move the very last category to the end

Bug: 48556
Change-Id: I93ce05f7cbb28313a3f0827539f0528c366aeb7e
Fix exception in InputWidget when config.value isn't set

Change-Id: I0d41d8b39aa6777f206ec47b8ceefff012e2b00b
Disable the 'cache' query parameter too

With explicit cache management on the Parsoid side there is no need to send
this explicitly any more.

Change-Id: I34bf3a6ffe631d3350c05ec4c21563f8a734effc
Merge "Wrap inline images in spans with display: inline-block."
Wrap inline images in spans with display: inline-block.

Change-Id: I8daac35c752ad33691955b2493191be990c78f58
Merge "Match non-BMP characters in wordbreak regexes"
Match non-BMP characters in wordbreak regexes

unicodejs.js:
* charRangeArrayRegexp to write surrogate-aware regexps
* private helper functions

unicodejs.wordbreak.test.js:
* test charRangeArrayRegexp
* corrected tests for non-BMP wordbreaks

unicodejs.wordbreak.js:
* use new surrogate-aware regexps

unicodejs.wordbreakproperties.js:
* generated from Unicode data

unicodejs.graphemebreakproperties.js:
* generated from Unicode data

unicodejs.wordbreak.groups.js:
* delete as no longer used

unicodejs-properties.py:
* generate unicodejs.wordbreakproperties.js from Unicode data
* generate unicodejs.graphemebreakproperties.js from Unicode data

index.php:
* update script tag links

/VisualEditor.php:
* update script tag links

/demos/ve/index.php:
* update script tag links

/maintenance/makeStaticLoader.php:
* update script tag links

Change-Id: I39c0386a85b0cf21d68d3385b84018a5d7648de5
Merge "Fix selection and hover for MW inline images."
Fix selection and hover for MW inline images.

Change-Id: I82444157a2f57739dc81039dd919233201041634
Remove Parsoid hack and fix new references.

Now that I797b2bd87 is in we can remove the data-parsoid hack
for new references. Also fix the converter to always insert content
for keyless references.

Change-Id: Ia42907feb8f64637189eba15139177c7eb5e8899
When editing meta items, modify them rather than rebuiding them

When editing the default sort key or a category's sort key, we would just
build a brand new meta item and replace the original item with it. This
destroys whitespace information tracked in the .internal property though,
so the resulting diffs looked pretty bad.

Instead, use ve.extendObject() to base the new meta item on the old one,
changing only what we need to change and keeping .internal (and
htmlAttributes and anything else that may be hiding in there) intact.

Change-Id: I40f4403ea2f2d13542d2e3c8c53e2d7f79515381
Insert Reference

Objective:

* Allow opening reference dialog with arbitrary selection
* Auto-insert reference when selection is not a reference node

Changes:

ve.init.mw.ViewPageTarget.js
* Added reference button to toolbar

ve.init.Target.js
* Add getToolbarSubset so we can exclude the reference button from
  the toolbar in the reference dialog (nested references are not
  allowed).

ve.ui.MWReferenceDialog.js
* Stop storing referenceNode (not needed)
* Only store internalItem on open if there's a focused node that's a
  reference
* Use wrapper paragraph when creating a new reference
* Create new reference on dialog close if required

ve.dm.InternalList.js
* Major rewrite to support key less references.
* Add new method for creating a transaction to insert a new iternal
  item. Also returns the index of the new item to be passed to the
  reference node.

Change-Id: I839ae165c299248484ce93d4ab087318a95fbb94
Localisation updates from http://translatewiki.net.

Change-Id: I531e6caedacd3be2fac25b972aa3e3a0a59c9c56
Preserve location of reference body within key

Previously we populated the reference body into all <ref> tags
with the same key. Now we store an internal attribute marking
which element originally had the data.

If that tag is deleted the body is moved to the first <ref> tag
with that name.

Change-Id: If9f12bfb699e6ce85bb8f7d2ea9e6df528610a3d
Merge "Disable Parsoid URL cache busting with touched ts"
FocusedNode Selection

Introduction of fake selection for single focused nodes. This
change specifically makes the selection much nicer in appearance
for Chrome users selecting floated FocusableNodes (block images)
for example.

Added ve-ce-surface-highlights DOM element to contain styled
highlight elements.

Made adjustments to getSelectionRect to return fake selection
bounds if necessary.

Replaced old uses of showSelection with model.change().

Change-Id: I96e66567cdce6455ef3eb77568e72f23140448ff
Disable Parsoid URL cache busting with touched ts

The Parsoid extension now keeps the cache for the current oldid up to date.
Removing the touched parameter lets VE use the cached HTML.

Change-Id: Id025c69060cb9a0bc2478ec49e2c436022049d97
Merge "mw: Remove 'Report problem' feature"
Merge "mw.ViewPageTarget: Make 'review' step optional in save flow"
Merge "Support for inline images"
mw: Remove 'Report problem' feature

Removed the "report" slide from the mw.ViewPageTarget save
dialog and everything that becomes obsolete as a result of it:

* JS saveDialogReviewWrongButton, which pointed to the report
     slide (was already hidden as of I90de95f6337ee).
* JS ve.init.mw.Target#reportProblem.
* JS ve.init.mw.ViewPageTarget#diffHtml.
* JS ve.dm.ElementLinearData#getUsedStoreValues.
* PHP mw.config wgVisualEditorConfig.reportProblemURL.
* PHP $wgVisualEditorParsoidProblemReportURL.
* I18N visualeditor-savedialog-title-report.
* I18N visualeditor-savedialog-label-review-wrong

Change-Id: I8a5e0ab2060d7c14086bba413d4c7d73b29c9b97
Support for inline images

Handles typeof mw:Image and mw:Image/Frameless

Change-Id: Ie2fbd4a3e12fb6faa4ab8e6dd0aa8d1334ff6498
Merge "Use blacklist instead of whitelist for storeHtmlAttributes of MWBlockImageNode."
mw.ViewPageTarget: Make 'review' step optional in save flow

Summary:

Instead of having a button "Review and save" that opens with a
diff and leads the user to the "Report a bug" and "Save page"
slides respectively, make it more like the default EditPage.

There is now a "Save page" button that opens with the save
form with a button to "Review changes" (diff) or "Save page".

The "Report a bug" slide has been unlinked from the UI and is
no longer accessible for now.

As a result of the UI no longer requesting a diff upfront this
also means we will no longer detect "nochanges" event (when it
turns out the submittted revision matches the latest version).

This is unfortunate as it was a nice feature to detect it
before the user spends time writing the edit summary) but it
is the same as how the default EditPage works.

Changes:

Improved interface messages.

Adapted "nochanges" caption to the new context (it is no
longer shown when clicking "Save page", it is now shown as a
result of clicking "Show changes").

Now that the "save" slide is accessible from multiple paths
it is needed to keep track of slide changes in a history
array. Previously the slide tree was 1 level deep with
everything descending from "review". Now it starts at "save"
and can go in multiple directions including a loop from
save>review>save. We also need to toggle the "Prev" button
based on history instead of based on whether or not we are
on the "first" slide.

Hid the "saveDialogReviewWrongButton" from the review slide.
We're approaching wider launches and this will not scale to
a wider audience.

Bug: 49258
Change-Id: I90de95f6337eeddd794b75d56543d8d152421a6f
Use blacklist instead of whitelist for storeHtmlAttributes of MWBlockImageNode.

Change-Id: Ief029005b3326a94a8432a3bd6de50669bd3a3b2
Render block templates as <div>s and inline ones as <span>s

Right now block templates are rendered as <span>s

Change-Id: I4c941a03e0e34a435990f0392080a3a8bf3e2835
Block Image Resizing

Allow block images to be resized by mixing in ResizableNode.

Made transitioning optional, and disabled it for block image nodes.

Change-Id: If89948d285ffb5efb104c44cbc9553a3d56f52e7
Image insertion

Objective:

* Allow inserting images from local wiki and commons

Changes:

ve.init.mw.ViewPageTarget.js
* Add media insert button to toolbar

ve.init.mw.Platform.js
* Add getMediaSources method - defaults to local wiki and commons

ve.ui.MWMediaInsertDialog.js
* New dialog for inserting media
* Uses a media select widget and inserts block images

ve.ui.Dialog.css
* Added styling for media select widget in media insert dialog

ve.ui.Widget.css
* Added styles for media select widget and media select item widget

ve.ui.MWMediaInsertButtonTool.js
* New tool for inserting media

ve.ui.MediaSelectItemWidget.js
* New item widget for media select widgets

ve.ui.MediaSelectWidget.js
* New widget for searching for and selecting media items

ve.ui.TextInputWidget.js
* Added isPending method

VisualEditor.i18n.php
* New messages for media insert dialog

VisualEditor.php
* Added links to new files and messages

PhantomJS--

Change-Id: Ia803ff3ef518782ce76802d2dab7559686a1bb0a
Merge "HACK: Update template dialog for Parsoid's url -> href change"
Merge "For performance reasons use classes collection instead of jQuery.hasClass"
Merge "Hack around exceptions thrown when closing the reference dialog"
Merge "Let's not put slugs around lists because there is no such need."
For performance reasons use classes collection instead of jQuery.hasClass

Change-Id: Id64a58d71c49ad74c55e3a24b86955ece668ebba
Merge "Fix freaky disappearance of template nodes"
HACK: Update template dialog for Parsoid's url -> href change

Also need to strip ./ and ../

This is a dirty hack, Timo to clean this up

Change-Id: I7f377d916b90f5cdecfcd77a6d5276747a543761
Hack around exceptions thrown when closing the reference dialog

ce.ProtectedNode doesn't like to be torn down when it's detached,
and this was happening to CE nodes created in the MWReferenceList.

Hack around this by attaching the CE nodes generated by the
MWReferenceList to the ce.MWReferenceListNode (so they have a
parent and a way of getting to the surface), and by guarding against
multiple successive setups/teardowns in ce.ProtectedNode.

Change-Id: If00e75b939ccbdbaf681bbb6609fec54805bf9a0
Let's not put slugs around lists because there is no such need.

It is easy to exit the list at any given point by using the toolbar
button or pressing enter twice while at the end of the list.

Change-Id: Ie34300fc13a4548e283348ef58c88ce420fbe0c1
Fix freaky disappearance of template nodes

ce.GeneratedContentNode had an interesting bug where it called .append()
directly on DOM elements stored in the store. They weren't cloned,
which meant the previous rendering of the same node would just disappear,
and they also weren't adopted into the correct document which would
probably have caused other issues as well.

Properly clone and transplant the nodes from the store before attaching
them to the DOM.

Change-Id: I423db85cb7c3851a9bf68de03c72aa22994d9474
Merge "mw.ViewPageTarget: Clean up transform/restore logic"
Merge "Prevent scrolling in top-level window while dialog is open"
Merge "Fix protectedness of MWReferenceList"
Merge "Fixing resize handle size"
Merge "Meta dialog messages were left in experimental mode"
Merge "Remove tests for OOJS methods"
Prevent scrolling in top-level window while dialog is open

Because scroll events cannot be canceled or prevented from bubbling
up, the only way to prevent the scrolling is to cancel the actual key
and mouse wheel events.

PhantomJs -= 2

Change-Id: I540738459181c37d11caf5db07345703e7000ef9
Merge "oojs: Integrate with OOJS v1.0.0"
Remove tests for OOJS methods

Change-Id: I6443e773fd2baf7e186ab4be0e227e78dd05b4b7
Meta dialog messages were left in experimental mode

The messages 'visualeditor-dialogbutton-meta-tooltip' and 'visualeditor
-dialog-meta-title' were left in the experimental block rather than
production, so didn't appear in live. My fault, sorry.

Change-Id: I4d2f8d9ee0900d1d3ee635f348f2cc1491287f3d
Fix vewhitelist override.

This is mainly used for testing blacklisted browsers, so we just need
one parameter ('vewhitelist') which sets whitelist to true and
blacklist to false.

Change-Id: I38771ba7a49657d67c4d94ace1f30b5e41904df6
Merge "Pending input refactor"
Merge "ve.dm.MWBlockImageNode: Make toDomElements add more information to its output so round-tripping can work properly."
Pending input refactor

Objective:

* Make all text inputs have the ability to be "pending", not just ones
  with a special mixin

Changes:

* Delete pending input widget
* Move pending input widget implementation to text input widget
* Update all uses of pending input widget
* Make pending image a reusable "texture"
* Update styles of text input widget for pending state
* Get rid of checking for mixin since all text inputs can be pending now

Bonus:

* Get rid of unused images, including .psd and .ai files
* Add transparency texture
* Fix input widget not using documented config value
* Fix documentation in select widget (lies!)

Change-Id: Ib46ab01dc39d706e5c25fd473dee0edce51b7e44
Fixing resize handle size

Handles were missing vendor-specific box-sizing declarations.

Change-Id: I6f8e8a37df29cc351f4ca50b7dd02fadcc3bdda3
Merge "Rename character to (grapheme) cluster when dealing with unicode."
Merge "Fix API request for language links"
mw.ViewPageTarget: Implement veaction=edit history state

Browser history state:
* Listen for popstate, if veaction is different, act on it
  (by calling activate or deactivate).
* When switching to edit mode, push veaction=edit.
  When switching to view mode, push non-veaction.
  Except if the switch was made by the popstate listener in
  which case we don't want to push again.

Clean up:
* Use document.location.href instead of odd location.toString
  Don't pass it to mw.Uri from the original one since it
  takes the current url by default.

Bug: 43844
Change-Id: I5c345c1526852a84b04436955845bf1b56d94402
oojs: Integrate with OOJS v1.0.0

To make integration and testing easier keeping references and
tests unchanged.

Change-Id: Ie808eaf0ffb754ba9c6be13810cfec2385d8de36
mw.ViewPageTarget: Clean up transform/restore logic

Merge methods:
* transformPage: transformSkinTabs + hideSiteNotice
* restorePage: restoreSkinTabs + restoreSiteNotice

Callers now consistently do both (e.g. #tearDownSurface only
called #restoreSkinTabs). This is also in preparation for
bug 43844.

Removed call from #tearDownSurface as that method is only
called from #deactivate which already calls #restorePage.

Clean up support check:
* Rename supportsStrictMode to supportsES5. Though the feature
  test asserts strict mode, we use it to check support for
  ES5. VisualEditor doesn't particularily care about strict
  mode itself.
* Reverse support if-statemement to return early instead of
  wrapping everything that follows. This makes it easier to
  see that we intent to abort if the current environment is
  known to be problematic. Also easier for code later on
  by not accidentally falling outside this block
* Follows-up aaa5ad254be12aa69.

Change-Id: Ia4b949d9c066a3f7b07217aa3d51de9908734e85
Code style fixes: 'function(' => 'function ('

Change-Id: I905f6bec5c12903775bf3bb1085d26c9ea001eca
Fix API request for language links

Fixes placement of 'indexpageids' in ajax options from I5b8fdfb78a211783

Bug: 48814
Change-Id: I897da1cf06c79ee40e29fb632d09cddb57144ada
Merge "Proper support for frame images (do not display magnify icon)."
Give users a read-only view of language links

This makes the 'category' section of the meta-data panel less lonely, and
prompts us to actually do this at some point quite soon (or encourage others
so to do).

Bug: 48814

Change-Id: I5b8fdfb78a2117839277a683db47fe97107d87b0
Fix protectedness of MWReferenceList

The update() method wiped out the entire contents of the node, including
the shield that makes ce.ProtectedNode work. Fixed by only wiping out and
reconstructing the contents of the <ol>

Change-Id: Ib2978a72939884be67964ce8a3d89a570f70bfa3
Fix deactivate

'detach'.split( '' ).join( 't' ) + 't';

Change-Id: Ic5ba376e2fa0afbbcdb3e8989433ce9dad973dd1
Really fix notices sometimes not being an array

The previous fix didn't really work, because the notices are expected to
be an array elsewhere too. Better to just convert it to an array on the
spot. getObjectValues works with any kind of object (including an array)
so it's safe to use with either data type.

Change-Id: I03237b8624a0b980e5f70d54d55c662ffa460373
Merge "Tolerate JSON stringify screwing up"
Tolerate JSON stringify screwing up

Sometimes the notices come through as an object with numeric keys. Go figure.

Change-Id: I3246006afe74a9c34a0cdd5294de61691bc37a43
Merge "'typeof' for templates changed in Parsoid, it is 'Transclusion' now and used to be 'Object/Template'"
mw.ViewPageTarget: Make tabLayout configurable server-side

Bug: 46871
Change-Id: I3fcb0c2903ae62d61ff789b5504e0ea23932121b
'typeof' for templates changed in Parsoid, it is 'Transclusion' now and used to be 'Object/Template'

Change-Id: Ia5b826bc1a2a648a8e618642697484000b68bfc2
Merge "Update reference lists and inline numberings automatically."
Update reference lists and inline numberings automatically.

The easy part is getting the correct numbers from the InternalList
and generating the ordered list HTML. The tricky part is connecting
up the events to make sure the renumberings/list generations are
triggered when required.

InternalList can emit an update event on document transaction, which
triggers the renumbering/relisting if any references have been
added or deleted during that transaction.

ve.ce.MWReferenceListNode also listens to changes on the
InternalListNode (i.e. changes to the contents of the references)
and always triggers a rebuild.

Change-Id: I1b48ef5240e433c3b314259aa68cde13841ea98b
Merge "Make the mwMeta dialog trigger a toolbar action, not a button"
Make the mwMeta dialog trigger a toolbar action, not a button

This has the secondary impact of moving mwMeta dialog out of experimental mode.

Change-Id: I3bb61d536826c6ba139661861092cd63423d99a4
Merge "Make it clear in the labels that this is for sorting"
Merge "Fix double width border between toolbar and surface in dialog."
ve.dm.MWBlockImageNode: Make toDomElements add more information to its output so round-tripping can work properly.

Change-Id: Ieacf9187371a1687869bcb4bb0244f1bc251a803
ve.dm.Converter: Fix too-much-ascending bug in Converter.

Change-Id: I748003d316614717c8eaf58dcf5735246951532a
Consistency

Quote JSON keys.

Change-Id: Id6cab25e0c755a8e505c384c8ce02094bd68652f
Rename character to (grapheme) cluster when dealing with unicode.

Change-Id: Ia72e19289ba7f15a921d22698ab5d8c354ef120d
Fixes to permaturely merged browser compatibility checks

See comments on Idc5f4a23a2709264d869a9

Bug: 38128
Change-Id: Ic38992e04b5f3932cf18f2dfc217cd733196efb8
Merge "Implement Grunt support (grunt jshint,csslint,qunit,watch)"
Merge "Message documentation for visualeditor-browserwarning."
Merge "ve.ce.Document: Introduce getRelativeRange method"
Message documentation for visualeditor-browserwarning.

Change-Id: Ifde7373535d1e4f8597257fdf779161ba4583819
Fix double width border between toolbar and surface in dialog.

Change-Id: I647a5f4c37d543e8a7c90eecf8cbe3a7a856cc47
Merge "Unit tests for browser compatibility list"
Merge "Implement new browser compatibility checks"
Unit tests for browser compatibility list

This test only runs in MW context.

Change-Id: I25315607d208a923aa28f8b34f099440ba311d9d
Implement new browser compatibility checks

We now have three stages:
1. Browser feature tests. Dies silently if any fail.
2. Browser blacklist. Dies silently if match found.
3. Browser whitelist. Shows warning if no match found.

Previously we were treating the remotely generated
edit notices as if they were in an object when
in fact they were in an array - the code has been
fixed to reflect that fact.

As locally generated notices will typically require
parsed messages, we've also moved the notice rendering
to after onReady is fired.

Updated jquery.client to latest master from MediaWiki core
(needed for proper detection of Iceweasel, Android and Safari)

Bug: 38128
Change-Id: Idc5f4a23a2709264d869a91d00873c4e187bc470
ve.ce.Document: Introduce getRelativeRange method

A new method to be used for cursor left and right movement.

Change-Id: I9b32ccf6800d34f94793fc9086ba2c7341e30c61
Merge "makeStaticLoader: Incorporate hardcoded changes and re-sync"
makeStaticLoader: Incorporate hardcoded changes and re-sync

Follows-up 2e76271 and 231a50f which made manual changes to
the static-loading files without updating makeStaticLoader
(thus causing the load order and if-statement to be out of
sync between different index.php files).

Updating makeStaticLoader to include those changes and applying
it to the other index.php file.

Change-Id: I9bbe97d85f663b1cffeb384d52b5cc54e2f6601b
Implement Grunt support (grunt jshint,csslint,qunit,watch)

This has no influence on Jenkins but can be used locally to
easily run certain tools. Since we already had `.jshintrc` in
our repo it was already possible to easily run JSHint from
the command-line locally. Taking that as a base the following
are new features:
* `grunt csslint`: Runs CSSLint on all css files
* `grunt qunit`: Runs QUnit (standalone) tests in PhantomJS
* `grunt test`: Runs jshint/csslint/qunit
* `grunt watch`: Runs the "test" command automatically whenever
  a file is changed. You can keep this in the background so
  whenever you save a file in your editor (e.g. Sublime Text)
  it'll run the tests and if there is a failure, it'll throw a
  bash error code causing your Terminal application to beep you
  in whatever way your operating system does so (e.g. for
  Mac OS X a red badge + jumping icon in the Dock). It will
  continue to run in the background even after a failure so no
  need to re-start watch after a failure.
* `grunt`: Runs the default task, which is 'test'.

Previously to use `jshint .` you had to:
* One-time install:
  * install package -- nodejs npm
  * npm install -g jshint
* Usage:
  * cd VisualEditor; jshint .

Now, for grunt:
* One-time install:
  * install package -- nodejs npm
  * npm install -g grunt-cli
  * cd VisualEditor; npm install
* Usage:
  * cd VisualEditor; grunt

Change-Id: I7a4fdf4b6bf3f00cef15dc3e2c81eceb595aec7c
Add .csslintrc file and fix remaining warnings

Adding a fairly loose .csslintrc file so that our code
passes it.

The following options cause warnings in our code and have been
disabled for now:

* adjoining-classes
  > Don't use adjoining classes.
  > .ve-ui-widget-disabled.ve-ui-textInputWidget textarea:focus {

* box-sizing
  > The box-sizing property isn't supported in IE6 and IE7.
  > box-sizing: border-box;

* box-model
  > Using width with border can sometimes make elements larger than you expect.
  > border: solid 1px #ccc;
  > Using width with padding can sometimes make elements larger than you expect.
  > padding: 0 0.75em 0 0.75em;
  > Using width with border-right can sometimes make elements larger than you expect.
  > border-right: 1px solid #eee;

* fallback-colors
  > Fallback background-color (hex or RGB) should precede RGBA background-color.
  > background-color: rgba(104,171,255,0.1);

* important
  > Use of !important
  > position: relative !important;

* outline-none
  > Outlines shouldn't be hidden unless other visual changes are made.
  > .ve-ce-documentNode[contenteditable="true"]:focus {

* qualified-headings
  > Heading (h1) should not be qualified.
  > .ve-ce-branchNode h1:empty:before,

* universal-selector
  > The universal selector (*) is known to be slow.
  > .ve-ce-protectedNode * {

* unqualified-attributes
  > Unqualified attribute selectors are known to be slow.
  > .ve-ce-documentNode[contenteditable="true"]:focus {

Fixes made:
* modules/ve/ce/styles/ve.ce.Surface.css:
 [L66:C2] margin can't be used with display: inline.
* modules/ve/ui/styles/ve.ui.css: Unknown @ rule: @-ms-keyframes
 Internet Explorer < 10 doesn't support keyframes. IE10+ supports
 the standard property. I don't think ms-keyframes ever existed
 http://caniuse.com/css-animation. ms-transform did exist
 http://caniuse.com/transform.

Change-Id: I728a48e489c079e1c94a506bb00c245de9551eb6
jshint: Fix trailing comma

Due to the "es5: true" jshint option we enabled, these
warnings were surpressed. I've disabled the option since
we no longer require it. It was enabled in 07c86fc to fix
a bug with jshint. This bug has now been fixed.

Change-Id: I55b7d031eb5581af5f733f050cf2ea98dacb2af6
Proper support for frame images (do not display magnify icon).

Change-Id: I94792760e6b1ff69ab13501939bf8d10e0558e5b
Merge "Store DM nodes in InternalList"
Localisation updates from http://translatewiki.net.

Change-Id: I32f8aafbb6093f321ca46d2b759b95fa5fea9504
Store DM nodes in InternalList

Also keep items in the order they appear in the document
and grouped by group and key.

Additions and removals are triggered by the new root/unroot events.

Change-Id: Ia3e90ccfdab88f352b89992b90554e5f03ff9952
Make it clear in the labels that this is for sorting

Change-Id: I6441365aa81b0ee1a6481390dd7aa1afe9cef310
Localisation updates from http://translatewiki.net.

Change-Id: I5f4e2e9a04316fd9a30961c367af2424304bbe52
Localisation updates from http://translatewiki.net.

Change-Id: Id809fd2303ffd336dfc812da4ae418ba92e111c1
Merge "ve.ui.MWTemplateDialog: Implement inferring of template data"
ve.ui.MWTemplateDialog: Implement inferring of template data

Clean up of logic implemented during the template-sprint:

* Store spec inside the content model, directly associated
  with the content-part. This allowed fixing the bug where
  two spec-less template invocations overwrote each other's
  made-up template data due to it using "target.wt" as key.
  The opener now provides the fetcher with a "specId" which
  is set to "part/<id>" for wt-generated template targets.

* Batching is now implemented inside the fetcher instead
  of outside. This allows calling "getTemplateSpecs" inside
  the loop with a dedicated callback for each spec to store
  it in the content.parts[i] object passed by reference.

  It also makes it easier to use by different code paths.
  You call it as much as you like and it will queue up
  naturally through javascript yielding and then make a batch
  request. This is based on the pattern I used in MediaWiki core
  for mw.loader#addEmbeddedCSS.

Follows-up e7af635, da679b7.

Change-Id: I4d7121229d060a96d927585c987a1a81a474b922
Merge "Convert GeneratedContentNode into a mixing (instead of an abstract class)."
Merge "Unwrap excess <p>s in inline template rendering"
Unwrap excess <p>s in inline template rendering

This is a hack, in the future Parsoid will have a template re-expansion
API that will produce the correct result.

Change-Id: I328c11330fb3db71c51882717d6b84099c9270d1
Merge "Use grapheme clusters in unicodeJS.TextString"
Use grapheme clusters in unicodeJS.TextString

unicodejs.js:
* add splitClusters(text) and splitCharacters(text) methods

unicodejs.textstring.js:
* change internal representation from a char string to a list of grapheme
  clusters

unicodejs.wordbreak.js:
* change getGroup to work on the first character of a grapheme cluster

ve.js:
* Use new unicodejs.splitClusters function

Bug: 48975
Change-Id: I202b98199d2780534d1e02519b72579ba796f08f
Merge "Now we've got PHPCS switched on, kill long lines"
Merge "ve.debug: Document why we use global Function#apply+Function#call instead of method.apply"
ve.debug: Document why we use global Function#apply+Function#call instead of method.apply

Follows-up 2ad6577

Change-Id: I3e2cc39873bffd08b1404bd54dd392623092847d
Merge "Add icon option to ve.ui.TextInputWidget"
Now we've got PHPCS switched on, kill long lines

Lest PHPCS throws wobblies over unrelated changes in PHP files with
underlying issues in their code style.

Change-Id: Ifc4aec328d726e9ca62db34af55ea9592c08d9f3
Merge "Fix demo to convert annotation indexes to actual annotations"
JS and PHP code style fixes

if(	-> if (
for(	-> for (
else if	-> elseif

Lines greater than 120 chars chomped.

Change-Id: I909d4fe9785a656481878256830ae5965e48a416
Fix demo to convert annotation indexes to actual annotations

Change-Id: Ib9d4ab87baca2db7e9e8f2b9fc974c3198d9fe28
Convert GeneratedContentNode into a mixing (instead of an abstract class).

Change-Id: I280d2a59326bd83357c7a09c3a188a70fbc75335
Add icon option to ve.ui.TextInputWidget

Changes:

ve.ui.Widget.css
* Add styles for decorated text input widgets and their icon elements

ve.ui.TextInputWidget.js
* Add icon option which adds an icon before input text

Change-Id: Ib48d795391cb5d110e7dc05658d51129792dfc33
Add search icons

Change-Id: Id5b74916502ea3f94c79968e2dd7f64a563896ce
Template dialog cleanup

Objectives:

* Break template page creation into it's own method
* Get rid of styling being applied in JavaScript
* Fix styling issues

Changes:

ve.ui.MWTemplateDialog.js
* Add method for adding a template page
* Replace css calls with addition of classes for styling
* Cleanup of append calls

ve.ui.Dialog.css
* Make inputs in the template dialog full width and a reasonable height

ve.ui.Widget.css
* Swap margins with padding in labels to prevent layout issues
* Prevent textareas from being resized in safari/chrome

Change-Id: I4030d8605aad865251ecd0aeb8cc72d333bed6a4
Localisation updates from http://translatewiki.net.

Change-Id: I541c827aed5fbdc6d5308007378f6714f6b80821
Add support for editing multi-template nodes

Objectives:

* Refactor template dialog to support loading template data for, and
  editing multiple templates and interleaved content in a template node
* Update template node model to generate multi-template wikitext

Changes:

ve.dm.MWTemplateNode.js
* Rewrite getWikitext method to work with multi-template formats

ve.dm.MWTemplateDialog.js
* Retain information about the node and template calls
* Break AJAX handler into its own method
* Attach event handlers to inputs directly so template values are
  edited directly on the fly
* Refactor page building to support multiple templates
* Add multi-template support for template data API call
* Add support for editing plain text content

Change-Id: I92ff8a9e186701a3f8da88def92a5b7dcb607897
Compare objects/arrays fix

Objectives:

* Fix compareObjects so it doesn't break when given arrays
* Remove compareArrays
* Rename compareObjects to compare and update callers of both methods

Changes:

ve.js
* Loosen check for whether to recurse so both arrays and objects qualify
* Remove compareArrays
* Rename compareObjects to compare

ve.dm.MWTemplateNode.js, ve.dm.AnnotationSet.js, ve.dm.Document.js,
ve.dm.Transaction.js
* Update uses of compare(Arrays|Objects) to use compare

Change-Id: I7d4f7ceb28c0389f0157b7598e291f21393b5b85
Add class mw-figcaption to figcaption tag inside mwimage

This is currently required by Parsoid in order to serialize
(HTMLDOM -> wikitext) correctly.

Change-Id: I827f63420d05c62d689902c9b348d234f20a5d19
Merge "Adjust coverter getDomSubtreeFromData method call inside ve.dm.MWBlockImageNode to pass correct arguments (there was an API change)."
Adjust coverter getDomSubtreeFromData method call inside ve.dm.MWBlockImageNode to pass correct arguments (there was an API change).

Change-Id: I1918aee714363babf5182c699fd96ef9fd4fce55
Fix internal node weirdness

* In getDataElementOrSlice(), we were slicing one too far
* When encountering a closing for an internal node, don't traverse
  up. Doing this caused weird bugs, like inserting text where it didn't
  belong in some cases an exceptions in others, but these issues were
  parly masked by the off-by-one error in the data slice.

Change-Id: Ieda9afa95b7c1953d09e391774350a9b4148c2fe
Merge "A fix for arrow movements in RTL wikis."
Merge "Add tests for ve.dm.InternalLists"
Add tests for ve.dm.InternalLists

Also fix clone method when no document supplied.

Change-Id: I7b24e8622049c6293fa0ef813696d5d91a901e75
Use config object for ve.ui.PagedDialog.addPage optional args

Objectives;

* Cleanup the addPage API
* Add optional index param to addPage method

Changes:

ve.ui.MWMetaDialog.js, ve.ui.MWTemplateDialog.js
* Update uses of addPage

ve.ui.PagedDialog.js
* Bundle existing optional arguments into object
* Add index option for inserting a specific index

Change-Id: Idcef4d0a52fb817c7d888990920b2c12224a3392
A fix for arrow movements in RTL wikis.

This will make sure the marker moves correctly (backwards/forward)
in RTL languages as well as LTR languages, judging from the wiki pageLanguage.
This can be a quickfix until the movement can be decided per the direction
of the specific element (span/paragraph/div) the marker is in.

Bug: 38546
Change-Id: Ic01e110a5e6094cd275327a2e8cea90c900f1bd1
Fix resizable nodes

Making sure resize handle events are bound and unbound on focus, and that elements are created in the right window.

Change-Id: Ie90bb82aa6c81c372d76278dab3665bd49bf573c
Merge "Cleanup internalList method names and data stores"
Naming typo and mw content in demo

Changes:

* Remove MW specific content in the image demo page
* Fix naming of method, changed in previous commit

Change-Id: I9c073e9f07f791ba6e9e0e979190f3ef415f055d
Cleanup internalList method names and data stores

Rename some methods and erase the HTML data after conversion.

Change-Id: Ic7317db2c7693591fda4bea459631981a69003f3
Merge "Make menus render on the very top of everything"
Make menus render on the very top of everything

Menus dismiss automatically on blur, so it's safe to make them on the very top of everything

Change-Id: I08bed7f7fbf108f1197c4b6c52ab5b5159e3c982
Treat acronyms like words in camel case names

No matter what the W3C says, getDomFromHtmlString is more legible than
getDOMFromHTMLString.

Change-Id: Ic843b6671871024cce8acd82b6be435599ed168b
Consistent use of mw in HTML classes, and data element and annotation types

MWfooBar or MWfoobar should be mwFooBar

Change-Id: I30f0ef05960c9df218ef6f1cb161ff6ccd529bc7
Merge "Re-fix pixel grid snapping on new text style icons"
Don't do evil shadowing of mw

Having local variable called mw that shadows the global variable mw
is evil. Rename it to mwAttr.

Change-Id: I87bd3698c73608076424c10fdb0559dfdc3e3045
Re-fix pixel grid snapping on new text style icons

Trevor tweaked the pixel grid snapping on my previous commit
but it appears that introduced some errors as well. The horizontal
lines in underline-a and strikethrough-s no longer have integer
x-coordinates, and on underline-u the whole object is offset
by (0.166, 0.166).

Bug: 47780
Change-Id: I51f2605e7d8e2bab1d641f02244d5cd24f505676
Merge "Remove duplicated code breaking the template dialog"
Merge "Make reference editing work"
Merge "Fix misspelled event handler"
Clear phantoms on teardown in ProtectedNode

When you typed after a ProtectedNode that was previously at the end of
a paragraph, then moved the mouse, you'd get a JS error.

What happened was the typing caused a new TextNode to be created after
the ProtectedNode, which caused the ParagraphNode to be rebuilt,
detaching the original ProtectedNode and creating a new one. The
detached ProtectedNode was still bound to mousemove on the body, and
when that event fired it would try to remove its phantoms from the
surface and fail because detached nodes can't get to the surface.

Change-Id: I9f38776f0267645b14d7b26e2a25007cf3be8ec7
Merge "Rename 'langlinks' to 'languages'"
Localisation updates from http://translatewiki.net.

Change-Id: Id0be8b082f241ba0be50b477173db525d32e394b
Convert from DOS line endings (CRLF) to Unix ones (LF)

Change-Id: I66c2d6662c7512d5c55daf7a8a1876f00f8a7705
Rename 'langlinks' to 'languages'

For internal naming consistency (e.g. with MWLanguageMetaItem).

Change-Id: Ifb53fa10da52e1ea87389b024b7c581b8dd730e6
Make reference editing work

The only reason it doesn't save correctly right now is because Parsoid
doesn't serialize reference edits correctly.

Change-Id: Ia0f272c07cc28ee829372eb848f23aec99eb92f0
Merge "Fix getAnnotationIndexesFromOffset() to always return an array"
Merge "Remove trailing whitespace everywhere"
Remove trailing whitespace everywhere

Change-Id: I14f812bd31bd33d9fbd1148a474cbe7a3375d954
Restore window overlays

And use them for the category widget for it's popup.

Change-Id: I43db14c749400efa6a770343afbdfa16dd6bff30
Merge "Fix undefined i18n message in category popout"
Fix misspelled event handler

Change-Id: I3f3091aad24d4bfdea08fbce1c331e8767866bbc
Fix undefined i18n message in category popout

Message was renamed earlier but this caller wasn't updated

Change-Id: I7ec37c6e0fd6fbbe766166704ea797c9ffd6684b
Remove duplicated code breaking the template dialog

Change-Id: Ied5dc71106601ab354441c2d81507b616553c0d9
Merge "Fix documentation for GridLayout to add a return type"
Fix getAnnotationIndexesFromOffset() to always return an array

It used to, but a recent change broke it

Change-Id: I03ecfd5a515855a286136b57217779fd1c5912a5
Merge "Merging and remapping of IVStores and InternalLists"
Merge "Add getDocumentSlice"
Merging and remapping of IVStores and InternalLists

Add merge() methods to IndexValueStore and InternalList, which merge
another store/list in to the current one and return a mapping
translating old indexes to new ones.

Also add functions that, given such a mapping, traverse a linear
model data array and remap store/list indexes using simple logic for
annotations and node type-specific functions for node attributes.

Change-Id: I1e90755ced1a87c190947c037cf151c4d17cf8b7
Add getDocumentSlice

A document slice is a document built from a data slice of an existing
document. It's completely separate from the original document and has
its own store and internalList. The new document's data also contains
the entirety of the original document's internal list. It's possible
to create a document slice of data located inside the internal list,
in which case the resulting document will contain that data twice (one
mutable copy at the top level, and one immutable copy in the internal
list).

ve.dm.Document.js:
* Optionally take an internalList in the constructor. This allows us to
  create a document with a clone of an existing internalList rather than
  an empty one.
* Add edgeMetadata flag to getFullData()

ve.dm.IndexValueStore.js, ve.dm.InternalList.js:
* Make these classes cloneable

Change-Id: I93e06f764ace16aee9df941b07f8c2bff1a28e2b
Fix documentation for GridLayout to add a return type

Change-Id: I461160b01ae9fc4448904eeaf150570989d09d45
Internationalisation for the metadata dialog

Change-Id: Iefb6d5c90583f0684cb9548d38b83048b43d3c81
Merge "Store multi byte characters as one element"
Localisation updates from http://translatewiki.net.

Change-Id: I7dc7ab1b79f2a8807ec4cbb849e01e07143f54b1
Merge "Correctly populate internalList for example documents"
Store multi byte characters as one element

Getting & setting the cursor is done with byte offsets
instead of data model offset (characters) so we need to
be able to convert between the two as well as splitting
characters.

TODO: The regex only works on surrogate pairs, not
yet combining accents.

fixupInsertion will combine a combining mark with the
character to its left it it can.

Bug: 48630

Change-Id: I8d936fb15d82f73cd45fac142c540a7950850d55
Merge changes I2dc0c151,I807a0f32

* changes:
  Attach resize handles to $localOverlay
  Remove resize handles on surface teardown
Merge "Remove language page tab from MW meta dialog"
Merge "Wrap pre-formatted nodes at word boundaries, not window width"
Wrap pre-formatted nodes at word boundaries, not window width

Bug: 38043
Change-Id: I9b5e3b3e62b52c86743ee345b1cc31beec0a061e
Attach resize handles to $localOverlay

Because that's where they should be.

Change-Id: I2dc0c1511f459fea6bf7db86eff9a55c07dd911b
Remove resize handles on surface teardown

Add teardown call to surface destruction in mw target, and
teardown listener to resizeable node.

Bug: 48530
Change-Id: I807a0f32d3d1eb490456d887f7bf867bdb896df4
Remove language page tab from MW meta dialog

MW meta is close to being moved out of experimental, but language
editing is not in line for the beta release.

Bug: 48561
Change-Id: Ie87a3c7dde2f29c3898c08d4cade5c0ba2f937dd
Merge "Add MW meta button to toolbar"
Merge changes I0a60421f,I0646b8cf

* changes:
  Make MW meta dialog experimental
  Remove unused toolbar group name.
Add MW meta button to toolbar

Bug: 48561
Change-Id: Ibf63329a53bcd8043d46315239c19be4e681a18a
Make MW meta dialog experimental

Also remove the exception thrown when we try to add an non-existent
toolbar button, as it may just be experimental and not loaded.

Change-Id: I0a60421f45d7a3941c510defc60d1fbf9469e784
Correctly populate internalList for example documents

Right now the internal list is very much HTML-based, so it's not
populated at all when creating a document from data. So hack this in by
specifying what should be in the internal list as a property of the
example document's data array.

Change-Id: I51c7b7b4dcd9fd3333777c1287b7ba544887aa32
Remove unused toolbar group name.

Can't see why we'd need to style toolbar groups differently.

Change-Id: I0646b8cf37ab19e34a8ed2eb8558773365403610
Display 'editingold' as a notice when editing old version of a page

Bug: 47683
Change-Id: I216cdd68014173aa65cad42ddd3d870334be9ead
Merge "Use our own collection of constant to key code. The one based on w3c is not reliable."
Localisation updates from http://translatewiki.net.

Change-Id: I46da13c29a2f21fd36da068df338276d8f2ace2e
Use our own collection of constant to key code. The one based on w3c is not reliable.

Also, for next few months, please don't mention w3c when I'm around.

Change-Id: I4c8577ae50c16b177dbe370a0deac0d3272e9a06
Merge "Fix value for DOM_VK_DELETE"
Fix value for DOM_VK_DELETE

The spec you link to appears to not correlate to the real world.
Firefox has a value of 0x2E (46 in decimal) store for this, and
both FF & Chrome report that value in my tests.

Change-Id: I4b0d4d27448587ca7381c640d6d3949402305656
Merge "Support for thumb and frame images with captions."
Support for thumb and frame images with captions.

* VisualEditor.hooks.php
** export URL to magnify clip as a configuration variable so thumbnail image can render correctly

* ve.ce.Surface.css
** add CSS styling to make image captions look the same way in edit mode as they look in the view mode

* ve.ce.ParagraphNode.js
** add CSS class ve-ce-generated-wrapper if it is a generated wrapper

* ve.ce.MWImageCaptionNode.js
** make image caption rendering match the view mode

Change-Id: I0cd1b25e8f8355e0500aabc90e7c4cdf591545f3
Merge "ve.ui.Toolbar: Clear the float before the toolbar"
Localisation updates from http://translatewiki.net.

Change-Id: I2797cd857bfe1ebb301c617ac0a806cede2c5a50
ve.ui.Toolbar: Clear the float before the toolbar

On wikis where certain "topicons" exist the toolbar showed a
weird blank space pushing the entire toolbar down and
ve-ui-toolbar-actions to the left.

Bug: 48734
Change-Id: Ic5f73ac1eb8c41b891dd1c67b71795cb6c456141
Merge "Fix for check if data is balanced"
Fix for check if data is balanced

Previous check wouldn't make sense, cause the last offset in the data
could be that one that makes data balanced (and j is increased always
after iteration). 

Change-Id: Ie9498d0ac9e3417d09b8b3043bf3281e7dfbf9db
Added comment to explain better what ve.Keys is.

Change-Id: I9c9b181c4ddbaa0a32e419726fc91b6ae8db7b2a
Merge "Clicking link button while link inspector is already open throws error"
Merge "Remove native KeyEvent"
Merge "Get rid of try..catch by using ve.dm.nodeFactory.lookup."
Merge "ve.Element: Add unit tests"
Remove native KeyEvent

Relying on any native implementation of window.KeyEvent is
unreliable. The two specs listed in the comments for this method
are not the same and Firefox now has DOM_VK_ENTER and
DOM_VK_RETURN which are equivalent to 13 and 14 respectively.
The key on the right side of my home row triggers 14 using
native window.KeyEvent in Firefox, where Chrome uses our
defined constants and returns 13. This fix ensures the same
values for all browsers.

Change-Id: I12b2f5d674bdf13526577cb81d0505b608f2846c
Get rid of try..catch by using ve.dm.nodeFactory.lookup.

Change-Id: I017ed60f7d7ce8af34c94fe237cc4101192518f1
Merge "ve.ui.MWTemplateDialog: Implement templatedata API fetch"
MWLinkTargetInputWidget: Normalise value before matching

Don't suggest a "new page" (redlink) for values that are
strictly different but the same as a suggestion according
to mw.Title (e.g. input "foo" with an existing "Foo" page
should not suggest a redlink to inexistant page "foo").

Bug: 48476
Change-Id: I66f5fc56554984af58d6223dc6cd76b3ab9940bd
ve.Element: Add unit tests

Follows-up c2defc9.

Change-Id: I2045e40567de01f6b44beffe760b6a6287754f75
Clicking link button while link inspector is already open throws error

Bug: 48549
Change-Id: Ia97b6e3d862e02f5c55cac3f490fd8f26052027a
ve.ui.MWTemplateDialog: Implement templatedata API fetch

Fetch
* Added basic name expansion logic since bug 48663 is not yet
  resolved in Parsoid.
* Fetch info from template data API.

Clean up (follows-up 97157a1c, de203cb8, 718db58)
* Remove redundant initialize method.
* Pass the entire target object to #getTemplateData
  because `target.wt` is *not* the template name.
* Reorganise #createPage to be more logical and rename
  to #createParamPage.
* Add todo comments for things currently missing.
* Implement error handling of promise to prevent UI from
  going stale if the promise is not resolved.
* Fix documentation in ve.ui.MWCategoryInputWidget.

Change-Id: Ie0114a81eead86d7a3b3e3a7a5b10d25c457b524
Merge "Show warning when commit message is empty and preference is set"
Show warning when commit message is empty and preference is set

If the commit message is empty we show a warning, and if the warning
is already visible we allow the user to proceed.

Bug: 47752
Change-Id: Idba707abaea8b08a94f7fa4d5bc5b1e35261a572
Localisation updates from http://translatewiki.net.

Change-Id: I02bdae14ac66abf865cc9fbaeca41367dbc7cadb
Merge "Icons for underline, strike & super/subscript buttons"
Icons for underline, strike & super/subscript buttons

Bug: 47780
Change-Id: I2f317e1dda2c2e2fceac401768c732dae02e83ce
Merge "Move selection to end of insertion after paste"
Merge "mw.ViewPageTarget: Get feedback url from content language"
mw.ViewPageTarget: Get feedback url from content language

Link is specific to the project language, not the user's preference.

Bug: 47730
Change-Id: I3804e6f91015ef9b8ae5196efb37475d714cd7d5
mw.ViewPageTarge: Add mw-content-ltr/mw-content-rtl to surface

Add class to surface in order to correctly match MediaWiki styling.

Change-Id: If9f39dabc723d37a51065e410415fc76ca044d2e
Added very basic support (rendering) for captions of thumb and frame images.

Change-Id: I4a59d4601c9bf44b241bb1432c9f1abc3f961743
Merge "Add a transaction builder for replacing the contents of a node"
Add a transaction builder for replacing the contents of a node

Change-Id: I69d362c4694104313dd2634434eddfbaf9435b22
Merge "Refetch the token when we get a badtoken error"
Merge "Refactor HTML attribute preservation"
Fix 'dump model' button on standalone demo

Updated location of linear model data in memory.
Also fixed coding standards.

Change-Id: I513b3a288b1214aa097cb0abb439ea781d37c237
Merge "Wrap <img> in <a> inside image thumb in order to match MediaWiki parser output."
Merge "Fix call to getWindow"
Merge "UnicodeJS treating start/end tags as letters"
Merge changes Icbab46af,Ied54d2b7

* changes:
  Move toolbar cancel message to VE specific message
  Remove parsedMessages from messages array
UnicodeJS treating start/end tags as letters

Because /[a-z]/.test(null) treats null as the string 'null' and
so returns true.

Bug: 48487
Change-Id: I2408229cddd876ff8fe55a9eddf9bac87a61457e
Move selection to end of insertion after paste

Assuming this was broken by changes to translateRange.

Bug: 48603
Change-Id: Ia2a2120cb75aa86374b594ae3f484c5161028919
Fix call to getWindow

Using the wrong namespace.

Bug: 48602
Change-Id: I31dc071328123b57b778aa1b21f0e1daf6405e5c
Change document title on surface setup/teardown

Now reads "Creating/Editing Title - Sitename".

Bug: 48272
Change-Id: I9dcc8ec2c37a7ff9cff6cedb7bdb1fed1bdc4deb
Merge "Fix old copy/paste documentation errors"
Merge "Fix various issues with prematurely aborting VE load"
Merge "Fix bytelimit status update"
Merge "Change 'Edit source' to 'Create source' for new pages"
Fix bytelimit status update

We need to listen to the same events as bytelimit. Specifically
we were missing keyup, which meant the counter could get stuck on
-1.

Bug: 47718
Change-Id: I3d4f3f8cd451bfb6acea19ee9baae7be60adcf15
Merge "Always enable save button on oldid pages"
Merge "Disable VE on redirect pages"
Refactor HTML attribute preservation

Rather than using namespaced linmod attributes, store the preserved
HTML attributes in the .htmlAttributes property of the linear model
element, in a nested structure to allow for easier treatment of child
nodes. Also added attribute order preservation by storing attributes
as an object plus an array of keys.

ve.ce.Node.js:
* Remove html/* attribute synchronization. Doesn't make sense any more
  because these things aren't in the attributes object any more. I don't
  think it ever made sense because these attributes were never supposed
  to be changed anyway.

ve.ce.View.js:
* Replace renderAttributes() with a simple wrapper around
  renderHtmlAttributeList()

ve.dm.Converter.js:
* Add buildHtmlAttributeList() and renderHtmlAttributes() for building
  and rendering HTML attribute lists

ve.dm.Model.js:
* Add getter for .htmlAttributes

ve.dm.Node.js:
* Drop .htmlAttributes on clone, and remove logic dropping html/*

ve.ui.MWCategoryWidget.js:
* Remove html/0/about hack, was already unnecessary and now doesn't
  work any more

tests/:
* UPDATE ALL THE TESTS

Change-Id: I620573afd70d36ade6b80413075b6e1f4a435abe
Refetch the token when we get a badtoken error

Intercept badtoken errors, refetch the edit token from the
action=tokens API, and retry the request again. If this fails too,
show the error to the user.

Right now this just shows the good old confirm() dialog if the token
refetch fails; we should probaby give the user a clearer error message
telling them to refresh the page or something.

Bug: 42984
Change-Id: Ib43d1938ffa24bc8d1dc76a300e16e486dabd928
Localisation updates from http://translatewiki.net.

Change-Id: I3f4502145e220843975bf2c3b6342a90b6774299
Always enable save button on oldid pages

Was previously enabled on creation but could be disabled
by state changes.

Bug: 48584
Change-Id: I67c011ac655d4e553f9467cab10a875aaac61d03
Wrap <img> in <a> inside image thumb in order to match MediaWiki parser output.

Change-Id: I91cfcd9ea319b4429abbbe9ddbb07d1cd8a65b62
Change 'Edit source' to 'Create source' for new pages

Bug: 47421
Change-Id: Iafba040cb8eb53017f38f2099a473e0e43e2ec46
Fix various issues with prematurely aborting VE load

Add checks to make sure parts of the target are acutally
active before trying to tear them down or use them.

This fixes a couple of issues which appeared when the VE was
closed before it had a chance to finish loading.

Bug: 48520
Bug: 47813
Change-Id: Ide5def0e983bab49108b40008fc170957c7fc2a2
Fix old copy/paste documentation errors

Three methods in ve.init.mw.ViewPageTarget have incorrect descriptions.

Change-Id: Ie2e7835a7c6fa7387d48936dbe65649a150eec79
Move toolbar cancel message to VE specific message

Be consistent with all other button messages.

Change-Id: Icbab46aff210b79db59de688d539b8e69a13ec0d
Remove parsedMessages from messages array

These messages are only used in their parsed form, we never use
them in their raw wikitext form, so not point sending them to the
client.

Change-Id: Ied54d2b760fe1c15cd03df6d77052f6a5b920391
Disable VE on redirect pages

Will need to be undone once redirect editing support is added.

Bug: 47329
Change-Id: I68836156c35c796aa2156c382992b0c105ae34cf
Merge "ve.ui.PopupWidget visibility fixes"
Merge "Use promise pattern inside MWTemplateDialog in order to download TemplateData (currently just mocked) asynchronously."
ve.ui.PopupWidget visibility fixes

Objective:

* Context popup would stop opening sometimes "mysteriously" which ended
  up having to do with the automatic closing on blur functionality
  added to popups for use in the category popup widget
* Mousedown event canceling was being applied a little too widely, and
  was causing popup widgets to not allow child elements to be focused
  (unless they contained an iframe, like an inspector)

Changes:

ve.ui.Context.js
* Make use of the popup's show and hide methods within the inspector

ve.ui.MWCategoryPopupWidget.js
* Override autoClose option for category popup widgets

ve.ui.PopupWidget.js
* Add autoClose option to popup widgets
* Move event handler to the top of the methods (convention)
* Only bind blur event if autoClose is enabled
* Inline the getFocusedChild method

Change-Id: I22aedb5fbd51b327ea7ce2ecdd6123e79cbebb9c
Merge "Support for nodes that handles their own children in ve.dm.Converter.prototype.getDomSubtreeFromData"
Use promise pattern inside MWTemplateDialog in order to download TemplateData (currently just mocked) asynchronously.

Change-Id: Ib23521cf40a80cc82872de82d3935414ef385d21
Merge "Keep veaction=edit in the url when VE runs in debug mode so it keeps user just refresh the page in order to get into the edit mode."
Support for nodes that handles their own children in ve.dm.Converter.prototype.getDomSubtreeFromData

Change-Id: I784dec71d3f0b23001075234e324a8e06a6cfc6b
Keep veaction=edit in the url when VE runs in debug mode so it keeps user just refresh the page in order to get into the edit mode.

Change-Id: I32c7135c3b989348d2d5722977cec2f81f08c162
Localisation updates from http://translatewiki.net.

Change-Id: I14e7d7bac0117b405066166a6bbd47bd8a3748c6
Merge "ve.ui.Context: Add embedding feature"
ve.ui.Context: Add embedding feature

Objectives:

* Make the context menu display in the top right corner of the currently
  focused inspectable node (if there is one)
* Prevent clicking on anything to do with the toolbar or popup from doing
  anything at all, ever

Bonus:

* While we are using the clever feature in jQuery's on method which allows
  passing boolean false to cancel the event - may as well do that in
  ve.ui.Dialog as well

Changes:

ve.ui.FocusableNode
* Add ability to specify the focusable element so that dimensions can be
  derived from it

ve.ce.Surface
* Add quotes to object keys

ve.ui.MediaDialog
* Change association from being MW specific to handling images in general

ve.ui.Context
* Add embedded styles for context
* Add embedded mode, which is triggered when the context is a single
  focusable node, and the node is large enough to fit the context
  reasonably

ve.ui.Dialog
* Inline mousedown handler

ve.ui.Toolbar, ve.ui.PopupWidget
* Cancel stray mousedown events

Change-Id: I4b25d33f64b4bcb8a3ecfd7e9728f54a2d4886f3
Merge "Emit teardown event before replacing generated content node content and emit setup event after."
Create and commit transaction after attributes of the template are changed and applied.

Change-Id: I4a1acdadcd1486ddd5dafcfc794c9b3b93e92592
Emit teardown event before replacing generated content node content and emit setup event after.

Change-Id: I397d4dfb5fd0177255a0b4389ba5380807969ef4
Implement roundtrip update of template contents

Currently there is no Parsoid call for this so we're using the PHP
parser API.

Change-Id: I8bc4f96924d88de7bc67203336bf465ba91fc37b
Merge "Introduce createPage method in ve.ui.MWTemplateDialog and even use it!"
Merge "Fixing block template styling"
Fixing block template styling

Trailing comma borks everything.

Change-Id: Ic4eb97f84b45297312b45ab64355836ef8a329d1
Fix image block node error

When loading an image block node in the demo, there are no classes on the figure, which caused the code to crash because it was assuming that jQuery's attr method would always return a string.

Change-Id: Ib13e7bfa3fb2bd76ac71dfef085bed209d880b4a
Introduce createPage method in ve.ui.MWTemplateDialog and even use it!

Change-Id: I7b063a9380742e157a4c7128c1654abcf3ad8c6f
Build TemplateDialog based on parameters that are passed to template
(instead of TemplateData as before).

Change-Id: I50b0e6ef1936c4b56f40fa73bd42b03587bdf979
Merge "Content for Template Dialog"
Merge "Implement ve.dm.MWTemplateNode.getWikitext()"
Implement ve.dm.MWTemplateNode.getWikitext()

Escapes }} and | by wrapping them in <nowiki> tags, and steps around
<nowiki> tags so as to not double-wrap things.

Change-Id: Ia50906524c1fcf55c9f390a114856bc7f20b2d3a
Content for Template Dialog

Initial commit of page content.

Change-Id: Iffdf4f4179c6f3b04611d4bd9548e7cf23188856
Merge "Multiline option for ve.ui.TextInputWidget.js"
Merge "Process example template data and add pages to PagedDialog based on it."
Merge "Added clearPages method to ve.ui.PagedDialog."
Multiline option for ve.ui.TextInputWidget.js

Objective:

* Add multiline option to text input widget which uses a text area instead of a text input

Changes:

ve.ui.Widget.css
* Add text area support for styles otherwise only targeting input elements

ve.ui.InputWidget.js
* Initialize input element using a method, so it can be fully customized (like making a text area or select input
* Use val() to set the initial value, using jQuery's abstraction around inputs of various types

ve.ui.TextInputWidget.js
* Add multiline option which uses a text area instead of an input

Change-Id: I1bf17c8c76b7f1708c57ee5e95160c071ddd00e9
Process example template data and add pages to PagedDialog based on it.

Change-Id: I34ee42e66df26000842f9b1540a577b2621f8839
Added clearPages method to ve.ui.PagedDialog.

Change-Id: Ie55f727f649b2dcd4189489c7baa9f524aa5d1c7
Merge "Rewrite API 'paction' switcher as an actual switch"
Merge "Revert "Localisation updates from http://translatewiki.net.""
Rewrite API 'paction' switcher as an actual switch

Change-Id: I1f10ee890ea5d1d709739b21c23e35a6a6fd4901
Revert "Localisation updates from http://translatewiki.net."

This reverts commit b91469867d6fa262c337dce5ab36d86e187841d0

Change-Id: I2e48e70597f13ffb6b59c3d780442288b5087046
Merge "Localisation updates from http://translatewiki.net."
Localisation updates from http://translatewiki.net.

Change-Id: I405c871bce7014222ee24ed1b995ca29408bff82
Merge "Fix for default sort key crash"
Fix for default sort key crash

The existing default sort key was being cached when the dialog was
constructed, but on the 2nd time launching it the reference was broken.
This change gets rid of the caching and always grabs a fresh copy when
we need one.

Also, the flag indicating the default sort key has changed wasn't being
reset properly.

Change-Id: I8fb3b088f25212b8c542df65bb5a248550ff6f27
Pages in template dialog

Just a starting point for Inez to loop.

Change-Id: I6d418ba955f0904d34b474c984eef7f97be257e9
Merge "Add level option to ve.ui.OutlineItemWidget"
Add level option to ve.ui.OutlineItemWidget

Objective:

* Add indentation feature to outline items

Changes:

ve.ui.PagedDialog.js
* Pass level argument through addPage method

ve.ui.Widget.css
* Add styles for non-zero levels of outline items

ve.ui.OutlineItemWidget.js
* Add missing config documentation for icon option
* Add level option, with getLevel/setLevel methods
* Add statically configurable number of levels and level class

Change-Id: Ie24761c64918fdc6cd28070b3cf56743c6288970
Merge "Implement ve.ui.MWTemplateDialog"
Implement ve.ui.MWTemplateDialog

Objective:

* Add button to launch template dialog
* Add template dialog

Changes;

*.php
* Add messages and links to files

ve.ce.Node.css
* Make inline templates display as inline-block to contain their
  contents (allowing shields to work properly)

ve.ui.MWTemplateDialog.js
* New empty dialog for templates

ve.ui.MWTemplateButtonTool.js
* New template button, appears in context and launches dialog

Change-Id: I9174ed7c9012522246a6defc859276bf36763f5b
ve.ce.Surface: Append phantoms to overlay instead of surface

Surface can be deep inside a skin layout of which it is not
unlikely for one or more of the parents to have position
relative.

Change-Id: Ie202fa43b837650fd296fa6804d035622e2599e1
ve.Editor

Objectives:

* Split ve.Surface into ve.Editor and ve.ui.Surface
* Move actions, triggers and commands to ve.ui
* Move toolbar wrapping, floating, shadow and actions functionality to configurable options of ve.ui.Toolbar
* Make ve.ce.Surface and ve.ui.Surface inherit ve.Element and use this.$$ for iframe friendliness
* Make the toolbar separately initialized so it's possible to have a surface without one, as well as control where the toolbar is

Some change notes:

VisualEditor.php
* Added standalone module for mediawiki integrated unit testing

ve.ce.Surface.js
* Remove requirement to pass in an attached container to construct object
* Inherit ve.Element and use this.$$ instead of $
* Make getSelectionRect iframe friendly
* Move most of the initialize stuff to a new initialize method to be called after the surface is attached to the DOM

ve.init.mw.ViewPageTarget.js
* Merge toolbar functions into setup/teardown methods
* Add toolbar manually (since it's not added by the surface anymore)

ve.init.sa.Target.js
* Update new init procedure for editor, surface and toolbar separately
* Move toolbar floating stuff to ve.Toolbar

Change-Id: If91a9d6e76a8be8d1b5a2566394765a37d29a8a7
Merge "Make ve.ce.ProtectedNode use setup (for setup) and teardown (for teardown) events so it is going to work well after node is rewrapped (example: MWBlockImageNode)."
Make ve.ce.ProtectedNode use setup (for setup) and teardown (for teardown) events so it is going to work well after node is rewrapped (example: MWBlockImageNode).

Change-Id: Ibd539813f4302d8bbf8eaa35af71817a55fb1f4b
Merge "Make MWBlockImageNode a ProtectedNode (by adding mixin)."
Merge "Added method getDataFromDomRecursionClean to ve.dm.Converter - used by nodes that handle their own children."
Merge "Return proper error if parsoid is unavailable on serialize"
Merge "Use new options format for toolbar in mw init"
Added method getDataFromDomRecursionClean to ve.dm.Converter - used by nodes that handle their own children.

Change-Id: I604cf201515152824ec159b8c86f2010afcd3369
Make MWBlockImageNode a ProtectedNode (by adding mixin).

Change-Id: Ib15efaf4964f16b86020367e42848d228efd09ba
Return proper error if parsoid is unavailable on serialize

Previously was just returning an empty result.

Bug: 47581
Change-Id: I6bdd177bc9b5a0af9107cf08d8e46470c6778e12
Use new options format for toolbar in mw init

Wasn't updated after change 63095 and so wasn't setting options.

Bug: 48509
Change-Id: Icda3305e422bedaf0d490b8fbe51f55b8c8e79e8
Implement 'minordefault' user preference

Marks all edits as minor by default if the user preference is set.

Bug: 48347
Change-Id: Ib5cdcb9433be5ff7b9179d3833f42e5c3453285a
Merge "Better support for MediaWiki block level images (thumb and frame)"
MWInlineImageNode should be img

Change-Id: I0cc43c59031f970b879b64696e824ebaa28a4b53
Better support for MediaWiki block level images (thumb and frame)

Change-Id: Id6f65e4e1971e21035c89f32fa7ab0009c84695c
Move no changes message to separate save dialog slide

Previously it was just being returned as the diff html, which
looked weird becacuse 1: it was the wrong width and 2: the
save buttons were still there.

Bug: 43754
Change-Id: I537bcae91f51a3f30ca4736c41f7a5619bbf321d
Move edit conflict notice to a save dialog slide

Previously used a confirm() dialog which is a bit ugly.

Bug: 42522
Change-Id: I709d936d998b130515b62de880c6e7aa7978786b
Merge "Fix for crashing on save"
Fix for crashing on save

converter.documentData contains the full data with metadata interleaved,
but it was being sliced using offsets relevant to the element data.

Change-Id: Iddbef23212da818a2a399b4abdc223aad130eb4e
See: I6daff5c5969e5fdc871f8f346cf790b4302ae080
Localisation updates from http://translatewiki.net.

Change-Id: I7a5e28780b95155519e2fb9d0d0e09125719bc8b
Merge "Introduction of setup and teardown events for ve.ce.View nodes"
Merge "ve.Element refactor"
Merge "Floating toolbar cleanup"
Introduction of setup and teardown events for ve.ce.View nodes

* modules/ve/ve.Node.js - remove ve.EventEmitter mixin
* modules/ve/ve.dm.Node.js - added ve.EventEmitter mixin
* modules/ve/ce/ve.ce.BranchNode.js - make updateTagName use newly added
  events

Change-Id: I349155b8e986fe09b615bb5f0617409d723936ef
ve.Element refactor

Objectives:

* Move ve.ui.Element to ve.Element
* Make CE nodes inherit from ve.Element

Changes:

ve.ui.Element.js, ve.Element.js
* Move and rename
* Move ve.ui.get$$ to ve.Element.static.get$$
* Add static getDocument and getWindow methods
* Add instance getElementDocument and getElementWindow methods
* Add getTagName method, which by default reads the static tagName property, but when overridden can return a tag name based on other factors

*.php
* Updated file link

ve.ce.*Annotation.js, ve.ce.*Node.js, ve.ce.View.js, ve.ce.Document
* Added config options pass through
* Replaced passing elements through constructor with defining static tag names
* Added getTagName overrides where needed that derive tag name from model
* Refactore dom wrapper methods, now consistently using getTagName

ve.ce.Surface.js
* Removed static initialization (not needed)

ve.dm.Model.js, ve.ui.Window.js
* Added missing docs

ve.ui.GroupElement.js, ve.ui.Layout.js, ve.ui.Widget.js,
* Updated class name for elements

ve.ui.Frame.js, ve.ui.LookupInputWidget.js
* Updated location of get$$

ve.ui.js
* Move get$$ to ve.Element

ve.js
* Add auto-init of static properties to mixinClass

Change-Id: I39ae14966456903728e4d9e53f806ddce9ca2b70
Floating toolbar cleanup

Objective:

Move toolbar floating functionality to ve.init and clean it up

As a bonus:

demo.css
* Fix CSS path to set width of inputs properly

Changes:

demos/ve/index.php
* Allow ve.init.sa.Target to construct it's own surface object

ve.ce.Surface.js
* Move object resizing and table editing disabling commands from ve.Surface
* Add method for getting the currently focused node

ve.init.mw.ViewPageTarget.js
* Remove initializing surface property (now done in parent class)
* Normalize all uses of "setup" to "setUp"
* Replace uses of getDocumentModel with getModel().getDocument()
* Add calls to set up and tear down for toolbar floating

ve.init.mw.Target.js
* Replace uses of getDocumentModel with getModel().getDocument()

ve.init.sa.Target.js
* Move example from ve.Surface
* Change constructor to accept document model
* Create ve.Surface object in constructor
* Add set up for toolbar floating

ve.ui.init.Target.js
* Initialize surface property
* Move and cleanup toolbar floating functionality from ve.Surface

ve.ui.Surface.js
* Remove example now that init.sa creates it's own surface (moved)
* Document options
* Simplify toolbar options and remove the concept of multiple toolbars
* No longer cache the options object
* Move toolbar initialization to constructor
* Change setupCommands to addCommands, making it useful after construction
* Inline selection initialization
* Move and cleanup toolbar floating functionality to ve.ce.Surface
* Reorganize a few methods
* Move toolbar floating to ve.init.Target.js

Change-Id: I393a426e35567d57c048122bf64a83c1ef45e6e8
Merge "Updating to Rangy 1.3 alpha"
Merge "Reference dialog"
Updating to Rangy 1.3 alpha

We previously tried Rangy 1.3 alpha but rolled back due to a bug
with getting cursor position in IE. Rangy developer Tim Down fixed
the issue here:
https://code.google.com/p/rangy/source/detail?r=780

Both 1.2 (filenames without file versions) and 1.3 in the repo
for now.

Change-Id: I26263fc1d10e3c2bdda7f1c9135544ca3bc05d97
Merge "Revert "Fix check for existing category in article.""
Revert "Fix check for existing category in article."

This reverts commit 50c48a1cac40196ff379638a2b5ad4dd206e3119

Change-Id: I3eca792883171a3390a9fc6f95ca42bfdedcf986
Merge "Fix check for existing category in article."
Reference dialog

Objective:

Add a basic (empty) dialog for mediawiki references. Editor to follow.

Changes:

*.php
* Added file links and messages

ve.ui.MWMetaDialog.js
* Moved initialize method to the top (for consistent ordering)

ve.ui.MWReferenceDialog.js
* New class, basic empty dialog for references

ve.ui.LinkInspector.js, ve.ui.MWLinkInspector.js, ve.ui.MediaButtonTool.js
* Cleanup documentation
* Whitespace

icons.ai, reference.png, reference.svg
* Switch to reference icon being 3 books on a shelf

ve.ui.MWReferenceButtonTool.js
* New class, basic dialog button for references

Change-Id: Ia4e30e9239fa1e3b28c0a1ef1ca0a6515a8103ef
Localisation updates from http://translatewiki.net.

Change-Id: I9185e045a20582b04962a03392f67c73aee8fe0f
Merge "Send a full document back to Parsoid"
Merge "Fix categories with multiple ../ in their hrefPrefix"
Merge "ListAction tests"
Send a full document back to Parsoid

To do this, we take the document generated by the converter and
transplant things from the original Parsoid document into it.

Change-Id: I2f5058220669526130a360cec3389c3f42b41771
Fix categories with multiple ../ in their hrefPrefix

Was already fixed for links.

Bug: 48408
Change-Id: I84d2b23a05585890b2d5023c7c7f38a43889fd7f
ListAction tests

Unwrap and wrap cases.

Change-Id: If4df07eae1d70347dc55b57dc117f2ff5c7385df
Merge "Fix indent action when acting on multiple list items"
Merge "Use consistent capitalisation of Html"
Fix indent action when acting on multiple list items

Same as https://gerrit.wikimedia.org/r/#/c/63394/ but for
indentation, as well as unindentation.

Bug: 48390
Change-Id: I5ce0c385214f30c5e5c66b5b5b755c9937267cd0
Merge "Optimise code for first/last child detection in fixupInsertion"
Merge "Fix unindent action when acting on multiple list items"
Merge "Don't use VE on non-wikitext pages"
Fix inability to split lists

Fixes change made in I7a8d6c474ecca5af02b72b6453c900ed61acea58 by using
DOM_VK_ENTER instead of DOM_VK_RETURN (which is not defined anymore).

Bug: 48386
Change-Id: I8d7aeffc8166487806e3489b054f508c5e9418ff
Optimise code for first/last child detection in fixupInsertion

The code to record the first/last child stacks was written before
I decided on using a recursive call going only one step when such
a stack was encountered.

As we only ever test the length of the stack most of the code around
calculating the stack can be thrown away, and all we need is a simple
test to see if we are the first/last child of the immediate parent.

Change-Id: Iffb03c649e166c9f89061a4d944fa07633f16aba
Fix unindent action when acting on multiple list items

This is caused by a limitation of surface fragments in that they
always expand to include insertions touching them. In this case
we build surface fragments contain adjacent listItems, so when
the first listItem is de-listed a transaction is first created to
split the list. This insertion of ('/list', 'list') is adjacent
to the second surface fragment and so becomes part of that fragment.

This then causes the wrong node to be passed to unindentListItem.

The workaround is to use the inner range of the listItem, not
the outer range.

Bug: 48390

Change-Id: I7418910412d292ef4953e294a97f66e48d6f776f
Don't use VE on non-wikitext pages

Bug: 47456
Change-Id: Iae6510f661feedec181fd8697d799353edb5eac8
Localisation updates from http://translatewiki.net.

Change-Id: Ifd9a13e5f4236c55b2313c1df5ec189baca08ec6
Use consistent capitalisation of Html

If the previous commit properInnerHTML was renamed to
properInnerHtml, but its invocations weren't (a bug).
While DOM uses .innerHTML we use Html throughout the
rest of our code so we should be consistent either way.

Change-Id: If46bb256e938a097951c159b7a278667fd8e06a6
Merge "Add ve.properOuterHtml"
Access keys for edit and edit source

Set up 'v' for edit, and 'e' for edit source as access keys.

Bug: 48107
Change-Id: I598177bc75ed84dea35952a3b2b1b2111aac89b2
Add ve.properOuterHtml

Like ve.properInnerHtml but for outerHTML. Factored out the shared code
into ve.fixupPreBug.

Change-Id: I5c5b6d017936c6c2e71631fb8859ba1dbd95615a
Fix breaking getLength() call

Change-Id: Iaa6cb22bf93a677aff077ce38ee11e606430cee5
Merge "Fieldsets and default sort keys"
Merge "Edit and Edit source tab were reversed in RTL in the Vector integration"
Merge "Switching back to Rangy 1.2"
Fieldsets and default sort keys

Objective:
* Add default sort key field to meta dialog
* Replace PagePanelLayout with a generic panel containing one or more FieldsetLayout elements

Changes:

*.php
* Added/removed file links

ve.dm.MWDefaultSortMetaItem.js
* Added getContent method

ve.dm.MetaItem.js
* Added replaceWith method

ve.dm.MetaList.js
* Allow insertion at the end by omitting offset and index

ve.dm.MWMetaDialog.js
* Added default sort key field
* Put category and default sort fields inside fieldsets
* Added loading/saving default sort key

ve.ui.PagedLayout.js
* Changed class used for pages to generic panel layout

ve.ui.PagePanelLayout
* Moved title/icon stuff to field set

ve.ui.FieldsetLayout.js
* New class, adds fieldset with legend

ve.ui.StackPanelLayout.js
* Moved up to the layouts directory

ve.ui.Dialog.css
* Moved style for paged panel from layout stylesheet

ve.ui.Layout.css
* Added styles for fieldsets

ve.ui.Widget.css
* Adjusted margins of input label widgets

ve.ui.MWCategoryWidget.js, ve.ui.MWCategoryPopupWidget.js
* Added setDefaultSortKey method

Change-Id: I979f5e3f08a688790c9f54086206ed1999af13ea
Switching back to Rangy 1.2

Rangy files are now 1.2 and I've added 1.3 alpha versions to make
it easier to switch between while testing.

Change-Id: I2f5d86b14bd4f87719d01e3255c28f0ae8764f4f
Merge "Output a nice message when the diff is empty"
Fix check for existing category in article.

Now looking inside existingCategories array for category string vs
item object.  When adding side by side duplicate categories,
category is now in correct section of menu.

Change-Id: I40dd30d80fb8bf818c077512468d630a5cb84120
Output a nice message when the diff is empty

Bug: 43754
Change-Id: I8daae124b060ccf54ce5ca7c1e1a6d18b7265ade
Merge "(bug 48022) Ignore certain function keys in key press handler"
(bug 48022) Ignore certain function keys in key press handler

This is a temporary solution that still may some function keys go through.

Change-Id: I7a8d6c474ecca5af02b72b6453c900ed61acea58
Merge "Clean up variable initialization in setupSkinTabs()"
Merge "Localisation updates from http://translatewiki.net."
Localisation updates from http://translatewiki.net.

Change-Id: I263431ad6d92d3d62497bffcc0abd930f675c9aa
Edit and Edit source tab were reversed in RTL in the Vector integration

If we're in RTL mode and the skin is Vector-based, we need to reverse
the order of the tabs in the DOM, because that's a weird thing that
Vector does to render tabs in RTL.

See https://bugzilla.wikimedia.org/show_bug.cgi?id=46947 for discussion
about the Vector behavior.

Bug: 48017
Change-Id: Ie1214b08450aefed893739a2b862cb1e9b23a2ef
Clean up variable initialization in setupSkinTabs()

Change-Id: Ic596f1c98162557f33f5ca398d2358e91a3d5cb0
Remove hack for old version of Parsoid

Removing check for parsoid returning document fragments.

Change-Id: I5a8729d93907d13c699a1f3cf43ffd3e0c45b003
Merge "Use pageLanguage rather than pageViewLanguage for the surface's lang&dir"
Use pageLanguage rather than pageViewLanguage for the surface's lang&dir

Bug: 33175
Change-Id: Ica006404227dcd286c387de4f637036341b17eae
Merge "Make reference list nodes render contents again"
Make reference list nodes render contents again

Really Roan? How dare you!

See I3f5116d7dfbaa5889b7c5cac01d7341272749c58

Change-Id: Ia0ae514fc07752edb7b7100716e09163d3bfacba
Merge "Category UI improvements"
Merge "When removing an empty list item, also remove the list if it's now empty"
Merge "Whitespace between unwrapped inline nodes assigned to paragraph"
Whitespace between unwrapped inline nodes assigned to paragraph

In stopWrapping we assign any left over whitespace to the paragraph
in position 3, however we weren't clearing this whitespace buffer
if an inline content node followed it.

Change-Id: I8b3ee3915044abd6bafda386430bf7f992ca4aa8
Merge "Clone template dom elements being sent to converter"
Merge "Reduction of renderContents calls"
When removing an empty list item, also remove the list if it's now empty

When the user presses Enter in an empty list item, we remove it. But if
the list item was the only child of the list, that leaves an empty list
which then gets a block slug, leading to all sorts of weird things, and
even pawns in Firefox. So check whether the list item was the last child
and if so, remove the list.

Bug: 48287
Change-Id: If22d9b904b8861e24d56944d791545635b2e4254
Reduction of renderContents calls

There is no need to call renderContents in ContentBranchNode constructor
because it is going to be called anyways in onSplice

Change-Id: Id1ab983668299658ecd6e89a37667cc34c701689
Kill getOffsetFromNode() with fire

The way it operated was evil. It did a depth-first search from the root,
finding the node using reference equality. For documents with deep
structures, this could take a long time. Inez did some profiling and
found it was called tens of millions of times on a complex document.

Kill getOffsetFromNode() and move its functionality to getOffset().
The logic has been completely rewritten: getOffset() now traverses
up from the node rather than down from the root, and pretty much does
the reverse of what getNodeFromOffset() does. This should be much more
efficient even without offset caching in the node objects (which we may
still implement later).

Change-Id: I125f9fa423c40db6472e2c4a7c94214218ba3bc7
Category UI improvements

Objectives:
* Ensure items don't get moved to the end when their sort-key is edited
* Add placeholder text and pending styling to input
* Auto-expand input to the end of the line
* Make the minimum input width smaller

Changes:

ve.ui.MWMetaDialog.js
* Added calls to fitInput on initialize
* Fixed sort key update and insert handlers to maintain item position when updating

ve.ui.GroupElement.js
* Added index argument to addItems, allowing items to be inserted at a specific location

ve.ui.PagePanelLayout.js
* Fixed CSS class name

ve.ui.StackPanelLayout.js, ve.ui.MenuWidget.js, ve.ui.SelectWidget.js
* Passed index argument through to group element

ve.ui.PanelLayout.js
* Fixed overflow direction for scrolling option

ve.ui.Inspector.css
* Moved border-box properties to text input widget class
* Set input widget within inspectors to be 100% by default

ve.ui.Layout.css
* Updated CSS class name
* Whitespace fixes

ve.ui.Widget.css
* Made text input widgets's wrapper default to 20em wide and the input inside it be 100%, using border-box to ensure proper sizing
* Adjusted category list item and input styles to make input appear more like a category item
* Whitespace fixes

ve.ui.MWCategoryInputWidget.js
* Made category input widget inherit text input widget, rather than just input widget

ve.ui.MWCategoryWidget.js
* Replaced group functionality by mixing in group element
* Added fitInput, which automatically make the input fill the rest of the line or take up the entire next line depending on how much space is left

VisualEditor.i18n.php
* Adjusted placeholder text for category input

Change-Id: I79a18a7b849804027473084a42c36133fdacad57
Merge "Move completeHistory from dm.Surface to dm.Document"
Merge "Mo' vectors (mo' problems)"
Move completeHistory from dm.Surface to dm.Document

Per IRL conversation with Trevor, that's where it belongs.

Change-Id: I9eae05380597ed83122f29864b77d2278d3dd863
Localisation updates from http://translatewiki.net.

Change-Id: I333bb2869366ae69ab210bf21f2b7ca78209e7d5
Clone template dom elements being sent to converter

The dom elements in the IV store are used for rendering, so if they
are sent by reference to the converter they get re-attached, causing
all templates to disappear from the page whenever you press 'review
and save'.

Fix is to run it through ve.copyArray, which clones all the nodes.

Change-Id: I1b03351a28ac82e0fdb7e94e761cf65d6548e501
Mo' vectors (mo' problems)

Serve vectors to any browser which supports them, instead
of just high dpi devices.

Bug: 48148
Change-Id: Iafe8cd290fb195369776f51a96b6de4a51577b89
Localisation updates from http://translatewiki.net.

Change-Id: Ia26c0c0675a018f487524dc5b6d3ffc757c99f9f
Merge "Fixing shields"
Fixing shields

Shields were being added twice. Switched the blank png to gif
because the red IE background couldn't be replicated. Changed
some styles from Alien to Protected.

Change-Id: I9c62665e4e0dc54b8511749b9d2a629db7990a16
ViewPageTarget: Bind callback in onSerialize like in onShowChanges

init.mw.Target#serialize is an odd one because it is the only
target method that has a callback parameter (instead of
emitting the event on Target and having ViewPageTarget get
the event through that).

This line from onShowChanges needed to be added to onSerialize

  // Invalidate the viewer wikitext on next change
  this.surface.getModel().connect( this, { 'transact': 'onSurfaceModelTransact' } );

Though onSerialize is currently bound manually from the
serialize callback, it should be refactored to be like the others.

Bug: 44446
Change-Id: I9eddebbdf9294ee3d46286bdf1b157e00252d300
Merge "Also render attributes of the form html/i-j/attrName in CE"
Merge "Preserve HTML attributes recursively"
Also render attributes of the form html/i-j/attrName in CE

Factored the parsing of html/* attributes out into a static function.
Factored attribute (re)rendering out into ce.View, attribute updates
are much simpler now.

Change-Id: I4caa6d5e1e2c21c28ddff61c3c864e47f66cc6b2
Preserve HTML attributes recursively

For nodes that handle their own children (as well as leaf nodes and
meta items), store the first child's attributes in html/0-0/*, the
second child's attributes in html/0-1/*, the second element's third
child's fourth child's attributes in html/1-2-3/* , etc.

This obsoletes the ad-hoc code that basically did the same thing in
MWInlineImageNode.

Change-Id: If5abd2d5d9c361b359617ff4b0f3d6ba4c9b0142
Convert DOM elements to stringifiable objects for reporting

We already do this in unit test so moving getDomElementSummary
and convertDomElements from ve.qunit.js to ve.js.

Apply ve.convertDomElements to report data before serialising.

Bug: 47948
Change-Id: Id807ccc6ff31d063be815ed4988cb35684adb76a
Do proper HTML preservation in ve.dm.MWReferenceListNode

Store the HTML as a domElements array like everywhere else, rather than
as a string. Also disable HTML attribute preservation because there's
no point doing that when we're already preserving all of the HTML.

Also fixed a misnamed attribute (<li li="foo"> --> <li id="foo">) in
the test case.

Change-Id: I36bf8bade8118e07a75eb6f3a2427a00ef4915d7
Merge "ve.test: Import K-JS test suite for object utilities"
ve.test: Import K-JS test suite for object utilities

We've housed these utilities for a while and changed some of
them quite a bit. Importing them to avoid regressions and
ensure we keep them in sync with our fork of it.

Removed references back through `@source`. They are sufficiently
different that the reference no longer adds any value.

Imported from https://github.com/Krinkle/K-js/blob/v0.1.2/test/K.test.js.

Change-Id: I9e71297246b7c248c1f032ba6b6ae1123519f3c1
Merge "Fix ContentBranchNode test broken by ve.ce.ProtectedNode"
Merge "Make .static.storeHtmlAttributes more versatile"
Fix ContentBranchNode test broken by ve.ce.ProtectedNode

Also make sure Jenkins actually runs that test suite

Change-Id: I72b10db3875370da95cb20e127ac8f1efee425bf
Make .static.storeHtmlAttributes more versatile

It now allows you to specify which attributes to preserve in various
ways rather than just setting true or false.

Removed unused factory methods that exposed the old value.

Change-Id: I914164adcf1f0e48fa3fa85277e68c72dbad393e
Localisation updates from http://translatewiki.net.

Change-Id: I8f74b7bce92ba91fce39387edc0307c6a753b929
Merge "ve.ce.FocusableNode: Fix documentation"
ve.ce.FocusableNode: Fix documentation

The constructor doesn't use any parameter named "$resizable".
And the one usage of it (ve.ce.ImageNode) doesn't pass any
arguments.

Follows-up 3fe3032.

Change-Id: I30530f4199a7c8383933be286b7b7a705c05c26c
ve.isMixedIn: Fix bugs and add unit tests

* It returned undefined instead of false if the subject
  didn't have a 'mixins' property. This is because '&&'
  is a DEFAULT operator, not an AND operator, it returns the
  value, not a boolean per se.
* The logic of traversing to the constructor property was
  broken since all objects in javascript have a constructor
  property, and functions/constructors are also objects.

Follows-up Ic3e4472b9e694.

Change-Id: I462e7ce270c8cfc7e1970e359894ee4b7d90b881
Merge "ve.ce.ProtectedNode"
ve.ce.ProtectedNode

Objective:

Generalize the shield and phantom magic, so we can use it for pretty much
any node we like. Usually this will be used with generated content nodes,
but also with aliens (of course) and possible other stuff in the future.

Bonus:

Also fixes a bug in DM that would crash VE when you selected to the end
and hit backspace.

Changes:

*.php
* Added links to files

aliens.html
* Added attributes to aliens to make them aliens again

ve.ce.AlienNode.js
* Moved shield and phantom functionality to ve.ce.ProtectedNode

ve.ce.AlienNode.js, ve.ce.MWReferenceListNode.js,
ve.ce.MWReferenceNode.js, ve.ce.MWTemplateNode.js
* Mixed in ve.ce.ProtectedNode

ve.ce.Node.css
* Reorganized styles and updated class names
* Added simple light blue hover with outline (using inset box shadow) for
  protected nodes, same style as before for aliens

ve.ce.Surface.css
* Moved phantom styles to ve.ce.Node.css

ve.ce.BranchNode.js
* Moved call to setLive(false) to happen before detach() so that the
  surface object is still available and events can be disconnected

ve.ce.BranchNode.js, ve.ce.Document.js, ve.ce.js, ve.ce.Surface.js, ve.ce.SurfaceObserver.js
* Adjusted CSS class names

ve.ce.Node.js
* Moved shield template to ve.ce.ProtectedNode

ve.ce.ProtectedNode.js
* New class, mix into another class to protect it from editing

ve.ce.RelocatableNode.js
* Renamed temporary surface property to relocatingSurface to avoid
  confusion when debugging

ve.ce.Surface.js
* Moved phantom template to ve.ce.ProtectedNode

ve.dm.Transaction.js
* Fixed bug where most of the internal list was being deleted when the
  end of the document was selected and the user pressed backspace

Change-Id: I2468b16e1ba6785ad298e38190e33493135719c3
Merge "Context menu in wrong place"
Context menu in wrong place

A bug in I4bad882d1d6fb83bcdcfd0de3bfc9af52960c2ff caused the vertical
position to sometimes be NaN, and thus make the context in the wrong
place (but only vertically).

Change-Id: I5216af5c432caaa0fb400d8d006647b9f2488619
Merge changes I5f279b06,I6116afa2

* changes:
  Configurable insertion annotations
  Fix insertion annotations
Configurable insertion annotations

This makes it possible to use a static property to configure whether an
annotation should be applied to content added after it. This makes it
possible to do this for normal style stuff, but not for links.

TODO: Inez is going to add IE support for this since it inverts the
problem where the UI gets out of sync in all non-IE browsers to now make
it so it only gets out of sync in IE.

Bug: 48171

Change-Id: I5f279b06b098960be7bd4ad3f5e6f74b67e31d1a
Fix insertion annotations

Now comparing annotations in surface to insertionAnnotations
by comparable object to trigger pawn trick. Adding annotations
correctly to placeholder.

dm.Surface change method now uses setInsertionAnnotations()
and passes the AnnotationSet from offset-1. The set is cloned.

Added ve.ce.Surface.areAnnotationsCorrect() to compare either
annotations to the left or right to the insertionAnnotations.

Also use compareTo() and getComparableAnnotations() rather than
comparing by name, and fix SurfaceFragment.annotateContent() to
actually be selective when clearing rather than clearing everything.

Change-Id: I6116afa2e176daa0a0f2103a551501426829e2a6
Localisation updates from http://translatewiki.net.

Change-Id: I2f5b38067c995de61c249abdfa64d394314afcce
Merge "Fix placement of whitespace when element ends in meta"
Merge "Use a smarter comparison of annotations when creating open/close tags"
Merge "Adjust binding to section edit links after changes in core"
Code style fixes

* "function(" -> "function ("
* "{String}" -> "{string}"
* collapse unintentional double spaces

Change-Id: I3ce3f02d1e31d4797b44e04d28457dec363be296
Merge "Hack MWTemplate so it also does partial type matches"
Merge "Force about grouping for multi-element about groups"
Localisation updates from http://translatewiki.net.

Change-Id: I7db778949f1e4dff4d780808c8c24601bf7ac74a
Use a smarter comparison of annotations when creating open/close tags

Currently we just compare by store index, but a bold annotation
with data-parsoid attributes set should merge with a new clean bold
annotation. Similar rules apply to link annotations.

Bug: 48110
Change-Id: I93586919002c78732228e08b134e67e1a94f8ad7
Hack MWTemplate so it also does partial type matches

For extension-specific types such as mw: , we require that all
types be matched. But we want MWTemplateNode to match
anything with an mw:Object/Template type, even if it also has
other types (like mw:WikiLink/Category in our test case).

Hack this into MWTemplate by matching on /^mw:/ then using
a matchFunction to assert that mw:Object/Template is in the
typeof attribute.

Update the test case. Because it's now a template, there's a bunch
of store stuff involved. Remove the other test case for about
group forcing because it's now a duplicate of this one.

Change-Id: Iacbe952a66d610c19b46bd76b84c50488857ac29
Force about grouping for multi-element about groups

When converting an element that starts an about group with at
least one other element in it, we now only consider models that
support about grouping. This prevents the first node from being
converted to something else and leaving the others hanging.

In practical terms, this means that elements like
<link rel="mw:WikiLink/Category" typeof="mw:Object/Template">
get alienated and pull in the rest of their about group, rather than
being converted to a category or alienMeta or whatever and
leaving the other elements to be converted normally.

Added a test case that asserts this. Really the result should be an
MWtemplate rather than an alien, but that's a separate issue.
Also removed superfluous mustMatchAll checks; we've already
filtered the array by the time we get there.

Change-Id: I522ba4c56d5bc52c7e9aab1e2535385540c1315d
Localisation updates from http://translatewiki.net.

Change-Id: I5bb2e690191dea436e6659ae7511f851a2e76f38
Adjust binding to section edit links after changes in core

Match the new .mw-editsection class, after core change I6a6c12a9.

Change-Id: I22daf7f9bc720b2be35695ca78c5603e80999986
Fix placement of whitespace when element ends in meta

This was broken for both normal elements, where the meta item is
inside the element, and wrapper paragraphs, where the meta item
gets moved outside the wrapper.

Bug: 47712
Change-Id: I42daaf142e548e5b221ff0a52df0ad24ec6a4fd0
Merge "Show message 'anoneditwarning' in notices when applicable"
Merge "Edit source tab should be 'selected' when... selected"
Update oldid on successful page save (if a new id is generated)

New ID is now passed from the API to the save event, to the onSave
handler. Empty diffs won't generate a newrevid.

Bug: 47420
Change-Id: I12ce27c8dc57f7aa753bcf5840635d5fea6b4e80
Edit source tab should be 'selected' when... selected

VE recreates the tab from scratch and deletes the old one
so as not to copy over access key settings. This fix
copies over classes from the old tab.

Bug: 47452
Change-Id: Ic2d42bb3034be25f388b587a00c3f523cfcc163c
Show message 'anoneditwarning' in notices when applicable

Currently this code is unreachable as line 27 of the hooks file
checks the user's options for 'visualeditor-enable' before allowing
VE to load. For testing just comment out that line.

Bug: 47842
Change-Id: Ib5c3284c646ebcc0a8cad0b02de559d7820e05a0
Merge "EventEmitter API cleanup"
Merge "RTL fix for VE's link widget"
EventEmitter API cleanup

The EventEmitter API we inherited from Node.js and then bastardized was
getting awkward and cumbersome. The number of uses of ve.bind was getting
out of control, and removing events meant caching the bound method in a
property. Many of the "features" of EventEmitter wasn't even being used,
some causing overhead, others just causing bloat. This change cleans up
how EventEmitter is used throughout the codebase.

The new event emitter API includes:
* emit - identical to the previous API, no longer throws an error if you
  emit error without a handler
* once - identical to the previous API, still introduces a wrapper* on -
  compatible with the previous API but has some new features
* off - identical to removeListener in the previous API
* connect - very similar to addListenerMethods but doesn't wrap callbacks
  in closures anymore
* disconnect - new, basically the opposite of addListenerMethods

Another change that is made in this commit is mixing in rather than
inheriting from EventEmitter.

Finally, there are changes throughout the codebase anywhere
connect/disconnect could be used.

Change-Id: Ic3085d39172a8a719ce7f036690f673e59848d3a
Merge "Localisation updates from http://translatewiki.net."
Localisation updates from http://translatewiki.net.

Change-Id: If66dac65058527d3a1b7299b6b28348f2af85d29
RTL fix for VE's link widget

The purpose is to flip the direction of the input inside
the link widget for RTL wikis, but flip it again to LTR
if the user inserts an external URL. This is my first VE
fix, I tried to follow conventions and avoid touching the
parent objects that are unrelated to URLs.

Bug: 47717
Change-Id: Ic13b9c3b155ce2979298cac9518c7419b9d45bac
GeneratedContentNodes store DOM elements, not HTML (like aliens)

To avoid serialisation bugs, and for consistency.

Change-Id: I02e202a2ab52c88da039349ec079bea55e000665
Merge "Localisation updates from http://translatewiki.net."
Localisation updates from http://translatewiki.net.

Change-Id: I19074dc7b902b2870438bb2e542d7c76e688e6b4
Merge "Make ve.ce.Surface.getSelectionRect() tollerate browser bugs"
Make ve.ce.Surface.getSelectionRect() tollerate browser bugs

.getClientRects() somestimes returns an empty collection which causes an
exception to be thrown by rangy. This corresponds to
.getBoundingDocumentRect() returning a hash full of zeroes.

Detect this and handle such ranges separately, by inserting dummy DOM
elements at the selection's beginning and end, then using their
position to determine where the actual selection was.

This behavior is seen sometimes in Opera, and in Chrome by using the link tool on text at the beginning of the document.

Bug: 47772
Change-Id: I4bad882d1d6fb83bcdcfd0de3bfc9af52960c2ff
Merge "Also respect .static.renderHtmlAttributes when rerendering for attribute changes"
Merge "When annotating, skip any branch nodes that are content"
Add support for <div>s as user-editable blocks

Bug: 47907
Change-Id: I794927a881082e0113c0ce8ee8f1d908b0960899
When annotating, skip any branch nodes that are content

We don't have these yet, but when we do, we'll need this

Change-Id: I1c2572f00fc0b9a144bb4092a44cd5af2bb752da
Also respect .static.renderHtmlAttributes when rerendering for attribute changes

Change-Id: I5baa41987e04cb0bee771d530f779df7e4fd86b2
Remove all code related to change markers

Specifically by looking for "data-ve-changed",
"ChangeMarker*" and internal.changed.

Various tests, test counters and unused variables also
affected.

Bug: 45061
Change-Id: Ibd1ee68e0d650979d40574eff9cebded1a28499f
Localisation updates from http://translatewiki.net.

Change-Id: I8fbb953b557967f568c33bcf62b4cfd1ea122461
Merge "docgen: Use new jsduck --color and --warnings-exit-nonzero option"
Merge "Allow merging of content nodes with nodes that can contain content (but are not content themself)"
Allow merging of content nodes with nodes that can contain content (but are not content themself)

This changeset addresses a problem of pressing backspace in empty list item in order to merge it with list item above it.

Change-Id: I598da6ef24de97b0a7a7bbab6c9ee775aaab460b
docgen: Use new jsduck --color and --warnings-exit-nonzero option

Change-Id: I8a0d8bb8ece598991b9fd1b85cf618463a950fed
Merge changes I5eafaa48,Ia8f23a37,I17534d67,If5ed1b64

* changes:
  Category editing
  Remove singular adding for ve.ui.GroupElement
  Implement ve.dm.Surface#truncateUndoStack
  ve.ui.LookupWidget
Merge "Make loading VE work on Opera again"
Merge "Move Phantoms onChange"
Merge "Fix range translation for surface fragments"
Move Phantoms onChange

Aliens now listen for surface model change events in order to
adjust the position of the phantoms.

Change-Id: I1e8bfba331a10678e9ca7e64b7818197237eb0a2
Category editing

Modifications:

VisualEditor.php
* Added links to new widgets

VisualEditor.i18n.php
* Added placeholder text for category input

ve.ui.Widget.css
* Added styles for new widgets

New:

ve.ui.MWMetaDialog.js
* Create category widget with categories from dm.
* Listen to metaList for insert and remove events
** insert / remove bound methods to be improved upon additional meta groups
* Add listeners to mwCategoryWidget for new categories and updates

ve.ui.MWCategoryWidget.js
* Top-level category editing widget

ve.ui.MWCategoryItemWidget.js
* Items within a category widget

ve.ui.MWCategoryInputWidget.js
* Input for new categories, handles menu and API requests

ve.ui.MWCategoryPopupWidget.js
* Mini-inspector for a category item

Bug: 39597
Change-Id: I5eafaa484a1924a566d3a1ee1d869293089d0ecf
Remove singular adding for ve.ui.GroupElement

By making the API for adding/removing/clearing always plural, it greatly
simplifies the interfaces and reduces function call overhead in most
situations.

Change-Id: Ia8f23a373a01a8f6d5081587a591563e4f25ea42
Implement ve.dm.Surface#truncateUndoStack

ve.dm.Surface.js
* Allow manual truncation of the undo stack to prevent redoing something
  that's been undone

Change-Id: I17534d6724fc2b325152cb2f665c6816f44232c1
ve.ui.LookupWidget

Refactoring of externally sourced suggestions for text inputs.

*.php
* Added links to new file

ve.ui.InputLabelWidget.js
* Changed to focus input element, not wrapper div

ve.ui.InputWidget.js
* Fixed incorrect documentation

ve.ui.LookupInputWidget.js
* New mixing that abstracts placing a menu of options below a text input
  and filling it with data from an external source

ve.ui.MenuWidget.js
* Fixed to get reference to input element, no wrapper div

ve.ui.MWLinkTargetInputWidget.js
* Moved pending and lookup functionality to mixing
* Implemented menu population using only matching pages, rather than a
  combination of that and page existence checks (fewer API calls)

ve.ui.TextInputMenuWidget.js
* Added configurable container to render underneath, rather than assuming
  this.input.$
* Added auto-position-on-window-resize functionality
* Fixed frame position correction to ensure that it only is used when the
  overlay is in a different frame from the container to position
  underneath

ve.ui.TextInputWidget.js
* Added placeholder text feature

Change-Id: If5ed1b64fd15982807691ce8bb0362970633108a
Fix range translation for surface fragments

Remove all manual changes to SF ranges as these are not
undoable. Instead change translate range to default to
outer expand and build functionality around that behaviour
never changing.

As translate range is always outer I don't think we need to
check for start and end crossing over?

Added more undo tests to assert these selections are maintained
properly, and added the test case to 'update' for when and undo
point is overwritten.

Insert content now results in a selection over the inserted
content. Most usages were expecting this anyway and were
followed up with an adjustRange(-length,0) which is no longer
necessary.

Noticed that the link inspector case was never being triggered
as word boundary was always expanding to at least one char (mainly
for Hanzi selection). This doesn't make much sense as single
spaces get auto selected so removed this functionality.

Split collapseRange out into collapseRangeToStart and
collapseRangeToEnd as this may be required to get the old
behaviour (range moves to end after insert).

Change-Id: I3dc0b4d00d37bad1ca3076a69b41c5f0b3fa0570
makeStaticLoader: Implement --write-file option

Takes a path as input, reads it in and replaces the
"Generated by" sections and writes it back to disk.
:
Change-Id: Idd68032ba5b621958a353582ea994acd0c4cfbd3
Declare dependency on jquery.client in ResouceLoader and static loader

Follows-up I90ea547c735edab and I004514ab761.

Change-Id: I18a34d47c40c1fa5a2305b86f3e1a066cf9dde2c
makeStaticLoader: Add ext.visualEditor.experimental to dependencies

Change-Id: Ia6b268e845365b4737487726e5bfb825e59fe1c3
Make loading VE work on Opera again

Once more, with feeling. The first reverted attempt was I90ea547c.

Detailed comments inside.

Change-Id: I1ab60665987614e5757e2b108d614b680321d8eb
Merge "Get back to where you once belonged"
Merge "ve.ce.Surface.getSelectionRect() might return null"
Merge "Fixed a comment"
Merge "Per Timo's comment, change $.makeArray( foo ) to foo.toArray()"
Per Timo's comment, change $.makeArray( foo ) to foo.toArray()

Change-Id: Ideee46640bc82f979578d5cc467c9c79d9806ae0
Merge "Fix ce.AlienNode"
Fix ce.AlienNode

Was completely broken after the dm.AlienNode changes

Change-Id: I3f5116d7dfbaa5889b7c5cac01d7341272749c58
Merge "Revert "Redo ve.createDocumentFromHTML() properly""
Merge "Use duck typing instead of instanceof Node"
Revert "Redo ve.createDocumentFromHTML() properly"

Completely breaks in Firefox

This reverts commit 7287c8029330cba8d89e7093be1c1c7963dced0a

Change-Id: I1c34842e156fd5668aac097ba6dd80201e54ecca
Use duck typing instead of instanceof Node

instanceof Node doesn't work with nodes generated by the iframe hack
for some reason. Instead, use duck typing by checking for a .cloneNode
method.

>>> ve.createDocumentFromHTML('<body><tt>Foo</tt></body>').body.childNodes[0]
<tt>Foo</tt>
>>> ve.createDocumentFromHTML('<body><tt>Foo</tt></body>').body.childNodes[0] instanceof Node
false

Change-Id: I1ea1253bd204d1070cd01b666b8a90f1cb7e5e14
(bug 47746) Fixing Phantom placement in RTL

CSSJanus flips left for right for RTL languages. To ensure proper positioning of phantoms, the phantom container must actually be set to left:0, not right:0. Added the @noflip option before the phantoms selector to prevent CSSJanus from modifying it.

Change-Id: Id7662362d117d6c5719b9b98d7a0dbf62e9ba3ff
Get back to where you once belonged

The toolbar has a high z-index when being floated, it doesn't need one
otherwise. This was causing an issue where the Vector actions drop-down
menu was being obscured.

Change-Id: I3c0ff7c4cf3b4a6c3d94f00ef56d7f299aeb6020
Merge "Fixed docs"
Merge "Create meta item for defaultsort"
Fixed docs

Wrong param type.
<pre> tags quoted to avoid jsduck warning.

Change-Id: Ieb9b5527ea69c8f02a175d29c1534290f85ba032
Localisation updates from http://translatewiki.net.

Change-Id: I5355846543cacf41656e05c3bdc45ad458dd4d49
makeStaticLoader: Fix trailing slash

Change-Id: Ic2b14aae725769957c203de7f4ce820fc2ee110f
makeStaticLoader: Implement --fixdir option

Currently when running this maintenance script it outputs
the full path to the i18n file. This was done that way because
of .docs/generate.sh (which pipes it to php through stdin).

This however means that currently the output is not suitable
for pasting into demo and test index files (as the path should
be relative for those).

The --fixdir option will function as toggle between a fixed
path to the directory on disk, or a dynamic resolution at
run-time. The default is the latter. generate.sh passes --fixdir.

Change-Id: Idebca553587aaff9b31255d884461f4a51e70afd
Create meta item for defaultsort

Bug: 46465
Change-Id: I604a79c25e5b0315f7e6437da657977b0efa77db
ve.ce.Surface.getSelectionRect() might return null

Protect against this. Also fix misnesting of updateDimensions()
function's body.

Change-Id: I5040d46d51bd59bf4d2fd7d4d8853c8675420ad0
Fixed a comment

Change-Id: I97917f70d42820105f6cdbaa3a1724cee3d6731b
Localisation updates from http://translatewiki.net.

Change-Id: I6338609aefffbbe2bbc6c7d317069e59d2a9a6f1
Fix new test case to use new domElements instead of html

This was missed by the merge as it doesn't cause any tests to fail (yet).

Change-Id: I6d106279d31276817ea718fdef3d8199b80693f6
Merge "Paragraph->heading conversion was broken when cursor next to an inline node"
Merge "AlienNode stores original DOM elements instead of HTML"
AlienNode stores original DOM elements instead of HTML

As jQuery hash problems in some cases converting HTML, it is
easier just to store the original DOM elements.

The bulk of this commit is fixing the tests as although we have an
assertion for comparing DOM elements, we don't have one for comparing
objects or arrays which may contain DOM elements.

ve.js
* copyObject & copyArray fixed to run cloneNode(true) on any item
  of type Node.
* Added callback function so an object/array can be copied with
  modifications.

ve.qunit.js
* Added deepEqualWithDomElements: Using the new copyObect/Array
  callback, we can copy the incoming object and convert any nodes
  to node summaries, then just run the normal deep equal comparison.

ve.dm.AlienNodes.js
* Instead of storing HMTL we store cloned DOM elements which we can
  send straight back to the converter without any processing.

ve.dm.example.js
* Updated tests to expect DOM elements instead of HTML.

ve.dm.Converter.test.js
* Updated tests to use deepEqualWithDomElements

Bug: 47737
Change-Id: I3df8f49b170c31da9610129d53cf8cb65dd5d5f8
Localisation updates from http://translatewiki.net.

Change-Id: I323d7b9d6f326ce1f99853a51a9e248d6828703c
Merge "Add a copy of jquery.client so the standalone still works"
Paragraph->heading conversion was broken when cursor next to an inline node

In this case, selectNodes() returns the paragraph, which is not a content
node, and so newFromContentBranchConversion() decides to do nothing at all.

This change makes newFromContentBranchConversion() more intelligent about
finding the content branch to operate on, fixing cases such as these
where selectNodes() returns the content branch itself rather than one of
its children.

Bug: 41203
Change-Id: I710fbf184ef5ef84d9c2f5bca2b115e0660f5b8f
Merge "Stop dropping properties in copyObject/copyArray"
Merge "Allow fixUpInsertion to move offsets when inserting at start/end"
Add Matma Rex to AUTHORS.txt

Matma Rex (Bartosz Dziewoński <matma.rex@gmail.com>) has done some useful
things for us and it's time to note him in the AUTHORS.txt file. :-)

Change-Id: I903437833e119e4f8eb89991cee1b9a0821954ce
Allow fixUpInsertion to move offsets when inserting at start/end

fixUpInsertion now returns an object with both data and offset
which allows offset changes.

Within fixUpInsertion we lazy-generate first/lastChildStack which
is a list of parent nodes for which the current node is the first/last
child. Whenever we try to close off a node we check these stacks and
if they are populated we instead use a recursive call to start
fixUpInsertion again but with the offset shifted by 1.

Bug: 46799

Change-Id: Ic51dd03725c11f1f7e279929534ee3afea14d662
Stop dropping properties in copyObject/copyArray

Previously, if we didn't know about a property type we would just drop it.
This led to various fixes to add support for booleans, nulls, etc. We're
now having problems again, this time with functions not being copied.

So instead of only copying types we know how to copy, deep clone the ones
we know how to and shallow copy the ones we don't know about. This seems
like a saner approach to me. Besides, it doesn't seem like cloning a
function is even possible in JS.

Change-Id: Idd1546ce3a43087a8b96a37101431e466e02f04f
Localisation updates from http://translatewiki.net.

Change-Id: I31dd15bacdd46bd0be299e99af6163dec72734d5
Add a copy of jquery.client so the standalone still works

The tests passed just fine in Gerrit, because it runs the tests via
MediaWiki using ResourceLoader, which was able to load jquery.client
just fine from MW core.

Change-Id: I004514ab761107b687be2fe1ff49ecfd25bead5b
Merge "UI Refactor"
UI Refactor

Changed:

VisualEditor.i18n.php
* Updated Link inspector i18n messages

ve.ui.MetaDialog.js -> ve.ui.PagedDialog
* Moved paging functionality into Paged dialog

ve.ui.EditorPanelLayout -> ve.ui.PagePanelLayout.js
* Renamed from EditorPanelLayout to work nicely with the concept of
  stacks and pages

ve.ui.GroupElement.js
* Added addItem method and change addItems to use it

ve.ui.Dialog.css
* Updated classname as per refactor of meta dialog

ve.ui.StackPanelLayout.js
* Set currentItem property on showItem
* In addItems method, show currentItem with class method
** rather display block on element

ve.ui.Layout.css
* Make editorPanel layout 100% in width.

ve.ui.Widget.css
* Added CategoryWidget and CategoryPopup styles
* Other adjustments

ve.ui.PopupWidget.js
* Added auto-close on loss of focus
* Made friendly with being initialized inside a frame

ve.ui.MWLinkTargetInputWidget.js
* Mixin ve.ui.PendingInputWidget and remove pending methods
* Prevent querying on spaces
* Reintroduce i18n messages for menu sections

ve.ui.MenuWidget.js
* Update cases of $input config property to input

New:

ve.ui.PagedDialog.js
* Refactored base-class for mwMeta dialog (and probably other dialogs
  too)
* Abstracts adding and accessing pages

ve.ui.PendingInputWidget.js
* Moved pushPending and popPending methods into pending class

Change-Id: I29bcd92b7b5641941a4e98e65b2a56424a5263ff
Merge "Add TableCaptionNode"
Merge "(bug 47711) Fix FF specific bug"
Add TableCaptionNode

Because we have a node for <table>, we also need one for <caption>,
otherwise we'll try to alienate it and fail.

Added the test case as a separate example document so Ed can use it
for his tests.

Removed test case asserting <caption> is alienated.

Change-Id: I3a917db58e6c0eb97899b214b07d01fc8d86b56d
(bug 47711) Fix FF specific bug

Firefox fires key press events for arrow keys - but we handle them
already in keydown - so the solution is to just ignore those
key presses in the handler.


Change-Id: I1aff295a0958b75697c4d362e0d6095283f37fe8
Merge "Redo ve.createDocumentFromHTML() properly"
Merge "Further AnnotationSet optimisation: create containsIndex"
Merge "Add method to ElementLinearData to get IVStore items in use"
Merge "Make clearing by type actually work"
Merge "Move feedback link to the right list of messages"
Merge "Deduplicate childUpdate events based on transaction and appliedness"
Deduplicate childUpdate events based on transaction and appliedness

Previously, they were only being deduplicated based on the transaction,
which meant that an undo was seen as a duplicate (but then if you undid
again, that wasn't a duplicate).

Change-Id: If432ea28e6c206a2ad5562e529e2d3ed808c20e4
Tolerate <!DOCTYPE>

Parsoid switched from <!doctype> to <!DOCTYPE>, which exposed the fact
that our dirty regex to detect whether we're dealing with a full
document or a fragment was case-sensitive. Made it case-insensitive.

Change-Id: Ia8a38488e06ca7d7a6fb9a9699b5d9b5c5eb03f2
Make clearing by type actually work

Clearing by type in SurfaceFragment didn't actually work. Instead,
it followed a code path intended for setting and created an annotation
of that type with no data, then tried to clear that. What we really
want to do there is clear anything with that type.

This fixes the bug where unbolding of text that was already bold in
the article didn't work.

Bug: 47680
Change-Id: I77f00e63c8732420063b0453fede7f453083c913
Merge "New static property - renderHtmlAttributes"
Merge "Initial support for MWBlockImageNode - thumb images with captions :-)"
Merge "Do not have ignoreHidden set to true"
Do not have ignoreHidden set to true

We're no longer doing dark-launch deployments for the VisualEditor
so this is unnecessary and a bit messy.

Bug: 42936
Change-Id: I0e55faca4eabe910d9b4d8ca8c6b4b0bd42e8539
Further AnnotationSet optimisation: create containsIndex

In most places we call .contains we already know the index, so we
can avoid store lookups by using .containsIndex.

Change-Id: I45a9a421473f9bec479ab8ccceceb162b7004c3a
Initial support for MWBlockImageNode - thumb images with captions :-)

Change-Id: I4d81533ed9193ff934333f7c1ad80e03e33b236c
New static property - renderHtmlAttributes

It is going to be used at least for figure tags for which Parsoid gives as a lot of CSS class names that are useless for rendering purpose

Change-Id: I4b1e8084a6b7ab5294e0c3cf153fc6cffb3e8dac
Add method to ElementLinearData to get IVStore items in use

This is minimise the amount of data we need to serialise when
sending this over the wire.

The minimal IVStore data is added to the MW bug report, and
editedData fixed to only return the data array, not the full
LinearData object.

Documentation in AnnotationSet has finally been updated to
refelect the fact that it only stores Annotations
(was previous the generic OrderedHashSet).

getAnnotationFromOffset has been split out into a function
that just returns this indexes so that in cases where we
don't need the values we don't do an unneccesary store lookup.

Bug: 47318

Change-Id: I4819cf06d1bd0ae4f8b896052e278ca75c9551bf
Merge "Performance improvement for getRenderedContents"
Performance improvement for getRenderedContents

Instead of calling $.append for every single char - buffer and call $.append only when really needed.

Change-Id: I53acfa795ea5dc6a8ca39ce11017daa85c9151d2
Merge "Remove fixUpStack to fix blank paragraph insertion bug"
Move feedback link to the right list of messages

Whoops, I'm a complete fool.

Change-Id: I05115473dbb9cbd3ad055f2477005a5fb92fd384
Remove fixUpStack to fix blank paragraph insertion bug

The fixUpStack is actually redundant code and closingStack
and openingStack handle all our cases. It was causing the
insertion to try to correct balance itself in the middle
of inserting two paragraphs, causing the creation on an
empty paragraph between them.

Added a test case for the fix and other cases to make
sure removing fixUpStack hasn't caused problems.

Bug: 46800

Change-Id: I35e54165709ac56e8116359a7c3b487eecf08ff7
Merge "Improve resizable node rendering"
Fix link inspector undefined madness

Reuse the existing internal link annotation builder instead of using a
constructor directly, and incorrectly (it's meant to be passed an
element, not an attributes object)

Change-Id: I4cda6a9c3442cb10ebbc0844630fedba403adc91
Improve resizable node rendering

* Only place them in a high z-index while resizing so they don't render
  above dialogs and menus
* Add resize transition

ve.ce.ImageNode.js
* Switch from element attributes to CSS for setting dimensions

ve.ce.Node.css
* Add resizing class for resizable nodes for z-index
* Add transitioning class for resizable nodes for transitions
* Switch from border to inset box-shadow to not affect handle position
  calculation

ve.ce.ResizableNode.js
* Add/remove resizing class while resizing
* Switch from using $image to $resiable to make the class useful for
  non-image node
* Enable transition and set new dimensions before transaction processing
  which will cause re-rendering)
* Delay transaction processing for resize until after transition is
  complete
* Add hiding of context menu on resize start

ve.ce.Surface.js
* Add getSurface method so we can get to the context menu

Change-Id: I4667e394d0af4a80b651c2a0f6d11d30e196bf60
Redo ve.createDocumentFromHTML() properly

Redone using document.implementation.createHTMLDocument instead of the
iframe trick. It's supported by all browsers we target, including IE9.

This also makes VE work on Opera using a nasty hack.
* Previously, for reasons I'm not even trying to understand, Opera
  would sometimes return an empty generic object from
  ve.createDocumentFromHTML() - but only if you weren't debugging it
  (Dragonfly was disabled). I have no idea what is it about the iframe
  hack that makes it not like it, but fact is, it doesn't work.
* Calling .open(), .write() or .close() on the document returned by
  document.implementation.createHTMLDocument acts as if it was
  window.document - that is, the entire contents of the web page are
  replaced with new ones. That's probably a one-word bug somewhere
  deep in Opera's innards; I reported it (it got the identifier
  DSK-384486). Until it gets fixed, we work around it by using
  document.documentElement.innerHTML, which works reliably.

Change-Id: I90ea547c735edaba9f7ecb8f685351ac6499c53e
Merge "Make the feedback link language-variable for release"
Make the feedback link language-variable for release

This involves setting some i18n messages for the target languages based on the
translations already provided - I hope this doesn't break anything for TWN but
the need for this only just became apparent; apologies!

Longer-term we will need to come up with a better way of doing this, if we are
keeping the in-VisualEditor feedback link around.

Change-Id: Id6ed80cdcd4314e84e75fb718421767162d73ef3
Hack to escape angle brackets in data-parsoid attribute

Parsoid is sending us some unescaped HTML in the data-parsoid
attribute. When we try to rebuild ref nodes (inline aliens)
this confuses Firefox which tries to sanitise the HTML by converting
<ref/> to <ref></span>.

As a temporary fix we can manually escape <>'s inside the
data-parsoid attribute.

Also in this commit the new MWReference nodes have been moved
to experimental as they are incomplete.

Bug: 47417
Change-Id: Ib6a0cfb880e769f28b42c9fa63ddc1abc75c399d
Merge "Link inspector fixes"
Link inspector fixes

ve.ce.Node.css
* Added prefixes for use of box-sizing

ve.ui.MWLinkInspector.js
* Whitespace

ve.ui.Inspector.css
* Corrected input width, always 100% wide now by using box-sizing

ve.ui.DialogButtonTool.js, ve.ui.Context.js
* Updated use of getViewsForNode

ve.ui.ViewRegistry.js
* Added inheritance-based prioritization for matching views with annotations and nodes

Bug: 47413

Change-Id: I286a28002c1691e58bbd7de04ed08cceb8b3bb07
Merge "Create and process transaction only if the value of given attribute (width or height) really changed"
Rename MWImageNode to MWInlineImageNode (get ready for adding MWBlockImageNode soon)

Change-Id: I617e2a17cb6fbd11e486c2981e361ae931ac1870
Merge "Mixin tracking"
Create and process transaction only if the value of given attribute (width or height) really changed

Change-Id: I4177478171e1d417634adb06f3bf74af0c77c15e
Merge "Selecting generated content with cursor keys"
Selecting generated content with cursor keys

Using left and right arrow key to move to and over an image will
select the entire node.

Bug: 37870
Bug: 38129
Change-Id: I70deadd2c2707149ea33e3b8ee42fb0d8508aacc
Localisation updates from http://translatewiki.net.

Change-Id: Ie342a495e66b207423ba3f6a8a84c53f3f172c92
Mixin tracking

Change-Id: Ic3e4472b9e69458f0797c17f72dbcd2ec5267893
ve.init.mw.ViewPageTarget: Account for serialize error

This is showing a separate need for refactoring. We call
"this.serialize( ..., callback )" but if it failed callback
is never called and an event is emitter for the error.

That makes it rather disconnected from each other.

In this case we're lucky that all calls to serialize are similar
in nature and need the same kind of error callback but other
wise this would be pretty messed up. It obviously needs to be
untangled and get rid of this akward eventemitter dance.

This doesn't fix bug 47581, but it does fix the "Infinite loader
with no error" problem as a result of it by handling the error
in a more intuitive way.

Bug: 47581
Change-Id: Icdf64a792c13a326f494e051be47f2946928d142
Merge "Added unit tests for getRelativeOffset method"
Refactor renderContents() deduplication code

Change-Id: Ib8672b51fc236cac805b88a99d07b3c496548cbd
Revert "Localisation updates from http://translatewiki.net."

Overwrites If598552fac639da645a8b1273c5fc6028695fcc1

This reverts commit d53bb3a578c1a339bae9f3fbb28ecd66597e031f

Change-Id: I2ab4f72058d3e42a3f380aaebdf1f9730c659a4a
Localisation updates from http://translatewiki.net.

Change-Id: Ie746cd3269a47233b43f6eed6bd825622a4890fc
Merge "Add menu icon"
Merge "ViewPageTarget: Refactor 'replace' tabLayout"
Merge "Add data model support for MediaWiki references"
Add data model support for MediaWiki references

So far just read-only.

Bug: 39599
Change-Id: I6daff5c5969e5fdc871f8f346cf790b4302ae080
Merge "Minor logic fix in ve.createDocumentFromHTML()"
Merge "Fix ve.ui.get$$'s handling of jQuery selection"
Minor logic fix in ve.createDocumentFromHTML()

iframe.contentDocument doesn't seem to have a key called 'document' at
all; I assume a different nesting was intended.

Change-Id: Ia37e3719d5247408bac2dfad1717d9193fb84c06
Merge "AnnotationSet optimisations."
Merge "MWTemplateNode should serialise original HTML if unchanged"
Added unit tests for getRelativeOffset method

Change-Id: I45538f3e698229c003097c84edceac7ae4e4eb05
MWTemplateNode should serialise original HTML if unchanged

To help the selective serialiser we can return the original
HTML for generated content if it is unmodified.

As the output of toDomElements now depends on changes
to the dataElement we now have a 'modify' function in
the some test cases.

We also now have 'storeItems' to assert that the index-value
store is correctly populated and for loading values back
into the store for toDomElements tests.

Also make 'mw' an attribute and remove 'about' property.

Bug: 47394
Change-Id: I2bbb5d2d6a90c4eb87fa129671112c92a9b931e7
Fix ve.ui.get$$'s handling of jQuery selection

Turns out, the context property of a jQuery selection isn't always
there.

For example:

$( 'body' ).context === document
$( '<div>' ).context === undefined

Even if you later attach that div, so long as you have the old
selection around, the cached `context` property won't magically be
updated. This makes sense (although it's poorly documented in the
jQuery API) but causes issues for us, and pretty much makes the
context property useless.

Instead, we can just use the standard `ownerDocument` property,
available on all DOM elements.

This change also add support for passing in a DOM element directly, in
addition to the existing support of passing jQuery or Document objects
in.

Change-Id: Ib8a31b74f2a4f455b1318be9f5c7805a2a193c79
ViewPageTarget: Refactor 'replace' tabLayout

The 'add' tabLayout path is pretty basic and up to date. The
older (now active again) tabLayout 'replace' was fairly outdated
and unmaintained.

Fixes:
* Attributes copied from the original (except for the 'id'
  attribute) were not actually beinged copied over because they
  don't exist on the ca-edit list item, but on the anchor link
  inside that list item.
* Clean up messages from the module registry that were unused.
  Keys 'accesskey-ca-edit' and 'tooltip-ca-edit' were also inexistant.
* Add message keys for tooltip and accesskey of editsource tab.

Depends on I0bde1a228983c58b in mediawiki/core.

Bug: 47396
Change-Id: If598552fac639da645a8b1273c5fc6028695fcc1
Factor the <pre> newline hack out of the converter into ve.properInnerHTML()

Also add detection for whether the browser is actually broken (most are,
but some, like Opera, aren't), treat <textarea> and <listing> in addition
to <pre>, and fix a bug where the function would crash if the <pre> was
empty (because .firstChild was undefined/null).

Change-Id: I541b57e9fd5c9c42d19d0a59f6e29fb43d35c9b6
Merge "The resurrection"
AnnotationSet optimisations.

addSet:
* Instead of indexing items in the store, just union the indexStore arrays

removeSet/removeNotInSet:
* difference or intersect the indexStore arrays

filter:
* push indices into the result set instead of values

simpleArrayUnion/Intersect/Difference have been created as utilities
in ve. They are prefixed 'simple' because they use object keys to
do fast in-array comparisons. This means they are limited to string
values or values which will compare as strings (e.g. numbers).

Change-Id: I079cbdfece4f6d80ec0afd61959913f13217fcb3
Add menu icon

Also fix reference icon class name

Change-Id: I3ace9644c74687047995f8c896d4133bbb59ede2
Merge "Move config vars that are global in nature to the startup module"
The resurrection

By removing the transaction listeners from surface fragments we
no longer have to make sure they are always manually destroyed.

In order to retain the functionality of having fragments update
with transactions elsewhere we keep a pointer to a place in the
new complete history stack in the surface. The complete history
stack records all transactions, even undone ones.

Whenever getRange is called we replay all transactions in the
complete history (in the correct order) since the fragment was
last updated.

Also in this commit:
* Updated Format/IndentationAction to test undo(). This increases
  coverage of surface fragment behaviour.
* .range is always accessed by .getRange now, although as an
  optimisation we can use the noCopy mode when we a sure the
  returned range will not be modified.
* Added undo test to .update (previously .onTransact)

Bug: 47343
Change-Id: I9e9818da1baa8319a3002f6d74fd1aad6732a8f5
Localisation updates from http://translatewiki.net.

Change-Id: I4e44b9415dd16b10b2354c0049e1cbfd53a137e5
Actually send oldid on POST like we promised Parsoid we would

VisualEditor did not send an oldid on POST so far, which disabled
selective serialization in production.

Bug: 47434
Change-Id: Ib1b7079a7fd3357903e5a14795ed0d2f2bdc5d16
Localisation updates from http://translatewiki.net.

Change-Id: I7b275fcf941ed4d07dd127216cff5bb92dffeb4d
Allow resizing nodes

Actually really resizing the image

Show bounding box on mouseover with 4 handles. Bounding box is resizable. Image resizes to match bounding box on mouse up.

Change-Id: I1f3dac64eb86dd1f258937e4915af101b3ac19d8
Allow node relocation

*.php
* Added links to new file

ve.ce.ImageNode.js
* Added relocatable node mixin
* Added $image reference to the actual img element, so if it's wrapped
  in a sub class the functionality in the parent class  doesn't break.
* Moved drag start event handling to relocatable node
* Removed drag end binding, not needed.

ve.ce.MWImageNode.js
* Moved addClass to initialization section of constructor.
* Copied 'view' data prop from image element to keep stuff working after
  the wrapping.

ve.ce.Node.css
* Switched to default (arrow) cursor for images.

ve.ce.RelocatableNode.js
* New mixing for nodes that should be relocatable
* Added implementation for drag start, which tells the surface to allow
  dragging this node.

ve.ce.Surface.js
* Added relocation support, which is used by relocatable nodes
* Split onDocumentDragDrop into onDocumentDragOver and onDocumentDrop
  which now have implementations that support relocation of nodes

ve.ui.Context.js
* Added relocation tracking to prevent context being shown while
  relocating

Change-Id: I8703adfb707af2c3224431afc3418356ac2c686c
Merge "Initialize iframe for dialog with correct doctype"
Improve two messages in English

Change-Id: I964ea73700ac9b6e621ec63536c30c9341667048
Move config vars that are global in nature to the startup module

If they're in the per-page config, we'll have to deal with caching
nightmares when changing them.

Change-Id: Ic8866500b1f20aee36c436dcc3d132c8fde0a8fc
Initialize iframe for dialog with correct doctype

Change-Id: I93bf12754b5c4d99e117c822d287015765651eb3
Separate experimental features out into a new module

Currently some issues, probably with loading nodes
after factories.

Toggled by global $wgVisualEditorEnableExperimentalCode.

Change-Id: Idab3dd68572c037289c6742d03fd327285110f67
Merge "Fix broken config for this.restoring"
Fix broken config for this.restoring

Current set up leaves us with restoring when we're not and vice
versa. Not good. :-) (Partial fix of change 59968.)

Change-Id: Ia33a2f3318cf2e46b7469b2c773e91c5ee8fdefa
Frame initialization exceptions

Don't call initialize inside the try-catch, it ends up sending exceptions thrown inside that method to /dev/null.

Change-Id: I8e0945f35c639ec156ee9a163b86fddfaed0ea7b
Don't show "Restore page" button when editing most recent version

Change-Id: Iaeb11e0d5323e0276e66fc4c994d705cde68411d
Merge "Fix whitespace preservation around meta items"
Fix bug in ContentBranchNode that caused renderContents to be called not enough

Change-Id: Idff61d405404eccb43c0f36cbfc7eba5af30bad9
Fix whitespace preservation around meta items

This was broken, especially in wrappers.

Changed the wrapping algorithm so that meta items are placed outside
wrappers if possible. On the left-hand side, this is already the case:
we don't open wrappers for meta items. On the right-hand side, this is
accomplished by buffering the meta items and only inserting them when
we encounter either real text (not whitespace) or the end of the wrapper.
If we're interrupted by real text, we insert the meta items with the
unmodified whitespace. If we're interrupted by the end of the wrapper,
we insert the meta items outside of the wrapper with whitespace stripped.

Internally, this is done by stripping the whitespace into the whitespace[0]
of the meta item to its right. Then when we output the meta items, we
either decide to 'restore' the whitespace, or to 'fixup' by also setting
whitespace[3] on the element before the whitespace.

Change-Id: Ibeea2a9906c4aae9fe6d284613edd6ec853ca5e7
Merge "Allow node focusing"
UI "Views" refactor

Objective:

Make it possible for inspectors to inspect nodes or annotations, rather
than only annotations. Meanwhile, also make it possible for dialogs to
edit an annotation.

Strategy:

Switch from using type patterns to associate inspectors with annotations
to using arrays of classes, similar to how dialogs already work.
Introduce a view registry which provides lookups for relationships
between models and views. This is more centralized and less repetitive
than implement matching functions for both annotations and nodes in both
the dialog and inspector factories.

Changes:

*.php
* Added links to new file

ve.AnnotationAction.js
* Removed unused parameter to filter annotations using a string or regexp

ve.dm.AnnotationSet.js
* Switched from property/value arguments to callbacks

ve.ui.*(Dialog|Inspector).js
* Replaced type patterns with class lists
* Added class to view registry

ve.ui.*Tool.js, ve.ui.Context.js
* Updated model/view relationship lookup

ve.ui.*Factory.js
* Removed overly-specific lookup functions

ve.ui.Inspector.js
* Removed typePattern property
* Updated model/view relationship lookup

ve.ui.ViewRegistry.js
* New class!
* Migrated node and annotation lookup functions from factories

Change-Id: Ic2bbcf072fdd87e5ce8a03fe1ae3e6d8d50e2593
Merge "Updated rangy from 1.2.2 to 1.3alpha.772"
Merge "ve.ui.SelectWidget: Keep track of mouse down"
Merge "Simplified iframe initialization"
Merge "Actually pass oldid parameter when serializing"
Merge "Remove html/* attributes in getClonedElement()"
Merge "Make the AnnotationSet constructor take an array of indexes"
Merge changes I7b0e3fa4,I559232f3

* changes:
  ve.init.mw.ViewPageTarget: Put the Edit source link in the visible tab area
  ve.init.mw.ViewPageTarget: Switch tabLayout from 'add' to 'replace'
Merge "Added inline comment explaining not obvious purpose of code"
Merge "Death and/or destruction"
Allow node focusing

*.php
* Added links to new file

ve.ce.ImageNode.js
* Added focusable node mixin

ve.ce.FocusableNode.js
* New class!
* Adds isFocused and setFocused methods
* When a node is focused or blurred, 'focus' and 'blur' events are emitted
* While a node is focused, it will have the 've-ce-node-focused' class added to it's this.$

ve.ce.Surface.js
* Add detection of node focusing and setting focus and blur on nodes on change

Change-Id: I3f1ad6309571f2bfe568550e2e8f1bd5a0302085
Added inline comment explaining not obvious purpose of code

Change-Id: Ib9ea1307ebe58c03abd00dcf8b96681d6901a3d4
Merge "Transactions to store metadata merge info when present"
Merge "Avoid rendering content of ve.ce.ContentBranchNode multiple times when only one transaction is applied"
Make the AnnotationSet constructor take an array of indexes

Before, it took an array of objects and translated those to indexes
using the store. Literally every caller outside of the test suite got
an array of indexes from the linear model, translated those to objects,
then passed them into the AnnotationSet constructor which translated
them right back to indexes.

The previous behavior was kind of ridiculous on its face, but the
reason we found it is because Inez was investigating the performance
degradation when bolding a line and found that half of it was due
to the hundreds of ve.getHash() calls caused by this behavior.

Change-Id: I38df8ae9f6392849dacf477ea2f804283c964417
Remove html/* attributes in getClonedElement()

Subbu said that cloning of attributes like data-parsoid or typeof would
cause problems for Parsoid.

Also remove the attributes object if it becomes empty, and do the same
for the internal object.

Bug: 47297
Change-Id: I428becf95c70d0ed8af5b0c408e3966dc47fd8c3
Merge "Delete spurious normalizedHtml"
Merge "When we say originalHtml, we'd better mean it"
When we say originalHtml, we'd better mean it

Gabriel noticed whitespace diffs in the problem reports. These were
caused by browsers' .innerHTML being broken on <pre>s. We compensate
for this in the converter, but not when generating originalHtml.

However, a variable called originalHtml really shouldn't be generated,
it should just literally be the original, unprocessed HTML. This
does mean it includes the doctype, <html> and <head> which aren't
included in editedHtml (that one's just the contents of the <body>), but
that's much easier to deal with on Parsoid's end than random newline
diffs all over the place.

Change-Id: I8e66cb79887f49f84114ab6b4d0e0d24aea744b6
Merge "Serialize alienated context-sensitive nodes correctly"
Merge "Fix a weird whitespace stripping bug"
Serialize alienated context-sensitive nodes correctly

Context-sensitive nodes are HTML elements like <caption> that can only
appear in certain contexts (<table> in this case). This means that
serializing them by throwing them in a <div> and calling .innerHTML
fails, because the browser knows a <caption> can't be in a <div> and
unwraps it. jQuery's .html() function is clever though and knows to wrap
<caption> in a <table> (and has similar rules for other elements).
So use jQuery's .html() rather than manual .innerHTML stuff.

Change-Id: Id7d3eff968b3a2ba345680772f7cc32e3dcdb529
Delete spurious normalizedHtml

Was equal to the HTML before conversion, so not needed

Change-Id: I48e3b3d48334562f605bccfddc5f2aa7cf883087
Merge "Partly fix the "Report problem" button"
Fix a weird whitespace stripping bug

In HTML like <td>Foo <b>Bar</b></td>, the space would be stripped and
registered as trailing whitespace in the <td>, so it wouldn't be visible
in the editor and would be inserted after the </b> on the way out.

Thanks to Subbu for reporting this. This case was kind of ridiculous and
we're lucky the JRuby article contained it. To trigger the bug, you had
to have:
* a table cell
* containing unwrapped content
* consisting of
** some text
** whitespace
** open annotation (bold in my example, link in Subbu's case)
** text
** close annotation
** and nothing else

Change-Id: I2b83f02764b311a32a50956d4c8930a9394e91a4
Partly fix the "Report problem" button

This was broken ever since the introduction of IndexValueStore, because
the call to getDataFromDom() wasn't updated, so it crashed with a "doc
is undefined" error. Fixing part of this by passing in a new IVStore.

The data that is transmitted over the wire still has indices with no way
to find out what the corresponding annotations are. It needs to be fully
expanded but there's no way to do this in DM quite yet.

Bug: 47319
Change-Id: I761523d22e51ac560e37ae991d01a6b84224ca40
Updated rangy from 1.2.2 to 1.3alpha.772

This gets us some new functionality, mainly the ability to get a position
from a point on screen.

Changes:

* Updated core and position
* Removed unused modules

Change-Id: I2145fe549c975fdbbcd7dfcf144afb26509d0050
Fix missing global in 116321afe5fd19d02fe89f82e62cda80c13dda8f

Change-Id: Ia76ce0cdd3fed3de1829ae397f1ab3cf3686d8dc
Avoid rendering content of ve.ce.ContentBranchNode multiple times when only one transaction is applied

Change-Id: I940bb96b670afb7ab3de524919b56912d027a2ef
ve.init.mw.ViewPageTarget: Put the Edit source link in the visible tab area

Instead of in the collapsed section.

Change-Id: I7b0e3fa4e35ce6135e3a47360da51fd8e0231ca1
Make the "Report problem" POST URL configurable

Defaults to "$wgVisualEditorParsoidURL/_bugs/"

Change-Id: I4847d54b0effe433d5d179d91fdf361c249515ad
ve.ui.SelectWidget: Keep track of mouse down

This helps with some differences between browsers, specifically Firefox,
where e.which would be "1" even if the mouse button was not pressed.

Change-Id: Ia88449c2bc84073d903dc702bb586127618d86f2
Actually pass oldid parameter when serializing

Apparently Parsoid has always required this, and we've never sent it,
yet somehow the code in production works. This may well be the cause
of some of the selser issues we saw after the deployment attempt in
January.

Made oldid a required parameter in the API module, and default it to 0.
When we get 0, we translate that to the empty string for Parsoid's
benefit. We also need to explicitly get wgCurRevisionId in
ViewPageTarget, and that's also 0 on new pages.

Change-Id: I3a55025246014cd74e15d6d5b6c4ede7b823e5df
Whitespace preservation was broken after the first run

The first run of getDomFromData() would preserve whitespace just fine,
but it blanked out the .veInternal.whitespace[1] element in certain
cases, contaminating the linear model and making the whitespace data
inconsistent. Subsequent runs of getDomFromData() would then refuse to
serialize that whitespace because the information about it was
inconsistent.

In getDomFromData(), we sometimes unset .veInternal.whitespace[1] (i.e.
set it to undefined) to prevent double processing. Because we're
potentially going to modify .veInternal, don't assign it by reference,
but copy the object.

Added tests asserting that the linear model is unchanged after calling
getDomFromData(), because that function should never modify
linear model data. This test failed in 4 cases (all whitespace-related)
before I added the copyObject() call.

Bug: 43543
Change-Id: Ic4c93510518163894201a693ab50331413715967
ve.init.mw.ViewPageTarget: Switch tabLayout from 'add' to 'replace'

This makes the Edit tab point to the VisualEditor, and adds a
"Edit source" link to the p-cactions menu.

Bug: 46872
Change-Id: I559232f3d8e42df0d45311b65df8c30425b1a368
Merge "Inside ve.ce.Document.getRelativeOffset fallback to 'character' mode if 'word' mode returns the same offset as was passed originally"
Transactions to store metadata merge info when present

ve.dm.Transaction
* Replace operations are now built directly from the
  linear model and automatically determine what metadata
  replace information they need to include:
** retainMetadata
** replaceMetadata
** insertMetadata

ve.dm.Document
* Metadata array created empty and padded out after data parsing
  as we are no longer using Document.spliceData to build it (a new
  test checks for correct metadata length)
* spliceData replaced with getMetadataReplace, which instead returns
  transactional steps of spliceData (retain, replace, insert)

ve.dm.MetaLinearData
* Add function for merging metadata items together. Only used
  once in the code (Document.getMetadataReplace) but useful
  for generating test data.

ve.dm.MetaList
* Replace operations with metadata need to calculate new offset
  and indices directly, but can't be applied immediately lest they
  put a metaItem out of place and affect findItem.

ve.dm.MetaItem
* Add methods to support queued moves as required by MetaList

Test files
* Updated to match new pushReplace API
* Remove any instances of Document.spliceData
* Extra check on sparse metadata array length
* Rewrite spliceData tests as getMetadataReplace tests
* Count expected cases in Transaction(Processor) tests

Bug: 46954
Change-Id: I4edad1c2dd37c723bff2792bab7d694ef17a86dc
Inside ve.ce.Document.getRelativeOffset fallback to 'character' mode if 'word' mode returns the same offset as was passed originally

Change-Id: Ia3de5d5c1f37f17161fb1c8c9a284c868bb4a5fb
Simplified iframe initialization

Rather than attach a function to the window and trigger it from a script
tag in the document body, it's much simpler to just use the references
we already have to execute the code immediately and directly.

This also fixes issues in Firefox where reaching in and adding functions
to the window wasn't allowed.

Change-Id: If7a84edf6ae4549b19ce36a3477311c46dbadea7
Localisation updates from http://translatewiki.net.

Change-Id: If48c12717c23a0e05122f9912118eddd1b4f03c9
Merge "There was no check if anchorNode of selection range is inside an element with CSS class ve-ce-slug."
Merge "Make returning the same offset the least preferred option in ve.ce.Document.getRelativeOffset"
Merge "Fix annotation breakage"
Fix annotation breakage

Inez reported that unitalicizing from the toolbar was broken, because
the toolbar was somehow generating annotations that had .attributes={}
as opposed to .attributes=undefined. Turned out the cause was in the
default value for element in the ve.dm.Model constructor.

Change-Id: I64ea9ef56cd15d1131c1aa23484d7420c95a8225
docgen: Disable parallel processing, suspected cause of Ruby segfaults

Change-Id: Icdf92b4c0aed27f7bfc5d37c6abeedf60a2b7f27
Make returning the same offset the least preferred option in ve.ce.Document.getRelativeOffset

Change-Id: If21cdea220b58aec92b8735e92f594d8c16c8f6f
There was no check if anchorNode of selection range is inside an element with CSS class ve-ce-slug.

Adding that check let me simplify logic around a little bit as well.

Bug: 47258

Change-Id: I51bf5e9caecf6a8b4e0f75118a93cfe69a5a6542
Localisation updates from http://translatewiki.net.

Change-Id: I43d68d92b1a36f3832881391932bb8b2cc157f8b
Merge "Filter our zero-coverage updateState nodes"
Merge "TransactionProcessor: Fix offset bug"
Filter our zero-coverage updateState nodes

Added filter for nodes being passed to update state event - this
ensures that nodes are not being included with zero-length coverage, a
side effect of how selectNodes handles the virtual boundaries of text
nodes.

Change-Id: I6362114b57469b1108da11f94dc345a2bcdfc7cd
Hybridise MWTemplateNode

* Create MWTemplateBlockNode & MWTemplateInlineNode (in ce and dm)
* Move Alien's 'isInline' code to ve.dm.Node.static.isHybridInline
* Move definition of ce.AlienBlock/InlineNode inside ce.Aline.js file
  to match dm.AlienBlock/InlineNode and MWTemplate
* Duplicate AlienBlock/Inline styles for templates
* Create test case for inline templates
* Count test cases in ve.dm.Converter.test.js automatically

Change-Id: Id9bc7f049ea974dd5e7f8b7a66080939e0948bbd
Merge "Have ce's ctrl+arrow functionality use UnicodeJS library"
JSHint: Re-order jshintrc options to split common from project settings

Per I43ace21208 and https://www.mediawiki.org/wiki/CC/JS#Linting

Change-Id: I280d377071ca1244130cd976aeba11d2152ef923
TransactionProcessor: Fix offset bug

Use ve.BranchNode.getNodeFromOffset instead of
ve.dm.Document.getNodeFromOffset so correct nodes will be retrieved to
emit update events to.


Change-Id: Iaf559f0424584a3dde065e548e403c4a53207312
Merge "Create MWTemplateNode"
Localisation updates from http://translatewiki.net.

Change-Id: Ifd24a43489b8921e3c1e85f61718351e6c021e07
Have ce's ctrl+arrow functionality use UnicodeJS library

Change 57076 implemented the functionality required to skip
words in UnicodeJS. This change simply removes all the existing
code we had and replaces it with this implementation.

Bug: 46794
Change-Id: I6b2700d65476c4d34ba4a01a88382d7af8e736fb
Create MWTemplateNode

This node stores the rendered in the index-value store, hashed on
a custom hash of the dm (type + mw) which makes it unique it its
parameters.

Bug: 46571
Change-Id: I0ab4c9f7bca207121d5b42e83c821771b6139da8
Allow nodes to handle their own children

For data->DOM, this is easy: .toDataElements() can optionally return an
array instead of an object, and that will be treated as the data to
insert. If this happens, the converter won't descend. The node handler
can recursively invoke the converter if it needs to (although I suspect
the current implementation is broken when converting block content in an
inline context).

For DOM->data, this is a bit more complex. The node sets
.static.handlesOwnChildren = true; , which triggers the converter to
pass a data slice rather than a single data element, and not to
descend. The node handler can invoke the converter to recursively
convert DOM subtrees to data.

ve.dm.Converter (data->DOM):
* Renamed createDataElement() to createDataElements()
** .toDataElement() may return element or array, handle this
* Renamed childDataElement to childDataElements, is now an array
* Actually alienate if .toDataElement() returns null
** Shockingly, this claimed to be supported before but wasn't
* Rather than pushing to data, concat to it
** Add closing if needed
* Don't descend if .toDataElement() returned an array of length >1, or
  if the node has .handlesOwnChildren = true

ve.dm.Converter (DOM->data):
* Split getDomSubtreeFromData() and getDomFromData()
* When converting a node that handles its own children, pass in a data
  slice and skip over that data

Change-Id: I196cb4c0895cbf0b428a189adb61b56565573ab3
Merge "Fixes to DM metaList stuff under Roan's guidance."
Fixes to DM metaList stuff under Roan's guidance.

Splitting this out of https://gerrit.wikimedia.org/r/#/c/58274

Change-Id: Ic90b9714959e1cfb0c18997e2f2b593ed9909990
Merge "Allow hybrids across Model subclasses"
Merge "Pass the converter object to the node handler in toDataElement()"
Merge "Make getDataFromDomRecursion() use a context stack to pass context info"
Localisation updates from http://translatewiki.net.

Change-Id: I1e2e270822c7c9eefe8a2ae182ae63e992bfde8e
Allow hybrids across Model subclasses

A node could already implement a toDataElements() function that
returns a data element of another node type, but it couldn't return
an annotation or a meta item. This is fixed now, and any dm.Model
subclass can now morph into any other dm.Model subclass.

I didn't originally plan to do this today at all, but doing this now
makes my upcoming converter changes easier. Surprise feature!

Change-Id: Ief6ac302094df084221a5a97c32a522b929c2960
Pass the converter object to the node handler in toDataElement()

This will allow node handlers to recursively invoke getDataFromDomRecursion()

Change-Id: I12cd4b31614a549bfbe8fbdc7d0607ece32aa98a
Make getDataFromDomRecursion() use a context stack to pass context info

This will allow toDataElement() functions to just call this function
with a DOM element, rather than having to have all the recursion context
data to pass in.

Also expose this information using getters.

Change-Id: I89574c42385267e08704f018c0892d63014376a6
Merge "Image node refactor"
Image node refactor

ve.ce.ImageNode.js
* Moved in generic stuff from MWImageNode
* Added drag end handler (empty, will be used soon)

ve.ce.MWImageNode.js
* Changed to inherit ImageNode
* Moved generic stuff out

ve.dm.ImageNode.js
* Added attribute extraction/preservation for src, width and height

ve.dm.MWImageNode.js
* Changed to inherit ImageNode
* Re-using ImageNode's attribute handling to extract/preserve attributes on both the image and wrapper level

Change-Id: Ied4e1ece24e6804220eac35330790f7084df55de
Revert "Localisation updates from http://translatewiki.net."

Overwrites Iededbc54b287328b3047b05efad6ca3cc152caa5

This reverts commit 96614883bbaf8710605959c262c7a12687a8e08e

Change-Id: I5f55f0241427965d33a8205d891c05230fc5f55e
Localisation updates from http://translatewiki.net.

Change-Id: Ie1b9b1d917924f78544b88a2c06a1e848da924c1
Dialog button changes

ve.ui.MetaDialog.js
* Added scrolling to outline panel

ve.ui.css
* Added reusable animation keyframes

ve.ui.Dialog.css
* Changed dialog head style
* Changed dialog cancel button to close icon button
* Added animation of dialog opening
* Increased min-height of dialog to always show a little content

ve.ui.Icons-*.css
* Added close icon (not sure why it was missing)

ve.ui.Window.css
* Moved head padding out of window and into implementations of window

ve.ui.Dialog.js
* Moved apply button to footer
* Renamed cancel button to close button
* Overrode close method with triggers a closing animation and then calls the parent close method after an animation is complete
* Added classes to close and apply buttons to make styling less ambiguous
* Converted cancel button (now the close button) to an icon button

ve.ui.Window.js
* Added footer to dialog

VisualEditor*.php
* Added close message

Change-Id: Iededbc54b287328b3047b05efad6ca3cc152caa5
No more confusing boolean argument for closing windows

window.close( true ) thing sucked, and was being named and used
inconsistently throughout the code.

The new approach uses an action string, so it looks more like
window.close( 'accept' ) or window.close( 'back' ). This makes it easy
to steer the behavior at any point in the window close code path.

Most importantly for the link inspector, this allows us to now restore
the previous selection when the user presses escape or clicks the back
button, while still moving the cursor to the end and collapsing the
selection upon pressing enter and allowing removal by clicking the
trash can.

This commit also cleans some things up, like the various ways we have
to close an inspector which all seem useless because we wouldn't want
to just randomly close an inspector on someone. An inspector should
be closed only when the user has dealt with it.

ve.InspectorAction.js
* Removed close method

ve.ui.LinkInspector.js
* Updated documentation
* Passing action to parent method
* Updated logic to deal with change from "remove" to "action" argument
* Added selection restauration on "back" action

ve.ui.Context.js
* Added action to call to close
* Removed closeInspector method

ve.ui.Dialog.js
* Moved event handlers to the top
* Added actions to calls to close
* Added click block event handler to prevent focus changes

ve.ui.Inspector.js
* Added actions to calls to close
* Added storing of previous selection - this is different from
  initialSelection because it's captured before the selection is
  modified by setup

ve.ui.Window.js
* Updated documentation
* Updated argument name from "remove" to "action"

ve.ui.WindowSet.js
* Updated documentation
* Removed auto-close, replaced it with error if trying to open a window
  when another is already open
* Removed close method

Change-Id: Ie8f72504177dd6ba169fdddbb776fd5397b831c4
Create GeneratedContentNode which can store rendered HTML in IV store

AlienNode is now a subclass of GCNode, but doesn't use the IV store yet.

Bug: 46571
Change-Id: If0717afdf557a2aa681d1bae3a6e98299631091a
Merge "Fix 404 on iframe styles by standardizing get and set modules methods."
Fix 404 on iframe styles by standardizing get and set modules methods.

Change-Id: Iebc2a9fc7db00d661f685c28dbc345fb561bb15e
Merge "Added icon for reference, switched from category to tag icons"
Actually use the doc parameter in toDomElements()

It's been passed in for a while, but nothing ever used it. As we know
some browsers don't like it when we create elements in the wrong
document, and this ensures we always use the correct document for
createElement().

Change-Id: Ia3d2fabe0516956105ad2b5625ed2f76c015c26e
Merge "Clickable inline images"
Merge "Reduce code duplication for annotation rendering"
Merge "Prevent IE from editing ce="false""
Reduce code duplication for annotation rendering

ve.dm.Converter and ve.ce.ContentBranchNode were duplicating a fair bit
of logic for annotation rendering. Moved the annotation opening and
closing logic into ve.dm.Converter.openAndCloseAnnotations, and
implemented both annotation rendering code paths in terms of that
function with callbacks for caller-specific behavior.

Change-Id: I7cba7d2fda7002287b07949a1b8120ba80bfe854
Merge "Convert AnnotationFactory and MetaItemFactory to NamedClassFactories"
Merge "Rename ve.NodeFactory to ve.NamedClassFactory"
Merge "Add ve.ce.View as a common base class for ce.Node and ce.Annotation"
Added icon for reference, switched from category to tag icons

Change-Id: I15e988eebd4d10f07e60895e9a14f87f4af9e7ea
Merge "Implement next/prevBreakOffset and word skipping"
Implement next/prevBreakOffset and word skipping

This provides the functionality for keyboard word skipping
(i.e. pressing ctrl/alt + arrow key).

Bug: 46794
Change-Id: Ib0861fa075df805410717a148b8a6e166d947849
Convert AnnotationFactory and MetaItemFactory to NamedClassFactories

Change-Id: Ic6e3a336050a335c88ef41735c0f4e470c5b75b6
Rename ve.NodeFactory to ve.NamedClassFactory

We weren't really using it exclusively for nodes any more, and the only
functionality in there was for using .static.name

Change-Id: Ie26928cd01faee95a10912201663b45f1f20fb19
Add ve.ce.View as a common base class for ce.Node and ce.Annotation

Just like ve.dm.Model is a common base class for dm.Node, dm.Annotation
and dm.MetaItem.

ce.View abstracts the this.model and this.$ behavior, including liveness,
whitelisted HTML attribute rendering and adding a back reference in
.data(). The back reference has been renamed from .data( 'node' ) to
the more generic .data( 'view' ).

At this point this means ce.Annotation is just a shell around ce.View
(except where it defaults to a span rather than a div), but that could
change in the future.

Change-Id: I0eef5b80718e0b0fcd3f8bba096b452f0bb680d0
Move common Node/Annotation/MetaItem code into ve.dm.Model

ve.dm.Model is now the common base class for these three. ve.dm.Node
inherited from ve.Node before, so it now uses it as a mixin instead.
This required changing ve.Node's usage of ve.EventEmitter from
inhertiance to a mixin as well, because inherited methods apparently
don't get mixed in correctly.

* Change annotation terminology from linmodAnnotation to element for
  consistency with Node, MetaItem and Model
* Reimplement getClonedElement() in Node for .internal treatment

Change-Id: Ifd3922af23557c0b0f8984d36b31c8a1e2ec497e
Merge "Fix MetaList tests, were totally broken"
Merge "Fix a bug where trimOuterSpaceFromRange() didn't trim an all-whitespace range"
Merge "Fix ModelRegistry bugs"
Fix MetaList tests, were totally broken

They worked fine with just one group, but once Rob added a second group
everything came falling down.

* Index the return value of findItem() into the correct array
  (list.items for all, list.groups[groupname] for groups)
* Expect null if there is something at the coordinates but it's in the
  wrong group
* Keep track of the next index and expect that for forInsertion when
  findItem() returned null, as well as at the end of each offset

Change-Id: I76438f583cea5694ce04fa2f4e7e88f8f8f236d1
Merge "Great Annotation Refactor of 2013"
Be resilient against an unset hrefPrefix in MWCategoryMetaItem

(or any unset attribute for that matter)

Change-Id: I59364354c64fbce016090e17aa9683ec0a0fea9b
Fix ModelRegistry bugs

* In matchTypeRegExps(), skip string types
** Didn't break because we currently have mixes of strings and regexes
* Combine types from rel, typeof and property rather than picking one
** Added test case in ve.dm.example that resembles actual Parsoid output
* If the element has extension-specific types, not only restrict type
  matching to extension-specific types, but also require that *all* types
  present on the element be matched

Change-Id: Iacf3851a0ca9081d2c813b42435484a47cec6230
Clickable inline images

Clicking an inline image will select it, or expand the selection.

Change-Id: I505665f2dac2e52140cc049e63e3355190dcbfec
Prevent IE from editing ce="false"

This is a redux of logic already in master.
Moved from keydown to keypress because IE
fires keydown multiple times for held keys.
Changed the logic to determine that the current
offset is just after an element that should not be
directly edited.

Change-Id: I5206d8919abde740d92f636b0c8618c4ebb6f6ff
Fix for custom hash with keys in different order

Instead of returning val when a custom hash is found,
feed it back into val and let the object sorting take
place if required.

Bug: 46895
Change-Id: I6a9b42facd97fbf49042d3a082121ec93659b9f1
Change custom .getHash functions to .getHashObject

As described in the bug, ve.getHash performs JSON.stringify so to
customise a hash the object should just return an object to be
hashed, not the hash string itself.

Bug: 46895
Change-Id: If11071d4b04a01e25102ffb57240882f650ee10d
Merge "Support loading stylesheets into frames from different locations"
Support loading stylesheets into frames from different locations

This is one of the blockers for splitting VE up into separate
repositories or extending VE with an extension.

ve.ui.Frame.js

  It's critical that we don't emit initialize from ve.ui.Frame until
  it's completely loaded, especially its styles, because we will
  begin measuring it straight away.

  Involved loading the stylesheets using $.ajax and setting base
  URL of the iframe to the ve.ui styles directory so all the image
  URLs still worked. This won't work for stylesheets from multiple
  locations, so we needed a more robust solution.

  The new solution uses some trickery described in the code
  documentation, but essentially no longer depends on all
  stylesheets being located in the same folder.

ve.ui.Dialog.js, ve.ui.Inspector.js, ve.ui.Window.js

  Static methods are now being used to extend a window class to
  include different stylesheets rather than simple array
  concatenation.

Change-Id: I619238732f975d41305f81f8f818a577a40f49da
Localisation updates from http://translatewiki.net.

Change-Id: I35da34be26ff883143802d73c83af3083ad3c100
Localisation updates from http://translatewiki.net.

Change-Id: I62770f638377f21bb7b701f08feebc78ecaf0a57
Merge "Quick fix for IE typing after generated content"
Quick fix for IE typing after generated content

The previous check was incorrect and was setting selection
too often.

Change-Id: I1ac393c149b6f814949b84e47faa04906c94f6af
Localisation updates from http://translatewiki.net.

Change-Id: I4a080a31c5102cea5b14b05e89d93db6a7c12bb9
Media dialog support

*/index.php
* Added links to new files

VisualEditor.php
* Added links to new files
* Removed keys of non-existent messages

ve.ui.ContentDialog.js, ve.ui.MetaDialog.js
* Removed redundant comments

ve.ui.MediaDialog.js
* New dialog, just for media

icons.ai, picture.png, picture.svg, ve.ui.Icons-*.css
* Added picture icon

ve.ui.MediaButtonTool.js
* New button, just for media (shows up in the context toolbar)

ve.ui.DialogButtonTool.js
* New base class for dialog buttons

ve.ui.Context.js
* Added basic support for showing dialog buttons, in addition to
  annotation buttons, in the context toolbar - to test, select only an
  image node

ve.ui.Dialog.js
* Prevent clicks on the click-block from changing focus
* Moved initialize to below the event handlers and updated its
  documentation

ve.ui.DialogFactory.js
* Added a way to get the names of dialogs that can be used to edit a
  node

ve.ui.Inspector.js
* Removed close handler which set focus, this is done already in window

ve.ui.InspectorFactory.js
* Fixed comment so it's not telling lies anymore

ve.ui.Window.js
* Removed auto-focus on frame, it's changing the focus in the parent
  document which blows-away the focus in CE, and it really isn't needed
  as it turns out

VisualEditor.18n.php
* Added media dialog title message
* Added media tool tooltip message

Bug: 37870
Change-Id: I9150c46b3e292910fed899fa60d6da433049ca45
Test: Disable circular reference test for ve.getHash.

Change-Id: Idbad334ed21247c3f4d442f6aad62a0b9347cfc6
Merge "ve.init: Fix broken dependency between ve.js and ve.init.platform"
Fix a bug where trimOuterSpaceFromRange() didn't trim an all-whitespace range

Also add tests for it

Change-Id: I713626bd778f45b5f7bfb6ca4ba2057f84c0a0c5
ve.init.mw.ViewPageTarget: Use original label for replaced tab

To verify
* Save "MediaWiki:Edit" with "Edit page" (anything not "Edit")
* Set this.tabLayout = 'replace';
* Observe that the ve-edit tab is now "Edit" (msg: vector-view-edit)
  instead of "Edit page" (msg: edit)

Bug: 42117
Change-Id: I2e7dd85cd14049101e2d49751d37797d77bc7c9d
Merge "Test: Fix 404 errors in example images."
Make ve.ce.Document.getSiblingWordBoundary compatible with new linmod

Change-Id: I746fb8ad761e68cb3c8a76550e2dd4cb540be4e6
Remove superfluous spaces in function invocations.

Find-Exec: ack '\.[a-zA-Z]+\ \(' --js modules/ve modules/unicodejs
Change-Id: Ib7d0a6514f3321f1d09fbf7cf52c2a9c2cecde88
ve.init: Fix broken dependency between ve.js and ve.init.platform

Depencency tree looked like this
* ext.visualEditor.viewPageTarget
  - ve.init.platform
  - ve.init.target
** ext.visualEditor.core
   - (most ve.* classes)
*** ext.visualEditor.base
    - ve.js

Some of the ve classes are calling ve.msg from the global scope
at load time (e.g. in the definition of static properties or in
constructors of classes that were immediately instantiated in
the same file).

Platform needs to be initialised in the base module.
ve.init.Platform.js was already there, but that's just an
abstract base class. The the ve.init.platform property is set
from the implementation classes' files.

Updated makeStaticLoader.php and re-ran for test and demo html.
The fake "Standalone Init" module is now gone, which shows that
this was needed as test/ and demo/ already put their platform
code in/after the 'ext.visualEditor.base' module in the html.

Bug: 45175
Change-Id: I47d7d92495974572194700c98a219d22ecbfaf4b
Merge "Re-run makeStaticLoader for index.php (fix 404 ve.ui.FlaggableElements.js)"
Add left/right/center alignment to popups

This allows the popup to be aligned to the callout in 3 different ways, center is still default.

Change-Id: I3f2a4672da62d7d4cd4c7d20df640d6390f00c9f
Re-run makeStaticLoader for index.php (fix 404 ve.ui.FlaggableElements.js)

Change-Id: Ifba82e644e6ad4b2fe69f2632df7935756dd275c
Test: Fix 404 errors in example images.

Consistently refer to example.png for <img> tests.
And "Wiki.png" for MediaWiki image tests.

Change-Id: I799654b66bb586338e807a84bb84f7ec0b486728
Test: Fix 404 error.

Follows-up I89f7c2afd815f3050.

Change-Id: Icdc9919b0b9b6f285795ea0d2753cd367cb6ae99
Fix borked resource module for LabeledElement, and GroupElement.

Change-Id: I2ca8aa4c7e7e7c22f42f22660fdb363dcc8d1f19
Merge "Add overlay to frame"
Merge "Stack panel, element mixins, cleanup"
Localisation updates from http://translatewiki.net.

Change-Id: I71e8c813c9847577c8a1f599985b140862f32da2
Add overlay to frame

This is where we can add popups and stuff.

Accessible through: this.$$.frame.$overlay

Change-Id: Icbc9a114006804a1b9ab74144f0aaf59a15c5466
Script tag for LinearData test not renamed after file move.

Change-Id: I89f7c2afd815f3050a2d837de67189cd628c03c6
Localisation updates from http://translatewiki.net.

Change-Id: I9692a5fa27269e660c6076690ca0875260bfadd4
Localisation updates from http://translatewiki.net.

Change-Id: Ia143d0bc7cfc83e55cdb7a2c512e24b09d1cee87
Merge "Store data in LinearData class with an index-value store for objects"
Store data in LinearData class with an index-value store for objects

Created an IndexValueStore class which can store any object and return
an integer index to its hash map.

Linear data is now stored in ve.dm.LinearData instances. Two subclasses
for element and meta data contain methods specific to those data types
(ElementLinearData and MetaLinearData).

The static methods in ve.dm.Document that inspected data at a given
offset are now instance methods of ve.dm.ElementLinearData.

AnnotationSets (which are no longer OrderedHashSets) have been moved
to /dm and also have to be instantiated with a pointer the store.

Bug: 46320
Change-Id: I249a5d48726093d1cb3e36351893f4bff85f52e2
Fix MWImageNode dimensions and implement toDomElements

Using element.height was returning 0 if the attribute was empty
when in fact what we mean to store is null (i.e. auto height).

This takes care of the writing of attributes in CE as jQuery
ignores an attribute-set command if the value is null.

Also in this commit I've implemented a basic toDomElements
that outputs the original HTML (code copied from AlienNode).
This stops the code from throwing an exception but will
eventually need to be rewritten to rebuild the HTML from
the attributes stored in the DM.

Bug: 56336
Change-Id: I297a1d0a07e9ebf9d0110fb1cdf266f8415f25b7
Merge "Typing support after Aliens and Entities for IE"
Make sure that rangy is initialized only once and that it is initialized before it is used.

Change-Id: Ia318908d34e82ae97ae1bf662ad9fc5dc28bf6ba
Typing support after Aliens and Entities for IE

When the cursor is between ce="false" elements and an editable next
sibling, IE often sets the anchorNode to be the ce="false" element
(or text node within). This change returns aliens to ce="false"
(abandoning the former true within true IE trick), and ensures that
the cursor is in the right place on keydown by programmatically
setting the selection.

Change-Id: I952488510f32b096b27e8e55d4afc7df930e0072
Merge "Fix for live preview in jsduck"
Fix for live preview in jsduck

This got out of sync, pretty simple fix.

Change-Id: Ib21e63399f184de1b182f20b9d35307e2c73a0df
Doc: Replace "@property @type {Type}" with "@property {Type}".

Also removed a few redundant headings in class documentation
comments. There is already an @class and it looks a bit odd  in
the generated pages:
 <h2>TextString</h2>
 <p>TextString</p>
 <p>This class provides a ...</p>

Change-Id: Ie311c6993ed02e79272dbde71f6a1bc252ef3037
Merge "Fix: focus method should be called on jQuery object not on ve.ui.TextInputWidget object itself."
Merge "Added support for displaying inline images."
Fix: focus method should be called on jQuery object not on ve.ui.TextInputWidget object itself.

Change-Id: I70b6553245b68e6de465eb3434bce4c4228f1764
Added support for displaying inline images.

Change-Id: Ieecbca8ed864585e8eaa99598d4bfdb5ac9bfec7
Stack panel, element mixins, cleanup

*.php
* Updated links to files

ve.ui.MetaDialog
* Added stack panel that now contains category and language editor panels
* Attached outline widget to stack panel

ve.ui.FlaggableWidget -> ve.ui.FlaggableElement
* Moved to elements

ve.ui.GroupWidget -> ve.ui.GroupElement
* Moved to elements
* Removed invalid event documentation

ve.ui.LabledWidget -> ve.ui.LabledElement
* Moved to elements

ve.ui.StackPanelLayout.js
* New class, mutually exclusive panel container

ve.ui.TitledPanelLayout
* Remvoed, using labeled element instead

ve.ui.Element.css
* Added for elements
* Moved label style here, from widget styles

*.css, ve.ui.ButtonWidget.js, ve.ui.InputLabelWidget, ve.ui.OptionWidget, ve.ui.SelectWidget
* Adjusted class names to reflect widget -> element migration

Change-Id: I32f504c844dba7aae1b286eef06ca046627bdc8d
Docgen: Add a way to override parameters to makeStaticLoader.

When running from Jenkins, we publish only the docs/ directory.
So the live previews are failing as there is no ../modules to be
found.

This will allow Jenkins to instead pass a different --ve-path.

Also, needed to fix the eval in PHP to not use vePath directly.
The vePath is the path for the web browser to the module directory
not for the server-side.

On the server-side we can just use __DIR__ as maintenance/
is always next to /modules and /VisualEditor.i18n.php.

Change-Id: I02101454a1977938bf861425db2141bdb446725b
Merge "Docgen: Re-colourise jsduck warnings."
Docgen: Re-colourise jsduck warnings.

When jsduck is executed in a subshell (as we do, to catch output)
it disables the color output. It should have a --color flag, but
it doesn't have that, so manually colourise for now.

Change-Id: I1f8da523b6b4fc1fc6965f751395f8af497b13b5
Remove auto-open of meta dialog

This was accidentally introduced in I7ff5f5f095460fd4f6cf841f4182bfb92bf034da

Change-Id: I9266346ff43897e3e7789fd8224628422bc903c6
Localisation updates from http://translatewiki.net.

Change-Id: I654e5ee090f9dd708ad57a666bfdfd3a2e5e5c68
Merge "Removed static "overrides", which were only setting defaults"
Merge "New popup widget"
New popup widget

This will make the popup with callout functionality easy to reuse elsewhere - in the first case most likely the popup menus for the category widget.

*.php
* Added links to the new widget

ve.ui.Context.css, ve.ui.Widget.css
* Moved styles to the widget stylesheet

ve.ui.Context.js, ve.ui.PopupWidget
* Moved "popup" specific stuff to the new popup widget

Change-Id: I823c6e2c5e1ec11088898e9621d93e983c3b76f3
Merge "Added layouts and fixed up dialog styling issues"
Initialize rangy once and globally instead of doing it in constructor of every surface.

Change-Id: I06e331021ff8af63e76ceccc005319fc9ce96619
Merge "Small cleanup in CE"
Small cleanup in CE

Better comments for:
* ve.ce.Document.getRelativeOffset,
* ve.ce.Document.getSiblingWordBoundary.
Convert ve.ce.Surface.getSelectionRect to a static method.
Moved getNodeAndOffset from ve.ce.Surface to ve.ce.Document.

Change-Id: Ic00221fa463205d04c9b52150c0dd15904493b1e
UnicodeJS library to implement Unicode standards

Initially just with a Wordbreak module to implement Unicode standard
on 'Default Word Boundaries'. Due to it's standaloneability this has
been written as a separate library. Non-BMP characters are currently
not supported.

Bug: 44085
Change-Id: Ieafa070076f4c36855684f6bc179667e28af2c25
Message cleanup

VisualEditor.i18n.php, VisualEditor.php
* Remove unused message

Change-Id: I6e1fdfdbcbf112f8ba09176f1e19dfafabe43f51
Link inspector suggestion sections

ve.ui.Widget.css
* Made sections use a default cursor - they aren't clickable so they shouldn't appear to be

Change-Id: Id74288040080c18b8595f2903239bc82e8bc1ab2
Removed static "overrides", which were only setting defaults

The default widget element type is already 'div', no need to override that.

Change-Id: Ief6ee9a7a2e2384ea26276483a5d8e33ab70dacf
Merge "Prevent adding content to aliens in IE"
Prevent adding content to aliens in IE

The phantoms prevent direct clicking into aliens,
and the recent selection changes prevent keyboard
navigation into aliens, but one issue remained.
Clicking to place the cursor just after an alien
would actually focus within the alien. Typing
modified the alien content. By nesting ce="true"
within ce="true", IE ceases this behavior.

Dragging state is now set to false when blurring
the document. The mouseup event sets dragging to
false, but the event is cancelled because blur
happens between mousedown and mouseup. Phantom
display logic uses on this property.

Change-Id: I162dea89838756fd28d63ff66cc4a5e5bda2873a
Localisation updates from http://translatewiki.net.

Change-Id: I5d0e4892e88b404edcbb1c6fdc96405eab7a7860
Added layouts and fixed up dialog styling issues

ve.ui.Dialog.css
* Fix issue where the use of margin auto on the outer dialog wrapper
  would expose parts of the underlying content - this is resolved by
  making the outer wrapper cover the whole screen and making the
  window frame use margin auto

ve.ui.Icons*.css
* Added missing settings icon rule

ve.ui.Layout.css
* Added styles for editor panel

ve.ui.Window.css
* Removed default height, setting it specifically in inspector now

ve.ui.EditorPanelLayout.js
* New layout, adds a title and icon above the content

ve.ui.TitledEditorLayout.js
* Similar to labeled widget, but for panels

ve.ui.MetaDialog.js
* Using settings icon now
* Switched to using a specific layout - still hard-coded for
  categories

ve.ui.Frame.js
* Modified style loader to guarantee order of style rules, no matter
  what order they load in

*.php
* Moved layouts to be included after widgets so they can use widgets
* Added links to new layouts

Change-Id: I7ff5f5f095460fd4f6cf841f4182bfb92bf034da
Add insert and remove events to MetaList

These events occur when an item is inserted or removed by onTransact(),
so both for insertions/removals done through the MetaList mutators and
insertions/removals done by any other means.

We have to gather these events and batch them up because we have to allow
offset translation and index recomputation to occur first (otherwise
calling .getOffset() and .getIndex() on inserted items doesn't work).

Change-Id: I74a9a21398eca4e9afd7148171af20d439cf7ebd
Merge changes I4b62a310,I7c9f22a1

* changes:
  Add mutators in MetaList
  Move .commit()/.rollback() from TransactionProcessor to Document
Merge "Add support for slugs in ve.ce.Document.prototype.getRelativeOffset"
Merge "Docs: Primitive -> primitive."
Add support for slugs in ve.ce.Document.prototype.getRelativeOffset

Also removed ve.ce.Surface.prototype.adjustCursor because it is not being used anymore

Change-Id: Ib7dd8f4f6eaa688995d33247600875a45fc5a602
Merge "Cleanup in ve.ce.Surface."
Cleanup in ve.ce.Surface.

Mostly by extracting parts of onDocumentKeyDown method into separated methods: handleLeftOrRightArrowKey and handleUpOrDownArrowKey

Change-Id: If19abf2218bc667c729f7bf388074061cec3031c
Merge "Fix documentation to place @emits in the correct place"
Add mutators in MetaList

Add .insertMeta() and .removeMeta() methods to insert and remove
metadata through the meta list. For convenience, there is also a
.remove() method in MetaItem that wraps around removeMeta().

Also rename insertItem() and removeItem() to addInsertedItem() and
deleteRemovedItem() to avoid confusion, and make the MetaList
constructor take a dm.Surface rather than a document so we can call
change().

Change-Id: I4b62a3109404cfd56f5de68938e1db908b03e678
Fix documentation to place @emits in the correct place

@emits, @returns, @chainable & @throws should always appear
in that order, according to CODING.md.

Change-Id: I9b192e018a028a8b32730c288cc4e3108800fb58
Move .commit()/.rollback() from TransactionProcessor to Document

Previously these were static functions in TransactionProcessor
which instantiated a TP called .process() on it. These are now
methods of ve.dm.Document.

Also moved the emission of the 'transact' event on the document from
TransactionProcessor to Document itself, and moved the tests asserting
double application is protected against from TP to Document (because
the corresponding code moved as well).

Change-Id: I7c9f22a14accaf0ba1f70d5aa4f0573bb7e677d0
Merge "Small cleanup/refactoring to getSiblingWordBoundary"
Small cleanup/refactoring to getSiblingWordBoundary

CPU time + memory optimization + make inexpensive comparison first

Change-Id: I7f504f741b4d90201e40bbc40ae2e88fe0db2e33
Docs: Primitive -> primitive.

Only one left, thought there were more.

Change-Id: Ifdf490854ea138daf01319ed58cdba4182481c85
Merge "Add MW-specific meta items for categories and language links"
Programmatic handling for selection (arrow up and arrow down only).

This is only for IE and only for backwards selection.

Change-Id: Ifdcd2d404d1018057b5ba16753fc964b07738879
Localisation updates from http://translatewiki.net.

Change-Id: Id57f55ea0eb7ef9b2613dadd25513716bc2785b3
Merge "Programmatic handling for selection (arrow left and arrow right only)."
Merge "Introduce helper functions."
Programmatic handling for selection (arrow left and arrow right only).

Change-Id: I6ccbecdeafbe189dbe052e4e9ce8f926dad14aea
Merge "Introduce method ve.ce.Document.getRelativeOffset."
Introduce helper functions.

* ve.ce.isLeftOrRightArrowKey
* ve.ce.isUpOrDownArrowKey
* ve.ce.isArrowKey

Change-Id: Id9fd7975e98085d01e545d1d0fc6086a06648031
Introduce method ve.ce.Document.getRelativeOffset.

Change-Id: If2b8675b4604fc5ec1430497f2d55b2f3584a453
ve.init.mw.ViewPageTarget: Fix exception in deactivate().

This caused the page to stay in a dimmed state because it would
throw an exception before tearDownSurface() and showPageContent()
would be called.

Bug: 46456
Change-Id: I91ad2b110c2c523a4bb367407e3f33a953328ab4
Cleanup to ve.dm.SurfaceFragment.wordBoundaryPattern

Change-Id: I475fc0c97d5af646f51fe779c4b3136ddd3f83d0
Removed ve.dm.Document.getIEStyleWordBoundary method.
Added ve.ce.Document.getSiblingWordBoundary method.

Change-Id: I44b53273429aede5be10f39c2ee2f70d96cdc6fb
Add MW-specific meta items for categories and language links

Also rename MWMetaItem to MWAlienMetaItem, because that's what it
really is.

Change-Id: I70695bfa3b8449c936a63f7b2a248b90c49dcea1
Remove more periods

Tags don't need periods at the end, these are not complete sentences.

Change-Id: I8efa931862149e892d08b370e70aff8d86a6db7d
Merge "Fix transition animation between context menu/inspector"
Fix transition animation between context menu/inspector

This removes the "grow from nothing" effect (which may have been a
little overkill) but fixes the situation where the inspector is open
and you click to a new location and it moves to the new location and
then transitions down to the menu (which looks bad).

Change-Id: I19d27da6fea7c36965c83aa73836b1bc870c9bcc
Merge "Docs: Add more @source links to external.js"
Localisation updates from http://translatewiki.net.

Change-Id: I88f19e3a2a23df1a037c22fbc0dd0ac11344e82e
Docs: Add more @source links to external.js

Change-Id: Ibde8eba9d464d1deb1a7a100fcf79f7ebe347621
Merge "Docgen: Exit with error status code if there are warnings."
Merge "Document and clean up events in all the things"
Document and clean up events in all the things

* Document them consistently between secetions Inheritance and
  Static Properties under their own (new) section Events.
* Removed any quotes or brackets around the event name in existing
  @emit annotations
  Search: @emit.*['"{}(){}]
* For every call to this.emit() anywhere, added @emits.
* Fixed all warnings for references to undefined events
  (introduced as a result of the previous point).
  Event handler parameter documented based on the emit() call
  and actual handlers using the event. Usually the latter is
  more elaborate.
* Extend coverage of jQuery as needed
  (copied from mwcore/maintenance/jsduck/external.js
  written by me, hereby implicitly and explicitly released under MIT).

Specifics
* ve.ce.Surface#onContentChange: Fixed type of range from Object to ve.Range.
* ve.ce.SurfaceObserver#poll: Fix syntax for code from {} to `backticks`.
* ve.ui.Toolbar#onContextChange: Doesn't actually emit "clearState" event.
  Removed #onClearState in Tool, ButtonTool and DropdownTool.

Bug: 45872
Change-Id: Id879aa769b2c72d86a0322e75dddeb868211ce28
Docgen: Exit with error status code if there are warnings.

This way the Jenkins job will be marked failure if we introduce
regressions in the validity of the syntax.

Change-Id: I80ea147b96632412913193600960d1cf4127ed25
Merge "Create basic tests for AnnotationSet."
Introducing method ve.dm.Document.getIEStyleWordBoundary

This is just a prototype - if it will be as useful as I expect
then it will get refactored (and probably get a better name +
location).

Change-Id: Ice1a2bd7d498d9d8438c35239216f01bd3db1826
Localisation updates from http://translatewiki.net.

Change-Id: I5c5835c268f4654228f253ca72afacc768251ee0
Minor comment and licence fixes

Change-Id: I7fb632e56291b136e3e7b83ea6335474f1521d05
Create basic tests for AnnotationSet.

Also covers methods inherited from OrderedHashSet.

Bug: 46320
Change-Id: I632e4cf1b87312179a9ce52df0d590ff42f56325
Localisation updates from http://translatewiki.net.

Change-Id: I7954146323f7c48487aa21fc578aa09f3815f981
Bump copyright year range to 2013 in the licence file

Change-Id: Iade5e5f71043dac70995afa3553ca4529460f2e0
Localisation updates from http://translatewiki.net.

Change-Id: Iaf83e65d89f7b3f4700edbd16527b13677ec0d91
Remove duplicate and nonexistent files from demos/ve/index.php

Change-Id: I5f7ed1a54850221c92e7ba4e622278966a25e6af
Merge "Add MetaList"
Merge "Layouts, grids and panels"
Layouts, grids and panels

Layouts
* Makes widget inherit from element
* Adds layout which also inherits from element
* Adds grid and panel layouts
* Uses grid layout in meta dialog

Other changes
* Corrects issues with several of the stand-alone files by fixing and using makeStaticLoader.php

Change-Id: I6b92c0204e176c914c26eff8c03ea417578e080c
Add MetaList

A MetaList is a collection of MetaItems representing all of the
metadata in a ve.dm.Document, and it updates itself live as the
underlying document changes.

Currently this interface is read-only, I'll add mutators next.

Change-Id: If7bfc9563af37e22dcdca9a682d6decc2f6f1872
Merge "Added categories and language icons"
Added categories and language icons

These are not used yet, but will be for inspectors and dialogs to come.

Change-Id: I503c889d137f8a804f627446af861e6b94442e2b
Merge "Toolbar style fixes"
Localisation updates from http://translatewiki.net.

Change-Id: I1e44ab524f7f8d54cd6dfa0c1556c67c96acb0c6
Toolbar style fixes

demo.css
* Removed toolbar floating styles, which were out of sync and essentially a duplication of those in ve.Surface.css

ve.Surface.css
* Reorganized rules
* Fixed some CSS syntax issues

Change-Id: I94eb83fa74312266817f8932f54fc9b89332c524
Merge "Remove 1px left margin from toolbar in Vector"
Merge changes Ieffb108b,I334f7db2

* changes:
  Remove unused .data()
  Link inspector menu not appearing in the right place
Remove 1px left margin from toolbar in Vector

Apparently this is left over code from when Vector drew
the left border as a background.

Change-Id: I3a9829ed7ab1bb1f2ad1a1c88aff82b1a2fc456d
Merge "Move toolbar-shadow.png to correct location"
Merge "docgen: Exit with exit code of jsduck command"
Merge "Add Ed Sanders to the authors list for the MW extension"
Merge "Disable the save button when there is no past history"
Merge "Remove ve.dm.MWMetaNode.js from extension"
docgen: Exit with exit code of jsduck command

Change-Id: Idf896dc6d9dcd11effcc9836b857267570db3e15
Disable the save button when there is no past history

If the user has undone all their actions they should not be able to
save the document. By updating the 'edited' property we also solve
the issue of the onbeforeunload alert displaying if all edits
have been undone.

Bug: 42939
Change-Id: Ib3bc5b0e2f21781166a17a3fdf4f5286e6713859
Remove ve.dm.MWMetaNode.js from extension

This file was deleted in 52706 but its removal from the extension
was overlooked.

Change-Id: Icb5c14cddfae6efb6646816dfc235477c2392f3a
Merge "Emit a transact event on the ve.dm.Document when a transaction occurs"
Merge "Make metadata reaping handle replacement operations more sanely"
Merge "Change MetaNodes to MetaItems"
Add Ed Sanders to the authors list for the MW extension

Change-Id: I5560bdf12c4e496ef85be9251e3c94ceab71414f
Change MetaNodes to MetaItems

Rather than meta-things being special kinds of nodes, they are now a
separate class of things (MetaItems) along with Nodes and Annotations.

* Created a generic ve.dm.MetaItem that meta items inherit from.
  There will be actual instances of this class as well in the upcoming
  meta group code.
* Renamed MetaNode to AlienMetaItem, MWMetaNode to MWMetaItem,
  'metaBlock'/'metaInline' to 'alienMeta'
* Created a MetaItemFactory, handle meta items in the ModelRegistry
* Kill ve.dm.Node.static.isMeta, now obsolete

ve.dm.Converter:
* Pass in the MetaItemFactory
* Look up data element types in the ModelRegistry rather than the
  NodeFactory, because they can be either nodes or meta items
* Document createDataElement() and make explicit that modelClass can be
  either a node or a meta item
* Handle meta items in getDataFromDom()
* In getDomFromData(), check the MetaItemFactory as well as the NodeFactory

Change-Id: I893709c6f3aa00f85c1b905b70f9f4e597bdeada
Emit a transact event on the ve.dm.Document when a transaction occurs

We'll need this to let a MetaList observe a Document and adjust to changes.
We should probably also have SurfaceFragment listen to this event instead.

Change-Id: I9e811e242969eb44afe0b4fa8153d0fb1b0071cd
Make metadata reaping handle replacement operations more sanely

Before, replacement operations that both inserted and removed data at
the same time would be treated as removals followed by insertions,
so we'd reap the metadata from the affected range and move it to the
start of the range. For a pure replacement, this doesn't make any sense.

Instead, preserve the first min(insertLength, removeLength) elements in
the metadata array, then perform a pure insertion splice or a pure
removal splice for the length adjustment. Any metadata reaped in a
removal splice is restored at the offset where we started removing,
after the preserved portion.

These changes make the behavior of metadata reaping saner in general
(the previous behavior had the potential to move metadata around if it
was near a paragraph opening or closing and you converted the paragraph
to a heading), and makes the behavior match up with translateOffset(),
which is desirable for MetaList synchronization.

Change-Id: If9a1c6a7cf43ead7e3e1e8f6e081b139ca65fa53
Move toolbar-shadow.png to correct location

The style was moved, but the image was left behind.

Change-Id: Ib6c22cf652d0ae787030986f0afd262e62d7f610
Remove unused .data()

Just cleaning up the cruft

Change-Id: Ieffb108b234409a1122a984b45bdda688ce2014b
Link inspector menu not appearing in the right place

ve.ui.Widget.css
* Adjust menu up a few pixels to match other uses of ve.ui.MenuWidget (the format drop down)

ve.ui.LinkInspector.js
* Moved the form value initialization to a timeout that fires well after the animation of the inspector - this is only important because the first element has a menu that pops up and the menu was rendering in the wrong location

ve.ui.Frame.js
* Added reference to frame within this.$$ by passing it to get$$

ve.ui.Inspector.js
* Removed auto-focus on open from inspector base class - this will be done in a more specific and controlled way instead

ve.ui.js
* Added optional frame argument to get$$ so that it's easy to get the frame from any $$ that's bound to an iframe document

ve.ui.Window.js
* Removed duplicate static member assignments
* Added auto-focus on the window's frame before calling onOpen
* Added auto-blur of anything focused within the iframe after calling onClose

ve.ui.MWLinkTargetInputWidget.js
* Auto-highlight the selected item when populating a menu so that pressing enter always keeps the currently selected item selected

ve.ui.TextInputMenuWidget.js
* Take the frame's position into account when positioning a menu below an input

Change-Id: I334f7db29af6b821bcfc8dc3c0ccba2636d4d9b1
Toolbar actions not floating

Spurious semi-colon caused class to not be parsed, making toolbar actions not float right

Change-Id: I1ef88358908002cd7feb8c02b5da80d4f1ffe46d
Localisation updates from http://translatewiki.net.

Change-Id: I160ebbac817543781de503ae1e5928c18b08e4da
Merge "Add support for non-Latin scripts to wordBoundaryPattern"
Add support for non-Latin scripts to wordBoundaryPattern

Replacing [a-zA-Z] with a long unicode expression which encompasses
all the characters in the unicode 'letters' category. Similarly replacing
[0-9] with an expression for 'numbers'.

Bug: 44085
Change-Id: Idd403339caa24769ce08133dda06ab6d4b9d694e
Merge "Correct name of can(Node)HaveGrandchildren functions"
Merge "Add tests for ve.dm.Document.getNearestWordBoundary"
Merge "Fix Surface constructor in IndentationAction tests"
Merge "Context, frame, window, dialog and inspector refactor"
Context, frame, window, dialog and inspector refactor

This is a major refactor of user interface context, frame, dialog
and inspector classes, including adding several new classes which
generalize managing inspectors/dialogs (which are now subclasses
of window).

New classes:
* ve.ui.Window.js - base class for inspector and dialog classes
* ve.ui.WindowSet.js - manages mutually exclusive windows, used
  by surface and context for dialogs and inspectors respectively
* ve.ui.DialogFactory - generates dialogs
* ve.ui.IconButtonWidget - used in inspector for buttons in the head

Refactored classes:
* ve.ui.Context - moved inspector management to window set
* ve.ui.Frame - made iframes initialize asynchronously
* ve.ui.Dialog and ve.ui.Inspector - moved initialization to async
  initialize method

Other interesting bits:

ve.ui.*Icons*.css, *.svg, *.png, *.ai
* Merged icon stylesheets so all icons are available inside windows
* Renamed inspector icon to window

ve.ui.*.css
* Reorganized styles so that different windows can include only
  what they need
* Moved things to where they belonged (some things were in strange places)

ve.init.Target.js, ve.init.mw.ViewPageTarget.js, ve.init.sa.Target.js
* Removed dialog management - dialogs are managed by the surface now

ve.ui.*Dialog.js
* Renamed title message static property
* Added registration

ve.ui.*Inspector.js
* Switch to accept surface object rather than context, which conforms
  to the more general window class without losing any functionality
  (in fact, most of the time the surface was what we actually wanted)

ve.ui.MenuWidget.js, ve.ui.MWLinkTargetInputWidget.js
* Using surface overly rather than passing an overlay around
  through constructors

Change-Id: Ifd16a1003ff44c48ee7b2c66928cf9cc858b2564
Fix Surface constructor in IndentationAction tests

The IndentationAction was created against a version of master which
didn't have the new Surface constructor signature. This commit resolves
that conflict.

Change-Id: Ifc17f95acfa6057963d503448405355831b1ff97
Correct name of can(Node)HaveGrandchildren functions

Bug: 43893
Change-Id: I9fd2a1fd6e3ee0a7bdfc357b5d4e4e0fd3efa0a5
Add tests for ve.dm.Document.getNearestWordBoundary

Also in this commit is a minor fix to the regular expression so it
behaves as documented (the hyphen needed escaping).

Bug: 44085
Change-Id: Idc315e2dce79be8f028b5681c60f74e175b9d869
Merge "Refactor convert to use isolateAndUnwrap"
Merge "Emit apply and close dialog when apply changes is clicked."
Fix current annotation being nullified

MWLinkTargetInputWidget annotation property was being killed
on populateMenu.

Other changes:
* Removed calls to sanitize on subclasses setValue methods
  as those methods call the parent class method which already
  sanitizes input.

Bug: 46025
Change-Id: I169dd58a06122122f187f9d751076ef56b255558
Fix new lint warnings previously uncaught by jshint

The new jshint (0.9.1 > 1.1.0) is smarter about detecting trailing
whitespace (which enabled in our jshintrc file).
Looks like we did indeed let it slip through a few times in ve.Document.

Also cleaning up comment from * to - for consistency and avoiding
block-comment characters.

Change-Id: Ie1621816d608b5c42028ee945346d872a747c6a4
Refactor convert to use isolateAndUnwrap

isolateAndUnwrap now unwraps to a level determined by a target type
i.e. the type you are going to convert to.

Also in this commit wrap/unwrap/rewrap have been refactored to use
getLengthDifference. unwrap now takes an inner/outer unwrap depth.

Change-Id: I3c6249de43232a9ef64f498a0aaf66b1c44973f2
Merge "Only unwrap { generated: wrapper } based on context."
Only unwrap { generated: wrapper } based on context.

Wrapper paragraphs should only be unwrapped if they are the first
element in their parent - or if there is a block level element separating
them from the previous unwrapped paragraph.

Empty paragraphs should only be unwrapped if they are empty and the
last element in their parent.

Also in this commit is a simple test for IndentationAction.decrease().

Bug: 45590
Change-Id: I1f47d12db6d57d984fd4607f667a3b62c53f3dd6
Merge "Create MediaWiki specific nodes to contain MW specific rules."
Create MediaWiki specific nodes to contain MW specific rules.

Heading and Preformatted nodes have rules that should only
exist under a document node in MediaWiki.

Two new node types have been created as has a new DropdownTool which
uses these. The MW init options have been changed to use the new
DropdownTool.

Bug: 45295

Change-Id: I3f47e1ae1f5c1415bde58a75385e4bf5f4b8fffc
Merge "Pass through error message to VE if Parsoid is unreachable."
Merge "Fix JSDuck warnings"
Localisation updates from http://translatewiki.net.

Change-Id: I3a873d19eb5c2cbe689492321df12b500f323ba9
Fix JSDuck warnings

Change-Id: Ibc3f49c55ded5490fcb071f0ccf9f25a71a06c97
Warning: categories.json Class 've.NodeFactory' not found in categories file
Warning: ve.ui.ContentDialog.js:8: Unknown type ve.ui.Surface
Warning: ve.ui.MetaDialog.js:8: Unknown type ve.ui.Surface
Warning: ve.ui.Dialog.js:8: Unknown type ve.ui.Surface
Pass through error message to VE if Parsoid is unreachable.

The Status is marked as 'ok' if it completes with errors. We need
to check for the Status is 'good' as well, and if not we can
pass through the error.

MWHttpRequest only sets fatal errors so it can be assumed that if
the Status is not 'good' then there is one error in the error array.

Bug: 45916
Change-Id: Icb2d0253faaf4e00a9a1fe3091458b914e5b7579
Fix broken FormatAction tests.

The ve.Surface constructor was recently changed, but the instantiation
in the FormatAction tests was not updated accordingly.

The constructor now requires a ve.init.Target object.

Bug: 39597
Change-Id: Ia4193fbab5c63007ed057009bf9a39f1f9d18fb7
Localisation updates from http://translatewiki.net.

Change-Id: Ie45aaead6474f3b53454314685bda6593693885a
Merge "Do not display phantoms while dragging mouse over alien nodes."
Do not display phantoms while dragging mouse over alien nodes.

It really does screw up selection in IE and does not look good in other supported browsers.

Change-Id: Ie190e86b25c3b253d4cf809594e74094275d0d57
Emit apply and close dialog when apply changes is clicked.

* Cleanup cancel button click binding.

Change-Id: I959a1b33e06a344a7946de8709f71f9c265a7604
Merge "Adding comments for grep"
Adding comments for grep

Change-Id: Ib20219ccf4409ac24f896c67e695f4155136daeb
In MW integration, dialog was overlapping toolbar shadow.

Setting the top to the outerHeight of the toolbar solves this.

Change-Id: I528ce23c88dfe6a3be7d4f7c4f6c90ef608630c1
Localisation updates from http://translatewiki.net.

Change-Id: I524b94d521f8da5fe48b066964b73b5b22e3959f
Merge "Use static.name once for ce and dm nodes"
Use static.name once for ce and dm nodes

Add a static.name property to ce nodes and make sure both ce
and dm nodes always use the static.name property in constructors
and registration calls.

The result of this is that any given node type should now only
appear once in the code as a string.

Bug: 45701
Change-Id: Ibf31de16ab28ad58209c1443cd74f93dda278998
Merge "Fix for incorrect usage of ve.Range"
Fix for incorrect usage of ve.Range

Properties "from" and "to" of ve.Range should be used when
direction of the range is important.

Change-Id: I73f27abf5c90f9aad8fdd0622f71b09188af9486
Tweak i18n for meta and content dialog title

Change-Id: I4dc5c07073d1c1b202dbdb2f7c0c9e138d967a22
Merge "More work on dialog classes and their mw specific handling."
Merge "Introduce dialogs"
More work on dialog classes and their mw specific handling.

Changes include:

VisualEditor.i18n.php, VisualEditor.php
* i18n labels for dialogs

ve.init.mw.ViewPageTarget.js
* Initial go at onOpenDialog and onCloseDialog methods

ve.init.Target.js
* Change calls to dialog hide & show to close & open

ve.ui.MetaDialog.js, ve.ui.ContentDialog.js
* Pass surface when constructing
* Add static title message property

ve.ui.Surface.css
* Set high z-index for toolbar for shadow to overlap dialog.

ve.ui.Dialog.js
* Extends EventEmitter class.
* Changed hide/show method names to open/close.
* Create base ui elements.

ve.Surface.js
* Create instance of meta dialog.

Change-Id: I867ca0546606eeb5e2ab7f612bb5af700ab877ec
Fix for IE bug where clearTimeout doesn't clear the timeout

Apparently in IE even after you call clearTimeout, the function passed
to setTimeout might still get invoked (not 100% of the time).

It depends on the time difference between calling clearTimeout and
when that function was supposed to be called.

Change-Id: I050c1ecc51c1d891a028fb777243573487357171
Introduce dialogs

Major changes:

demos/ve/index.php
* Renamed ve-demo-content to ve-demo-editor

ve.init.mw.ViewPageTarget, ve.init.sa.Target
* Added handlers for dialog events

ve.ui.*Dialog.js
* Added skeleton classes for dialogs

ve.init.Target.js
* Create abstract class methods for Target.

ve.init.sa.Target.js
* Create Standalone target view methods.

ve.init.mw.Target.js
* Added MW specific target view methods.
* Integration action buttons are now added to the edit
view in the toolbar.

ve.Surface.js
* Simplified constructor, now requiring a target which contains the container

* Other changes include some documentation and code cleanup.

Bug: 39597
Change-Id: Iff39266bdd3052f34bda254ca407030dbbc81f26
DomRange makes more sense as a name for this class (cause it is not rangy specific).

Change-Id: I670523a0ed2216ebe34dc4b759a4aa429b9da53c
Pass parsoid server errors through to VisualEditor.

Unfortunately the Http::get wapper provides no data if anything but
an OK status is returned, so ApiVisualEditor now uses MWHttpRequest
directly.

If a non-OK status in encountered the error code and message are
passed through to the JSON output, and rendered in the error
alert by VE.

The error code passed through is parsoidserver-http-NNN although
other suggestions are welcome.

Bug: 44354
Change-Id: I166ecf81c40f0f1c62663f2096753269d28f2916
Localisation updates from http://translatewiki.net.

Change-Id: Ibfabac13df838d583054964d68533f2be227781e
Localisation updates from http://translatewiki.net.

Change-Id: I7a30b371511809c38fd139989d6d90e0c9d6252a
Merge "Shift-Enter should add newline in preformatted"
Localisation updates from http://translatewiki.net.

Change-Id: I449dd66f68534abd4e726579869f49f2984679a5
Added validation to ve.inheritClass

I encountered a very difficult to track down error while working on
ve.ui.Dialog where a copy-pasted inheritClass call overwrote the
prototype of ve.ui.Widget.

By adding this check, we can ensure that 2 identical calls to
inheritClass won't silently make the system explode. This check is
lightweight and will save someone down the line a bit of time and head
scratching.

Change-Id: I014d53722fc8d941ec415462d258a79985e0e3d7
Shift-Enter should add newline in preformatted

Modified handleEnter to check for the condition that shift-enter
is being pressed inside of a preformatted block. If so, a break
node is inserted.

Bug: 45355
Change-Id: Iae7b3c88b7cd976e519c09821a064078228acc79
Localisation updates from http://translatewiki.net.

Change-Id: If262096fc513b30795fb84c81a786740f477cc8c
Merge "Major UI refactoring and improvements"
Maintenance script: Update header

This is a much simpler pattern and more consistent
with other extensions.

Change-Id: Ia8b31ff0573287325eeb5a878a1eb36bbf6374af
Merge "Fixing canBeSplit for ListItemNode"
Merge "Cleanup: Omit second argument to setTimeout for "nextTick""
Cleanup: Omit second argument to setTimeout for "nextTick"

Not 0 or 1.

Change-Id: Ia6eb985e649c5bd196f87aac98c3919e60be9a86
Fixing canBeSplit for ListItemNode

List items weren't being properly split because of a typo in this file.

Change-Id: Ib275d62156b775bad57624dfdf4b54eb9a925eaa
Merge "Change FormatAction.splitAndUnwrap to use the new SurfaceFrament.isolate method"
Change FormatAction.splitAndUnwrap to use the new SurfaceFrament.isolate method

Bug: 45246
Change-Id: I6e10ed87b25150cfc9d8e42c0f0bd3733b08fee7
Merge "Implement SurfaceFragment.rewrapAllNodes"
Merge "Modify styles, add disabled and read-only for widgets"
Merge "Resigning from localStorage"
Fix JSDuck warnings

Follows-up I44bcb79a59 and various other changes.

Please remember to generate documentation and resolve
all warnings before pushing into gerrit.

Change-Id: I8a372443e841308463376d8673ce027a97bbcd30
Resigning from localStorage

Using localStorage for copy and paste between ve instances previously worked, but broke with the introduction of AnnotationSet. After a discussion with James, rich copy and paste from many sources is the real goal, so copy and paste enhancement should work toward that end.

Change-Id: I58c0f4525e486fada997872b40c2317f57034b7a
Implement SurfaceFragment.rewrapAllNodes

rewrapAllNodes is effectively the same as unwrap then wrap
except it operates as one transaction as so avoids a potentially
invalid intermediate state.

Added some more comments for unwrapAllNodes and renamed a varaible
for consistency.

Fixed a typo in Transaction.newFromWrap comment.

Bug: 45242
Change-Id: Ie752a788d087055d97c7c6f75f59c6a2680d26c7
Modify styles, add disabled and read-only for widgets

demos/ve/demo.css, demos/ve/index.php
* Style changes for utilities and dump output
* Initially disable the log range button, activate when there's a range to log
* Make range inputs read-only
* Rename some widget variables
* Add extra structure and classes to dump output

ve.ui.Widget.css
* Remove left/right margin for buttons
* Simplify opaque white color
* Modify selector for disabled buttons - see changes in ve.ui.Widget.js
* Added styles for text input widget's readonly and disabled states

ve.ui.Widget.js
* Added disabled state

ve.ui.ButtonWidget.js
* Moved click event handler to method

ve.ui.InputLabelWidget.js
* Moved click event handler to method

ve.ui.InputWidget.js
* Moved input change event handler to method
* Added readOnly state

ve.ui.LinkTargetInputWidget.js
* Corrected documentation

ve.ui.MenuWidget.js
* Blocked interaction while widget is disabled

ve.ui.MWLinkTargetInputWidget.js
* Corrected documentation
* Blocked interaction while widget is disabled

ve.ui.TextInputMenuWidget.js
* Blocked interaction while widget is disabled

Change-Id: I7ea89873b50a98d058d1dd1e309e3e8b7c8e7b2e
Merge "Make translateRange() translate across wrapping transactions correctly"
Merge "Add ve.Range.prototype.isBackwards()"
Merge "Combine consecutive remove operations"
Merge "After creating a ve.Surface in a test, destroy it"
Use @chainable where appropiate.

Find: @return.*this.*$
Replace: @chainable
Bug: 45264
Change-Id: Ib950422ddb78d7b91545399a6053e82ae2dbd932
Make translateRange() translate across wrapping transactions correctly

Previously, we would translate to the right of an insertion, but for
wrapping transactions that means we end up with something like
<ul><li>|<p>...</p></li></ul>|, which doesn't make any sense. This
change changes this to <ul><li>|<p>...</p>|</li></ul>.

* Add parameter to translateOffset() that toggles the behavior for
  the offset before an insertion
* In translateRange(), translate start and end differently
** In some cases this can map them across each other, fix that

Change-Id: Ia2197b08d9f6763be3f2db5a59546ddc3f74a281
Add ve.Range.prototype.isBackwards()

Change-Id: I6f6977cfc9d772239da22ceb779e5e37576c2e0c
Combine consecutive remove operations

We already combine consecutive operations of other types, but didn't do
that for remove. We have to do this, though, because translateOffset()
gets confused otherwise.

Change-Id: I4285a3efd9f2297398f57e2f24adb26adafdf465
Merge "Cleanup selection displaying related methods in ve.ce.Surface."
Merge "Introduction of ve.ce.RangyRange class."
Cleanup selection displaying related methods in ve.ce.Surface.

* Deleted blocks of code that are never executed.
* Deleted method (showCursor) that is never used.

Change-Id: I031585b40f384d3e0e5d4cb03f626c9229d97fcf
Introduction of ve.ce.RangyRange class.

Change-Id: I44bcb79a5967c362774603ea27181b9c64d2ea96
After creating a ve.Surface in a test, destroy it

I was seeing intermittent test failures caused by exceptions in
ce.SurfaceObserver (!!), seems to be caused by the FormatAction test
creating a surface but not destroying it.

Change-Id: I7ab070d3c8db934eb9781ac8a6466475144c214e
Change one last .storeHTMLAttributes to .storeHtmlAttributes

Change-Id: I161b2e8bf22c3784ca660ab0961a528b23601022
Merge "Make the full document regex hack a bit more robust"
Merge "Make string type matches override regex type matches"
Merge "Add MWMetaNode to clean up <meta>/<link> hack in the converter"
Merge "Support RDFa type regexes in ModelRegistry"
Merge "(bug 45062) Implement the new node API in the converter"
Merge "Change context.wrapping to context.inWrapper"
Merge "Add .static.enableAboutGrouping"
Merge "Add .static.storeHtmlAttributes"
Make string type matches override regex type matches

Change-Id: Ic21e27c047d8cb1161a6613bb5232d0d19b37aa6
Add MWMetaNode to clean up <meta>/<link> hack in the converter

Change-Id: I4c69bff4981eef78415b43d31c3fd2ee271450ef
Support RDFa type regexes in ModelRegistry

Change-Id: Id19c3a567140f9e27ba732b6e8d9e25bc7a28a4f
(bug 45062) Implement the new node API in the converter

This changes the node API to work with multiple elements, so we can
support about groups. Instead of passing in and returning single DOM
elements, we use arrays of DOM elements.

ve.dm.Converter:
* Pass modelRegistry into the constructor
* Remove onNodeRegister handler and its data
* Remove getDataElementFromDomElement() and
  getDataAnnotationFromDomElement(). Most logic moved into
  getDataFromDom(), some into createDataElement()
* Remove createAlien(), replaced with
  createDataElement( ve.dm.AlienNode, ... )
* Replace doAboutGrouping() (which wrapped about groups) with
  getAboutGroup() (which returns an array of the nodes in the group)
* Put in a hack so <meta>/<link> elements with an mw: property aren't
  alienated
* Remove about group wrapping behavior in favor of just outputting
  multiple nodes

ve.dm.AlienNode.js:
* For multi-element aliens, only choose inline if all elements are
  inline, not just the first one

ve.dm.example.js:
* Add html/0 stuff for meta nodes
* Fix test case to reflect new alien behavior

Change-Id: I40dcc27430f778bc00a44b91b7d824bfb2718be6
Change context.wrapping to context.inWrapper

It's what the docs say it should be, so let's call it that :)

Change-Id: Ia10861ce77872243beb3d3a1886877824103f6c9
Add .static.enableAboutGrouping

Defaults to false, nodes can opt into about grouping. Not being used
yet, will be used in the converter rewrite.

Change-Id: Ic2a529241e69fb07ac926c826ead0108193b3050
Add .static.storeHtmlAttributes

Defaults to true, but set to false, so we don't do redundant work for
aliens.

Change-Id: If35db3a67afd78124b4b2b46bb78ad60cbac46f5
Merge "Implement SurfaceFragment.unwrapAllNodes and fix wrapAllNodes."
Merge "Fix bug with replacements in translateOffset()"
Merge "Fix ModelRegistry stupidities"
Implement SurfaceFragment.unwrapAllNodes and fix wrapAllNodes.

wrapAllNodes was calulating the new selection incorrectly. This has
been fixed and a test added.

unwrapAllNodes takes a depth as its argument and unwraps that many
elements from inside the selection.

Tests for wrap/unwrap apply also now check that applying a wrap
and then its inverse as an unwrap result in the document reverting
to its original state.

Change-Id: I7dcacdfb5894be59ffad69b369d7b32933a25b61
Fix bug with replacements in translateOffset()

In our test case, offset 12 was mapped to 16, but that should be 11.
The problem here was that the offset right before the removal was
mapped to right after the removal, but that's only valid if we're
dealing with a removal, not when we're dealing with a replacement
where we're both removing and inserting data.

Change-Id: Ibf3c1463c0de009578cd50736f19bae82669ced8
Merge "(bug 43461) Hide Phantoms"
Merge "(bug 45423) Create SurfaceFragment.isolate method"
(bug 45423) Create SurfaceFragment.isolate method

This method will take a selection of siblings and ensure they
are the only chlidren in their first parent which can be placed anywhere
(for example the first parent of a tableCell which can be placed anywhere
is a table, and for a listItem is a list).

The method ensures no redundant empty tags are created, so if
the selection encompasses all siblings then no action is taken.

Also in this commit are two test cases run against ve.dm.example.isolationData.

Change-Id: I783bd5ecd9d43d61f9b2685985409b4d746cbe94
Merge "Create tests for ve.FormatAction.convert"
Create tests for ve.FormatAction.convert

These 3 tests convert different selections of list items to headings.

Bug: 45216
Change-Id: I6cf042d9d5aa4afb68c0992f444b600ed69f0c04
(bug 43461) Hide Phantoms

This fixes a problem that phantoms would remain visible if moving the mouse quickly. Now binding to mousemove and also mouseout.

Change-Id: I4f5e3319038828f83b108e9f5a45f54ebfeb7027
Make the full document regex hack a bit more robust

Anchor the regex and make it look for doctype too

Change-Id: I43abb6f214a28801642bde46b50f4ac12614d1e4
Merge "Change {Boolean} to {boolean} throughout"
Introduce ve.Keys based on DOM Level 3 KeyEvent

Change-Id: I6abee2c0c49e355aef39089c7c94e51aaee01929
Merge "Make ve.copyArray() / copyObject() work with booleans"
Change {Boolean} to {boolean} throughout

Change-Id: Ibbbaed3762efa6a6928ba6e4611b1f1fef91ad8f
Merge "Very small cleanup of onCut method in ve.ce.Surface."
Very small cleanup of onCut method in ve.ce.Surface.

Use ve.bind in order to change context within which
callback is called - reduces a need of introducing
new local variable.

Change-Id: I75ece695548c87073dd22e5e7ec80057d7132d22
Fix ModelRegistry stupidities

* Register mw: as an extension-specific type
* Include 'property' as an RDFa type attribute

Change-Id: Ia70708b76294815eb8eb8132048c33b0636380e9
Make ve.copyArray() / copyObject() work with booleans

This should really be fixed to not enumerate all types but be nicer.
Timo said he'd do that.

Change-Id: I15807696a7324d3fb207ed41b442a83dc83a75ec
Bump copyright notice year range to -2013 over -2012

199 files touched. Whee!

Change-Id: Id82ce4a32f833406db4a1cc585674f2bdb39ba0d
Merge "Upstream: Update QUnit from v1.10.0 to v1.11.0"
Upstream: Update QUnit from v1.10.0 to v1.11.0

* Code:
  http://code.jquery.com/qunit/qunit-1.11.0.js
  http://code.jquery.com/qunit/qunit-1.11.0.css
* Tree:
  https://github.com/jquery/qunit/tree/v1.11.0
* Changes:
  https://github.com/jquery/qunit/compare/v1.10.0...v1.11.0
* Release notes:
  https://github.com/jquery/qunit/blob/v1.11.0/History.md

Change-Id: I3591455f0096471d073c94eaab424d151203b297
Make the converter work with full HTML documents rather than fragments

The Parsoid output will also be expected to be a full HTML document. For
backwards compatibility, we allow for the Parsoid output to be a
document fragment as well. We don't send a full document back yet, also
for b/c -- we'll change this later once Parsoid has been updated in
production.

ve.dm.Converter.js:
* Make getDataFromDom() accept a document rather than a node
** Split off the recursion (which does use nodes) into its own function
** For now we just convert the <body>. In the future, we'll want to do
   things with the <head> as well
* Pass the document around so we can use it when creating elements
* Make getDomFromData() return a document rather than a <div>

ve.init.mw.Target.js:
* Store a document (this.doc) rather than a DOM node (this.dom)
* Pass around documents rather than DOM nodes
* Detect whether the Parsoid output is an HTML document or a fragment
  using a hacky regex
* When submitting to Parsoid, submit the innerHTML of the <body>

ve.init.mw.ViewPageTarget.js:
* s/dom/doc/
* Store body.innerHTML in this.originalHtml

ve.Surface.js:
* s/dom/doc/

demos/ve/index.php:
* Don't wrap HTML in <div>
* Pass HTML document rather than DOM node to ve.Surface

ve.dm.Converter.test.js:
* Construct a document from the test HTML, rather than a <div>

ve.dm.example.js:
* Wrap the HTML in the converter test cases in <body> tags to prevent
  misinterpretation (HTML fragments starting with comments, <meta>,
  <link> and whitespace are problematic)

Change-Id: I82fdad0a099febc5e658486cbf8becfcdbc85a2d
Add ve.createDocumentFromHTML()

Converts an HTML string to a brand new document using an iframe hack
(proper ways to do this exist, but don't work cross-browser).

Parsoid will serve us full HTML documents rather than document fragments
soon, so we'll need this functionality (along with some other changes
that I'm working on now) to deal with that change.

This doesn't currently work quite right in IE8 (although we have lots of
other issues in IE8) as well. It's not that hard to fix up though: we
just have to leave the iframe attached to the main document (should
probably provide a destroy function in that case) and the tests have to
deal with the fact that IE normalizes <head></head> to
<head><title></title></head> .

(For backwards compatibility, we'll have to deal with document fragments
as well; this will be implemented as an MW-specific hack in the
integration in the next commit.)

Change-Id: I15f877583c39124ba1c5e8e22585297ff3bac8d6
Localisation updates from http://translatewiki.net.

Change-Id: I4a09f45475098c28a8862cbd419d4f7b6cafb0c9
Localisation updates from http://translatewiki.net.

Change-Id: I20aaef5aad0f74f46dd50cfd7cbd4ed00a153f11
Localisation updates from http://translatewiki.net.

Change-Id: Idda059853b3df58b733d99ab28156ddb7209b0c0
Merge "Abort activation when changing to view mode."
Localisation updates from http://translatewiki.net.

Change-Id: I134fd570e2881c051c2261054d5fbb43b42fc121
Abort activation when changing to view mode.

Resolves (Bug 44838)

Changes:
* onLoad: Setup only if activating.  Prevents ve from loading after aborted
while activating.

* onViewTabClick: add clause for activating mode.  Calls deactivate with an
override, and exits activating mode.

Change-Id: Ia61cd1d576b63098419474ad58bc01362c08541e
Optimize ve.filterArray a bit

Change-Id: I8fc9c8d5f57a4af3b5421c65664351f21e488c53
Merge "Change the HTML attribute prefix from html/ to html/0/"
Localisation updates from http://translatewiki.net.

Change-Id: I174b1db993124f5d965e06287a80d60654abb96c
Change the HTML attribute prefix from html/ to html/0/

This means that <p data-foo="bar"> will now be converted to a paragraph
with attributes {"html/0/data-foo":"bar"} rather than {"html/foo":"bar"}

This paves the way for multi-element node (about group) handling in the
node API: nodes representing multiple DOM elements will have html/i/attr
to represent an attribute of the i'th DOM element.

Change-Id: Iea52bdccd721942ca708c8f9f47e934524809845
Merge "Check for instance of generic LinkAnnotation when querying target."
Localisation updates from http://translatewiki.net.

Change-Id: I3a0914ad5d1dc4acd067991a624bca03af2a08e2
Check for instance of generic LinkAnnotation when querying target.

Resolves (Bug 44686)

Change-Id: I0ff962330e061aea66a25a923f46d6759e5ff6af
Localisation updates from http://translatewiki.net.

Change-Id: I637f92daed34ac338e858a0fd151cfae43cc2895
Localisation updates from http://translatewiki.net.

Change-Id: I1d4ab6e2e6012124c9ede2bc0ab895d74babb2f0
Merge "Fix bug where inline nodes didn't trigger wrapping"
Merge "Remove trailing commas"
Merge "Make JSHint ignore the docs/ directory"
Merge "Node cleanup"
Fix bug where inline nodes didn't trigger wrapping

When encountering an inline node (i.e. content node that's not a text
node) within a branch node that's not a content branch node, the
converter should start a wrapper. But it doesn't do this, it only opens
wrappers for text nodes and annotations.

Fixed this in the converter, added a test for it, and fixed an existing
test that asserted the broken behavior.

Change-Id: I6e143e21e68b68f0d85b8772e24a2d3a5d465410
Node cleanup

ve.Node.js
* Removed unused emitUpdate property
* Made traverseUpstream a dynamic method rather than static

ve.ce.Node.js, ve.ce.Surface.js
* Updated calls to traverseUpstream

Change-Id: I28a2dac61aa32668d35854fbdb7712401c42336a
Merge "i18n icons"
i18n icons

Graphics (*.ai, *.png, *.svg)
* Took a pass on all images making them sharper and clearer
* Renamed bold and italic to bold-b and bold-a
* Added bold-f, italic-k, bold-a and italic-a
* Reorganized illustrator file

ve.ui.Icons-raster.css, ve.ui.Icons-vector.css
* Added classes for new icons
* Appended bullet, number, indent and outdent class names with "list"

ve.ui.*ButtonTool.js
* Added definitions for static icon property
* For bold and italic, added i18n style definitions

ve.ui.ButtonTool.js
* Switched from re-using the name property (which is intended to be the symbolic name of the tool used when registering with the tool factory) to using an static icon property for defining the icon

Change-Id: I43e7c35835a1e6dfb06f2a70226fac0d395008e8
Remove trailing commas

JSHint doesn't detect this (this is an open bug against jshint), but
Eclipse does

Change-Id: Iebfc0f9c6263f60898739c9d19400357a65da0e9
Make JSHint ignore the docs/ directory

Change-Id: I1d590b44cf663a024ebb6c09a807f25392625152
Merge "Introduce context object in getDataFromDom()"
Merge changes Ie5f1f94b,I7b7a2d50,Ieda8383c,I36860bee

* changes:
  Use AnnotationSet rather than array in getDataFromDom()
  Hybrid-ify MetaBlock/MetaInline
  Hybrid-ify AlienBlock/AlienInline
  Specify (but do not implement) the context parameter to toDataElement()
Introduce context object in getDataFromDom()

* Introduce context object as specified for
  ve.dm.Node.static.toDataElement()
* Remove wrapping variable in favor of context.wrapping
* Remove wrappingIsOurs in favor of context.canCloseWrapper
* Introduce originallyExpectingContent and use it to repopulate
  context.expectingContent after closing a wrapper
* Replace most uses of branchHasContent with context.expectingContent
** Except for two cases where we need originallyExpectingContent

These changes fix a case where a metaBlock was generated in an inline
position. Updated the tests to reflect this.

Change-Id: I6baf6053f8a3a0b7d91487f812b9235a7b2b3db1
Use AnnotationSet rather than array in getDataFromDom()

Change-Id: Ie5f1f94bd62739ccf74c027dd0ba418fe2d91fa6
Hybrid-ify MetaBlock/MetaInline

Change-Id: I7b7a2d50637e2009742b290cb1bd0f4fc0395934
Hybrid-ify AlienBlock/AlienInline

Change-Id: Ieda8383c0c04df208f4c5f2aa7380427467049b7
Specify (but do not implement) the context parameter to toDataElement()

This allows the converter to provide the node handlers with context
information, which hybrid nodes (such as alien and meta) need to decide
which shape to take.

Change-Id: I36860bee560a38ee39a149109be3706e39258edc
Localisation updates from http://translatewiki.net.

Change-Id: Ia91eccdbac663c4cbcd0a967d98acce893cd9db4
Merge "Fixed documentation warning"
Fixed documentation warning

Please use backtick (it's to the left of the 1 key) around HTML elements in comments.

Change-Id: I473e88a2cb1f7fb725f21cd0e8b3f659189c15a0
Localisation updates from http://translatewiki.net.

Change-Id: I5f90aee8638592987274beb2456b109c85eca5e1
Add Iceweasel to supported browsers list

Depends on https://gerrit.wikimedia.org/r/46666

Change-Id: I1192ce6687ba69504d0c4be484e479ddebedbc87
Merge "Added tests and fixed inconsistencies for empty text node handling"
Merge "Added support for passing data into annotation constructors"
Added tests and fixed inconsistencies for empty text node handling

Continues where Ibb682332a6084e357104183641a104e3ae1e253f left off, adding tests and removing inconsistencies between the behavior of the document constructor, which was adding empty text nodes to empty paragraphs, and correcting other tests which expected empty text nodes to be there as well.

Change-Id: I414d061cdd494b8023f14e944eda2910a4dab0d4
Merge "Trigger refactor"
Automatically prune empty text nodes

When there's 2 entities or inline content nodes (like aliens) with text between them, removing that text should remove the node too. If you don't remove the node then CE won't think to make a slug between the two inline nodes.

Change-Id: Ibb682332a6084e357104183641a104e3ae1e253f
Trigger refactor

Objective: Simplify the registration and use of triggers

Changes:

* Renamed ve.Command to ve.Trigger
* Renamed command demo to trigger demo
* Removed language prefixing of triggers
* Generating trigger tooltips rather than hard-coding them in i18n
* Added documentation to clarify that only 'mac' and 'pc' are supported platforms, and how the default is chosen
* Simplified trigger registry's register command
* Updated trigger registrations

Change-Id: Ibab6ad5b5c86f24707f064967dc2119a81125392
Localisation updates from http://translatewiki.net.

Change-Id: I5171de253449ce947efe8969518da3a94bb839c6
Added support for passing data into annotation constructors

This resolves a TODO

* Added logic to support passing an argument into annotation constructor which is used as the data property (reusing the element argument)
* Updated documentation
* Simplified instantiation of annotations

Change-Id: I142b8fa3883bf70c896a2a568088d833814ef2dc
Localisation updates from http://translatewiki.net.

Change-Id: I936572e4e09bf17e23d30b9907cdbdce280fca2a
Localisation updates from http://translatewiki.net.

Change-Id: Iede32ba7a624255707727bdf5d9f144aa39b73b3
Localisation updates from http://translatewiki.net.

Change-Id: I1f79d22cd0f29a4289400306059c0e25e0063479
Merge "Add extension-specific types functionality to ModelRegistry"
Merge "Allow matchTagNames = null in ve.dm.Converter"
Merge "Added @source links to externals"
Add extension-specific types functionality to ModelRegistry

Extension-specific types are RDFa types (or type regexes) that are
registered with the ModelRegistry separately. If an element has a type
that is extension-specific, then that element can only be matched by a
rule that asserts one of its extension-specific types.

For MediaWiki, we would call
ve.dm.modelRegistry.registerExtensionSpecificType(/^mw:/ ) .
So then an element like <span typeof="mw:foobar"> would either match a
rule specifically for mw:foobar, if one exists, or no rule at all; even
the rule for <span> would not match. The consequence of this is that
elements with unrecognized mw:-prefixed RDFa types are alienated.

Change-Id: Ia8ab1fe5dffb9f813689324372a168e8e4a3e0bc
Allow matchTagNames = null in ve.dm.Converter

This won't usefully register the node with the converter right now, but
we need to allow this because the ModelFactory tests will need to have
stub nodes with tag-only matches.

Change-Id: I023cc8ff647363ab55c73dff39b17ca47e9e6681
Added @source links to externals

Change-Id: Ib0c97a194e6abac5beec247a70497cc12a43dad4
Add wrapper for Array.prototype.filter

Change-Id: Ie7d8dd4193a81bedbb75258494bd78e8236bd0e8
Actually use this.nodeFactory and this.annotationFactory in ve.dm.Converter

Change-Id: I138a437d2e64577ad905ff70ecedf1eb7e6c8360
Drop name parameter from ModelRegistry.register(), use .static.name

Change-Id: I74eeab1195455072ae48ac0655582f2bf01806d6
Move matching code from AnnotationFactory to ModelRegistry

ModelRegistry registers both annotations and nodes, and performs
matching on both at the same time. It also registers annotations with
the AnnotationFactory, and nodes with the NodeFactory.

Change-Id: I5e68e506a0e573cc0afe6304ccea058ffc20d1c8
Fixed documentation errors

Many of these problems were introduced in I859b5871a9d2f17d970c002067c8ff24f3513e9f

Change-Id: Ifc2dc4934f782c4ce5107e3a356e357aef754083
Merge changes I8ee4796a,I2629c5fd

* changes:
  Make defaultAttributes a static property as well
  Replace nodeFactory invocations with direct static access
Merge "Convert node rules to static properties"
Merge "Add annotation-like static properties to nodes"
Merge "Enable VisualEditor in MediaWiki integration for IE 9 and up."
Enable VisualEditor in MediaWiki integration for IE 9 and up.

Change-Id: I987223589c2a6b61dde5e2db8234cca40e237eec
Localisation updates from http://translatewiki.net.

Change-Id: Ieedf1c85849348ddef28ec360b2d4dde0ff82286
Localisation updates from http://translatewiki.net.

Change-Id: I4433a78e3a9baa78d97d4e2c975971860733918a
Localisation updates from http://translatewiki.net.

Change-Id: I3dc88656fb58d21aa7e8321d1b08659ddfecac5a
Localisation updates from http://translatewiki.net.

Change-Id: Ibc33a284b2b57ec299b099633d5b373f6483fe11
Make defaultAttributes a static property as well

Change-Id: I8ee4796a93d55db9be6e43c78f3ac7bb29a65c6f
Convert node rules to static properties

Change-Id: If7d0159e984d9ccb4d5c31effb62bb9612260fda
Add annotation-like static properties to nodes

Add static properties for matching, data<->DOM conversion, and name. Use
matchTagNames, toDataElement and toDOMElement. name isn't used yet.

Change-Id: I5e7df3303bbd65e6968e931b568c23d76003a9a4
Replace nodeFactory invocations with direct static access

Change-Id: I2629c5fd659bca166237cef425f7cc3aff13ba0e
Merge "Fix naming of phantoms"
Merge "Inline ve.dm.Document.offsetContainsAnnotation"
Fix naming of phantoms

Change-Id: I60e925ee83fa2670eeabc5b690928f6f029b2eb4
Merge "Fixes for typos and some missing documentation"
Merge "Convert "var\t" to "var ""
Add TriggerRegistry to tests

Fixes tests broken by 8ba81f4d67c6a02d7456c97f92cbc169fc50bbff

Change-Id: Idd53d5c28941fa738b3a790977c0e7f0e65faaa9
Introduced method replacePhantoms in ve.ce.Surface in order to avoid accessing ve.ce.Surface local variable ($phantoms) from ve.ce.AlienNode

Change-Id: I9754d98175c7353f6db5306bc2ce35d6c57fdedb
Convert "var\t" to "var "

Partially reverts I45ee3fd5b2131131f3d10e05a1cc2f32a3e091cc (I read the diff backwards)

Change-Id: I5a638b8d13ed27a78586ff5507a421d7c49c9679
Fixes for typos and some missing documentation

Lots of fixes for "it's" being used incorrectly.

ve.ce.Document.js
* Filled in documentation for missing params

ve.FormatAction.js
* Fixed incorrect tag for returns documentation

Change-Id: Ic256cc6952c31f5e6ae8be92919a0799cfe6188b
Merge "Slug Todos"
ImageNode Todos

* Removed mousedown handler (dragging is handled in ve.ce.surface)
* Added attribute change handler to ve.ce.Node to keep attribute changes on the model in sync with the DOM

Change-Id: I1d6a7f3dc3136439ce511a4f3eb5a54797c8f996
Merge "Add interplatform, i18n shortcuts to ui buttons."
Add interplatform, i18n shortcuts to ui buttons.

Objective:
* Put command shortcuts in button title attributes. (Bug 42919)
* Provide a registry for platform specific command triggers and their
corresponding i18n messages. (Bug 44012)
* Enable loading of triggers after ve.Surface is created. (lazy load)

Changes:

VisualEditor.i18n.php
* Add default trigger i18n messags for mac and pc system platforms

VisusalEditor.php, demos/ve/index.php
* Add links to files

ve.init.mw.Platform.js
* Define getUserLanguage and getSystemPlatform methods.

ve.init.sa.Platform.js
* Define getUserLanguage and getSystemPlatform methods.

ve.init.Platform.js
* Define abstract methods: getUserLangauge, getSystemPlatform

ve.ui.BoldBUttonTool.js, ve.ui.IndentButtonTool.js, ve.ui.ItalicButtonTool.js,
ve.ui.LinkButtonTool.js, ve.ui.OutdentButtonTool.js, ve.ui.RedoButtonTool.js,
ve.ui.UndoButtonTool.js
* Add registration for command triggers.

ve.Surface.js
* Methodize loading of triggers.
* Bind register event to ve.triggerRegistry to allow lazy loading of triggers.

ve.ui.Tool.js
* Init pre-registered tooltip messages.
* Update tool titles when new triggers are loaded.

ve.CommandRegistry.js
* Remove command registration ( moved to buttons themselves )

ve.TriggerRegistry.js
* New class for registering triggers.

ve.init.mw.ViewPageTarget.js
* Changed instance of unindent command to outdent.

Change-Id: Id8580a3f81aac751db0b7482422a73912648dfed
Double spaces optimization

Moved the sequential space check into the whitespaceHtmlChars and htmlChars loop

Change-Id: I835cccf868fed851f25f5ccbba1386697b0ea66b
Reorganization of ve.ce.Surface methods

Logical grouping for Init, Browser Events, Custom Events, Utilities, Helpers, Getters, and Setters. This may be a precursor to a future, larger refactoring.

Change-Id: I059f88a604f0b5bc383eb3ae274bab0fe2dc476b
Merge "Cleaned up paste target and surface styles"
Cleaned up paste target and surface styles

Resolves a TODO related to the paste target div.

VisualEditor.php
* Added link to ve.Surface.css

ve.Surface.js
* Cleaned up initialization of .ve-surface element
* Removed float clearing div (see ve.Surface.css)
* Removed paste div (moved to ve.ce.Surface)

ve.Surface.css
* Added rule which adds an ":after" element to handle clearing floats

ve.ce.Surface.js
* Cleaned up initialization of DOM elements
* Added paste target div
* Replaced paste element selectors with direct references to this.$pasteTarget

ve.ce.Surface.css
* Changed paste div styles to use a namespaced class instead of a generic ID

demos/ve/index.php
* Added link to ve.Surface.css

Change-Id: Ib93d45ac82ae643fc8e659f5a063c02a8ddacdde
Slug Todos

Setting display of block slugs with CSS.

Change-Id: I249015618f934f8c162912883dbd4452fa266b3f
Merge "Minor cleanup."
Fix minor bug (typo - was: ve.ve, is: ve.ce)

Change-Id: I588d7237fb57be28fcfbb8aa3b0ff2288c3bdae6
Minor cleanup.

Change-Id: I45ee3fd5b2131131f3d10e05a1cc2f32a3e091cc
Merge "Removing alienblock tag"
Inline ve.dm.Document.offsetContainsAnnotation

Resolves TODO

ve.dm.Document.js
* Removed offsetContainsAnnotation method
* Inlined uses of removed method

ve.dm.Transaction.js
* Inlined uses of removed method

ve.dm.Document.test.js
* Removed test for removed method

Change-Id: Ie970234ad5d8c0417389b8a45defec9fd5be6a79
Removing alienblock tag

One of our demos literally used an <alienblock> tag to trigger alienBlock behavior. Since this is not registered in ve.js blockTypes array, I'm just switching it to a <div> for the demo.

Change-Id: I68bff80fcbdd794eeae94dff43f7ef82f972cdb5
Remove range.normalize (not needed), use range.isCollapsed more often

The normalize method doesn't need to be explicitly called anymore because there's not any code that changes the properties of a range directly anymore.

A good way to prove it's not needed anymore is to move the normalization logic to the constructor and then add "console.log(this.from <= this.to );" to the normalize method - you will find that it's never actually doing anything at all because the range was normalized by the constructor.

ve.Range
* Moved normalization logic to constructor
* Removed calls to normalize method
* Removed normalize method
* Simplified documentation for flip method
* Whitespace fixes

ve.Document, ve.dm.Transaction, ve.dm.Surface, ve.dm.Document, ve.ce.Surface
* Removed calls to range.normalize
* Switched to using range.isCollapsed instead of comparing properties directly

Change-Id: I80bfd06f88579c34dce2083c2b70d63ab92f1275
Major Documentation Cleanup

* Made method descriptions imperative: "Do this" rather than "Does this"
* Changed use of "this object" to "the object" in method documentation
* Added missing documentation
* Fixed incorrect documentation
* Fixed incorrect debug method names (as in those VeDmClassName tags we add to functions so they make sense when dumped into in the console)
* Normalized use of package names throughout
* Normalized class descriptions
* Removed incorrect @abstract tags
* Added missing @method tags
* Lots of other minor cleanup

Change-Id: I4ea66a2dd107613e2ea3a5f56ff54d675d72957e
Localisation updates from http://translatewiki.net.

Change-Id: I1f4f17c7f1e7ef53cc0bb8f24a907e215c364e48
Make ve.dm.AnnotationFactory a named function rather than an anonymous function

Trevor, this could be another target for a cleanup spree, maybe?

Change-Id: Id37903ef452ff9758ac6c70c9e21faaff66c6f0b
JSDuck: Fix warnings

Warning: modules/ve/test/ve.qunit.js:5: Class QUnit not found
Warning: .docs/categories.json No class found matching a pattern 've.Position' in categories file
Warning: modules/ve/ce/ve.ce.Surface.js:1297: Unknown type MouseEvent
Warning: modules/ve/ce/ve.ce.Surface.js:1297: Unknown type int

Follows-up:
* Ic21c9d3f
* Ib521eaa6

Change-Id: I8e371a2d4d91a1f03bd4ef59d18b7df715f23238
Merge "MetaBlockNode should be a BranchNode, not a LeafNode"
Merge "Make stub nodes inherit correctly"
Merge "Fix test breakage in 90f046799"
Localisation updates from http://translatewiki.net.

Change-Id: If669449da461d18437a6517d935f6f3c58f33e48
Localisation updates from http://translatewiki.net.

Change-Id: I7f8958a151049fef2bbbd94e3213ff12f14221ac
Merge "Removed code for and links to unused libraries"
MetaBlockNode should be a BranchNode, not a LeafNode

Change-Id: Id6f99ffce553d45cb2bc0250721ceec25333e1dd
Make stub nodes inherit correctly

Some of these stubs didn't inherit Node at all. Made them all inherit
LeafNode because their rules specify they can't have children.

Change-Id: If4afc8de350f67ee78a41307c426ec2aceeb884f
Fix test breakage in 90f046799

The title attribute should only be rendered. It should not be put in the
HTML that is sent back to Parsoid.

Change-Id: I63c0373c71c3bf01a4238af3ccd02c835a118e2f
Ignore Eclipse files

Change-Id: I8002d5d98011c3b53e868ccb5ef676c35743a7c7
Removed code for and links to unused libraries

Removes:
* ve.Position
* jquery.multiSuggest
* jquery.json

Change-Id: Ic21c9d3f5fe8a71d37a1a3633baa6325ca5d51b3
Merge "More {String} -> {string} conversions in documentation"
More {String} -> {string} conversions in documentation

Follow up for I6a7c9e8ee8f995731bc205d666167874eb2ebe23

The first pass that Timo took missed the following cases

* "{Array|String}": string is just one of the values
* "{String[]}": string is followed by [] to indicate an array of strings

Change-Id: I65e595e8d37fb624802d84af9536a2d3c5d73c7d
Merge "Initialization error when canceling load"
(bug 42398) Kill ve.ce.Meta{Block,Inline}Node, not needed.

CE doesn't actually render meta nodes anymore now that we split them out
into the meta-linmod.

I took a stab at consolidating metaBlock and metaInline (into simply
'meta'), but we can't do that with the current node API unless we put a
lot of meta-specific hacks in the converter. So I'm leaving this for the
node API rewrite.

Change-Id: Ie83413df718eabcaeb504316a2db0d24a1be2226
Merge "Triple-Click Detection for IE"
Triple-Click Detection for IE

IE does not properly support MouseEvent.detail for reporting the number of clicks in a user action. The new clickCounter() function takes a mousedown event and returns the detail property if non-IE or calculates the detail by comparing to a recent history (up to 3) of mousedowns.

Change-Id: Ib521eaa695d7e436d67ebb49106159daadc2ee38
Merge "(bug 43056) Inline tags like <span> are block-alienated sometimes"
Merge "BugID 43076 - Fixes to alien and phantom corner cases"
Merge "Trivial wording change to disclaimer meant to be done before launch"
Merge "Set title attributes for internal and external links."
Initialization error when canceling load

Added check for the existence of the surface before the save dialog is hidden. This oversight caused errors when there was a load error and the user clicked cancel.

Change-Id: I3b6d8d4d9f4c81ffcbd7996d6b17ac04f33bf6d7
Merge "JSDuck: Generated code documentation!"
Localisation updates from http://translatewiki.net.

Change-Id: Iab61dbf42cb2dc61bebc9960116229e249eb1d06
Localisation updates from http://translatewiki.net.

Change-Id: I0f6a8f9f101d8ba5b2382cdc1ea7e6cd1ad28499
Localisation updates from http://translatewiki.net.

Change-Id: I78cbf7250e1475ed145055e5c2d590af042817a1
Localisation updates from http://translatewiki.net.

Change-Id: I50ab1323ccc7192465e5cefa71a5abb30ab5dc4c
Localisation updates from http://translatewiki.net.

Change-Id: I12838f56addebc08a200a9c626d97891b95ff7eb
Localisation updates from http://translatewiki.net.

Change-Id: If55ce5814a3471480e0acedc87905a98ecf594fd
Localisation updates from http://translatewiki.net.

Change-Id: I682f716924f7c8e214ca7705dfc4a08961285496
Localisation updates from http://translatewiki.net.

Change-Id: I39b0dc4c8a2ce55c462aac6ceebc4a722e369b7d
Localisation updates from http://translatewiki.net.

Change-Id: I58cb40894e2ba167ed9d300cd572a81e435b9cc3
Localisation updates from http://translatewiki.net.

Change-Id: Ia65549e788fc97248a113240139e82d94663d7d1
Remove en-gb

Same as en. Superfluous.

Change-Id: I6f3a6a2779e935ab4f76d9f5cfa529b16994b9b4
Localisation updates from http://translatewiki.net.

Change-Id: I3601870992d4b8feb6e7952776218bfb85cbf394
BugID 43076 - Fixes to alien and phantom corner cases

The {{coords}} template is correctly rendered as an inlineAlien, which previously did not have shields. However, the template has a deeply nested span that is positioned and floated. The fix is to shift shielding logic up to AlienNode (from AlienBlockNode) and to show phantoms on all shields (both block and inline). I've also updated the aliens demo to exhibit this corner case.

Change-Id: Ifce60c7762c0ead5c6fe29d6eabf601c1565cbfa
Merge "Fixing label tag in demo"
Localisation updates from http://translatewiki.net.

Change-Id: I368511b4adc0a4d7f700aa0812305edaa01f60ce
Fixing label tag in demo

Change-Id: I5715ec4a4f710bcadbe226b79a930d71dfd9e2d1
Localisation updates from http://translatewiki.net.

Change-Id: I00df3f25088c46eda00b2c3aa210757a4b73076c
Merge "Fix outdent tooltip calling for a non-existant message"
Localisation updates from http://translatewiki.net.

Change-Id: Ic13434f023a33edc221881b6b085cc51107a06fc
Localisation updates from http://translatewiki.net.

Change-Id: I81ecea2a6e989ac25c382195e8acad69ebd5b26c
Merge "(bug 43098) Prevent alien node contents from floating above phantoms."
Localisation updates from http://translatewiki.net.

Change-Id: I8c4bd126e41e9b3087f74a6356557d9ded88e87b
Localisation updates from http://translatewiki.net.

Change-Id: I271d6fd62d52ff8a456b19e3297d3d1d914f70d3
Trivial wording change to disclaimer meant to be done before launch

Change-Id: Ic89b3f0847f4f9ebd798ab36b7732c7f6e9a81ce
(bug 43098) Prevent alien node contents from floating above phantoms.

* Sets z-index of alien blocks to 0.
* Simplify alienNode css
* Add missing -ms-user-select: none;
* Add missing [-moz-|-ms-|]user-select: element
  (webkit doesn't support element, auto is closest)

Change-Id: I889074a659483ce3d48380be5f50f80abb573286
Fix outdent tooltip calling for a non-existant message

Change-Id: I8b39f116181310b86d804a567eedf9c68bde594f
Localisation updates from http://translatewiki.net.

Change-Id: I79058ee012e3fde329ab0fc19205af2686a5b189
Set title attributes for internal and external links.

Fixes (Bug 37904)

Change-Id: Ib987f74fa9f326fe583683401424c79ba9651caf
Localisation updates from http://translatewiki.net.

Change-Id: I5869cd6c77c94e4c3994917860c6f399cc4ec274
Merge "(bug 43040) All edits were being marked as minor"
(bug 43040) All edits were being marked as minor

&minor=false doesn't work, but &minor=0 does

Change-Id: I73e18e7b58a151d78d56aa199cdfadb6d7150f1d
Merge "Typo from I65447da8."
Typo from I65447da8.

Change-Id: I27cce9784149cf1e98c4ed144ead4718978a74ae
Merge "Handle a null response in onLoad()"
Merge "Close suggestions when escape key pressed."
Merge "Only call showSelecton on undo and redo if there is a returned range."
Handle a null response in onLoad()

Change-Id: I6ce6c3b313c4785db1bad47c8822cca5114d17a3
Close suggestions when escape key pressed.

Fixes (Bug 43051)

Change-Id: I5e6baeec62da49b10793f2ebe7d341697a63f9c4
Merge "Save dialog: Fix too-wide diff box."
Merge "(bug 43013) Exclude edit notices with no visible text."
Merge "Phase out $.toJSON, use JSON.stringify directly."
Phase out $.toJSON, use JSON.stringify directly.

Although $.toJSON optimises heavily for modern browsers (it
becomes a direct reference to JSON.stringify), we still load the
extra plugin.

JSON is specified as part of ECMAScript 5, but most browsers
supported this one before they supported the rest of ES5.

http://caniuse.com/#search=JSON

Cut off for native JSON is IE7, Firefox 3.0 (3.6 supports it) and
Safari 3. Not any of our concern as VE will most likely never
support those (certainly not at this point in time, and less
likely as time goes on).

Change-Id: I4e8f26ac94763fa38d29e41264de0247f53a21e5
(bug 43013) Exclude edit notices with no visible text.

en.wikipedia.org has a template gala for edit notices with a whole
bunch of html framework outputted by default from
MediaWiki:Editnotice-0 (even if their underlying system has no
matches for the current page).

In the core editor from EditPage.php this isn't a problem as the
element is just idling hidden above the editor.

In the case of VisualEditor (where we have a custom delivery for
the edit notices) we don't want to say "1 notice available" on
every page, so we need to be smart and quickly walk the dom of the
notice, filter out invisible nodes, and if the resulting nodes
have no contents, ignore the notice all together.

Change-Id: I65447da8b88a9bae9c24ff155544ff66b3fe9100
Disabled VisualEditor section edit link overrides by default

Server config: $wgVisualEditorEnableSectionEditLinks
Client config: mw.config.get( 'wgVisualEditor' ).enableSectionEditLinks

Change-Id: I859546475a32a686e318aa7108396606b5a0a78d
Localisation updates from http://translatewiki.net.

Change-Id: Ie9545be769df90cab2d67bdd20cd68d25f643da6
Only call showSelecton on undo and redo if there is a returned range.

Fixes (Bug 43033)

Change-Id: I36745a01fad135b8eb02ee0da22d74ebf0a4c118
Link 'user' namespace as well as 'main' in preferences label

This was skipped due to time constraints; now fixing up.

Change-Id: I4ef25c0aeabdcf14a078aa3360e43db223010ff7
Merge "Add "and User namespace" to message"
Save dialog: Fix too-wide diff box.

The rules have changed, these constraints are no longer needed
and actually causing the table.diff to ignore the restrictions
and bump out of the container beyond the width of the window.

This restores the condition under which table.diff is displayed
by core EditPage.php.

Follows-up I5f59482f4db.

Change-Id: I456644bf14efab7dac351818d5c3bb69b9b3c993
Add "and User namespace" to message

enwiki now also has VE enabled in NS_USER

Change-Id: Ic96d09fe0a54c43d1c951d44c1c4efe3006f75c8
Add missing qqq strings and other minor clean-ups

In our rush to get the code out of the door, we skipped the qqq strings for some
of these strings, and we left a ghastly i18n hole in the middle. Now fixed.

Change-Id: I88319cdc2d10f99a631989047a571a7a3e7122da
Fix renamed message keys

Some of the message keys have been renamed but only in English; find/replace of others.

Change-Id: I4d85fe2d4da5a4a09083223701ae10810caee6cb
Merge "Remove cruft from suggestion tool."
Merge "Save dialog: Implement new "Review and Save" model."
Merge "Make {{PAGENAME}} in edit notices work by setting $wgTitle"
Save dialog: Implement new "Review and Save" model.

Basically saveDialog-body now has three slides:
* review
* report
* save

There is a viewPage.swapSaveDialog method that is called like this
 viewPage.swapSaveDialog( 'review' );
initially called from showSaveDialog.

Misc:
 * Replaced more reused core message with a ve ones:
   savearticle => visualeditor-savedialog-label-save
   showdiff => (removed)

 * Removed min-height from saveDialog. When slide-review is
   load, it is very short and there shouldn't be 10em's of
   whitespace below the loader + buttons.

To avoid problems with diff cache being cleared while looking
at the save dialog, we lock and unlock the surface.
We could later remove this as and optimise it as feature, but for
now this fixes a bug.

Change-Id: I5f59482f4db16264014720b199d7652843c36108
Make {{PAGENAME}} in edit notices work by setting $wgTitle

This is TERRIBLY DIRTY and I am ashamed

Change-Id: Ief6f7b81de966d5f87e802c4385ae041f98bde6d
Merge "Store HTML before the converter messes with it"
Remove cruft from suggestion tool.

-Prevents previously inspected link suggestions from showing prior
to rebuild.
-Ability for onInput to be executed immediately.
-Removed duplicated logic from open method.
-No longer calling onInput on enter key.

Change-Id: I11792b03ec01cc1929009fb76089adcc86c97629
Store HTML before the converter messes with it

Change-Id: I51f0a97a266522e46f415fd7618c3ef26a8924cd
Added disable/enable methods to ve.Surface

Change-Id: I65a93c590ace58b666adcb792bc825174a3f95c6
Localisation updates from http://translatewiki.net.

Change-Id: I0b2116010549ad4ab035abd0fba0b4134e8b242a
Save dialog: Various clean up.

Drop "-down" class in favour of :active CSS pseudo-class.
* http://kimblim.dk/css-tests/selectors/
* http://www.quirksmode.org/css/contents.html
* http://caniuse.com/#search=css%202.1

Rename methods consistently to enableFoo and disableFoo.

Use mw.notify instead of mw.util.jsMessage (the latter takes a
string of html and parses it, instead of taking text).
Also, jsMessage is obsolete (legacy wrapper around mw.notify).

Rename slide-main to slide-save in preparation of other slides
and introduction of multi-step save dialog.

Re-introduce "disabled" state (not css, but actual state) so that
pressing "Show changes" multiple times will not spawn multiple
async operations. The save function guards against this by keeping
a static property in the internal helper method, but there are
still some operations happening between the button and that method
this should be guarded in the UI instead. Follows-up I67819168.

Change-Id: Idf0331377e6be814ccae853228d6159b4ad5a159