diff options
Diffstat (limited to 'src/3rdparty/webkit/WebCore/loader')
11 files changed, 123 insertions, 60 deletions
diff --git a/src/3rdparty/webkit/WebCore/loader/DocLoader.cpp b/src/3rdparty/webkit/WebCore/loader/DocLoader.cpp index 06d96bc..0b72f94 100644 --- a/src/3rdparty/webkit/WebCore/loader/DocLoader.cpp +++ b/src/3rdparty/webkit/WebCore/loader/DocLoader.cpp @@ -247,7 +247,7 @@ void DocLoader::printAccessDeniedMessage(const KURL& url) const m_doc->url().string().utf8().data()); // FIXME: provide a real line number and source URL. - frame()->domWindow()->console()->addMessage(OtherMessageSource, ErrorMessageLevel, message, 1, String()); + frame()->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, message, 1, String()); } void DocLoader::setAutoLoadImages(bool enable) diff --git a/src/3rdparty/webkit/WebCore/loader/EmptyClients.h b/src/3rdparty/webkit/WebCore/loader/EmptyClients.h index 2abd54f..f1c4c5d 100644 --- a/src/3rdparty/webkit/WebCore/loader/EmptyClients.h +++ b/src/3rdparty/webkit/WebCore/loader/EmptyClients.h @@ -95,7 +95,7 @@ public: virtual void setResizable(bool) { } - virtual void addMessageToConsole(MessageSource, MessageLevel, const String&, unsigned, const String&) { } + virtual void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String&, unsigned, const String&) { } virtual bool canRunBeforeUnloadConfirmPanel() { return false; } virtual bool runBeforeUnloadConfirmPanel(const String&, Frame*) { return true; } @@ -137,6 +137,9 @@ public: virtual void formStateDidChange(const Node*) { } + virtual void formDidFocus(const Node*) { } + virtual void formDidBlur(const Node*) { } + virtual PassOwnPtr<HTMLParserQuirks> createHTMLParserQuirks() { return 0; } virtual bool setCursor(PlatformCursorHandle) { return false; } @@ -270,8 +273,8 @@ public: virtual bool canCachePage() const { return false; } virtual PassRefPtr<Frame> createFrame(const KURL&, const String&, HTMLFrameOwnerElement*, const String&, bool, int, int) { return 0; } - virtual Widget* createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool) { return 0; } - virtual Widget* createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL&, const Vector<String>&, const Vector<String>&) { return 0; } + virtual PassRefPtr<Widget> createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool) { return 0; } + virtual PassRefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL&, const Vector<String>&, const Vector<String>&) { return 0; } virtual ObjectContentType objectContentType(const KURL&, const String&) { return ObjectContentType(); } virtual String overrideMediaType() const { return String(); } diff --git a/src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp b/src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp index 9a09e49..1e51583 100644 --- a/src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp +++ b/src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp @@ -424,7 +424,7 @@ bool FrameLoader::requestFrame(HTMLFrameOwnerElement* ownerElement, const String Frame* frame = ownerElement->contentFrame(); if (frame) - frame->loader()->scheduleLocationChange(url.string(), m_outgoingReferrer, true, true, userGestureHint()); + frame->loader()->scheduleLocationChange(url.string(), m_outgoingReferrer, true, true, isProcessingUserGesture()); else frame = loadSubframe(ownerElement, url, frameName, m_outgoingReferrer); @@ -487,7 +487,7 @@ Frame* FrameLoader::loadSubframe(HTMLFrameOwnerElement* ownerElement, const KURL void FrameLoader::submitForm(const char* action, const String& url, PassRefPtr<FormData> formData, const String& target, const String& contentType, const String& boundary, - bool lockHistory, bool lockBackForwardList, PassRefPtr<Event> event, PassRefPtr<FormState> formState) + bool lockHistory, PassRefPtr<Event> event, PassRefPtr<FormState> formState) { ASSERT(action); ASSERT(strcmp(action, "GET") == 0 || strcmp(action, "POST") == 0); @@ -559,20 +559,7 @@ void FrameLoader::submitForm(const char* action, const String& url, PassRefPtr<F frameRequest.resourceRequest().setURL(u); addHTTPOriginIfNeeded(frameRequest.resourceRequest(), outgoingOrigin()); - // Navigation of a subframe during loading of the main frame does not create a new back/forward item. - // Strangely, we only implement this rule for form submission; time will tell if we need it for other types of navigation. - // The definition of "during load" is any time before the load event has been handled. - // See https://bugs.webkit.org/show_bug.cgi?id=14957 for the original motivation for this. - if (Page* targetPage = targetFrame->page()) { - Frame* mainFrame = targetPage->mainFrame(); - if (mainFrame != targetFrame) { - Document* document = mainFrame->document(); - if (!mainFrame->loader()->isComplete() || document && document->processingLoadEvent()) - lockBackForwardList = true; - } - } - - targetFrame->loader()->scheduleFormSubmission(frameRequest, lockHistory, lockBackForwardList, event, formState); + targetFrame->loader()->scheduleFormSubmission(frameRequest, lockHistory, event, formState); } void FrameLoader::stopLoading(bool sendUnload, DatabasePolicy databasePolicy) @@ -1336,6 +1323,20 @@ void FrameLoader::scheduleHTTPRedirection(double delay, const String& url) scheduleRedirection(new ScheduledRedirection(delay, url, true, delay <= 1, false, false)); } +static bool mustLockBackForwardList(Frame* targetFrame) +{ + // Navigation of a subframe during loading of an ancestor frame does not create a new back/forward item. + // The definition of "during load" is any time before all handlers for the load event have been run. + // See https://bugs.webkit.org/show_bug.cgi?id=14957 for the original motivation for this. + + for (Frame* ancestor = targetFrame->tree()->parent(); ancestor; ancestor = ancestor->tree()->parent()) { + Document* document = ancestor->document(); + if (!ancestor->loader()->isComplete() || document && document->processingLoadEvent()) + return true; + } + return false; +} + void FrameLoader::scheduleLocationChange(const String& url, const String& referrer, bool lockHistory, bool lockBackForwardList, bool wasUserGesture) { if (!m_frame->page()) @@ -1344,6 +1345,8 @@ void FrameLoader::scheduleLocationChange(const String& url, const String& referr if (url.isEmpty()) return; + lockBackForwardList = lockBackForwardList || mustLockBackForwardList(m_frame); + // If the URL we're going to navigate to is the same as the current one, except for the // fragment part, we don't need to schedule the location change. KURL parsedURL(url); @@ -1360,7 +1363,7 @@ void FrameLoader::scheduleLocationChange(const String& url, const String& referr } void FrameLoader::scheduleFormSubmission(const FrameLoadRequest& frameRequest, - bool lockHistory, bool lockBackForwardList, PassRefPtr<Event> event, PassRefPtr<FormState> formState) + bool lockHistory, PassRefPtr<Event> event, PassRefPtr<FormState> formState) { ASSERT(m_frame->page()); ASSERT(!frameRequest.isEmpty()); @@ -1372,7 +1375,7 @@ void FrameLoader::scheduleFormSubmission(const FrameLoadRequest& frameRequest, // This may happen when a frame changes the location of another frame. bool duringLoad = !m_committedFirstRealDocumentLoad; - scheduleRedirection(new ScheduledRedirection(frameRequest, lockHistory, lockBackForwardList, event, formState, duringLoad)); + scheduleRedirection(new ScheduledRedirection(frameRequest, lockHistory, mustLockBackForwardList(m_frame), event, formState, duringLoad)); } void FrameLoader::scheduleRefresh(bool wasUserGesture) @@ -1586,28 +1589,8 @@ bool FrameLoader::gotoAnchor(const String& name) if (!anchorNode && !(name.isEmpty() || equalIgnoringCase(name, "top"))) return false; - // We need to update the layout before scrolling, otherwise we could - // really mess things up if an anchor scroll comes at a bad moment. - m_frame->document()->updateStyleIfNeeded(); - // Only do a layout if changes have occurred that make it necessary. - if (m_frame->view() && m_frame->contentRenderer() && m_frame->contentRenderer()->needsLayout()) - m_frame->view()->layout(); - - // Scroll nested layers and frames to reveal the anchor. - // Align to the top and to the closest side (this matches other browsers). - RenderObject* renderer; - IntRect rect; - if (!anchorNode) - renderer = m_frame->document()->renderer(); // top of document - else { - renderer = anchorNode->renderer(); - rect = anchorNode->getRect(); - } - if (renderer) { - renderer->enclosingLayer()->scrollRectToVisible(rect, true, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignTopAlways); - if (m_frame->view()) - m_frame->view()->setLockedToAnchor(true); - } + if (FrameView* view = m_frame->view()) + view->maintainScrollPositionAtAnchor(anchorNode ? static_cast<Node*>(anchorNode) : m_frame->document()); return true; } @@ -1686,7 +1669,7 @@ static HTMLPlugInElement* toPlugInElement(Node* node) bool FrameLoader::loadPlugin(RenderPart* renderer, const KURL& url, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues, bool useFallback) { - Widget* widget = 0; + RefPtr<Widget> widget; if (renderer && !useFallback) { HTMLPlugInElement* element = toPlugInElement(renderer->node()); @@ -1768,7 +1751,7 @@ void FrameLoader::provisionalLoadStarted() m_client->provisionalLoadStarted(); } -bool FrameLoader::userGestureHint() +bool FrameLoader::isProcessingUserGesture() { Frame* frame = m_frame->tree()->top(); if (!frame->script()->isEnabled()) @@ -2111,7 +2094,7 @@ void FrameLoader::completed() if (Frame* parent = m_frame->tree()->parent()) parent->loader()->checkCompleted(); if (m_frame->view()) - m_frame->view()->setLockedToAnchor(false); + m_frame->view()->maintainScrollPositionAtAnchor(0); } void FrameLoader::started() @@ -2406,7 +2389,7 @@ void FrameLoader::reportLocalLoadFailed(Frame* frame, const String& url) if (!frame) return; - frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, "Not allowed to load local resource: " + url, 0, String()); + frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Not allowed to load local resource: " + url, 0, String()); } bool FrameLoader::shouldHideReferrer(const KURL& url, const String& referrer) @@ -2623,7 +2606,7 @@ bool FrameLoader::shouldAllowNavigation(Frame* targetFrame) const targetDocument->url().string().utf8().data(), activeDocument->url().string().utf8().data()); // FIXME: should we print to the console of the activeFrame as well? - targetFrame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, message, 1, String()); + targetFrame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, message, 1, String()); } return false; @@ -5066,7 +5049,7 @@ void FrameLoader::dispatchWindowObjectAvailable() } } -Widget* FrameLoader::createJavaAppletWidget(const IntSize& size, HTMLAppletElement* element, const HashMap<String, String>& args) +PassRefPtr<Widget> FrameLoader::createJavaAppletWidget(const IntSize& size, HTMLAppletElement* element, const HashMap<String, String>& args) { String baseURLString; String codeBaseURLString; @@ -5094,7 +5077,7 @@ Widget* FrameLoader::createJavaAppletWidget(const IntSize& size, HTMLAppletEleme baseURLString = m_frame->document()->baseURL().string(); KURL baseURL = completeURL(baseURLString); - Widget* widget = m_client->createJavaAppletWidget(size, element, baseURL, paramNames, paramValues); + RefPtr<Widget> widget = m_client->createJavaAppletWidget(size, element, baseURL, paramNames, paramValues); if (!widget) return 0; diff --git a/src/3rdparty/webkit/WebCore/loader/FrameLoader.h b/src/3rdparty/webkit/WebCore/loader/FrameLoader.h index d96329f..b80a87c 100644 --- a/src/3rdparty/webkit/WebCore/loader/FrameLoader.h +++ b/src/3rdparty/webkit/WebCore/loader/FrameLoader.h @@ -261,7 +261,7 @@ namespace WebCore { void submitForm(const char* action, const String& url, PassRefPtr<FormData>, const String& target, const String& contentType, const String& boundary, - bool lockHistory, bool lockBackForwardList, PassRefPtr<Event>, PassRefPtr<FormState>); + bool lockHistory, PassRefPtr<Event>, PassRefPtr<FormState>); void stop(); void stopLoading(bool sendUnload, DatabasePolicy = DatabasePolicyStop); @@ -305,7 +305,7 @@ namespace WebCore { void handledOnloadEvents(); String userAgent(const KURL&) const; - Widget* createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const HashMap<String, String>& args); + PassRefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const HashMap<String, String>& args); void dispatchWindowObjectAvailable(); void dispatchDocumentElementAvailable(); @@ -316,7 +316,7 @@ namespace WebCore { bool openedByDOM() const; void setOpenedByDOM(); - bool userGestureHint(); + bool isProcessingUserGesture(); void resetMultipleFormSubmissionProtection(); @@ -492,7 +492,7 @@ namespace WebCore { void dispatchDidFinishLoading(DocumentLoader*, unsigned long identifier); static bool isLocationChange(const ScheduledRedirection&); - void scheduleFormSubmission(const FrameLoadRequest&, bool lockHistory, bool lockBackForwardList, PassRefPtr<Event>, PassRefPtr<FormState>); + void scheduleFormSubmission(const FrameLoadRequest&, bool lockHistory, PassRefPtr<Event>, PassRefPtr<FormState>); void loadWithDocumentLoader(DocumentLoader*, FrameLoadType, PassRefPtr<FormState>); // Calls continueLoadAfterNavigationPolicy void load(DocumentLoader*); // Calls loadWithDocumentLoader diff --git a/src/3rdparty/webkit/WebCore/loader/FrameLoaderClient.h b/src/3rdparty/webkit/WebCore/loader/FrameLoaderClient.h index 8c050f0..aa36b50 100644 --- a/src/3rdparty/webkit/WebCore/loader/FrameLoaderClient.h +++ b/src/3rdparty/webkit/WebCore/loader/FrameLoaderClient.h @@ -200,10 +200,10 @@ namespace WebCore { virtual PassRefPtr<Frame> createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement, const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight) = 0; - virtual Widget* createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool loadManually) = 0; + virtual PassRefPtr<Widget> createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool loadManually) = 0; virtual void redirectDataToPlugin(Widget* pluginWidget) = 0; - virtual Widget* createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues) = 0; + virtual PassRefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues) = 0; virtual ObjectContentType objectContentType(const KURL& url, const String& mimeType) = 0; virtual String overrideMediaType() const = 0; diff --git a/src/3rdparty/webkit/WebCore/loader/TextDocument.cpp b/src/3rdparty/webkit/WebCore/loader/TextDocument.cpp index 0d86c1b..a3d7061 100644 --- a/src/3rdparty/webkit/WebCore/loader/TextDocument.cpp +++ b/src/3rdparty/webkit/WebCore/loader/TextDocument.cpp @@ -162,6 +162,8 @@ void TextTokenizer::write(const SegmentedString& s, bool) void TextTokenizer::finish() { + if (!m_preElement) + write(SegmentedString(), true); // Create document structure for an empty text document. m_preElement = 0; fastFree(m_buffer); m_buffer = 0; diff --git a/src/3rdparty/webkit/WebCore/loader/icon/IconDatabase.cpp b/src/3rdparty/webkit/WebCore/loader/icon/IconDatabase.cpp index 3ded4f3..b78291d 100644 --- a/src/3rdparty/webkit/WebCore/loader/icon/IconDatabase.cpp +++ b/src/3rdparty/webkit/WebCore/loader/icon/IconDatabase.cpp @@ -27,6 +27,8 @@ #include "config.h" #include "IconDatabase.h" +#if ENABLE(ICONDATABASE) + #include "AutodrainedPool.h" #include "DocumentLoader.h" #include "FileSystem.h" @@ -2067,3 +2069,5 @@ void IconDatabase::writeIconSnapshotToSQLDatabase(const IconSnapshot& snapshot) } } // namespace WebCore + +#endif // ENABLE(ICONDATABASE) diff --git a/src/3rdparty/webkit/WebCore/loader/icon/IconDatabase.h b/src/3rdparty/webkit/WebCore/loader/icon/IconDatabase.h index 40f641a..675e6c8 100644 --- a/src/3rdparty/webkit/WebCore/loader/icon/IconDatabase.h +++ b/src/3rdparty/webkit/WebCore/loader/icon/IconDatabase.h @@ -165,6 +165,7 @@ private: HashSet<String> m_pageURLsPendingImport; HashSet<String> m_pageURLsInterestedInIcons; HashSet<IconRecord*> m_iconsPendingReading; +#endif // ENABLE(ICONDATABASE) // *** Sync Thread Only *** public: @@ -174,6 +175,7 @@ public: bool shouldStopThreadActivity() const; +#if ENABLE(ICONDATABASE) private: static void* iconDatabaseSyncThreadStart(void *); void* iconDatabaseSyncThread(); @@ -238,4 +240,4 @@ IconDatabase* iconDatabase(); } // namespace WebCore -#endif +#endif // IconDatabase_h diff --git a/src/3rdparty/webkit/WebCore/loader/icon/IconDatabaseNone.cpp b/src/3rdparty/webkit/WebCore/loader/icon/IconDatabaseNone.cpp index a7fb88d..03a7964 100644 --- a/src/3rdparty/webkit/WebCore/loader/icon/IconDatabaseNone.cpp +++ b/src/3rdparty/webkit/WebCore/loader/icon/IconDatabaseNone.cpp @@ -26,6 +26,8 @@ #include "config.h" #include "IconDatabase.h" +#if !ENABLE(ICONDATABASE) + #include "PlatformString.h" #include "SharedBuffer.h" #include <wtf/StdLibExtras.h> @@ -194,4 +196,23 @@ void IconDatabase::setClient(IconDatabaseClient*) { } +// ************************ +// *** Sync Thread Only *** +// ************************ + +void IconDatabase::importIconURLForPageURL(const String&, const String&) +{ +} + +void IconDatabase::importIconDataForIconURL(PassRefPtr<SharedBuffer>, const String&) +{ +} + +bool IconDatabase::shouldStopThreadActivity() const +{ + return true; +} + } // namespace WebCore + +#endif // !ENABLE(ICONDATABASE) diff --git a/src/3rdparty/webkit/WebCore/loader/loader.cpp b/src/3rdparty/webkit/WebCore/loader/loader.cpp index d10877f..881e200 100644 --- a/src/3rdparty/webkit/WebCore/loader/loader.cpp +++ b/src/3rdparty/webkit/WebCore/loader/loader.cpp @@ -176,6 +176,35 @@ void Loader::resumePendingRequests() scheduleServePendingRequests(); } +void Loader::nonCacheRequestInFlight(const KURL& url) +{ + if (!url.protocolInHTTPFamily()) + return; + + AtomicString hostName = url.host(); + RefPtr<Host> host = m_hosts.get(hostName.impl()); + if (!host) { + host = Host::create(hostName, maxRequestsInFlightPerHost); + m_hosts.add(hostName.impl(), host); + } + + host->nonCacheRequestInFlight(); +} + +void Loader::nonCacheRequestComplete(const KURL& url) +{ + if (!url.protocolInHTTPFamily()) + return; + + AtomicString hostName = url.host(); + RefPtr<Host> host = m_hosts.get(hostName.impl()); + ASSERT(host); + if (!host) + return; + + host->nonCacheRequestComplete(); +} + void Loader::cancelRequests(DocLoader* docLoader) { docLoader->clearPendingPreloads(); @@ -204,6 +233,7 @@ Loader::Host::Host(const AtomicString& name, unsigned maxRequestsInFlight) : m_name(name) , m_maxRequestsInFlight(maxRequestsInFlight) , m_numResourcesProcessing(0) + , m_nonCachedRequestsInFlight(0) { } @@ -219,6 +249,17 @@ void Loader::Host::addRequest(Request* request, Priority priority) m_requestsPending[priority].append(request); } +void Loader::Host::nonCacheRequestInFlight() +{ + ++m_nonCachedRequestsInFlight; +} + +void Loader::Host::nonCacheRequestComplete() +{ + --m_nonCachedRequestsInFlight; + ASSERT(m_nonCachedRequestsInFlight >= 0); +} + bool Loader::Host::hasRequests() const { if (!m_requestsLoading.isEmpty()) @@ -250,7 +291,7 @@ void Loader::Host::servePendingRequests(RequestQueue& requestsPending, bool& ser // resources that we would want to push to the front of the queue. Just hand off the remaining resources // to the networking layer. bool parsedAndStylesheetsKnown = !docLoader->doc()->parsing() && docLoader->doc()->haveStylesheetsLoaded(); - if (!parsedAndStylesheetsKnown && !resourceIsCacheValidator && m_requestsLoading.size() >= m_maxRequestsInFlight) { + if (!parsedAndStylesheetsKnown && !resourceIsCacheValidator && m_requestsLoading.size() + m_nonCachedRequestsInFlight >= m_maxRequestsInFlight) { serveLowerPriority = false; return; } diff --git a/src/3rdparty/webkit/WebCore/loader/loader.h b/src/3rdparty/webkit/WebCore/loader/loader.h index c5b9416..3cced3d 100644 --- a/src/3rdparty/webkit/WebCore/loader/loader.h +++ b/src/3rdparty/webkit/WebCore/loader/loader.h @@ -35,6 +35,7 @@ namespace WebCore { class CachedResource; class DocLoader; + class KURL; class Request; class Loader : Noncopyable { @@ -52,6 +53,9 @@ namespace WebCore { bool isSuspendingPendingRequests() { return m_isSuspendingPendingRequests; } void suspendPendingRequests(); void resumePendingRequests(); + + void nonCacheRequestInFlight(const KURL&); + void nonCacheRequestComplete(const KURL&); private: Priority determinePriority(const CachedResource*) const; @@ -69,11 +73,13 @@ namespace WebCore { const AtomicString& name() const { return m_name; } void addRequest(Request*, Priority); + void nonCacheRequestInFlight(); + void nonCacheRequestComplete(); void servePendingRequests(Priority minimumPriority = Low); void cancelRequests(DocLoader*); bool hasRequests() const; - bool processingResource() const { return m_numResourcesProcessing != 0; } + bool processingResource() const { return m_numResourcesProcessing != 0 || m_nonCachedRequestsInFlight !=0; } private: Host(const AtomicString&, unsigned); @@ -94,6 +100,7 @@ namespace WebCore { const AtomicString m_name; const int m_maxRequestsInFlight; int m_numResourcesProcessing; + int m_nonCachedRequestsInFlight; }; typedef HashMap<AtomicStringImpl*, RefPtr<Host> > HostMap; HostMap m_hosts; |