2010-12-06 Nate Chapin <japhet@chromium.org>
authorjaphet@chromium.org <japhet@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 6 Dec 2010 21:11:20 +0000 (21:11 +0000)
committerjaphet@chromium.org <japhet@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 6 Dec 2010 21:11:20 +0000 (21:11 +0000)
        Reviewed by Adam Barth.

        Make DocumentWriter a member of DocumentLoader
        instead of FrameLoader.
        https://bugs.webkit.org/show_bug.cgi?id=50489

        Refactor, no new tests.

        * bindings/ScriptControllerBase.cpp:
        (WebCore::ScriptController::executeIfJavaScriptURL):
        * dom/Document.cpp:
        (WebCore::Document::Document):
        (WebCore::Document::close):
        (WebCore::Document::lastModified):
        (WebCore::Document::finishedParsing):
        (WebCore::Document::initSecurityContext):
        (WebCore::Document::updateURLForPushOrReplaceState):
        * dom/Document.h:
        (WebCore::Document::setDocumentLoader):
        (WebCore::Document::loader):
        * dom/ProcessingInstruction.cpp:
        (WebCore::ProcessingInstruction::checkStyleSheet):
        * dom/ScriptElement.cpp:
        (WebCore::ScriptElement::scriptCharset):
        * html/HTMLLinkElement.cpp:
        (WebCore::HTMLLinkElement::process):
        * html/MediaDocument.cpp:
        (WebCore::MediaDocument::replaceMediaElementTimerFired):
        * html/PluginDocument.cpp:
        (WebCore::PluginDocumentParser::createDocumentStructure):
        * loader/DocumentLoader.cpp:
        (WebCore::DocumentLoader::DocumentLoader):
        (WebCore::DocumentLoader::finishedLoading):
        (WebCore::DocumentLoader::commitData):
        (WebCore::DocumentLoader::setupForReplaceByMIMEType):
        (WebCore::DocumentLoader::setFrame):
        * loader/DocumentLoader.h:
        (WebCore::DocumentLoader::writer):
        * loader/DocumentWriter.h:
        (WebCore::DocumentWriter::setFrame):
        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::FrameLoader):
        (WebCore::FrameLoader::init):
        (WebCore::FrameLoader::clear):
        (WebCore::FrameLoader::receivedFirstData):
        (WebCore::FrameLoader::transitionToCommitted):
        (WebCore::FrameLoader::open):
        (WebCore::FrameLoader::finishedLoadingDocument):
        (WebCore::FrameLoader::addExtraFieldsToRequest):
        * loader/FrameLoader.h:
        (WebCore::FrameLoader::notifier):
        * loader/cache/CachedResourceLoader.cpp:
        (WebCore::CachedResourceLoader::requestPreload):
        * platform/network/FormDataBuilder.cpp:
        (WebCore::FormDataBuilder::encodingFromAcceptCharset):
        * svg/graphics/SVGImage.cpp:
        (WebCore::SVGImage::dataChanged):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@73392 268f45cc-cd09-0410-ab3c-d52691b4dbfc

37 files changed:
WebCore/ChangeLog
WebCore/bindings/ScriptControllerBase.cpp
WebCore/dom/Document.cpp
WebCore/dom/Document.h
WebCore/dom/ProcessingInstruction.cpp
WebCore/dom/ScriptElement.cpp
WebCore/html/HTMLLinkElement.cpp
WebCore/html/MediaDocument.cpp
WebCore/html/PluginDocument.cpp
WebCore/loader/DocumentLoader.cpp
WebCore/loader/DocumentLoader.h
WebCore/loader/DocumentWriter.cpp
WebCore/loader/DocumentWriter.h
WebCore/loader/FrameLoader.cpp
WebCore/loader/FrameLoader.h
WebCore/loader/cache/CachedResourceLoader.cpp
WebCore/platform/network/FormDataBuilder.cpp
WebCore/svg/graphics/SVGImage.cpp
WebKit/chromium/ChangeLog
WebKit/chromium/src/ContextMenuClientImpl.cpp
WebKit/chromium/src/FrameLoaderClientImpl.cpp
WebKit/chromium/src/WebFrameImpl.cpp
WebKit/chromium/src/WebPageSerializerImpl.cpp
WebKit/chromium/src/WebSearchableFormData.cpp
WebKit/chromium/src/WebViewImpl.cpp
WebKit/gtk/ChangeLog
WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
WebKit/gtk/webkit/webkitwebview.cpp
WebKit/mac/ChangeLog
WebKit/mac/WebView/WebFrame.mm
WebKit/qt/Api/qwebframe.cpp
WebKit/qt/ChangeLog
WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
WebKit/wince/ChangeLog
WebKit/wince/WebCoreSupport/FrameLoaderClientWinCE.cpp
WebKit/wx/ChangeLog
WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp

