Changeset 48029 in webkit


Ignore:
Timestamp:
Sep 3, 2009 12:38:11 PM (15 years ago)
Author:
kevino@webkit.org
Message:

Reviewed by Kevin Ollivier.

[wx] Frames support
https://bugs.webkit.org/show_bug.cgi?id=19041

Location:
trunk
Files:
6 added
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r48028 r48029  
     12009-09-03  Kevin Watters  <kevinwatters@gmail.com>
     2
     3        Reviewed by Kevin Ollivier.
     4
     5        [wx] Frames support
     6        https://bugs.webkit.org/show_bug.cgi?id=19041
     7
     8        * page/wx/EventHandlerWx.cpp:
     9        (WebCore::EventHandler::passMousePressEventToSubframe):
     10        (WebCore::EventHandler::passMouseMoveEventToSubframe):
     11        (WebCore::EventHandler::passMouseReleaseEventToSubframe):
     12        (WebCore::EventHandler::passWheelEventToWidget):
     13        (WebCore::EventHandler::tabsToAllControls):
     14        (WebCore::EventHandler::passSubframeEventToSubframe):
     15        (WebCore::EventHandler::passMouseDownEventToWidget):
     16        * platform/wx/RenderThemeWx.cpp:
     17        (WebCore::nativeWindowForRenderObject):
     18        (WebCore::RenderThemeWx::paintButton):
     19        (WebCore::RenderThemeWx::paintTextField):
     20        (WebCore::RenderThemeWx::paintMenuList):
     21        (WebCore::RenderThemeWx::paintMenuListButton):
     22        * platform/wx/ScrollbarThemeWx.cpp: Added.
     23        (WebCore::ScrollbarTheme::nativeTheme):
     24        (WebCore::ScrollbarThemeWx::~ScrollbarThemeWx):
     25        (WebCore::ScrollbarThemeWx::scrollbarThickness):
     26        (WebCore::ScrollbarThemeWx::hasThumb):
     27        (WebCore::ScrollbarThemeWx::buttonSize):
     28        (WebCore::ScrollbarThemeWx::backButtonRect):
     29        (WebCore::ScrollbarThemeWx::forwardButtonRect):
     30        (WebCore::ScrollbarThemeWx::trackRect):
     31        (WebCore::ScrollbarThemeWx::paintScrollCorner):
     32        (WebCore::ScrollbarThemeWx::paint):
     33        * platform/wx/ScrollbarThemeWx.h: Added.
     34        (WebCore::ScrollbarThemeWx::hasButtons):
     35        * platform/wx/TemporaryLinkStubs.cpp:
     36        * platform/wx/wxcode/gtk/scrollbar_render.cpp: Added.
     37        (wxStyleForPart):
     38        (GetButtonWidget):
     39        (wxGetGdkWindowForDC):
     40        (wxRenderer_DrawScrollbar):
     41        * platform/wx/wxcode/mac/carbon/scrollbar_render.cpp: Added.
     42        (wxScrollbarPartToHIPressedState):
     43        (wxRenderer_DrawScrollbar):
     44        * platform/wx/wxcode/scrollbar_render.h: Added.
     45        (calcThumbStartAndLength):
     46        * platform/wx/wxcode/win/non-kerned-drawing.cpp:
     47        (WebCore::drawTextWithSpacing):
     48        * platform/wx/wxcode/win/scrollbar_render.cpp: Added.
     49        (GraphicsHDC::GraphicsHDC):
     50        (GraphicsHDC::~GraphicsHDC):
     51        (GraphicsHDC::operator HDC):
     52        (getTSStateForPart):
     53        (wxRenderer_DrawScrollbar):
     54        * webcore-wx.bkl:
     55
    1562009-09-03  Yael Aharon  <yael.aharon@nokia.com>
    257
  • trunk/WebCore/page/wx/EventHandlerWx.cpp

    r46592 r48029  
    3333#include "KeyboardEvent.h"
    3434#include "MouseEventWithHitTestResults.h"
     35#include "NotImplemented.h"
    3536#include "Page.h"
    3637#include "PlatformKeyboardEvent.h"
     
    4445bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe)
    4546{
    46     return passSubframeEventToSubframe(mev, subframe);
     47    subframe->eventHandler()->handleMousePressEvent(mev.event());
     48    return true;
    4749}
    4850
    4951bool EventHandler::passMouseMoveEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe, WebCore::HitTestResult* hittest)
    5052{
    51     return passSubframeEventToSubframe(mev, subframe);
     53    subframe->eventHandler()->handleMouseMoveEvent(mev.event(), hittest);
     54    return true;
    5255}
    5356
    5457bool EventHandler::passMouseReleaseEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe)
    5558{
    56     return passSubframeEventToSubframe(mev, subframe);
     59    subframe->eventHandler()->handleMouseReleaseEvent(mev.event());
     60    return true;
    5761}
    5862
     
    6973{
    7074    return passMouseDownEventToWidget(renderWidget->widget());
     75}
     76
     77bool EventHandler::passWheelEventToWidget(PlatformWheelEvent& event, Widget* widget)
     78{
     79    if (!widget || !widget->isFrameView())
     80        return false;
     81
     82    return static_cast<FrameView*>(widget)->frame()->eventHandler()->handleWheelEvent(event);
     83}
     84
     85bool EventHandler::tabsToAllControls(KeyboardEvent* event) const
     86{
     87    notImplemented();
     88    return false;
     89}
     90
     91bool EventHandler::passSubframeEventToSubframe(MouseEventWithHitTestResults&, Frame* subframe, HitTestResult*)
     92{
     93    notImplemented();
     94    return false;
     95}
     96
     97bool EventHandler::passMouseDownEventToWidget(Widget*)
     98{
     99    notImplemented();
     100    return false;
    71101}
    72102
  • trunk/WebCore/platform/wx/RenderThemeWx.cpp

    r44834 r48029  
    3030#include "FrameView.h"
    3131#include "GraphicsContext.h"
     32#include "HostWindow.h"
    3233#include "NotImplemented.h"
    3334#include "RenderView.h"
     
    138139    return rt;
    139140}
     141
     142wxWindow* nativeWindowForRenderObject(RenderObject* o)
     143{
     144    FrameView* frameView = o->view()->frameView();
     145    ASSERT(frameView);
     146    ASSERT(frameView->hostWindow());
     147    return frameView->hostWindow()->platformWindow();
     148}
     149
    140150
    141151bool RenderThemeWx::isControlStyled(const RenderStyle* style, const BorderData& border,
     
    252262bool RenderThemeWx::paintButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
    253263{
    254     wxWindow* window = o->view()->frameView()->platformWidget();
     264    wxWindow* window = nativeWindowForRenderObject(o);
    255265    wxDC* dc = static_cast<wxDC*>(i.context->platformContext());
    256266    int flags = 0;
    257267   
     268    IntRect rect = r;
     269
     270#if USE(WXGC)
     271    double xtrans = 0;
     272    double ytrans = 0;
     273   
     274    wxGCDC* gcdc = static_cast<wxGCDC*>(dc);
     275    wxGraphicsContext* gc = gcdc->GetGraphicsContext();
     276    gc->GetTransform().TransformPoint(&xtrans, &ytrans);
     277    rect.setX(r.x() + (int)xtrans);
     278    rect.setY(r.y() + (int)ytrans);
     279#endif
     280
    258281    if (!isEnabled(o))
    259282        flags |= wxCONTROL_DISABLED;
     
    267290   
    268291    if (part == PushButtonPart || part == ButtonPart)
    269         wxRendererNative::Get().DrawPushButton(window, *dc, r, flags);
     292        wxRendererNative::Get().DrawPushButton(window, *dc, rect, flags);
    270293    else if(part == RadioPart) {
    271294        if (isChecked(o))
    272295            flags |= wxCONTROL_CHECKED;
    273296#if wxCHECK_VERSION(2,9,0)
    274         wxRendererNative::Get().DrawRadioButton(window, *dc, r, flags);
    275 #else
    276         wxRenderer_DrawRadioButton(window, *dc, r, flags);
     297        wxRendererNative::Get().DrawRadioButton(window, *dc, rect, flags);
     298#else
     299        wxRenderer_DrawRadioButton(window, *dc, rect, flags);
    277300#endif
    278301    }
     
    280303        if (isChecked(o))
    281304            flags |= wxCONTROL_CHECKED;
    282         wxRendererNative::Get().DrawCheckBox(window, *dc, r, flags);
     305        wxRendererNative::Get().DrawCheckBox(window, *dc, rect, flags);
    283306    }
    284307    return false;
     
    292315bool RenderThemeWx::paintTextField(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
    293316{
    294     wxWindow* window = o->view()->frameView()->platformWidget();
     317    wxWindow* window = nativeWindowForRenderObject(o);
    295318    wxDC* dc = static_cast<wxDC*>(i.context->platformContext());
    296319#if wxCHECK_VERSION(2,9,0)
     
    314337bool RenderThemeWx::paintMenuList(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
    315338{
    316     wxWindow* window = o->view()->frameView()->platformWidget();
     339    wxWindow* window = nativeWindowForRenderObject(o);
    317340    wxDC* dc = static_cast<wxDC*>(i.context->platformContext());
    318341   
     
    343366bool RenderThemeWx::paintMenuListButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
    344367{
    345     wxWindow* window = o->view()->frameView()->platformWidget();
     368    wxWindow* window = nativeWindowForRenderObject(o);
    346369    wxDC* dc = static_cast<wxDC*>(i.context->platformContext());
    347370   
  • trunk/WebCore/platform/wx/TemporaryLinkStubs.cpp

    r47980 r48029  
    114114void Image::drawPattern(GraphicsContext*, const FloatRect& srcRect, const TransformationMatrix& patternTransform, const FloatPoint& phase, CompositeOperator, const FloatRect& destRect) { notImplemented(); }
    115115
    116 ScrollbarTheme* ScrollbarTheme::nativeTheme() { notImplemented(); static ScrollbarTheme theme; return &theme; }
    117 
    118116String FileChooser::basenameForWidth(const Font&, int width) const { notImplemented(); return String(); }
    119117
     
    126124void Editor::showFontPanel() { notImplemented(); }
    127125void Editor::showStylesPanel() { notImplemented(); }
    128 
    129 bool EventHandler::tabsToAllControls(KeyboardEvent* event) const { notImplemented(); return false; }
    130 bool EventHandler::passSubframeEventToSubframe(MouseEventWithHitTestResults&, Frame* subframe, HitTestResult*) { notImplemented(); return false; }
    131 bool EventHandler::passMouseDownEventToWidget(Widget*) { notImplemented(); return false; }
    132 bool EventHandler::passWheelEventToWidget(PlatformWheelEvent&, Widget*) { notImplemented(); return false; }
    133126
    134127void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) { notImplemented(); }
  • trunk/WebCore/platform/wx/wxcode/win/non-kerned-drawing.cpp

    r43261 r48029  
    8080    // get the native HDC handle to draw using native APIs
    8181    HDC hdc = 0;
     82    float y = point.y() - font->ascent();
     83    float x = point.x();
     84
    8285#if USE(WXGC)
     86    // when going from GdiPlus -> Gdi, any GdiPlus transformations are lost
     87    // so we need to alter the coordinates to reflect their transformed point.
     88    double xtrans = 0;
     89    double ytrans = 0;
     90   
    8391    wxGraphicsContext* gc = dc->GetGraphicsContext();
     92    gc->GetTransform().TransformPoint(&xtrans, &ytrans);
    8493    Gdiplus::Graphics* g;
    8594    if (gc) {
     
    8796        hdc = g->GetHDC();
    8897    }
     98    x += (int)xtrans;
     99    y += (int)ytrans;   
    89100#else
    90101    hdc = static_cast<HDC>(dc->GetHDC());
     
    95106    const GlyphBufferGlyph*   glyphs   = glyphBuffer.glyphs(from);
    96107    const GlyphBufferAdvance* advances = glyphBuffer.advances(from);
    97 
    98     float y = point.y() - font->ascent();
    99     float x = point.x();
    100108
    101109    int* spacing = new int[numGlyphs - from];
  • trunk/WebCore/webcore-wx.bkl

    r47127 r48029  
    112112                platform/wx/wxcode/gtk/fontprops.cpp
    113113                platform/wx/wxcode/gtk/non-kerned-drawing.cpp
     114                platform/wx/wxcode/gtk/scrollbar_render.cpp
    114115                platform/wx/SharedTimerWx.cpp
    115116            </if>
     
    118119                platform/wx/wxcode/mac/carbon/fontprops.cpp
    119120                platform/wx/wxcode/mac/carbon/non-kerned-drawing.cpp
     121                platform/wx/wxcode/mac/carbon/scrollbar_render.cpp
    120122                platform/wx/SharedTimerWx.cpp
    121123            </if>
     
    123125                platform/wx/wxcode/win/fontprops.cpp
    124126                platform/wx/wxcode/win/non-kerned-drawing.cpp
     127                platform/wx/wxcode/win/scrollbar_render.cpp
    125128                <!-- grab the windows port's SharedTimer implementation -->
    126129                platform/win/SharedTimerWin.cpp
  • trunk/WebKit/wx/ChangeLog

    r47983 r48029  
     12009-09-03  Kevin Watters  <kevinwatters@gmail.com>
     2
     3        Reviewed by Kevin Ollivier.
     4
     5        [wx] Frames support
     6        https://bugs.webkit.org/show_bug.cgi?id=19041
     7
     8        * WebFrame.cpp:
     9        (wxWebFrame::wxWebFrame):
     10        (wxWebFrame::~wxWebFrame):
     11        (wxWebFrame::GetFrame):
     12        * WebFrame.h:
     13        * WebFramePrivate.h:
     14        * WebKitSupport/ChromeClientWx.cpp:
     15        (WebCore::ChromeClientWx::platformWindow):
     16        (WebCore::ChromeClientWx::scroll):
     17        * WebKitSupport/EditorClientWx.cpp:
     18        (WebCore::EditorClientWx::isEditable):
     19        (WebCore::EditorClientWx::registerCommandForUndo):
     20        (WebCore::EditorClientWx::registerCommandForRedo):
     21        (WebCore::EditorClientWx::clearUndoRedoOperations):
     22        (WebCore::EditorClientWx::canUndo):
     23        (WebCore::EditorClientWx::canRedo):
     24        (WebCore::EditorClientWx::undo):
     25        (WebCore::EditorClientWx::redo):
     26        * WebKitSupport/FrameLoaderClientWx.cpp:
     27        (WebCore::FrameLoaderClientWx::FrameLoaderClientWx):
     28        (WebCore::FrameLoaderClientWx::setFrame):
     29        (WebCore::FrameLoaderClientWx::dispatchWillSubmitForm):
     30        (WebCore::FrameLoaderClientWx::frameLoaderDestroyed):
     31        (WebCore::FrameLoaderClientWx::committedLoad):
     32        (WebCore::FrameLoaderClientWx::dispatchDecidePolicyForMIMEType):
     33        (WebCore::FrameLoaderClientWx::dispatchDecidePolicyForNewWindowAction):
     34        (WebCore::FrameLoaderClientWx::dispatchDecidePolicyForNavigationAction):
     35        (WebCore::FrameLoaderClientWx::createFrame):
     36        (WebCore::FrameLoaderClientWx::transitionToCommittedForNewPage):
     37        * WebKitSupport/FrameLoaderClientWx.h:
     38        * WebView.h:
     39        * WebViewPrivate.h:
     40
    1412009-09-02  Kevin Ollivier  <kevino@theolliviers.com>
    242
  • trunk/WebKit/wx/WebFrame.cpp

    r47977 r48029  
    7575    m_isEditable(false),
    7676    m_isInitialized(false),
    77     m_beingDestroyed(false),
    78     m_title(wxEmptyString)
     77    m_beingDestroyed(false)
    7978{
    8079
     
    8887   
    8988    WebCore::FrameLoaderClientWx* loaderClient = new WebCore::FrameLoaderClientWx();
    90    
    91     m_impl->frame = WebCore::Frame::create(container->m_impl->page, parentFrame, loaderClient);
    92     m_impl->frame->deref();
    93 
    94     loaderClient->setFrame(m_impl->frame.get());
     89    RefPtr<WebCore::Frame> newFrame = WebCore::Frame::create(container->m_impl->page, parentFrame, loaderClient);
     90
     91    m_impl->frame = newFrame.get();
     92
     93    loaderClient->setFrame(this);
    9594    loaderClient->setWebView(container);
    9695   
     96    if (data && data->ownerElement)
     97        m_impl->frame->ref();
     98
    9799    m_impl->frame->init();
    98100       
     
    102104wxWebFrame::~wxWebFrame()
    103105{
    104     m_impl->frame->loader()->detachFromParent();
     106    if (m_impl)
     107        delete m_impl;
    105108}
    106109
     
    108111{
    109112    if (m_impl)
    110         return m_impl->frame.get();
     113        return m_impl->frame;
    111114       
    112115    return 0;
  • trunk/WebKit/wx/WebFrame.h

    r43260 r48029  
    147147    void MakeEditable(bool enable);
    148148    bool IsEditable() const { return m_isEditable; }
    149 
    150     wxString GetPageTitle() const { return m_title; }
    151     void SetPageTitle(const wxString& title) { m_title = title; }
    152149   
    153150    WebCore::Frame* GetFrame();
     
    161158    bool m_beingDestroyed;
    162159    WebFramePrivate* m_impl;
    163     wxString m_title;
    164160   
    165161};
  • trunk/WebKit/wx/WebFramePrivate.h

    r38687 r48029  
    3131
    3232#include "config.h"
    33 #include "EditCommand.h"
    34 #include "EditCommandWx.h"
    3533#include "Frame.h"
    36 #include "wtf/RefPtr.h"
    37 #include "wtf/Vector.h"
     34#include "HTMLFrameOwnerElement.h"
     35#include "KURL.h"
    3836
    3937class WebFramePrivate {
     
    4341            frame(0)
    4442    {}
     43   
     44    WebCore::Frame* frame;
     45};
    4546
    46     WTF::Vector<EditCommandWx> undoStack;
    47     WTF::Vector<EditCommandWx> redoStack;
     47class WebViewFrameData
     48{
     49public:
     50    WebCore::KURL url;
     51    WebCore::String name;
     52    WebCore::HTMLFrameOwnerElement* ownerElement;
    4853   
    49     WTF::RefPtr<WebCore::Frame> frame;
     54    WebCore::String referrer;
     55    bool allowsScrolling;
     56    int marginWidth;
     57    int marginHeight;   
    5058};
    5159
  • trunk/WebKit/wx/WebKitSupport/ChromeClientWx.cpp

    r46344 r48029  
    341341PlatformWidget ChromeClientWx::platformWindow() const
    342342{
    343     return 0;
     343    return m_webView;
    344344}
    345345
     
    394394void ChromeClientWx::scroll(const IntSize&, const IntRect&, const IntRect&)
    395395{
     396    m_webView->Refresh();
    396397    notImplemented();
    397398}
  • trunk/WebKit/wx/WebKitSupport/EditorClientWx.cpp

    r43987 r48029  
    203203
    204204    if (frame) {
    205         wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->platformWidget());
     205        wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformWindow());
    206206        if (webKitWin)
    207207            return webKitWin->IsEditable();
     
    286286
    287287    if (frame) {
    288         wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->platformWidget());
     288        wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformWindow());
    289289        if (webKitWin) {
    290             webKitWin->GetMainFrame()->m_impl->undoStack.append(EditCommandWx(command));
     290            webKitWin->m_impl->undoStack.append(EditCommandWx(command));
    291291        }
    292292    }
     
    298298
    299299    if (frame) {
    300         wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->platformWidget());
     300        wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformWindow());
    301301        if (webKitWin) {
    302             webKitWin->GetMainFrame()->m_impl->redoStack.insert(0, EditCommandWx(command));
     302            webKitWin->m_impl->redoStack.insert(0, EditCommandWx(command));
    303303        }
    304304    }
     
    307307void EditorClientWx::clearUndoRedoOperations()
    308308{
    309     notImplemented();
     309    Frame* frame = m_page->focusController()->focusedOrMainFrame();
     310   
     311    if (frame) {
     312        wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformWindow());
     313        if (webKitWin) {
     314            webKitWin->m_impl->redoStack.clear();
     315            webKitWin->m_impl->undoStack.clear();
     316        }
     317    }
    310318}
    311319
     
    315323
    316324    if (frame) {
    317         wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->platformWidget());
    318         if (webKitWin && webKitWin->GetMainFrame()) {
    319             return webKitWin->GetMainFrame()->m_impl->undoStack.size() != 0;
     325        wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformWindow());
     326        if (webKitWin) {
     327            return webKitWin->m_impl->undoStack.size() != 0;
    320328        }
    321329    }
     
    328336
    329337    if (frame) {
    330         wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->platformWidget());
    331         if (webKitWin && webKitWin->GetMainFrame()) {
    332             return webKitWin->GetMainFrame()->m_impl->redoStack.size() != 0;
     338        wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformWindow());
     339        if (webKitWin && webKitWin) {
     340            return webKitWin->m_impl->redoStack.size() != 0;
    333341        }
    334342    }
     
    341349
    342350    if (frame) {
    343         wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->platformWidget());
    344         if (webKitWin && webKitWin->GetMainFrame()) {
    345             webKitWin->GetMainFrame()->m_impl->undoStack.last().editCommand()->unapply();
    346             webKitWin->GetMainFrame()->m_impl->undoStack.removeLast();
     351        wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformWindow());
     352        if (webKitWin) {
     353            webKitWin->m_impl->undoStack.last().editCommand()->unapply();
     354            webKitWin->m_impl->undoStack.removeLast();
    347355        }
    348356    }
     
    353361    Frame* frame = m_page->focusController()->focusedOrMainFrame();
    354362
    355     if (frame) {
    356         wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->platformWidget());
    357         if (webKitWin && webKitWin->GetMainFrame()) {
    358             webKitWin->GetMainFrame()->m_impl->redoStack.first().editCommand()->reapply();
    359             webKitWin->GetMainFrame()->m_impl->redoStack.remove(0);
     363    if (frame) {   
     364        wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformWindow());
     365        if (webKitWin) {
     366            webKitWin->m_impl->redoStack.first().editCommand()->reapply();
     367            webKitWin->m_impl->redoStack.remove(0);
    360368        }
    361369    }
  • trunk/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp

    r45679 r48029  
    4949#include "ScriptController.h"
    5050#include "ScriptString.h"
     51#include <wtf/PassRefPtr.h>
     52#include <wtf/RefPtr.h>
    5153
    5254#include <stdio.h>
    5355
    5456#include "WebFrame.h"
     57#include "WebFramePrivate.h"
    5558#include "WebView.h"
    5659#include "WebViewPrivate.h"
     
    7881
    7982FrameLoaderClientWx::FrameLoaderClientWx()
    80     : m_frame(0)
     83    : m_webFrame(0)
    8184{
    8285}
     
    8790}
    8891
    89 void FrameLoaderClientWx::setFrame(Frame *frame)
    90 {
    91     m_frame = frame;
     92void FrameLoaderClientWx::setFrame(wxWebFrame *frame)
     93{
     94    m_webFrame = frame;
     95    m_frame = m_webFrame->m_impl->frame;
    9296}
    9397
     
    9599{
    96100    m_webView = webview;
    97 }
    98 
    99 void FrameLoaderClientWx::detachFrameLoader()
    100 {
    101     m_frame = 0;
    102101}
    103102
     
    340339{
    341340    // FIXME: Send an event to allow for alerts and cancellation
    342     if (!m_frame)
     341    if (!m_webFrame)
    343342        return;
    344343    (m_frame->loader()->*function)(PolicyUse);
     
    506505void FrameLoaderClientWx::frameLoaderDestroyed()
    507506{
     507    if (m_webFrame)
     508        delete m_webFrame;
     509    m_webFrame = 0;
    508510    m_frame = 0;
    509511    delete this;
     
    554556void FrameLoaderClientWx::committedLoad(WebCore::DocumentLoader* loader, const char* data, int length)
    555557{
    556     if (!m_frame)
     558    if (!m_webFrame)
    557559        return;
    558560    FrameLoader* fl = loader->frameLoader();
     
    694696void FrameLoaderClientWx::dispatchDecidePolicyForMIMEType(FramePolicyFunction function, const String& mimetype, const ResourceRequest& request)
    695697{
    696     if (!m_frame)
     698    if (!m_webFrame)
    697699        return;
    698700   
     
    703705void FrameLoaderClientWx::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const NavigationAction&, const ResourceRequest& request, PassRefPtr<FormState>, const String& targetName)
    704706{
    705     if (!m_frame)
     707    if (!m_webFrame)
    706708        return;
    707709
     
    723725void FrameLoaderClientWx::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const NavigationAction& action, const ResourceRequest& request, PassRefPtr<FormState>)
    724726{
    725     if (!m_frame)
     727    if (!m_webFrame)
    726728        return;
    727729       
     
    753755                                   const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight)
    754756{
    755 /*
    756     FIXME: Temporarily disabling code for loading subframes. While most
    757     (i)frames load and are destroyed properly, the iframe created by
    758     google.com in its new homepage does not get destroyed when
    759     document()->detach() is called, as other (i)frames do. It is destroyed on
    760     app shutdown, but until that point, this 'in limbo' frame will do things
    761     like steal keyboard focus and crash when clicked on. (On some platforms,
    762     it is actually a visible object, even though it's not in a valid state.)
    763    
    764     Since just about every user is probably going to test against Google at
    765     some point, I'm disabling this functionality until I have time to track down
    766     why it is not being destroyed.
    767 */
    768 
    769 /*
    770     wxWindow* parent = m_webView;
    771 
    772757    WebViewFrameData* data = new WebViewFrameData();
    773758    data->name = name;
     
    775760    data->url = url;
    776761    data->referrer = referrer;
     762    data->allowsScrolling = allowsScrolling;
    777763    data->marginWidth = marginWidth;
    778764    data->marginHeight = marginHeight;
    779765
    780     wxWebView* newWin = new wxWebView(parent, -1, wxDefaultPosition, wxDefaultSize, data);
    781 
    782     RefPtr<Frame> childFrame = newWin->m_impl->frame;
    783 
    784     // FIXME: All of the below should probably be moved over into WebCore
     766    wxWebFrame* newFrame = new wxWebFrame(m_webView, m_webFrame, data);
     767
     768    RefPtr<Frame> childFrame = adoptRef(newFrame->m_impl->frame);
     769
     770    m_frame->tree()->appendChild(childFrame);
    785771    childFrame->tree()->setName(name);
    786     m_frame->tree()->appendChild(childFrame);
    787     // ### set override encoding if we have one
    788 
    789     FrameLoadType loadType = m_frame->loader()->loadType();
    790     FrameLoadType childLoadType = FrameLoadTypeInternal;
    791 
    792     childFrame->loader()->load(url, referrer, childLoadType,
    793                             String(), 0, 0);
     772    childFrame->init();
     773
     774    // The creation of the frame may have run arbitrary JavaScript that removed it from the page already.
     775    if (!childFrame->page())
     776        return 0;
     777
     778    childFrame->loader()->loadURLIntoChildFrame(url, referrer, childFrame.get());
    794779   
    795780    // The frame's onload handler may have removed it from the document.
     
    797782        return 0;
    798783   
    799     delete data;
    800    
    801     return childFrame.get();
    802 */
    803     notImplemented();
    804     return 0;
     784    return childFrame.release();
    805785}
    806786
     
    881861void FrameLoaderClientWx::transitionToCommittedForNewPage()
    882862{
     863    ASSERT(m_webFrame);
    883864    ASSERT(m_frame);
    884865    ASSERT(m_webView);
    885866   
    886     Page* page = m_frame->page();
    887     ASSERT(page);
    888 
    889     bool isMainFrame = m_frame == page->mainFrame();
    890 
    891     m_frame->setView(0);
    892 
    893     RefPtr<FrameView> frameView;
    894     if (isMainFrame)
    895         frameView = FrameView::create(m_frame, IntRect(m_webView->GetRect()).size());
    896     else
    897         frameView = FrameView::create(m_frame);
    898 
    899     ASSERT(frameView);
    900     m_frame->setView(frameView);
    901 
    902     frameView->setPlatformWidget(m_webView);
    903 
    904     if (HTMLFrameOwnerElement* owner = m_frame->ownerElement())
    905         m_frame->view()->setScrollbarModes(owner->scrollingMode(), owner->scrollingMode());
    906 }
    907 
    908 }
     867    IntSize size = IntRect(m_webView->GetRect()).size();
     868    // FIXME: This value should be gotten from m_webView->IsTransparent();
     869    // but transitionToCommittedForNewPage() can be called while m_webView is
     870    // still being initialized.
     871    bool transparent = false;
     872    Color backgroundColor = transparent ? WebCore::Color::transparent : WebCore::Color::white;
     873   
     874    if (m_frame)
     875        m_frame->createView(size, backgroundColor, transparent, IntSize(), false);
     876}
     877
     878}
  • trunk/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h

    r45679 r48029  
    3434#include "ResourceResponse.h"
    3535
     36class wxWebFrame;
    3637class wxWebView;
    3738
     
    5253        FrameLoaderClientWx();
    5354        ~FrameLoaderClientWx();
    54         void setFrame(Frame *frame);
     55        void setFrame(wxWebFrame *frame);
    5556        void setWebView(wxWebView *webview);
    56         virtual void detachFrameLoader();
    5757
    5858        virtual bool hasWebView() const; // mainly for assertions
     
    208208
    209209    private:
    210         Frame *m_frame;
     210        wxWebFrame *m_webFrame;
     211        Frame* m_frame;
    211212        wxWebView *m_webView;
    212213        ResourceResponse m_response;
  • trunk/WebKit/wx/WebView.cpp

    r47981 r48029  
    235235    EVT_SET_FOCUS(wxWebView::OnSetFocus)
    236236    EVT_KILL_FOCUS(wxWebView::OnKillFocus)
    237     EVT_ACTIVATE(wxWebView::OnActivate)
    238237END_EVENT_TABLE()
    239238
     
    267266    if ( (style & wxBORDER_MASK) == 0)
    268267        style |= wxBORDER_NONE;
    269     style |= wxHSCROLL | wxVSCROLL;
    270268   
    271269    if (!wxWindow::Create(parent, id, position, size, style, name))
     
    316314    m_beingDestroyed = true;
    317315   
    318     delete m_mainFrame;
     316    if (m_mainFrame && m_mainFrame->GetFrame())
     317        m_mainFrame->GetFrame()->loader()->detachFromParent();
    319318   
    320319    delete m_impl->page;
     
    488487void wxWebView::OnPaint(wxPaintEvent& event)
    489488{
    490    
    491489    if (m_beingDestroyed || !m_mainFrame)
    492490        return;
    493    
     491
     492    // WebView active state is based on TLW active state.
     493    wxTopLevelWindow* tlw = dynamic_cast<wxTopLevelWindow*>(wxGetTopLevelParent(this));
     494    if (tlw && tlw->IsActive())
     495        m_impl->page->focusController()->setActive(true);
     496    else {
     497        m_impl->page->focusController()->setActive(false);
     498    }
    494499    WebCore::Frame* frame = m_mainFrame->GetFrame();
    495500    if (!frame || !frame->view())
     
    505510        if (dc.IsOk()) {
    506511            wxRect paintRect = GetUpdateRegion().GetBox();
    507 
    508             WebCore::IntSize offset = frame->view()->scrollOffset();
    509 #if USE(WXGC)
    510             gcdc.SetDeviceOrigin(-offset.width(), -offset.height());
    511 #endif
    512             dc.SetDeviceOrigin(-offset.width(), -offset.height());
    513             paintRect.Offset(offset.width(), offset.height());
    514512
    515513#if USE(WXGC)
     
    519517#endif
    520518            if (frame->contentRenderer()) {
    521                 if (frame->view()->needsLayout())
    522                     frame->view()->layout();
    523 
    524                 frame->view()->paintContents(&gc, paintRect);
     519                frame->view()->layoutIfNeededRecursive();
     520                frame->view()->paint(&gc, paintRect);
    525521            }
    526522        }
     
    540536    if (m_isInitialized && m_mainFrame) {
    541537        WebCore::Frame* frame = m_mainFrame->GetFrame();
    542         frame->eventHandler()->sendResizeEvent();
    543         frame->view()->layout();
    544         frame->view()->adjustScrollbars();
     538        frame->view()->setFrameRect(wxRect(wxPoint(0,0), event.GetSize()));
     539        frame->view()->forceLayout();
     540        frame->view()->adjustViewSize();
    545541    }
    546542     
     
    561557    event.Skip();
    562558   
    563     if (m_beingDestroyed)
    564         return;
    565    
    566     if (!m_mainFrame)
     559    if (!m_impl->page)
    567560        return;
    568561       
     
    612605    wxPoint localEventPoint = ScreenToClient(event.GetPosition());
    613606
    614     if (!m_mainFrame)
     607    if (!m_impl->page)
    615608        return;
    616609       
    617     WebCore::Frame* focusedFrame = m_mainFrame->GetFrame();
     610    WebCore::Frame* focusedFrame = m_impl->page->focusController()->focusedOrMainFrame();
    618611    if (!focusedFrame->view())
    619612        return;
     
    695688{
    696689    WebCore::Frame* frame = 0;
    697     if (m_mainFrame)
    698         frame = m_mainFrame->GetFrame();
     690    if (m_impl->page)
     691        frame = m_impl->page->focusController()->focusedOrMainFrame();
    699692
    700693    if (!(frame && frame->view()))
     
    837830       
    838831    if (frame) {
    839         m_impl->page->focusController()->setActive(true);
    840832        frame->selection()->setFocused(true);
    841833    }
     
    851843       
    852844    if (frame) {
    853         m_impl->page->focusController()->setActive(false);
    854845        frame->selection()->setFocused(false);
    855846    }
     
    857848}
    858849
    859 void wxWebView::OnActivate(wxActivateEvent& event)
    860 {
    861     if (m_impl->page)
    862         m_impl->page->focusController()->setActive(event.GetActive());
    863 
    864     event.Skip();
    865 }
    866 
    867850wxWebViewDOMElementInfo wxWebView::HitTest(const wxPoint& pos) const
    868851{
  • trunk/WebKit/wx/WebView.h

    r44060 r48029  
    172172    void OnSetFocus(wxFocusEvent& event);
    173173    void OnKillFocus(wxFocusEvent& event);
    174     void OnActivate(wxActivateEvent& event);
    175174   
    176175private:
  • trunk/WebKit/wx/WebViewPrivate.h

    r44060 r48029  
    3131
    3232#include "config.h"
    33 #include "HTMLFrameOwnerElement.h"
     33#include "EditCommand.h"
     34#include "EditCommandWx.h"
    3435#include "Page.h"
    35 #include "wtf/RefPtr.h"
    36 #include "KURL.h"
     36#include "wtf/Vector.h"
    3737
    3838#include <wx/timer.h>
     
    4949    wxTimer tripleClickTimer;
    5050    wxPoint tripleClickPos;
    51 };
    52 
    53 class WebViewFrameData
    54 {
    55 public:
    56     WebCore::KURL url;
    57     WebCore::String name;
    58     WebCore::HTMLFrameOwnerElement* ownerElement;
    5951   
    60     WebCore::String referrer;
    61     bool allowsScrolling;
    62     int marginWidth;
    63     int marginHeight;   
     52    WTF::Vector<EditCommandWx> undoStack;
     53    WTF::Vector<EditCommandWx> redoStack;
    6454};
    6555
  • trunk/WebKitTools/ChangeLog

    r48027 r48029  
     12009-09-03  Kevin Watters  <kevinwatters@gmail.com>
     2
     3        Reviewed by Kevin Ollivier.
     4
     5        [wx] Frames support
     6        https://bugs.webkit.org/show_bug.cgi?id=19041
     7
     8        * wx/build-wxwebkit:
     9
    1102009-09-02  David Kilzer  <ddkilzer@apple.com>
    211
  • trunk/WebKitTools/wx/build-wxwebkit

    r43844 r48029  
    369369                PY_LIBDIR="$PY_LIBDIR\\Libs"
    370370                PY_LIB=`python -c "import sys; sys.stdout.write('python' + sys.version[:3])"`
    371                 PY_LIB=`python -c "sys.stdout.write('$PY_LIB'.replace('.', ''))"`
     371                PY_LIB=`python -c "import sys; sys.stdout.write('$PY_LIB'.replace('.', ''))"`
    372372            else
    373373                PY_LIB=`python-config --libs`
Note: See TracChangeset for help on using the changeset viewer.