Changeset 105756 in webkit


Ignore:
Timestamp:
Jan 24, 2012, 10:51:50 AM (14 years ago)
Author:
levin@chromium.org
Message:

[windows] Convert usage of GetDC to HWndDC Part 3.
https://bugs.webkit.org/show_bug.cgi?id=76889

Reviewed by Adam Roben.

Source/WebCore:

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.

Source/WebKit2:

  • UIProcess/win/WebPopupMenuProxyWin.cpp:

(WebKit::WebPopupMenuProxyWin::paint): Fix a dc leak and use the dellayed allocation.

Location:
trunk/Source
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r105754 r105756  
     12012-01-24  David Levin  <levin@chromium.org>
     2
     3        [windows] Convert usage of GetDC to HWndDC Part 3.
     4        https://bugs.webkit.org/show_bug.cgi?id=76889
     5
     6        Reviewed by Adam Roben.
     7
     8        No new functionality so no new tests.
     9
     10        * platform/graphics/win/UniscribeController.cpp:
     11        (WebCore::UniscribeController::shapeAndPlaceItem): Simple replacement.
     12        (WebCore::UniscribeController::shape): Use the delayed allocation.
     13        * platform/win/PopupMenuWin.cpp:
     14        (WebCore::PopupMenuWin::paint): Fix a dc leak and use the dellayed allocation.
     15
    1162012-01-24  Mario Sanchez Prada  <msanchez@igalia.com>
    217
  • trunk/Source/WebCore/platform/graphics/win/UniscribeController.cpp

    r96404 r105756  
    2727#include "UniscribeController.h"
    2828#include "Font.h"
     29#include "HWndDC.h"
    2930#include "SimpleFontData.h"
    3031#include "TextRun.h"
     
    249250        // The script cache isn't primed with enough info yet.  We need to select our HFONT into
    250251        // a DC and pass the DC in to ScriptPlace.
    251         HDC hdc = GetDC(0);
     252        HWndDC hdc(0);
    252253        HFONT hfont = fontData->platformData().hfont();
    253254        HFONT oldFont = (HFONT)SelectObject(hdc, hfont);
     
    255256                                  &item.a, advances.data(), offsets.data(), 0);
    256257        SelectObject(hdc, oldFont);
    257         ReleaseDC(0, hdc);
    258258    }
    259259   
     
    381381                                Vector<SCRIPT_VISATTR>& visualAttributes)
    382382{
    383     HDC hdc = 0;
     383    HWndDC hdc;
    384384    HFONT oldFont = 0;
    385385    HRESULT shapeResult = E_PENDING;
     
    392392            // a DC and pass the DC in to ScriptShape.
    393393            ASSERT(!hdc);
    394             hdc = GetDC(0);
     394            hdc.setHWnd(0);
    395395            HFONT hfont = fontData->platformData().hfont();
    396396            oldFont = (HFONT)SelectObject(hdc, hfont);
     
    402402    } while (shapeResult == E_PENDING || shapeResult == E_OUTOFMEMORY);
    403403
    404     if (hdc) {
     404    if (hdc)
    405405        SelectObject(hdc, oldFont);
    406         ReleaseDC(0, hdc);
    407     }
    408406
    409407    if (FAILED(shapeResult))
  • trunk/Source/WebCore/platform/win/PopupMenuWin.cpp

    r99493 r105756  
    3232#include "GraphicsContext.h"
    3333#include "HTMLNames.h"
     34#include "HWndDC.h"
    3435#include "HostWindow.h"
    3536#include "Page.h"
     
    4344#include "TextRun.h"
    4445#include "WebCoreInstanceHandle.h"
     46
    4547#include <windows.h>
    4648#include <windowsx.h>
     
    567569
    568570    if (!m_DC) {
    569         m_DC = ::CreateCompatibleDC(::GetDC(m_popup));
     571        m_DC = ::CreateCompatibleDC(HWndDC(m_popup));
    570572        if (!m_DC)
    571573            return;
     
    661663        m_scrollbar->paint(&context, damageRect);
    662664
    663     HDC localDC = hdc ? hdc : ::GetDC(m_popup);
     665    HWndDC hWndDC;
     666    HDC localDC = hdc ? hdc : hWndDC.setHWnd(m_popup);
    664667
    665668    ::BitBlt(localDC, damageRect.x(), damageRect.y(), damageRect.width(), damageRect.height(), m_DC, damageRect.x(), damageRect.y(), SRCCOPY);
    666 
    667     if (!hdc)
    668         ::ReleaseDC(m_popup, localDC);
    669669}
    670670
  • trunk/Source/WebKit2/ChangeLog

    r105746 r105756  
     12012-01-24  David Levin  <levin@chromium.org>
     2
     3        [windows] Convert usage of GetDC to HWndDC Part 3.
     4        https://bugs.webkit.org/show_bug.cgi?id=76889
     5
     6        Reviewed by Adam Roben.
     7
     8        * UIProcess/win/WebPopupMenuProxyWin.cpp:
     9        (WebKit::WebPopupMenuProxyWin::paint): Fix a dc leak and use the dellayed allocation.
     10
    1112012-01-24  Sergio Villar Senin  <svillar@igalia.com>
    212
  • trunk/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp

    r103409 r105756  
    3535#include <WebCore/ScrollbarTheme.h>
    3636#include <WebCore/BitmapInfo.h>
     37#include <WebCore/HWndDC.h>
    3738#include <WebCore/PlatformMouseEvent.h>
    3839#include <windowsx.h>
     
    809810
    810811    if (!m_DC) {
    811         m_DC = ::CreateCompatibleDC(::GetDC(m_popup));
     812        m_DC = ::CreateCompatibleDC(HWndDC(m_popup));
    812813        if (!m_DC)
    813814            return;
     
    849850        m_scrollbar->paint(&context, damageRect);
    850851
    851     HDC localDC = hdc ? hdc : ::GetDC(m_popup);
     852
     853    HWndDC hWndDC;
     854    HDC localDC = hdc ? hdc : hWndDC.setHWnd(m_popup);
    852855
    853856    ::BitBlt(localDC, damageRect.x(), damageRect.y(), damageRect.width(), damageRect.height(), m_DC, damageRect.x(), damageRect.y(), SRCCOPY);
    854 
    855     if (!hdc)
    856         ::ReleaseDC(m_popup, localDC);
    857857}
    858858
Note: See TracChangeset for help on using the changeset viewer.