index 3348d43..0a8386c 100644 (file)
@@ -1,3 +1,63 @@
+2010-12-06  Nate Chapin  <japhet@chromium.org>
+
+        Reviewed by Adam Barth.
+
+        Make DocumentWriter a member of DocumentLoader
+        instead of FrameLoader.
+        https://bugs.webkit.org/show_bug.cgi?id=50489
+
+        Refactor, no new tests.
+
+        * bindings/ScriptControllerBase.cpp:
+        (WebCore::ScriptController::executeIfJavaScriptURL):
+        * dom/Document.cpp:
+        (WebCore::Document::Document):
+        (WebCore::Document::close):
+        (WebCore::Document::lastModified):
+        (WebCore::Document::finishedParsing):
+        (WebCore::Document::initSecurityContext):
+        (WebCore::Document::updateURLForPushOrReplaceState):
+        * dom/Document.h:
+        (WebCore::Document::setDocumentLoader):
+        (WebCore::Document::loader):
+        * dom/ProcessingInstruction.cpp:
+        (WebCore::ProcessingInstruction::checkStyleSheet):
+        * dom/ScriptElement.cpp:
+        (WebCore::ScriptElement::scriptCharset):
+        * html/HTMLLinkElement.cpp:
+        (WebCore::HTMLLinkElement::process):
+        * html/MediaDocument.cpp:
+        (WebCore::MediaDocument::replaceMediaElementTimerFired):
+        * html/PluginDocument.cpp:
+        (WebCore::PluginDocumentParser::createDocumentStructure):
+        * loader/DocumentLoader.cpp:
+        (WebCore::DocumentLoader::DocumentLoader):
+        (WebCore::DocumentLoader::finishedLoading):
+        (WebCore::DocumentLoader::commitData):
+        (WebCore::DocumentLoader::setupForReplaceByMIMEType):
+        (WebCore::DocumentLoader::setFrame):
+        * loader/DocumentLoader.h:
+        (WebCore::DocumentLoader::writer):
+        * loader/DocumentWriter.h:
+        (WebCore::DocumentWriter::setFrame):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::FrameLoader):
+        (WebCore::FrameLoader::init):
+        (WebCore::FrameLoader::clear):
+        (WebCore::FrameLoader::receivedFirstData):
+        (WebCore::FrameLoader::transitionToCommitted):
+        (WebCore::FrameLoader::open):
+        (WebCore::FrameLoader::finishedLoadingDocument):
+        (WebCore::FrameLoader::addExtraFieldsToRequest):
+        * loader/FrameLoader.h:
+        (WebCore::FrameLoader::notifier):
+        * loader/cache/CachedResourceLoader.cpp:
+        (WebCore::CachedResourceLoader::requestPreload):
+        * platform/network/FormDataBuilder.cpp:
+        (WebCore::FormDataBuilder::encodingFromAcceptCharset):
+        * svg/graphics/SVGImage.cpp:
+        (WebCore::SVGImage::dataChanged):
+
 2010-12-06  Mark Rowe  <mrowe@apple.com>
 
         Build fix.
index a77ff9c..3c50db2 100644 (file)
@@ -112,7 +112,7 @@ bool ScriptController::executeIfJavaScriptURL(const KURL& url, ShouldReplaceDocu
     //        synchronously can cause crashes:
     //        http://bugs.webkit.org/show_bug.cgi?id=16782
     if (shouldReplaceDocumentIfJavaScriptURL == ReplaceDocumentIfJavaScriptURL)
-        m_frame->loader()->writer()->replaceDocument(scriptResult);
+        m_frame->document()->loader()->writer()->replaceDocument(scriptResult);
 
     return true;
 }
index c088e4e..e182214 100644 (file)
@@ -427,6 +427,7 @@ Document::Document(Frame* frame, const KURL& url, bool isXHTML, bool isHTML, con
     m_ignoreAutofocus = false;
 
     m_frame = frame;
+    m_documentLoader = frame ? frame->loader()->activeDocumentLoader() : 0;
 
     if (frame || !url.isEmpty())
         setURL(url);
@@ -2053,9 +2054,8 @@ void Document::close()
     Frame* frame = this->frame();
     if (frame) {
         // This code calls implicitClose() if all loading has completed.
-        FrameLoader* frameLoader = frame->loader();
-        frameLoader->writer()->endIfNotLoadingMainResource();
-        frameLoader->checkCompleted();
+        loader()->writer()->endIfNotLoadingMainResource();
+        frame->loader()->checkCompleted();
     } else {
         // Because we have no frame, we don't know if all loading has completed,
         // so we just call implicitClose() immediately. FIXME: This might fire
@@ -3712,7 +3712,7 @@ String Document::lastModified() const
     DateComponents date;
     bool foundDate = false;
     if (m_frame) {
-        String httpLastModified = m_frame->loader()->documentLoader()->response().httpHeaderField("Last-Modified");
+        String httpLastModified = m_documentLoader->response().httpHeaderField("Last-Modified");
         if (!httpLastModified.isEmpty()) {
             date.setMillisecondsSinceEpochForDateTime(parseDate(httpLastModified));
             foundDate = true;
@@ -4230,7 +4230,7 @@ void Document::finishedParsing()
             return;
 
         if (InspectorController* controller = page()->inspectorController())
-            controller->mainResourceFiredDOMContentEvent(f->loader()->documentLoader(), url());
+            controller->mainResourceFiredDOMContentEvent(m_documentLoader, url());
 #endif
     }
 }
@@ -4444,8 +4444,7 @@ void Document::initSecurityContext()
         // load local resources.  See https://bugs.webkit.org/show_bug.cgi?id=16756
         // and https://bugs.webkit.org/show_bug.cgi?id=19760 for further
         // discussion.
-        DocumentLoader* documentLoader = m_frame->loader()->documentLoader();
-        if (documentLoader && documentLoader->substituteData().isValid())
+        if (m_documentLoader->substituteData().isValid())
             securityOrigin()->grantLoadLocalResources();
     }
 
@@ -4525,7 +4524,7 @@ void Document::updateURLForPushOrReplaceState(const KURL& url)
     // FIXME: Eliminate this redundancy.
     setURL(url);
     f->loader()->setURL(url);
-    f->loader()->documentLoader()->replaceRequestURLForSameDocumentNavigation(url);
+    m_documentLoader->replaceRequestURLForSameDocumentNavigation(url);
 }
 
 void Document::statePopped(SerializedScriptValue* stateObject)
