Changeset 67253 in webkit


Ignore:
Timestamp:
Sep 10, 2010 5:49:48 PM (14 years ago)
Author:
abarth@webkit.org
Message:

2010-09-10 Adam Barth <abarth@webkit.org>

Reviewed by Darin Fisher.

Move code from WebKit-layer to DocumentLoader
https://bugs.webkit.org/show_bug.cgi?id=45569

  • src/FrameLoaderClientImpl.cpp: (WebKit::FrameLoaderClientImpl::committedLoad):
  • src/WebFrameImpl.cpp: (WebKit::WebFrameImpl::commitDocumentData):

2010-09-10 Adam Barth <abarth@webkit.org>

Reviewed by Darin Fisher.

Move code from WebKit-layer to DocumentLoader
https://bugs.webkit.org/show_bug.cgi?id=45569

This code didn't know that setEncoding can be called multiple times.

  • WebCoreSupport/FrameLoaderClientQt.cpp: (WebCore::FrameLoaderClientQt::FrameLoaderClientQt): (WebCore::FrameLoaderClientQt::finishedLoading): (WebCore::FrameLoaderClientQt::setMainDocumentError): (WebCore::FrameLoaderClientQt::committedLoad): (WebCore::FrameLoaderClientQt::dispatchDidReceiveResponse): (WebCore::FrameLoaderClientQt::dispatchDidFailLoading):
  • WebCoreSupport/FrameLoaderClientQt.h:

2010-09-10 Adam Barth <abarth@webkit.org>

Reviewed by Darin Fisher.

Move code from WebKit-layer to DocumentLoader
https://bugs.webkit.org/show_bug.cgi?id=45569

  • WebCoreSupport/FrameLoaderClientGtk.cpp: (WebKit::FrameLoaderClient::committedLoad):

2010-09-10 Adam Barth <abarth@webkit.org>

Reviewed by Darin Fisher.

Move code from WebKit-layer to DocumentLoader
https://bugs.webkit.org/show_bug.cgi?id=45569

  • WebCoreSupport/WebFrameLoaderClient.cpp: (WebFrameLoaderClient::committedLoad):
  • WebCoreSupport/WebFrameLoaderClient.h:

2010-09-10 Adam Barth <abarth@webkit.org>

Reviewed by Darin Fisher.

Move code from WebKit-layer to DocumentLoader
https://bugs.webkit.org/show_bug.cgi?id=45569

  • WebKitSupport/FrameLoaderClientWx.cpp: (WebCore::FrameLoaderClientWx::committedLoad):

2010-09-10 Adam Barth <abarth@webkit.org>

Reviewed by Darin Fisher.

Move code from WebKit-layer to DocumentLoader
https://bugs.webkit.org/show_bug.cgi?id=45569

This code is the most confused, but now should be a bit cleaner.
There's still a magical fake-setting for creating renderers that needs
to be cleaned up, but we can do that in a separate patch.

  • WebView/WebFrame.mm: (-[WebFrame _commitData:]):
  • WebView/WebFrameInternal.h:
  • WebView/WebHTMLRepresentation.mm: (-[WebHTMLRepresentation receivedData:withDataSource:]): (-[WebHTMLRepresentation finishedLoadingWithDataSource:]):

2010-09-10 Adam Barth <abarth@webkit.org>

Reviewed by Darin Fisher.

Move code from WebKit-layer to DocumentLoader
https://bugs.webkit.org/show_bug.cgi?id=45569

  • WebCoreSupport/FrameLoaderClientHaiku.cpp: (WebCore::FrameLoaderClientHaiku::committedLoad):

2010-09-10 Adam Barth <abarth@webkit.org>

Reviewed by Darin Fisher.

Move code from WebKit-layer to DocumentLoader
https://bugs.webkit.org/show_bug.cgi?id=45569

This code didn't know that setEncoding could be called multiple times
safely.

  • WebCoreSupport/FrameLoaderClientEfl.cpp: (WebCore::FrameLoaderClientEfl::FrameLoaderClientEfl): (WebCore::FrameLoaderClientEfl::committedLoad): (WebCore::FrameLoaderClientEfl::dispatchDidReceiveResponse): (WebCore::FrameLoaderClientEfl::finishedLoading): (WebCore::FrameLoaderClientEfl::dispatchDidFailLoading): (WebCore::FrameLoaderClientEfl::setMainDocumentError):
  • WebCoreSupport/FrameLoaderClientEfl.h:

2010-09-10 Adam Barth <abarth@webkit.org>

