No bug - Replace tabs with spaces, strip EOL whitespace.
authorJeff Gilbert <jgilbert@mozilla.com>
Fri, 12 Oct 2018 15:16:45 -0700
changeset 489361 64298e3625ed2a90ec6b64bfba0fb630ab607d2b
parent 489360 2aede0d5656f05304e2a584cabd0ce9c0337723f
child 489362 0c5f5c2e2a860f9f681e301662aabe2deca8be4b
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
milestone64.0a1
No bug - Replace tabs with spaces, strip EOL whitespace.
dom/plugins/test/testplugin/nptest_windows.cpp
gfx/thebes/gfxGDIFontList.cpp
--- a/dom/plugins/test/testplugin/nptest_windows.cpp
+++ b/dom/plugins/test/testplugin/nptest_windows.cpp
@@ -393,63 +393,63 @@ drawToDC(InstanceData* instanceData, HDC
       ::SetBkMode(dc, oldBkMode);
     }
     break;
 
     case DM_SOLID_COLOR:
     {
       HDC offscreenDC = ::CreateCompatibleDC(dc);
       if (!offscreenDC)
-	return;
+        return;
 
       const BITMAPV4HEADER bitmapheader = {
-	sizeof(BITMAPV4HEADER),
-	width,
-	height,
-	1, // planes
-	32, // bits
-	BI_BITFIELDS,
-	0, // unused size
-	0, 0, // unused metrics
-	0, 0, // unused colors used/important
-	0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000, // ARGB masks
+        sizeof(BITMAPV4HEADER),
+        width,
+        height,
+        1, // planes
+        32, // bits
+        BI_BITFIELDS,
+        0, // unused size
+        0, 0, // unused metrics
+        0, 0, // unused colors used/important
+        0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000, // ARGB masks
       };
       uint32_t *pixelData;
       HBITMAP offscreenBitmap =
-	::CreateDIBSection(dc, reinterpret_cast<const BITMAPINFO*>(&bitmapheader),
-			   0, reinterpret_cast<void**>(&pixelData), 0, 0);
+        ::CreateDIBSection(dc, reinterpret_cast<const BITMAPINFO*>(&bitmapheader),
+                           0, reinterpret_cast<void**>(&pixelData), 0, 0);
       if (!offscreenBitmap)
-	return;
+        return;
 
       uint32_t rgba = instanceData->scriptableObject->drawColor;
       unsigned int alpha = ((rgba & 0xFF000000) >> 24);
       BYTE r = ((rgba & 0xFF0000) >> 16);
       BYTE g = ((rgba & 0xFF00) >> 8);
       BYTE b = (rgba & 0xFF);
 
       // Windows expects premultiplied
       r = BYTE(float(alpha * r) / 0xFF);
       g = BYTE(float(alpha * g) / 0xFF);
       b = BYTE(float(alpha * b) / 0xFF);
       uint32_t premultiplied =
-	(alpha << 24) +	(r << 16) + (g << 8) + b;
+        (alpha << 24) + (r << 16) + (g << 8) + b;
 
       for (uint32_t* lastPixel = pixelData + width * height;
-	   pixelData < lastPixel;
-	   ++pixelData)
-	*pixelData = premultiplied;
+           pixelData < lastPixel;
+           ++pixelData)
+        *pixelData = premultiplied;
 
       ::SelectObject(offscreenDC, offscreenBitmap);
       BLENDFUNCTION blendFunc;
       blendFunc.BlendOp = AC_SRC_OVER;
       blendFunc.BlendFlags = 0;
       blendFunc.SourceConstantAlpha = 255;
       blendFunc.AlphaFormat = AC_SRC_ALPHA;
       ::AlphaBlend(dc, x, y, width, height, offscreenDC, 0, 0, width, height,
-		   blendFunc);
+                   blendFunc);
 
       ::DeleteObject(offscreenDC);
       ::DeleteObject(offscreenBitmap);
     }
     break;
   }
 }
 