index 476e25b..bc06883 100644 (file)
@@ -33,6 +33,7 @@
 #include "CollectionType.h"
 #include "Color.h"
 #include "ContainerNode.h"
+#include "DocumentLoader.h"
 #include "DocumentMarkerController.h"
 #include "DocumentTiming.h"
 #include "QualifiedName.h"
@@ -55,6 +56,7 @@ class Attr;
 class AXObjectCache;
 class CDATASection;
 class CachedCSSStyleSheet;
+class CachedResourceLoader;
 class CachedScript;
 class CanvasRenderingContext;
 class CharacterData;
@@ -67,7 +69,6 @@ class DOMImplementation;
 class DOMSelection;
 class DOMWindow;
 class DatabaseThread;
-class CachedResourceLoader;
 class DocumentFragment;
 class DocumentType;
 class DocumentWeakReference;
@@ -548,6 +549,9 @@ public:
     // to get visually ordered hebrew and arabic pages right
     void setVisuallyOrdered();
     bool visuallyOrdered() const { return m_visuallyOrdered; }
+    
+    void setDocumentLoader(DocumentLoader* documentLoader) { m_documentLoader = documentLoader; }
+    DocumentLoader* loader() const { return m_documentLoader; }
 
     void open(Document* ownerDocument = 0);
     void implicitOpen();
@@ -1136,6 +1140,7 @@ private:
     bool m_didCalculateStyleSelector;
 
     Frame* m_frame;
+    DocumentLoader* m_documentLoader;
     OwnPtr<CachedResourceLoader> m_cachedResourceLoader;
     RefPtr<DocumentParser> m_parser;
     bool m_wellFormed;
index 544d789..b891310 100644 (file)
@@ -168,7 +168,7 @@ void ProcessingInstruction::checkStyleSheet()
             {
                 String charset = attrs.get("charset");
                 if (charset.isEmpty())
-                    charset = document()->frame()->loader()->writer()->encoding();
+                    charset = document()->loader()->writer()->encoding();
 
                 m_cachedSheet = document()->cachedResourceLoader()->requestCSSStyleSheet(url, charset);
             }
index 74f2580..72878d2 100644 (file)
@@ -292,8 +292,8 @@ String ScriptElement::scriptCharset() const
 
     // If charset has not been declared in script tag, fall back to frame encoding.
     if (charset.isEmpty()) {
-        if (Frame* frame = m_element->document()->frame())
-            charset = frame->loader()->writer()->encoding();
+        if (DocumentLoader* loader = m_element->document()->loader())
+            charset = loader->writer()->encoding();
     }
 
     return charset;
index 319e759..f928138 100644 (file)
@@ -230,8 +230,8 @@ void HTMLLinkElement::process()
         // also, don't load style sheets for standalone documents
         
         String charset = getAttribute(charsetAttr);
