Changeset 29369 in webkit


Ignore:
Timestamp:
Jan 10, 2008 1:23:34 PM (16 years ago)
Author:
Adam Roben
Message:

Fix many bugs by giving Windows one FrameView per page load

WebCore:

Fixes to allow multiple FrameViews on Windows

Reviewed by Hyatt.

  • page/FrameView.cpp: (WebCore::FrameView::FrameView): Added a new constructor that takes an IntSize to specify the FrameView's initial size. (WebCore::FrameView::scheduleRelayout): Added an assertion that our Document is not in the page cache.
  • page/FrameView.h:
  • platform/gtk/WidgetGtk.cpp: (WebCore::Widget::~Widget): Add a warm, fuzzy ASSERT.
  • platform/qt/WidgetQt.cpp: (WebCore::Widget::~Widget): Ditto.
  • rendering/RenderWidget.cpp: (WebCore::RenderWidget::setWidget): Make sure to remove any existing Widget from the Widget hierarchy before deleting it. One instance where this is needed is when setWidget is called during FrameView creation on Windows.

WebKit/win:

Fix many bugs by giving Windows one FrameView per page load

Bugs include:

<rdar://5659200>

Windows back/forward cache causes crashes in the layout tests

<rdar://5659355>
<http://bugs.webkit.org/show_bug.cgi?id=16808>

REGRESSION: PLT broken on Windows due to back/forward cache

<rdar://5663654>
<http://bugs.webkit.org/show_bug.cgi?id=16607>

Random crashes in FrameView::scheduleRelayout while surfing
Thinkgeek

On Windows until now we've only had one FrameView per Frame. Once the
back/forward cache was turned on this started causing assertions to
fail and crashes to occur due to a single FrameView being both in the
back/forward cache (possibly multiple times!) and used by a live
document. We now create a new FrameView for each page load, just as
Mac does.

This has the side-effect of plugging some of the world leaks seen at
the end of the PLT.

