Diff
Modified: trunk/Source/WebCore/ChangeLog (105755 => 105756)
--- trunk/Source/WebCore/ChangeLog 2012-01-24 18:49:22 UTC (rev 105755)
+++ trunk/Source/WebCore/ChangeLog 2012-01-24 18:51:50 UTC (rev 105756)
@@ -1,3 +1,18 @@
+2012-01-24 David Levin <[email protected]>
+
+ [windows] Convert usage of GetDC to HWndDC Part 3.
+ https://bugs.webkit.org/show_bug.cgi?id=76889
+
+ Reviewed by Adam Roben.
+
+ No new functionality so no new tests.
+
+ * platform/graphics/win/UniscribeController.cpp:
+ (WebCore::UniscribeController::shapeAndPlaceItem): Simple replacement.
+ (WebCore::UniscribeController::shape): Use the delayed allocation.
+ * platform/win/PopupMenuWin.cpp:
+ (WebCore::PopupMenuWin::paint): Fix a dc leak and use the dellayed allocation.
+
2012-01-24 Mario Sanchez Prada <[email protected]>
[GTK] Refactor GTK's accessibilitity code to be more modular
Modified: trunk/Source/WebCore/platform/graphics/win/UniscribeController.cpp (105755 => 105756)
--- trunk/Source/WebCore/platform/graphics/win/UniscribeController.cpp 2012-01-24 18:49:22 UTC (rev 105755)
+++ trunk/Source/WebCore/platform/graphics/win/UniscribeController.cpp 2012-01-24 18:51:50 UTC (rev 105756)
@@ -26,6 +26,7 @@
#include "config.h"
#include "UniscribeController.h"
#include "Font.h"
+#include "HWndDC.h"
#include "SimpleFontData.h"
#include "TextRun.h"
#include <wtf/MathExtras.h>
@@ -248,13 +249,12 @@
if (placeResult == E_PENDING) {
// The script cache isn't primed with enough info yet. We need to select our HFONT into
// a DC and pass the DC in to ScriptPlace.
- HDC hdc = GetDC(0);
+ HWndDC hdc(0);
HFONT hfont = fontData->platformData().hfont();
HFONT oldFont = (HFONT)SelectObject(hdc, hfont);
placeResult = ScriptPlace(hdc, fontData->scriptCache(), glyphs.data(), glyphs.size(), visualAttributes.data(),
&item.a, advances.data(), offsets.data(), 0);
SelectObject(hdc, oldFont);
- ReleaseDC(0, hdc);
}
if (FAILED(placeResult) || glyphs.isEmpty())
@@ -380,7 +380,7 @@
Vector<WORD>& glyphs, Vector<WORD>& clusters,
Vector<SCRIPT_VISATTR>& visualAttributes)
{
- HDC hdc = 0;
+ HWndDC hdc;
HFONT oldFont = 0;
HRESULT shapeResult = E_PENDING;
int glyphCount = 0;
@@ -391,7 +391,7 @@
// The script cache isn't primed with enough info yet. We need to select our HFONT into
// a DC and pass the DC in to ScriptShape.
ASSERT(!hdc);
- hdc = GetDC(0);
+ hdc.setHWnd(0);
HFONT hfont = fontData->platformData().hfont();
oldFont = (HFONT)SelectObject(hdc, hfont);
} else if (shapeResult == E_OUTOFMEMORY) {
@@ -401,10 +401,8 @@
}
} while (shapeResult == E_PENDING || shapeResult == E_OUTOFMEMORY);
- if (hdc) {
+ if (hdc)
SelectObject(hdc, oldFont);
- ReleaseDC(0, hdc);
- }
if (FAILED(shapeResult))
return false;
Modified: trunk/Source/WebCore/platform/win/PopupMenuWin.cpp (105755 => 105756)
--- trunk/Source/WebCore/platform/win/PopupMenuWin.cpp 2012-01-24 18:49:22 UTC (rev 105755)
+++ trunk/Source/WebCore/platform/win/PopupMenuWin.cpp 2012-01-24 18:51:50 UTC (rev 105756)
@@ -31,6 +31,7 @@
#include "FrameView.h"
#include "GraphicsContext.h"
#include "HTMLNames.h"
+#include "HWndDC.h"
#include "HostWindow.h"
#include "Page.h"
#include "PlatformMouseEvent.h"
@@ -42,6 +43,7 @@
#include "SimpleFontData.h"
#include "TextRun.h"
#include "WebCoreInstanceHandle.h"
+
#include <windows.h>
#include <windowsx.h>
#if OS(WINCE)
@@ -566,7 +568,7 @@
return;
if (!m_DC) {
- m_DC = ::CreateCompatibleDC(::GetDC(m_popup));
+ m_DC = ::CreateCompatibleDC(HWndDC(m_popup));
if (!m_DC)
return;
}
@@ -660,12 +662,10 @@
if (m_scrollbar)
m_scrollbar->paint(&context, damageRect);
- HDC localDC = hdc ? hdc : ::GetDC(m_popup);
+ HWndDC hWndDC;
+ HDC localDC = hdc ? hdc : hWndDC.setHWnd(m_popup);
::BitBlt(localDC, damageRect.x(), damageRect.y(), damageRect.width(), damageRect.height(), m_DC, damageRect.x(), damageRect.y(), SRCCOPY);
-
- if (!hdc)
- ::ReleaseDC(m_popup, localDC);
}
int PopupMenuWin::scrollSize(ScrollbarOrientation orientation) const
Modified: trunk/Source/WebKit2/ChangeLog (105755 => 105756)
--- trunk/Source/WebKit2/ChangeLog 2012-01-24 18:49:22 UTC (rev 105755)
+++ trunk/Source/WebKit2/ChangeLog 2012-01-24 18:51:50 UTC (rev 105756)
@@ -1,3 +1,13 @@
+2012-01-24 David Levin <[email protected]>
+
+ [windows] Convert usage of GetDC to HWndDC Part 3.
+ https://bugs.webkit.org/show_bug.cgi?id=76889
+
+ Reviewed by Adam Roben.
+
+ * UIProcess/win/WebPopupMenuProxyWin.cpp:
+ (WebKit::WebPopupMenuProxyWin::paint): Fix a dc leak and use the dellayed allocation.
+
2012-01-24 Sergio Villar Senin <[email protected]>
[WK2] [GTK] TestDownloads hitting an assertion in Debug builds
Modified: trunk/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp (105755 => 105756)
--- trunk/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp 2012-01-24 18:49:22 UTC (rev 105755)
+++ trunk/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp 2012-01-24 18:51:50 UTC (rev 105756)
@@ -34,6 +34,7 @@
#include <WebCore/WebCoreInstanceHandle.h>
#include <WebCore/ScrollbarTheme.h>
#include <WebCore/BitmapInfo.h>
+#include <WebCore/HWndDC.h>
#include <WebCore/PlatformMouseEvent.h>
#include <windowsx.h>
@@ -808,7 +809,7 @@
return;
if (!m_DC) {
- m_DC = ::CreateCompatibleDC(::GetDC(m_popup));
+ m_DC = ::CreateCompatibleDC(HWndDC(m_popup));
if (!m_DC)
return;
}
@@ -848,12 +849,11 @@
if (m_scrollbar)
m_scrollbar->paint(&context, damageRect);
- HDC localDC = hdc ? hdc : ::GetDC(m_popup);
+ HWndDC hWndDC;
+ HDC localDC = hdc ? hdc : hWndDC.setHWnd(m_popup);
+
::BitBlt(localDC, damageRect.x(), damageRect.y(), damageRect.width(), damageRect.height(), m_DC, damageRect.x(), damageRect.y(), SRCCOPY);
-
- if (!hdc)
- ::ReleaseDC(m_popup, localDC);
}
bool WebPopupMenuProxyWin::setFocusedIndex(int i, bool hotTracking)