-        if (charset.isEmpty() && document()->frame())
-            charset = document()->frame()->loader()->writer()->encoding();
+        if (charset.isEmpty())
+            charset = document()->loader()->writer()->encoding();
 
         if (m_cachedSheet) {
             if (m_loading)
index af66795..72b9f78 100644 (file)
@@ -208,7 +208,7 @@ void MediaDocument::replaceMediaElementTimerFired(Timer<MediaDocument>*)
         embedElement->setAttribute(heightAttr, "100%");
         embedElement->setAttribute(nameAttr, "plugin");
         embedElement->setAttribute(srcAttr, url().string());
-        embedElement->setAttribute(typeAttr, frame()->loader()->writer()->mimeType());
+        embedElement->setAttribute(typeAttr, loader()->writer()->mimeType());
 
         ExceptionCode ec;
         videoElement->parentNode()->replaceChild(embedElement, videoElement, ec);
index cebb949..bcb6d3a 100644 (file)
@@ -91,7 +91,7 @@ void PluginDocumentParser::createDocumentStructure()
     
     m_embedElement->setAttribute(nameAttr, "plugin");
     m_embedElement->setAttribute(srcAttr, document()->url().string());
-    m_embedElement->setAttribute(typeAttr, document()->frame()->loader()->writer()->mimeType());
+    m_embedElement->setAttribute(typeAttr, document()->loader()->writer()->mimeType());
 
     static_cast<PluginDocument*>(document())->setPluginNode(m_embedElement);
 
index 2f21066..66837d2 100644 (file)
@@ -37,6 +37,7 @@
 #include "DOMWindow.h"
 #include "Document.h"
 #include "DocumentParser.h"
+#include "DocumentWriter.h"
 #include "Event.h"
 #include "Frame.h"
 #include "FrameLoader.h"
@@ -49,7 +50,7 @@
 #include "PlatformString.h"
 #include "Settings.h"
 #include "SharedBuffer.h"
-
+#include "TextResourceDecoder.h"
 #include <wtf/Assertions.h>
 #include <wtf/text/CString.h>
 #include <wtf/unicode/Unicode.h>
@@ -77,6 +78,7 @@ static void setAllDefersLoading(const ResourceLoaderSet& loaders, bool defers)
 DocumentLoader::DocumentLoader(const ResourceRequest& req, const SubstituteData& substituteData)
     : m_deferMainResourceDataLoad(true)
     , m_frame(0)
+    , m_writer(m_frame)
     , m_originalRequest(req)
     , m_substituteData(substituteData)
     , m_originalRequestCopy(req)
@@ -276,7 +278,7 @@ void DocumentLoader::finishedLoading()
     commitIfReady();
     if (FrameLoader* loader = frameLoader()) {
         loader->finishedLoadingDocument(this);
-        loader->writer()->end();
+        m_writer.end();
     }
 }
 
@@ -304,10 +306,9 @@ void DocumentLoader::commitData(const char* bytes, int length)
         userChosen = false;
         encoding = response().textEncodingName();
     }
-    // FIXME: DocumentWriter should be owned by DocumentLoader.
-    m_frame->loader()->writer()->setEncoding(encoding, userChosen);
+    m_writer.setEncoding(encoding, userChosen);
     ASSERT(m_frame->document()->parsing());
-    m_frame->loader()->writer()->addData(bytes, length);
+    m_writer.addData(bytes, length);
 }
 
 bool DocumentLoader::doesProgressiveLoad(const String& MIMEType) const
@@ -337,7 +338,7 @@ void DocumentLoader::setupForReplaceByMIMEType(const String& newMIMEType)
     }
     
     frameLoader()->finishedLoadingDocument(this);
-    m_frame->loader()->writer()->end();
+    m_writer.end();
     
     frameLoader()->setReplacing();
     m_gotFirstByte = false;
@@ -374,6 +375,7 @@ void DocumentLoader::setFrame(Frame* frame)
         return;
     ASSERT(frame && !m_frame);
     m_frame = frame;
+    m_writer.setFrame(frame);
     attachToFrame();
 }
 
index e1f75ed..63e5f43 100644 (file)
@@ -30,6 +30,7 @@
 #define DocumentLoader_h
 
 #include "DocumentLoadTiming.h"
+#include "DocumentWriter.h"
 #include "NavigationAction.h"
 #include "ResourceError.h"
 #include "ResourceRequest.h"
