Commit 818318b3 authored by eric@webkit.org's avatar eric@webkit.org

2011-06-16 Eric Seidel <eric@webkit.org>

        Reviewed by Adam Barth.

        FrameLoader doesn't need completeURL or baseURL
        https://bugs.webkit.org/show_bug.cgi?id=62818

        No functional change, thus no tests.

        * html/HTMLPlugInImageElement.cpp:
        (WebCore::HTMLPlugInImageElement::isImageType):
        (WebCore::HTMLPlugInImageElement::wouldLoadAsNetscapePlugin):
        * inspector/InspectorPageAgent.cpp:
        (WebCore::InspectorPageAgent::open):
        * loader/FrameLoader.cpp:
        * loader/FrameLoader.h:
        * loader/NavigationScheduler.cpp:
        (WebCore::NavigationScheduler::scheduleLocationChange):
        * page/History.cpp:
        (WebCore::History::urlForState):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@89079 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c35e085a
2011-06-16 Eric Seidel <eric@webkit.org>
Reviewed by Adam Barth.
FrameLoader doesn't need completeURL or baseURL
https://bugs.webkit.org/show_bug.cgi?id=62818
No functional change, thus no tests.
* html/HTMLPlugInImageElement.cpp:
(WebCore::HTMLPlugInImageElement::isImageType):
(WebCore::HTMLPlugInImageElement::wouldLoadAsNetscapePlugin):
* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::open):
* loader/FrameLoader.cpp:
* loader/FrameLoader.h:
* loader/NavigationScheduler.cpp:
(WebCore::NavigationScheduler::scheduleLocationChange):
* page/History.cpp:
(WebCore::History::urlForState):
2011-06-16 Dawit Alemayehu <adawit@kde.org>
Reviewed by Antonio Gomes.
......
......@@ -159,7 +159,6 @@ __ZN7WebCore11FileChooser10chooseFileERKN3WTF6StringE
__ZN7WebCore11FileChooser10iconLoadedEN3WTF10PassRefPtrINS_4IconEEE
__ZN7WebCore11FileChooser11chooseFilesERKN3WTF6VectorINS1_6StringELm0EEE
__ZN7WebCore11FileChooserD1Ev
__ZN7WebCore11FrameLoader11completeURLERKN3WTF6StringE
__ZN7WebCore11FrameLoader11loadArchiveEN3WTF10PassRefPtrINS_7ArchiveEEE
__ZN7WebCore11FrameLoader11shouldCloseEv
__ZN7WebCore11FrameLoader11urlSelectedERKNS_4KURLERKN3WTF6StringENS4_10PassRefPtrINS_5EventEEEbbNS_14ReferrerPolicyE
......
......@@ -31,6 +31,7 @@
#ifndef GenericBinding_h
#define GenericBinding_h
#include "Document.h"
#include "Frame.h"
#include "FrameLoader.h"
......@@ -58,7 +59,7 @@ KURL completeURL(State<Binding>* state, const String& relativeURL)
Frame* frame = state->firstFrame();
if (!frame)
return KURL();
return frame->loader()->completeURL(relativeURL);
return frame->document()->completeURL(relativeURL);
}
}
......
......@@ -49,7 +49,7 @@ JSValue JSDOMApplicationCache::hasItem(ExecState* exec)
Frame* frame = asJSDOMWindow(exec->dynamicGlobalObject())->impl()->frame();
if (!frame)
return jsUndefined();
const KURL& url = frame->loader()->completeURL(exec->argument(0).toString(exec));
const KURL& url = frame->document()->completeURL(exec->argument(0).toString(exec));
ExceptionCode ec = 0;
bool result = impl()->hasItem(url, ec);
......@@ -62,8 +62,8 @@ JSValue JSDOMApplicationCache::add(ExecState* exec)
Frame* frame = asJSDOMWindow(exec->dynamicGlobalObject())->impl()->frame();
if (!frame)
return jsUndefined();
const KURL& url = frame->loader()->completeURL(exec->argument(0).toString(exec));
const KURL& url = frame->document()->completeURL(exec->argument(0).toString(exec));
ExceptionCode ec = 0;
impl()->add(url, ec);
setDOMException(exec, ec);
......@@ -75,8 +75,8 @@ JSValue JSDOMApplicationCache::remove(ExecState* exec)
Frame* frame = asJSDOMWindow(exec->dynamicGlobalObject())->impl()->frame();
if (!frame)
return jsUndefined();
const KURL& url = frame->loader()->completeURL(exec->argument(0).toString(exec));
const KURL& url = frame->document()->completeURL(exec->argument(0).toString(exec));
ExceptionCode ec = 0;
impl()->remove(url, ec);
setDOMException(exec, ec);
......
......@@ -59,7 +59,7 @@ bool HTMLPlugInImageElement::isImageType()
m_serviceType = mimeTypeFromDataURL(m_url);
if (Frame* frame = document()->frame()) {
KURL completedURL = frame->loader()->completeURL(m_url);
KURL completedURL = document()->completeURL(m_url);
return frame->loader()->client()->objectContentType(completedURL, m_serviceType, shouldPreferPlugInsForImages()) == ObjectContentImage;
}
......@@ -95,12 +95,12 @@ bool HTMLPlugInImageElement::wouldLoadAsNetscapePlugin(const String& url, const
{
ASSERT(document());
ASSERT(document()->frame());
FrameLoader* frameLoader = document()->frame()->loader();
ASSERT(frameLoader);
KURL completedURL;
if (!url.isEmpty())
completedURL = frameLoader->completeURL(url);
completedURL = document()->completeURL(url);
FrameLoader* frameLoader = document()->frame()->loader();
ASSERT(frameLoader);
if (frameLoader->client()->objectContentType(completedURL, serviceType, shouldPreferPlugInsForImages()) == ObjectContentNetscapePlugin)
return true;
return false;
......
......@@ -317,7 +317,8 @@ void InspectorPageAgent::open(ErrorString*, const String& url, const bool* const
frame = mainFrame;
UserGestureIndicator indicator(DefinitelyProcessingUserGesture);
frame->loader()->changeLocation(mainFrame->document()->securityOrigin(), frame->loader()->completeURL(url), "", false, false);
// FIXME: Why does one use mainFrame and the other frame?
frame->loader()->changeLocation(mainFrame->document()->securityOrigin(), frame->document()->completeURL(url), "", false, false);
}
static PassRefPtr<InspectorObject> buildObjectForCookie(const Cookie& cookie)
......
......@@ -788,18 +788,6 @@ void FrameLoader::checkCallImplicitClose()
m_frame->document()->implicitClose();
}
KURL FrameLoader::baseURL() const
{
ASSERT(m_frame->document());
return m_frame->document()->baseURL();
}
KURL FrameLoader::completeURL(const String& url)
{
ASSERT(m_frame->document());
return m_frame->document()->completeURL(url);
}
void FrameLoader::loadURLIntoChildFrame(const KURL& url, const String& referer, Frame* childFrame)
{
ASSERT(childFrame);
......
......@@ -219,8 +219,6 @@ public:
void didEndDocument();
void willSetEncoding();
KURL baseURL() const;
void handledOnloadEvents();
String userAgent(const KURL&) const;
......@@ -260,8 +258,6 @@ public:
bool isComplete() const;
KURL completeURL(const String& url);
void cancelAndClear();
void setTitle(const StringWithDirection&);
......
......@@ -335,12 +335,12 @@ void NavigationScheduler::scheduleLocationChange(PassRefPtr<SecurityOrigin> secu
lockBackForwardList = lockBackForwardList || mustLockBackForwardList(m_frame);
FrameLoader* loader = m_frame->loader();
// 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(ParsedURLString, url);
if (parsedURL.hasFragmentIdentifier() && equalIgnoringFragmentIdentifier(m_frame->document()->url(), parsedURL)) {
loader->changeLocation(securityOrigin, loader->completeURL(url), referrer, lockHistory, lockBackForwardList);
loader->changeLocation(securityOrigin, m_frame->document()->completeURL(url), referrer, lockHistory, lockBackForwardList);
return;
}
......
......@@ -109,10 +109,10 @@ void History::go(ScriptExecutionContext* context, int distance)
KURL History::urlForState(const String& urlString)
{
KURL baseURL = m_frame->loader()->baseURL();
KURL baseURL = m_frame->document()->baseURL();
if (urlString.isEmpty())
return baseURL;
return KURL(baseURL, urlString);
}
......
......@@ -829,7 +829,7 @@ PluginView::PluginView(Frame* parentFrame, const IntSize& size, PluginPackage* p
, m_element(element)
, m_isStarted(false)
, m_url(url)
, m_baseURL(m_parentFrame->loader()->completeURL(m_parentFrame->document()->baseURL().string()))
, m_baseURL(m_parentFrame->document()->baseURL()) // FIXME: No need for this member variable!
, m_status(PluginStatusLoadedSuccessfully)
, m_requestTimer(this, &PluginView::requestTimerFired)
, m_invalidateTimer(this, &PluginView::invalidateTimerFired)
......
......@@ -150,11 +150,6 @@ void assemblePasswordFormResult(const KURL& fullOrigin,
WebPasswordFormData::WebPasswordFormData(const WebFormElement& webForm)
{
RefPtr<HTMLFormElement> form = webForm.operator PassRefPtr<HTMLFormElement>();
Frame* frame = form->document()->frame();
if (!frame)
return;
PasswordFormFields fields;
findPasswordFormFields(form.get(), &fields);
......@@ -165,7 +160,7 @@ WebPasswordFormData::WebPasswordFormData(const WebFormElement& webForm)
String action = form->action();
if (action.isNull())
action = ""; // missing 'action' attribute implies current URL
KURL fullAction = frame->loader()->completeURL(action);
KURL fullAction = form->document()->completeURL(action);
if (!fullAction.isValid())
return;
......
......@@ -70,8 +70,10 @@ void GetFormEncoding(const HTMLFormElement* form, TextEncoding* encoding)
// Returns true if the submit request results in an HTTP URL.
bool IsHTTPFormSubmit(const HTMLFormElement* form)
{
// FIXME: This function is insane. This is an overly complicated way to get this information.
String action(form->action());
return form->document()->frame()->loader()->completeURL(action.isNull() ? "" : action).protocol() == "http";
// The isNull() check is trying to avoid completeURL returning KURL() when passed a null string.
return form->document()->completeURL(action.isNull() ? "" : action).protocolIs("http");
}
// If the form does not have an activated submit button, the first submit
......@@ -236,10 +238,6 @@ namespace WebKit {
WebSearchableFormData::WebSearchableFormData(const WebFormElement& form, const WebInputElement& selectedInputElement)
{
RefPtr<HTMLFormElement> formElement = form.operator PassRefPtr<HTMLFormElement>();
const Frame* frame = formElement->document()->frame();
if (!frame)
return;
HTMLInputElement* inputElement = selectedInputElement.operator PassRefPtr<HTMLInputElement>().get();
// Only consider forms that GET data.
......@@ -287,7 +285,7 @@ WebSearchableFormData::WebSearchableFormData(const WebFormElement& form, const W
return;
String action(formElement->action());
KURL url(frame->loader()->completeURL(action.isNull() ? "" : action));
KURL url(formElement->document()->completeURL(action.isNull() ? "" : action));
RefPtr<FormData> formData = FormData::create(encodedString);
url.setQuery(formData->flattenToString());
m_url = url;
......
......@@ -954,7 +954,7 @@ String WebHaltablePlugin::pluginName() const
if (!frame->document()->securityOrigin()->canAccess(targetFrame->document()->securityOrigin()))
return CString();
KURL absoluteURL = targetFrame->loader()->completeURL(relativeURLString);
KURL absoluteURL = targetFrame->document()->completeURL(relativeURLString);
return absoluteURL.string().utf8();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment