Changeset 120956 in webkit


Ignore:
Timestamp:
Jun 21, 2012 12:20:00 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[GTK] Fix NPAPI plugins on Windows
https://bugs.webkit.org/show_bug.cgi?id=54531

Patch by Kalev Lember <kalevlember@gmail.com> on 2012-06-21
Reviewed by Martin Robinson.

.:

Define XP_WIN on Windows for plugin support.

  • GNUmakefile.am:

Source/WebCore:

Switch to using PluginPackageWin.cpp and PluginViewWin.cpp on Windows
platform, and leave plugins/gtk/ only for XP_UNIX platforms. With this
we can share a lot of code with other ports and don't have to
reimplement all the Windows-specific code in plugins/gtk/.

  • GNUmakefile.am:
  • GNUmakefile.list.am:
  • platform/FileSystem.h:

(WebCore):

  • platform/graphics/GraphicsContext.h:

(GraphicsContext):

  • platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h:

(WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate):
(GraphicsContextPlatformPrivate):

  • platform/graphics/transforms/TransformationMatrix.h:

(TransformationMatrix):

  • platform/graphics/win/GraphicsContextCairoWin.cpp:

(WebCore):

  • platform/graphics/win/GraphicsContextWin.cpp:

(WebCore):

  • platform/gtk/FileSystemGtk.cpp:

(WebCore::unloadModule):

  • plugins/PluginView.h:

(PluginView):

  • plugins/win/PluginViewWin.cpp:

(windowHandleForPageClient):
(WebCore::registerPluginView):
(WebCore::PluginView::paint):
(WebCore::PluginView::handleMouseEvent):
(WebCore::PluginView::platformStart):
(WebCore::PluginView::snapshot):

Source/WTF:

Define ENABLE_PLUGIN_PACKAGE_SIMPLE_HASH for the GTK+ port, and
include OwnPtrWin.cpp in the list of files built on Windows.

  • GNUmakefile.am:
  • GNUmakefile.list.am:
  • wtf/Platform.h:
