merge mozilla-inbound to mozilla-central a=merge
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Mon, 19 Oct 2015 11:38:22 +0200
changeset 303447 1a157155a4fe0074b3d03b54fe9e466472c2cd56
parent 303420 d3e87bb40753327550143ba8ac8ee27b300cd4a9 (current diff)
parent 303446 a5d54cef3b23d237ca1f8db3874ebdaf9c2d2638 (diff)
child 303452 ed26d386d147486cf79bd3721e3e74b462358bf7
child 303489 10415ea81de6bdb7e480fe6479cfec8724b3dbea
child 303527 fa2108dc17027f6298502c0b52d7ad2dcd8c7441
push id1001
push userraliiev@mozilla.com
push dateMon, 18 Jan 2016 19:06:03 +0000
treeherdermozilla-release@8b89261f3ac4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone44.0a1
first release with
nightly linux32
1a157155a4fe / 44.0a1 / 20151019030227 / files
nightly linux64
1a157155a4fe / 44.0a1 / 20151019030227 / files
nightly mac
1a157155a4fe / 44.0a1 / 20151019030227 / files
nightly win32
1a157155a4fe / 44.0a1 / 20151019030227 / files
nightly win64
1a157155a4fe / 44.0a1 / 20151019030227 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
merge mozilla-inbound to mozilla-central a=merge
--- a/dom/base/test/mochitest.ini
+++ b/dom/base/test/mochitest.ini
@@ -825,16 +825,17 @@ support-files = file_bug1011748_redirect
 [test_bug1025933.html]
 [test_bug1037687.html]
 [test_element.matches.html]
 [test_user_select.html]
 skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android'
 [test_bug1081686.html]
 skip-if = buildapp == 'b2g' || toolkit == 'android' || e10s
 [test_window_define_nonconfigurable.html]
+skip-if = release_build
 [test_root_iframe.html]
 [test_performance_observer.html]
 [test_performance_user_timing.html]
 [test_bug1126851.html]
 skip-if = buildapp == 'mulet' || buildapp == 'b2g'
 [test_bug1118689.html]
 skip-if = buildapp == 'mulet' || buildapp == 'b2g'
 [test_integer_attr_with_leading_zero.html]
--- a/dom/canvas/WebGL2ContextQueries.cpp
+++ b/dom/canvas/WebGL2ContextQueries.cpp
@@ -270,18 +270,22 @@ WebGL2Context::GetQuery(GLenum target, G
         /* OpenGL ES 3.0 spec 6.1.7:
          *     pname must be CURRENT_QUERY.
          */
         ErrorInvalidEnum("getQuery: `pname` must be CURRENT_QUERY.");
         return nullptr;
     }
 
     WebGLRefPtr<WebGLQuery>& targetSlot = GetQuerySlotByTarget(target);
+    RefPtr<WebGLQuery> tmp = targetSlot.get();
+    if (tmp && tmp->mType != target) {
+        // Query in slot doesn't match target
+        return nullptr;
+    }
 
-    RefPtr<WebGLQuery> tmp = targetSlot.get();
     return tmp.forget();
 }
 
 void
 WebGL2Context::GetQueryParameter(JSContext*, WebGLQuery* query, GLenum pname,
                                  JS::MutableHandleValue retval)
 {
     retval.set(JS::NullValue());
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -1778,22 +1778,16 @@ int64_t MediaDecoderStateMachine::AudioD
 {
   MOZ_ASSERT(OnTaskQueue());
   NS_ASSERTION(HasAudio(),
                "Should only call AudioDecodedUsecs() when we have audio");
   // The amount of audio we have decoded is the amount of audio data we've
   // already decoded and pushed to the hardware, plus the amount of audio
   // data waiting to be pushed to the hardware.
   int64_t pushed = mMediaSink->IsStarted() ? (AudioEndTime() - GetMediaTime()) : 0;
-
-  // Currently for real time streams, AudioQueue().Duration() produce
-  // wrong values (Bug 1114434), so we use frame counts to calculate duration.
-  if (IsRealTime()) {
-    return pushed + FramesToUsecs(AudioQueue().FrameCount(), mInfo.mAudio.mRate).value();
-  }
   return pushed + AudioQueue().Duration();
 }
 
 bool MediaDecoderStateMachine::HasLowDecodedData(int64_t aAudioUsecs)
 {
   MOZ_ASSERT(OnTaskQueue());
   MOZ_ASSERT(mReader->UseBufferingHeuristics());
   // We consider ourselves low on decoded data if we're low on audio,
--- a/dom/media/platforms/gonk/GonkMediaDataDecoder.cpp
+++ b/dom/media/platforms/gonk/GonkMediaDataDecoder.cpp
@@ -98,16 +98,21 @@ GonkDecoderManager::ProcessQueuedSamples
 
 nsresult
 GonkDecoderManager::Flush()
 {
   if (mDecoder == nullptr) {
     GMDD_LOG("Decoder is not initialized");
     return NS_ERROR_UNEXPECTED;
   }
+
+  if (!mInitPromise.IsEmpty()) {
+    return NS_OK;
+  }
+
   {
     MutexAutoLock lock(mMutex);
     mQueuedSamples.Clear();
   }
 
   mLastTime = 0;
 
   MonitorAutoLock lock(mFlushMonitor);
new file mode 100644
--- /dev/null
+++ b/dom/media/test/crashtests/buffer-source-duration-1.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<script>
+const rate = 44100;
+var context = new window.OfflineAudioContext(1, 512, rate);
+var buffer = context.createBuffer(1, 128, rate);
+var source = context.createBufferSource();
+source.buffer = buffer;
+source.start(0, 0, 86400);
+context.startRendering().
+  then(function() {
+    document.documentElement.removeAttribute("class");
+  });
+</script>
new file mode 100644
--- /dev/null
+++ b/dom/media/test/crashtests/buffer-source-resampling-start-1.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<script>
+const rate = 44101; // not divisible by 2
+var context = new window.OfflineAudioContext(1, 512, rate);
+var buffer = context.createBuffer(1, 128, rate);
+buffer.getChannelData(0)[0] = 1.0;
+var source = context.createBufferSource();
+source.buffer = buffer;
+source.playbackRate.value = rate / (Math.pow(2, 30) * 1.0000001);
+source.start(512 / rate);
+context.startRendering().
+  then(function() {
+    document.documentElement.removeAttribute("class");
+  });
+</script>
--- a/dom/media/test/crashtests/crashtests.list
+++ b/dom/media/test/crashtests/crashtests.list
@@ -78,17 +78,19 @@ load 1080986.html
 load 1122218.html
 load 1127188.html
 load 1157994.html
 load 1158427.html
 load 1185176.html
 load 1185192.html
 load analyser-channels-1.html
 load audiocontext-double-suspend.html
+load buffer-source-duration-1.html
 load buffer-source-ended-1.html
+load buffer-source-resampling-start-1.html
 load doppler-1.html
 HTTP load media-element-source-seek-1.html
 load offline-buffer-source-ended-1.html
 load oscillator-ended-1.html
 load oscillator-ended-2.html
 
 # This needs to run at the end to avoid leaking busted state into other tests.
 skip-if(B2G) load 691096-1.html # bug 852821
--- a/dom/media/webaudio/AudioBufferSourceNode.cpp
+++ b/dom/media/webaudio/AudioBufferSourceNode.cpp
@@ -92,17 +92,17 @@ public:
       NS_ERROR("Bad AudioBufferSourceNodeEngine StreamTimeParameter");
     }
   }
   virtual void SetDoubleParameter(uint32_t aIndex, double aParam) override
   {
     switch (aIndex) {
     case AudioBufferSourceNode::START:
       MOZ_ASSERT(!mStart, "Another START?");
-      mStart = mDestination->SecondsToNearestStreamTime(aParam);
+      mStart = aParam * mDestination->SampleRate();
       // Round to nearest
       mBeginProcessing = mStart + 0.5;
       break;
     case AudioBufferSourceNode::DOPPLERSHIFT:
       mDopplerShift = (aParam <= 0 || mozilla::IsNaN(aParam)) ? 1.0 : aParam;
       break;
     default:
       NS_ERROR("Bad AudioBufferSourceNodeEngine double parameter.");
@@ -260,25 +260,28 @@ public:
       if (!BegunResampling()) {
         // First time the resampler is used.
         uint32_t inputLatency = speex_resampler_get_input_latency(resampler);
         inputLimit += inputLatency;
         // If starting after mStart, then play from the beginning of the
         // buffer, but correct for input latency.  If starting before mStart,
         // then align the resampler so that the time corresponding to the
         // first input sample is mStart.
-        uint32_t skipFracNum = inputLatency * ratioDen;
+        int64_t skipFracNum = static_cast<int64_t>(inputLatency) * ratioDen;
         double leadTicks = mStart - *aCurrentPosition;
         if (leadTicks > 0.0) {
           // Round to nearest output subsample supported by the resampler at
           // these rates.
-          skipFracNum -= leadTicks * ratioNum + 0.5;
-          MOZ_ASSERT(skipFracNum < INT32_MAX, "mBeginProcessing is wrong?");
+          int64_t leadSubsamples = leadTicks * ratioNum + 0.5;
+          MOZ_ASSERT(leadSubsamples <= skipFracNum,
+                     "mBeginProcessing is wrong?");
+          skipFracNum -= leadSubsamples;
         }
-        speex_resampler_set_skip_frac_num(resampler, skipFracNum);
+        speex_resampler_set_skip_frac_num(resampler,
+                                  std::min<int64_t>(skipFracNum, UINT32_MAX));
 
         mBeginProcessing = -STREAM_TIME_MAX;
       }
       inputLimit = std::min(inputLimit, availableInInputBuffer);
 
       for (uint32_t i = 0; true; ) {
         uint32_t inSamples = inputLimit;
         const float* inputData = mBuffer->GetData(i) + mBufferPosition;
--- a/dom/media/webaudio/test/mochitest.ini
+++ b/dom/media/webaudio/test/mochitest.ini
@@ -164,16 +164,17 @@ skip-if = (toolkit == 'gonk' && !debug) 
 [test_periodicWave.html]
 [test_periodicWaveBandLimiting.html]
 [test_scriptProcessorNode.html]
 [test_scriptProcessorNodeChannelCount.html]
 [test_scriptProcessorNodePassThrough.html]
 [test_scriptProcessorNode_playbackTime1.html]
 [test_scriptProcessorNodeZeroInputOutput.html]
 [test_scriptProcessorNodeNotConnected.html]
+[test_sequentialBufferSourceWithResampling.html]
 [test_singleSourceDest.html]
 [test_stereoPanningWithGain.html]
 [test_waveDecoder.html]
 [test_waveShaper.html]
 [test_waveShaperGain.html]
 [test_waveShaperNoCurve.html]
 [test_waveShaperPassThrough.html]
 [test_waveShaperInvalidLengthCurve.html]
new file mode 100644
--- /dev/null
+++ b/dom/media/webaudio/test/test_sequentialBufferSourceWithResampling.html
@@ -0,0 +1,72 @@
+<!DOCTYPE html>
+<title>Test seamless playback of a series of resampled buffers</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+// Permitting some accumulation of rounding to int16_t.
+// 64/2^15 would be only just small enough to detect off-by-one-subsample
+// scheduling errors with the frequencies here.
+const EPSILON = 4.0 / Math.pow(2, 15);
+// Offsets test for rounding to nearest rather than up or down.
+const OFFSETS = [EPSILON, 1.0 - EPSILON];
+// The ratio of resampling is 147:160, so 256 start points is enough to cover
+// every fractional offset.
+const LENGTH = 256;
+
+function do_test(context_rate, buffer_rate, start_offset) {
+
+  var context =
+    new OfflineAudioContext(2, LENGTH, context_rate);
+
+  var merger = context.createChannelMerger(context.destination.channelCount);
+  merger.connect(context.destination);
+
+  // Create an audio signal that will be repeated
+  var repeating_signal = context.createBuffer(1, 1, buffer_rate);
+  repeating_signal.getChannelData(0)[0] = 0.5;
+
+  // Schedule a series of nodes to repeat the signal.
+  for (var i = 0; i < LENGTH; ++i) {
+    var source = context.createBufferSource();
+    source.buffer = repeating_signal;
+    source.connect(merger, 0, 0);
+    source.start((i + start_offset) / buffer_rate);
+  }
+
+  // A single long signal should produce the same result.
+  var long_signal = context.createBuffer(1, LENGTH, buffer_rate);
+  var c = long_signal.getChannelData(0);
+  for (var i = 0; i < c.length; ++i) {
+    c[i] = 0.5;
+  }
+
+  var source = context.createBufferSource();
+  source.buffer = long_signal;
+  source.connect(merger, 0, 1);
+  source.start(start_offset / buffer_rate);
+
+  return context.startRendering().
+    then((buffer) => {
+      series_output = buffer.getChannelData(0);
+      expected = buffer.getChannelData(1);
+
+      for (var i = 0; i < buffer.length; ++i) {
+        assert_approx_equals(series_output[i], expected[i], EPSILON,
+                             "series output at " + i);
+      }
+    });
+}
+
+function start_tests(context_rate, buffer_rate) {
+  OFFSETS.forEach((start_offset) => {
+    promise_test(() => do_test(context_rate, buffer_rate, start_offset),
+                 "" + context_rate + " context, "
+                 + buffer_rate + " buffer, "
+                 + start_offset + " start");
+  });
+}
+
+start_tests(48000, 44100);
+start_tests(44100, 48000);
+
+</script>
--- a/extensions/cookie/nsCookiePermission.cpp
+++ b/extensions/cookie/nsCookiePermission.cpp
@@ -193,16 +193,17 @@ nsCookiePermission::CanSetCookie(nsIURI 
     return NS_ERROR_UNEXPECTED;
 
   uint32_t perm;
   mPermMgr->TestPermission(aURI, kPermissionType, &perm);
   bool isThirdParty = false;
   switch (perm) {
   case nsICookiePermission::ACCESS_SESSION:
     *aIsSession = true;
+    MOZ_FALLTHROUGH;
 
   case nsICookiePermission::ACCESS_ALLOW:
     *aResult = true;
     break;
 
   case nsICookiePermission::ACCESS_DENY:
     *aResult = false;
     break;
--- a/extensions/cookie/nsPermissionManager.cpp
+++ b/extensions/cookie/nsPermissionManager.cpp
@@ -905,16 +905,17 @@ nsPermissionManager::InitDB(bool aRemove
         NS_ENSURE_SUCCESS(rv, rv);
 
         rv = mDBConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
               "ALTER TABLE moz_hosts ADD expireTime INTEGER"));
         NS_ENSURE_SUCCESS(rv, rv);
       }
 
       // fall through to the next upgrade
+      MOZ_FALLTHROUGH;
 
     // TODO: we want to make default version as version 2 in order to fix bug 784875.
     case 0:
     case 2:
       {
         // Add appId/isInBrowserElement fields.
         rv = mDBConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
               "ALTER TABLE moz_hosts ADD appId INTEGER"));
@@ -924,16 +925,17 @@ nsPermissionManager::InitDB(bool aRemove
               "ALTER TABLE moz_hosts ADD isInBrowserElement INTEGER"));
         NS_ENSURE_SUCCESS(rv, rv);
 
         rv = mDBConn->SetSchemaVersion(3);
         NS_ENSURE_SUCCESS(rv, rv);
       }
 
       // fall through to the next upgrade
+      MOZ_FALLTHROUGH;
 
     // Version 3->4 is the creation of the modificationTime field.
     case 3:
       {
         rv = mDBConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
               "ALTER TABLE moz_hosts ADD modificationTime INTEGER"));
         NS_ENSURE_SUCCESS(rv, rv);
 
@@ -941,16 +943,17 @@ nsPermissionManager::InitDB(bool aRemove
         // now() would mean, eg, that doing "remove all from the last hour"
         // within the first hour after migration would remove all permissions.
 
         rv = mDBConn->SetSchemaVersion(4);
         NS_ENSURE_SUCCESS(rv, rv);
       }
 
       // fall through to the next upgrade
+      MOZ_FALLTHROUGH;
 
     // In version 5, host appId, and isInBrowserElement were merged into a
     // single origin entry
     //
     // In version 6, the tables were renamed for backwards compatability reasons
     // with version 4 and earlier.
     //
     // In version 7, a bug in the migration used for version 4->5 was discovered
@@ -1026,16 +1029,17 @@ nsPermissionManager::InitDB(bool aRemove
           NS_ENSURE_SUCCESS(rv, rv);
         }
 
         rv = mDBConn->SetSchemaVersion(6);
         NS_ENSURE_SUCCESS(rv, rv);
       }
 
       // fall through to the next upgrade
+      MOZ_FALLTHROUGH;
 
     // At this point, the version 5 table has been migrated to a version 6 table
     // We are guaranteed to have at least one of moz_hosts and moz_perms. If
     // we have moz_hosts, we will migrate moz_hosts into moz_perms (even if
     // we already have a moz_perms, as we need a re-migration due to bug 1186034).
     //
     // After this migration, we are guaranteed to have both a moz_hosts (for backwards
     // compatability), and a moz_perms table. The moz_hosts table will have a v4 schema,
@@ -1223,16 +1227,17 @@ nsPermissionManager::InitDB(bool aRemove
         }
 #endif
 
         rv = mDBConn->SetSchemaVersion(7);
         NS_ENSURE_SUCCESS(rv, rv);
       }
 
       // fall through to the next upgrade
+      MOZ_FALLTHROUGH;
 
     // The version 7-8 migration is the re-migration of localhost and ip-address
     // entries due to errors in the previous version 7 migration which caused
     // localhost and ip-address entries to be incorrectly discarded.
     // The version 7 migration logic has been corrected, and thus this logic only
     // needs to execute if the user is currently on version 7.
     case 7:
       {
@@ -1324,16 +1329,17 @@ nsPermissionManager::InitDB(bool aRemove
 
         // Even if we didn't perform the migration, we want to bump the schema
         // version to 8.
         rv = mDBConn->SetSchemaVersion(8);
         NS_ENSURE_SUCCESS(rv, rv);
       }
 
       // fall through to the next upgrade
+      MOZ_FALLTHROUGH;
 
     // The version 8-9 migration removes the unnecessary backup moz-hosts database contents.
     // as the data no longer needs to be migrated
     case 8:
       {
         // We only want to clear out the old table if it is a backup. If it isn't a backup,
         // we don't need to touch it.
         bool hostsIsBackupExists = false;
@@ -1350,16 +1356,19 @@ nsPermissionManager::InitDB(bool aRemove
           rv = mDBConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING("DROP TABLE moz_hosts_is_backup"));
           NS_ENSURE_SUCCESS(rv, rv);
         }
 
         rv = mDBConn->SetSchemaVersion(9);
         NS_ENSURE_SUCCESS(rv, rv);
       }
 
+      // fall through to the next upgrade
+      MOZ_FALLTHROUGH;
+
     // current version.
     case HOSTS_SCHEMA_VERSION:
       break;
 
     // downgrading.
     // if columns have been added to the table, we can still use the ones we
     // understand safely. if columns have been deleted or altered, just
     // blow away the table and start from scratch! if you change the way
--- a/gfx/gl/GLBlitHelper.cpp
+++ b/gfx/gl/GLBlitHelper.cpp
@@ -384,18 +384,20 @@ GLBlitHelper::InitTexQuadProgram(BlitTyp
             case BlitTexRect:
             case ConvertEGLImage:
             case ConvertSurfaceTexture:
             case ConvertGralloc: {
 #ifdef ANDROID
                 GLint texUnitLoc = mGL->fGetUniformLocation(program, "uTexUnit");
                 MOZ_ASSERT(texUnitLoc != -1, "uniform uTexUnit not found");
                 mGL->fUniform1i(texUnitLoc, 0);
+#else
+                MOZ_ASSERT_UNREACHABLE("gralloc not support on non-android");
+#endif
                 break;
-#endif
             }
             case ConvertPlanarYCbCr: {
                 GLint texY = mGL->fGetUniformLocation(program, "uYTexture");
                 GLint texCb = mGL->fGetUniformLocation(program, "uCbTexture");
                 GLint texCr = mGL->fGetUniformLocation(program, "uCrTexture");
                 mYTexScaleLoc = mGL->fGetUniformLocation(program, "uYTexScale");
                 mCbCrTexScaleLoc= mGL->fGetUniformLocation(program, "uCbCrTexScale");
 
--- a/gfx/gl/GLContext.cpp
+++ b/gfx/gl/GLContext.cpp
@@ -1426,20 +1426,21 @@ GLContext::InitWithPrefix(const char *pr
                 NS_ERROR("GL supports 3D textures without supplying functions.");
 
                 MarkUnsupported(GLFeature::texture_3D_copy);
                 ClearSymbols(coreSymbols);
             }
         }
 
         if (IsSupported(GLFeature::uniform_buffer_object)) {
+            // Note: Don't query for glGetActiveUniformName because it is not
+            // supported by GL ES 3.
             SymLoadStruct uboSymbols[] = {
                 { (PRFuncPtr*) &mSymbols.fGetUniformIndices, { "GetUniformIndices", nullptr } },
                 { (PRFuncPtr*) &mSymbols.fGetActiveUniformsiv, { "GetActiveUniformsiv", nullptr } },
-                { (PRFuncPtr*) &mSymbols.fGetActiveUniformName, { "GetActiveUniformName", nullptr } },
                 { (PRFuncPtr*) &mSymbols.fGetUniformBlockIndex, { "GetUniformBlockIndex", nullptr } },
                 { (PRFuncPtr*) &mSymbols.fGetActiveUniformBlockiv, { "GetActiveUniformBlockiv", nullptr } },
                 { (PRFuncPtr*) &mSymbols.fGetActiveUniformBlockName, { "GetActiveUniformBlockName", nullptr } },
                 { (PRFuncPtr*) &mSymbols.fUniformBlockBinding, { "UniformBlockBinding", nullptr } },
                 END_SYMBOLS
             };
 
             if (!LoadSymbols(&uboSymbols[0], trygl, prefix)) {
--- a/gfx/gl/GLContext.h
+++ b/gfx/gl/GLContext.h
@@ -3006,25 +3006,16 @@ public:
                               GLenum pname, GLint* params)
     {
         ASSERT_SYMBOL_PRESENT(fGetActiveUniformsiv);
         BEFORE_GL_CALL;
         mSymbols.fGetActiveUniformsiv(program, uniformCount, uniformIndices, pname, params);
         AFTER_GL_CALL;
     }
 
-    void fGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize,
-                               GLsizei* length, GLchar* uniformName)
-    {
-        ASSERT_SYMBOL_PRESENT(fGetActiveUniformName);
-        BEFORE_GL_CALL;
-        mSymbols.fGetActiveUniformName(program, uniformIndex, bufSize, length, uniformName);
-        AFTER_GL_CALL;
-    }
-
     GLuint fGetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName) {
         ASSERT_SYMBOL_PRESENT(fGetUniformBlockIndex);
         BEFORE_GL_CALL;
         GLuint result = mSymbols.fGetUniformBlockIndex(program, uniformBlockName);
         AFTER_GL_CALL;
         return result;
     }
 
--- a/gfx/gl/GLContextSymbols.h
+++ b/gfx/gl/GLContextSymbols.h
@@ -609,18 +609,16 @@ struct GLContextSymbols
 
     // uniform_buffer_object
     typedef void (GLAPIENTRY * PFNGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount,
                                                             const GLchar* const* uniformNames, GLuint* uniformIndices);
     PFNGLGETUNIFORMINDICESPROC fGetUniformIndices;
     typedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMSIVPROC) (GLuint program, GLsizei uniformCount, const GLuint* uniformIndices,
                                                              GLenum pname, GLint* params);
     PFNGLGETACTIVEUNIFORMSIVPROC fGetActiveUniformsiv;
