Diff
Modified: trunk/Source/WebCore/ChangeLog (105660 => 105661)
--- trunk/Source/WebCore/ChangeLog 2012-01-24 00:54:05 UTC (rev 105660)
+++ trunk/Source/WebCore/ChangeLog 2012-01-24 01:07:41 UTC (rev 105661)
@@ -1,3 +1,38 @@
+2012-01-23 David Levin <[email protected]>
+
+ [windows] Convert usages of GetDC to HWndDC Part 1.
+ https://bugs.webkit.org/show_bug.cgi?id=76744
+
+ Reviewed by Adam Roben.
+
+ No new functionality so no new tests.
+
+ * platform/graphics/win/FontCacheWin.cpp:
+ (WebCore::FontCache::getFontDataForCharacters): Changed GetDC to HWndDC
+ and removed ReleaseDC.
+ (WebCore::createGDIFont): Ditto.
+ (WebCore::FontCache::getTraitsInFamily): Ditto.
+ * platform/graphics/win/FontPlatformDataWin.cpp:
+ (WebCore::FontPlatformData::FontPlatformData): Ditto.
+ * platform/graphics/win/SimpleFontDataCGWin.cpp:
+ (WebCore::SimpleFontData::platformInit): Ditto.
+ * platform/graphics/win/SimpleFontDataWin.cpp:
+ (WebCore::SimpleFontData::initGDIFont): Ditto.
+ (WebCore::SimpleFontData::containsCharacters): Ditto.
+ (WebCore::SimpleFontData::determinePitch): Ditto.
+ (WebCore::SimpleFontData::boundsForGDIGlyph): Ditto.
+ (WebCore::SimpleFontData::widthForGDIGlyph): Ditto.
+ (WebCore::SimpleFontData::scriptFontProperties): Ditto.
+ * platform/win/CursorWin.cpp:
+ (WebCore::createSharedCursor): Ditto.
+ * platform/win/DragImageCGWin.cpp:
+ (WebCore::scaleDragImage): Ditto.
+ (WebCore::createDragImageFromImage): Ditto.
+ * platform/win/DragImageWin.cpp:
+ (WebCore::createDragImageForLink): Ditto.
+ * platform/win/PasteboardWin.cpp:
+ (WebCore::Pasteboard::writeImage): Ditto.
+
2012-01-23 Martin Robinson <[email protected]>
[GTK] Scrollbars do not respect the has-backward-stepper and has-forward-stepper properties
Modified: trunk/Source/WebCore/platform/graphics/win/FontCacheWin.cpp (105660 => 105661)
--- trunk/Source/WebCore/platform/graphics/win/FontCacheWin.cpp 2012-01-24 00:54:05 UTC (rev 105660)
+++ trunk/Source/WebCore/platform/graphics/win/FontCacheWin.cpp 2012-01-24 01:07:41 UTC (rev 105661)
@@ -30,6 +30,7 @@
#include <winsock2.h>
#include "FontCache.h"
#include "Font.h"
+#include "HWndDC.h"
#include "SimpleFontData.h"
#include "UnicodeRange.h"
#include <mlang.h>
@@ -189,7 +190,7 @@
{
UChar character = characters[0];
SimpleFontData* fontData = 0;
- HDC hdc = GetDC(0);
+ HWndDC hdc(0);
HFONT primaryFont = font.primaryFont()->fontDataForCharacter(character)->platformData().hfont();
HGDIOBJ oldFont = SelectObject(hdc, primaryFont);
HFONT hfont = 0;
@@ -292,7 +293,6 @@
DeleteObject(hfont);
}
- ReleaseDC(0, hdc);
return fontData;
}
@@ -447,7 +447,7 @@
static HFONT createGDIFont(const AtomicString& family, LONG desiredWeight, bool desiredItalic, int size, bool synthesizeItalic)
{
- HDC hdc = GetDC(0);
+ HWndDC hdc(0);
LOGFONT logFont;
logFont.lfCharSet = DEFAULT_CHARSET;
@@ -459,8 +459,6 @@
MatchImprovingProcData matchData(desiredWeight, desiredItalic);
EnumFontFamiliesEx(hdc, &logFont, matchImprovingEnumProc, reinterpret_cast<LPARAM>(&matchData), 0);
- ReleaseDC(0, hdc);
-
if (!matchData.m_hasMatched)
return 0;
@@ -486,13 +484,12 @@
if (!result)
return 0;
- HDC dc = GetDC(0);
+ HWndDC dc(0);
SaveDC(dc);
SelectObject(dc, result);
WCHAR actualName[LF_FACESIZE];
GetTextFace(dc, LF_FACESIZE, actualName);
RestoreDC(dc, -1);
- ReleaseDC(0, dc);
if (wcsicmp(matchData.m_chosen.lfFaceName, actualName)) {
DeleteObject(result);
@@ -534,7 +531,7 @@
}
void FontCache::getTraitsInFamily(const AtomicString& familyName, Vector<unsigned>& traitsMasks)
{
- HDC hdc = GetDC(0);
+ HWndDC hdc(0);
LOGFONT logFont;
logFont.lfCharSet = DEFAULT_CHARSET;
@@ -546,8 +543,6 @@
TraitsInFamilyProcData procData(familyName);
EnumFontFamiliesEx(hdc, &logFont, traitsInFamilyEnumProc, reinterpret_cast<LPARAM>(&procData), 0);
copyToVector(procData.m_traitsMasks, traitsMasks);
-
- ReleaseDC(0, hdc);
}
FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontDescription, const AtomicString& family)
Modified: trunk/Source/WebCore/platform/graphics/win/FontPlatformDataWin.cpp (105660 => 105661)
--- trunk/Source/WebCore/platform/graphics/win/FontPlatformDataWin.cpp 2012-01-24 00:54:05 UTC (rev 105660)
+++ trunk/Source/WebCore/platform/graphics/win/FontPlatformDataWin.cpp 2012-01-24 01:07:41 UTC (rev 105661)
@@ -25,6 +25,7 @@
#include "config.h"
#include "FontPlatformData.h"
+#include "HWndDC.h"
#include "PlatformString.h"
#include <wtf/HashMap.h>
#include <wtf/RetainPtr.h>
@@ -51,7 +52,7 @@
, m_syntheticOblique(oblique)
, m_useGDI(useGDI)
{
- HDC hdc = GetDC(0);
+ HWndDC hdc(0);
SaveDC(hdc);
SelectObject(hdc, font);
@@ -71,7 +72,6 @@
}
RestoreDC(hdc, -1);
- ReleaseDC(0, hdc);
}
#ifndef NDEBUG
Modified: trunk/Source/WebCore/platform/graphics/win/SimpleFontDataCGWin.cpp (105660 => 105661)
--- trunk/Source/WebCore/platform/graphics/win/SimpleFontDataCGWin.cpp 2012-01-24 00:54:05 UTC (rev 105660)
+++ trunk/Source/WebCore/platform/graphics/win/SimpleFontDataCGWin.cpp 2012-01-24 01:07:41 UTC (rev 105661)
@@ -33,6 +33,7 @@
#include "FontCache.h"
#include "FloatRect.h"
#include "FontDescription.h"
+#include "HWndDC.h"
#include "PlatformString.h"
#include <ApplicationServices/ApplicationServices.h>
#include <WebKitSystemInterface/WebKitSystemInterface.h>
@@ -55,7 +56,7 @@
m_isSystemFont = false;
if (m_platformData.useGDI())
- return initGDIFont();
+ return initGDIFont();
CGFontRef font = m_platformData.cgFont();
int iAscent = CGFontGetAscent(font);
@@ -68,14 +69,13 @@
float fLineGap = scaleEmToUnits(iLineGap, unitsPerEm) * pointSize;
if (!isCustomFont()) {
- HDC dc = GetDC(0);
+ HWndDC dc(0);
HGDIOBJ oldFont = SelectObject(dc, m_platformData.hfont());
int faceLength = GetTextFace(dc, 0, 0);
Vector<WCHAR> faceName(faceLength);
GetTextFace(dc, faceLength, faceName.data());
m_isSystemFont = !wcscmp(faceName.data(), L"Lucida Grande");
SelectObject(dc, oldFont);
- ReleaseDC(0, dc);
fAscent = ascentConsideringMacAscentHack(faceName.data(), fAscent, fDescent);
}
Modified: trunk/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp (105660 => 105661)
--- trunk/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp 2012-01-24 00:54:05 UTC (rev 105660)
+++ trunk/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp 2012-01-24 01:07:41 UTC (rev 105661)
@@ -33,6 +33,7 @@
#include "FontCache.h"
#include "FloatRect.h"
#include "FontDescription.h"
+#include "HWndDC.h"
#include <mlang.h>
#include <unicode/uchar.h>
#include <unicode/unorm.h>
@@ -89,7 +90,7 @@
return;
}
- HDC hdc = GetDC(0);
+ HWndDC hdc(0);
HGDIOBJ oldFont = SelectObject(hdc, m_platformData.hfont());
OUTLINETEXTMETRIC metrics;
GetOutlineTextMetrics(hdc, sizeof(metrics), &metrics);
@@ -115,9 +116,6 @@
m_fontMetrics.setUnitsPerEm(metrics.otmEMSquare);
SelectObject(hdc, oldFont);
- ReleaseDC(0, hdc);
-
- return;
}
void SimpleFontData::platformCharWidthInit()
@@ -185,8 +183,8 @@
if (!langFontLink)
return false;
- HDC dc = GetDC(0);
-
+ HWndDC dc(0);
+
DWORD acpCodePages;
langFontLink->CodePageToCodePages(CP_ACP, &acpCodePages);
@@ -203,8 +201,6 @@
offset += numCharactersProcessed;
}
- ReleaseDC(0, dc);
-
return true;
}
@@ -216,7 +212,7 @@
}
// TEXTMETRICS have this. Set m_treatAsFixedPitch based off that.
- HDC dc = GetDC(0);
+ HWndDC dc(0);
SaveDC(dc);
SelectObject(dc, m_platformData.hfont());
@@ -227,12 +223,11 @@
m_treatAsFixedPitch = ((tm.tmPitchAndFamily & TMPF_FIXED_PITCH) == 0);
RestoreDC(dc, -1);
- ReleaseDC(0, dc);
}
FloatRect SimpleFontData::boundsForGDIGlyph(Glyph glyph) const
{
- HDC hdc = GetDC(0);
+ HWndDC hdc(0);
SetGraphicsMode(hdc, GM_ADVANCED);
HGDIOBJ oldFont = SelectObject(hdc, m_platformData.hfont());
@@ -241,7 +236,6 @@
GetGlyphOutline(hdc, glyph, GGO_METRICS | GGO_GLYPH_INDEX, &gdiMetrics, 0, 0, &identity);
SelectObject(hdc, oldFont);
- ReleaseDC(0, hdc);
return FloatRect(gdiMetrics.gmptGlyphOrigin.x, -gdiMetrics.gmptGlyphOrigin.y,
gdiMetrics.gmBlackBoxX + m_syntheticBoldOffset, gdiMetrics.gmBlackBoxY);
@@ -249,7 +243,7 @@
float SimpleFontData::widthForGDIGlyph(Glyph glyph) const
{
- HDC hdc = GetDC(0);
+ HWndDC hdc(0);
SetGraphicsMode(hdc, GM_ADVANCED);
HGDIOBJ oldFont = SelectObject(hdc, m_platformData.hfont());
@@ -258,7 +252,6 @@
GetGlyphOutline(hdc, glyph, GGO_METRICS | GGO_GLYPH_INDEX, &gdiMetrics, 0, 0, &identity);
SelectObject(hdc, oldFont);
- ReleaseDC(0, hdc);
return gdiMetrics.gmCellIncX + m_syntheticBoldOffset;
}
@@ -271,12 +264,11 @@
m_scriptFontProperties->cBytes = sizeof(SCRIPT_FONTPROPERTIES);
HRESULT result = ScriptGetFontProperties(0, scriptCache(), m_scriptFontProperties);
if (result == E_PENDING) {
- HDC dc = GetDC(0);
+ HWndDC dc(0);
SaveDC(dc);
SelectObject(dc, m_platformData.hfont());
ScriptGetFontProperties(dc, scriptCache(), m_scriptFontProperties);
RestoreDC(dc, -1);
- ReleaseDC(0, dc);
}
}
return m_scriptFontProperties;
Modified: trunk/Source/WebCore/platform/win/CursorWin.cpp (105660 => 105661)
--- trunk/Source/WebCore/platform/win/CursorWin.cpp 2012-01-24 00:54:05 UTC (rev 105660)
+++ trunk/Source/WebCore/platform/win/CursorWin.cpp 2012-01-24 01:07:41 UTC (rev 105661)
@@ -28,6 +28,7 @@
#include "Cursor.h"
#include "BitmapInfo.h"
+#include "HWndDC.h"
#include "Image.h"
#include "IntPoint.h"
#include "SystemInfo.h"
@@ -49,7 +50,7 @@
static bool doAlpha = windowsVersion() >= WindowsXP;
BitmapInfo cursorImage = BitmapInfo::create(IntSize(img->width(), img->height()));
- HDC dc = GetDC(0);
+ HWndDC dc(0);
HDC workingDC = CreateCompatibleDC(dc);
if (doAlpha) {
OwnPtr<HBITMAP> hCursor = adoptPtr(CreateDIBSection(dc, (BITMAPINFO *)&cursorImage, DIB_RGB_COLORS, 0, 0, 0));
@@ -112,7 +113,6 @@
DeleteDC(andMaskDC);
}
DeleteDC(workingDC);
- ReleaseDC(0, dc);
return impl.release();
}
Modified: trunk/Source/WebCore/platform/win/DragImageCGWin.cpp (105660 => 105661)
--- trunk/Source/WebCore/platform/win/DragImageCGWin.cpp 2012-01-24 00:54:05 UTC (rev 105660)
+++ trunk/Source/WebCore/platform/win/DragImageCGWin.cpp 2012-01-24 01:07:41 UTC (rev 105661)
@@ -29,6 +29,7 @@
#include "BitmapInfo.h"
#include "CachedImage.h"
#include "GraphicsContextCG.h"
+#include "HWndDC.h"
#include "Image.h"
#include "RetainPtr.h"
@@ -89,7 +90,7 @@
IntSize srcSize = dragImageSize(image);
IntSize dstSize(static_cast<int>(srcSize.width() * scale.width()), static_cast<int>(srcSize.height() * scale.height()));
HBITMAP hbmp = 0;
- HDC dc = GetDC(0);
+ HWndDC dc(0);
HDC dstDC = CreateCompatibleDC(dc);
if (!dstDC)
goto exit;
@@ -116,14 +117,13 @@
hbmp = image;
if (dstDC)
DeleteDC(dstDC);
- ReleaseDC(0, dc);
return hbmp;
}
DragImageRef createDragImageFromImage(Image* img)
{
HBITMAP hbmp = 0;
- HDC dc = GetDC(0);
+ HWndDC dc(0);
HDC workingDC = CreateCompatibleDC(dc);
CGContextRef drawContext = 0;
if (!workingDC)
@@ -155,7 +155,6 @@
exit:
if (workingDC)
DeleteDC(workingDC);
- ReleaseDC(0, dc);
return hbmp;
}
Modified: trunk/Source/WebCore/platform/win/DragImageWin.cpp (105660 => 105661)
--- trunk/Source/WebCore/platform/win/DragImageWin.cpp 2012-01-24 00:54:05 UTC (rev 105660)
+++ trunk/Source/WebCore/platform/win/DragImageWin.cpp 2012-01-24 01:07:41 UTC (rev 105661)
@@ -33,6 +33,7 @@
#include "FontSelector.h"
#include "Frame.h"
#include "GraphicsContext.h"
+#include "HWndDC.h"
#include "Image.h"
#include "RetainPtr.h"
#include "Settings.h"
@@ -183,18 +184,15 @@
// We now know how big the image needs to be, so we create and
// fill the background
HBITMAP image = 0;
- HDC dc = GetDC(0);
+ HWndDC dc(0);
HDC workingDC = CreateCompatibleDC(dc);
- if (!workingDC) {
- ReleaseDC(0, dc);
+ if (!workingDC)
return 0;
- }
PlatformGraphicsContext* contextRef;
image = allocImage(workingDC, imageSize, &contextRef);
if (!image) {
DeleteDC(workingDC);
- ReleaseDC(0, dc);
return 0;
}
@@ -225,7 +223,6 @@
deallocContext(contextRef);
DeleteDC(workingDC);
- ReleaseDC(0, dc);
return image;
}
Modified: trunk/Source/WebCore/platform/win/PasteboardWin.cpp (105660 => 105661)
--- trunk/Source/WebCore/platform/win/PasteboardWin.cpp 2012-01-24 00:54:05 UTC (rev 105660)
+++ trunk/Source/WebCore/platform/win/PasteboardWin.cpp 2012-01-24 01:07:41 UTC (rev 105661)
@@ -32,6 +32,7 @@
#include "DocumentFragment.h"
#include "Element.h"
#include "Frame.h"
+#include "HWndDC.h"
#include "HitTestResult.h"
#include "Image.h"
#include "KURL.h"
@@ -223,7 +224,7 @@
clear();
- HDC dc = GetDC(0);
+ HWndDC dc(0);
HDC compatibleDC = CreateCompatibleDC(0);
HDC sourceDC = CreateCompatibleDC(0);
OwnPtr<HBITMAP> resultBitmap = adoptPtr(CreateCompatibleBitmap(dc, image->width(), image->height()));
@@ -243,7 +244,6 @@
SelectObject(compatibleDC, oldBitmap);
DeleteDC(sourceDC);
DeleteDC(compatibleDC);
- ReleaseDC(0, dc);
if (::OpenClipboard(m_owner)) {
::SetClipboardData(CF_BITMAP, resultBitmap.leakPtr());
Modified: trunk/Source/WebKit/win/ChangeLog (105660 => 105661)
--- trunk/Source/WebKit/win/ChangeLog 2012-01-24 00:54:05 UTC (rev 105660)
+++ trunk/Source/WebKit/win/ChangeLog 2012-01-24 01:07:41 UTC (rev 105661)
@@ -1,3 +1,13 @@
+2012-01-23 David Levin <[email protected]>
+
+ [windows] Convert usages of GetDC to HWndDC Part 1.
+ https://bugs.webkit.org/show_bug.cgi?id=76744
+
+ Reviewed by Adam Roben.
+
+ * WebIconDatabase.cpp:
+ (createDIB): Changed GetDC to HWndDC and removed ReleaseDC.
+
2012-01-07 Andreas Kling <[email protected]>
Windows build fix.
Modified: trunk/Source/WebKit/win/WebIconDatabase.cpp (105660 => 105661)
--- trunk/Source/WebKit/win/WebIconDatabase.cpp 2012-01-24 00:54:05 UTC (rev 105660)
+++ trunk/Source/WebKit/win/WebIconDatabase.cpp 2012-01-24 01:07:41 UTC (rev 105661)
@@ -34,6 +34,7 @@
#include <WebCore/BString.h>
#include <WebCore/COMPtr.h>
#include <WebCore/FileSystem.h>
+#include <WebCore/HWndDC.h>
#include <WebCore/IconDatabase.h>
#include <WebCore/Image.h>
#include <WebCore/PlatformString.h>
@@ -284,11 +285,8 @@
{
BitmapInfo bmInfo = BitmapInfo::create(IntSize(*size));
- HDC dc = GetDC(0);
- HBITMAP result = CreateDIBSection(dc, &bmInfo, DIB_RGB_COLORS, 0, 0, 0);
- ReleaseDC(0, dc);
-
- return result;
+ HWndDC dc(0);
+ return CreateDIBSection(dc, &bmInfo, DIB_RGB_COLORS, 0, 0, 0);
}
HBITMAP WebIconDatabase::getOrCreateSharedBitmap(LPSIZE size)
Modified: trunk/Source/WebKit2/ChangeLog (105660 => 105661)
--- trunk/Source/WebKit2/ChangeLog 2012-01-24 00:54:05 UTC (rev 105660)
+++ trunk/Source/WebKit2/ChangeLog 2012-01-24 01:07:41 UTC (rev 105661)
@@ -1,3 +1,13 @@
+2012-01-23 David Levin <[email protected]>
+
+ [windows] Convert usages of GetDC to HWndDC Part 1.
+ https://bugs.webkit.org/show_bug.cgi?id=76744
+
+ Reviewed by Adam Roben.
+
+ * UIProcess/win/WebView.cpp:
+ (WebKit::WebView::flashBackingStoreUpdates): Typical conversion.
+
2012-01-21 Timothy Hatcher <[email protected]>
Make WebKit2 remember the height of the Web Inspector when it is docked.
Modified: trunk/Source/WebKit2/UIProcess/win/WebView.cpp (105660 => 105661)
--- trunk/Source/WebKit2/UIProcess/win/WebView.cpp 2012-01-24 00:54:05 UTC (rev 105660)
+++ trunk/Source/WebKit2/UIProcess/win/WebView.cpp 2012-01-24 01:07:41 UTC (rev 105661)
@@ -46,6 +46,7 @@
#include <WebCore/Editor.h>
#include <WebCore/FileSystem.h>
#include <WebCore/FloatRect.h>
+#include <WebCore/HWndDC.h>
#include <WebCore/IntRect.h>
#include <WebCore/NotImplemented.h>
#include <WebCore/Region.h>
@@ -959,9 +960,8 @@
void WebView::flashBackingStoreUpdates(const Vector<IntRect>& updateRects)
{
static HBRUSH brush = createBrush(WebPageProxy::backingStoreUpdatesFlashColor().rgb()).leakPtr();
- HDC dc = ::GetDC(m_window);
+ HWndDC dc(m_window);
flashRects(dc, updateRects.data(), updateRects.size(), brush);
- ::ReleaseDC(m_window, dc);
}
WebCore::IntSize WebView::viewSize()