@@ -72,6 +73,8 @@ namespace WebCore {
         FrameLoader* frameLoader() const;
         MainResourceLoader* mainResourceLoader() const { return m_mainResourceLoader.get(); }
         PassRefPtr<SharedBuffer> mainResourceData() const;
+        
+        DocumentWriter* writer() const { return &m_writer; }
 
         const ResourceRequest& originalRequest() const;
         const ResourceRequest& originalRequestCopy() const;
@@ -246,6 +249,8 @@ namespace WebCore {
         ResourceLoaderSet m_plugInStreamLoaders;
 
         RefPtr<SharedBuffer> m_mainResourceData;
+        
+        mutable DocumentWriter m_writer;
 
         // A reference to actual request used to create the data source.
         // This should only be used by the resourceLoadDelegate's
index 5b03cd7..8b75ee6 100644 (file)
@@ -123,6 +123,7 @@ void DocumentWriter::begin(const KURL& url, bool dispatch, SecurityOrigin* origi
 
     bool resetScripting = !(m_frame->loader()->stateMachine()->isDisplayingInitialEmptyDocument() && m_frame->document()->securityOrigin()->isSecureTransitionTo(url));
     m_frame->loader()->clear(resetScripting, resetScripting);
+    clear();
     if (resetScripting)
         m_frame->script()->updatePlatformScriptObjects();
 
index 5fb3dc1..78db16c 100644 (file)
@@ -52,7 +52,8 @@ public:
     void addData(const char* string, int length = -1, bool flush = false);
     void end();
     void endIfNotLoadingMainResource();
-    void clear();
+    
+    void setFrame(Frame* frame) { m_frame = frame; }
 
     String encoding() const;
     void setEncoding(const String& encoding, bool userChosen);
@@ -75,6 +76,7 @@ public:
 
 private:
     PassRefPtr<Document> createDocument(const KURL&);
+    void clear();
 
     Frame* m_frame;
 
index 35a492b..25ca6a4 100644 (file)
@@ -178,7 +178,6 @@ FrameLoader::FrameLoader(Frame* frame, FrameLoaderClient* client)
     , m_policyChecker(frame)
     , m_history(frame)
     , m_notifer(frame)
-    , m_writer(frame)
     , m_subframeLoader(frame)
     , m_state(FrameStateCommittedPage)
     , m_loadType(FrameLoadTypeStandard)
@@ -232,8 +231,8 @@ void FrameLoader::init()
     setState(FrameStateProvisional);
     m_provisionalDocumentLoader->setResponse(ResourceResponse(KURL(), "text/html", 0, String(), String()));
     m_provisionalDocumentLoader->finishedLoading();
-    writer()->begin(KURL(), false);
-    writer()->end();
+    m_documentLoader->writer()->begin(KURL(), false);
+    m_documentLoader->writer()->end();
     m_frame->document()->cancelParsing();
     m_stateMachine.advanceTo(FrameLoaderStateMachine::DisplayingInitialEmptyDocument);
     m_didCallImplicitClose = true;
@@ -592,7 +591,6 @@ void FrameLoader::clear(bool clearWindowProperties, bool clearScriptObjects, boo
     // Do not drop the document before the ScriptController and view are cleared
     // as some destructors might still try to access the document.
     m_frame->setDocument(0);
-    writer()->clear();
 
     m_subframeLoader.clear();
 
@@ -611,8 +609,8 @@ void FrameLoader::clear(bool clearWindowProperties, bool clearScriptObjects, boo
 
 void FrameLoader::receivedFirstData()
 {
-    writer()->begin(m_workingURL, false);
-    writer()->setDocumentWasLoadedAsPartOfNavigation();
+    activeDocumentLoader()->writer()->begin(m_workingURL, false);
+    activeDocumentLoader()->writer()->setDocumentWasLoadedAsPartOfNavigation();
 
     dispatchDidCommitLoad();
     dispatchDidClearWindowObjectsInAllWorlds();
@@ -2012,7 +2010,7 @@ void FrameLoader::transitionToCommitted(PassRefPtr<CachedPage> cachedPage)
             ASSERT_NOT_REACHED();
     }
 
-    writer()->setMIMEType(dl->responseMIMEType());
+    m_documentLoader->writer()->setMIMEType(dl->responseMIMEType());
 
     // Tell the client we've committed this URL.
     ASSERT(m_frame->view());
@@ -2148,8 +2146,6 @@ void FrameLoader::open(CachedFrameBase& cachedFrame)
     m_frame->domWindow()->setURL(document->url());
     m_frame->domWindow()->setSecurityOrigin(document->securityOrigin());
 
-    writer()->setDecoder(document->decoder());
-
     updateFirstPartyForCookies();
 
     cachedFrame.restore();
@@ -2242,7 +2238,7 @@ void FrameLoader::finishedLoadingDocument(DocumentLoader* loader)
     ArchiveResource* mainResource = archive->mainResource();
     loader->setParsedArchiveData(mainResource->data());
 
-    writer()->setMIMEType(mainResource->mimeType());
+    loader->writer()->setMIMEType(mainResource->mimeType());
 
     closeURL();
     didOpenURL(mainResource->url());
@@ -2250,8 +2246,8 @@ void FrameLoader::finishedLoadingDocument(DocumentLoader* loader)
     ASSERT(m_frame->document());
     String userChosenEncoding = documentLoader()->overrideEncoding();
     bool encodingIsUserChosen = !userChosenEncoding.isNull();
-    writer()->setEncoding(encodingIsUserChosen ? userChosenEncoding : mainResource->textEncoding(), encodingIsUserChosen);
-    writer()->addData(mainResource->data()->data(), mainResource->data()->size());
+    loader->writer()->setEncoding(encodingIsUserChosen ? userChosenEncoding : mainResource->textEncoding(), encodingIsUserChosen);
+    loader->writer()->addData(mainResource->data()->data(), mainResource->data()->size());
 }
 
 bool FrameLoader::isReplacing() const
@@ -2675,7 +2671,7 @@ void FrameLoader::addExtraFieldsToRequest(ResourceRequest& request, FrameLoadTyp
     // Always try UTF-8. If that fails, try frame encoding (if any) and then the default.
     // For a newly opened frame with an empty URL, encoding() should not be used, because this methods asks decoder, which uses ISO-8859-1.
     Settings* settings = m_frame->settings();
-    request.setResponseContentDispositionEncodingFallbackArray("UTF-8", writer()->deprecatedFrameEncoding(), settings ? settings->defaultTextEncodingName() : String());
+    request.setResponseContentDispositionEncodingFallbackArray("UTF-8", activeDocumentLoader()->writer()->deprecatedFrameEncoding(), settings ? settings->defaultTextEncodingName() : String());
 }
 
 void FrameLoader::addHTTPOriginIfNeeded(ResourceRequest& request, String origin)
index 76ad977..2101286 100644 (file)
@@ -32,7 +32,6 @@
 #define FrameLoader_h
 
 #include "CachePolicy.h"
-#include "DocumentWriter.h"
 #include "FrameLoaderStateMachine.h"
 #include "FrameLoaderTypes.h"
 #include "HistoryController.h"
@@ -98,7 +97,6 @@ public:
     PolicyChecker* policyChecker() const { return &m_policyChecker; }
     HistoryController* history() const { return &m_history; }
     ResourceLoadNotifier* notifier() const { return &m_notifer; }
-    DocumentWriter* writer() const { return &m_writer; }
     SubframeLoader* subframeLoader() const { return &m_subframeLoader; }
 
     // FIXME: This is not cool, people. There are too many different functions that all start loads.
@@ -427,7 +425,6 @@ private:
     mutable PolicyChecker m_policyChecker;
     mutable HistoryController m_history;
     mutable ResourceLoadNotifier m_notifer;
-    mutable DocumentWriter m_writer;
     mutable SubframeLoader m_subframeLoader;
     mutable FrameLoaderStateMachine m_stateMachine;
 
index 15c5f03..5f4f360 100644 (file)
@@ -406,7 +406,7 @@ void CachedResourceLoader::requestPreload(CachedResource::Type type, const Strin
 {
     String encoding;
     if (type == CachedResource::Script || type == CachedResource::CSSStyleSheet)
-        encoding = charset.isEmpty() ? m_document->frame()->loader()->writer()->encoding() : charset;
+        encoding = charset.isEmpty() ? m_document->loader()->writer()->encoding() : charset;
 
     CachedResource* resource = requestResource(type, url, encoding, true);
     if (!resource || (m_preloads && m_preloads->contains(resource)))
index da28fc2..4645583 100644 (file)
@@ -94,10 +94,7 @@ TextEncoding FormDataBuilder::encodingFromAcceptCharset(const String& acceptChar
             return encoding;
     }
 
-    if (Frame* frame = document->frame())
-        return frame->loader()->writer()->encoding();
-
-    return Latin1Encoding();
+    return document->loader()->writer()->encoding();
 }
 
 Vector<char> FormDataBuilder::generateUniqueBoundaryString()
index c9804ae..bebc742 100644 (file)
@@ -278,10 +278,10 @@ bool SVGImage::dataChanged(bool allDataReceived)
         loader->load(fakeRequest, false); // Make sure the DocumentLoader is created
         loader->policyChecker()->cancelCheck(); // cancel any policy checks
         loader->commitProvisionalLoad();
-        loader->writer()->setMIMEType("image/svg+xml");
-        loader->writer()->begin(KURL()); // create the empty document
-        loader->writer()->addData(data()->data(), data()->size());
-        loader->writer()->end();
+        loader->activeDocumentLoader()->writer()->setMIMEType("image/svg+xml");
+        loader->activeDocumentLoader()->writer()->begin(KURL()); // create the empty document
+        loader->activeDocumentLoader()->writer()->addData(data()->data(), data()->size());
+        loader->activeDocumentLoader()->writer()->end();
         frame->view()->setTransparent(true); // SVG Images are transparent.
     }
 
index 10db94a..5892a26 100644 (file)
@@ -1,3 +1,25 @@
+2010-12-06  Nate Chapin  <japhet@chromium.org>
+
+        Reviewed by Adam Barth.
+
+        Update calls to DocumentWriter.
+        https://bugs.webkit.org/show_bug.cgi?id=50489
+
+        * src/ContextMenuClientImpl.cpp:
+        (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems):
+        * src/FrameLoaderClientImpl.cpp:
+        (WebKit::FrameLoaderClientImpl::finishedLoading):
+        * src/WebFrameImpl.cpp:
+        (WebKit::WebFrameImpl::encoding):
+        (WebKit::WebFrameImpl::loadJavaScriptURL):
+        * src/WebPageSerializerImpl.cpp:
+        (WebKit::WebPageSerializerImpl::preActionBeforeSerializeOpenTag):
+        (WebKit::WebPageSerializerImpl::serialize):
+        * src/WebSearchableFormData.cpp:
+        (WebCore::GetFormEncoding):
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::pageEncoding):
+
 2010-12-03  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r73302.
index d33a06b..5003d10 100644 (file)
@@ -226,7 +226,7 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems(
 
     // If it's not a link, an image, a media element, or an image/media link,
     // show a selection menu or a more generic page menu.
-    data.frameEncoding = selectedFrame->loader()->writer()->encoding();
+    data.frameEncoding = selectedFrame->document()->loader()->writer()->encoding();
 
     // Send the frame and page URLs in any case.
     data.pageURL = urlFromFrame(m_webView->mainFrameImpl()->frame());
index 9d79599..f76c657 100644 (file)
@@ -1097,7 +1097,7 @@ void FrameLoaderClientImpl::finishedLoading(DocumentLoader* dl)
         // However, we only want to do this if makeRepresentation has been called, to
         // match the behavior on the Mac.
         if (m_hasRepresentation)
-            dl->frameLoader()->writer()->setEncoding("", false);
+            dl->writer()->setEncoding("", false);
     }
 }
 
index 4422e1b..898d24b 100644 (file)
@@ -545,7 +545,7 @@ WebURL WebFrameImpl::openSearchDescriptionURL() const
 
 WebString WebFrameImpl::encoding() const
 {
-    return frame()->loader()->writer()->encoding();
+    return frame()->document()->loader()->writer()->encoding();
 }
 
 WebSize WebFrameImpl::scrollOffset() const
@@ -2271,7 +2271,7 @@ void WebFrameImpl::loadJavaScriptURL(const KURL& url)
         return;
 
     if (!m_frame->navigationScheduler()->locationChangePending())
-        m_frame->loader()->writer()->replaceDocument(scriptResult);
+        m_frame->document()->loader()->writer()->replaceDocument(scriptResult);
 }
 
 } // namespace WebKit