-    typedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMNAMEPROC) (GLuint program, GLuint uniformIdex, GLsizei bufSize, GLsizei* length, GLchar* uniformName);
-    PFNGLGETACTIVEUNIFORMNAMEPROC fGetActiveUniformName;
     typedef GLuint (GLAPIENTRY * PFNGLGETUNIFORMBLOCKINDEXPROC) (GLuint program, const GLchar* uniformBlockName);
     PFNGLGETUNIFORMBLOCKINDEXPROC fGetUniformBlockIndex;
     typedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMBLOCKIVPROC) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params);
     PFNGLGETACTIVEUNIFORMBLOCKIVPROC fGetActiveUniformBlockiv;
     typedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName);
     PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC fGetActiveUniformBlockName;
     typedef void (GLAPIENTRY * PFNGLUNIFORMBLOCKBINDINGPROC) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
     PFNGLUNIFORMBLOCKBINDINGPROC fUniformBlockBinding;
--- a/gfx/layers/LayerScope.cpp
+++ b/gfx/layers/LayerScope.cpp
@@ -974,33 +974,37 @@ SenderHelper::SendLayer(LayerComposite* 
     if (!aLayer || !aLayer->GetLayer()) {
         return;
     }
 
     switch (aLayer->GetLayer()->GetType()) {
         case Layer::TYPE_COLOR: {
             EffectChain effect;
             aLayer->GenEffectChain(effect);
-            SenderHelper::SendEffectChain(nullptr, effect, aWidth, aHeight);
+
+            LayerScope::DrawBegin();
+            LayerScope::DrawEnd(nullptr, effect, aWidth, aHeight);
             break;
         }
         case Layer::TYPE_IMAGE:
         case Layer::TYPE_CANVAS:
         case Layer::TYPE_PAINTED: {
             // Get CompositableHost and Compositor
             CompositableHost* compHost = aLayer->GetCompositableHost();
             Compositor* comp = compHost->GetCompositor();
             // Send EffectChain only for CompositorOGL
             if (LayersBackend::LAYERS_OPENGL == comp->GetBackendType()) {
                 CompositorOGL* compOGL = static_cast<CompositorOGL*>(comp);
                 EffectChain effect;
                 // Generate primary effect (lock and gen)
                 AutoLockCompositableHost lock(compHost);
                 aLayer->GenEffectChain(effect);
-                SenderHelper::SendEffectChain(compOGL->gl(), effect);
+
+                LayerScope::DrawBegin();
+                LayerScope::DrawEnd(compOGL->gl(), effect, aWidth, aHeight);
             }
             break;
         }
         case Layer::TYPE_CONTAINER:
         default:
             break;
     }
 }
@@ -1167,16 +1171,22 @@ void
 SenderHelper::SendEffectChain(GLContext* aGLContext,
                               const EffectChain& aEffectChain,
                               int aWidth,
                               int aHeight)
 {
     if (!sLayersBufferSendable) return;
 
     const Effect* primaryEffect = aEffectChain.mPrimaryEffect;
+    MOZ_ASSERT(primaryEffect);
+
+    if (!primaryEffect) {
+      return;
+    }
+
     switch (primaryEffect->mType) {
         case EffectTypes::RGB: {
             const TexturedEffect* texturedEffect =
                 static_cast<const TexturedEffect*>(primaryEffect);
             SendTexturedEffect(aGLContext, aEffectChain.mLayerRef, texturedEffect);
             break;
         }
         case EffectTypes::YCBCR: {
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -1178,17 +1178,17 @@ nsEventStatus AsyncPanZoomController::On
   switch (mState) {
     case FLING:
     case ANIMATING_ZOOM:
     case SMOOTH_SCROLL:
     case OVERSCROLL_ANIMATION:
     case WHEEL_SCROLL:
     case PAN_MOMENTUM:
       CurrentTouchBlock()->GetOverscrollHandoffChain()->CancelAnimations(ExcludeOverscroll);
-      // Fall through.
+      MOZ_FALLTHROUGH;
     case NOTHING: {
       mX.StartTouch(point.x, aEvent.mTime);
       mY.StartTouch(point.y, aEvent.mTime);
       if (RefPtr<GeckoContentController> controller = GetGeckoContentController()) {
         controller->NotifyAPZStateChange(
             GetGuid(), APZStateChange::StartTouch,
             CurrentTouchBlock()->GetOverscrollHandoffChain()->CanBePanned(this));
       }
@@ -1287,17 +1287,17 @@ nsEventStatus AsyncPanZoomController::On
     ReentrantMonitorAutoEnter lock(mMonitor);
     SendAsyncScrollEvent();
   }
 
   switch (mState) {
   case FLING:
     // Should never happen.
     NS_WARNING("Received impossible touch end in OnTouchEnd.");
-    // Fall through.
+    MOZ_FALLTHROUGH;
   case ANIMATING_ZOOM:
   case SMOOTH_SCROLL:
   case NOTHING:
     // May happen if the user double-taps and drags without lifting after the
     // second tap. Ignore if this happens.
     return nsEventStatus_eIgnore;
 
   case TOUCHING:
--- a/gfx/layers/apz/src/GestureEventListener.cpp
+++ b/gfx/layers/apz/src/GestureEventListener.cpp
@@ -403,16 +403,17 @@ void GestureEventListener::HandleInputTi
 
   mLongTapTimeoutTask = nullptr;
 
   switch (mState) {
   case GESTURE_FIRST_SINGLE_TOUCH_DOWN:
     // just in case MAX_TAP_TIME > ContextMenuDelay cancel MAX_TAP timer
     // and fall through
     CancelMaxTapTimeoutTask();
+    MOZ_FALLTHROUGH;
   case GESTURE_FIRST_SINGLE_TOUCH_MAX_TAP_DOWN: {
     SetState(GESTURE_LONG_TOUCH_DOWN);
     mAsyncPanZoomController->HandleGestureEvent(
         CreateTapEvent(mLastTouchInput, TapGestureInput::TAPGESTURE_LONG));
     break;
   }
   default:
     NS_WARNING("Unhandled state upon long tap timeout");
--- a/gfx/layers/apz/util/APZEventState.cpp
+++ b/gfx/layers/apz/util/APZEventState.cpp
@@ -284,20 +284,20 @@ APZEventState::ProcessTouchEvent(const W
     break;
   }
 
   case eTouchEnd:
     if (isTouchPrevented) {
       mTouchEndCancelled = true;
       mEndTouchIsClick = false;
     }
-    // fall through
+    MOZ_FALLTHROUGH;
   case eTouchCancel:
     mActiveElementManager->HandleTouchEndEvent(mEndTouchIsClick);
-    // fall through
+    MOZ_FALLTHROUGH;
   case eTouchMove: {
     if (mPendingTouchPreventedResponse) {
       MOZ_ASSERT(aGuid == mPendingTouchPreventedGuid);
     }
     sentContentResponse = SendPendingTouchPreventedResponse(isTouchPrevented);
     break;
   }
 
@@ -422,9 +422,8 @@ already_AddRefed<nsIWidget>
 APZEventState::GetWidget() const
 {
   nsCOMPtr<nsIWidget> result = do_QueryReferent(mWidget);
   return result.forget();
 }
 
 } // namespace layers
 } // namespace mozilla
-
--- a/gfx/layers/composite/TiledContentHost.cpp
+++ b/gfx/layers/composite/TiledContentHost.cpp
@@ -64,16 +64,37 @@ TiledContentHost::TiledContentHost(const
   MOZ_COUNT_CTOR(TiledContentHost);
 }
 
 TiledContentHost::~TiledContentHost()
 {
   MOZ_COUNT_DTOR(TiledContentHost);
 }
 
+already_AddRefed<TexturedEffect>
+TiledContentHost::GenEffect(const gfx::Filter& aFilter)
+{
+  // If we can use hwc for this TiledContentHost, it implies that we have exactly
+  // one high precision tile. Please check TiledContentHost::GetRenderState() for
+  // all condition.
+  MOZ_ASSERT(mTiledBuffer.GetTileCount() == 1 && mLowPrecisionTiledBuffer.GetTileCount() == 0);
+  MOZ_ASSERT(mTiledBuffer.GetTile(0).mTextureHost);
+
+  TileHost& tile = mTiledBuffer.GetTile(0);
+  if (!tile.mTextureHost->BindTextureSource(tile.mTextureSource)) {
+    return nullptr;
+  }
+
+  return CreateTexturedEffect(tile.mTextureSource,
+                              nullptr,
+                              aFilter,
+                              true,
+                              tile.mTextureHost->GetRenderState());
+}
+
 void
 TiledContentHost::Attach(Layer* aLayer,
                          Compositor* aCompositor,
                          AttachFlags aFlags /* = NO_FLAGS */)
 {
   CompositableHost::Attach(aLayer, aCompositor, aFlags);
 }
 
--- a/gfx/layers/composite/TiledContentHost.h
+++ b/gfx/layers/composite/TiledContentHost.h
@@ -206,16 +206,18 @@ public:
         LayerRenderState state = host->GetRenderState();
         state.SetOffset(offset);
         return state;
       }
     }
     return LayerRenderState();
   }
 
+  // Generate effect for layerscope when using hwc.
+  virtual already_AddRefed<TexturedEffect> GenEffect(const gfx::Filter& aFilter) override;
 
   virtual bool UpdateThebes(const ThebesBufferData& aData,
                             const nsIntRegion& aUpdated,
                             const nsIntRegion& aOldValidRegionBack,
                             nsIntRegion* aUpdatedRegionBack) override
   {
     NS_ERROR("N/A for tiled layers");
     return false;
--- a/gfx/thebes/gfxAndroidPlatform.cpp
+++ b/gfx/thebes/gfxAndroidPlatform.cpp
@@ -323,36 +323,36 @@ gfxAndroidPlatform::GetFTLibrary()
 {
     return gPlatformFTLibrary;
 }
 
 gfxFontEntry*
 gfxAndroidPlatform::LookupLocalFont(const nsAString& aFontName,
                                     uint16_t aWeight,
                                     int16_t aStretch,
-                                    bool aItalic)
+                                    uint8_t aStyle)
 {
     return gfxPlatformFontList::PlatformFontList()->LookupLocalFont(aFontName,
                                                                     aWeight,
                                                                     aStretch,
-                                                                    aItalic);
+                                                                    aStyle);
 }
 
 gfxFontEntry* 
 gfxAndroidPlatform::MakePlatformFont(const nsAString& aFontName,
                                      uint16_t aWeight,
                                      int16_t aStretch,
-                                     bool aItalic,
+                                     uint8_t aStyle,
                                      const uint8_t* aFontData,
                                      uint32_t aLength)
 {
     return gfxPlatformFontList::PlatformFontList()->MakePlatformFont(aFontName,
                                                                      aWeight,
                                                                      aStretch,
-                                                                     aItalic,
+                                                                     aStyle,
                                                                      aFontData,
                                                                      aLength);
 }
 
 already_AddRefed<ScaledFont>
 gfxAndroidPlatform::GetScaledFontForFont(DrawTarget* aTarget, gfxFont *aFont)
 {
     return GetScaledFontForFontWithCairoSkia(aTarget, aFont);
--- a/gfx/thebes/gfxAndroidPlatform.h
+++ b/gfx/thebes/gfxAndroidPlatform.h
@@ -43,21 +43,21 @@ public:
     void GetSystemFontList(InfallibleTArray<FontListEntry>* retValue);
 
     // platform implementations of font functions
     virtual bool IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags);
     virtual gfxPlatformFontList* CreatePlatformFontList();
     virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
                                           uint16_t aWeight,
                                           int16_t aStretch,
-                                          bool aItalic);
+                                          uint8_t aStyle);
     virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
                                            uint16_t aWeight,
                                            int16_t aStretch,
-                                           bool aItalic,
+                                           uint8_t aStyle,
                                            const uint8_t* aFontData,
                                            uint32_t aLength);
 
     virtual void GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh,
                                         int32_t aRunScript,
                                         nsTArray<const char*>& aFontList);
 
     virtual nsresult GetFontList(nsIAtom *aLangGroup,
--- a/gfx/thebes/gfxDWriteFontList.cpp
+++ b/gfx/thebes/gfxDWriteFontList.cpp
@@ -212,17 +212,18 @@ gfxDWriteFontFamily::FindStyleVariations
             }
         }
 
         if (LOG_FONTLIST_ENABLED()) {
             LOG_FONTLIST(("(fontlist) added (%s) to family (%s)"
                  " with style: %s weight: %d stretch: %d psname: %s fullname: %s",
                  NS_ConvertUTF16toUTF8(fe->Name()).get(),
                  NS_ConvertUTF16toUTF8(Name()).get(),
-                 (fe->IsItalic()) ? "italic" : "normal",
+                 (fe->IsItalic()) ?
+                  "italic" : (fe->IsOblique() ? "oblique" : "normal"),
                  fe->Weight(), fe->Stretch(),
                  NS_ConvertUTF16toUTF8(psname).get(),
                  NS_ConvertUTF16toUTF8(fullname).get()));
         }
     }
 
     // assume that if no error, all postscript/fullnames were initialized
     if (!skipFaceNames) {
@@ -383,17 +384,17 @@ gfxDWriteFontEntry::CopyFontTable(uint32
 {
     gfxDWriteFontList *pFontList = gfxDWriteFontList::PlatformFontList();
 
     // Don't use GDI table loading for symbol fonts or for
     // italic fonts in Arabic-script system locales because of
     // potential cmap discrepancies, see bug 629386.
     // Ditto for Hebrew, bug 837498.
     if (mFont && pFontList->UseGDIFontTableAccess() &&
-        !(mItalic && UsingArabicOrHebrewScriptSystemLocale()) &&
+        !(mStyle && UsingArabicOrHebrewScriptSystemLocale()) &&
         !mFont->IsSymbolFont())
     {
         LOGFONTW logfont = { 0 };
         if (!InitLogFont(mFont, &logfont))
             return NS_ERROR_FAILURE;
 
         AutoDC dc;
         AutoSelectFont font(dc.GetDC(), &logfont);
@@ -738,41 +739,41 @@ gfxDWriteFontList::GetDefaultFont(const 
 
     return nullptr;
 }
 
 gfxFontEntry *
 gfxDWriteFontList::LookupLocalFont(const nsAString& aFontName,
                                    uint16_t aWeight,
                                    int16_t aStretch,
-                                   bool aItalic)
+                                   uint8_t aStyle)
 {
     gfxFontEntry *lookup;
 
     lookup = LookupInFaceNameLists(aFontName);
     if (!lookup) {
         return nullptr;
     }
 
     gfxDWriteFontEntry* dwriteLookup = static_cast<gfxDWriteFontEntry*>(lookup);
     gfxDWriteFontEntry *fe =
         new gfxDWriteFontEntry(lookup->Name(),
                                dwriteLookup->mFont,
                                aWeight,
                                aStretch,
-                               aItalic);
+                               aStyle);
     fe->SetForceGDIClassic(dwriteLookup->GetForceGDIClassic());
     return fe;
 }
 
 gfxFontEntry *
 gfxDWriteFontList::MakePlatformFont(const nsAString& aFontName,
                                     uint16_t aWeight,
                                     int16_t aStretch,
-                                    bool aItalic,
+                                    uint8_t aStyle,
                                     const uint8_t* aFontData,
                                     uint32_t aLength)
 {
     nsresult rv;
     nsAutoString uniqueName;
     rv = gfxFontUtils::MakeUniqueUserFontName(uniqueName);
     if (NS_FAILED(rv)) {
         free((void*)aFontData);
@@ -827,17 +828,17 @@ gfxDWriteFontList::MakePlatformFont(cons
     DWRITE_FONT_FILE_TYPE fileType;
     UINT32 numFaces;
 
     gfxDWriteFontEntry *entry = 
         new gfxDWriteFontEntry(uniqueName, 
                                fontFile,
                                aWeight,
                                aStretch,
-                               aItalic);
+                               aStyle);
 
     fontFile->Analyze(&isSupported, &fileType, &entry->mFaceType, &numFaces);
     if (!isSupported || numFaces > 1) {
         // We don't know how to deal with 0 faces either.
         delete entry;
         return nullptr;
     }
 
@@ -969,17 +970,18 @@ gfxDWriteFontList::InitFontList()
                 gillSansMTFamily->AddFontEntry(faces[i]);
 
                 if (LOG_FONTLIST_ENABLED()) {
                     gfxFontEntry *fe = faces[i];
                     LOG_FONTLIST(("(fontlist) moved (%s) to family (%s)"
                          " with style: %s weight: %d stretch: %d",
                          NS_ConvertUTF16toUTF8(fe->Name()).get(),
                          NS_ConvertUTF16toUTF8(gillSansMTFamily->Name()).get(),
-                         (fe->IsItalic()) ? "italic" : "normal",
+                         (fe->IsItalic()) ?
+                          "italic" : (fe->IsOblique() ? "oblique" : "normal"),
                          fe->Weight(), fe->Stretch()));
                 }
             }
 
             // remove Gills Sans
             mFontFamilies.Remove(nameGillSans);
         }
     }
--- a/gfx/thebes/gfxDWriteFontList.h
+++ b/gfx/thebes/gfxDWriteFontList.h
@@ -75,18 +75,21 @@ public:
      * \param aFaceName The name of the corresponding font face.
      * \param aFont DirectWrite font object
      */
     gfxDWriteFontEntry(const nsAString& aFaceName,
                               IDWriteFont *aFont) 
       : gfxFontEntry(aFaceName), mFont(aFont), mFontFile(nullptr),
         mForceGDIClassic(false)
     {
-        mItalic = (aFont->GetStyle() == DWRITE_FONT_STYLE_ITALIC ||
-                   aFont->GetStyle() == DWRITE_FONT_STYLE_OBLIQUE);
+        DWRITE_FONT_STYLE dwriteStyle = aFont->GetStyle();
+        mStyle = (dwriteStyle == DWRITE_FONT_STYLE_ITALIC ?
+                  NS_FONT_STYLE_ITALIC :
+                  (dwriteStyle == DWRITE_FONT_STYLE_OBLIQUE ?
+                   NS_FONT_STYLE_OBLIQUE : NS_FONT_STYLE_NORMAL));
         mStretch = FontStretchFromDWriteStretch(aFont->GetStretch());
         uint16_t weight = NS_ROUNDUP(aFont->GetWeight() - 50, 100);
 
         weight = std::max<uint16_t>(100, weight);
         weight = std::min<uint16_t>(900, weight);
         mWeight = weight;
 
         mIsCJK = UNINITIALIZED_VALUE;
@@ -96,53 +99,53 @@ public:
      * Constructs a font entry using a font. But with custom font values.
      * This is used for creating correct font entries for @font-face with local
      * font source.
      *
      * \param aFaceName The name of the corresponding font face.
      * \param aFont DirectWrite font object
      * \param aWeight Weight of the font
      * \param aStretch Stretch of the font
-     * \param aItalic True if italic
+     * \param aStyle italic or oblique of font
      */
     gfxDWriteFontEntry(const nsAString& aFaceName,
                               IDWriteFont *aFont,
                               uint16_t aWeight,
                               int16_t aStretch,
-                              bool aItalic)
+                              uint8_t aStyle)
       : gfxFontEntry(aFaceName), mFont(aFont), mFontFile(nullptr),
         mForceGDIClassic(false)
     {
         mWeight = aWeight;
         mStretch = aStretch;
-        mItalic = aItalic;
+        mStyle = aStyle;
         mIsLocalUserFont = true;
         mIsCJK = UNINITIALIZED_VALUE;
     }
 
     /**
      * Constructs a font entry using a font file.
      *
      * \param aFaceName The name of the corresponding font face.
      * \param aFontFile DirectWrite fontfile object
      * \param aWeight Weight of the font
      * \param aStretch Stretch of the font
-     * \param aItalic True if italic
+     * \param aStyle italic or oblique of font
      */
     gfxDWriteFontEntry(const nsAString& aFaceName,
                               IDWriteFontFile *aFontFile,
                               uint16_t aWeight,
                               int16_t aStretch,
-                              bool aItalic)
+                              uint8_t aStyle)
       : gfxFontEntry(aFaceName), mFont(nullptr), mFontFile(aFontFile),
         mForceGDIClassic(false)
     {
         mWeight = aWeight;
         mStretch = aStretch;
-        mItalic = aItalic;
+        mStyle = aStyle;
         mIsDataUserFont = true;
         mIsCJK = UNINITIALIZED_VALUE;
     }
 
     virtual ~gfxDWriteFontEntry();
 
     virtual bool IsSymbolFont();
 
@@ -344,22 +347,22 @@ public:
     // initialize font lists
     virtual nsresult InitFontList();
 
     virtual gfxFontFamily* GetDefaultFont(const gfxFontStyle* aStyle);
 
     virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
                                           uint16_t aWeight,
                                           int16_t aStretch,
-                                          bool aItalic);
+                                          uint8_t aStyle);
 
     virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
                                            uint16_t aWeight,
                                            int16_t aStretch,
-                                           bool aItalic,
+                                           uint8_t aStyle,
                                            const uint8_t* aFontData,
                                            uint32_t aLength);
     
     bool GetStandardFamilyName(const nsAString& aFontName,
                                  nsAString& aFamilyName);
 
     IDWriteGdiInterop *GetGDIInterop() { return mGDIInterop; }
     bool UseGDIFontTableAccess() { return mGDIFontTableAccess; }
