Fix several size-related issues in inlineEditor.

inlineEditor worked alright in most of our previous cases, but while
investigating some issues today, I realized it just wasn't as smart as
it should be.

When figuring out its ideal size, it was assuming that the input would
have the default box-sizing of content-box. If it was anything else, the
calculations would be off, due to assumptions when calling getExtents().
It now checks before deciding what needs to be called.

It has some new smarts regarding the button size allocation.
Previously, it would assume that if there were buttons, and it's a
single-line editor, that the button widths should be factored in. If
custom CSS places the buttons on the following line, those widths
are no longer factored in.

This also goes back to using `display: none` instead of
`visibility: hidden` for the edit icon. This was intended to keep the
height of the line the same so that the text and the content below it
doesn't jump when the icon is shown or hidden. Instead of doing this,
it's now up to the consumer to pick a line-height that's the greater of
the icon height and the text height, and use that for both elements.
That will keep the text and layout consistent.

Changing how the edit icon is hidden also gives us more space for the
actual field, since we no longer need to make room for the icon (to
prevent wrapping).

Reviewed at https://reviews.reviewboard.org/r/6172/
Allow greater control over inline editor buttons and rendering.

The buttons element is no longer always a <div>. If it's a multi-line
editor, it will appear as a <div/>, but if it's a single-line editor, it
will appear as a <span/>. This is preferred over hard-coding a
`display: inline` style on the element, and will have the same effect by
default. Custom CSS can then override it to have whatever display style
is appropriate.

There are also cases where a caller may need to set some properties on
an element before actually showing the editor and triggering the layout
code. For example, an element may need to be set that would impact the
positioning of the buttons or some other aspect of the editor.

To handle this, there's now a beginEditPreShow event that callers can
listen to. This is displayed immediately before the editor is shown.

Reviewed at https://reviews.reviewboard.org/r/6173/
Merge branch 'release-0.8.x'
Fix thread-related issues with extension data/media installation.

When attempting to install media/data for an extension, we'd grab a lock
so that only one thread/process on the system could write the files and
update the data at once. When originally written, this worked well
enough, as it was using fcntl.flock() to lock the file. This wasn't
cross-platform, though, so we updated it to use Django's lock wrappers.

Those wrappers are broken in Django versions prior to 1.7, for this
case. Instead of using fcntl.flock(), they use fcntl.lockf(), which is
buggy on Python with threads, and results in separate threads being able
to grab the same lock at the same time, preventing the whole locking
strategy from working.

This is fixed in newer versions of Django, but we can't wait for that.
Instead, we're pulling in the locks.py from Django 1.7 and sticking it
in djblets.util.compat. It's important to note that this module is not
guaranteed to remain indefinitely, as we would like to eventually use
Django's upstream version.

There was also an issue where multiple threads all tried to delete the
lock file. A simple try/except around it fixes this. If the file wasn't
found, we ignore it, since another thread likely deleted it. Anything
else results in a log error. (This was the original problem that led me
down this rabbit hole.)

To ensure that this all works, I've written a new unit test for media
installation. It makes use of a lot of the same multi-threaded testing
that another test used, so that has been pulled out into reusable
functions, simplifying both test cases considerably.

Without these fixes, the new test catches the multiple calls for media
installation, and the breakage from attempting to delete the lock file
twice. With the fixes, the test passes.

Reviewed at https://reviews.reviewboard.org/r/6186/
Merge branch 'release-0.8.x'