index 0d85d78..7ea9a8c 100644 (file)
@@ -168,7 +168,7 @@ String WebPageSerializerImpl::preActionBeforeSerializeOpenTag(
             // Get encoding info.
             String xmlEncoding = param->document->xmlEncoding();
             if (xmlEncoding.isEmpty())
-                xmlEncoding = param->document->frame()->loader()->writer()->encoding();
+                xmlEncoding = param->document->loader()->writer()->encoding();
             if (xmlEncoding.isEmpty())
                 xmlEncoding = UTF8Encoding().name();
             result.append("<?xml version=\"");
@@ -505,7 +505,7 @@ bool WebPageSerializerImpl::serialize()
 
         didSerialization = true;
 
-        String encoding = webFrame->frame()->loader()->writer()->encoding();
+        String encoding = document->loader()->writer()->encoding();
         const TextEncoding& textEncoding = encoding.isEmpty() ? UTF8Encoding() : TextEncoding(encoding);
         String directoryName = url == mainURL ? m_localDirectoryName : "";
 
index 50192eb..d9a2133 100644 (file)
@@ -61,8 +61,7 @@ void GetFormEncoding(const HTMLFormElement* form, TextEncoding* encoding)
         if (encoding->isValid())
             return;
     }
-    const Frame* frame = form->document()->frame();
-    *encoding = frame ? TextEncoding(frame->loader()->writer()->encoding()) : Latin1Encoding();
+    *encoding = TextEncoding(form->document()->loader()->writer()->encoding());
 }
 
 // Returns true if the submit request results in an HTTP URL.