--- a/gfx/thebes/gfxDWriteFonts.cpp
+++ b/gfx/thebes/gfxDWriteFonts.cpp
@@ -80,18 +80,19 @@ gfxDWriteFont::gfxDWriteFont(gfxFontEntr
     , mNeedsBold(aNeedsBold)
     , mUseSubpixelPositions(false)
     , mAllowManualShowGlyphs(true)
 {
     gfxDWriteFontEntry *fe =
         static_cast<gfxDWriteFontEntry*>(aFontEntry);
     nsresult rv;
     DWRITE_FONT_SIMULATIONS sims = DWRITE_FONT_SIMULATIONS_NONE;
-    if ((GetStyle()->style & (NS_FONT_STYLE_ITALIC | NS_FONT_STYLE_OBLIQUE)) &&
-        !fe->IsItalic() && GetStyle()->allowSyntheticStyle) {
+    if ((GetStyle()->style != NS_FONT_STYLE_NORMAL) &&
+        fe->IsUpright() &&
+        GetStyle()->allowSyntheticStyle) {
             // For this we always use the font_matrix for uniformity. Not the
             // DWrite simulation.
             mNeedsOblique = true;
     }
     if (aNeedsBold) {
         sims |= DWRITE_FONT_SIMULATIONS_BOLD;
     }
 
--- a/gfx/thebes/gfxFT2FontList.cpp
+++ b/gfx/thebes/gfxFT2FontList.cpp
@@ -183,19 +183,19 @@ FT2FontEntry::CreateScaledFont(const gfx
     cairo_matrix_t sizeMatrix;
     cairo_matrix_t identityMatrix;
 
     // XXX deal with adjusted size
     cairo_matrix_init_scale(&sizeMatrix, aStyle->size, aStyle->size);
     cairo_matrix_init_identity(&identityMatrix);
 
     // synthetic oblique by skewing via the font matrix
-    bool needsOblique = !IsItalic() &&
-            (aStyle->style & (NS_FONT_STYLE_ITALIC | NS_FONT_STYLE_OBLIQUE)) &&
-            aStyle->allowSyntheticStyle;
+    bool needsOblique = IsUpright() &&
+                        aStyle->style != NS_FONT_STYLE_NORMAL &&
+                        aStyle->allowSyntheticStyle;
 
     if (needsOblique) {
         cairo_matrix_t style;
         cairo_matrix_init(&style,
                           1,                //xx
                           0,                //yx
                           -1 * OBLIQUE_SKEW_FACTOR, //xy
                           1,                //yy
@@ -246,17 +246,17 @@ FT2FontEntry::CreateFontInstance(const g
     return font;
 }
 
 /* static */
 FT2FontEntry*
 FT2FontEntry::CreateFontEntry(const nsAString& aFontName,
                               uint16_t aWeight,
                               int16_t aStretch,
-                              bool aItalic,
+                              uint8_t aStyle,
                               const uint8_t* aFontData,
                               uint32_t aLength)
 {
     // Ownership of aFontData is passed in here; the fontEntry must
     // retain it as long as the FT_Face needs it, and ensure it is
     // eventually deleted.
     FT_Face face;
     FT_Error error =
@@ -272,17 +272,17 @@ FT2FontEntry::CreateFontEntry(const nsAS
         return nullptr;
     }
     // Create our FT2FontEntry, which inherits the name of the userfont entry
     // as it's not guaranteed that the face has valid names (bug 737315)
     FT2FontEntry* fe =
         FT2FontEntry::CreateFontEntry(face, nullptr, 0, aFontName,
                                       aFontData);
     if (fe) {
-        fe->mItalic = aItalic;
+        fe->mStyle = aStyle;
         fe->mWeight = aWeight;
         fe->mStretch = aStretch;
         fe->mIsDataUserFont = true;
     }
     return fe;
 }
 
 class FTUserFontData {
@@ -318,17 +318,17 @@ FTFontDestroyFunc(void *data)
 FT2FontEntry*
 FT2FontEntry::CreateFontEntry(const FontListEntry& aFLE)
 {
     FT2FontEntry *fe = new FT2FontEntry(aFLE.faceName());
     fe->mFilename = aFLE.filepath();
     fe->mFTFontIndex = aFLE.index();
     fe->mWeight = aFLE.weight();
     fe->mStretch = aFLE.stretch();
-    fe->mItalic = aFLE.italic();
+    fe->mStyle = (aFLE.italic() ? NS_FONT_STYLE_ITALIC : NS_FONT_STYLE_NORMAL);
     return fe;
 }
 
 // Helpers to extract font entry properties from an FT_Face
 static bool
 FTFaceIsItalic(FT_Face aFace)
 {
     return !!(aFace->style_flags & FT_STYLE_FLAG_ITALIC);
@@ -375,17 +375,18 @@ FTFaceGetWeight(FT_Face aFace)
 /* static */
 FT2FontEntry*
 FT2FontEntry::CreateFontEntry(FT_Face aFace,
                               const char* aFilename, uint8_t aIndex,
                               const nsAString& aName,
                               const uint8_t* aFontData)
 {
     FT2FontEntry *fe = new FT2FontEntry(aName);
-    fe->mItalic = FTFaceIsItalic(aFace);
+    fe->mStyle = (FTFaceIsItalic(aFace) ?
+                  NS_FONT_STYLE_ITALIC : NS_FONT_STYLE_NORMAL);
     fe->mWeight = FTFaceGetWeight(aFace);
     fe->mFilename = aFilename;
     fe->mFTFontIndex = aIndex;
 
     if (aFontData) {
         fe->mFTFace = aFace;
         int flags = gfxPlatform::GetPlatform()->FontHintingEnabled() ?
                     FT_LOAD_DEFAULT :
@@ -591,17 +592,17 @@ FT2FontFamily::AddFacesToFontList(Infall
             static_cast<const FT2FontEntry*>(mAvailableFonts[i].get());
         if (!fe) {
             continue;
         }
         
         aFontList->AppendElement(FontListEntry(Name(), fe->Name(),
                                                fe->mFilename,
                                                fe->Weight(), fe->Stretch(),
-                                               fe->IsItalic(),
+                                               fe->mStyle,
                                                fe->mFTFontIndex,
                                                aVisibility == kHidden));
     }
 }
 
 /*
  * Startup cache support for the font list:
  * We store the list of families and faces, with their style attributes and the
@@ -1447,17 +1448,17 @@ gfxFT2FontList::InitFontList()
 
 // called for each family name, based on the assumption that the
 // first part of the full name is the family name
 
 gfxFontEntry*
 gfxFT2FontList::LookupLocalFont(const nsAString& aFontName,
                                 uint16_t aWeight,
                                 int16_t aStretch,
-                                bool aItalic)
+                                uint8_t aStyle)
 {
     // walk over list of names
     FT2FontEntry* fontEntry = nullptr;
     nsString fullName(aFontName);
 
     // Note that we only check mFontFamilies here, not mHiddenFontFamilies;
     // hence @font-face { src:local(...) } will not find hidden fonts.
     for (auto iter = mFontFamilies.Iter(); !iter.Done(); iter.Next()) {
@@ -1504,17 +1505,17 @@ searchDone:
     }
 
     FT2FontEntry* fe =
         FT2FontEntry::CreateFontEntry(fontEntry->mFTFace,
                                       fontEntry->mFilename.get(),
                                       fontEntry->mFTFontIndex,
                                       fontEntry->Name(), nullptr);
     if (fe) {
-        fe->mItalic = aItalic;
+        fe->mStyle = aStyle;
         fe->mWeight = aWeight;
         fe->mStretch = aStretch;
         fe->mIsLocalUserFont = true;
     }
 
     return fe;
 }
 
@@ -1533,25 +1534,25 @@ gfxFT2FontList::GetDefaultFont(const gfx
     /* TODO: what about Qt or other platforms that may use this? */
     return ff;
 }
 
 gfxFontEntry*
 gfxFT2FontList::MakePlatformFont(const nsAString& aFontName,
                                  uint16_t aWeight,
                                  int16_t aStretch,
-                                 bool aItalic,
+                                 uint8_t aStyle,
                                  const uint8_t* aFontData,
                                  uint32_t aLength)
 {
     // The FT2 font needs the font data to persist, so we do NOT free it here
     // but instead pass ownership to the font entry.
     // Deallocation will happen later, when the font face is destroyed.
     return FT2FontEntry::CreateFontEntry(aFontName, aWeight, aStretch,
-                                         aItalic, aFontData, aLength);
+                                         aStyle, aFontData, aLength);
 }
 
 void
 gfxFT2FontList::GetFontFamilyList(nsTArray<RefPtr<gfxFontFamily> >& aFamilyArray)
 {
     for (auto iter = mFontFamilies.Iter(); !iter.Done(); iter.Next()) {
         RefPtr<gfxFontFamily>& family = iter.Data();
         aFamilyArray.AppendElement(family);
--- a/gfx/thebes/gfxFT2FontList.h
+++ b/gfx/thebes/gfxFT2FontList.h
@@ -37,17 +37,17 @@ public:
         return Name();
     }
 
     // create a font entry for a downloaded font
     static FT2FontEntry* 
     CreateFontEntry(const nsAString& aFontName,
                     uint16_t aWeight,
                     int16_t aStretch,
-                    bool aItalic,
+                    uint8_t aStyle,
                     const uint8_t* aFontData,
                     uint32_t aLength);
 
     // create a font entry representing an installed font, identified by
     // a FontListEntry; the freetype and cairo faces will not be instantiated
     // until actually needed
     static FT2FontEntry*
     CreateFontEntry(const FontListEntry& aFLE);
@@ -120,22 +120,22 @@ class gfxFT2FontList : public gfxPlatfor
 public:
     gfxFT2FontList();
 
     virtual gfxFontFamily* GetDefaultFont(const gfxFontStyle* aStyle);
 
     virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
                                           uint16_t aWeight,
                                           int16_t aStretch,
-                                          bool aItalic);
+                                          uint8_t aStyle);
 
     virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
                                            uint16_t aWeight,
                                            int16_t aStretch,
-                                           bool aItalic,
+                                           uint8_t aStyle,
                                            const uint8_t* aFontData,
                                            uint32_t aLength);
 
     void GetSystemFontList(InfallibleTArray<FontListEntry>* retValue);
 
     static gfxFT2FontList* PlatformFontList() {
         return static_cast<gfxFT2FontList*>(gfxPlatformFontList::PlatformFontList());
     }
--- a/gfx/thebes/gfxFcPlatformFontList.cpp
+++ b/gfx/thebes/gfxFcPlatformFontList.cpp
@@ -251,18 +251,20 @@ gfxFontconfigFontEntry::gfxFontconfigFon
           mFTFace(nullptr), mFTFaceInitialized(false),
           mAspect(0.0), mFontData(nullptr)
 {
     // italic
     int slant;
     if (FcPatternGetInteger(aFontPattern, FC_SLANT, 0, &slant) != FcResultMatch) {
         slant = FC_SLANT_ROMAN;
     }
-    if (slant > 0) {
-        mItalic = true;
+    if (slant == FC_SLANT_OBLIQUE) {
+        mStyle = NS_FONT_STYLE_OBLIQUE;
+    } else if (slant > 0) {
+        mStyle = NS_FONT_STYLE_ITALIC;
     }
 
     // weight
     int weight;
     if (FcPatternGetInteger(aFontPattern, FC_WEIGHT, 0, &weight) != FcResultMatch) {
         weight = FC_WEIGHT_REGULAR;
     }
     mWeight = MapFcWeight(weight);
@@ -273,25 +275,25 @@ gfxFontconfigFontEntry::gfxFontconfigFon
         width = FC_WIDTH_NORMAL;
     }
     mStretch = MapFcWidth(width);
 }
 
 gfxFontconfigFontEntry::gfxFontconfigFontEntry(const nsAString& aFaceName,
                                                uint16_t aWeight,
                                                int16_t aStretch,
-                                               bool aItalic,
+                                               uint8_t aStyle,
                                                const uint8_t *aData,
                                                FT_Face aFace)
     : gfxFontEntry(aFaceName),
       mFTFace(aFace), mFTFaceInitialized(true),
       mAspect(0.0), mFontData(aData)
 {
     mWeight = aWeight;
-    mItalic = aItalic;
+    mStyle = aStyle;
     mStretch = aStretch;
     mIsDataUserFont = true;
 
     // Use fontconfig to fill out the pattern from the FTFace.
     // The "file" argument cannot be nullptr (in fontconfig-2.6.0 at
     // least). The dummy file passed here is removed below.
     //
     // When fontconfig scans the system fonts, FcConfigGetBlanks(nullptr)
@@ -314,23 +316,23 @@ gfxFontconfigFontEntry::gfxFontconfigFon
 
     mUserFontData = new FTUserFontData(mFTFace, mFontData);
 }
 
 gfxFontconfigFontEntry::gfxFontconfigFontEntry(const nsAString& aFaceName,
                                                FcPattern* aFontPattern,
                                                uint16_t aWeight,
                                                int16_t aStretch,
-                                               bool aItalic)
+                                               uint8_t aStyle)
         : gfxFontEntry(aFaceName), mFontPattern(aFontPattern),
           mFTFace(nullptr), mFTFaceInitialized(false),
           mAspect(0.0), mFontData(nullptr)
 {
     mWeight = aWeight;
-    mItalic = aItalic;
+    mStyle = aStyle;
     mStretch = aStretch;
     mIsLocalUserFont = true;
 }
 
 gfxFontconfigFontEntry::~gfxFontconfigFontEntry()
 {
 }
 
@@ -665,19 +667,19 @@ gfxFontconfigFontEntry::CreateScaledFont
                                          const gfxFontStyle *aStyle,
                                          bool aNeedsBold)
 {
     if (aNeedsBold) {
         FcPatternAddBool(aRenderPattern, FC_EMBOLDEN, FcTrue);
     }
 
     // synthetic oblique by skewing via the font matrix
-    bool needsOblique = !IsItalic() &&
-            (aStyle->style & (NS_FONT_STYLE_ITALIC | NS_FONT_STYLE_OBLIQUE)) &&
-            aStyle->allowSyntheticStyle;
+    bool needsOblique = IsUpright() &&
+                        aStyle->style != NS_FONT_STYLE_NORMAL &&
+                        aStyle->allowSyntheticStyle;
 
     if (needsOblique) {
         // disable embedded bitmaps (mimics behavior in 90-synthetic.conf)
         FcPatternDel(aRenderPattern, FC_EMBEDDED_BITMAP);
         FcPatternAddBool(aRenderPattern, FC_EMBEDDED_BITMAP, FcFalse);
     }
 
     cairo_font_face_t *face =
@@ -858,17 +860,18 @@ gfxFontconfigFontFamily::FindStyleVariat
         AddFontEntry(fontEntry);
 
         if (LOG_FONTLIST_ENABLED()) {
             LOG_FONTLIST(("(fontlist) added (%s) to family (%s)"
                  " with style: %s weight: %d stretch: %d"
                  " psname: %s fullname: %s",
                  NS_ConvertUTF16toUTF8(fontEntry->Name()).get(),
                  NS_ConvertUTF16toUTF8(Name()).get(),
-                 fontEntry->IsItalic() ? "italic" : "normal",
+                 (fontEntry->IsItalic()) ?
+                  "italic" : (fontEntry->IsOblique() ? "oblique" : "normal"),
                  fontEntry->Weight(), fontEntry->Stretch(),
                  NS_ConvertUTF16toUTF8(psname).get(),
                  NS_ConvertUTF16toUTF8(fullname).get()));
         }
     }
     mFaceNamesInitialized = true;
     mFontPatterns.Clear();
     SetHasStyles(true);
@@ -1167,37 +1170,37 @@ gfxFcPlatformFontList::GetDefaultFont(co
     return FindGenericFamily(NS_LITERAL_STRING("-moz-default"),
                              aStyle->language);
 }
 
 gfxFontEntry*
 gfxFcPlatformFontList::LookupLocalFont(const nsAString& aFontName,
                                        uint16_t aWeight,
                                        int16_t aStretch,
-                                       bool aItalic)
+                                       uint8_t aStyle)
 {
     nsAutoString keyName(aFontName);
     ToLowerCase(keyName);
 
     // if name is not in the global list, done
     FcPattern* fontPattern = mLocalNames.Get(keyName);
     if (!fontPattern) {
         return nullptr;
     }
 
     return new gfxFontconfigFontEntry(aFontName,
                                       fontPattern,
-                                      aWeight, aStretch, aItalic);
+                                      aWeight, aStretch, aStyle);
 }
 
 gfxFontEntry*
 gfxFcPlatformFontList::MakePlatformFont(const nsAString& aFontName,
                                         uint16_t aWeight,
                                         int16_t aStretch,
-                                        bool aItalic,
+                                        uint8_t aStyle,
                                         const uint8_t* aFontData,
                                         uint32_t aLength)
 {
     FT_Face face;
     FT_Error error =
         FT_New_Memory_Face(gfxFcPlatformFontList::GetFTLibrary(),
                            aFontData, aLength, 0, &face);
     if (error != FT_Err_Ok) {
@@ -1205,18 +1208,18 @@ gfxFcPlatformFontList::MakePlatformFont(
         return nullptr;
     }
     if (FT_Err_Ok != FT_Select_Charmap(face, FT_ENCODING_UNICODE)) {
         FT_Done_Face(face);
         NS_Free((void*)aFontData);
         return nullptr;
     }
 
-    return new gfxFontconfigFontEntry(aFontName, aWeight, aStretch, aItalic,
-                                      aFontData, face);
+    return new gfxFontconfigFontEntry(aFontName, aWeight, aStretch,
+                                      aStyle, aFontData, face);
 }
 
 gfxFontFamily*
 gfxFcPlatformFontList::FindFamily(const nsAString& aFamily, gfxFontStyle* aStyle)
 {
     nsAutoString familyName(aFamily);
     ToLowerCase(familyName);
     nsIAtom* language = (aStyle ? aStyle->language.get() : nullptr);
--- a/gfx/thebes/gfxFcPlatformFontList.h
+++ b/gfx/thebes/gfxFcPlatformFontList.h
@@ -94,26 +94,26 @@ public:
     explicit gfxFontconfigFontEntry(const nsAString& aFaceName,
                                     FcPattern* aFontPattern);
 
     // used for data fonts where the fontentry takes ownership
     // of the font data and the FT_Face
     explicit gfxFontconfigFontEntry(const nsAString& aFaceName,
                                     uint16_t aWeight,
                                     int16_t aStretch,
-                                    bool aItalic,
+                                    uint8_t aStyle,
                                     const uint8_t *aData,
                                     FT_Face aFace);
 
     // used for @font-face local system fonts with explicit patterns
     explicit gfxFontconfigFontEntry(const nsAString& aFaceName,
                                     FcPattern* aFontPattern,
                                     uint16_t aWeight,
                                     int16_t aStretch,
-                                    bool aItalic);
+                                    uint8_t aStyle);
 
     FcPattern* GetPattern() { return mFontPattern; }
 
     bool SupportsLangGroup(nsIAtom *aLangGroup) const override;
 
     nsresult ReadCMAP(FontInfoData *aFontInfoData = nullptr) override;
     bool TestCharacterMap(uint32_t aCh) override;
 
@@ -204,21 +204,22 @@ public:
                      nsTArray<nsString>& aListOfFonts) override;
 
 
     gfxFontFamily*
     GetDefaultFont(const gfxFontStyle* aStyle) override;
 
     gfxFontEntry*
     LookupLocalFont(const nsAString& aFontName, uint16_t aWeight,
-                    int16_t aStretch, bool aItalic) override;
+                    int16_t aStretch, uint8_t aStyle) override;
 
     gfxFontEntry*
     MakePlatformFont(const nsAString& aFontName, uint16_t aWeight,
-                     int16_t aStretch, bool aItalic,
+                     int16_t aStretch,
+                     uint8_t aStyle,
                      const uint8_t* aFontData,
                      uint32_t aLength) override;
 
     gfxFontFamily* FindFamily(const nsAString& aFamily,
                               gfxFontStyle* aStyle = nullptr) override;
 
     bool GetStandardFamilyName(const nsAString& aFontName,
                                nsAString& aFamilyName) override;
--- a/gfx/thebes/gfxFont.cpp
+++ b/gfx/thebes/gfxFont.cpp
@@ -2285,17 +2285,19 @@ gfxFont::Measure(gfxTextRun *aTextRun,
         if (isRTL) {
             metrics.mBoundingBox -= gfxPoint(x, 0);
         }
     }
 
     // If the font may be rendered with a fake-italic effect, we need to allow
     // for the top-right of the glyphs being skewed to the right, and the
     // bottom-left being skewed further left.
-    if (mStyle.style != NS_FONT_STYLE_NORMAL && !mFontEntry->IsItalic()) {
+    if (mStyle.style != NS_FONT_STYLE_NORMAL &&
+        mFontEntry->IsUpright() &&
+        mStyle.allowSyntheticStyle) {
         gfxFloat extendLeftEdge =
             ceil(OBLIQUE_SKEW_FACTOR * metrics.mBoundingBox.YMost());
         gfxFloat extendRightEdge =
             ceil(OBLIQUE_SKEW_FACTOR * -metrics.mBoundingBox.y);
         metrics.mBoundingBox.width += extendLeftEdge + extendRightEdge;
         metrics.mBoundingBox.x -= extendLeftEdge;
     }
 
--- a/gfx/thebes/gfxFontEntry.cpp
+++ b/gfx/thebes/gfxFontEntry.cpp
@@ -63,17 +63,17 @@ gfxCharacterMap::NotifyReleased()
     gfxPlatformFontList *fontlist = gfxPlatformFontList::PlatformFontList();
     if (mShared) {
         fontlist->RemoveCmap(this);
     }
     delete this;
 }
 
 gfxFontEntry::gfxFontEntry() :
-    mItalic(false), mFixedPitch(false),
+    mStyle(NS_FONT_STYLE_NORMAL), mFixedPitch(false),
     mIsValid(true),
     mIsBadUnderlineFont(false),
     mIsUserFontContainer(false),
     mIsDataUserFont(false),
     mIsLocalUserFont(false),
     mStandardFace(false),
     mSymbolFont(false),
     mIgnoreGDEF(false),
@@ -103,17 +103,17 @@ gfxFontEntry::gfxFontEntry() :
     mGrFace(nullptr),
     mGrFaceRefCnt(0)
 {
     memset(&mDefaultSubSpaceFeatures, 0, sizeof(mDefaultSubSpaceFeatures));
     memset(&mNonDefaultSubSpaceFeatures, 0, sizeof(mNonDefaultSubSpaceFeatures));
 }
 
 gfxFontEntry::gfxFontEntry(const nsAString& aName, bool aIsStandardFace) :
-    mName(aName), mItalic(false), mFixedPitch(false),
+    mName(aName), mStyle(NS_FONT_STYLE_NORMAL), mFixedPitch(false),
     mIsValid(true),
     mIsBadUnderlineFont(false),
     mIsUserFontContainer(false),
     mIsDataUserFont(false),
     mIsLocalUserFont(false), mStandardFace(aIsStandardFace),
     mSymbolFont(false),
     mIgnoreGDEF(false),
     mIgnoreGSUB(false),
@@ -1150,67 +1150,79 @@ gfxFontFamily::FindFontForStyle(const gf
     nsAutoTArray<gfxFontEntry*,4> matched;
     FindAllFontsForStyle(aFontStyle, matched, aNeedsSyntheticBold);
     if (!matched.IsEmpty()) {
         return matched[0];
     }
     return nullptr;
 }
 
+#define STYLE_SHIFT 2 // number of bits to contain style distance
+
+// style distance ==> [0,2]
 static inline uint32_t
-StyleStretchDistance(gfxFontEntry *aFontEntry, bool aTargetItalic,
-                     int16_t aTargetStretch)
+StyleDistance(uint32_t aFontStyle, uint32_t aTargetStyle)
 {
-    // Compute a measure of the "distance" between the requested style
-    // and the given fontEntry,
-    // considering italicness and font-stretch but not weight.
+    if (aFontStyle == aTargetStyle) {
+        return 0; // styles match exactly ==> 0
+    }
+    if (aFontStyle == NS_FONT_STYLE_NORMAL ||
+        aTargetStyle == NS_FONT_STYLE_NORMAL) {
+        return 2; // one is normal (but not the other) ==> 2
+    }
+    return 1; // neither is normal; must be italic vs oblique ==> 1
+}
 