Reviewed by Hyatt.

  • WebFrame.cpp: (WebFrame::initWithWebFrameView): Don't create the FrameView right away -- it'll be created when the load is committed. (WebFrame::transitionToCommittedFromCachedPage): Match the Mac by no longer calling resetMultipleFormSubmissionProtection here. (WebFrame::transitionToCommittedForNewPage): Ported code from -[WebCoreFrameBridge createFrameViewWithNSView:marginWidth:marginHeight:], -[WebCoreFrameBridge installInFrame:], and moved code here from WebFrame::initWithWebFrameView and WebView::initWithFrame. WebCore takes care of resetMultipleFormSubmissionProtection, just like it does on the Mac.
  • WebView.cpp: (WebView::initWithFrame): Moved FrameView initialization code to WebFrame::transitionToCommittedForNewPage.
Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r29368 r29369  
     12008-01-10  Adam Roben  <aroben@apple.com>
     2
     3        Fixes to allow multiple FrameViews on Windows
     4
     5        Reviewed by Hyatt.
     6
     7        * page/FrameView.cpp:
     8        (WebCore::FrameView::FrameView): Added a new constructor that takes an
     9        IntSize to specify the FrameView's initial size.
     10        (WebCore::FrameView::scheduleRelayout): Added an assertion that our
     11        Document is not in the page cache.
     12        * page/FrameView.h:
     13        * platform/gtk/WidgetGtk.cpp:
     14        (WebCore::Widget::~Widget): Add a warm, fuzzy ASSERT.
     15        * platform/qt/WidgetQt.cpp:
     16        (WebCore::Widget::~Widget): Ditto.
     17        * rendering/RenderWidget.cpp:
     18        (WebCore::RenderWidget::setWidget): Make sure to remove any existing
     19        Widget from the Widget hierarchy before deleting it. One instance
     20        where this is needed is when setWidget is called during FrameView
     21        creation on Windows.
     22
    1232008-01-10  Alp Toker  <alp@atoker.com>
    224
  • trunk/WebCore/page/FrameView.cpp

    r29002 r29369  
    144144    show();
    145145}
     146
     147#if !PLATFORM(MAC)
     148FrameView::FrameView(Frame* frame, const IntSize& initialSize)
     149    : m_refCount(1)
     150    , m_frame(frame)
     151    , d(new FrameViewPrivate(this))
     152{
     153    init();
     154    Widget::setFrameGeometry(IntRect(x(), y(), initialSize.width(), initialSize.height()));
     155    show();
     156}
     157#endif
    146158
    147159FrameView::~FrameView()
     
    700712void FrameView::scheduleRelayout()
    701713{
     714    ASSERT(!m_frame->document() || !m_frame->document()->inPageCache());
    702715    ASSERT(m_frame->view() == this);
    703716
  • trunk/WebCore/page/FrameView.h

    r28371 r29369  
    5151public:
    5252    FrameView(Frame*);
     53
     54    // On the Mac, FrameViews always get their size from the underlying NSView,
     55    // so passing in a size is nonsensical.
     56#if !PLATFORM(MAC)
     57    FrameView(Frame*, const IntSize& initialSize);
     58#endif
     59
    5360    virtual ~FrameView();
    5461
  • trunk/WebCore/platform/gtk/WidgetGtk.cpp

    r28728 r29369  
    8080Widget::~Widget()
    8181{
     82    ASSERT(!parent());
    8283    delete data;
    8384}
  • trunk/WebCore/platform/qt/WidgetQt.cpp

    r29166 r29369  
    8080Widget::~Widget()
    8181{
     82    Q_ASSERT(!parent());
    8283    delete data;
    8384    data = 0;
  • trunk/WebCore/rendering/RenderWidget.cpp

    r27263 r29369  
    126126    if (widget != m_widget) {
    127127        if (m_widget) {
     128            // removeFromParent is a no-op on Mac.
     129            m_widget->removeFromParent();
    128130            widgetRendererMap().remove(m_widget);
    129131            deleteWidget();
  • trunk/WebKit/win/ChangeLog

    r29347 r29369  
     12008-01-10  Adam Roben  <aroben@apple.com>
     2
     3        Fix many bugs by giving Windows one FrameView per page load
     4       
     5        Bugs include:
     6            <rdar://5659200>
     7                Windows back/forward cache causes crashes in the layout tests
     8            <rdar://5659355>
     9            <http://bugs.webkit.org/show_bug.cgi?id=16808>
     10                REGRESSION: PLT broken on Windows due to back/forward cache
     11            <rdar://5663654>
     12            <http://bugs.webkit.org/show_bug.cgi?id=16607>
     13                Random crashes in FrameView::scheduleRelayout while surfing
     14                Thinkgeek
     15
     16        On Windows until now we've only had one FrameView per Frame. Once the
     17        back/forward cache was turned on this started causing assertions to
     18        fail and crashes to occur due to a single FrameView being both in the
     19        back/forward cache (possibly multiple times!) and used by a live
     20        document. We now create a new FrameView for each page load, just as
     21        Mac does.
     22
     23        This has the side-effect of plugging some of the world leaks seen at
     24        the end of the PLT.
     25
     26        Reviewed by Hyatt.
     27
     28        * WebFrame.cpp:
     29        (WebFrame::initWithWebFrameView): Don't create the FrameView right
     30        away -- it'll be created when the load is committed.
     31        (WebFrame::transitionToCommittedFromCachedPage): Match the Mac by no
     32        longer calling resetMultipleFormSubmissionProtection here.
     33        (WebFrame::transitionToCommittedForNewPage): Ported code from
     34        -[WebCoreFrameBridge
     35        createFrameViewWithNSView:marginWidth:marginHeight:],
     36        -[WebCoreFrameBridge installInFrame:], and moved code here from
     37        WebFrame::initWithWebFrameView and WebView::initWithFrame. WebCore
     38        takes care of resetMultipleFormSubmissionProtection, just like it does
     39        on the Mac.
     40        * WebView.cpp:
     41        (WebView::initWithFrame): Moved FrameView initialization code to
     42        WebFrame::transitionToCommittedForNewPage.
     43
    1442008-01-09  Ada Chan  <adachan@apple.com>
    245
  • trunk/WebKit/win/WebFrame.cpp

    r28822 r29369  
    10701070    Frame* frame = new Frame(page, ownerElement, this);
    10711071    d->frame = frame;
    1072 
    1073     FrameView* frameView = new FrameView(frame);
    1074 
    1075     frame->setView(frameView);
    1076     frameView->deref(); // FrameViews are created with a ref count of 1. Release this ref since we've assigned it to frame.
    1077 
    1078     frameView->setContainingWindow(viewWindow);
    10791072}
    10801073
     
    18391832void WebFrame::transitionToCommittedFromCachedPage(CachedPage*)
    18401833{
    1841     transitionToCommittedForNewPage();
    18421834}
    18431835
    18441836void WebFrame::transitionToCommittedForNewPage()
    18451837{
    1846     ASSERT(core(this));
    1847 
    1848     // On the mac, this is done in Frame::setView, but since we don't have separate
    1849     // frame views, we'll just do it here instead.
    1850     core(this)->loader()->resetMultipleFormSubmissionProtection();
     1838    Frame* frame = core(this);
     1839    ASSERT(frame);
     1840
     1841    Page* page = frame->page();
     1842    ASSERT(page);
     1843
     1844    bool isMainFrame = frame == page->mainFrame();
     1845
     1846    if (isMainFrame && frame->view())
     1847        frame->view()->detachFromWindow();
     1848
     1849    frame->setView(0);
     1850
     1851    FrameView* frameView;
     1852    if (isMainFrame) {
     1853        RECT rect;
     1854        d->webView->frameRect(&rect);
     1855        frameView = new FrameView(frame, IntRect(rect).size());
     1856    } else
     1857        frameView = new FrameView(frame);
     1858
     1859    frame->setView(frameView);
     1860    frameView->deref(); // FrameViews are created with a ref count of 1. Release this ref since we've assigned it to frame.
     1861
     1862    HWND viewWindow;
     1863    if (SUCCEEDED(d->webView->viewWindow(reinterpret_cast<OLE_HANDLE*>(&viewWindow))))
     1864        frameView->setContainingWindow(viewWindow);
     1865
     1866    if (isMainFrame)
     1867        frameView->attachToWindow();
     1868
     1869    if (frame->ownerRenderer())
     1870        frame->ownerRenderer()->setWidget(frameView);
    18511871}
    18521872
  • trunk/WebKit/win/WebView.cpp

    r29347 r29369  
    20612061    m_mainFrame = webFrame;
    20622062    webFrame->Release(); // The WebFrame is owned by the Frame, so release our reference to it.
    2063     m_page->mainFrame()->view()->attachToWindow();
    2064     m_page->mainFrame()->view()->resize(frame.right - frame.left, frame.bottom - frame.top);
    20652063
    20662064    m_page->mainFrame()->tree()->setName(String(frameName, SysStringLen(frameName)));
Note: See TracChangeset for help on using the changeset viewer.