Clean up ve.dm.SurfaceFragment#isolateAndUnwrap a bit

* Move tx variable into inner function
* Merge startOffsetChange and endOffsetChange into adjustment

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

Change-Id: If55a165f97ca7c82d71ee613a2a8ac7980815f92
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
Merge "Revert "'The great ' + getRandom(classList) + ' rewrite of ' + new Date().getFullYear();""
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
[BREAKING CHANGE] Pass fragments, not surfaces, to windows (reprise)

This re-instates commit 7203025af78.

Change-Id: Iff779f3f40d86b9a40f2a2a5fc276571f53797c1
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
Prevent context flashing on window resize

Change-Id: I422da46293e283c0b57d062cca225fc891c379da
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
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
Merge "Refactor Scalable functionality"
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 "[BREAKING CHANGE] Pass fragments, not surfaces, to windows (reprise)"
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 "Convert language name to lower case when looking for i18n file"
Merge "Fix ve.dm.SurfaceFragment#getSelectedNode"
Merge "Clean up ve.dm.SurfaceFragment#isolateAndUnwrap a bit"
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
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
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