+#define REVERSE_STRETCH_DISTANCE 5
+
+// stretch distance ==> [0,13]
+static inline uint32_t
+StretchDistance(int16_t aFontStretch, int16_t aTargetStretch)
+{
     int32_t distance = 0;
-    if (aTargetStretch != aFontEntry->mStretch) {
+    if (aTargetStretch != aFontStretch) {
         // stretch values are in the range -4 .. +4
         // if aTargetStretch is positive, we prefer more-positive values;
         // if zero or negative, prefer more-negative
         if (aTargetStretch > 0) {
-            distance = (aFontEntry->mStretch - aTargetStretch) * 2;
+            distance = (aFontStretch - aTargetStretch);
         } else {
-            distance = (aTargetStretch - aFontEntry->mStretch) * 2;
+            distance = (aTargetStretch - aFontStretch);
         }
         // if the computed "distance" here is negative, it means that
         // aFontEntry lies in the "non-preferred" direction from aTargetStretch,
         // so we treat that as larger than any preferred-direction distance
-        // (max possible is 8) by adding an extra 10 to the absolute value
+        // (max possible is 4) by adding an extra 5 to the absolute value
         if (distance < 0) {
-            distance = -distance + 10;
+            distance = -distance + REVERSE_STRETCH_DISTANCE;
         }
     }
-    if (aFontEntry->IsItalic() != aTargetItalic) {
-        distance += 1;
-    }
     return uint32_t(distance);
 }
 
-#define NON_DESIRED_DIRECTION_DISTANCE 1000
-#define MAX_WEIGHT_DISTANCE            2000
-
 // CSS currently limits font weights to multiples of 100 but the weight
 // matching code below does not assume this.
 //
-// Calculate weight values with range (0..1000). In general, heavier weights
-// match towards even heavier weights while lighter weights match towards even
-// lighter weights. Target weight values in the range [400..500] are special,
-// since they will first match up to 500, then down to 0, then up again
-// towards 999.
+// Calculate weight distance with values in the range (0..1000). In general,
+// heavier weights match towards even heavier weights while lighter weights
+// match towards even lighter weights. Target weight values in the range
+// [400..500] are special, since they will first match up to 500, then down
+// towards 0, then up again towards 999.
 //
 // Example: with target 600 and font weight 800, distance will be 200. With
-// target 300 and font weight 600, distance will be 1300, since heavier weights
-// are farther away than lighter weights. If the target is 5 and the font weight
-// 995, the distance would be 1990 for the same reason.
+// target 300 and font weight 600, distance will be 900, since heavier
+// weights are farther away than lighter weights. If the target is 5 and the
+// font weight 995, the distance would be 1590 for the same reason.
 
+#define REVERSE_WEIGHT_DISTANCE 600
+#define WEIGHT_SHIFT             11 // number of bits to contain weight distance
+
+// weight distance ==> [0,1598]
 static inline uint32_t
-WeightDistance(uint32_t aTargetWeight, uint32_t aFontWeight)
+WeightDistance(uint32_t aFontWeight, uint32_t aTargetWeight)
 {
     // Compute a measure of the "distance" between the requested
     // weight and the given fontEntry
 
     int32_t distance = 0, addedDistance = 0;
     if (aTargetWeight != aFontWeight) {
         if (aTargetWeight > 500) {
             distance = aFontWeight - aTargetWeight;
@@ -1230,23 +1242,44 @@ WeightDistance(uint32_t aTargetWeight, u
                 // font weights outside use rule for target weights < 400 with
                 // added distance to separate from font weights in
                 // the [400..500] range
                 distance = aTargetWeight - aFontWeight;
                 addedDistance = 100;
             }
         }
         if (distance < 0) {
-            distance = -distance + NON_DESIRED_DIRECTION_DISTANCE;
+            distance = -distance + REVERSE_WEIGHT_DISTANCE;
         }
         distance += addedDistance;
     }
     return uint32_t(distance);
 }
 
+#define MAX_DISTANCE 0xffffffff
+
+static inline uint32_t
+WeightStyleStretchDistance(gfxFontEntry* aFontEntry,
+                           const gfxFontStyle& aTargetStyle)
+{
+    // weight/style/stretch priority: stretch >> style >> weight
+    uint32_t stretchDist =
+        StretchDistance(aFontEntry->mStretch, aTargetStyle.stretch);
+    uint32_t styleDist = StyleDistance(aFontEntry->mStyle, aTargetStyle.style);
+    uint32_t weightDist =
+        WeightDistance(aFontEntry->Weight(), aTargetStyle.weight);
+
+    NS_ASSERTION(weightDist < (1 << WEIGHT_SHIFT), "weight value out of bounds");
+    NS_ASSERTION(styleDist < (1 << STYLE_SHIFT), "slope value out of bounds");
+
+    return (stretchDist << (STYLE_SHIFT + WEIGHT_SHIFT)) |
+           (styleDist << WEIGHT_SHIFT) |
+           weightDist;
+}
+
 void
 gfxFontFamily::FindAllFontsForStyle(const gfxFontStyle& aFontStyle,
                                     nsTArray<gfxFontEntry*>& aFontEntryList,
                                     bool& aNeedsSyntheticBold)
 {
     if (!mHasStyles) {
         FindStyleVariations(); // collect faces for the family, if not already done
     }
@@ -1266,30 +1299,28 @@ gfxFontFamily::FindAllFontsForStyle(cons
     if (count == 1) {
         fe = mAvailableFonts[0];
         aNeedsSyntheticBold =
             wantBold && !fe->IsBold() && aFontStyle.allowSyntheticWeight;
         aFontEntryList.AppendElement(fe);
         return;
     }
 
-    bool wantItalic = (aFontStyle.style &
-                       (NS_FONT_STYLE_ITALIC | NS_FONT_STYLE_OBLIQUE)) != 0;
-
     // Most families are "simple", having just Regular/Bold/Italic/BoldItalic,
     // or some subset of these. In this case, we have exactly 4 entries in mAvailableFonts,
     // stored in the above order; note that some of the entries may be nullptr.
     // We can then pick the required entry based on whether the request is for
     // bold or non-bold, italic or non-italic, without running the more complex
     // matching algorithm used for larger families with many weights and/or widths.
 
     if (mIsSimpleFamily) {
         // Family has no more than the "standard" 4 faces, at fixed indexes;
         // calculate which one we want.
         // Note that we cannot simply return it as not all 4 faces are necessarily present.
+        bool wantItalic = (aFontStyle.style != NS_FONT_STYLE_NORMAL);
         uint8_t faceIndex = (wantItalic ? kItalicMask : 0) |
                             (wantBold ? kBoldMask : 0);
 
         // if the desired style is available, return it directly
         fe = mAvailableFonts[faceIndex];
         if (fe) {
             // no need to set aNeedsSyntheticBold here as we matched the boldness request
             aFontEntryList.AppendElement(fe);
@@ -1327,26 +1358,24 @@ gfxFontFamily::FindAllFontsForStyle(cons
     // given but the 99% use case is only a single font entry per
     // weight/style/stretch distance value. To optimize this, only add entries
     // to the matched font array when another entry already has the same
     // weight/style/stretch distance and add the last matched font entry. For
     // normal platform fonts with a single font entry for each
     // weight/style/stretch combination, only the last matched font entry will
     // be added.
 
-    uint32_t minDistance = 0xffffffff;
+    uint32_t minDistance = MAX_DISTANCE;
     gfxFontEntry* matched = nullptr;
     // iterate in forward order so that faces like 'Bold' are matched before
     // matching style distance faces such as 'Bold Outline' (see bug 1185812)
     for (uint32_t i = 0; i < count; i++) {
         fe = mAvailableFonts[i];
-        uint32_t distance =
-            WeightDistance(aFontStyle.weight, fe->Weight()) +
-            (StyleStretchDistance(fe, wantItalic, aFontStyle.stretch) *
-             MAX_WEIGHT_DISTANCE);
+        // weight/style/stretch priority: stretch >> style >> weight
+        uint32_t distance = WeightStyleStretchDistance(fe, aFontStyle);
         if (distance < minDistance) {
             matched = fe;
             if (!aFontEntryList.IsEmpty()) {
                 aFontEntryList.Clear();
             }
             minDistance = distance;
         } else if (distance == minDistance) {
             if (matched) {
@@ -1386,18 +1415,19 @@ gfxFontFamily::CheckForSimpleFamily()
         return;
     }
 
     int16_t firstStretch = mAvailableFonts[0]->Stretch();
 
     gfxFontEntry *faces[4] = { 0 };
     for (uint8_t i = 0; i < count; ++i) {
         gfxFontEntry *fe = mAvailableFonts[i];
-        if (fe->Stretch() != firstStretch) {
-            return; // font-stretch doesn't match, don't treat as simple family
+        if (fe->Stretch() != firstStretch || fe->IsOblique()) {
+            // simple families don't have varying font-stretch or oblique
+            return;
         }
         uint8_t faceIndex = (fe->IsItalic() ? kItalicMask : 0) |
                             (fe->Weight() >= 600 ? kBoldMask : 0);
         if (faces[faceIndex]) {
             return; // two faces resolve to the same slot; family isn't "simple"
         }
         faces[faceIndex] = fe;
     }
@@ -1443,27 +1473,26 @@ void gfxFontFamily::LocalizedName(nsAStr
 
 // metric for how close a given font matches a style
 static int32_t
 CalcStyleMatch(gfxFontEntry *aFontEntry, const gfxFontStyle *aStyle)
 {
     int32_t rank = 0;
     if (aStyle) {
          // italics
-         bool wantItalic =
-             (aStyle->style & (NS_FONT_STYLE_ITALIC | NS_FONT_STYLE_OBLIQUE)) != 0;
-         if (aFontEntry->IsItalic() == wantItalic) {
+         bool wantUpright = (aStyle->style == NS_FONT_STYLE_NORMAL);
+         if (aFontEntry->IsUpright() == wantUpright) {
              rank += 10;
          }
 
         // measure of closeness of weight to the desired value
         rank += 9 - DeprecatedAbs(aFontEntry->Weight() / 100 - aStyle->ComputeWeight());
     } else {
         // if no font to match, prefer non-bold, non-italic fonts
-        if (!aFontEntry->IsItalic()) {
+        if (aFontEntry->IsUpright()) {
             rank += 3;
         }
         if (!aFontEntry->IsBold()) {
             rank += 2;
         }
     }
 
     return rank;
--- a/gfx/thebes/gfxFontEntry.h
+++ b/gfx/thebes/gfxFontEntry.h
@@ -3,16 +3,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef GFX_FONTENTRY_H
 #define GFX_FONTENTRY_H
 
 #include "gfxTypes.h"
 #include "nsString.h"
+#include "gfxFontConstants.h"
 #include "gfxFontFeatures.h"
 #include "gfxFontUtils.h"
 #include "nsTArray.h"
 #include "nsTHashtable.h"
 #include "mozilla/HashFunctions.h"
 #include "mozilla/MemoryReporting.h"
 #include "DrawMode.h"
 #include "nsUnicodeScriptCodes.h"
@@ -116,17 +117,19 @@ public:
     virtual nsString RealFaceName();
 
     uint16_t Weight() const { return mWeight; }
     int16_t Stretch() const { return mStretch; }
 
     bool IsUserFont() const { return mIsDataUserFont || mIsLocalUserFont; }
     bool IsLocalUserFont() const { return mIsLocalUserFont; }
     bool IsFixedPitch() const { return mFixedPitch; }
-    bool IsItalic() const { return mItalic; }
+    bool IsItalic() const { return mStyle == NS_FONT_STYLE_ITALIC; }
+    bool IsOblique() const { return mStyle == NS_FONT_STYLE_OBLIQUE; }
+    bool IsUpright() const { return mStyle == NS_FONT_STYLE_NORMAL; }
     bool IsBold() const { return mWeight >= 600; } // bold == weights 600 and above
     bool IgnoreGDEF() const { return mIgnoreGDEF; }
     bool IgnoreGSUB() const { return mIgnoreGSUB; }
 
     // whether a feature is supported by the font (limited to a small set
     // of features for which some form of fallback needs to be implemented)
     bool SupportsOpenTypeFeature(int32_t aScript, uint32_t aFeatureTag);
     bool SupportsGraphiteFeature(uint32_t aFeatureTag);
@@ -383,17 +386,17 @@ public:
                                   // plus a NULL terminator
     };
 
     bool SupportsScriptInGSUB(const hb_tag_t* aScriptTags);
 
     nsString         mName;
     nsString         mFamilyName;
 
-    bool             mItalic      : 1;
+    uint8_t          mStyle       : 2; // italic/oblique
     bool             mFixedPitch  : 1;
     bool             mIsValid     : 1;
     bool             mIsBadUnderlineFont : 1;
     bool             mIsUserFontContainer : 1; // userfont entry
     bool             mIsDataUserFont : 1;      // platform font entry (data)
     bool             mIsLocalUserFont : 1;     // platform font entry (local)
     bool             mStandardFace : 1;
     bool             mSymbolFont  : 1;
--- a/gfx/thebes/gfxFontconfigFonts.cpp
+++ b/gfx/thebes/gfxFontconfigFonts.cpp
@@ -330,20 +330,20 @@ gfxSystemFcFontEntry::ReleaseGrFace(gr_f
 // several files because of the limit on the number of glyphs in a Type 1 font
 // file.  (e.g. Computer Modern.)
 
 class gfxUserFcFontEntry : public gfxFcFontEntry {
 protected:
     explicit gfxUserFcFontEntry(const nsAString& aFontName,
                        uint16_t aWeight,
                        int16_t aStretch,
-                       bool aItalic)
+                       uint8_t aStyle)
         : gfxFcFontEntry(aFontName)
     {
-        mItalic = aItalic;
+        mStyle = aStyle;
         mWeight = aWeight;
         mStretch = aStretch;
     }
 
     // Helper function to change a pattern so that it matches the CSS style
     // descriptors and so gets properly sorted in font selection.  This also
     // avoids synthetic style effects being added by the renderer when the
     // style of the font itself does not match the descriptor provided by the
@@ -416,19 +416,19 @@ gfxUserFcFontEntry::AdjustPatternToCSS(F
  * gfxFcFonts from regular family-name based font selection.
  */
 
 class gfxLocalFcFontEntry : public gfxUserFcFontEntry {
 public:
     gfxLocalFcFontEntry(const nsAString& aFontName,
                         uint16_t aWeight,
                         int16_t aStretch,
-                        bool aItalic,
+                        uint8_t aStyle,
                         const nsTArray< nsCountedRef<FcPattern> >& aPatterns)
-        : gfxUserFcFontEntry(aFontName, aWeight, aStretch, aItalic)
+        : gfxUserFcFontEntry(aFontName, aWeight, aStretch, aStyle)
     {
         if (!mPatterns.SetCapacity(aPatterns.Length(), fallible))
             return; // OOM
 
         for (uint32_t i = 0; i < aPatterns.Length(); ++i) {
             FcPattern *pattern = FcPatternDuplicate(aPatterns.ElementAt(i));
             if (!pattern)
                 return; // OOM
@@ -453,19 +453,19 @@ public:
  */
 
 class gfxDownloadedFcFontEntry : public gfxUserFcFontEntry {
 public:
     // This takes ownership of the face and its underlying data
     gfxDownloadedFcFontEntry(const nsAString& aFontName,
                              uint16_t aWeight,
                              int16_t aStretch,
-                             bool aItalic,
+                             uint8_t aStyle,
                              const uint8_t *aData, FT_Face aFace)
-        : gfxUserFcFontEntry(aFontName, aWeight, aStretch, aItalic),
+        : gfxUserFcFontEntry(aFontName, aWeight, aStretch, aStyle),
           mFontData(aData), mFace(aFace)
     {
         NS_PRECONDITION(aFace != nullptr, "aFace is NULL!");
         mIsDataUserFont = true;
         InitPattern();
     }
 
     virtual ~gfxDownloadedFcFontEntry();
@@ -1743,17 +1743,17 @@ gfxPangoFontGroup::Shutdown()
     // cairo_debug_reset_static_data.
     gFTLibrary = nullptr;
 }
 
 /* static */ gfxFontEntry *
 gfxPangoFontGroup::NewFontEntry(const nsAString& aFontName,
                                 uint16_t aWeight,
                                 int16_t aStretch,
-                                bool aItalic)
+                                uint8_t aStyle)
 {
     gfxFontconfigUtils *utils = gfxFontconfigUtils::GetFontconfigUtils();
     if (!utils)
         return nullptr;
 
     // The font face name from @font-face { src: local() } is not well
     // defined.
     //
@@ -1786,17 +1786,17 @@ gfxPangoFontGroup::NewFontEntry(const ns
          ++v) {
         const nsTArray< nsCountedRef<FcPattern> >& fonts =
             utils->GetFontsForFullname(name);
 
         if (fonts.Length() != 0)
             return new gfxLocalFcFontEntry(aFontName,
                                            aWeight,
                                            aStretch,
-                                           aItalic,
+                                           aStyle,
                                            fonts);
     }
 
     return nullptr;
 }
 
 /* static */ FT_Library
 gfxPangoFontGroup::GetFTLibrary()
@@ -1828,17 +1828,17 @@ gfxPangoFontGroup::GetFTLibrary()
 
     return gFTLibrary;
 }
 
 /* static */ gfxFontEntry *
 gfxPangoFontGroup::NewFontEntry(const nsAString& aFontName,
                                 uint16_t aWeight,
                                 int16_t aStretch,
-                                bool aItalic,
+                                uint8_t aStyle,
                                 const uint8_t* aFontData,
                                 uint32_t aLength)
 {
     // Ownership of aFontData is passed in here, and transferred to the
     // new fontEntry, which will release it when no longer needed.
 
     // Using face_index = 0 for the first face in the font, as we have no
     // other information.  FT_New_Memory_Face checks for a nullptr FT_Library.
@@ -1846,17 +1846,17 @@ gfxPangoFontGroup::NewFontEntry(const ns
     FT_Error error =
         FT_New_Memory_Face(GetFTLibrary(), aFontData, aLength, 0, &face);
     if (error != 0) {
         free((void*)aFontData);
         return nullptr;
     }
 
     return new gfxDownloadedFcFontEntry(aFontName, aWeight,
-                                        aStretch, aItalic,
+                                        aStretch, aStyle,
                                         aFontData, face);
 }
 
 
 static double
 GetPixelSize(FcPattern *aPattern)
 {
     double size;
--- a/gfx/thebes/gfxFontconfigFonts.h
+++ b/gfx/thebes/gfxFontconfigFonts.h
@@ -40,22 +40,22 @@ public:
                         uint8_t *aMatchType);
 
     static void Shutdown();
 
     // Used for @font-face { src: local(); }
     static gfxFontEntry *NewFontEntry(const nsAString& aFontName,
                                       uint16_t aWeight,
                                       int16_t aStretch,
-                                      bool aItalic);
+                                      uint8_t aStyle);
     // Used for @font-face { src: url(); }
     static gfxFontEntry *NewFontEntry(const nsAString& aFontName,
                                       uint16_t aWeight,
                                       int16_t aStretch,
-                                      bool aItalic,
+                                      uint8_t aStyle,
                                       const uint8_t* aFontData,
                                       uint32_t aLength);
 
 private:
 
     virtual gfxFont *GetFontAt(int32_t i, uint32_t aCh = 0x20);
 
     // @param aLang [in] language to use for pref fonts and system default font
--- a/gfx/thebes/gfxGDIFont.cpp
+++ b/gfx/thebes/gfxGDIFont.cpp
@@ -172,19 +172,18 @@ void
 gfxGDIFont::Initialize()
 {
     NS_ASSERTION(!mMetrics, "re-creating metrics? this will leak");
 
     LOGFONTW logFont;
 
     // Figure out if we want to do synthetic oblique styling.
     GDIFontEntry* fe = static_cast<GDIFontEntry*>(GetFontEntry());
-    bool wantFakeItalic =
-        (mStyle.style & (NS_FONT_STYLE_ITALIC | NS_FONT_STYLE_OBLIQUE)) &&
-        !fe->IsItalic() && mStyle.allowSyntheticStyle;
+    bool wantFakeItalic = mStyle.style != NS_FONT_STYLE_NORMAL &&
+                          fe->IsUpright() && mStyle.allowSyntheticStyle;
 
     // If the font's family has an actual italic face (but font matching
     // didn't choose it), we have to use a cairo transform instead of asking
     // GDI to italicize, because that would use a different face and result
     // in a possible glyph ID mismatch between shaping and rendering.
     //
     // We use the mFamilyHasItalicFace flag in the entry in case of user fonts,
     // where the *CSS* family may not know about italic faces that are present
--- a/gfx/thebes/gfxGDIFontList.cpp
+++ b/gfx/thebes/gfxGDIFontList.cpp
@@ -113,28 +113,29 @@ FontTypeToOutPrecision(uint8_t fontType)
 /***************************************************************
  *
  * GDIFontEntry
  *
  */
 
 GDIFontEntry::GDIFontEntry(const nsAString& aFaceName,
                            gfxWindowsFontType aFontType,
-                           bool aItalic, uint16_t aWeight, int16_t aStretch,
+                           uint8_t aStyle, uint16_t aWeight,
+                           int16_t aStretch,
                            gfxUserFontData *aUserFontData,
                            bool aFamilyHasItalicFace)
     : gfxFontEntry(aFaceName),
       mWindowsFamily(0), mWindowsPitch(0),
       mFontType(aFontType),
       mForceGDI(false),
       mFamilyHasItalicFace(aFamilyHasItalicFace),
       mCharset(), mUnicodeRanges()
 {
     mUserFontData = aUserFontData;
-    mItalic = aItalic;
+    mStyle = aStyle;
     mWeight = aWeight;
     mStretch = aStretch;
     if (IsType1())
         mForceGDI = true;
     mIsDataUserFont = aUserFontData != nullptr;
 
     InitLogFont(aFaceName, aFontType);
 }
@@ -301,19 +302,20 @@ GDIFontEntry::TestCharacterMap(uint32_t 
         NS_ASSERTION(mCharacterMap, "failed to initialize a character map");
     }
 
     if (mCharacterMap->mBuildOnTheFly) {
         if (aCh > 0xFFFF)
             return false;
 
         // previous code was using the group style
-        gfxFontStyle fakeStyle;  
-        if (mItalic)
+        gfxFontStyle fakeStyle;
+        if (!IsUpright()) {
             fakeStyle.style = NS_FONT_STYLE_ITALIC;
+        }
         fakeStyle.weight = mWeight * 100;
 
         RefPtr<gfxFont> tempFont = FindOrMakeFont(&fakeStyle, false);
         if (!tempFont || !tempFont->Valid())
             return false;
         gfxGDIFont *font = static_cast<gfxGDIFont*>(tempFont.get());
 
         HDC dc = GetDC((HWND)nullptr);
@@ -382,34 +384,35 @@ GDIFontEntry::InitLogFont(const nsAStrin
     mLogFont.lfOutPrecision   = FontTypeToOutPrecision(aFontType);
     mLogFont.lfClipPrecision  = CLIP_TURNOFF_FONTASSOCIATION;
     mLogFont.lfQuality        = DEFAULT_QUALITY;
     mLogFont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
     // always force lfItalic if we want it.  Font selection code will
     // do its best to give us an italic font entry, but if no face exists
     // it may give us a regular one based on weight.  Windows should
     // do fake italic for us in that case.
-    mLogFont.lfItalic         = mItalic;
+    mLogFont.lfItalic         = !IsUpright();
     mLogFont.lfWeight         = mWeight;
 
     int len = std::min<int>(aName.Length(), LF_FACESIZE - 1);
     memcpy(&mLogFont.lfFaceName, aName.BeginReading(), len * sizeof(char16_t));
     mLogFont.lfFaceName[len] = '\0';
 }
 
 GDIFontEntry* 
 GDIFontEntry::CreateFontEntry(const nsAString& aName,
-                              gfxWindowsFontType aFontType, bool aItalic,
+                              gfxWindowsFontType aFontType,
+                              uint8_t aStyle,
                               uint16_t aWeight, int16_t aStretch,
                               gfxUserFontData* aUserFontData,
                               bool aFamilyHasItalicFace)
 {
     // jtdfix - need to set charset, unicode ranges, pitch/family
 
-    GDIFontEntry *fe = new GDIFontEntry(aName, aFontType, aItalic,
+    GDIFontEntry *fe = new GDIFontEntry(aName, aFontType, aStyle,
                                         aWeight, aStretch, aUserFontData,
                                         aFamilyHasItalicFace);
 
     return fe;
 }
 
 void
 GDIFontEntry::AddSizeOfIncludingThis(MallocSizeOf aMallocSizeOf,
@@ -451,28 +454,30 @@ GDIFontFamily::FamilyAddStylesProc(const
             return 1;
         }
     }
 
     for (uint32_t i = 0; i < ff->mAvailableFonts.Length(); ++i) {
         fe = static_cast<GDIFontEntry*>(ff->mAvailableFonts[i].get());
         // check if we already know about this face
         if (fe->mWeight == logFont.lfWeight &&
-            fe->mItalic == (logFont.lfItalic == 0xFF)) {
+            fe->IsItalic() == (logFont.lfItalic == 0xFF)) {
             // update the charset bit here since this could be different
             fe->mCharset.set(metrics.tmCharSet);
             return 1; 
         }
     }
 
     // We can't set the hasItalicFace flag correctly here,
     // because we might not have seen the family's italic face(s) yet.
     // So we'll set that flag for all members after loading all the faces.
+    uint8_t italicStyle = (logFont.lfItalic == 0xFF ?
+                           NS_FONT_STYLE_ITALIC : NS_FONT_STYLE_NORMAL);
     fe = GDIFontEntry::CreateFontEntry(nsDependentString(lpelfe->elfFullName),
-                                       feType, (logFont.lfItalic == 0xFF),
+                                       feType, italicStyle,
                                        (uint16_t) (logFont.lfWeight), 0,
                                        nullptr, false);
     if (!fe)
         return 1;
 
     ff->AddFontEntry(fe);
 
     // mark the charset bit
@@ -707,54 +712,53 @@ gfxGDIFontList::EnumFontFamExProc(ENUMLO
 
     return 1;
 }
 
 gfxFontEntry* 
 gfxGDIFontList::LookupLocalFont(const nsAString& aFontName,
                                 uint16_t aWeight,
                                 int16_t aStretch,
-                                bool aItalic)
+                                uint8_t aStyle)
 {
     gfxFontEntry *lookup;
 
     lookup = LookupInFaceNameLists(aFontName);
     if (!lookup) {
         return nullptr;
     }
 
     bool isCFF = false; // jtdfix -- need to determine this
     
     // use the face name from the lookup font entry, which will be the localized
     // face name which GDI mapping tables use (e.g. with the system locale set to
     // Dutch, a fullname of 'Arial Bold' will find a font entry with the face name
     // 'Arial Vet' which can be used as a key in GDI font lookups).
     GDIFontEntry *fe = GDIFontEntry::CreateFontEntry(lookup->Name(), 
         gfxWindowsFontType(isCFF ? GFX_FONT_TYPE_PS_OPENTYPE : GFX_FONT_TYPE_TRUETYPE) /*type*/, 
-        lookup->mItalic ? NS_FONT_STYLE_ITALIC : NS_FONT_STYLE_NORMAL,
-        lookup->mWeight, aStretch, nullptr,
+        lookup->mStyle, lookup->mWeight, aStretch, nullptr,
         static_cast<GDIFontEntry*>(lookup)->mFamilyHasItalicFace);
-        
+
     if (!fe)
         return nullptr;
 
     fe->mIsLocalUserFont = true;
 
     // make the new font entry match the userfont entry style characteristics
     fe->mWeight = (aWeight == 0 ? 400 : aWeight);
-    fe->mItalic = aItalic;
+    fe->mStyle = aStyle;
 
     return fe;
 }
 
 gfxFontEntry*
 gfxGDIFontList::MakePlatformFont(const nsAString& aFontName,
                                  uint16_t aWeight,
                                  int16_t aStretch,
-                                 bool aItalic,
+                                 uint8_t aStyle,
                                  const uint8_t* aFontData,
                                  uint32_t aLength)
 {
     // MakePlatformFont is responsible for deleting the font data with free
     // so we set up a stack object to ensure it is freed even if we take an
     // early exit
     struct FontDataDeleter {
         FontDataDeleter(const uint8_t* aFontData)
@@ -803,27 +807,26 @@ gfxGDIFontList::MakePlatformFont(const n
         RemoveFontMemResourceEx(fontRef);
         return nullptr;
     }
 
     // make a new font entry using the unique name
     WinUserFontData *winUserFontData = new WinUserFontData(fontRef);
     uint16_t w = (aWeight == 0 ? 400 : aWeight);
 
-    GDIFontEntry *fe = GDIFontEntry::CreateFontEntry(uniqueName, 
-        gfxWindowsFontType(isCFF ? GFX_FONT_TYPE_PS_OPENTYPE : GFX_FONT_TYPE_TRUETYPE) /*type*/, 
-        uint32_t(aItalic ? NS_FONT_STYLE_ITALIC : NS_FONT_STYLE_NORMAL),
-        w, aStretch, winUserFontData, false);
+    GDIFontEntry *fe = GDIFontEntry::CreateFontEntry(uniqueName,
+        gfxWindowsFontType(isCFF ? GFX_FONT_TYPE_PS_OPENTYPE : GFX_FONT_TYPE_TRUETYPE) /*type*/,
+        aStyle, w, aStretch, winUserFontData, false);
 
     if (!fe)
         return fe;
 
     fe->mIsDataUserFont = true;
 
-    // Uniscribe doesn't place CFF fonts loaded privately 
+    // Uniscribe doesn't place CFF fonts loaded privately
     // via AddFontMemResourceEx on XP/Vista
     if (isCFF && !IsWin7OrLater()) {
         fe->mForceGDI = true;
     }
 
     return fe;
 }
 
--- a/gfx/thebes/gfxGDIFontList.h
+++ b/gfx/thebes/gfxGDIFontList.h
@@ -231,26 +231,26 @@ public:
     virtual bool TestCharacterMap(uint32_t aCh);
 
     virtual void AddSizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
                                         FontListSizes* aSizes) const;
 
     // create a font entry for a font with a given name
     static GDIFontEntry* CreateFontEntry(const nsAString& aName,
                                          gfxWindowsFontType aFontType,
-                                         bool aItalic,
+                                         uint8_t aStyle,
                                          uint16_t aWeight, int16_t aStretch,
                                          gfxUserFontData* aUserFontData,
                                          bool aFamilyHasItalicFace);
 
     // create a font entry for a font referenced by its fullname
     static GDIFontEntry* LoadLocalFont(const nsAString& aFontName,
                                        uint16_t aWeight,
                                        int16_t aStretch,
-                                       bool aItalic);
+                                       uint8_t aStyle);
 
     uint8_t mWindowsFamily;
     uint8_t mWindowsPitch;
 
     gfxWindowsFontType mFontType;
     bool mForceGDI    : 1;
 
     // For src:local user-fonts, we keep track of whether the platform family
@@ -261,17 +261,17 @@ public:
 
     gfxSparseBitSet mCharset;
     gfxSparseBitSet mUnicodeRanges;
 
 protected:
     friend class gfxWindowsFont;
 
     GDIFontEntry(const nsAString& aFaceName, gfxWindowsFontType aFontType,
-                 bool aItalic, uint16_t aWeight, int16_t aStretch,
+                 uint8_t aStyle, uint16_t aWeight, int16_t aStretch,
                  gfxUserFontData *aUserFontData, bool aFamilyHasItalicFace);
 
     void InitLogFont(const nsAString& aName, gfxWindowsFontType aFontType);
 
     virtual gfxFont *CreateFontInstance(const gfxFontStyle *aFontStyle, bool aNeedsBold);
 
     virtual nsresult CopyFontTable(uint32_t aTableTag,
                                    FallibleTArray<uint8_t>& aBuffer) override;
@@ -306,22 +306,22 @@ public:
     virtual gfxFontFamily* GetDefaultFont(const gfxFontStyle* aStyle);
 
     gfxFontFamily* FindFamily(const nsAString& aFamily,
                               gfxFontStyle* aStyle = nullptr) override;
 
     virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
                                           uint16_t aWeight,
                                           int16_t aStretch,
-                                          bool aItalic);
+                                          uint8_t aStyle);
 
     virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
                                            uint16_t aWeight,
                                            int16_t aStretch,
-                                           bool aItalic,
+                                           uint8_t aStyle,
                                            const uint8_t* aFontData,
                                            uint32_t aLength);
 
     virtual void AddSizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
                                         FontListSizes* aSizes) const;
     virtual void AddSizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
                                         FontListSizes* aSizes) const;
 
--- a/gfx/thebes/gfxMacFont.cpp
+++ b/gfx/thebes/gfxMacFont.cpp
@@ -56,21 +56,20 @@ gfxMacFont::gfxMacFont(MacOSFontEntry *a
         return;
     }
 
     cairo_matrix_t sizeMatrix, ctm;
     cairo_matrix_init_identity(&ctm);
     cairo_matrix_init_scale(&sizeMatrix, mAdjustedSize, mAdjustedSize);
 
     // synthetic oblique by skewing via the font matrix
-    bool needsOblique =
-        (mFontEntry != nullptr) &&
-        (!mFontEntry->IsItalic() &&
-         (mStyle.style & (NS_FONT_STYLE_ITALIC | NS_FONT_STYLE_OBLIQUE))) &&
-        mStyle.allowSyntheticStyle;
+    bool needsOblique = mFontEntry != nullptr &&
+                        mFontEntry->IsUpright() &&
+                        mStyle.style != NS_FONT_STYLE_NORMAL &&
+                        mStyle.allowSyntheticStyle;
 
     if (needsOblique) {
         cairo_matrix_t style;
         cairo_matrix_init(&style,
                           1,                //xx
                           0,                //yx
                           -1 * OBLIQUE_SKEW_FACTOR, //xy
                           1,                //yy
--- a/gfx/thebes/gfxMacPlatformFontList.h
+++ b/gfx/thebes/gfxMacPlatformFontList.h
@@ -28,17 +28,17 @@ class MacOSFontEntry : public gfxFontEnt
 public:
     friend class gfxMacPlatformFontList;
 
     MacOSFontEntry(const nsAString& aPostscriptName, int32_t aWeight,
                    bool aIsStandardFace = false);
 
     // for use with data fonts
     MacOSFontEntry(const nsAString& aPostscriptName, CGFontRef aFontRef,
-                   uint16_t aWeight, uint16_t aStretch, uint32_t aItalicStyle,
+                   uint16_t aWeight, uint16_t aStretch, uint8_t aStyle,
                    bool aIsDataUserFont, bool aIsLocal);
 
     virtual ~MacOSFontEntry() {
         ::CGFontRelease(mFontRef);
     }
 
     virtual CGFontRef GetFontRef();
 
@@ -81,22 +81,22 @@ public:
 
     gfxFontFamily* GetDefaultFont(const gfxFontStyle* aStyle) override;
 
     bool GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName) override;
 
     gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
                                   uint16_t aWeight,
                                   int16_t aStretch,
-                                  bool aItalic) override;
-    
+                                  uint8_t aStyle) override;
+
     gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
                                    uint16_t aWeight,
                                    int16_t aStretch,
-                                   bool aItalic,
+                                   uint8_t aStyle,
                                    const uint8_t* aFontData,
                                    uint32_t aLength) override;
 
     gfxFontFamily* FindFamily(const nsAString& aFamily,
                               gfxFontStyle* aStyle = nullptr) override;
 
     // lookup the system font for a particular system font type and set
     // the name and style characteristics
--- a/gfx/thebes/gfxMacPlatformFontList.mm
+++ b/gfx/thebes/gfxMacPlatformFontList.mm
@@ -263,34 +263,34 @@ MacOSFontEntry::MacOSFontEntry(const nsA
       mIsCFFInitialized(false)
 {
     mWeight = aWeight;
 }
 
 MacOSFontEntry::MacOSFontEntry(const nsAString& aPostscriptName,
                                CGFontRef aFontRef,
                                uint16_t aWeight, uint16_t aStretch,
-                               uint32_t aItalicStyle,
+                               uint8_t aStyle,
                                bool aIsDataUserFont,
                                bool aIsLocalUserFont)
     : gfxFontEntry(aPostscriptName, false),
       mFontRef(NULL),
       mFontRefInitialized(false),
       mRequiresAAT(false),
       mIsCFF(false),
       mIsCFFInitialized(false)
 {
     mFontRef = aFontRef;
     mFontRefInitialized = true;
     ::CFRetain(mFontRef);
 
     mWeight = aWeight;
     mStretch = aStretch;
     mFixedPitch = false; // xxx - do we need this for downloaded fonts?
-    mItalic = (aItalicStyle & (NS_FONT_STYLE_ITALIC | NS_FONT_STYLE_OBLIQUE)) != 0;
+    mStyle = aStyle;
 
     NS_ASSERTION(!(aIsDataUserFont && aIsLocalUserFont),
                  "userfont is either a data font or a local font");
     mIsDataUserFont = aIsDataUserFont;
     mIsLocalUserFont = aIsLocalUserFont;
 }
 
 CGFontRef
@@ -518,17 +518,17 @@ gfxMacFontFamily::FindStyleVariations(Fo
             fontEntry->mStretch = NS_FONT_STRETCH_EXPANDED;
         }
         // Cocoa fails to set the Italic traits bit for HelveticaLightItalic,
         // at least (see bug 611855), so check for style name endings as well
         if ((macTraits & NSItalicFontMask) ||
             [facename hasSuffix:@"Italic"] ||
             [facename hasSuffix:@"Oblique"])
         {
-            fontEntry->mItalic = true;
+            fontEntry->mStyle = NS_FONT_STYLE_ITALIC;
         }
         if (macTraits & NSFixedPitchFontMask) {
             fontEntry->mFixedPitch = true;
         }
 
         if (LOG_FONTLIST_ENABLED()) {
             LOG_FONTLIST(("(fontlist) added (%s) to family (%s)"
                  " with style: %s weight: %d stretch: %d"
@@ -1004,53 +1004,50 @@ gfxMacPlatformFontList::AppleWeightToCSS
         aAppleWeight = kAppleMaxWeight;
     return gAppleWeightToCSSWeight[aAppleWeight];
 }
 
 gfxFontEntry*
 gfxMacPlatformFontList::LookupLocalFont(const nsAString& aFontName,
                                         uint16_t aWeight,
                                         int16_t aStretch,
-                                        bool aItalic)
+                                        uint8_t aStyle)
 {
     nsAutoreleasePool localPool;
 
     NSString *faceName = GetNSStringForString(aFontName);
     MacOSFontEntry *newFontEntry;
 
     // lookup face based on postscript or full name
     CGFontRef fontRef = ::CGFontCreateWithFontName(CFStringRef(faceName));
     if (!fontRef) {
         return nullptr;
     }
 
     NS_ASSERTION(aWeight >= 100 && aWeight <= 900,
                  "bogus font weight value!");
 
     newFontEntry =
-        new MacOSFontEntry(aFontName, fontRef,
-                           aWeight, aStretch,
-                           aItalic ?
-                               NS_FONT_STYLE_ITALIC : NS_FONT_STYLE_NORMAL,
+        new MacOSFontEntry(aFontName, fontRef, aWeight, aStretch, aStyle,
                            false, true);
     ::CFRelease(fontRef);
 
     return newFontEntry;
 }
 
 static void ReleaseData(void *info, const void *data, size_t size)
 {
     free((void*)data);
 }
 
 gfxFontEntry*
 gfxMacPlatformFontList::MakePlatformFont(const nsAString& aFontName,
                                          uint16_t aWeight,
                                          int16_t aStretch,
-                                         bool aItalic,
+                                         uint8_t aStyle,
                                          const uint8_t* aFontData,
                                          uint32_t aLength)
 {
     NS_ASSERTION(aFontData, "MakePlatformFont called with null data");
 
     NS_ASSERTION(aWeight >= 100 && aWeight <= 900, "bogus font weight value!");
 
     // create the font entry
@@ -1068,21 +1065,17 @@ gfxMacPlatformFontList::MakePlatformFont
     ::CGDataProviderRelease(provider);
 
     if (!fontRef) {
         return nullptr;
     }
 
     nsAutoPtr<MacOSFontEntry>
         newFontEntry(new MacOSFontEntry(uniqueName, fontRef, aWeight,
-                                        aStretch,
-                                        aItalic ?
-                                            NS_FONT_STYLE_ITALIC :
-                                            NS_FONT_STYLE_NORMAL,
-                                        true, false));
+                                        aStretch, aStyle, true, false));
     ::CFRelease(fontRef);
 
     // if succeeded and font cmap is good, return the new font
     if (newFontEntry->mIsValid && NS_SUCCEEDED(newFontEntry->ReadCMAP())) {
         return newFontEntry.forget();
     }
 
     // if something is funky about this font, delete immediately
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -1371,17 +1371,17 @@ gfxPlatform::UseGraphiteShaping()
 
     return mGraphiteShapingEnabled;
 }
 
 gfxFontEntry*
 gfxPlatform::MakePlatformFont(const nsAString& aFontName,
                               uint16_t aWeight,
                               int16_t aStretch,
-                              bool aItalic,
+                              uint8_t aStyle,
                               const uint8_t* aFontData,
                               uint32_t aLength)
 {
     // Default implementation does not handle activating downloaded fonts;
     // just free the data and return.
     // Platforms that support @font-face must override this,
     // using the data to instantiate the font, and taking responsibility
     // for freeing it when no longer required.
--- a/gfx/thebes/gfxPlatform.h
+++ b/gfx/thebes/gfxPlatform.h
@@ -343,31 +343,31 @@ public:
      * Look up a local platform font using the full font face name.
      * (Needed to support @font-face src local().)
      * Ownership of the returned gfxFontEntry is passed to the caller,
      * who must either AddRef() or delete.
      */
     virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
                                           uint16_t aWeight,
                                           int16_t aStretch,
-                                          bool aItalic)
+                                          uint8_t aStyle)
     { return nullptr; }
 
     /**
      * Activate a platform font.  (Needed to support @font-face src url().)
      * aFontData is a NS_Malloc'ed block that must be freed by this function
      * (or responsibility passed on) when it is no longer needed; the caller
      * will NOT free it.
      * Ownership of the returned gfxFontEntry is passed to the caller,
      * who must either AddRef() or delete.
      */
     virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
                                            uint16_t aWeight,
                                            int16_t aStretch,
-                                           bool aItalic,
+                                           uint8_t aStyle,
                                            const uint8_t* aFontData,
                                            uint32_t aLength);
 
     /**
      * Whether to allow downloadable fonts via @font-face rules
      */
     bool DownloadableFontsEnabled();
 
--- a/gfx/thebes/gfxPlatformFontList.h
+++ b/gfx/thebes/gfxPlatformFontList.h
@@ -148,24 +148,24 @@ public:
 
     // get the system default font family
     virtual gfxFontFamily* GetDefaultFont(const gfxFontStyle* aStyle) = 0;
 
     // look up a font by name on the host platform
     virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
                                           uint16_t aWeight,
                                           int16_t aStretch,
-                                          bool aItalic) = 0;
+                                          uint8_t aStyle) = 0;
 
     // create a new platform font from downloaded data (@font-face)
     // this method is responsible to ensure aFontData is free()'d
     virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
                                            uint16_t aWeight,
                                            int16_t aStretch,
-                                           bool aItalic,
+                                           uint8_t aStyle,
                                            const uint8_t* aFontData,
                                            uint32_t aLength) = 0;
 
     // get the standard family name on the platform for a given font name
     // (platforms may override, eg Mac)
     virtual bool GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName);
 
     virtual void AddSizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
--- a/gfx/thebes/gfxPlatformGtk.cpp
+++ b/gfx/thebes/gfxPlatformGtk.cpp
@@ -251,44 +251,45 @@ gfxPlatformGtk::CreateFontGroup(const Fo
 
     return new gfxPangoFontGroup(aFontFamilyList, aStyle, aUserFontSet);
 }
 
 gfxFontEntry*
 gfxPlatformGtk::LookupLocalFont(const nsAString& aFontName,
                                 uint16_t aWeight,
                                 int16_t aStretch,
-                                bool aItalic)
+                                uint8_t aStyle)
 {
     if (sUseFcFontList) {
         gfxPlatformFontList* pfl = gfxPlatformFontList::PlatformFontList();
-        return pfl->LookupLocalFont(aFontName, aWeight, aStretch, aItalic);
+        return pfl->LookupLocalFont(aFontName, aWeight, aStretch,
+                                    aStyle);
     }
 
     return gfxPangoFontGroup::NewFontEntry(aFontName, aWeight,
-                                           aStretch, aItalic);
+                                           aStretch, aStyle);
 }
 
 gfxFontEntry* 
 gfxPlatformGtk::MakePlatformFont(const nsAString& aFontName,
                                  uint16_t aWeight,
                                  int16_t aStretch,
-                                 bool aItalic,
+                                 uint8_t aStyle,
                                  const uint8_t* aFontData,
                                  uint32_t aLength)
 {
     if (sUseFcFontList) {
         gfxPlatformFontList* pfl = gfxPlatformFontList::PlatformFontList();
-        return pfl->MakePlatformFont(aFontName, aWeight, aStretch, aItalic,
-                                     aFontData, aLength);
+        return pfl->MakePlatformFont(aFontName, aWeight, aStretch,
+                                     aStyle, aFontData, aLength);
     }
 
     // passing ownership of the font data to the new font entry
     return gfxPangoFontGroup::NewFontEntry(aFontName, aWeight,
-                                           aStretch, aItalic,
+                                           aStretch, aStyle,
                                            aFontData, aLength);
 }
 
 bool
 gfxPlatformGtk::IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags)
 {
     // check for strange format flags
     NS_ASSERTION(!(aFormatFlags & gfxUserFontSet::FLAG_FORMAT_NOT_USED),
--- a/gfx/thebes/gfxPlatformGtk.h
+++ b/gfx/thebes/gfxPlatformGtk.h
@@ -58,26 +58,26 @@ public:
 
     /**
      * Look up a local platform font using the full font face name (needed to
      * support @font-face src local() )
      */
     virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
                                           uint16_t aWeight,
                                           int16_t aStretch,
-                                          bool aItalic) override;
+                                          uint8_t aStyle) override;
 
     /**
      * Activate a platform font (needed to support @font-face src url() )
      *
      */
     virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
                                            uint16_t aWeight,
                                            int16_t aStretch,
-                                           bool aItalic,
+                                           uint8_t aStyle,
                                            const uint8_t* aFontData,
                                            uint32_t aLength) override;
 
     /**
      * Check whether format is supported on a platform or not (if unclear,
      * returns true).
      */
     virtual bool IsFontFormatSupported(nsIURI *aFontURI,
--- a/gfx/thebes/gfxPlatformMac.cpp
+++ b/gfx/thebes/gfxPlatformMac.cpp
@@ -147,39 +147,39 @@ gfxPlatformMac::CreateFontGroup(const Fo
     return new gfxFontGroup(aFontFamilyList, aStyle, aTextPerf, aUserFontSet);
 }
 
 // these will move to gfxPlatform once all platforms support the fontlist
 gfxFontEntry* 
 gfxPlatformMac::LookupLocalFont(const nsAString& aFontName,
                                 uint16_t aWeight,
                                 int16_t aStretch,
-                                bool aItalic)
+                                uint8_t aStyle)
 {
     return gfxPlatformFontList::PlatformFontList()->LookupLocalFont(aFontName,
                                                                     aWeight,
                                                                     aStretch,
-                                                                    aItalic);
+                                                                    aStyle);
 }
 
 gfxFontEntry* 
 gfxPlatformMac::MakePlatformFont(const nsAString& aFontName,
                                  uint16_t aWeight,
                                  int16_t aStretch,
-                                 bool aItalic,
+                                 uint8_t aStyle,
                                  const uint8_t* aFontData,
                                  uint32_t aLength)
 {
     // Ownership of aFontData is received here, and passed on to
     // gfxPlatformFontList::MakePlatformFont(), which must ensure the data
     // is released with free when no longer needed
     return gfxPlatformFontList::PlatformFontList()->MakePlatformFont(aFontName,
                                                                      aWeight,
                                                                      aStretch,
-                                                                     aItalic,
+                                                                     aStyle,
                                                                      aFontData,
                                                                      aLength);
 }
 
 bool
 gfxPlatformMac::IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags)
 {
     // check for strange format flags
--- a/gfx/thebes/gfxPlatformMac.h
+++ b/gfx/thebes/gfxPlatformMac.h
@@ -39,24 +39,24 @@ public:
     CreateFontGroup(const mozilla::FontFamilyList& aFontFamilyList,
                     const gfxFontStyle *aStyle,
                     gfxTextPerfMetrics* aTextPerf,
                     gfxUserFontSet *aUserFontSet) override;
 
     virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
                                           uint16_t aWeight,
                                           int16_t aStretch,
-                                          bool aItalic) override;
+                                          uint8_t aStyle) override;
 
     virtual gfxPlatformFontList* CreatePlatformFontList() override;
 
     virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
                                            uint16_t aWeight,
                                            int16_t aStretch,
