Bug 1028497 - Part 1: Add pref for CSS Font Loading API.

We start with this preffed off even in Nightly builds since we'll need
to support iterators on FontFaceSet objects (and remove the indexed
getter) before exposing it to authors.
Bug 1028497 - Part 2: Add Web IDL interfaces for CSS Font Loading API. r=bzbarsky
Bug 1028497 - Part 3: Add skeleton implementations of CSSFontFaceLoadEvent, FontFace, FontFaceSet and FontFaceSource. r=jdaggett
Bug 1028497 - Part 4: Move the nsUserFontSet object into FontFaceSet. r=jdaggett

This (a) moves ownership of the gfxUserFontSet into FontFaceSet, (b) moves
nearly all of the functionality of nsUserFontSet into FontFaceSet, and (c)
adds a class that inherits from gfxUserFontSet so that we can override some
of its virtual functions and delegate them to the FontFaceSet.
Bug 1028497 - Part 5: Implement document.fonts. r=bzbarsky
Bug 1028497 - Part 6: Have a FontFace::Entry class extending gfxUserFontEntry that can inform the FontFaceSet about loading. r=jdaggett

We can't make FontFace inherit from gfxUserFontEntry, since the former
is cycle collected.  So instead, we have a small class that inherits
from it that will override its virtual methods and forward things on to
the FontFace object.

We make gfxUserFontSet::CreateFontFace virtual so we can override it to
produce instances of our gfxUserFontEntry subclass.
Bug 1028497 - Part 7: Add ability to create a FontFace for a @font-face rule; store it on the nsCSSFontFaceRule. r=jdaggett,bzbarsky

Every nsCSSFontFaceRule that is used will get a FontFace object to
reflect it in the FontFaceSet.  Here we add storage on the
nsCSSFontFaceRule for its FontFace, although it will be the
FontFaceSet's responsibility to set it.  We also add a static
constructor function on FontFace to create one that reflects a rule.
Bug 1028497 - Part 8: Implement Length and array access on FontFaceSet. r=jfkthame

This is a temporary measure until we support iterators on the
FontFaceSet; the spec does not expose FontFaces as indexed properties on
the FontFaceSet.
Bug 1028497 - Part 9: Implement FontFace.status. r=jdaggett

We make gfxUserFontEntry::SetLoadState virtual so that we can hook into
changes and update FontFace::mStatus.  We can't just reflect the
gfxUserFontEntry's value in FontFace::Status() since the spec has
requirements about when exactly the status is set.
Bug 1028497 - Part 10: Implement FontFace descriptor getters. r=jdaggett

We add an mDescriptors that will be used to store the descriptor values
of an unconnected FontFace object.  For CSS-connected FontFace objects,
the descriptors are stored in the nsCSSFontFaceRule::mDecl.mDescriptors.
(Both of these use the same type, though, CSSFontFaceDescriptors.)

Ideally we could have the descriptors always stored on the FontFace,
and for the nsCSSFontFaceStyleDecl go and fetch them from the FontFace,
but it turned out to be impossible to ensure that a FontFace could be
created whenever a nsCSSFontFaceStyleDecl was cloned, since it needs
access to the window object to create the FontFace's promise objects!
Bug 1028497 - Part 11: Implement FontFace descriptor setters. r=jdaggett

These set the descriptors, but don't cause anything to update, just
like setting descriptors on an @font-face rule's style declaration
doesn't do anything yet.
Bug 1028497 - Part 12: Implement FontFace.loaded. r=jdaggett,bzbarsky
Bug 1028497 - Part 13: Implement FontFace.load(). r=jdaggett
Bug 1028497 - Part 14: Rename some methods to talk about UserFontEntry instead of FontFace. r=jdaggett

How that we have a class named "FontFace", it's a bit confusing for some
of the gfxUserFontSet methods to have "FontFace" in their names, so I'm
renaming them to mention "UserFontEntry" instead.
Bug 1028497 - Part 15: Store FontFace objects on the FontFaceSet rather than nsCSSFontFaceRules. r=jdaggett,bzbarsky

Here we change FontFaceSet's records array to associate gfxUserFontEntry
pointers with FontFace pointers, rather than with nsCSSFontFaceRule
pointers.  This will make it more uniform to handle both CSS-connected
and unconnected FontFace objects when rebuilding the user font entries
under UpdateRules.
Bug 1028497 - Part 15.1: Store user font entries in FontFace objects. r=jdaggett
Bug 1028497 - Part 16: Don't destroy the user font set if there are no @font-face rules. r=jfkthame

We can no longer call FontFaceSet::DestroyUserFontSet (what used to be
nsUserFontSet::Destroy) in nsPresContext::FlushUserFontSet, since we
need to keep tracking FontFace objects even if the list of @font-face
rules is empty.
Bug 1028497 - Part 17: Factor out FontFace family-name getting. r=jdaggett
Bug 1028497 - Part 18: Create user font entries from FontFaces rather than nsCSSFontFaceRules. r=jdaggett

This changes InsertRule, which looked at the descriptors on an
nsCSSFontFaceRule to create a user font entry and add it to a family,
into InsertConnectedFontFace, which can do the same but for the FontFace
that reflects the rule.
Bug 1028497 - Part 19: Support disconnecting FontFaces that reflect @font-face rules. r=jdaggett,bzbarsky

This adds support for a CSS-connected FontFace to be disconnected from
its rule. This causes it to get its own copy of the descriptors on the
nsCSSFontFaceStyleDecl, and for the pointers between the FontFace and
the nsCSSFontFaceRule to be nulled out.

We start tracking now whether a given FontFace is in the FontFaceSet
(in the sense that it will appear on the DOM FontFaceSet object if we
inspect it with script). All FontFace objects created though, whether
they are currently "in" the FontFaceSet or not, are still tracked by the
FontFaceSet. We use the new mUnavailableFaces array on the FontFaceSet
for that.

We need to track these FontFaces that aren't in the FontFaceSet as
that's where we store their user font entry -- important if we call
load() on a FontFace before adding it to the FontFaceSet.