https://bugs.webkit.org/show_bug.cgi?id=76744
Reviewed by Adam Roben.
Source/WebCore:
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.
Source/WebKit/win:
* WebIconDatabase.cpp:
(createDIB): Changed GetDC to HWndDC and removed ReleaseDC.
Source/WebKit2:
* UIProcess/win/WebView.cpp:
(WebKit::WebView::flashBackingStoreUpdates): Typical conversion.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105661
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-01-23 David Levin <levin@chromium.org>
+
+ [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 <mrobinson@igalia.com>
[GTK] Scrollbars do not respect the has-backward-stepper and has-forward-stepper properties
#include <winsock2.h>
#include "FontCache.h"
#include "Font.h"
+#include "HWndDC.h"
#include "SimpleFontData.h"
#include "UnicodeRange.h"
#include <mlang.h>
{
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;
DeleteObject(hfont);
}
- ReleaseDC(0, hdc);
return fontData;
}
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;
MatchImprovingProcData matchData(desiredWeight, desiredItalic);
EnumFontFamiliesEx(hdc, &logFont, matchImprovingEnumProc, reinterpret_cast<LPARAM>(&matchData), 0);
- ReleaseDC(0, hdc);
-
if (!matchData.m_hasMatched)
return 0;
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);
}
void FontCache::getTraitsInFamily(const AtomicString& familyName, Vector<unsigned>& traitsMasks)
{
- HDC hdc = GetDC(0);
+ HWndDC hdc(0);
LOGFONT logFont;
logFont.lfCharSet = DEFAULT_CHARSET;
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)
#include "config.h"
#include "FontPlatformData.h"
+#include "HWndDC.h"
#include "PlatformString.h"
#include <wtf/HashMap.h>
#include <wtf/RetainPtr.h>
, m_syntheticOblique(oblique)
, m_useGDI(useGDI)
{
- HDC hdc = GetDC(0);
+ HWndDC hdc(0);
SaveDC(hdc);
SelectObject(hdc, font);
}
RestoreDC(hdc, -1);
- ReleaseDC(0, hdc);
}
#ifndef NDEBUG
#include "FontCache.h"
#include "FloatRect.h"
#include "FontDescription.h"
+#include "HWndDC.h"
#include "PlatformString.h"
#include <ApplicationServices/ApplicationServices.h>
#include <WebKitSystemInterface/WebKitSystemInterface.h>
m_isSystemFont = false;
if (m_platformData.useGDI())
- return initGDIFont();
+ return initGDIFont();
CGFontRef font = m_platformData.cgFont();
int iAscent = CGFontGetAscent(font);
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);
}
#include "FontCache.h"
#include "FloatRect.h"
#include "FontDescription.h"
+#include "HWndDC.h"
#include <mlang.h>
#include <unicode/uchar.h>
#include <unicode/unorm.h>
return;
}
- HDC hdc = GetDC(0);
+ HWndDC hdc(0);
HGDIOBJ oldFont = SelectObject(hdc, m_platformData.hfont());
OUTLINETEXTMETRIC metrics;
GetOutlineTextMetrics(hdc, sizeof(metrics), &metrics);
m_fontMetrics.setUnitsPerEm(metrics.otmEMSquare);
SelectObject(hdc, oldFont);
- ReleaseDC(0, hdc);
-
- return;
}
void SimpleFontData::platformCharWidthInit()
if (!langFontLink)
return false;
- HDC dc = GetDC(0);
-
+ HWndDC dc(0);
+
DWORD acpCodePages;
langFontLink->CodePageToCodePages(CP_ACP, &acpCodePages);
offset += numCharactersProcessed;
}
- ReleaseDC(0, dc);
-
return true;
}
}
// TEXTMETRICS have this. Set m_treatAsFixedPitch based off that.
- HDC dc = GetDC(0);
+ HWndDC dc(0);
SaveDC(dc);
SelectObject(dc, m_platformData.hfont());
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());
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);
float SimpleFontData::widthForGDIGlyph(Glyph glyph) const
{
- HDC hdc = GetDC(0);
+ HWndDC hdc(0);
SetGraphicsMode(hdc, GM_ADVANCED);
HGDIOBJ oldFont = SelectObject(hdc, m_platformData.hfont());
GetGlyphOutline(hdc, glyph, GGO_METRICS | GGO_GLYPH_INDEX, &gdiMetrics, 0, 0, &identity);
SelectObject(hdc, oldFont);
- ReleaseDC(0, hdc);
return gdiMetrics.gmCellIncX + m_syntheticBoldOffset;
}
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;
#include "Cursor.h"
#include "BitmapInfo.h"
+#include "HWndDC.h"
#include "Image.h"
#include "IntPoint.h"
#include "SystemInfo.h"
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));
DeleteDC(andMaskDC);
}
DeleteDC(workingDC);
- ReleaseDC(0, dc);
return impl.release();
}
#include "BitmapInfo.h"
#include "CachedImage.h"
#include "GraphicsContextCG.h"
+#include "HWndDC.h"
#include "Image.h"
#include "RetainPtr.h"
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;
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)
exit:
if (workingDC)
DeleteDC(workingDC);
- ReleaseDC(0, dc);
return hbmp;
}
#include "FontSelector.h"
#include "Frame.h"
#include "GraphicsContext.h"
+#include "HWndDC.h"
#include "Image.h"
#include "RetainPtr.h"
#include "Settings.h"
// 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;
}
deallocContext(contextRef);
DeleteDC(workingDC);
- ReleaseDC(0, dc);
return image;
}
#include "DocumentFragment.h"
#include "Element.h"
#include "Frame.h"
+#include "HWndDC.h"
#include "HitTestResult.h"
#include "Image.h"
#include "KURL.h"
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()));
SelectObject(compatibleDC, oldBitmap);
DeleteDC(sourceDC);
DeleteDC(compatibleDC);
- ReleaseDC(0, dc);
if (::OpenClipboard(m_owner)) {
::SetClipboardData(CF_BITMAP, resultBitmap.leakPtr());
+2012-01-23 David Levin <levin@chromium.org>
+
+ [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 <awesomekling@apple.com>
Windows build fix.
#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>
{
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)
+2012-01-23 David Levin <levin@chromium.org>
+
+ [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 <timothy@apple.com>
Make WebKit2 remember the height of the Web Inspector when it is docked.
#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>
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()