-                                           bool aItalic,
+                                           uint8_t aStyle,
                                            const uint8_t* aFontData,
                                            uint32_t aLength) override;
 
     bool IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags) override;
 
     nsresult GetFontList(nsIAtom *aLangGroup,
                          const nsACString& aGenericFamily,
                          nsTArray<nsString>& aListOfFonts) override;
--- a/gfx/thebes/gfxQtPlatform.cpp
+++ b/gfx/thebes/gfxQtPlatform.cpp
@@ -127,33 +127,33 @@ gfxQtPlatform::CreateFontGroup(const Fon
 {
     return new gfxPangoFontGroup(aFontFamilyList, aStyle, aUserFontSet);
 }
 
 gfxFontEntry*
 gfxQtPlatform::LookupLocalFont(const nsAString& aFontName,
                                uint16_t aWeight,
                                int16_t aStretch,
-                               bool aItalic)
+                               uint8_t aStyle)
 {
     return gfxPangoFontGroup::NewFontEntry(aFontName, aWeight,
-                                           aStretch, aItalic);
+                                           aStretch, aStyle);
 }
 
 gfxFontEntry*
 gfxQtPlatform::MakePlatformFont(const nsAString& aFontName,
                                 uint16_t aWeight,
                                 int16_t aStretch,
-                                bool aItalic,
+                                uint8_t aStyle,
                                 const uint8_t* aFontData,
                                 uint32_t aLength)
 {
     // passing ownership of the font data to the new font entry
     return gfxPangoFontGroup::NewFontEntry(aFontName, aWeight,
-                                           aStretch, aItalic,
+                                           aStretch, aStyle,
                                            aFontData, aLength);
 }
 
 bool
 gfxQtPlatform::IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags)
 {
     // check for strange format flags
     NS_ASSERTION(!(aFormatFlags & gfxUserFontSet::FLAG_FORMAT_NOT_USED),
--- a/gfx/thebes/gfxQtPlatform.h
+++ b/gfx/thebes/gfxQtPlatform.h
@@ -49,26 +49,26 @@ public:
 
     /**
      * Look up a local platform font using the full font face name (needed to
      * support @font-face src local() )
      */
     virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
                                           uint16_t aWeight,
                                           int16_t aStretch,
-                                          bool aItalic) override;
+                                          uint8_t aStyle) override;
 
     /**
      * Activate a platform font (needed to support @font-face src url() )
      *
      */
     virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
                                            uint16_t aWeight,
                                            int16_t aStretch,
