Changeset 51880 in webkit


Ignore:
Timestamp:
Dec 8, 2009 4:52:19 PM (14 years ago)
Author:
kevino@webkit.org
Message:

Reviewed by Kevin Ollivier.

[wx] Mac plugins support.

https://bugs.webkit.org/show_bug.cgi?id=32236

Location:
trunk
Files:
1 added
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r51875 r51880  
     12009-12-08  Kevin Watters  <kevinwatters@gmail.com>
     2
     3        Reviewed by Kevin Ollivier.
     4
     5        [wx] Mac plugins support.
     6       
     7        https://bugs.webkit.org/show_bug.cgi?id=32236
     8
     9        * wtf/Platform.h:
     10
    1112009-12-08  Dmitry Titov  <dimich@chromium.org>
    212
     
    2030        * wtf/ThreadVerifier.h: Removed.
    2131
     32>>>>>>> .r51879
    22332009-12-08  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
    2334
  • trunk/JavaScriptCore/wtf/Platform.h

    r51871 r51880  
    555555#if PLATFORM(WX)
    556556#define ENABLE_ASSEMBLER 1
     557#if PLATFORM(DARWIN)
     558#define WTF_PLATFORM_CF 1
     559#endif
    557560#endif
    558561
  • trunk/WebCore/ChangeLog

    r51877 r51880  
     12009-12-08  Kevin Watters  <kevinwatters@gmail.com>
     2
     3        Reviewed by Kevin Ollivier.
     4
     5        [wx] Mac plugins support.
     6       
     7        https://bugs.webkit.org/show_bug.cgi?id=32236
     8
     9        * platform/FileSystem.h:
     10        * platform/cf/BinaryPropertyList.h:
     11        * platform/network/curl/ResourceHandleManager.cpp:
     12        * platform/wx/FileSystemWx.cpp:
     13        (WebCore::fileExists):
     14        (WebCore::unloadModule):
     15        (WebCore::wxDirTraverserNonRecursive::wxDirTraverserNonRecursive):
     16        (WebCore::wxDirTraverserNonRecursive::OnFile):
     17        (WebCore::wxDirTraverserNonRecursive::OnDir):
     18        (WebCore::listDirectory):
     19        * plugins/mac/PluginViewMac.cpp:
     20        (WebCore::nativeWindowFor):
     21        (WebCore::cgHandleFor):
     22        (WebCore::topLevelOffsetFor):
     23        (WebCore::PluginView::platformStart):
     24        (WebCore::PluginView::setFocus):
     25        (WebCore::PluginView::invalidateRect):
     26        (WebCore::PluginView::handleKeyboardEvent):
     27        (WebCore::PluginView::globalMousePosForPlugin):
     28        * plugins/wx/PluginDataWx.cpp: Added.
     29        (WebCore::PluginData::initPlugins):
     30        (WebCore::PluginData::refresh):
     31        * wscript:
     32
    1332009-12-08  Brady Eidson  <beidson@apple.com>
    234
  • trunk/WebCore/platform/FileSystem.h

    r50138 r51880  
    4040#include <windows.h>
    4141#endif
    42 #if defined(Q_WS_MAC)
     42#endif
     43
     44#if PLATFORM(CF) || (PLATFORM(QT) && defined(Q_WS_MAC))
    4345#include <CoreFoundation/CFBundle.h>
    44 #endif
    4546#endif
    4647
     
    7778#elif PLATFORM(GTK)
    7879typedef GModule* PlatformModule;
     80#elif PLATFORM(CF)
     81typedef CFBundleRef PlatformModule;
    7982#else
    8083typedef void* PlatformModule;
  • trunk/WebCore/platform/cf/BinaryPropertyList.h

    r42468 r51880  
    2626#ifndef BinaryPropertyList_h
    2727#define BinaryPropertyList_h
     28
     29#include <CoreFoundation/CoreFoundation.h>
    2830
    2931#include <wtf/Vector.h>
  • trunk/WebCore/platform/network/curl/ResourceHandleManager.cpp

    r49752 r51880  
    5050#include <wtf/Vector.h>
    5151
     52#if !PLATFORM(WIN_OS)
     53#include <sys/param.h>
     54#define MAX_PATH MAXPATHLEN
     55#endif
     56
    5257namespace WebCore {
    5358
  • trunk/WebCore/platform/wx/FileSystemWx.cpp

    r51143 r51880  
    3636
    3737#include <wx/wx.h>
     38#include <wx/datetime.h>
     39#include <wx/dir.h>
     40#include <wx/dynlib.h>
     41#include <wx/file.h>
     42#include <wx/filefn.h>
    3843#include <wx/filename.h>
    39 #include <wx/dir.h>
    40 #include <wx/file.h>
    41 #include <wx/datetime.h>
    42 #include <wx/filefn.h>
     44
     45#if PLATFORM(DARWIN)
     46#include <CoreFoundation/CoreFoundation.h>
     47#endif
    4348
    4449namespace WebCore {
     
    4651bool fileExists(const String& path)
    4752{
    48     return wxFileName::FileExists(path);
     53    // NOTE: This is called for directory paths too so we need to check both.
     54    return wxFileName::FileExists(path) || wxFileName::DirExists(path);
    4955}
    5056
     
    124130#if PLATFORM(WIN_OS)
    125131    return ::FreeLibrary(mod);
     132#elif PLATFORM(DARWIN)
     133    CFRelease(mod);
     134    return true;
    126135#else
    127     notImplemented();
    128     return false;
     136    wxASSERT(mod);
     137    delete mod;
     138    return true;
    129139#endif
    130140}
     141
     142
     143class wxDirTraverserNonRecursive : public wxDirTraverser {
     144public:
     145    wxDirTraverserNonRecursive(wxString basePath, wxArrayString& files) : m_basePath(basePath), m_files(files) { }
     146
     147    virtual wxDirTraverseResult OnFile(const wxString& filename)
     148    {
     149        wxFileName afile(filename);
     150        afile.MakeRelativeTo(m_basePath);
     151        if (afile.GetFullPath().Find(afile.GetPathSeparator()) == wxNOT_FOUND)
     152            m_files.push_back(filename);
     153
     154        return wxDIR_CONTINUE;
     155    }
     156
     157    virtual wxDirTraverseResult OnDir(const wxString& dirname)
     158    {
     159        wxFileName dirfile(dirname);
     160        dirfile.MakeRelativeTo(m_basePath);
     161        if (dirfile.GetFullPath().Find(dirfile.GetPathSeparator()) == wxNOT_FOUND)
     162            m_files.push_back(dirname);
     163
     164        return wxDIR_CONTINUE;
     165    }
     166
     167private:
     168    wxString m_basePath;
     169    wxArrayString& m_files;
     170
     171    DECLARE_NO_COPY_CLASS(wxDirTraverserNonRecursive)
     172};
    131173
    132174Vector<String> listDirectory(const String& path, const String& filter)
    133175{
    134176    wxArrayString   file_paths;
     177    // wxDir::GetAllFiles recurses and for platforms like Mac where
     178    // a .plugin or .bundle can be a dir wx will recurse into the bundle
     179    // and list the files rather than just returning the plugin name, so
     180    // we write a special traverser that works around that issue.
     181    wxDirTraverserNonRecursive traverser(path, file_paths);
    135182   
    136     int n_files = wxDir::GetAllFiles(path, &file_paths, _T(""), wxDIR_FILES);
     183    wxDir dir(path);
     184    dir.Traverse(traverser, _T(""), wxDIR_FILES | wxDIR_DIRS);
    137185
    138186    Vector<String> entries;
    139187   
    140     for (int i = 0; i < n_files; i++)
     188    for (int i = 0; i < file_paths.GetCount(); i++)
    141189    {
    142190        entries.append(file_paths[i]);
  • trunk/WebCore/plugins/mac/PluginViewMac.cpp

    r51490 r51880  
    8888#endif
    8989
     90#if PLATFORM(WX)
     91#include <wx/defs.h>
     92#include <wx/wx.h>
     93#endif
     94
    9095using std::min;
    9196
     
    104109        return static_cast<WindowRef>(qt_mac_window_for(widget));
    105110#endif
     111#if PLATFORM(WX)
     112    if (widget)
     113        return (WindowRef)widget->MacGetTopLevelWindowRef();
     114#endif
    106115    return 0;
    107116}
     
    112121    if (widget)
    113122        return (CGContextRef)widget->macCGHandle();
     123#endif
     124#if PLATFORM(WX)
     125    if (widget)
     126        return (CGContextRef)widget->MacGetCGContextRef();
    114127#endif
    115128    return 0;
     
    122135        PlatformWidget topLevel = widget->window();
    123136        return widget->mapTo(topLevel, QPoint(0, 0)) + topLevel->geometry().topLeft() - topLevel->pos();
     137    }
     138#endif
     139#if PLATFORM(WX)
     140    if (widget) {
     141        PlatformWidget toplevel = wxGetTopLevelParent(widget);
     142        return toplevel->ScreenToClient(widget->GetScreenPosition());
    124143    }
    125144#endif
     
    183202    }
    184203#endif
     204#if PLATFORM(WX)
     205    if (wxWindow* widget = m_parentFrame->view()->hostWindow()->platformPageClient())
     206        setPlatformPluginWidget(widget);
     207#endif
    185208
    186209    // Create a fake window relative to which all events will be sent when using offscreen rendering
     
    337360
    338361    if (platformPluginWidget())
     362#if PLATFORM(QT)
    339363       platformPluginWidget()->setFocus(Qt::OtherFocusReason);
     364#else
     365        platformPluginWidget()->SetFocus();
     366#endif
    340367   else
    341368       Widget::setFocus();
     
    514541{
    515542    if (platformPluginWidget())
     543#if PLATFORM(QT)
    516544        platformPluginWidget()->update(convertToContainingWindow(rect));
     545#else
     546        platformPluginWidget()->RefreshRect(convertToContainingWindow(rect));
     547#endif
    517548    else
    518549        invalidateWindowlessPluginRect(rect);
     
    658689    LOG(Plugins, "PV::hKE(): record.modifiers: %d", record.modifiers);
    659690
     691#if PLATFORM(QT)
    660692    LOG(Plugins, "PV::hKE(): PKE.qtEvent()->nativeVirtualKey: 0x%02X, charCode: %d",
    661693               keyCode, int(uchar(charCodes[0])));
     694#endif
    662695
    663696    if (!dispatchNPEvent(record))
     
    708741    pos.v = short(pos.v * scaleFactor);
    709742
     743#if PLATFORM(WX)
     744    // make sure the titlebar/toolbar size is included
     745    WindowRef windowRef = nativeWindowFor(platformPluginWidget());
     746    ::Rect content, structure;
     747
     748    GetWindowBounds(windowRef, kWindowStructureRgn, &structure);
     749    GetWindowBounds(windowRef, kWindowContentRgn, &content);
     750
     751    int top = content.top  - structure.top;
     752    pos.v -= top;
     753#endif
     754
    710755    return pos;
    711756}
  • trunk/WebCore/wscript

    r51143 r51880  
    3131
    3232if build_port == "wx":
    33     no_plugins = [      'plugins/PluginDataNone.cpp',
    34                         'plugins/PluginViewNone.cpp',
    35                         'plugins/PluginPackageNone.cpp'
    36                  ]
    37    
    3833    if building_on_win32:
    3934        webcore_dirs.extend(['platform/wx/wxcode/win', 'plugins/win'])
     
    5247        ]
    5348    elif sys.platform.startswith('darwin'):
     49        webcore_dirs.append('plugins/mac')
    5450        webcore_dirs.append('platform/wx/wxcode/mac/carbon')
     51        webcore_dirs.append('platform/mac')
    5552        webcore_sources['wx-mac'] = [
     53               'platform/mac/WebCoreNSStringExtras.mm',
    5654               'platform/mac/PurgeableBufferMac.cpp',
     55               'plugins/wx/PluginDataWx.cpp',
     56               'plugins/mac/PluginPackageMac.cpp',
     57               'plugins/mac/PluginViewMac.cpp'
    5758        ]
    58         webcore_sources['plugins'] = no_plugins
    5959    else:
     60        webcore_sources['wx-gtk'] = [
     61               'plugins/PluginDataNone.cpp',
     62               'plugins/PluginViewNone.cpp',
     63               'plugins/PluginPackageNone.cpp'
     64        ]
    6065        webcore_dirs.append('platform/wx/wxcode/gtk')
    61         webcore_sources['plugins'] = no_plugins
    6266       
     67import TaskGen
    6368from TaskGen import taskgen, feature, after
    6469import Task, ccroot
     
    8893def build(bld):
    8994    import Options
    90 
     95    if sys.platform.startswith('darwin'):
     96        TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cxx']
     97   
    9198    wk_includes = ['.', '..', 'DerivedSources',
    9299                wk_root,
     
    99106
    100107    features = [build_port]
     108    exclude_patterns = ['*None.cpp', '*CFNet.cpp', '*Qt.cpp', '*Win.cpp', '*Wince.cpp', '*Gtk.cpp', '*Mac.cpp', '*Safari.cpp', '*Chromium*.cpp','*SVG*.cpp', '*AllInOne.cpp', 'test*bindings.*']
    101109    if build_port == 'wx':
    102110        features.append('curl')
     111       
     112    if sys.platform.startswith('darwin'):
     113        features.append('cf')
     114    else:
     115        exclude_patterns.append('*CF.cpp')
    103116
    104117    full_dirs = get_dirs_for_features(webcore_dir, features=features, dirs=webcore_dirs)
     
    130143       
    131144    excludes = []
     145   
    132146    if build_port == 'wx':
    133         excludes = get_excludes(webcore_dir, ['*None.cpp', '*CF.cpp', '*Qt.cpp', '*Win.cpp', '*Wince.cpp', '*Gtk.cpp', '*Mac.cpp', '*Safari.cpp', '*Chromium*.cpp','*SVG*.cpp', '*AllInOne.cpp', 'test*bindings.*'])
     147        excludes = get_excludes(webcore_dir, exclude_patterns)
    134148        excludes.extend(['UserStyleSheetLoader.cpp', 'RenderMediaControls.cpp'])
    135149
     
    152166        if building_on_win32:
    153167            excludes.append('SharedTimerWx.cpp')
     168           
     169        excludes.append('AuthenticationCF.cpp')
     170        excludes.append('LoaderRunLoopCF.cpp')
    154171       
    155172    webcore.find_sources_in_dirs(full_dirs, excludes = excludes, exts=['.c', '.cpp'])
  • trunk/WebKit/wx/ChangeLog

    r51644 r51880  
     12009-12-08  Kevin Watters  <kevinwatters@gmail.com>
     2
     3        Reviewed by Kevin Ollivier.
     4
     5        [wx] Mac plugins support.
     6       
     7        https://bugs.webkit.org/show_bug.cgi?id=32236
     8
     9        * WebKitSupport/FrameLoaderClientWx.cpp:
     10        (WebCore::FrameLoaderClientWx::createPlugin):
     11        (WebCore::FrameLoaderClientWx::redirectDataToPlugin):
     12        * WebView.cpp:
     13        (wxWebView::Create):
     14
    1152009-12-03  Brady Eidson  <beidson@apple.com>
    216
  • trunk/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp

    r51644 r51880  
    3838#include "FrameView.h"
    3939#include "FrameTree.h"
     40#include "PluginView.h"
    4041#include "HTMLFormElement.h"
    4142#include "HTMLFrameOwnerElement.h"
    42 #include "HTMLPluginElement.h"
    4343#include "NotImplemented.h"
    4444#include "Page.h"
     
    854854PassRefPtr<Widget> FrameLoaderClientWx::createPlugin(const IntSize& size, HTMLPlugInElement* element, const KURL& url, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually)
    855855{
    856 #if PLATFORM(WIN_OS)
     856#if __WXMSW__ || __WXMAC__
    857857    RefPtr<PluginView> pv = PluginView::create(m_frame, size, element, url, paramNames, paramValues, mimeType, loadManually);
    858858    if (pv->status() == PluginStatusLoadedSuccessfully)
     
    864864void FrameLoaderClientWx::redirectDataToPlugin(Widget* pluginWidget)
    865865{
    866      ASSERT(!m_pluginView);
    867      m_pluginView = static_cast<PluginView*>(pluginWidget);
    868      m_hasSentResponseToPlugin = false;
     866    ASSERT(!m_pluginView);
     867    m_pluginView = static_cast<PluginView*>(pluginWidget);
     868    m_hasSentResponseToPlugin = false;
    869869}
    870870
  • trunk/WebKit/wx/WebView.cpp

    r51143 r51880  
    339339#endif
    340340
    341 #if __WXMSW__
     341#if __WXMSW__ || __WXMAC__
    342342    settings->setPluginsEnabled(true);
    343343#endif
  • trunk/WebKitTools/ChangeLog

    r51876 r51880  
     12009-12-08  Kevin Watters  <kevinwatters@gmail.com>
     2
     3        Reviewed by Kevin Ollivier.
     4
     5        [wx] Mac plugins support.
     6       
     7        https://bugs.webkit.org/show_bug.cgi?id=32236
     8
     9        * wx/browser/wscript:
     10
    1112009-12-08  David Levin  <levin@chromium.org>
    212
  • trunk/WebKitTools/wx/browser/wscript

    r49910 r51880  
    4646        source = 'browser.cpp',
    4747        target = 'wxBrowser',
    48         uselib = 'WXWEBKIT WX ' + get_config(),
     48        uselib = 'WX CURL ICU XSLT XML WXWEBKIT ' + get_config(),
    4949        libpath = [output_dir],
    5050        uselib_local = '',
Note: See TracChangeset for help on using the changeset viewer.