Reviewed by Darin Fisher.

Move code from WebKit-layer to DocumentLoader
https://bugs.webkit.org/show_bug.cgi?id=45569

There's a bunch of code that's copy/pasted (poorly) across all the
ports that really belongs in WebCore. This patch moves that logic into
DocumentLoader. This patch is a step on the path to having
DocumentLoader own DocumentWriter.

  • WebCore.exp.in:
  • loader/DocumentLoader.cpp: (WebCore::DocumentLoader::commitData):
  • loader/DocumentLoader.h:
  • loader/FrameLoader.cpp: (WebCore::FrameLoader::finishedLoadingDocument):

2010-09-10 Adam Barth <abarth@webkit.org>

Reviewed by Darin Fisher.

Move code from WebKit-layer to DocumentLoader
https://bugs.webkit.org/show_bug.cgi?id=45569

This code looks copy/pasted from Mac. It's unclear whether whether all
the complexity is needed here, but I don't have a good way to find out.

  • WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::committedLoad):
  • WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
Location:
trunk
Files:
31 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r67252 r67253  
     12010-09-10  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Darin Fisher.
     4
     5        Move code from WebKit-layer to DocumentLoader
     6        https://bugs.webkit.org/show_bug.cgi?id=45569
     7
     8        There's a bunch of code that's copy/pasted (poorly) across all the
     9        ports that really belongs in WebCore.  This patch moves that logic into
     10        DocumentLoader.  This patch is a step on the path to having
     11        DocumentLoader own DocumentWriter.
     12
     13        * WebCore.exp.in:
     14        * loader/DocumentLoader.cpp:
     15        (WebCore::DocumentLoader::commitData):
     16        * loader/DocumentLoader.h:
     17        * loader/FrameLoader.cpp:
     18        (WebCore::FrameLoader::finishedLoadingDocument):
     19
    1202010-09-10  Cosmin Truta  <ctruta@chromium.org>
    221
  • trunk/WebCore/WebCore.exp.in

    r67238 r67253  
    291291__ZN7WebCore14CachedResource12removeClientEPNS_20CachedResourceClientE
    292292__ZN7WebCore14CachedResource9addClientEPNS_20CachedResourceClientE
     293__ZN7WebCore14DocumentLoader10commitDataEPKci
    293294__ZN7WebCore14DocumentLoader13attachToFrameEv
    294295__ZN7WebCore14DocumentLoader15detachFromFrameEv
     
    299300__ZN7WebCore14DocumentLoader22cancelMainResourceLoadERKNS_13ResourceErrorE
    300301__ZN7WebCore14DocumentLoader24removePlugInStreamLoaderEPNS_14ResourceLoaderE
    301 __ZN7WebCore14DocumentLoader7addDataEPKci
    302302__ZN7WebCore14DocumentLoader7requestEv
    303303__ZN7WebCore14DocumentLoader8setFrameEPNS_5FrameE
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r67226 r67253  
    2062820628                        buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
    2062920629                        compatibilityVersion = "Xcode 2.4";
    20630                         developmentRegion = English;
    2063120630                        hasScannedForEncodings = 1;
    2063220631                        knownRegions = (
  • trunk/WebCore/loader/DocumentLoader.cpp

    r67223 r67253  
    287287}
    288288
    289 void DocumentLoader::addData(const char* bytes, int length)
    290 {
    291     ASSERT(m_frame->document());
     289void DocumentLoader::commitData(const char* bytes, int length)
     290{
     291    // Set the text encoding.  This is safe to call multiple times.
     292    bool userChosen = true;
     293    String encoding = overrideEncoding();
     294    if (encoding.isNull()) {
     295        userChosen = false;
     296        encoding = response().textEncodingName();
     297    }
     298    // FIXME: DocumentWriter should be owned by DocumentLoader.
     299    m_frame->loader()->writer()->setEncoding(encoding, userChosen);
    292300    ASSERT(m_frame->document()->parsing());
    293     // FIXME: DocumentWriter should move to be owned by DocumentLoader.
    294     frameLoader()->writer()->addData(bytes, length);
     301    m_frame->loader()->writer()->addData(bytes, length);
    295302}
    296303
  • trunk/WebCore/loader/DocumentLoader.h

    r67223 r67253  
    212212        void resetTiming() { m_documentLoadTiming = DocumentLoadTiming(); }
    213213
    214         void addData(const char* bytes, int length);
     214        // The WebKit layer calls this function when it's ready for the data to
     215        // actually be added to the document.
     216        void commitData(const char* bytes, int length);
    215217
    216218#if ENABLE(OFFLINE_WEB_APPLICATIONS)
  • trunk/WebCore/loader/FrameLoader.cpp

    r67224 r67253  
    22272227        return;
    22282228
     2229    // FIXME: The remainder of this function should be in DocumentLoader.
     2230   
    22292231    loader->addAllArchiveResources(archive.get());
    2230    
     2232
    22312233    ArchiveResource* mainResource = archive->mainResource();
    22322234    loader->setParsedArchiveData(mainResource->data());
     
    22372239    didOpenURL(mainResource->url());
    22382240
     2241    ASSERT(m_frame->document());
    22392242    String userChosenEncoding = documentLoader()->overrideEncoding();
    22402243    bool encodingIsUserChosen = !userChosenEncoding.isNull();
    22412244    writer()->setEncoding(encodingIsUserChosen ? userChosenEncoding : mainResource->textEncoding(), encodingIsUserChosen);
    2242 
    2243     ASSERT(m_frame->document());
    2244 
    2245     loader->addData(mainResource->data()->data(), mainResource->data()->size());
     2245    writer()->addData(mainResource->data()->data(), mainResource->data()->size());
    22462246}
    22472247
  • trunk/WebKit/chromium/ChangeLog

    r67250 r67253  
     12010-09-10  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Darin Fisher.
     4
     5        Move code from WebKit-layer to DocumentLoader
     6        https://bugs.webkit.org/show_bug.cgi?id=45569
     7
     8        * src/FrameLoaderClientImpl.cpp:
     9        (WebKit::FrameLoaderClientImpl::committedLoad):
     10        * src/WebFrameImpl.cpp:
     11        (WebKit::WebFrameImpl::commitDocumentData):
     12
    1132010-09-10  Tony Chang  <tony@chromium.org>
    214
  • trunk/WebKit/chromium/src/FrameLoaderClientImpl.cpp

    r66794 r67253  
    10541054    // If we are sending data to MediaDocument, we should stop here
    10551055    // and cancel the request.
    1056     if (m_webFrame->frame()->document()
    1057         && m_webFrame->frame()->document()->isMediaDocument())
     1056    if (m_webFrame->frame()->document()->isMediaDocument())
    10581057        loader->cancelMainResourceLoad(pluginWillHandleLoadError(loader->response()));
    10591058
  • trunk/WebKit/chromium/src/WebFrameImpl.cpp

    r67250 r67253  
    10131013}
    10141014
    1015 // FIXME: This function should be moved into WebCore.
    10161015void WebFrameImpl::commitDocumentData(const char* data, size_t length)
    10171016{
    1018     DocumentLoader* documentLoader = m_frame->loader()->documentLoader();
    1019 
    1020     // Set the text encoding.  This calls begin() for us.  It is safe to call
    1021     // this multiple times (Mac does: page/mac/WebCoreFrameBridge.mm).
    1022     bool userChosen = true;
    1023     String encoding = documentLoader->overrideEncoding();
    1024     if (encoding.isNull()) {
    1025         userChosen = false;
    1026         encoding = documentLoader->response().textEncodingName();
    1027     }
    1028     m_frame->loader()->writer()->setEncoding(encoding, userChosen);
    1029     m_frame->loader()->documentLoader()->addData(data, length);
     1017    m_frame->loader()->documentLoader()->commitData(data, length);
    10301018}
    10311019
  • trunk/WebKit/efl/ChangeLog

    r67223 r67253  
     12010-09-10  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Darin Fisher.
     4
     5        Move code from WebKit-layer to DocumentLoader
     6        https://bugs.webkit.org/show_bug.cgi?id=45569
     7
     8        This code didn't know that setEncoding could be called multiple times
     9        safely.
     10
     11        * WebCoreSupport/FrameLoaderClientEfl.cpp:
     12        (WebCore::FrameLoaderClientEfl::FrameLoaderClientEfl):
     13        (WebCore::FrameLoaderClientEfl::committedLoad):
     14        (WebCore::FrameLoaderClientEfl::dispatchDidReceiveResponse):
     15        (WebCore::FrameLoaderClientEfl::finishedLoading):
     16        (WebCore::FrameLoaderClientEfl::dispatchDidFailLoading):
     17        (WebCore::FrameLoaderClientEfl::setMainDocumentError):
     18        * WebCoreSupport/FrameLoaderClientEfl.h:
     19
    1202010-09-10  Adam Barth  <abarth@webkit.org>
    221
  • trunk/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp

    r67223 r67253  
    6868    : m_view(view)
    6969    , m_frame(0)
    70     , m_firstData(false)
    7170    , m_userAgent("")
    7271    , m_customUserAgent("")
     
    183182}
    184183
    185 // FIXME: This function should be moved into WebCore.
    186184void FrameLoaderClientEfl::committedLoad(DocumentLoader* loader, const char* data, int length)
    187185{
    188     if (!m_pluginView) {
    189         if (!m_frame)
    190             return;
    191 
    192         FrameLoader* fl = loader->frameLoader();
    193         if (m_firstData) {
    194             fl->writer()->setEncoding(m_response.textEncodingName(), false);
    195             m_firstData = false;
    196         }
    197         fl->documentLoader()->addData(data, length);
    198     }
     186    if (!m_pluginView)
     187        loader->commitData(data, length);
    199188
    200189    // We re-check here as the plugin can have been created
     
    326315{
    327316    m_response = response;
    328     m_firstData = true;
    329317}
    330318
     
    720708void FrameLoaderClientEfl::finishedLoading(DocumentLoader* loader)
    721709{
    722     if (!m_pluginView) {
    723         if (m_firstData) {
    724             FrameLoader* fl = loader->frameLoader();
    725             fl->writer()->setEncoding(m_response.textEncodingName(), false);
    726             m_firstData = false;
    727         }
    728     } else {
    729         m_pluginView->didFinishLoading();
    730         m_pluginView = 0;
    731         m_hasSentResponseToPlugin = false;
    732     }
     710    if (!m_pluginView)
     711        return;
     712    m_pluginView->didFinishLoading();
     713    m_pluginView = 0;
     714    m_hasSentResponseToPlugin = false;
    733715}
    734716
     
    766748void FrameLoaderClientEfl::dispatchDidFailLoading(DocumentLoader* loader, unsigned long identifier, const ResourceError& err)
    767749{
    768     if (!shouldFallBack(err))
    769         return;
    770 
    771     if (m_firstData) {
    772         FrameLoader* fl = loader->frameLoader();
    773         fl->writer()->setEncoding(m_response.textEncodingName(), false);
    774         m_firstData = false;
    775     }
    776 
     750    notImplemented();
    777751}
    778752
     
    905879void FrameLoaderClientEfl::setMainDocumentError(DocumentLoader* loader, const ResourceError& error)
    906880{
    907     if (!m_pluginView) {
    908         if (m_firstData) {
    909             loader->frameLoader()->writer()->setEncoding(m_response.textEncodingName(), false);
    910             m_firstData = false;
    911         }
    912     } else {
    913         m_pluginView->didFail(error);
    914         m_pluginView = 0;
    915         m_hasSentResponseToPlugin = false;
    916     }
     881    if (!m_pluginView)
     882        return;
     883    m_pluginView->didFail(error);
     884    m_pluginView = 0;
     885    m_hasSentResponseToPlugin = false;
    917886}
    918887
  • trunk/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.h

    r66794 r67253  
    210210
    211211    ResourceResponse m_response;
    212     bool m_firstData;
    213212    String m_userAgent;
    214213    String m_customUserAgent;
  • trunk/WebKit/gtk/ChangeLog

    r67223 r67253  
     12010-09-10  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Darin Fisher.
     4
     5        Move code from WebKit-layer to DocumentLoader
     6        https://bugs.webkit.org/show_bug.cgi?id=45569
     7
     8        * WebCoreSupport/FrameLoaderClientGtk.cpp:
     9        (WebKit::FrameLoaderClient::committedLoad):
     10
    1112010-09-10  Adam Barth  <abarth@webkit.org>
    212
  • trunk/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp

    r67223 r67253  
    246246}
    247247
    248 // FIXME: This function should be moved into WebCore.
    249248void FrameLoaderClient::committedLoad(WebCore::DocumentLoader* loader, const char* data, int length)
    250249{
    251250    if (!m_pluginView) {
    252251        ASSERT(loader->frame());
    253         // Setting the encoding on the frame loader is our way to get work done that is normally done
    254         // when the first bit of data is received, even for the case of a document with no data (like about:blank).
    255         String encoding = loader->overrideEncoding();
    256         bool userChosen = !encoding.isNull();
    257         if (!userChosen)
    258             encoding = loader->response().textEncodingName();
    259 
    260         FrameLoader* frameLoader = loader->frameLoader();
    261         frameLoader->writer()->setEncoding(encoding, userChosen);
    262         if (data)
    263             frameLoader->documentLoader()->addData(data, length);
     252        loader->commitData(data, length);
    264253
    265254        Frame* coreFrame = loader->frame();
    266         if (coreFrame && coreFrame->document() && coreFrame->document()->isMediaDocument())
    267             loader->cancelMainResourceLoad(frameLoader->client()->pluginWillHandleLoadError(loader->response()));
     255        if (coreFrame && coreFrame->document()->isMediaDocument())
     256            loader->cancelMainResourceLoad(coreFrame->loader()->client()->pluginWillHandleLoadError(loader->response()));
    268257    }
    269258
  • trunk/WebKit/haiku/ChangeLog

    r67223 r67253  
     12010-09-10  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Darin Fisher.
     4
     5        Move code from WebKit-layer to DocumentLoader
     6        https://bugs.webkit.org/show_bug.cgi?id=45569
     7
     8        * WebCoreSupport/FrameLoaderClientHaiku.cpp:
     9        (WebCore::FrameLoaderClientHaiku::committedLoad):
     10
    1112010-09-10  Adam Barth  <abarth@webkit.org>
    212
  • trunk/WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.cpp

    r67223 r67253  
    505505}
    506506
    507 // FIXME: This function should be moved into WebCore.
    508507void FrameLoaderClientHaiku::committedLoad(WebCore::DocumentLoader* loader, const char* data, int length)
    509508{
    510     if (!m_frame)
    511         return;
    512 
    513     FrameLoader* frameLoader = loader->frameLoader();
    514     frameLoader->writer()->setEncoding(m_response.textEncodingName(), false);
    515     frameLoader->documentLoader()->addData(data, length);
     509    loader->commitData(data, length);
    516510}
    517511
  • trunk/WebKit/mac/ChangeLog

    r67238 r67253  
     12010-09-10  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Darin Fisher.
     4
     5        Move code from WebKit-layer to DocumentLoader
     6        https://bugs.webkit.org/show_bug.cgi?id=45569
     7
     8        This code is the most confused, but now should be a bit cleaner.
     9        There's still a magical fake-setting for creating renderers that needs
     10        to be cleaned up, but we can do that in a separate patch.
     11
     12        * WebView/WebFrame.mm:
     13        (-[WebFrame _commitData:]):
     14        * WebView/WebFrameInternal.h:
     15        * WebView/WebHTMLRepresentation.mm:
     16        (-[WebHTMLRepresentation receivedData:withDataSource:]):
     17        (-[WebHTMLRepresentation finishedLoadingWithDataSource:]):
     18
    1192010-09-09  Darin Adler  <darin@apple.com>
    220
  • trunk/WebKit/mac/WebView/WebFrame.mm

    r67238 r67253  
    488488}
    489489
    490 - (void)_addData:(NSData *)data
    491 {
    492     Document* document = _private->coreFrame->document();
    493 
    494     document->setShouldCreateRenderers(_private->shouldCreateRenderers);
    495     _private->coreFrame->loader()->documentLoader()->addData((const char *)[data bytes], [data length]);
    496 }
    497 
    498490- (NSString *)_stringWithDocumentTypeStringAndMarkupString:(NSString *)markupString
    499491{
     
    936928}
    937929
    938 - (void)_receivedData:(NSData *)data textEncodingName:(NSString *)textEncodingName
    939 {
    940     // Set the encoding. This only needs to be done once, but it's harmless to do it again later.
    941     String encoding = _private->coreFrame->loader()->documentLoader()->overrideEncoding();
    942     bool userChosen = !encoding.isNull();
    943     if (encoding.isNull())
    944         encoding = textEncodingName;
    945     _private->coreFrame->loader()->writer()->setEncoding(encoding, userChosen);
    946     [self _addData:data];
     930- (void)_commitData:(NSData *)data
     931{
     932    // FIXME: This really should be a setting.
     933    Document* document = _private->coreFrame->document();
     934    document->setShouldCreateRenderers(_private->shouldCreateRenderers);
     935
     936    _private->coreFrame->loader()->documentLoader()->commitData((const char *)[data bytes], [data length]);
    947937}
    948938
  • trunk/WebKit/mac/WebView/WebFrameInternal.h

    r66323 r67253  
    163163- (BOOL)_canSaveAsWebArchive;
    164164
    165 - (void)_receivedData:(NSData *)data textEncodingName:(NSString *)textEncodingName;
     165- (void)_commitData:(NSData *)data;
    166166
    167167@end
  • trunk/WebKit/mac/WebView/WebHTMLRepresentation.mm

    r67238 r67253  
    167167{
    168168    WebFrame *webFrame = [dataSource webFrame];
    169     if (webFrame) {
    170         if (!_private->pluginView)
    171             [webFrame _receivedData:data textEncodingName:[[_private->dataSource response] textEncodingName]];
     169    if (!webFrame)
     170        return;
     171
     172    if (!_private->pluginView)
     173        [webFrame _commitData:data];
     174
     175    // If the document is a stand-alone media document, now is the right time to cancel the WebKit load
     176    Frame* coreFrame = core(webFrame);
     177    if (coreFrame->document()->isMediaDocument())
     178        coreFrame->loader()->documentLoader()->cancelMainResourceLoad(coreFrame->loader()->client()->pluginWillHandleLoadError(coreFrame->loader()->documentLoader()->response()));
     179
     180    if (_private->pluginView) {
     181        if (!_private->hasSentResponseToPlugin) {
     182            [_private->manualLoader pluginView:_private->pluginView receivedResponse:[dataSource response]];
     183            _private->hasSentResponseToPlugin = YES;
     184        }
    172185       
    173         // If the document is a stand-alone media document, now is the right time to cancel the WebKit load
    174         Frame* coreFrame = core(webFrame);
    175         if (coreFrame->document() && coreFrame->document()->isMediaDocument())
    176             coreFrame->loader()->documentLoader()->cancelMainResourceLoad(coreFrame->loader()->client()->pluginWillHandleLoadError(coreFrame->loader()->documentLoader()->response()));
    177 
    178         if (_private->pluginView) {
    179             if (!_private->hasSentResponseToPlugin) {
    180                 [_private->manualLoader pluginView:_private->pluginView receivedResponse:[dataSource response]];
    181                 _private->hasSentResponseToPlugin = YES;
    182             }
    183            
    184             [_private->manualLoader pluginView:_private->pluginView receivedData:data];
    185         }
     186        [_private->manualLoader pluginView:_private->pluginView receivedData:data];
    186187    }
    187188}
     
    196197- (void)finishedLoadingWithDataSource:(WebDataSource *)dataSource
    197198{
    198     WebFrame *frame = [dataSource webFrame];
     199    WebFrame* webFrame = [dataSource webFrame];
    199200
    200201    if (_private->pluginView) {
     
    203204    }
    204205
    205     if (frame) {
    206         if (![self _isDisplayingWebArchive]) {
    207             // Telling the frame we received some data and passing nil as the data is our
    208             // way to get work done that is normally done when the first bit of data is
    209             // received, even for the case of a document with no data (like about:blank).
    210             [frame _receivedData:nil textEncodingName:[[_private->dataSource response] textEncodingName]];
    211         }
    212        
    213         WebView *webView = [frame webView];
    214         if ([webView isEditable])
    215             core(frame)->editor()->applyEditingStyleToBodyElement();
    216     }
     206    if (!webFrame)
     207        return;
     208
     209    if (![self _isDisplayingWebArchive]) {
     210        // Telling the frame we received some data and passing nil as the data is our
     211        // way to get work done that is normally done when the first bit of data is
     212        // received, even for the case of a document with no data (like about:blank).
     213        [webFrame _commitData:nil];
     214    }
     215
     216    WebView *webView = [webFrame webView];
     217    if ([webView isEditable])
     218        core(webFrame)->editor()->applyEditingStyleToBodyElement();
    217219}
    218220
  • trunk/WebKit/qt/ChangeLog

    r67223 r67253  
     12010-09-10  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Darin Fisher.
     4
     5        Move code from WebKit-layer to DocumentLoader
     6        https://bugs.webkit.org/show_bug.cgi?id=45569
     7
     8        This code didn't know that setEncoding can be called multiple times.
     9
     10        * WebCoreSupport/FrameLoaderClientQt.cpp:
     11        (WebCore::FrameLoaderClientQt::FrameLoaderClientQt):
     12        (WebCore::FrameLoaderClientQt::finishedLoading):
     13        (WebCore::FrameLoaderClientQt::setMainDocumentError):
     14        (WebCore::FrameLoaderClientQt::committedLoad):
     15        (WebCore::FrameLoaderClientQt::dispatchDidReceiveResponse):
     16        (WebCore::FrameLoaderClientQt::dispatchDidFailLoading):
     17        * WebCoreSupport/FrameLoaderClientQt.h:
     18
    1192010-09-10  Adam Barth  <abarth@webkit.org>
    220
  • trunk/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp

    r67223 r67253  
    190190    : m_frame(0)
    191191    , m_webFrame(0)
    192     , m_firstData(false)
    193192    , m_pluginView(0)
    194193    , m_hasSentResponseToPlugin(false)
     
    582581void FrameLoaderClientQt::finishedLoading(DocumentLoader* loader)
    583582{
    584     if (!m_pluginView) {
    585         if(m_firstData) {
    586             FrameLoader *fl = loader->frameLoader();
    587             fl->writer()->setEncoding(m_response.textEncodingName(), false);
    588             m_firstData = false;
    589         }
    590     }
    591     else {
    592         if (m_pluginView->isPluginView())
    593             m_pluginView->didFinishLoading();
    594         m_pluginView = 0;
    595         m_hasSentResponseToPlugin = false;
    596     }
     583    if (!m_pluginView)
     584        return;
     585    if (m_pluginView->isPluginView())
     586        m_pluginView->didFinishLoading();
     587    m_pluginView = 0;
     588    m_hasSentResponseToPlugin = false;
    597589}
    598590
     
    777769void FrameLoaderClientQt::setMainDocumentError(WebCore::DocumentLoader* loader, const WebCore::ResourceError& error)
    778770{
    779     if (!m_pluginView) {
    780         if (m_firstData) {
    781             loader->frameLoader()->writer()->setEncoding(m_response.textEncodingName(), false);
    782             m_firstData = false;
    783         }
    784     } else {
    785         if (m_pluginView->isPluginView())
    786             m_pluginView->didFail(error);
    787         m_pluginView = 0;
    788         m_hasSentResponseToPlugin = false;
    789     }
     771    if (!m_pluginView)
     772        return;
     773    if (m_pluginView->isPluginView())
     774        m_pluginView->didFail(error);
     775    m_pluginView = 0;
     776    m_hasSentResponseToPlugin = false;
    790777}
    791778
     
    793780void FrameLoaderClientQt::committedLoad(WebCore::DocumentLoader* loader, const char* data, int length)
    794781{
    795     if (!m_pluginView) {
    796         if (!m_frame)
    797             return;
    798         FrameLoader *fl = loader->frameLoader();
    799         if (m_firstData) {
    800             fl->writer()->setEncoding(m_response.textEncodingName(), false);
    801             m_firstData = false;
    802         }
    803         fl->documentLoader()->addData(data, length);
    804     }
     782    if (!m_pluginView)
     783        loader->commitData(data, length);
    805784   
    806785    // We re-check here as the plugin can have been created
     
    963942
    964943    m_response = response;
    965     m_firstData = true;
    966944    if (dumpResourceLoadCallbacks)
    967945        printf("%s - didReceiveResponse %s\n",
     
    993971               (dumpAssignedUrls.contains(identifier) ? qPrintable(dumpAssignedUrls[identifier]) : "<unknown>"),
    994972               qPrintable(drtDescriptionSuitableForTestResult(error)));
    995 
    996     if (m_firstData) {
    997         FrameLoader *fl = loader->frameLoader();
    998         fl->writer()->setEncoding(m_response.textEncodingName(), false);
    999         m_firstData = false;
    1000     }
    1001973}
    1002974
  • trunk/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h

    r66794 r67253  
    233233    QWebFrame *m_webFrame;
    234234    ResourceResponse m_response;
    235     bool m_firstData;
    236235
    237236    // Plugin view to redirect data to
  • trunk/WebKit/win/ChangeLog

    r67238 r67253  
     12010-09-10  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Darin Fisher.
     4
     5        Move code from WebKit-layer to DocumentLoader
     6        https://bugs.webkit.org/show_bug.cgi?id=45569
     7
     8        * WebCoreSupport/WebFrameLoaderClient.cpp:
     9        (WebFrameLoaderClient::committedLoad):
     10        * WebCoreSupport/WebFrameLoaderClient.h:
     11
    1122010-09-09  Darin Adler  <darin@apple.com>
    213
  • trunk/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp

    r67223 r67253  
    492492void WebFrameLoaderClient::committedLoad(DocumentLoader* loader, const char* data, int length)
    493493{
    494     // FIXME: This should probably go through the data source.
    495     const String& textEncoding = loader->response().textEncodingName();
    496 
    497494    if (!m_manualLoader)
    498         receivedData(data, length, textEncoding);
     495        loader->commitData(data, length);
    499496
    500497    if (!m_manualLoader)
     
    511508    }
    512509    m_manualLoader->didReceiveData(data, length);
    513 }
    514 
    515 // FIXME: This function should be moved into WebCore.
    516 void WebFrameLoaderClient::receivedData(const char* data, int length, const String& textEncoding)
    517 {
    518     Frame* coreFrame = core(m_webFrame);
    519     if (!coreFrame)
    520         return;
    521 
    522     // Set the encoding. This only needs to be done once, but it's harmless to do it again later.
    523     String encoding = coreFrame->loader()->documentLoader()->overrideEncoding();
    524     bool userChosen = !encoding.isNull();
    525     if (encoding.isNull())
    526         encoding = textEncoding;
    527     coreFrame->loader()->writer()->setEncoding(encoding, userChosen);
    528     coreFrame->loader()->documentLoader()->addData(data, length);
    529510}
    530511
  • trunk/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h

    r65021 r67253  
    127127private:
    128128    PassRefPtr<WebCore::Frame> createFrame(const WebCore::KURL&, const WTF::String& name, WebCore::HTMLFrameOwnerElement*, const WTF::String& referrer);
    129     void receivedData(const char*, int, const WTF::String&);
    130129    WebHistory* webHistory() const;
    131130
  • trunk/WebKit/wx/ChangeLog

    r67223 r67253  
     12010-09-10  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Darin Fisher.
     4
     5        Move code from WebKit-layer to DocumentLoader
     6        https://bugs.webkit.org/show_bug.cgi?id=45569
     7
     8        * WebKitSupport/FrameLoaderClientWx.cpp:
     9        (WebCore::FrameLoaderClientWx::committedLoad):
     10
    1112010-09-10  Adam Barth  <abarth@webkit.org>
    212
  • trunk/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp

    r67223 r67253  
    618618    if (!m_webFrame)
    619619        return;
    620     if (!m_pluginView) {
    621         FrameLoader* fl = loader->frameLoader();
    622         fl->writer()->setEncoding(m_response.textEncodingName(), false);
    623         fl->documentLoader()->addData(data, length);
    624     }
    625    
     620    if (!m_pluginView)
     621        loader->commitData(data, length);
     622
    626623    // We re-check here as the plugin can have been created
    627624    if (m_pluginView) {
  • trunk/WebKit2/ChangeLog

    r67247 r67253  
     12010-09-10  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Darin Fisher.
     4
     5        Move code from WebKit-layer to DocumentLoader
     6        https://bugs.webkit.org/show_bug.cgi?id=45569
     7
     8        This code looks copy/pasted from Mac.  It's unclear whether whether all
     9        the complexity is needed here, but I don't have a good way to find out.
     10
     11        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
     12        (WebKit::WebFrameLoaderClient::committedLoad):
     13        * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
     14
    1152010-09-10  Anders Carlsson  <andersca@apple.com>
    216
  • trunk/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp

    r67223 r67253  
    600600void WebFrameLoaderClient::committedLoad(DocumentLoader* loader, const char* data, int length)
    601601{
    602     const String& textEncoding = loader->response().textEncodingName();
    603    
    604602    if (!m_pluginView)
    605         receivedData(data, length, textEncoding);
    606 
    607     // Calling receivedData did not create the plug-in view.
     603        loader->commitData(data, length);
     604
     605    // Calling commitData did not create the plug-in view.
    608606    if (!m_pluginView)
    609607        return;
     
    621619}
    622620
    623 // FIXME: This function should be moved into WebCore.
    624 void WebFrameLoaderClient::receivedData(const char* data, int length, const String& textEncoding)
    625 {
    626     Frame* coreFrame = m_frame->coreFrame();
    627     if (!coreFrame)
    628         return;
    629    
    630     // Set the encoding. This only needs to be done once, but it's harmless to do it again later.
    631     String encoding = coreFrame->loader()->documentLoader()->overrideEncoding();
    632     bool userChosen = !encoding.isNull();
    633     if (encoding.isNull())
    634         encoding = textEncoding;
    635     coreFrame->loader()->writer()->setEncoding(encoding, userChosen);
    636    
    637     coreFrame->loader()->documentLoader()->addData(data, length);
    638 }
    639 
    640621void WebFrameLoaderClient::finishedLoading(DocumentLoader* loader)
    641622{
  • trunk/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h

    r66794 r67253  
    204204    virtual bool shouldUsePluginDocument(const WTF::String& /*mimeType*/) const;
    205205   
    206     void receivedData(const char* data, int length, const WTF::String& textEncoding);
    207 
    208206    virtual PassRefPtr<WebCore::FrameNetworkingContext> createNetworkingContext();
    209207   
Note: See TracChangeset for help on using the changeset viewer.