Location:
trunk
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r120927 r120956  
     12012-06-21  Kalev Lember  <kalevlember@gmail.com>
     2
     3        [GTK] Fix NPAPI plugins on Windows
     4        https://bugs.webkit.org/show_bug.cgi?id=54531
     5
     6        Reviewed by Martin Robinson.
     7
     8        Define XP_WIN on Windows for plugin support.
     9
     10        * GNUmakefile.am:
     11
    1122012-06-21  Ryuan Choi  <ryuan.choi@gmail.com>
    213
  • trunk/GNUmakefile.am

    r120012 r120956  
    162162
    163163# For the Gtk port we want to use XP_UNIX both in X11 and Mac
    164 if !TARGET_WIN32
     164if TARGET_WIN32
     165global_cppflags += \
     166        -DXP_WIN
     167else
    165168global_cppflags += \
    166169        -DXP_UNIX
  • trunk/Source/WTF/ChangeLog

    r120922 r120956  
     12012-06-21  Kalev Lember  <kalevlember@gmail.com>
     2
     3        [GTK] Fix NPAPI plugins on Windows
     4        https://bugs.webkit.org/show_bug.cgi?id=54531
     5
     6        Reviewed by Martin Robinson.
     7
     8        Define ENABLE_PLUGIN_PACKAGE_SIMPLE_HASH for the GTK+ port, and
     9        include OwnPtrWin.cpp in the list of files built on Windows.
     10
     11        * GNUmakefile.am:
     12        * GNUmakefile.list.am:
     13        * wtf/Platform.h:
     14
    1152012-06-21  Balazs Kelemen  <kbalazs@webkit.org>
    216
  • trunk/Source/WTF/GNUmakefile.am

    r111788 r120956  
    1616        -lpthread
    1717
     18if TARGET_WIN32
     19# OwnPtrWin.cpp needs the symbols from gdi32 dll
     20libWTF_la_LIBADD += -lgdi32
     21endif
     22
    1823libWTF_la_CXXFLAGS = \
    1924        $(global_cxxflags) \
  • trunk/Source/WTF/GNUmakefile.list.am

    r119981 r120956  
    228228    Source/WTF/wtf/ThreadFunctionInvocation.h \
    229229    Source/WTF/wtf/ThreadingWin.cpp \
    230     Source/WTF/wtf/ThreadSpecificWin.cpp
     230    Source/WTF/wtf/ThreadSpecificWin.cpp \
     231    Source/WTF/wtf/win/OwnPtrWin.cpp
    231232else
    232233wtf_sources += \
  • trunk/Source/WTF/wtf/Platform.h

    r120745 r120956  
    10271027#endif
    10281028
    1029 #if !ENABLE(NETSCAPE_PLUGIN_API) || (ENABLE(NETSCAPE_PLUGIN_API) && ((OS(UNIX) && (PLATFORM(QT) || PLATFORM(WX))) || PLATFORM(GTK) || PLATFORM(EFL)))
     1029#if !ENABLE(NETSCAPE_PLUGIN_API) || (ENABLE(NETSCAPE_PLUGIN_API) && ((OS(UNIX) && (PLATFORM(GTK) || PLATFORM(QT) || PLATFORM(WX))) || PLATFORM(EFL)))
    10301030#define ENABLE_PLUGIN_PACKAGE_SIMPLE_HASH 1
    10311031#endif
  • trunk/Source/WebCore/ChangeLog

    r120954 r120956  
     12012-06-21  Kalev Lember  <kalevlember@gmail.com>
     2
     3        [GTK] Fix NPAPI plugins on Windows
     4        https://bugs.webkit.org/show_bug.cgi?id=54531
     5
     6        Reviewed by Martin Robinson.
     7
     8        Switch to using PluginPackageWin.cpp and PluginViewWin.cpp on Windows
     9        platform, and leave plugins/gtk/ only for XP_UNIX platforms. With this
     10        we can share a lot of code with other ports and don't have to
     11        reimplement all the Windows-specific code in plugins/gtk/.
     12
     13        * GNUmakefile.am:
     14        * GNUmakefile.list.am:
     15        * platform/FileSystem.h:
     16        (WebCore):
     17        * platform/graphics/GraphicsContext.h:
     18        (GraphicsContext):
     19        * platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h:
     20        (WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate):
     21        (GraphicsContextPlatformPrivate):
     22        * platform/graphics/transforms/TransformationMatrix.h:
     23        (TransformationMatrix):
     24        * platform/graphics/win/GraphicsContextCairoWin.cpp:
     25        (WebCore):
     26        * platform/graphics/win/GraphicsContextWin.cpp:
     27        (WebCore):
     28        * platform/gtk/FileSystemGtk.cpp:
     29        (WebCore::unloadModule):
     30        * plugins/PluginView.h:
     31        (PluginView):
     32        * plugins/win/PluginViewWin.cpp:
     33        (windowHandleForPageClient):
     34        (WebCore::registerPluginView):
     35        (WebCore::PluginView::paint):
     36        (WebCore::PluginView::handleMouseEvent):
     37        (WebCore::PluginView::platformStart):
     38        (WebCore::PluginView::snapshot):
     39
    1402012-06-21  Brady Eidson  <beidson@apple.com>
    241
  • trunk/Source/WebCore/GNUmakefile.am

    r120228 r120956  
    156156endif # END USE_PANGO
    157157
     158# ---
     159# Windows plugin support
     160# ---
     161if TARGET_WIN32
     162webcoregtk_cppflags += \
     163        -I$(srcdir)/Source/WebCore/platform/graphics/win
     164endif # END TARGET_WIN32
     165
    158166# ----
    159167# HTML Details Element
     
    965973        $(XRENDER_CFLAGS) \
    966974        $(XT_CFLAGS)
     975
     976if TARGET_WIN32
     977# PluginPackageWin.cpp needs the symbols from version dll
     978libWebCore_la_LIBADD = -lversion
     979endif
    967980
    968981libWebCoreModules_la_SOURCES = \
  • trunk/Source/WebCore/GNUmakefile.list.am

    r120929 r120956  
    48194819        Source/WebCore/platform/gtk/WidgetGtk.cpp \
    48204820        Source/WebCore/platform/gtk/WidgetRenderingContext.cpp \
    4821         Source/WebCore/platform/gtk/WidgetRenderingContext.h \
    4822         Source/WebCore/plugins/gtk/PluginPackageGtk.cpp \
    4823         Source/WebCore/plugins/gtk/PluginViewGtk.cpp
     4821        Source/WebCore/platform/gtk/WidgetRenderingContext.h
    48244822
    48254823if TARGET_X11
     
    48374835if TARGET_WIN32
    48384836webcore_sources += \
     4837        Source/WebCore/platform/graphics/win/DIBPixelData.cpp \
     4838        Source/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp \
     4839        Source/WebCore/platform/graphics/win/GraphicsContextWin.cpp \
     4840        Source/WebCore/platform/graphics/win/LocalWindowsContext.h \
     4841        Source/WebCore/platform/graphics/win/TransformationMatrixWin.cpp \
     4842        Source/WebCore/platform/win/BitmapInfo.cpp \
     4843        Source/WebCore/platform/win/BitmapInfo.h \
    48394844        Source/WebCore/platform/win/SystemInfo.cpp \
    48404845        Source/WebCore/platform/win/SystemInfo.h \
     4846        Source/WebCore/platform/win/WebCoreInstanceHandle.cpp \
     4847        Source/WebCore/platform/win/WebCoreInstanceHandle.h \
    48414848        Source/WebCore/plugins/win/PluginDatabaseWin.cpp \
    48424849        Source/WebCore/plugins/win/PluginMessageThrottlerWin.cpp \
    4843         Source/WebCore/plugins/win/PluginMessageThrottlerWin.h
     4850        Source/WebCore/plugins/win/PluginMessageThrottlerWin.h \
     4851        Source/WebCore/plugins/win/PluginPackageWin.cpp
    48444852webcoregtk_sources += \
    4845         Source/WebCore/platform/cairo/WidgetBackingStoreCairo.cpp
     4853        Source/WebCore/platform/cairo/WidgetBackingStoreCairo.cpp \
     4854        Source/WebCore/plugins/win/PluginViewWin.cpp
     4855else
     4856webcoregtk_sources += \
     4857        Source/WebCore/plugins/gtk/PluginPackageGtk.cpp \
     4858        Source/WebCore/plugins/gtk/PluginViewGtk.cpp
    48464859endif
    48474860
  • trunk/Source/WebCore/platform/FileSystem.h

    r120282 r120956  
    7575
    7676// PlatformModule
    77 #if PLATFORM(GTK)
     77#if OS(WINDOWS)
     78typedef HMODULE PlatformModule;
     79#elif PLATFORM(GTK)
    7880typedef GModule* PlatformModule;
    79 #elif OS(WINDOWS)
    80 typedef HMODULE PlatformModule;
    8181#elif PLATFORM(QT)
    8282#if defined(Q_WS_MAC)
  • trunk/Source/WebCore/platform/graphics/GraphicsContext.h

    r119706 r120956  
    489489#endif
    490490
    491 #if (PLATFORM(QT) && OS(WINDOWS)) || (PLATFORM(WX) && OS(WINDOWS))
     491#if (PLATFORM(GTK) && OS(WINDOWS)) || (PLATFORM(QT) && OS(WINDOWS)) || (PLATFORM(WX) && OS(WINDOWS))
    492492        HDC getWindowsContext(const IntRect&, bool supportAlphaBlend = true, bool mayCreateBitmap = true);
    493493        void releaseWindowsContext(HDC, const IntRect&, bool supportAlphaBlend = true, bool mayCreateBitmap = true);
  • trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h

    r119392 r120956  
    5353#if PLATFORM(GTK)
    5454        , expose(0)
    55 #elif PLATFORM(WIN)
     55#endif
     56#if PLATFORM(WIN) || (PLATFORM(GTK) && OS(WINDOWS))
    5657        // NOTE:  These may note be needed: review and remove once Cairo implementation is complete
    5758        , m_hdc(0)
     
    9899#if PLATFORM(GTK)
    99100    GdkEventExpose* expose;
    100 #elif PLATFORM(WIN)
     101#endif
     102#if PLATFORM(WIN) || (PLATFORM(GTK) && OS(WINDOWS))
    101103    HDC m_hdc;
    102104    bool m_shouldIncludeChildWindows;
  • trunk/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h

    r118572 r120956  
    5151#endif
    5252
    53 #if PLATFORM(WIN) || (PLATFORM(QT) && OS(WINDOWS)) || (PLATFORM(WX) && OS(WINDOWS))
     53#if PLATFORM(WIN) || (PLATFORM(GTK) && OS(WINDOWS)) || (PLATFORM(QT) && OS(WINDOWS)) || (PLATFORM(WX) && OS(WINDOWS))
    5454#if COMPILER(MINGW) && !COMPILER(MINGW64)
    5555typedef struct _XFORM XFORM;
     
    342342#endif
    343343
    344 #if PLATFORM(WIN) || (PLATFORM(QT) && OS(WINDOWS)) || (PLATFORM(WX) && OS(WINDOWS))
     344#if PLATFORM(WIN) || (PLATFORM(GTK) && OS(WINDOWS)) || (PLATFORM(QT) && OS(WINDOWS)) || (PLATFORM(WX) && OS(WINDOWS))
    345345    operator XFORM() const;
    346346#endif
  • trunk/Source/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp

    r95901 r120956  
    2828
    2929#include "AffineTransform.h"
     30#include "DIBPixelData.h"
    3031#include "Path.h"
    3132
     
    3738namespace WebCore {
    3839
     40#if PLATFORM(WIN)
    3941static cairo_t* createCairoContextWithHDC(HDC hdc, bool hasAlpha)
    4042{
     
    8890    }
    8991}
     92#endif
    9093
    9194static void setRGBABitmapAlpha(unsigned char* bytes, size_t length, unsigned char level)
     
    150153}
    151154
     155#if PLATFORM(WIN)
    152156void GraphicsContext::drawWindowsBitmap(WindowsBitmap* bitmap, const IntPoint& point)
    153157{
     
    172176    cairo_surface_destroy(surface);
    173177}
     178#endif
    174179
    175180}
  • trunk/Source/WebCore/platform/graphics/win/GraphicsContextWin.cpp

    r94897 r120956  
    5252}
    5353
     54#if PLATFORM(WIN)
    5455void GraphicsContext::setShouldIncludeChildWindows(bool include)
    5556{
     
    9596    return adoptPtr(new WindowsBitmap(m_data->m_hdc, size));
    9697}
     98#endif
    9799
    98100HDC GraphicsContext::getWindowsContext(const IntRect& dstRect, bool supportAlphaBlend, bool mayCreateBitmap)
     
    134136}
    135137
     138#if PLATFORM(WIN)
    136139void GraphicsContextPlatformPrivate::save()
    137140{
     
    203206    SetWorldTransform(m_hdc, &xform);
    204207}
    205 
    206 }
     208#endif
     209
     210}
  • trunk/Source/WebCore/platform/gtk/FileSystemGtk.cpp

    r120950 r120956  
    357357bool unloadModule(PlatformModule module)
    358358{
     359#if OS(WINDOWS)
     360    return ::FreeLibrary(module);
     361#else
    359362    return g_module_close(module);
    360 }
    361 }
     363#endif
     364}
     365}
  • trunk/Source/WebCore/plugins/PluginView.h

    r116403 r120956  
    4848#endif
    4949
    50 #if OS(WINDOWS) && (PLATFORM(QT) || PLATFORM(WX))
     50#if OS(WINDOWS) && (PLATFORM(GTK) || PLATFORM(QT) || PLATFORM(WX))
    5151typedef struct HWND__* HWND;
    5252typedef HWND PlatformPluginWidget;
     
    377377#endif
    378378
    379 #if ((PLATFORM(QT) || PLATFORM(WX)) && OS(WINDOWS)) || defined(XP_MACOSX) || PLATFORM(EFL)
     379#if ((PLATFORM(GTK) || PLATFORM(QT) || PLATFORM(WX)) && OS(WINDOWS)) || defined(XP_MACOSX) || PLATFORM(EFL)
    380380        // On Mac OSX and Qt/Windows the plugin does not have its own native widget,
    381381        // but is using the containing window as its reference for positioning/painting.
  • trunk/Source/WebCore/plugins/win/PluginViewWin.cpp

    r119927 r120956  
    8787#endif
    8888
     89#if PLATFORM(GTK)
     90#include <gdk/gdkwin32.h>
     91#include <gtk/gtk.h>
     92#endif
     93
    8994#if PLATFORM(QT)
    9095#include "QWebPageClient.h"
     
    103108static inline HWND windowHandleForPageClient(PlatformPageClient client)
    104109{
    105 #if PLATFORM(QT)
     110#if PLATFORM(GTK)
     111    if (!client)
     112        return 0;
     113    if (GdkWindow* window = gtk_widget_get_window(client))
     114        return static_cast<HWND>(GDK_WINDOW_HWND(window));
     115    return 0;
     116#elif PLATFORM(QT)
    106117    if (!client)
    107118        return 0;
     
    301312    haveRegisteredWindowClass = true;
    302313
    303 #if PLATFORM(QT)
    304     WebCore::setInstanceHandle((HINSTANCE)(qWinAppInst()));
     314#if PLATFORM(GTK) || PLATFORM(QT)
     315    WebCore::setInstanceHandle((HINSTANCE)(GetModuleHandle(0)));
    305316#endif
    306317
     
    643654    // On Safari/Windows without transparency layers the GraphicsContext returns the HDC
    644655    // of the window and the plugin expects that the passed in DC has window coordinates.
    645     // In the Qt port we always draw in an offscreen buffer and therefore need to preserve
    646     // the translation set in getWindowsContext.
    647 #if !PLATFORM(QT) && !OS(WINCE)
     656    // In the GTK and Qt ports we always draw in an offscreen buffer and therefore need
     657    // to preserve the translation set in getWindowsContext.
     658#if !PLATFORM(GTK) && !PLATFORM(QT) && !OS(WINCE)
    648659    if (!context->isInTransparencyLayer()) {
    649660        XFORM transform;
     
    753764        event->setDefaultHandled();
    754765
    755 #if !PLATFORM(QT) && !PLATFORM(WX) && !OS(WINCE)
     766#if !PLATFORM(GTK) && !PLATFORM(QT) && !PLATFORM(WX) && !OS(WINCE)
    756767    // Currently, Widget::setCursor is always called after this function in EventHandler.cpp
    757768    // and since we don't want that we set ignoreNextSetCursor to true here to prevent that.
     
    9981009                                       0, 0, 0, 0, parentWindowHandle, 0, WebCore::instanceHandle(), 0);
    9991010
    1000 #if OS(WINDOWS) && (PLATFORM(QT) || PLATFORM(WX))
     1011#if OS(WINDOWS) && (PLATFORM(GTK) || PLATFORM(QT) || PLATFORM(WX))
    10011012        m_window = window;
    10021013#else
     
    10411052PassRefPtr<Image> PluginView::snapshot()
    10421053{
    1043 #if !PLATFORM(WX) && !OS(WINCE)
     1054#if !PLATFORM(GTK) && !PLATFORM(WX) && !OS(WINCE)
    10441055    OwnPtr<HDC> hdc = adoptPtr(CreateCompatibleDC(0));
    10451056
Note: See TracChangeset for help on using the changeset viewer.