@@ -795,17 +795,17 @@ pluginHandleEvent(InstanceData* instance
   LRESULT result = 0;
   return handleEventInternal(instanceData, pe, &result);
 }
 
 /* windowed plugin events */
 
 LRESULT CALLBACK PluginWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
-	WNDPROC wndProc = (WNDPROC)GetProp(hWnd, "MozillaWndProc");
+        WNDPROC wndProc = (WNDPROC)GetProp(hWnd, "MozillaWndProc");
   if (!wndProc)
     return 0;
   InstanceData* pInstance = (InstanceData*)GetProp(hWnd, "InstanceData");
   if (!pInstance)
     return 0;
 
   NPEvent event = { static_cast<uint16_t>(uMsg), wParam, lParam };
 
--- a/gfx/thebes/gfxGDIFontList.cpp
+++ b/gfx/thebes/gfxGDIFontList.cpp
@@ -75,17 +75,17 @@ public:
             NS_ASSERTION(success, buf);
         }
 #endif
     }
 
     HANDLE mFontRef;
 };
 
-BYTE 
+BYTE
 FontTypeToOutPrecision(uint8_t fontType)
 {
     BYTE ret;
     switch (fontType) {
     case GFX_FONT_TYPE_TT_OPENTYPE:
     case GFX_FONT_TYPE_TRUETYPE:
         ret = OUT_TT_ONLY_PRECIS;
         break;
@@ -149,19 +149,19 @@ GDIFontEntry::ReadCMAP(FontInfoData *aFo
     AUTO_PROFILER_LABEL("GDIFontEntry::ReadCMAP", OTHER);
 
     // attempt this once, if errors occur leave a blank cmap
     if (mCharacterMap) {
         return NS_OK;
     }
 
     // skip non-SFNT fonts completely
-    if (mFontType != GFX_FONT_TYPE_PS_OPENTYPE && 
+    if (mFontType != GFX_FONT_TYPE_PS_OPENTYPE &&
         mFontType != GFX_FONT_TYPE_TT_OPENTYPE &&
-        mFontType != GFX_FONT_TYPE_TRUETYPE) 
+        mFontType != GFX_FONT_TYPE_TRUETYPE)
     {
         mCharacterMap = new gfxCharacterMap();
         mCharacterMap->mBuildOnTheFly = true;
         return NS_ERROR_FAILURE;
     }
 
     RefPtr<gfxCharacterMap> charmap;
     nsresult rv;
@@ -283,17 +283,17 @@ GDIFontEntry::FillLogFont(LOGFONTW *aLog
     if (mIsDataUserFont) {
         aLogFont->lfItalic = 0;
     }
 }
 
 #define MISSING_GLYPH 0x1F // glyph index returned for missing characters
                            // on WinXP with .fon fonts, but not Type1 (.pfb)
 
-bool 
+bool
 GDIFontEntry::TestCharacterMap(uint32_t aCh)
 {
     if (!mCharacterMap) {
         ReadCMAP();
         NS_ASSERTION(mCharacterMap, "failed to initialize a character map");
     }
 
     if (mCharacterMap->mBuildOnTheFly) {
@@ -317,32 +317,32 @@ GDIFontEntry::TestCharacterMap(uint32_t 
         HFONT hfont = font->GetHFONT();
         HFONT oldFont = (HFONT)SelectObject(dc, hfont);
 
         wchar_t str[1] = { (wchar_t)aCh };
         WORD glyph[1];
 
         bool hasGlyph = false;
 
-        // Bug 573038 - in some cases GetGlyphIndicesW returns 0xFFFF for a 
-        // missing glyph or 0x1F in other cases to indicate the "invalid" 
+        // Bug 573038 - in some cases GetGlyphIndicesW returns 0xFFFF for a
+        // missing glyph or 0x1F in other cases to indicate the "invalid"
         // glyph.  Map both cases to "not found"
         if (IsType1() || mForceGDI) {
-            // Type1 fonts and uniscribe APIs don't get along.  
+            // Type1 fonts and uniscribe APIs don't get along.
             // ScriptGetCMap will return E_HANDLE
-            DWORD ret = GetGlyphIndicesW(dc, str, 1, 
+            DWORD ret = GetGlyphIndicesW(dc, str, 1,
                                          glyph, GGI_MARK_NONEXISTING_GLYPHS);
             if (ret != GDI_ERROR
                 && glyph[0] != 0xFFFF
                 && (IsType1() || glyph[0] != MISSING_GLYPH))
             {
                 hasGlyph = true;
             }
         } else {
-            // ScriptGetCMap works better than GetGlyphIndicesW 
+            // ScriptGetCMap works better than GetGlyphIndicesW
             // for things like bitmap/vector fonts
             SCRIPT_CACHE sc = nullptr;
             HRESULT rv = ScriptGetCMap(dc, &sc, str, 1, 0, glyph);
             if (rv == S_OK)
                 hasGlyph = true;
         }
 
         SelectObject(dc, oldFont);
@@ -387,17 +387,17 @@ GDIFontEntry::InitLogFont(const nsACStri
     mLogFont.lfWeight         = Weight().Min().ToIntRounded();
 
     NS_ConvertUTF8toUTF16 name(aName);
     int len = std::min<int>(name.Length(), LF_FACESIZE - 1);
     memcpy(&mLogFont.lfFaceName, name.BeginReading(), len * sizeof(char16_t));
     mLogFont.lfFaceName[len] = '\0';
 }
 
-GDIFontEntry* 
+GDIFontEntry*
 GDIFontEntry::CreateFontEntry(const nsACString& aName,
                               gfxWindowsFontType aFontType,
                               SlantStyleRange aStyle,
                               WeightRange aWeight,
                               StretchRange aStretch,
                               gfxUserFontData* aUserFontData)
 {
     // jtdfix - need to set charset, unicode ranges, pitch/family
@@ -469,17 +469,17 @@ GDIFontFamily::FamilyAddStylesProc(const
         fe = static_cast<GDIFontEntry*>(ff->mAvailableFonts[i].get());
         // check if we already know about this face
         if (fe->Weight().Min() == FontWeight(int32_t(logFont.lfWeight)) &&
             fe->IsItalic() == (logFont.lfItalic == 0xFF)) {
             // update the charset bit here since this could be different
             // XXX Can we still do this now that we store mCharset
             // on the font family rather than the font entry?
             ff->mCharset.set(metrics.tmCharSet);
-            return 1; 
+            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.
     auto italicStyle = (logFont.lfItalic == 0xFF ?
                            FontSlantStyle::Italic() : FontSlantStyle::Normal());
@@ -580,17 +580,17 @@ RemoveCharsetFromFontSubstitute(nsAStrin
 nsresult
 gfxGDIFontList::GetFontSubstitutes()
 {
     HKEY hKey;
     DWORD i, rv, lenAlias, lenActual, valueType;
     WCHAR aliasName[MAX_VALUE_NAME];
     WCHAR actualName[MAX_VALUE_DATA];
 
-    if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, 
+    if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
           L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\FontSubstitutes",
           0, KEY_READ, &hKey) != ERROR_SUCCESS)
     {
         return NS_ERROR_FAILURE;
     }
 
     for (i = 0, rv = ERROR_SUCCESS; rv != ERROR_NO_MORE_ITEMS; i++) {
         aliasName[0] = 0;
@@ -612,17 +612,17 @@ gfxGDIFontList::GetFontSubstitutes()
         nsAutoString actualFontName((char16_t*) actualName);
         RemoveCharsetFromFontSubstitute(substituteName);
         BuildKeyNameFromFontName(substituteName);
         RemoveCharsetFromFontSubstitute(actualFontName);
         BuildKeyNameFromFontName(actualFontName);
         gfxFontFamily *ff;
         NS_ConvertUTF16toUTF8 substitute(substituteName);
         NS_ConvertUTF16toUTF8 actual(actualFontName);
-        if (!actual.IsEmpty() && 
+        if (!actual.IsEmpty() &&
             (ff = mFontFamilies.GetWeak(actual))) {
             mFontSubstitutes.Put(substitute, ff);
         } else {
             mNonExistingFonts.AppendElement(substitute);
         }
     }
 
     // "Courier" on a default Windows install is an ugly bitmap font.
@@ -712,37 +712,37 @@ gfxGDIFontList::EnumFontFamExProc(ENUMLO
 
         // mark the charset bit
         family->mCharset.set(metrics.tmCharSet);
     }
 
     return 1;
 }
 
-gfxFontEntry* 
+gfxFontEntry*
 gfxGDIFontList::LookupLocalFont(const nsACString& aFontName,
                                 WeightRange aWeightForEntry,
                                 StretchRange aStretchForEntry,
                                 SlantStyleRange aStyleForEntry)
 {
     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*/, 
+    GDIFontEntry *fe = GDIFontEntry::CreateFontEntry(lookup->Name(),
+        gfxWindowsFontType(isCFF ? GFX_FONT_TYPE_PS_OPENTYPE : GFX_FONT_TYPE_TRUETYPE) /*type*/,
         lookup->SlantStyle(), lookup->Weight(), aStretchForEntry, nullptr);
 
     if (!fe)
         return nullptr;
 
     fe->mIsLocalUserFont = true;
 
     // make the new font entry match the userfont entry style characteristics
@@ -840,27 +840,27 @@ gfxGDIFontList::MakePlatformFont(const n
         return nullptr;
 
     FallibleTArray<uint8_t> newFontData;
 
     rv = gfxFontUtils::RenameFont(uniqueName, aFontData, aLength, &newFontData);
 
     if (NS_FAILED(rv))
         return nullptr;
-        
+
     DWORD numFonts = 0;
 
     uint8_t *fontData = reinterpret_cast<uint8_t*> (newFontData.Elements());
     uint32_t fontLength = newFontData.Length();
     NS_ASSERTION(fontData, "null font data after renaming");
 
     // http://msdn.microsoft.com/en-us/library/ms533942(VS.85).aspx
-    // "A font that is added by AddFontMemResourceEx is always private 
+    // "A font that is added by AddFontMemResourceEx is always private
     //  to the process that made the call and is not enumerable."
-    fontRef = AddFontMemResourceEx(fontData, fontLength, 
+    fontRef = AddFontMemResourceEx(fontData, fontLength,
                                     0 /* reserved */, &numFonts);
     if (!fontRef) {
         if (FixupSymbolEncodedFont(fontData, fontLength)) {
             fontRef = AddFontMemResourceEx(fontData, fontLength, 0, &numFonts);
         }
     }
     if (!fontRef) {
         return nullptr;
@@ -919,17 +919,17 @@ gfxGDIFontList::FindAndAddFamilies(const
 gfxFontFamily*
 gfxGDIFontList::GetDefaultFontForPlatform(const gfxFontStyle* aStyle)
 {
     gfxFontFamily *ff = nullptr;
 
     // this really shouldn't fail to find a font....
     NONCLIENTMETRICSW ncm;
     ncm.cbSize = sizeof(ncm);
-    BOOL status = ::SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, 
+    BOOL status = ::SystemParametersInfoW(SPI_GETNONCLIENTMETRICS,
                                           sizeof(ncm), &ncm, 0);
     if (status) {
         ff = FindFamily(NS_ConvertUTF16toUTF8(ncm.lfMessageFont.lfFaceName));
         if (ff) {
             return ff;
         }
     }