-                                           bool aItalic,
+                                           uint8_t aStyle,
                                            const uint8_t* aFontData,
                                            uint32_t aLength) override;
 
     /**
      * Check whether format is supported on a platform or not (if unclear,
      * returns true).
      */
     virtual bool IsFontFormatSupported(nsIURI *aFontURI,
--- a/gfx/thebes/gfxUserFontSet.cpp
+++ b/gfx/thebes/gfxUserFontSet.cpp
@@ -104,17 +104,17 @@ private:
     const size_t mLimit;
     off_t        mOff;
 };
 
 gfxUserFontEntry::gfxUserFontEntry(gfxUserFontSet* aFontSet,
              const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
              uint32_t aWeight,
              int32_t aStretch,
-             uint32_t aItalicStyle,
+             uint8_t aStyle,
              const nsTArray<gfxFontFeature>& aFeatureSettings,
              uint32_t aLanguageOverride,
              gfxSparseBitSet* aUnicodeRanges)
     : gfxFontEntry(NS_LITERAL_STRING("userfont")),
       mUserFontLoadState(STATUS_NOT_LOADED),
       mFontDataLoadingState(NOT_LOADING),
       mUnsupportedFormat(false),
       mLoader(nullptr),
@@ -122,19 +122,17 @@ gfxUserFontEntry::gfxUserFontEntry(gfxUs
 {
     MOZ_ASSERT(aWeight != 0,
                "aWeight must not be 0; use NS_FONT_WEIGHT_NORMAL instead");
     mIsUserFontContainer = true;
     mSrcList = aFontFaceSrcList;
     mSrcIndex = 0;
     mWeight = aWeight;
     mStretch = aStretch;
-    // XXX Currently, we don't distinguish 'italic' and 'oblique' styles;
-    // we need to fix this. (Bug 543715)
-    mItalic = (aItalicStyle & (NS_FONT_STYLE_ITALIC | NS_FONT_STYLE_OBLIQUE)) != 0;
+    mStyle = aStyle;
     mFeatureSettings.AppendElements(aFeatureSettings);
     mLanguageOverride = aLanguageOverride;
 
     if (aUnicodeRanges &&
         Preferences::GetBool("layout.css.unicode-range.enabled")) {
         mCharacterMap = new gfxCharacterMap(*aUnicodeRanges);
     }
 }
@@ -142,28 +140,24 @@ gfxUserFontEntry::gfxUserFontEntry(gfxUs
 gfxUserFontEntry::~gfxUserFontEntry()
 {
 }
 
 bool
 gfxUserFontEntry::Matches(const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
                           uint32_t aWeight,
                           int32_t aStretch,
-                          uint32_t aItalicStyle,
+                          uint8_t aStyle,
                           const nsTArray<gfxFontFeature>& aFeatureSettings,
                           uint32_t aLanguageOverride,
                           gfxSparseBitSet* aUnicodeRanges)
 {
-    // XXX font entries don't distinguish italic from oblique (bug 543715)
-    bool isItalic =
-        (aItalicStyle & (NS_FONT_STYLE_ITALIC | NS_FONT_STYLE_OBLIQUE)) != 0;
-
     return mWeight == aWeight &&
            mStretch == aStretch &&
-           mItalic == isItalic &&
+           mStyle == aStyle &&
            mFeatureSettings == aFeatureSettings &&
            mLanguageOverride == aLanguageOverride &&
            mSrcList == aFontFaceSrcList &&
            ((!aUnicodeRanges && !mCharacterMap) ||
             (aUnicodeRanges && mCharacterMap && mCharacterMap->Equals(aUnicodeRanges)));
 }
 
 gfxFont*
@@ -407,17 +401,17 @@ gfxUserFontEntry::LoadNextSrc()
 
         // src local ==> lookup and load immediately
 
         if (currSrc.mSourceType == gfxFontFaceSrc::eSourceType_Local) {
             gfxFontEntry* fe =
                 gfxPlatform::GetPlatform()->LookupLocalFont(currSrc.mLocalName,
                                                             mWeight,
                                                             mStretch,
-                                                            mItalic);
+                                                            mStyle);
             nsTArray<gfxUserFontSet*> fontSets;
             GetUserFontSets(fontSets);
             for (gfxUserFontSet* fontSet : fontSets) {
                 // We need to note on each gfxUserFontSet that contains the user
                 // font entry that we used a local() rule.
                 fontSet->SetLocalRulesUsed();
             }
             if (fe) {
@@ -607,21 +601,20 @@ gfxUserFontEntry::LoadPlatformFont(const
         // The sanitizer ensures that we have a valid sfnt and a usable
         // name table, so this should never fail unless we're out of
         // memory, and GetFullNameFromSFNT is not directly exposed to
         // arbitrary/malicious data from the web.
         gfxFontUtils::GetFullNameFromSFNT(saneData, saneLen,
                                           originalFullName);
         // Here ownership of saneData is passed to the platform,
         // which will delete it when no longer required
-
         fe = gfxPlatform::GetPlatform()->MakePlatformFont(mName,
                                                           mWeight,
                                                           mStretch,
-                                                          mItalic,
+                                                          mStyle,
                                                           saneData,
                                                           saneLen);
         if (!fe) {
             mFontSet->LogMessage(this, "not usable by platform");
         }
     }
 
     if (fe) {
@@ -766,72 +759,72 @@ gfxUserFontSet::~gfxUserFontSet()
 }
 
 already_AddRefed<gfxUserFontEntry>
 gfxUserFontSet::FindOrCreateUserFontEntry(
                                const nsAString& aFamilyName,
                                const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
                                uint32_t aWeight,
                                int32_t aStretch,
-                               uint32_t aItalicStyle,
+                               uint8_t aStyle,
                                const nsTArray<gfxFontFeature>& aFeatureSettings,
                                uint32_t aLanguageOverride,
                                gfxSparseBitSet* aUnicodeRanges)
 {
     RefPtr<gfxUserFontEntry> entry;
 
     // If there's already a userfont entry in the family whose descriptors all match,
     // we can just move it to the end of the list instead of adding a new
     // face that will always "shadow" the old one.
     // Note that we can't do this for platform font entries, even if the
     // style descriptors match, as they might have had a different source list,
     // but we no longer have the old source list available to check.
     gfxUserFontFamily* family = LookupFamily(aFamilyName);
     if (family) {
         entry = FindExistingUserFontEntry(family, aFontFaceSrcList, aWeight,
-                                          aStretch, aItalicStyle,
+                                          aStretch, aStyle,
                                           aFeatureSettings, aLanguageOverride,
                                           aUnicodeRanges);
     }
 
     if (!entry) {
       entry = CreateUserFontEntry(aFontFaceSrcList, aWeight, aStretch,
-                                  aItalicStyle, aFeatureSettings,
+                                  aStyle, aFeatureSettings,
                                   aLanguageOverride, aUnicodeRanges);
       entry->mFamilyName = aFamilyName;
     }
 
     return entry.forget();
 }
 
 already_AddRefed<gfxUserFontEntry>
 gfxUserFontSet::CreateUserFontEntry(
                                const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
                                uint32_t aWeight,
                                int32_t aStretch,
-                               uint32_t aItalicStyle,
+                               uint8_t aStyle,
                                const nsTArray<gfxFontFeature>& aFeatureSettings,
                                uint32_t aLanguageOverride,
                                gfxSparseBitSet* aUnicodeRanges)
 {
 
     RefPtr<gfxUserFontEntry> userFontEntry =
         new gfxUserFontEntry(this, aFontFaceSrcList, aWeight,
-                              aStretch, aItalicStyle, aFeatureSettings,
+                              aStretch, aStyle, aFeatureSettings,
                               aLanguageOverride, aUnicodeRanges);
     return userFontEntry.forget();
 }
 
 gfxUserFontEntry*
 gfxUserFontSet::FindExistingUserFontEntry(
                                gfxUserFontFamily* aFamily,
                                const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
                                uint32_t aWeight,
                                int32_t aStretch,
-                               uint32_t aItalicStyle,
+                               uint8_t aStyle,
                                const nsTArray<gfxFontFeature>& aFeatureSettings,
                                uint32_t aLanguageOverride,
                                gfxSparseBitSet* aUnicodeRanges)
 {
     MOZ_ASSERT(aWeight != 0,
                "aWeight must not be 0; use NS_FONT_WEIGHT_NORMAL instead");
 
     nsTArray<RefPtr<gfxFontEntry>>& fontList = aFamily->GetFontList();
@@ -839,17 +832,17 @@ gfxUserFontSet::FindExistingUserFontEntr
     for (size_t i = 0, count = fontList.Length(); i < count; i++) {
         if (!fontList[i]->mIsUserFontContainer) {
             continue;
         }
 
         gfxUserFontEntry* existingUserFontEntry =
             static_cast<gfxUserFontEntry*>(fontList[i].get());
         if (!existingUserFontEntry->Matches(aFontFaceSrcList,
-                                            aWeight, aStretch, aItalicStyle,
+                                            aWeight, aStretch, aStyle,
                                             aFeatureSettings, aLanguageOverride,
                                             aUnicodeRanges)) {
             continue;
         }
 
         return existingUserFontEntry;
     }
 
@@ -862,17 +855,18 @@ gfxUserFontSet::AddUserFontEntry(const n
 {
     gfxUserFontFamily* family = GetFamily(aFamilyName);
     family->AddFontEntry(aUserFontEntry);
 
     if (LOG_ENABLED()) {
         LOG(("userfonts (%p) added to \"%s\" (%p) style: %s weight: %d "
              "stretch: %d",
              this, NS_ConvertUTF16toUTF8(aFamilyName).get(), aUserFontEntry,
-             (aUserFontEntry->IsItalic() ? "italic" : "normal"),
+             (aUserFontEntry->IsItalic() ? "italic" :
+              (aUserFontEntry->IsOblique() ? "oblique" : "normal")),
              aUserFontEntry->Weight(), aUserFontEntry->Stretch()));
     }
 }
 
 gfxUserFontEntry*
 gfxUserFontSet::FindUserFontEntryAndLoad(gfxFontFamily* aFamily,
                                          const gfxFontStyle& aFontStyle,
                                          bool& aNeedsBold,
@@ -1045,17 +1039,17 @@ gfxUserFontSet::UserFontCache::Entry::Ke
             }
         }
 
         if (mPrivate != aKey->mPrivate) {
             return false;
         }
     }
 
-    if (mFontEntry->mItalic           != fe->mItalic          ||
+    if (mFontEntry->mStyle            != fe->mStyle     ||
         mFontEntry->mWeight           != fe->mWeight          ||
         mFontEntry->mStretch          != fe->mStretch         ||
         mFontEntry->mFeatureSettings  != fe->mFeatureSettings ||
         mFontEntry->mLanguageOverride != fe->mLanguageOverride ||
         mFontEntry->mFamilyName       != fe->mFamilyName) {
         return false;
     }
 
--- a/gfx/thebes/gfxUserFontSet.h
+++ b/gfx/thebes/gfxUserFontSet.h
@@ -11,16 +11,17 @@
 #include "nsRefPtrHashtable.h"
 #include "nsAutoPtr.h"
 #include "nsCOMPtr.h"
 #include "nsIURI.h"
 #include "nsIPrincipal.h"
 #include "nsIScriptError.h"
 #include "nsURIHashKey.h"
 #include "mozilla/net/ReferrerPolicy.h"
+#include "gfxFontConstants.h"
 
 class nsFontFaceLoader;
 
 //#define DEBUG_USERFONT_CACHE
 
 class gfxFontFaceBufferSource
 {
   NS_INLINE_DECL_REFCOUNTING(gfxFontFaceBufferSource)
@@ -205,29 +206,29 @@ public:
     // stretch = [NS_FONT_STRETCH_ULTRA_CONDENSED, NS_FONT_STRETCH_ULTRA_EXPANDED]
     // italic style = constants in gfxFontConstants.h, e.g. NS_FONT_STYLE_NORMAL
     // language override = result of calling gfxFontStyle::ParseFontLanguageOverride
     // TODO: support for unicode ranges not yet implemented
     virtual already_AddRefed<gfxUserFontEntry> CreateUserFontEntry(
                               const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
                               uint32_t aWeight,
                               int32_t aStretch,
-                              uint32_t aItalicStyle,
+                              uint8_t aStyle,
                               const nsTArray<gfxFontFeature>& aFeatureSettings,
                               uint32_t aLanguageOverride,
                               gfxSparseBitSet* aUnicodeRanges) = 0;
 
     // creates a font face for the specified family, or returns an existing
     // matching entry on the family if there is one
     already_AddRefed<gfxUserFontEntry> FindOrCreateUserFontEntry(
                                const nsAString& aFamilyName,
                                const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
                                uint32_t aWeight,
                                int32_t aStretch,
-                               uint32_t aItalicStyle,
+                               uint8_t aStyle,
                                const nsTArray<gfxFontFeature>& aFeatureSettings,
                                uint32_t aLanguageOverride,
                                gfxSparseBitSet* aUnicodeRanges);
 
     // add in a font face for which we have the gfxUserFontEntry already
     void AddUserFontEntry(const nsAString& aFamilyName,
                           gfxUserFontEntry* aUserFontEntry);
 
@@ -411,19 +412,19 @@ public:
                 uint32_t principalHash = 0;
                 if (aKey->mPrincipal) {
                     aKey->mPrincipal->GetHashValue(&principalHash);
                 }
                 return mozilla::HashGeneric(principalHash + int(aKey->mPrivate),
                                             nsURIHashKey::HashKey(aKey->mURI),
                                             HashFeatures(aKey->mFontEntry->mFeatureSettings),
                                             mozilla::HashString(aKey->mFontEntry->mFamilyName),
-                                            ((uint32_t)aKey->mFontEntry->mItalic |
-                                             (aKey->mFontEntry->mWeight << 1) |
-                                             (aKey->mFontEntry->mStretch << 10) ) ^
+                                            (aKey->mFontEntry->mStyle |
+                                             (aKey->mFontEntry->mWeight << 2) |
+                                             (aKey->mFontEntry->mStretch << 11) ) ^
                                              aKey->mFontEntry->mLanguageOverride);
             }
 
             enum { ALLOW_MEMMOVE = false };
 
             gfxFontEntry* GetFontEntry() const { return mFontEntry; }
 
             bool IsPersistent() const { return mPersistence == kPersistent; }
@@ -490,17 +491,17 @@ protected:
     virtual void DoRebuildUserFontSet() = 0;
 
     // helper method for FindOrCreateUserFontEntry
     gfxUserFontEntry* FindExistingUserFontEntry(
                                    gfxUserFontFamily* aFamily,
                                    const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
                                    uint32_t aWeight,
                                    int32_t aStretch,
-                                   uint32_t aItalicStyle,
+                                   uint8_t aStyle,
                                    const nsTArray<gfxFontFeature>& aFeatureSettings,
                                    uint32_t aLanguageOverride,
                                    gfxSparseBitSet* aUnicodeRanges);
 
     // creates a new gfxUserFontFamily in mFontFamilies, or returns an existing
     // family if there is one
     gfxUserFontFamily* GetFamily(const nsAString& aFamilyName);
 
@@ -529,28 +530,28 @@ public:
         STATUS_LOADED,
         STATUS_FAILED
     };
 
     gfxUserFontEntry(gfxUserFontSet* aFontSet,
                      const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
                      uint32_t aWeight,
                      int32_t aStretch,
-                     uint32_t aItalicStyle,
+                     uint8_t aStyle,
                      const nsTArray<gfxFontFeature>& aFeatureSettings,
                      uint32_t aLanguageOverride,
                      gfxSparseBitSet* aUnicodeRanges);
 
     virtual ~gfxUserFontEntry();
 
     // Return whether the entry matches the given list of attributes
     bool Matches(const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
                  uint32_t aWeight,
                  int32_t aStretch,
-                 uint32_t aItalicStyle,
+                 uint8_t aStyle,
                  const nsTArray<gfxFontFeature>& aFeatureSettings,
                  uint32_t aLanguageOverride,
                  gfxSparseBitSet* aUnicodeRanges);
 
     virtual gfxFont* CreateFontInstance(const gfxFontStyle* aFontStyle,
                                         bool aNeedsBold);
 
     gfxFontEntry* GetPlatformFontEntry() const { return mPlatformFontEntry; }
--- a/gfx/thebes/gfxWindowsPlatform.cpp
+++ b/gfx/thebes/gfxWindowsPlatform.cpp
@@ -1051,36 +1051,36 @@ gfxWindowsPlatform::CreateFontGroup(cons
 {
     return new gfxFontGroup(aFontFamilyList, aStyle, aTextPerf, aUserFontSet);
 }
 
 gfxFontEntry* 
 gfxWindowsPlatform::LookupLocalFont(const nsAString& aFontName,
                                     uint16_t aWeight,
                                     int16_t aStretch,
-                                    bool aItalic)
+                                    uint8_t aStyle)
 {
     return gfxPlatformFontList::PlatformFontList()->LookupLocalFont(aFontName,
                                                                     aWeight,
                                                                     aStretch,
-                                                                    aItalic);
+                                                                    aStyle);
 }
 
 gfxFontEntry* 
 gfxWindowsPlatform::MakePlatformFont(const nsAString& aFontName,
                                      uint16_t aWeight,
                                      int16_t aStretch,
-                                     bool aItalic,
+                                     uint8_t aStyle,
                                      const uint8_t* aFontData,
                                      uint32_t aLength)
 {
     return gfxPlatformFontList::PlatformFontList()->MakePlatformFont(aFontName,
                                                                      aWeight,
                                                                      aStretch,
-                                                                     aItalic,
+                                                                     aStyle,
                                                                      aFontData,
                                                                      aLength);
 }
 
 bool
 gfxWindowsPlatform::IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags)
 {
     // check for strange format flags
--- a/gfx/thebes/gfxWindowsPlatform.h
+++ b/gfx/thebes/gfxWindowsPlatform.h
@@ -188,25 +188,25 @@ public:
                     gfxUserFontSet *aUserFontSet) override;
 
     /**
      * Look up a local platform font using the full font face name (needed to support @font-face src local() )
      */
     virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
                                           uint16_t aWeight,
                                           int16_t aStretch,
-                                          bool aItalic);
+                                          uint8_t aStyle);
 
     /**
      * Activate a platform font (needed to support @font-face src url() )
      */
     virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
                                            uint16_t aWeight,
                                            int16_t aStretch,
-                                           bool aItalic,
+                                           uint8_t aStyle,
                                            const uint8_t* aFontData,
                                            uint32_t aLength);
 
     virtual bool CanUseHardwareVideoDecoding() override;
 
     /**
      * Check whether format is supported on a platform or not (if unclear, returns true)
      */
--- a/image/test/browser/browser.ini
+++ b/image/test/browser/browser.ini
@@ -3,11 +3,11 @@ support-files =
   animated.gif
   animated2.gif
   big.png
   head.js
   image.html
   imageX2.html
 
 [browser_bug666317.js]
-skip-if = e10s # Bug 948194 - Decoded Images seem to not be discarded on memory-pressure notification with e10s enabled
+skip-if = true || e10s # Bug 1207012 - Permaorange from an uncaught exception that isn't actually turning the suite orange until it hits beta, Bug 948194 - Decoded Images seem to not be discarded on memory-pressure notification with e10s enabled
 [browser_image.js]
 skip-if = true # Bug 987616
--- a/js/xpconnect/loader/XPCOMUtils.jsm
+++ b/js/xpconnect/loader/XPCOMUtils.jsm
@@ -139,17 +139,19 @@ this.XPCOMUtils = {
         _interfaces.push(Ci[iface]);
       }
     }
     return {
       getInterfaces: function XPCU_getInterfaces(countRef) {
         countRef.value = _interfaces.length;
         return _interfaces;
       },
-      getScriptableHelper: function XPCU_getScriptableHelper() null,
+      getScriptableHelper: function XPCU_getScriptableHelper() {
+        return null;
+      },
       contractID: classInfo.contractID,
       classDescription: classInfo.classDescription,
       classID: classInfo.classID,
       flags: classInfo.flags,
       QueryInterface: this.generateQI([Ci.nsIClassInfo])
     };
   },
 
--- a/js/xpconnect/tests/chrome/test_sandboxImport.xul
+++ b/js/xpconnect/tests/chrome/test_sandboxImport.xul
@@ -19,18 +19,18 @@ https://bugzilla.mozilla.org/show_bug.cg
 
       function checkWrapped(obj) {
           var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
                             .getInterface(Components.interfaces.nsIDOMWindowUtils);
           is(utils.getClassName(obj), "Proxy", "right type of wrapper");
       }
 
       var sandbox = new Components.utils.Sandbox("about:blank");
-      sandbox.importFunction(function() "PASS", "foo");
-      sandbox.importFunction(function bar() "PASS");
+      sandbox.importFunction(function() { return "PASS"; }, "foo");
+      sandbox.importFunction(function bar() { return "PASS"; });
       sandbox.importFunction(checkWrapped);
       is(Components.utils.evalInSandbox("foo()", sandbox), "PASS", "importFunction works");
       is(Components.utils.evalInSandbox("bar()", sandbox), "PASS", "importFunction works");
       Components.utils.evalInSandbox("checkWrapped({})", sandbox);
 
       var importer = sandbox.importFunction;
       importer(function() { return "PASS"; }, "bar");
       is(Components.utils.evalInSandbox("bar()", sandbox), "PASS", "unbound importFunction works");