index 7bec254..351c13d 100644 (file)
@@ -1431,7 +1431,7 @@ WebString WebViewImpl::pageEncoding() const
     if (!m_page.get())
         return WebString();
 
-    return m_page->mainFrame()->loader()->writer()->encoding();
+    return m_page->mainFrame()->document()->loader()->writer()->encoding();
 }
 
 void WebViewImpl::setPageEncoding(const WebString& encodingName)
index 26646b6..7367388 100644 (file)
@@ -1,3 +1,15 @@
+2010-12-06  Nate Chapin  <japhet@chromium.org>
+
+        Reviewed by Adam Barth.
+
+        Update calls to DocumentWriter.
+        https://bugs.webkit.org/show_bug.cgi?id=50489
+
+        * WebCoreSupport/FrameLoaderClientGtk.cpp:
+        (WebKit::FrameLoaderClient::finishedLoading):
+        * webkit/webkitwebview.cpp:
+        (webkit_web_view_get_encoding):
+
 2010-12-06  Martin Robinson  <mrobinson@igalia.com>
 
         Reviewed by Xan Lopez.
index 3dbba12..9613bb1 100644 (file)
@@ -1016,10 +1016,9 @@ String FrameLoaderClient::generatedMIMETypeForURLScheme(const String&) const
 
 void FrameLoaderClient::finishedLoading(WebCore::DocumentLoader* documentLoader)
 {
-    if (!m_pluginView) {
-        FrameLoader* loader = documentLoader->frameLoader();
-        loader->writer()->setEncoding(m_response.textEncodingName(), false);
-    } else {
+    if (!m_pluginView)
+        documentLoader->writer()->setEncoding(m_response.textEncodingName(), false);
+    else {
         m_pluginView->didFinishLoading();
         m_pluginView = 0;
         m_hasSentResponseToPlugin = false;
index 559906a..a1d550f 100644 (file)
@@ -4509,7 +4509,7 @@ gdouble webkit_web_view_get_progress(WebKitWebView* webView)
 const gchar* webkit_web_view_get_encoding(WebKitWebView* webView)
 {
     g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL);
-    String encoding = core(webView)->mainFrame()->loader()->writer()->encoding();
+    String encoding = core(webView)->mainFrame()->document()->loader()->writer()->encoding();
     if (encoding.isEmpty())
         return 0;
     webView->priv->encoding = encoding.utf8();
index 469f0fa..2fd7057 100644 (file)
@@ -1,3 +1,13 @@
+2010-12-06  Nate Chapin  <japhet@chromium.org>
+
+        Reviewed by Adam Barth.
+
+        Update calls to DocumentWriter.
+        https://bugs.webkit.org/show_bug.cgi?id=50489
+
+        * WebView/WebFrame.mm:
+        (-[WebFrame _canProvideDocumentSource]):
+
 2010-12-06  Chris Marrin  <cmarrin@apple.com>
 
         Reviewed by Simon Fraser.
index d1d4953..db3f6ce 100644 (file)
@@ -933,7 +933,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
 - (BOOL)_canProvideDocumentSource
 {
     Frame* frame = _private->coreFrame;
-    String mimeType = frame->loader()->writer()->mimeType();
+    String mimeType = frame->document()->loader()->writer()->mimeType();
     PluginData* pluginData = frame->page() ? frame->page()->pluginData() : 0;
 
     if (WebCore::DOMImplementation::isTextMIMEType(mimeType) ||
index 3cdbef2..268b73e 100644 (file)
@@ -703,8 +703,8 @@ static inline QUrl ensureAbsoluteUrl(const QUrl &url)
 void QWebFrame::setUrl(const QUrl &url)
 {
     const QUrl absolute = ensureAbsoluteUrl(url);
-    d->frame->loader()->writer()->begin(absolute);
-    d->frame->loader()->writer()->end();
+    d->frame->document()->loader()->writer()->begin(absolute);
+    d->frame->document()->loader()->writer()->end();
     load(absolute);
 }
 
index d361624..c31feb9 100644 (file)
@@ -1,3 +1,15 @@
+2010-12-06  Nate Chapin  <japhet@chromium.org>
+
+        Reviewed by Adam Barth.
+
+        Update calls to DocumentWriter.
+        https://bugs.webkit.org/show_bug.cgi?id=50489
+
+        * Api/qwebframe.cpp:
+        (QWebFrame::setUrl):
+        * WebCoreSupport/FrameLoaderClientQt.cpp:
+        (WebCore::FrameLoaderClientQt::finishedLoading):
+
 2010-12-01  Jia Pu  <jpu@apple.com>
 
         Reviewed by Darin Adler.
index bf6e75a..4751cf8 100644 (file)
@@ -619,7 +619,7 @@ void FrameLoaderClientQt::finishedLoading(DocumentLoader* loader)
         // However, we only want to do this if makeRepresentation has been called, to
         // match the behavior on the Mac.
         if (m_hasRepresentation)
-            loader->frameLoader()->writer()->setEncoding("", false);
+            loader->writer()->setEncoding("", false);
         return;
     }
     if (m_pluginView->isPluginView())
index f7a76e0..da1cd48 100644 (file)
@@ -1,3 +1,13 @@
+2010-12-06  Nate Chapin  <japhet@chromium.org>
+
+        Reviewed by Adam Barth.
+
+        Update calls to DocumentWriter.
+        https://bugs.webkit.org/show_bug.cgi?id=50489
+
+        * WebCoreSupport/FrameLoaderClientWinCE.cpp:
+        (WebKit::FrameLoaderClientWinCE::finishedLoading):
+
 2010-12-06  Patrick Gansterer  <paroga@webkit.org>
 
         Reviewed by Andreas Kling.
index f3643b2..f16346a 100644 (file)
@@ -450,8 +450,7 @@ String FrameLoaderClientWinCE::generatedMIMETypeForURLScheme(const String&) cons
 void FrameLoaderClientWinCE::finishedLoading(DocumentLoader* documentLoader)
 {
     if (!m_pluginView) {
-        FrameLoader* loader = documentLoader->frameLoader();
-        loader->writer()->setEncoding(m_response.textEncodingName(), false);
+        documentLoader->writer()->setEncoding(m_response.textEncodingName(), false);
         return;
     }
 
index ee07fbd..f4e0615 100644 (file)
@@ -1,3 +1,13 @@
+2010-12-06  Nate Chapin  <japhet@chromium.org>
+
+        Reviewed by Adam Barth.
+
+        Update calls to DocumentWriter.
+        https://bugs.webkit.org/show_bug.cgi?id=50489
+
+        * WebKitSupport/FrameLoaderClientWx.cpp:
+        (WebCore::FrameLoaderClientWx::finishedLoading):
+
 2010-12-01  Jia Pu  <jpu@apple.com>
 
         Reviewed by Darin Adler.
index 8748a98..9af992c 100644 (file)
@@ -434,8 +434,7 @@ void FrameLoaderClientWx::finishedLoading(DocumentLoader* loader)
 {
     if (!m_pluginView) {
         if (m_firstData) {
-            FrameLoader* fl = loader->frameLoader();
-            fl->writer()->setEncoding(m_response.textEncodingName(), false);
+            loader->writer()->setEncoding(m_response.textEncodingName(), false);
             m_firstData = false;
         }
     } else {