--- a/js/xpconnect/tests/mochitest/file_bug802557.html
+++ b/js/xpconnect/tests/mochitest/file_bug802557.html
@@ -1,17 +1,19 @@
 <!DOCTYPE html>
 <html>
 <head>
 <script>
 var gTS = window.location.toString;
 var gGHR = Object.getOwnPropertyDescriptor(window.location, 'href').get;
 function getTests(fromOuter) {
 
-  function loc() fromOuter ? window.location : location;
+  function loc() {
+    return fromOuter ? window.location : location;
+  }
   return {
     getLocationImplicit: function() {
       return loc() + "";
     },
     getLocationExplicit: function() {
       return loc().toString();
     },
     getLocationApply1: function() {
@@ -30,24 +32,24 @@ function getTests(fromOuter) {
       return Function.call.apply(gGHR, [loc()]);
     },
   }
 };
 
 function mungeNames(obj, suffix) {
   var rv = {};
   Object.getOwnPropertyNames(obj)
-        .forEach(function (name) rv[name + suffix] = obj[name]);
+        .forEach(name => rv[name + suffix] = obj[name]);
   return rv;
 }
 
 function mergeObjects(a, b) {
   var rv = {};
-  Object.getOwnPropertyNames(a).forEach(function(name) rv[name] = a[name]);
-  Object.getOwnPropertyNames(b).forEach(function(name) rv[name] = b[name]);
+  Object.getOwnPropertyNames(a).forEach(name => rv[name] = a[name]);
+  Object.getOwnPropertyNames(b).forEach(name => rv[name] = b[name]);
   return rv;
 }
 
 function getAllTests() {
   var innerTests = getTests(false);
   var outerTests = getTests(true);
   return mergeObjects(mungeNames(innerTests, '_inner'),
                       mungeNames(outerTests, '_outer'));
--- a/js/xpconnect/tests/mochitest/test_bug478438.html
+++ b/js/xpconnect/tests/mochitest/test_bug478438.html
@@ -19,29 +19,29 @@ https://bugzilla.mozilla.org/show_bug.cg
 
       var iwin = document.getElementById("f").contentWindow;
 
       function testOne(fn, onAllow, infinitive) {
         try { fn(); onAllow("able " + infinitive, "") }
         catch (e) { onAllow.opposite("unable " + infinitive, ": " + e) }
       }
 
-      testOne(function() iwin.focus, pass,
+      testOne(() => iwin.focus, pass,
               "to resolve/get allAccess property iwin.focus");
 
-      testOne(function() iwin.focus(), pass,
+      testOne(() => iwin.focus(), pass,
               "to call allAccess method iwin.focus");
 
-      testOne(function() iwin.alert, fail,
+      testOne(() => iwin.alert, fail,
               "to resolve/get restricted property iwin.alert");
 
-      testOne(function() iwin.alert(), fail,
+      testOne(() => iwin.alert(), fail,
               "to call restricted method iwin.alert");
 
-      testOne(function() iwin.location.toString(), fail,
+      testOne(() => iwin.location.toString(), fail,
               "to call restricted method iwin.location.toString");
 
       testOne(function() { iwin.location = "http://example.org" }, pass,
               "to set writable property iwin.location");
 
       SimpleTest.finish();
     }
   </script>
--- a/js/xpconnect/tests/unit/test_bug809652.js
+++ b/js/xpconnect/tests/unit/test_bug809652.js
@@ -16,17 +16,17 @@ function run_test() {
   var sb = new Cu.Sandbox('http://www.example.org');
   sb.obj = {foo: 2};
 
   /* Set up some typed arrays. */
   sb.ab = new ArrayBuffer(8);
   for (var i = 0; i < 8; ++i)
     new Uint8Array(sb.ab)[i] = i * 10;
   sb.ta = [];
-  TypedArrays.forEach(function(f) sb.ta.push(new f(sb.ab)));
+  TypedArrays.forEach(f => sb.ta.push(new f(sb.ab)));
   sb.dv = new DataView(sb.ab);
 
   /* Things that should throw. */
   checkThrows("Object.prototype.__lookupSetter__('__proto__').call(obj, {});", sb);
   sb.re = /f/;
   checkThrows("RegExp.prototype.exec.call(re, 'abcdefg').index", sb);
   sb.d = new Date();
   checkThrows("Date.prototype.setYear.call(d, 2011)", sb);
--- a/layout/generic/nsViewportFrame.cpp
+++ b/layout/generic/nsViewportFrame.cpp
@@ -7,16 +7,17 @@
  * rendering object that is the root of the frame tree, which contains
  * the document's scrollbars and contains fixed-positioned elements
  */
 
 #include "nsViewportFrame.h"
 #include "nsGkAtoms.h"
 #include "nsIScrollableFrame.h"
 #include "nsSubDocumentFrame.h"
+#include "nsCanvasFrame.h"
 #include "nsAbsoluteContainingBlock.h"
 #include "GeckoProfiler.h"
 #include "nsIMozBrowserFrame.h"
 
 using namespace mozilla;
 
 ViewportFrame*
 NS_NewViewportFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
@@ -86,16 +87,32 @@ ShouldInTopLayerForFullscreen(Element* a
   nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(aElement);
   if (browserFrame && browserFrame->GetReallyIsBrowserOrApp()) {
     return false;
   }
   return true;
 }
 #endif // DEBUG
 
+static void
+BuildDisplayListForTopLayerFrame(nsDisplayListBuilder* aBuilder,
+                                 nsIFrame* aFrame,
+                                 nsDisplayList* aList)
+{
+  nsRect dirty;
+  nsDisplayListBuilder::OutOfFlowDisplayData*
+    savedOutOfFlowData = nsDisplayListBuilder::GetOutOfFlowData(aFrame);
+  if (savedOutOfFlowData) {
+    dirty = savedOutOfFlowData->mDirtyRect;
+  }
+  nsDisplayList list;
+  aFrame->BuildDisplayListForStackingContext(aBuilder, dirty, &list);
+  aList->AppendToTop(&list);
+}
+
 void
 ViewportFrame::BuildDisplayListForTopLayer(nsDisplayListBuilder* aBuilder,
                                            nsDisplayList* aList)
 {
   nsIDocument* doc = PresContext()->Document();
   nsTArray<Element*> fullscreenStack = doc->GetFullscreenStack();
   for (Element* elem : fullscreenStack) {
     if (nsIFrame* frame = elem->GetPrimaryFrame()) {
@@ -118,26 +135,26 @@ ViewportFrame::BuildDisplayListForTopLay
       // elements are not allowed to be out-of-flow. They should not
       // be handled as top layer element here.
       if (!(frame->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) {
         MOZ_ASSERT(!elem->GetParent()->IsHTMLElement(), "HTML element "
                    "should always be out-of-flow if in the top layer");
         continue;
       }
       MOZ_ASSERT(frame->GetParent() == this);
+      BuildDisplayListForTopLayerFrame(aBuilder, frame, aList);
+    }
+  }
 
-      nsRect dirty;
-      nsDisplayListBuilder::OutOfFlowDisplayData*
-        savedOutOfFlowData = nsDisplayListBuilder::GetOutOfFlowData(frame);
-      if (savedOutOfFlowData) {
-        dirty = savedOutOfFlowData->mDirtyRect;
+  nsIPresShell* shell = PresContext()->PresShell();
+  if (nsCanvasFrame* canvasFrame = shell->GetCanvasFrame()) {
+    if (Element* container = canvasFrame->GetCustomContentContainer()) {
+      if (nsIFrame* frame = container->GetPrimaryFrame()) {
+        BuildDisplayListForTopLayerFrame(aBuilder, frame, aList);
       }
-      nsDisplayList list;
-      frame->BuildDisplayListForStackingContext(aBuilder, dirty, &list);
-      aList->AppendToTop(&list);
     }
   }
 }
 
 #ifdef DEBUG
 void
 ViewportFrame::SetInitialChildList(ChildListID     aListID,
                                    nsFrameList&    aChildList)
new file mode 100644
--- /dev/null
+++ b/layout/reftests/font-matching/italic-oblique-1.html
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML>
+<head>
+<title>style matching - italic/oblique</title>
+<link rel="author" title="John Daggett" href="mailto:jdaggett@mozilla.com">
+<link rel="author" title="Mozilla" href="http://www.mozilla.org/">
+<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-prop">
+<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-matching">
+<link rel="match" href="italic-oblique-ref.html">
+<meta name="flags" content="font matching must distinguish between italic and oblique">
+<style>
+@font-face {
+  font-family: test;
+  src: url(../fonts/markA.woff);
+}
+
+@font-face {
+  font-family: test;
+  src: url(../fonts/markB.woff);
+  font-style: italic;
+}
+
+body { margin: 30px }
+p { margin: 0; font: italic 300% test, serif; }
+</style>
+</head>
+<body>
+<p>BBB</p>
+</body>
+</html>
+
+
new file mode 100644
--- /dev/null
+++ b/layout/reftests/font-matching/italic-oblique-2.html
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML>
+<head>
+<title>style matching - italic/oblique</title>
+<link rel="author" title="John Daggett" href="mailto:jdaggett@mozilla.com">
+<link rel="author" title="Mozilla" href="http://www.mozilla.org/">
+<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-prop">
+<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-matching">
+<link rel="match" href="italic-oblique-ref.html">
+<meta name="flags" content="font matching must distinguish between italic and oblique">
+<style>
+@font-face {
+  font-family: test;
+  src: url(../fonts/markA.woff);
+}
+
+@font-face {
+  font-family: test;
+  src: url(../fonts/markC.woff);
+  font-style: oblique;
+}
+
+body { margin: 30px }
+p { margin: 0; font: italic 300% test, serif; }
+</style>
+</head>
+<body>
+<p>CCC</p>
+</body>
+</html>
+
+
new file mode 100644
--- /dev/null
+++ b/layout/reftests/font-matching/italic-oblique-3.html
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML>
+<head>
+<title>style matching - italic/oblique</title>
+<link rel="author" title="John Daggett" href="mailto:jdaggett@mozilla.com">
+<link rel="author" title="Mozilla" href="http://www.mozilla.org/">
+<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-prop">
+<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-matching">
+<link rel="match" href="italic-oblique-ref.html">
+<meta name="flags" content="font matching must distinguish between italic and oblique">
+<style>
+@font-face {
+  font-family: test;
+  src: url(../fonts/markA.woff);
+}
+
+@font-face {
+  font-family: test;
+  src: url(../fonts/markB.woff);
+  font-style: italic;
+}
+
+@font-face {
+  font-family: test;
+  src: url(../fonts/mark2B.woff);
+  font-style: oblique;
+}
+
+body { margin: 30px }
+p { margin: 0; font: italic 300% test, serif; }
+</style>
+</head>
+<body>
+<p>BBB</p>
+</body>
+</html>
+
+
new file mode 100644
--- /dev/null
+++ b/layout/reftests/font-matching/italic-oblique-4.html
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML>
+<head>
+<title>style matching - italic/oblique</title>
+<link rel="author" title="John Daggett" href="mailto:jdaggett@mozilla.com">
+<link rel="author" title="Mozilla" href="http://www.mozilla.org/">
+<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-prop">
+<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-matching">
+<link rel="match" href="italic-oblique-ref.html">
+<meta name="flags" content="font matching must distinguish between italic and oblique">
+<style>
+@font-face {
+  font-family: test;
+  src: url(../fonts/markA.woff);
+}
+
+@font-face {
+  font-family: test;
+  src: url(../fonts/mark2B.woff);
+  font-style: oblique;
+}
+
+@font-face {
+  font-family: test;
+  src: url(../fonts/markB.woff);
+  font-style: italic;
+}
+
+body { margin: 30px }
+p { margin: 0; font: italic 300% test, serif; }
+</style>
+</head>
+<body>
+<p>BBB</p>
+</body>
+</html>
+
+
new file mode 100644
--- /dev/null
+++ b/layout/reftests/font-matching/italic-oblique-5.html
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML>
+<head>
+<title>style matching - italic/oblique</title>
+<link rel="author" title="John Daggett" href="mailto:jdaggett@mozilla.com">
+<link rel="author" title="Mozilla" href="http://www.mozilla.org/">
+<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-prop">
+<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-matching">
+<link rel="match" href="italic-oblique-ref.html">
+<meta name="flags" content="font matching must distinguish between italic and oblique">
+<style>
+@font-face {
+  font-family: test;
+  src: url(../fonts/markA.woff);
+}
+
+@font-face {
+  font-family: test;
+  src: url(../fonts/mark2B.woff);
+  font-style: italic;
+}
+
+@font-face {
+  font-family: test;
+  src: url(../fonts/markB.woff);
+  font-style: oblique;
+}
+
+body { margin: 30px }
+p { margin: 0; font: oblique 300% test, serif; }
+</style>
+</head>
+<body>
+<p>BBB</p>
+</body>
+</html>
+
+
new file mode 100644
--- /dev/null
+++ b/layout/reftests/font-matching/italic-oblique-6.html
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML>
+<head>
+<title>style matching - italic/oblique</title>
+<link rel="author" title="John Daggett" href="mailto:jdaggett@mozilla.com">
+<link rel="author" title="Mozilla" href="http://www.mozilla.org/">
+<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-prop">
+<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-matching">
+<link rel="match" href="italic-oblique-ref.html">
+<meta name="flags" content="font matching must distinguish between italic and oblique">
+<style>
+@font-face {
+  font-family: test;
+  src: url(../fonts/markA.woff);
+}
+
+@font-face {
+  font-family: test;
+  src: url(../fonts/markB.woff);
+  font-style: italic;
+}
+
+@font-face {
+  font-family: test;
+  src: url(../fonts/markC.woff);
+  font-style: oblique;
+}
+
+body { margin: 30px }
+p { margin: 0; font: oblique 300% test, serif; }
+</style>
+</head>
+<body>
+<p>CCC</p>
+</body>
+</html>
+
+
new file mode 100644
--- /dev/null
+++ b/layout/reftests/font-matching/italic-oblique-7.html
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML>
+<head>
+<title>style matching - italic/oblique</title>
+<link rel="author" title="John Daggett" href="mailto:jdaggett@mozilla.com">
+<link rel="author" title="Mozilla" href="http://www.mozilla.org/">
+<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-prop">
+<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-matching">
+<link rel="match" href="italic-oblique-ref.html">
+<meta name="flags" content="font matching must distinguish between italic and oblique">
+<style>
+@font-face {
+  font-family: test;
+  src: url(../fonts/markA.woff);
+  font-style: oblique;
+}
+
+@font-face {
+  font-family: test;
+  src: url(../fonts/markB.woff);
+}
+
+@font-face {
+  font-family: test;
+  src: url(../fonts/mark2B.woff);
+  font-style: italic;
+}
+
+body { margin: 30px }
+p { margin: 0; font: oblique 300% test, serif; }
+</style>
+</head>
+<body>
+<p>AAA</p>
+</body>
+</html>
+
+
new file mode 100644
--- /dev/null
+++ b/layout/reftests/font-matching/italic-oblique-8.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML>
+<head>
+<title>style matching - italic/oblique</title>
+<link rel="author" title="John Daggett" href="mailto:jdaggett@mozilla.com">
+<link rel="author" title="Mozilla" href="http://www.mozilla.org/">
+<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-prop">
+<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-matching">
+<link rel="match" href="italic-oblique-ref.html">
+<meta name="flags" content="font matching must distinguish between italic and oblique">
+<style>
+@font-face {
+  font-family: test1;
+  src: url(../fonts/markA.woff);
+}
+
+@font-face {
+  font-family: test2;
+  src: url(../fonts/markB.woff);
+  font-style: italic;
+}
+
+@font-face {
+  font-family: test3;
+  src: url(../fonts/markC.woff);
+  font-style: oblique;
+}
+
+@font-face {
+  font-family: test3;
+  src: url(../fonts/mark2C.woff);
+  font-style: italic;
+}
+
+body { margin: 30px }
+p { margin: 0; font: oblique 300% test1, test2, test3, serif; }
+</style>
+</head>
+<body>
+<p>CCC</p>
+</body>
+</html>
+
+
new file mode 100644
--- /dev/null
+++ b/layout/reftests/font-matching/italic-oblique-9.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML>
+<head>
+<title>style matching - italic/oblique</title>
+<link rel="author" title="John Daggett" href="mailto:jdaggett@mozilla.com">
+<link rel="author" title="Mozilla" href="http://www.mozilla.org/">
+<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-prop">
+<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-matching">
+<link rel="match" href="italic-oblique-ref.html">
+<meta name="flags" content="font matching must distinguish between italic and oblique">
+<style>
+@font-face {
+  font-family: test1;
+  src: url(../fonts/markA.woff);
+}
+
+@font-face {
+  font-family: test2;
+  src: url(../fonts/markC.woff);
+  font-style: italic;
+}
+
+@font-face {
+  font-family: test3;
+  src: url(../fonts/mark2C.woff);
+  font-style: oblique;
+}
+
+@font-face {
+  font-family: test3;
+  src: url(../fonts/mark2A.woff);
+  font-style: italic;
+}
+
+body { margin: 30px }
+p { margin: 0; font: oblique 300% test1, test2, test3, serif; }
+</style>
+</head>
+<body>
+<p>CCC</p>
+</body>
+</html>
+
+
new file mode 100644
--- /dev/null
+++ b/layout/reftests/font-matching/italic-oblique-kinnari-ref.html
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML>
+<head>
+<title>style matching - italic/oblique</title>
+<link rel="author" title="John Daggett" href="mailto:jdaggett@mozilla.com">
+<link rel="author" title="Mozilla" href="http://www.mozilla.org/">
+<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-prop">
+<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-matching">
+<link rel="match" href="italic-oblique-ref.html">
+<meta name="flags" content="font matching must distinguish between italic and oblique">
+<style>
+@font-face {
+  font-family: test;
+  src: url(../fonts/mark2A.woff);
+  font-style: oblique;
+}
+
+@font-face {
+  font-family: test;
+  src: url(../fonts/markB.woff);
+}
+
+@font-face {
+  font-family: test;
+  src: url(../fonts/markA.woff);
+  font-style: italic;
+}
+
+body { margin: 30px }
+p { margin: 0; font: italic 300% kinnari, test, serif; }
+</style>
+</head>
+<body>
+<p>AAA</p>
+</body>
+</html>
+
+
new file mode 100644
--- /dev/null
+++ b/layout/reftests/font-matching/italic-oblique-kinnari.html
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML>
+<head>
+<title>style matching - italic/oblique</title>
+<link rel="author" title="John Daggett" href="mailto:jdaggett@mozilla.com">
+<link rel="author" title="Mozilla" href="http://www.mozilla.org/">
+<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-prop">
+<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-matching">
+<link rel="match" href="italic-oblique-ref.html">
+<meta name="flags" content="font matching must distinguish between italic and oblique">
+<style>
+@font-face {
+  font-family: test;
+  src: url(../fonts/mark2A.woff);
+  font-style: oblique;
+}
+
+@font-face {
+  font-family: test;
+  src: url(../fonts/markB.woff);
+}
+
+@font-face {
+  font-family: test;
+  src: url(../fonts/markA.woff);
+  font-style: italic;
+}
+
+body { margin: 30px }
+p { margin: 0; font: oblique 300% kinnari, test, serif; }
+</style>
+</head>
+<body>
+<p>AAA</p>
+</body>
+</html>
+
+
new file mode 100644
--- /dev/null
+++ b/layout/reftests/font-matching/italic-oblique-ref.html
@@ -0,0 +1,24 @@
+<!DOCTYPE HTML>
+<head>
+<title>style matching - italic/oblique</title>
+<link rel="author" title="John Daggett" href="mailto:jdaggett@mozilla.com">
+<link rel="author" title="Mozilla" href="http://www.mozilla.org/">
+<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-prop">
+<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-matching">
+<link rel="match" href="italic-oblique-1-ref.html">
+<meta name="flags" content="font matching must distinguish between italic and oblique">
+<style>
+@font-face {
+  font-family: test;
+  src: url(../fonts/markA.woff);
+}
+body { margin: 30px }
+p { margin: 0; font: 300% test, serif; }
+</style>
+</head>
+<body>
+<p>AAA</p>
+</body>
+</html>
+
+
--- a/layout/reftests/font-matching/reftest.list
+++ b/layout/reftests/font-matching/reftest.list
@@ -93,8 +93,21 @@ random-if(!(cocoaWidget||winWidget)) == 
 != syntheticbold-rotated.html syntheticbold-rotated-ref.html
 
 HTTP(..) == font-synthesis-1.html font-synthesis-1-ref.html
 skip-if(Mulet) HTTP(..) == font-synthesis-2.html font-synthesis-2-ref.html # MULET: Bug 1144079: Re-enable Mulet mochitests and reftests taskcluster-specific disables
 
 # Bug 1060791 - support for format 10 cmap in Apple Symbols;
 # relevant fonts not present on other platforms.
 skip-if(!cocoaWidget) HTTP(..) != apple-symbols-1.html apple-symbols-1-notref.html
+
+# distinguish between italic and oblique
+== simple-oblique.html simple-oblique-ref.html
+== italic-oblique-1.html italic-oblique-ref.html
+fuzzy-if(Mulet,103,144) == italic-oblique-2.html italic-oblique-ref.html
+== italic-oblique-3.html italic-oblique-ref.html
+== italic-oblique-4.html italic-oblique-ref.html
+== italic-oblique-5.html italic-oblique-ref.html
+fuzzy-if(Mulet,103,144) == italic-oblique-6.html italic-oblique-ref.html
+== italic-oblique-7.html italic-oblique-ref.html
+fuzzy-if(Mulet,103,144) == italic-oblique-8.html italic-oblique-ref.html
+fuzzy-if(Mulet,103,144) == italic-oblique-9.html italic-oblique-ref.html
+!= italic-oblique-kinnari.html italic-oblique-kinnari-ref.html
new file mode 100644
--- /dev/null
+++ b/layout/reftests/font-matching/simple-oblique-ref.html
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>oblique italic equivalence</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+  
+<style type="text/css">
+
+body {
+  margin: 50px;
+  font-size: 300%;
+}
+
+#sans { font-family: sans-serif; }
+#serif { font-family: serif; }
+#mono { font-family: monospace; }
+
+p {
+  margin: 0;
+  font-style: italic;
+  line-height: 1.3em;
+}
+</style>
+
+</head>
+<body>
+
+<p id=sans>UNICORN asteroid</p>
+<p id=serif>UNICORN asteroid</p>
+<p id=mono>UNICORN asteroid</p>
+
+</body>
+</html>
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/layout/reftests/font-matching/simple-oblique.html
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>oblique italic equivalence</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+  
+<style type="text/css">
+
+body {
+  margin: 50px;
+  font-size: 300%;
+}
+
+#sans { font-family: sans-serif; }
+#serif { font-family: serif; }
+#mono { font-family: monospace; }
+
+p {
+  margin: 0;
+  font-style: oblique;
+  line-height: 1.3em;
+}
+</style>
+
+</head>
+<body>
+
+<p id=sans>UNICORN asteroid</p>
+<p id=serif>UNICORN asteroid</p>
+<p id=mono>UNICORN asteroid</p>
+
+</body>
+</html>
\ No newline at end of file
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..58869bec71a78714fdb0ce0ee79a8486be55debc
GIT binary patch
literal 1084
zc$_QucXMN4WB>vd8wOqw&H9A_2XJ!>@dc_=05YY3SjKPNi<ADr`bG>4j7xxgM<5Oh
z{hMl*oSRqx6#D@YV{~HRXMUetRsz(=WCOAYj1`$G(-Vt<>R2Rzd=3!)|DS<5J*P4a
zsLlt-uL9zl@~DOR8L5dWKywU$d_y2M`w+aKIs+&O6a$Jg$N{km=Wcf1jNFn6px6r_
zUjT$fB^X+B@{@t;m>ht7E-=nu2+2*X0J*OP$d?CV1qKfW%e=(gRG_*OKyecwExh)%
zBx^x_aR~zh^B<rZX&~16zmCDQ;#P7(N<sp|qxM_Z{f>XWU6cACt&UM7(IRW%bnfM%
zk`gzj8N6jIvXq$Nu!zAXl?&uCsGeJg4;&CUdX7;=5~#+&XaSQLgFXY}4Y+(l;)8^Q
zBnC!-lP4I2iW4p{a{>dWk)a79|2*N(p#!H59Jq3HOM7GELUt!(y99%j6s9ht4TVMr
z7?hcXI6R7d6AKawQVLSSe&in%V7<m0%FJ-el=B(T4eT5YiVP4Mgi}CfCM2XaBuKKk
zu?cKo{3LO(MvRSB;Ve^&!oJ7<{|kKjueidC&CQHWVshg|P7eda1x#*ihZ<%kdN4Dz
zGqL>x83v3)P`H4h9mF3=0YINzNt$)^z?lQ*7Hpq5(eZwour>GL=*7J`Ysz!X42>CQ
z@<`8gJhVpPq3@fVo_e5A(~(|QQP!)ytW!lLE#qbE&zZc=pQRMca>1fagpF;Rs!w%;
znh{5{2xH+X&S|{rb#e)}KKHkOJRL92#>U2QRa^cv$nMhq^InG?1di>0JAXmIk;&$X
z9~9myCJJjziF47ijr@3JvB0ehZO8I%s<nT6byoeuGwB~;``q{Ei0#c_GukitZ1zvF
z1FZWNT&USz@o9~~gR{lme;)4am9D9Nrw|Z6Z}*On@_EeP;w@HMJzpa?cU4-eoYr~W
zPrIL+$$faavw5D?=R2({vd=UAK0o6?LOZig(V7izoR0F`JTrtdj&+zkzA{mmRXH_w
zwNB|*`=x5?xs9DSWpnmLO}`Y+qjIrI#klxPx6;(kjn>JRjm+oF4ounju(4Wf<z1Ch
zw>DMt(2CTFx}Uo$Ux`iEi<UYwXKlwemgMv|<-wOFm0Zqn)W1p2+V=FyjZihuC8;`R
zT@M-bJl?SFXa7>m_mOY@em?TH`)=u5nS^;aZR1s<j!(Q6_3vIWQ<t1?H8{Q)n*X2W
zadYUJ$SAv^!F8rY2!rKL#>b%8Wd!C&CP+F-VQ5k=yZheZOCa~&7zthm=UUda3=9Bl
C`FeE#
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..d1319a74c83e5b921a0d02a425b06f4c960ee762
GIT binary patch
literal 1084
zc$_QucXMN4WB>vd8wOqw&H9A_2XJ!>@dc_=05YY3SjKPNi<ADr`bG>4j7xxgM<5Oh
z{g-N<oSRqx6#D@YV{~HXXMUSpRsz(=WCOAYj1`$G(-Vt<>R2Rzd=3!)|DS<5J*P4a
zsLlt-uL9zl@~DOR8L5dWKywU$d_y2M`w+aKIs+&O6a$Jg$N{km=Wcf1jNFn6px6r_
zUjT$fB^X+B@{@t;m>ht7E-=nu2+2*X0J*OP$d?CV1qKfW%e=(gRG_*OKyecwExi7{
zG;2YAaR~zh^B<rZX&~16zn;Og;#P7(N<sp|qt~CNpF8&Xc1`Mov^qwSM2oD2)47+6
zN=n?AX7HA=$Wmg4!y*O?WzG*kjZi(e4j(umaP%CbiX>2tfzbjcF$R4G#v5??gv194
z2}ul$0w+%}2o)z>VCDn{P9sATME-fgpF;;u9XN31=$7`z#)a%o#&!t?DJe`{MjHx^
z4lpP)3vqZ9`z9776eJZSh5g7sD8PD+H<X#-R4gYbK-f7L6d52i2&aI|Oh`y;NRVW6
zV-wiG_(|emjTjrN!da#kg?*R*{}=f5-*JT(o0}P%#N@__oE`>-3z*#4lo*T;2e2`8
zNU{9~83v3)P`H4h9mF3=0YINzNt$)^z?lQ*7Hpq5(eZwour>GL=*7J`Ysz!X42>CQ
z@<`8gJhVpPq3@fVo_e5A(~(|QQP!)ytW!lLE#qbE&zZc=pQRMca>1fagpF;Rs!w%;
znh{5{2xH+X&S|{rb#e)}KKHkOJRL92#>U2QRa^cv$nMhq^InG?1di>0JAXmIk;&$X
z9~9myCJJjziDS{Wjr@3JvB0ehZO8I%s<nT6byoeuGwB~;``q{Ei0#c_GukitZ1zvF
z1FZWNT&USz@o9~~gR{lme;)4am9D9Nrw|Z6Z}*On@_EeP;w@HMJzpa?cU4-eoYr~W
zPrIL+$$faavw5D?=R2({vd=UAK0o6?LOZig(V7izoR0F`JTrtdj&+zkzA{mmRXH_w
zwNB|*`=x5?xs9DSWpnmLO}`Y+qjIrI#klxPx6;(kjn>JRjm+oF4ounju(4Wf<z1Ch
zw>DMt(2CTFx}Uo$Ux`iEi<UYwXKlwemgMv|<-wOFm0Zqn)W1p2+V=FyjZihuC8;`R
zT@M-bJl?SFXa7>m_mOY@em?TH`)=u5nS^;aZR1s<j!(Q6_3vIWQ*WPdGdR8&n*X2W
zadYUJ$SAv^!F8rY2&3gL#wVcIWd!C&CP+F-VQ5k=yZheZOCa~&7zthm=UUda3=9Cw
C&wEn<
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..d21fd0722c3d69df711808a2576b12a1860f6ac0
GIT binary patch
literal 1084
zc$_QucXMN4WB>vd8wOqw&H9A_2XJ!>@dc_=05YY3SjKPNi<ADr`bG>4j7xxgM<5Oh
z{hw-)oSRqx6#D@YV{~E=Vt$ugRsz(=WCOAYj1`$G(-Vt<>R2Rzd=3!)|DS<5J*P4a
zsLlt-uL9zl@~DOR8L5dWKywU$d_y2M`w+aKIs+&O6a$Jg$N{km=Wcf1jNFn6px6r_
zUjT$fB^X+B@{@t;m>ht7E-=nu2+2*X0J*OP$d?CV1qKfW%e=(gRG_*OKyhOrExhrw
zENel2aR~zh^B<rZX&~16zk$KD;#P7(N<sp|quG0&`yKmyyC(HPS{<WEqD9ui>D<dj
zB_(c5GkD8bWGOMjVG)DzPtF@ajZi(e4j(umaP%CbiX>2tfzbjcF$R4G#v5??gv194
z2}ul$0w+%}2o)z>VCDn{P9sATME-fgpF;;u9XN31=$7`z#)a%o#&!t?DJe`{MjHx^
z4lpP)3vqZ9`z9776r>fTh5g7sD8PD+H<X#-R4eBzpc~jZ7!(;GGzh1F%uGl~Ye<k}
zb7K?O!1zhxV2v0XtHN2P7KMGE|Nj^G^q+Bs7n_?Io5bYCiJTq=h6|Y7*pe8G4-2p{
zbQ-aP69h00LE!?1b`XCg1ps|=C27{t17{ALTd;lNM92GS!q(h}qZjw)tSQeiGc;zL
z$s;|}@z5HDhrVxedg_5fO-FiJMOm-*vQ8D1w2YUrKWFkff0j}(%LR)z5jM7Msy@{X
zYDOH*B8-KnIH&Qd*U2T^`rP0C@pQa68yg$LRc-mxAiGQZ&wCwq5IDB~?feA+M<$ym
zeo%O;m@2F>CC<jB%IMKbcf~CWdDq_E;LG>+>TLf9XU#vXt>NFFBepk#&1k>mv)Mnz
z4zSuSyim8j;>#L=2Um;R|GeATEnQRjPB9>S-tQeD<@1=o&9_`x^?Z%ooK=afj9KSp
zKh1uw_wM7vo$ZZQpYOD<$Ue{b+utK0;1NeRQ+7^(qrnj&<!2JJ3{{uTu_{bDej>tL
z%RBb-`4yTT)e44BFN(ePRXzOFBWdmONwb1C-cFq)5iK=4wDn<(*TkdK*oDMq-aY2)
z)+cIywIXri`mR}(@5I9OqNUEvU2B-jnRf2R`(@jV9XmP%|J^u#=gsP!8(+sf+Bj|I
z7IDtW23?1aJ+q%CwkN&t!+GKD`bF2b7B{%&@z+euknP=i?bG*p`4j&6c0=Neq51z=
z9yf=siHx!v8eC^eTw$=>&G-})yNtm6$OK6zDGW`@Wq02@d<o><8zaHX;9SePmVp5P
DTO50-
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..3d42d6f40c845c3f6303456173f8eef0d6199318
GIT binary patch
literal 1084
zc$_QucXMN4WB>vd8wOqw&H9A_2XJ!>@dc_=05YY3SjKPNi<ADr`bG>4j7xxgM<5Oh
zV@S13&P^-;iv56yF*-5uv%OC)D*@_bvH@8H#)?dp>50Wabu1D<J_iW@|Ifgjo>Q3y
zRObWaR{?QNdDO!EjMT&wpg9IWz9A5seF$DqodFaCiUGwL<bYU(b2mG0Ms7(3Q0xVe
zF95=#5)7?5`N=?aOb$Rk7Z_(SgybexfZW#t<jVuG0)q#GWnN-#Dp1`CptuQ;7T)|_
zp0yyqxP*a$`43QyG!Se3-^gHEaVt3?B_V;~(dswueaAlEu1S56R>vrkXpyyWI`?u>
zNr@ZN4Bj#pSxU@sSj3=zp7Q`uBUI0=!v_us96iUVA_-JuV6=cqj6t7)@djKzA@M;%
zLJ|X`z{wK~Ld6Lem^p!g)5y>Sk$;}>=g@&u2M%00x~09baUr{tv0Z{eN(xh#(S|~!
z0}RT{LL45&zKI111&IZTVL$Q@3b0<|4P|CHwU+Y@&<*Sy42ld88iZ3oW+o)0H6%!~
zxv>dsVEiO;uttoHRpBgCi^9Is|Njeo`d_!gi_Oi9O=5E6L{1L_!v#!kY>OC-4_{zq
z=<;F*CmCQIg2Dw1?I8Y03IO`#O46*O2hJQgw_y9kiH`Tvgsr&`M=$QpSyP^4W@yYf
zlSg`{<DoSQ4}IU{^wa}|nvV3cin3nqWt}Q2X&EnLf6nA}{w$?nmJ1ebB5Z8iRDG%&
z)QmWqMHmZDaZck^uair-^|`<O<LP*DHa0eftJ?CXL3Wq++h!eh5NN&s%UvbGX;n$1
zqU#3knNtrW+*vXqFtt5IkNJ?;whfO(vsZ4oU1I6D>yE<qQ?{SB#7$DW*zjz2;=MD`
z4B<ao4*lGHd~td!!}@vAPs-2d-g$Vsn7wh=$2&*2R(+7!@c)eG)txD(#jDyxt5(=<
zKaoH0_KZh|i`i{UAMWH1+&+)_+x!U!790^2W4(4`LDPbMRkkyRCdodtieDY+lvPf?
zyF#b*to`C;3U3>aOmUB1V?OoEbmq>ja;NXi>AI^o`N)k+H`ZwJJbxw<nNyi?N@?@$
z9Vbt0e6&nTU*}V3pz-p&!l#>-9=vl?>e94?M?HV@tjgUu1Pu?#|Mob$&#O1~xe)(W
zpC>gF4Y(F-<mCKI&OBHx#{S=?@V8QVtTlVYlWzyaJFi^~$kwfY|C4P>p6_IEd@(ft
zKg;9h&^3`!c0+^fOo=OumU|eVfnt{tm>-!S=_G}rNxAIqdxtN9+<Rjrcp02)S=TZ!
F002iUf0zIO
--- a/layout/style/FontFace.h
+++ b/layout/style/FontFace.h
@@ -39,22 +39,22 @@ public:
   class Entry final : public gfxUserFontEntry {
     friend class FontFace;
 
   public:
     Entry(gfxUserFontSet* aFontSet,
           const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
           uint32_t aWeight,
           int32_t aStretch,
-          uint32_t aItalicStyle,
+          uint8_t aStyle,
           const nsTArray<gfxFontFeature>& aFeatureSettings,
           uint32_t aLanguageOverride,
           gfxSparseBitSet* aUnicodeRanges)
       : gfxUserFontEntry(aFontSet, aFontFaceSrcList, aWeight, aStretch,
-                         aItalicStyle, aFeatureSettings, aLanguageOverride,
+                         aStyle, aFeatureSettings, aLanguageOverride,
                          aUnicodeRanges) {}
 
     virtual void SetLoadState(UserFontLoadState aLoadState) override;
     virtual void GetUserFontSets(nsTArray<gfxUserFontSet*>& aResult) override;
     const nsAutoTArray<FontFace*,1>& GetFontFaces() { return mFontFaces; }
 
   protected:
     // The FontFace objects that use this user font entry.  We need to store
--- a/layout/style/FontFaceSet.cpp
+++ b/layout/style/FontFaceSet.cpp
@@ -164,17 +164,17 @@ FontFaceSet::RemoveDOMContentLoadedListe
 }
 
 void
 FontFaceSet::ParseFontShorthandForMatching(
                             const nsAString& aFont,
                             RefPtr<FontFamilyListRefCnt>& aFamilyList,
                             uint32_t& aWeight,
                             int32_t& aStretch,
-                            uint32_t& aItalicStyle,
+                            uint8_t& aStyle,
                             ErrorResult& aRv)
 {
   // Parse aFont as a 'font' property value.
   Declaration declaration;
   declaration.InitializeEmpty();
 
   bool changed = false;
   nsCSSParser parser;
@@ -219,17 +219,17 @@ FontFaceSet::ParseFontShorthandForMatchi
     weight = NS_FONT_WEIGHT_BOLD;
   } else if (weight == NS_STYLE_FONT_WEIGHT_LIGHTER) {
     weight = NS_FONT_WEIGHT_THIN;
   }
 
   aWeight = weight;
 
   aStretch = data->ValueFor(eCSSProperty_font_stretch)->GetIntValue();
-  aItalicStyle = data->ValueFor(eCSSProperty_font_style)->GetIntValue();
+  aStyle = data->ValueFor(eCSSProperty_font_style)->GetIntValue();
 }
 
 static bool
 HasAnyCharacterInUnicodeRange(gfxUserFontEntry* aEntry,
                               const nsAString& aInput)
 {
   const char16_t* p = aInput.Data();
   const char16_t* end = p + aInput.Length();
@@ -247,17 +247,17 @@ void
 FontFaceSet::FindMatchingFontFaces(const nsAString& aFont,
                                    const nsAString& aText,
                                    nsTArray<FontFace*>& aFontFaces,
                                    ErrorResult& aRv)
 {
   RefPtr<FontFamilyListRefCnt> familyList;
   uint32_t weight;
   int32_t stretch;
-  uint32_t italicStyle;
+  uint8_t italicStyle;
   ParseFontShorthandForMatching(aFont, familyList, weight, stretch, italicStyle,
                                 aRv);
   if (aRv.Failed()) {
     return;
   }
 
   gfxFontStyle style;
   style.style = italicStyle;
@@ -959,17 +959,17 @@ FontFaceSet::FindOrCreateUserFontEntryFr
                                                    FontFace* aFontFace,
                                                    uint8_t aSheetType)
 {
   nsCSSValue val;
   nsCSSUnit unit;
 
   uint32_t weight = NS_STYLE_FONT_WEIGHT_NORMAL;
   int32_t stretch = NS_STYLE_FONT_STRETCH_NORMAL;
-  uint32_t italicStyle = NS_STYLE_FONT_STYLE_NORMAL;
+  uint8_t italicStyle = NS_STYLE_FONT_STYLE_NORMAL;
   uint32_t languageOverride = NO_FONT_LANGUAGE_OVERRIDE;
 
   // set up weight
   aFontFace->GetDesc(eCSSFontDesc_Weight, val);
   unit = val.GetUnit();
   if (unit == eCSSUnit_Integer || unit == eCSSUnit_Enumerated) {
     weight = val.GetIntValue();
     if (weight == 0) {
@@ -1767,21 +1767,21 @@ FontFaceSet::UserFontSet::DoRebuildUserF
   mFontFaceSet->RebuildUserFontSet();
 }
 
 /* virtual */ already_AddRefed<gfxUserFontEntry>
 FontFaceSet::UserFontSet::CreateUserFontEntry(
                                const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
                                uint32_t aWeight,
                                int32_t aStretch,
-                               uint32_t aItalicStyle,
+                               uint8_t aStyle,
                                const nsTArray<gfxFontFeature>& aFeatureSettings,
                                uint32_t aLanguageOverride,
                                gfxSparseBitSet* aUnicodeRanges)
 {
   RefPtr<gfxUserFontEntry> entry =
-    new FontFace::Entry(this, aFontFaceSrcList, aWeight, aStretch, aItalicStyle,
+    new FontFace::Entry(this, aFontFaceSrcList, aWeight, aStretch, aStyle,
                         aFeatureSettings, aLanguageOverride, aUnicodeRanges);
   return entry.forget();
 }
 
 #undef LOG_ENABLED
 #undef LOG
--- a/layout/style/FontFaceSet.h
+++ b/layout/style/FontFaceSet.h
@@ -78,17 +78,17 @@ public:
                                 const char* aMessage,
                                 uint32_t aFlags = nsIScriptError::errorFlag,
                                 nsresult aStatus = NS_OK) override;
     virtual void DoRebuildUserFontSet() override;
     virtual already_AddRefed<gfxUserFontEntry> CreateUserFontEntry(
                                    const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
                                    uint32_t aWeight,
                                    int32_t aStretch,
-                                   uint32_t aItalicStyle,
+                                   uint8_t aStyle,
                                    const nsTArray<gfxFontFeature>& aFeatureSettings,
                                    uint32_t aLanguageOverride,
                                    gfxSparseBitSet* aUnicodeRanges) override;
 
   private:
     RefPtr<FontFaceSet> mFontFaceSet;
   };
 
@@ -281,17 +281,17 @@ private:
   // Helper function for HasLoadingFontFaces.
   void UpdateHasLoadingFontFaces();
 
   void ParseFontShorthandForMatching(
               const nsAString& aFont,
               RefPtr<mozilla::css::FontFamilyListRefCnt>& aFamilyList,
               uint32_t& aWeight,
               int32_t& aStretch,
-              uint32_t& aItalicStyle,
+              uint8_t& aStyle,
               ErrorResult& aRv);
   void FindMatchingFontFaces(const nsAString& aFont,
                              const nsAString& aText,
                              nsTArray<FontFace*>& aFontFaces,
                              mozilla::ErrorResult& aRv);
 
   RefPtr<UserFontSet> mUserFontSet;
 
--- a/layout/style/ua.css
+++ b/layout/style/ua.css
@@ -509,17 +509,15 @@ div:-moz-native-anonymous.moz-selectionc
   margin: 0px;
   visibility: hidden;
 }
 
 /* Custom content container in the CanvasFrame, fixed positioned on top of
    everything else, not reacting to pointer events. */
 div:-moz-native-anonymous.moz-custom-content-container {
   pointer-events: none;
-
+  -moz-top-layer: top;
   position: fixed;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
-
-  z-index: 2147483648;
 }
--- a/mfbt/Attributes.h
+++ b/mfbt/Attributes.h
@@ -331,16 +331,45 @@
  *   MOZ_WARN_UNUSED_RESULT int foo() { return 42; }
  */
 #if defined(__GNUC__) || defined(__clang__)
 #  define MOZ_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))
 #else
 #  define MOZ_WARN_UNUSED_RESULT
 #endif
 
+/**
+ * MOZ_FALLTHROUGH is an annotation to suppress compiler warnings about switch
+ * cases that fall through without a break or return statement. MOZ_FALLTHROUGH
+ * is only needed on cases that have code:
+ *
+ * switch (foo) {
+ *   case 1: // These cases have no code. No fallthrough annotations are needed.
+ *   case 2:
+ *   case 3:
+ *     foo = 4; // This case has code, so a fallthrough annotation is needed:
+ *     MOZ_FALLTHROUGH;
+ *   default:
+ *     return foo;
+ * }
+ */
+#if defined(__clang__) && __cplusplus >= 201103L
+   /* clang's fallthrough annotations are only available starting in C++11. */
+#  define MOZ_FALLTHROUGH [[clang::fallthrough]]
+#elif defined(_MSC_VER)
+   /*
+    * MSVC's __fallthrough annotations are checked by /analyze (Code Analysis):
+    * https://msdn.microsoft.com/en-us/library/ms235402%28VS.80%29.aspx
+    */
+#  include <sal.h>
+#  define MOZ_FALLTHROUGH __fallthrough
+#else
+#  define MOZ_FALLTHROUGH /* FALLTHROUGH */
+#endif
+
 #ifdef __cplusplus
 
 /*
  * The following macros are attributes that support the static analysis plugin
  * included with Mozilla, and will be implemented (when such support is enabled)
  * as C++11 attributes. Since such attributes are legal pretty much everywhere
  * and have subtly different semantics depending on their placement, the
  * following is a guide on where to place the attributes.
--- a/testing/mozharness/scripts/desktop_l10n.py
+++ b/testing/mozharness/scripts/desktop_l10n.py
@@ -201,17 +201,16 @@ class DesktopSingleLocale(LocalesMixin, 
         self.buildid = None
         self.make_ident_output = None
         self.bootstrap_env = None
         self.upload_env = None
         self.revision = None
         self.version = None
         self.upload_urls = {}
         self.locales_property = {}
-        self.l10n_dir = None
         self.package_urls = {}
         self.pushdate = None
         # upload_files is a dictionary of files to upload, keyed by locale.
         self.upload_files = {}
 
         if 'mock_target' in self.config:
             self.enable_mock()
 
@@ -725,17 +724,16 @@ class DesktopSingleLocale(LocalesMixin, 
             os.path.abspath(os.path.join(cwd, f)) for f in files
         ]
         return SUCCESS
 
     def make_installers(self, locale):
         """wrapper for make installers-(locale)"""
         env = self.query_l10n_env()
         self._copy_mozconfig()
-        env['L10NBASEDIR'] = self.l10n_dir
         dirs = self.query_abs_dirs()
         cwd = os.path.join(dirs['abs_locales_dir'])
         target = ["installers-%s" % locale,
                   "LOCALE_MERGEDIR=%s" % env["LOCALE_MERGEDIR"], ]
         return self._make(target=target, cwd=cwd,
                           env=env, halt_on_failure=False)
 
     def repack_locale(self, locale):
--- a/widget/GfxInfoBase.cpp
+++ b/widget/GfxInfoBase.cpp
@@ -1005,17 +1005,17 @@ GfxInfoBase::EvaluateDownloadedBlacklist
           break;
 
         case nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION:
           if (!suggestedVersion.IsEmpty()) {
             SetPrefValueForDriverVersion(suggestedVersion);
           } else {
             RemovePrefForDriverVersion();
           }
-          // FALLTHROUGH
+          MOZ_FALLTHROUGH;
 
         case nsIGfxInfo::FEATURE_BLOCKED_MISMATCHED_VERSION:
         case nsIGfxInfo::FEATURE_BLOCKED_DEVICE:
         case nsIGfxInfo::FEATURE_DISCOURAGED:
         case nsIGfxInfo::FEATURE_BLOCKED_OS_VERSION:
           SetPrefValueForFeature(features[i], status);
           break;
       }