+2007-01-23 Lars Knoll <lars@trolltech.com>
+
+ Reviewed by Maciej
+
+ Make the last remaining pieces of the FrameLoader platform
+ independent. Move most of the code over to WebFrameLoaderClient.
+ Some smaller cleanups in the WebFrameBridge, and moved some
+ platform independent functionality over to the shared code
+ in WebCore.
+
+ * WebCore.exp:
+ * WebCore.pro:
+ * WebCore.xcodeproj/project.pbxproj:
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::loadSubframe):
+ (WebCore::FrameLoader::shouldUsePlugin):
+ (WebCore::FrameLoader::loadPlugin):
+ (WebCore::FrameLoader::detachFromParent):
+ (WebCore::FrameLoader::partClearedInBegin):
+ (WebCore::FrameLoader::createJavaAppletWidget):
+ (WebCore::FrameLoader::didChangeTitle):
+ * loader/FrameLoader.h:
+ * loader/FrameLoaderClient.h:
+ * loader/FrameLoaderTypes.h:
+ (WebCore::):
+ * loader/PluginDocument.cpp:
+ (WebCore::PluginTokenizer::writeRawData):
+ * loader/mac/FrameLoaderMac.mm: Removed.
+ * loader/qt/FrameLoaderQt.cpp: Removed.
+ * page/Frame.cpp:
+ (WebCore::Frame::Frame):
+ * page/FrameView.cpp:
+ (WebCore::FrameView::mediaType):
+ * page/qt/FrameQt.cpp:
+ (WebCore::FrameQt::FrameQt):
+ * platform/graphics/svg/SVGImageEmptyClients.h:
+ (WebCore::SVGEmptyFrameLoaderClient::makeRepresentation):
+ (WebCore::SVGEmptyFrameLoaderClient::dispatchDidLoadResourceFromMemoryCache):
+ (WebCore::SVGEmptyFrameLoaderClient::dispatchDidCommitLoad):
+ (WebCore::SVGEmptyFrameLoaderClient::dispatchDidFailLoad):
+ (WebCore::SVGEmptyFrameLoaderClient::dispatchCreatePage):
+ (WebCore::SVGEmptyFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
+ (WebCore::SVGEmptyFrameLoaderClient::dispatchUnableToImplementPolicy):
+ (WebCore::SVGEmptyFrameLoaderClient::revertToProvisionalState):
+ (WebCore::SVGEmptyFrameLoaderClient::setMainDocumentError):
+ (WebCore::SVGEmptyFrameLoaderClient::startDownload):
+ (WebCore::SVGEmptyFrameLoaderClient::committedLoad):
+ (WebCore::SVGEmptyFrameLoaderClient::shouldFallBack):
+ (WebCore::SVGEmptyFrameLoaderClient::willUseArchive):
+ (WebCore::SVGEmptyFrameLoaderClient::createDocumentLoader):
+ (WebCore::SVGEmptyFrameLoaderClient::createFrame):
+ (WebCore::SVGEmptyFrameLoaderClient::createPlugin):
+ (WebCore::SVGEmptyFrameLoaderClient::createJavaAppletWidget):
+ (WebCore::SVGEmptyFrameLoaderClient::objectContentType):
+ (WebCore::SVGEmptyFrameLoaderClient::overrideMediaType):
+ (WebCore::SVGEmptyFrameLoaderClient::redirectDataToPlugin):
+ (WebCore::SVGEmptyFrameLoaderClient::windowObjectCleared):
+
2007-01-23 Oliver Hunt <oliver@apple.com>
Reviewed by Adam.
__ZN7WebCore6StringC1EP8NSString
__ZN7WebCore6StringC1EPKc
__ZN7WebCore6StringC1ERKNS_16DeprecatedStringE
+__ZN7WebCore6Widget7setViewEP6NSView
+__ZN7WebCore6WidgetC1EP6NSView
+__ZN7WebCore6WidgetC1Ev
__ZN7WebCore7IntSizeC1ERK7_NSSize
__ZN7WebCore7nsColorERKNS_5ColorE
__ZN7WebCore8Document11completeURLERKNS_16DeprecatedStringE
__ZN7WebCore9TimerBaseC2Ev
__ZN7WebCore9TimerBaseD2Ev
__ZN7WebCoreeqERKNS_4KURLES2_
+__ZNK7WebCore6Widget7getViewEv
__ZNK7WebCore10StringImplcvP8NSStringEv
__ZNK7WebCore11CachedImage5imageEv
__ZNK7WebCore11ContextMenu19platformDescriptionEv
loader/icon/SQLTransaction.cpp \
loader/icon/SQLStatement.cpp \
loader/icon/SQLDatabase.cpp \
- loader/qt/FrameLoaderQt.cpp \
loader/qt/DocumentLoaderQt.cpp \
platform/CString.cpp \
platform/DragData.cpp \
656D373A0ADBA5DE00A4554D /* FormState.h in Headers */ = {isa = PBXBuildFile; fileRef = 656D37220ADBA5DE00A4554D /* FormState.h */; settings = {ATTRIBUTES = (Private, ); }; };
656D373B0ADBA5DE00A4554D /* FormState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 656D37230ADBA5DE00A4554D /* FormState.cpp */; };
656D373C0ADBA5DE00A4554D /* FrameLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 656D37240ADBA5DE00A4554D /* FrameLoader.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 656D373D0ADBA5DE00A4554D /* FrameLoaderMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 656D37250ADBA5DE00A4554D /* FrameLoaderMac.mm */; };
656D373E0ADBA5DE00A4554D /* FrameLoaderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 656D37260ADBA5DE00A4554D /* FrameLoaderClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
656D373F0ADBA5DE00A4554D /* ResourceLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 656D37270ADBA5DE00A4554D /* ResourceLoader.h */; settings = {ATTRIBUTES = (Private, ); }; };
656D37410ADBA5DE00A4554D /* MainResourceLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 656D37290ADBA5DE00A4554D /* MainResourceLoader.h */; };
656D37220ADBA5DE00A4554D /* FormState.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FormState.h; sourceTree = "<group>"; };
656D37230ADBA5DE00A4554D /* FormState.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = FormState.cpp; sourceTree = "<group>"; };
656D37240ADBA5DE00A4554D /* FrameLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FrameLoader.h; sourceTree = "<group>"; };
- 656D37250ADBA5DE00A4554D /* FrameLoaderMac.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = FrameLoaderMac.mm; sourceTree = "<group>"; };
656D37260ADBA5DE00A4554D /* FrameLoaderClient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FrameLoaderClient.h; sourceTree = "<group>"; };
656D37270ADBA5DE00A4554D /* ResourceLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ResourceLoader.h; sourceTree = "<group>"; };
656D37290ADBA5DE00A4554D /* MainResourceLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MainResourceLoader.h; sourceTree = "<group>"; };
isa = PBXGroup;
children = (
656D371F0ADBA5DE00A4554D /* DocumentLoaderMac.mm */,
- 656D37250ADBA5DE00A4554D /* FrameLoaderMac.mm */,
93A1EAA70A563508006960A0 /* ImageDocumentMac.h */,
93A1EA9F0A5634C9006960A0 /* ImageDocumentMac.mm */,
656D371A0ADBA5DE00A4554D /* LoaderNSURLExtras.h */,
656D37350ADBA5DE00A4554D /* WebDataProtocol.mm in Sources */,
656D37370ADBA5DE00A4554D /* DocumentLoaderMac.mm in Sources */,
656D373B0ADBA5DE00A4554D /* FormState.cpp in Sources */,
- 656D373D0ADBA5DE00A4554D /* FrameLoaderMac.mm in Sources */,
656D37440ADBA5DE00A4554D /* NetscapePlugInStreamLoaderMac.mm in Sources */,
0668E1900ADD9640004128E0 /* PopupMenuMac.mm in Sources */,
4B3043C90AE0371D00A82647 /* SoundMac.mm in Sources */,
#include "FrameView.h"
#include "HistoryItem.h"
#include "HTMLFormElement.h"
+#include "HTMLFrameElement.h"
#include "HTMLNames.h"
#include "HTMLObjectElement.h"
#include "HTTPParsers.h"
Frame* FrameLoader::loadSubframe(HTMLFrameOwnerElement* ownerElement, const KURL& url, const String& name, const String& referrer)
{
- Frame* frame = createFrame(url, name, ownerElement, referrer);
+ bool allowsScrolling = true;
+ int marginWidth = -1;
+ int marginHeight = -1;
+ if (ownerElement->hasTagName(frameTag) || ownerElement->hasTagName(iframeTag)) {
+ HTMLFrameElementBase* o = static_cast<HTMLFrameElementBase*>(ownerElement);
+ allowsScrolling = o->scrollingMode() != ScrollbarAlwaysOff;
+ marginWidth = o->getMarginWidth();
+ marginHeight = o->getMarginHeight();
+ }
+
+ bool hideReferrer;
+ if (!canLoad(url, referrer, hideReferrer))
+ return 0;
+
+ Frame* frame = m_client->createFrame(url, name, ownerElement, hideReferrer ? String() : referrer,
+ allowsScrolling, marginWidth, marginHeight);
+
if (!frame) {
checkEmitLoadEvent();
return 0;
bool FrameLoader::shouldUsePlugin(const KURL& url, const String& mimeType, bool hasFallback, bool& useFallback)
{
- ObjectContentType objectType = objectContentType(url, mimeType);
+ ObjectContentType objectType = m_client->objectContentType(url, mimeType);
// If an object's content can't be handled and it has no fallback, let
// it be handled as a plugin to show the broken plugin icon.
useFallback = objectType == ObjectContentNone && hasFallback;
if (renderer->node() && renderer->node()->isElementNode())
pluginElement = static_cast<Element*>(renderer->node());
- widget = createPlugin(pluginElement, url, paramNames, paramValues, mimeType);
+ bool hideReferrer;
+ if (!canLoad(url, outgoingReferrer(), hideReferrer))
+ return false;
+
+ widget = m_client->createPlugin(pluginElement, url, paramNames, paramValues, mimeType,
+ m_frame->document()->isPluginDocument());
if (widget) {
renderer->setWidget(widget);
m_containsPlugIns = true;
closeURL();
stopAllLoaders();
- m_client->detachedFromParent1();
+ saveScrollPositionAndViewStateToItem(currentHistoryItem());
detachChildren();
m_client->detachedFromParent2();
setDocumentLoader(0);
m_frame->pageDestroyed();
}
#if PLATFORM(MAC)
- closeBridge();
+ [Mac(m_frame)->bridge() close];
#endif
m_client->detachedFromParent4();
}
return documentLoader()->request().httpReferrer();
}
+void FrameLoader::partClearedInBegin()
+{
+ if (m_frame->settings()->isJavaScriptEnabled())
+ m_client->windowObjectCleared();
+}
+
+Widget* FrameLoader::createJavaAppletWidget(const IntSize& size, Element* element, const HashMap<String, String>& args)
+{
+ String baseURLString;
+ Vector<String> paramNames;
+ Vector<String> paramValues;
+ HashMap<String, String>::const_iterator end = args.end();
+ for (HashMap<String, String>::const_iterator it = args.begin(); it != end; ++it) {
+ if (it->first.lower() == "baseurl")
+ baseURLString = it->second;
+ paramNames.append(it->first);
+ paramValues.append(it->second);
+ }
+
+ if (baseURLString.isEmpty())
+ baseURLString = m_frame->document()->baseURL();
+ KURL baseURL = completeURL(baseURLString);
+
+ Widget* widget = m_client->createJavaAppletWidget(size, element, baseURL, paramNames, paramValues);
+ if(widget)
+ m_frame->view()->addChild(widget);
+ return widget;
+}
+
+void FrameLoader::didChangeTitle(DocumentLoader* loader)
+{
+ m_client->didChangeTitle(loader);
+
+ // The title doesn't get communicated to the WebView until we are committed.
+ if (loader->isCommitted()) {
+ // Must update the entries in the back-forward list too.
+ // This must go through the WebFrame because it has the right notion of the current b/f item.
+ m_client->setTitle(loader->title(), loader->urlForHistory());
+ m_client->setMainFrameDocumentReady(true); // update observers with new DOMDocument
+ m_client->dispatchDidReceiveTitle(loader->title());
+ }
+}
} // namespace WebCore
template <typename T> class Timer;
- enum ObjectContentType {
- ObjectContentNone, ObjectContentImage, ObjectContentFrame, ObjectContentPlugin
- };
-
typedef HashSet<RefPtr<ResourceLoader> > ResourceLoaderSet;
bool isBackForwardLoadType(FrameLoadType);
// Also not cool.
void stopLoadingPlugIns();
void stopLoadingSubresources();
-#if PLATFORM(MAC)
- void closeBridge();
-#endif
void cancelMainResourceLoad(const ResourceError&);
void stopAllLoaders();
void cancelMainResourceLoad();
void urlSelected(const FrameLoadRequest&, Event*);
bool requestFrame(HTMLFrameOwnerElement*, const String& URL, const AtomicString& frameName);
- Frame* createFrame(const KURL& URL, const String& name, HTMLFrameOwnerElement*, const String& referrer);
Frame* loadSubframe(HTMLFrameOwnerElement*, const KURL& URL, const String& name, const String& referrer);
void submitForm(const char* action, const String& URL, PassRefPtr<FormData>, const String& target, const String& contentType, const String& boundary, Event*);
String overrideMediaType() const;
- void redirectDataToPlugin(Widget* pluginWidget);
-
Frame* opener();
void setOpener(Frame*);
bool openedByJavaScript();
KURL completeURL(const String& URL);
- Widget* createPlugin(Element*, const KURL&, const Vector<String>& paramNames,
- const Vector<String>& paramValues, const String& mimeType);
-
void clear(bool clearWindowProperties = true);
- ObjectContentType objectContentType(const KURL& url, const String& mimeType);
-
void didTellBridgeAboutLoad(const String& URL);
bool haveToldBridgeAboutLoad(const String& URL);
#define FrameLoaderClient_h
#include "FrameLoaderTypes.h"
+#include "StringHash.h"
#include <wtf/Forward.h>
#include <wtf/Platform.h>
class Frame;
class FrameLoader;
class HistoryItem;
+ class HTMLFrameOwnerElement;
+ class IntSize;
class KURL;
class NavigationAction;
class PageCache;
class ResourceRequest;
class ResourceResponse;
class String;
+ class Widget;
typedef void (FrameLoader::*FramePolicyFunction)(PolicyAction);
virtual void setCopiesOnScroll() = 0;
- virtual void detachedFromParent1() = 0;
virtual void detachedFromParent2() = 0;
virtual void detachedFromParent3() = 0;
virtual void detachedFromParent4() = 0;
virtual void saveDocumentViewToPageCache(PageCache*) = 0;
virtual bool canCachePage() const = 0;
virtual void download(ResourceHandle*, const ResourceRequest&, const ResourceResponse&) = 0;
+
+ virtual Frame* createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement,
+ const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight) = 0;
+ virtual Widget* createPlugin(Element*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool loadManually) = 0;
+ virtual void redirectDataToPlugin(Widget* pluginWidget) = 0;
+
+ virtual Widget* createJavaAppletWidget(const IntSize&, Element*, 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;
+
+ virtual void windowObjectCleared() const = 0;
};
} // namespace WebCore
NavigationTypeOther
};
+ enum ObjectContentType {
+ ObjectContentNone,
+ ObjectContentImage,
+ ObjectContentFrame,
+ ObjectContentPlugin
+ };
}
#endif
#include "Frame.h"
#include "FrameLoader.h"
+#include "FrameLoaderClient.h"
#include "Element.h"
#include "HTMLNames.h"
#include "RenderWidget.h"
if (!m_embedElement) {
createDocumentStructure();
- if (m_doc->frame()->settings()->arePluginsEnabled()) {
- m_doc->frame()->loader()->redirectDataToPlugin(static_cast<RenderWidget*>(m_embedElement->renderer())->widget());
+ Frame* frame = m_doc->frame();
+ if (frame->settings()->arePluginsEnabled()) {
+ frame->loader()->client()->redirectDataToPlugin(static_cast<RenderWidget*>(m_embedElement->renderer())->widget());
finish();
}
+++ /dev/null
-/*
- * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "config.h"
-#import "FrameLoader.h"
-
-#import "BlockExceptions.h"
-#import "Cache.h"
-#import "Chrome.h"
-#import "DOMElementInternal.h"
-#import "Document.h"
-#import "DocumentLoader.h"
-#import "Event.h"
-#import "FloatRect.h"
-#import "FormDataStreamMac.h"
-#import "FormState.h"
-#import "FrameLoadRequest.h"
-#import "FrameLoaderClient.h"
-#import "FrameMac.h"
-#import "FramePrivate.h"
-#import "FrameTree.h"
-#import "FrameView.h"
-#import "HistoryItem.h"
-#import "HTMLFormElement.h"
-#import "HTMLFrameElement.h"
-#import "HTMLNames.h"
-#import "IconDatabase.h"
-#import "LoaderNSURLExtras.h"
-#import "MainResourceLoader.h"
-#import "NavigationAction.h"
-#import "Page.h"
-#import "PageState.h"
-#import "Plugin.h"
-#import "ResourceError.h"
-#import "ResourceHandle.h"
-#import "ResourceRequest.h"
-#import "ResourceResponse.h"
-#import "SharedBuffer.h"
-#import "Settings.h"
-#import "SubresourceLoader.h"
-#import "SystemTime.h"
-#import "TextResourceDecoder.h"
-#import "WebCoreFrameBridge.h"
-#import "WebCoreSystemInterface.h"
-#import "WebDataProtocol.h"
-#import "Widget.h"
-#import "WindowFeatures.h"
-#import <kjs/JSLock.h>
-#import <wtf/Assertions.h>
-
-namespace WebCore {
-
-using namespace HTMLNames;
-
-void FrameLoader::didChangeTitle(DocumentLoader* loader)
-{
- m_client->didChangeTitle(loader);
-
- // The title doesn't get communicated to the WebView until we are committed.
- if (loader->isCommitted())
- if (NSURL *urlForHistory = canonicalURL(loader->urlForHistory().getNSURL())) {
- // Must update the entries in the back-forward list too.
- // This must go through the WebFrame because it has the right notion of the current b/f item.
- m_client->setTitle(loader->title(), urlForHistory);
- m_client->setMainFrameDocumentReady(true); // update observers with new DOMDocument
- m_client->dispatchDidReceiveTitle(loader->title());
- }
-}
-
-Frame* FrameLoader::createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement, const String& referrer)
-{
- BOOL allowsScrolling = YES;
- int marginWidth = -1;
- int marginHeight = -1;
- if (ownerElement->hasTagName(frameTag) || ownerElement->hasTagName(iframeTag)) {
- HTMLFrameElement* o = static_cast<HTMLFrameElement*>(ownerElement);
- allowsScrolling = o->scrollingMode() != ScrollbarAlwaysOff;
- marginWidth = o->getMarginWidth();
- marginHeight = o->getMarginHeight();
- }
-
- BEGIN_BLOCK_OBJC_EXCEPTIONS;
-
- return [Mac(m_frame)->bridge() createChildFrameNamed:name
- withURL:url.getNSURL()
- referrer:referrer
- ownerElement:ownerElement
- allowsScrolling:allowsScrolling
- marginWidth:marginWidth
- marginHeight:marginHeight];
-
- END_BLOCK_OBJC_EXCEPTIONS;
- return 0;
-}
-
-ObjectContentType FrameLoader::objectContentType(const KURL& url, const String& mimeType)
-{
- BEGIN_BLOCK_OBJC_EXCEPTIONS;
- return (ObjectContentType)[Mac(m_frame)->bridge() determineObjectFromMIMEType:mimeType URL:url.getNSURL()];
- END_BLOCK_OBJC_EXCEPTIONS;
- return ObjectContentNone;
-}
-
-static NSArray* nsArray(const Vector<String>& vector)
-{
- unsigned len = vector.size();
- NSMutableArray* array = [NSMutableArray arrayWithCapacity:len];
- for (unsigned x = 0; x < len; x++)
- [array addObject:vector[x]];
- return array;
-}
-
-Widget* FrameLoader::createPlugin(Element* element, const KURL& url,
- const Vector<String>& paramNames, const Vector<String>& paramValues,
- const String& mimeType)
-{
- BEGIN_BLOCK_OBJC_EXCEPTIONS;
- return new Widget([Mac(m_frame)->bridge() viewForPluginWithURL:url.getNSURL()
- attributeNames:nsArray(paramNames)
- attributeValues:nsArray(paramValues)
- MIMEType:mimeType
- DOMElement:[DOMElement _elementWith:element]
- loadManually:m_frame->document()->isPluginDocument()]);
- END_BLOCK_OBJC_EXCEPTIONS;
- return 0;
-}
-
-void FrameLoader::redirectDataToPlugin(Widget* pluginWidget)
-{
- BEGIN_BLOCK_OBJC_EXCEPTIONS;
- [Mac(m_frame)->bridge() redirectDataToPlugin:pluginWidget->getView()];
- END_BLOCK_OBJC_EXCEPTIONS;
-}
-
-Widget* FrameLoader::createJavaAppletWidget(const IntSize& size, Element* element, const HashMap<String, String>& args)
-{
- Widget* result = new Widget;
-
- BEGIN_BLOCK_OBJC_EXCEPTIONS;
-
- NSMutableArray *attributeNames = [[NSMutableArray alloc] init];
- NSMutableArray *attributeValues = [[NSMutableArray alloc] init];
-
- DeprecatedString baseURLString;
- HashMap<String, String>::const_iterator end = args.end();
- for (HashMap<String, String>::const_iterator it = args.begin(); it != end; ++it) {
- if (it->first.lower() == "baseurl")
- baseURLString = it->second.deprecatedString();
- [attributeNames addObject:it->first];
- [attributeValues addObject:it->second];
- }
-
- if (baseURLString.isEmpty())
- baseURLString = m_frame->document()->baseURL();
-
- result->setView([Mac(m_frame)->bridge() viewForJavaAppletWithFrame:NSMakeRect(0, 0, size.width(), size.height())
- attributeNames:attributeNames
- attributeValues:attributeValues
- baseURL:completeURL(baseURLString).getNSURL()
- DOMElement:[DOMElement _elementWith:element]]);
- [attributeNames release];
- [attributeValues release];
- m_frame->view()->addChild(result);
-
- END_BLOCK_OBJC_EXCEPTIONS;
-
- return result;
-}
-
-void FrameLoader::partClearedInBegin()
-{
- if (m_frame->settings()->isJavaScriptEnabled())
- [Mac(m_frame)->bridge() windowObjectCleared];
-}
-
-String FrameLoader::overrideMediaType() const
-{
- NSString *overrideType = [Mac(m_frame)->bridge() overrideMediaType];
- if (overrideType)
- return overrideType;
- return String();
-}
-
-void FrameLoader::closeBridge()
-{
- [Mac(m_frame)->bridge() close];
-}
-
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2006 Dirk Mueller <mueller@kde.org>
- * Copyright (C) 2006 Zack Rusin <zack@kde.org>
- * Copyright (C) 2006 George Staikos <staikos@kde.org>
- * Copyright (C) 2006 Simon Hausmann <hausmann@kde.org>
- * Copyright (C) 2006 Rob Buis <buis@kde.org>
- * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
- * Copyright (C) 2006 Apple Computer, Inc.
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "FrameQt.h"
-
-#include "DOMImplementation.h"
-#include "DOMWindow.h"
-#include "Document.h"
-#include "Document.h"
-#include "EditorClientQt.h"
-#include "Element.h"
-#include "FrameLoadRequest.h"
-#include "FrameLoader.h"
-#include "FramePrivate.h"
-#include "FrameLoaderClientQt.h"
-#include "ResourceLoader.h"
-#include "DocumentLoader.h"
-#include "FrameView.h"
-#include "FormState.h"
-#include "GraphicsContext.h"
-#include "HTMLDocument.h"
-#include "HTMLElement.h"
-#include "HTMLFormElement.h"
-#include "HistoryItem.h"
-#include "JSLock.h"
-#include "MouseEventWithHitTestResults.h"
-#include "Page.h"
-#include "PlatformKeyboardEvent.h"
-#include "PlatformMouseEvent.h"
-#include "PlatformWheelEvent.h"
-#include "Plugin.h"
-#include "RenderLayer.h"
-#include "RenderObject.h"
-#include "RenderWidget.h"
-#include "ResourceHandle.h"
-#include "ResourceHandleInternal.h"
-#include "SelectionController.h"
-#include "Chrome.h"
-#include "Settings.h"
-#include "TypingCommand.h"
-#include "kjs_window.h"
-#include "runtime_root.h"
-
-#include <QScrollArea>
-#include <qdebug.h>
-
-#define notImplemented() qDebug("FIXME: UNIMPLEMENTED: %s:%d (%s)", __FILE__, __LINE__, __FUNCTION__)
-
-namespace WebCore {
-
-
-Frame* FrameLoader::createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement, const String& referrer)
-{
- notImplemented();
- return 0;
-}
-
-ObjectContentType FrameLoader::objectContentType(const KURL&, const String& mimeType)
-{
- notImplemented();
- return ObjectContentType();
-}
-
-Widget* FrameLoader::createPlugin(Element*, const KURL&, const Vector<String>&, const Vector<String>&, const String&)
-{
- notImplemented();
- return 0;
-}
-
-Widget* FrameLoader::createJavaAppletWidget(const IntSize&, Element*, const HashMap<String, String>&)
-{
- notImplemented();
- return 0;
-}
-
-String FrameLoader::overrideMediaType() const
-{
- // no-op
- return String();
-}
-
-void FrameLoader::partClearedInBegin()
-{
- if (m_frame->settings()->isJavaScriptEnabled())
- static_cast<FrameLoaderClientQt*>(m_client)->partClearedInBegin();
-}
-
-void FrameLoader::didChangeTitle(DocumentLoader* loader)
-{
- notImplemented();
- m_client->didChangeTitle(loader);
-}
-
-void FrameLoader::redirectDataToPlugin(Widget* pluginWidget)
-{
- notImplemented();
-}
-
-
-}
-
-// vim: ts=4 sw=4 et
ownerElement->m_contentFrame = this;
}
+ setSettings(page->settings());
+
#ifndef NDEBUG
++FrameCounter::count;
#endif
#include "FloatRect.h"
#include "Frame.h"
#include "FrameLoader.h"
+#include "FrameLoaderClient.h"
#include "HTMLDocument.h"
#include "HTMLFrameSetElement.h"
#include "HTMLNames.h"
String FrameView::mediaType() const
{
// See if we have an override type.
- String overrideType = m_frame->loader()->overrideMediaType();
+ String overrideType = m_frame->loader()->client()->overrideMediaType();
if (!overrideType.isNull())
return overrideType;
return d->m_mediaType;
: Frame(page, ownerElement, frameLoader)
, m_bindingRoot(0)
{
- Settings* settings = new Settings;
- settings->setLoadsImagesAutomatically(true);
- settings->setMinimumFontSize(5);
- settings->setMinimumLogicalFontSize(5);
- settings->setShouldPrintBackgrounds(true);
- settings->setJavaScriptEnabled(true);
-
- settings->setDefaultFixedFontSize(14);
- settings->setDefaultFontSize(14);
- settings->setSerifFontFamily("Times New Roman");
- settings->setSansSerifFontFamily("Arial");
- settings->setFixedFontFamily("Courier");
- settings->setStandardFontFamily("Arial");
-
- setSettings(settings);
-
m_client = frameClient;
m_client->setFrame(this);
}
virtual void makeDocumentView() { }
virtual void makeRepresentation(DocumentLoader*) { }
-#if PLATFORM(MAC)
- virtual void setDocumentViewFromPageCache(NSDictionary *) { }
-#endif
virtual void forceLayout() { }
virtual void forceLayoutForNonHTML() { }
virtual void setCopiesOnScroll() { }
- virtual void detachedFromParent1() { }
virtual void detachedFromParent2() { }
virtual void detachedFromParent3() { }
virtual void detachedFromParent4() { }
virtual void loadedFromPageCache() { }
-#if PLATFORM(MAC)
virtual void download(ResourceHandle*, const ResourceRequest&, const ResourceResponse&) { }
virtual void assignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader*, const ResourceRequest&) { }
virtual void dispatchDidFinishLoading(DocumentLoader*, unsigned long identifier) { }
virtual void dispatchDidFailLoading(DocumentLoader*, unsigned long identifier, const ResourceError&) { }
virtual bool dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int length) { return false; }
-#endif
virtual void dispatchDidHandleOnloadEvents() { }
virtual void dispatchDidReceiveServerRedirectForProvisionalLoad() { }
virtual void dispatchDidStartProvisionalLoad() { }
virtual void dispatchDidReceiveTitle(const String& title) { }
virtual void dispatchDidCommitLoad() { }
-#if PLATFORM(MAC)
virtual void dispatchDidFailProvisionalLoad(const ResourceError&) { }
virtual void dispatchDidFailLoad(const ResourceError&) { }
-#endif
virtual void dispatchDidFinishDocumentLoad() { }
virtual void dispatchDidFinishLoad() { }
virtual void dispatchDidFirstLayout() { }
-#if PLATFORM(MAC)
virtual Frame* dispatchCreatePage() { return 0; }
-#endif
virtual void dispatchShow() { }
-#if PLATFORM(MAC)
virtual void dispatchDecidePolicyForMIMEType(FramePolicyFunction, const String& MIMEType, const ResourceRequest&) { }
virtual void dispatchDecidePolicyForNewWindowAction(FramePolicyFunction, const NavigationAction&, const ResourceRequest&, const String& frameName) { }
virtual void dispatchDecidePolicyForNavigationAction(FramePolicyFunction, const NavigationAction&, const ResourceRequest&) { }
-#endif
virtual void cancelPolicyCheck() { }
-#if PLATFORM(MAC)
virtual void dispatchUnableToImplementPolicy(const ResourceError&) { }
-#endif
virtual void dispatchWillSubmitForm(FramePolicyFunction, PassRefPtr<FormState>) { }
virtual void clearLoadingFromPageCache(DocumentLoader*) { }
virtual bool isLoadingFromPageCache(DocumentLoader*) { return 0; }
virtual void revertToProvisionalState(DocumentLoader*) { }
-#if PLATFORM(MAC)
virtual void setMainDocumentError(DocumentLoader*, const ResourceError&) { }
-#endif
virtual void clearUnarchivingState(DocumentLoader*) { }
virtual void willChangeEstimatedProgress() { }
virtual void setMainFrameDocumentReady(bool) { }
-#if PLATFORM(MAC)
virtual void startDownload(const ResourceRequest&) { }
-#endif
virtual void willChangeTitle(DocumentLoader*) { }
virtual void didChangeTitle(DocumentLoader*) { }
-#if PLATFORM(MAC)
virtual void committedLoad(DocumentLoader*, const char*, int) { }
-#endif
virtual void finishedLoading(DocumentLoader*) { }
virtual void finalSetupForReplace(DocumentLoader*) { }
-#if PLATFORM(MAC)
virtual ResourceError cancelledError(const ResourceRequest&) { return ResourceError(); }
virtual ResourceError cannotShowURLError(const ResourceRequest&) { return ResourceError(); }
virtual ResourceError interruptForPolicyChangeError(const ResourceRequest&) { return ResourceError(); }
virtual ResourceError fileDoesNotExistError(const ResourceResponse&) { return ResourceError(); }
virtual bool shouldFallBack(const ResourceError&) { return false; }
-#endif
virtual void setDefersLoading(bool) { }
-#if PLATFORM(MAC)
virtual bool willUseArchive(ResourceLoader*, const ResourceRequest&, const KURL& originalURL) const { return false; }
-#endif
virtual bool isArchiveLoadPending(ResourceLoader*) const { return false; }
virtual void cancelPendingArchiveLoad(ResourceLoader*) { }
virtual void clearArchivedResources() { }
virtual void didFinishLoad() { }
virtual void prepareForDataSourceReplacement() { }
-#if PLATFORM(MAC)
virtual PassRefPtr<DocumentLoader> createDocumentLoader(const ResourceRequest& request) { return new DocumentLoader(request); }
-#endif
virtual void setTitle(const String& title, const KURL&) { }
virtual String userAgent() { return ""; }
virtual void saveDocumentViewToPageCache(PageCache*) { }
virtual bool canCachePage() const { return false; }
+ virtual Frame* createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement,
+ const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight) { return 0; }
+ virtual Widget* createPlugin(Element*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool) { return 0; }
+ virtual Widget* createJavaAppletWidget(const IntSize&, Element*, const KURL&, const Vector<String>&, const Vector<String>&) { return 0; }
+
+ virtual ObjectContentType objectContentType(const KURL& url, const String& mimeType) { return ObjectContentType(); }
+ virtual String overrideMediaType() const { return String(); }
+
+ virtual void redirectDataToPlugin(WebCore::Widget*) {}
+ virtual void windowObjectCleared() const {}
};
class SVGEmptyEditorClient : public EditorClient {
+2007-01-23 Lars Knoll <lars@trolltech.com>
+
+ Reviewed by Maciej
+
+ Make the last remaining pieces of the FrameLoader platform
+ independent. Move most of the code over to WebFrameLoaderClient.
+ Some smaller cleanups in the WebFrameBridge, and moved some
+ platform independent functionality over to the shared code
+ in WebCore.
+
+ * Webcoresupport/WebFrameBridge.mm:
+ (-[WebFrameBridge finishInitializingWithPage:frameName:frameView:ownerElement:]):
+ (-[WebFrameBridge createChildFrameNamed:withURL:referrer:ownerElement:allowsScrolling:marginWidth:marginHeight:]):
+ (-[WebFrameBridge viewForPluginWithURL:attributeNames:attributeValues:MIMEType:DOMElement:loadManually:]):
+ * WebCoreSupport/WebFrameLoaderClient.h:
+ * WebCoreSupport/WebFrameLoaderClient.mm:
+ (WebFrameLoaderClient::setTitle):
+ (WebFrameLoaderClient::createFrame):
+ (WebFrameLoaderClient::objectContentType):
+ (nsArray):
+ (WebFrameLoaderClient::createPlugin):
+ (WebFrameLoaderClient::redirectDataToPlugin):
+ (nsMutableArray):
+ (WebFrameLoaderClient::createJavaAppletWidget):
+ (WebFrameLoaderClient::overrideMediaType):
+ (WebFrameLoaderClient::windowObjectCleared):
+
2007-01-23 Oliver Hunt <oliver@apple.com>
Reviewed by Adam.
m_frame = new FrameMac(page, ownerElement, new WebFrameLoaderClient(_frame));
m_frame->setBridge(self);
m_frame->tree()->setName(name);
- m_frame->setSettings(core(webView)->settings());
[self setTextSizeMultiplier:[webView textSizeMultiplier]];
marginWidth:(int)width
marginHeight:(int)height
{
- bool hideReferrer;
- if (!m_frame->loader()->canLoad(URL, referrer, hideReferrer))
- return 0;
-
ASSERT(_frame);
WebFrameView *childView = [[WebFrameView alloc] initWithFrame:NSMakeRect(0,0,0,0)];
RefPtr<Frame> newFrame = [newBridge _frame];
- [_frame _loadURL:URL referrer:(hideReferrer ? String() : referrer) intoChild:kit(newFrame.get())];
+ [_frame _loadURL:URL referrer:referrer intoChild:kit(newFrame.get())];
// The frame's onload handler may have removed it from the document.
if (!newFrame->tree()->parent())
DOMElement:(DOMElement *)element
loadManually:(BOOL)loadManually
{
- bool hideReferrer;
- if (!m_frame->loader()->canLoad(URL, m_frame->loader()->outgoingReferrer(), hideReferrer))
- return nil;
-
ASSERT([attributeNames count] == [attributeValues count]);
WebBasePluginPackage *pluginPackage = nil;
virtual void setCopiesOnScroll();
- virtual void detachedFromParent1();
virtual void detachedFromParent2();
virtual void detachedFromParent3();
virtual void detachedFromParent4();
virtual PassRefPtr<WebCore::DocumentLoader> createDocumentLoader(const WebCore::ResourceRequest&);
virtual void setTitle(const WebCore::String& title, const WebCore::KURL&);
+ virtual WebCore::Frame* createFrame(const WebCore::KURL& url, const WebCore::String& name, WebCore::HTMLFrameOwnerElement*,
+ const WebCore::String& referrer, bool allowsScrolling, int marginWidth, int marginHeight);
+ virtual WebCore::Widget* createPlugin(WebCore::Element*, const WebCore::KURL&, const Vector<WebCore::String>&,
+ const Vector<WebCore::String>&, const WebCore::String&, bool);
+ virtual void redirectDataToPlugin(WebCore::Widget* pluginWidget);
+
+ virtual WebCore::Widget* createJavaAppletWidget(const WebCore::IntSize&, WebCore::Element*, const WebCore::KURL& baseURL,
+ const Vector<WebCore::String>& paramNames, const Vector<WebCore::String>& paramValues);
+
+ virtual WebCore::ObjectContentType objectContentType(const WebCore::KURL& url, const WebCore::String& mimeType);
+ virtual WebCore::String overrideMediaType() const;
+
+ virtual void windowObjectCleared() const;
+
void deliverArchivedResourcesAfterDelay() const;
bool canUseArchivedResource(NSURLRequest *) const;
bool canUseArchivedResource(NSURLResponse *) const;
#import "WebFrame.h"
#undef private
+#import "DOMElementInternal.h"
#import "WebBackForwardList.h"
#import "WebChromeClient.h"
#import "WebDataSourceInternal.h"
#import "WebUIDelegate.h"
#import "WebViewInternal.h"
#import <WebCore/AuthenticationMac.h>
+#import <WebCore/BlockExceptions.h>
#import <WebCore/Chrome.h>
#import <WebCore/Document.h>
#import <WebCore/DocumentLoader.h>
#import <WebCore/HitTestResult.h>
#import <WebCore/HTMLFormElement.h>
#import <WebCore/IconDatabase.h>
+#import <WebCore/LoaderNSURLExtras.h>
#import <WebCore/MouseEvent.h>
#import <WebCore/Page.h>
#import <WebCore/PageCache.h>
#import <WebCore/ResourceRequest.h>
#import <WebCore/WebCoreFrameBridge.h>
#import <WebCore/WebDataProtocol.h>
+#import <WebCore/Widget.h>
+#import <WebKit/DOMElement.h>
#import <WebKit/DOMHTMLFormElement.h>
#import <WebKitSystemInterface.h>
#import <wtf/PassRefPtr.h>
[[[m_webFrame->_private->webFrameView _scrollView] contentView] setCopiesOnScroll:YES];
}
-void WebFrameLoaderClient::detachedFromParent1()
-{
- Frame* coreFrame = core(m_webFrame.get());
- if (coreFrame)
- coreFrame->loader()->saveScrollPositionAndViewStateToItem(coreFrame->loader()->currentHistoryItem());
-}
-
void WebFrameLoaderClient::detachedFromParent2()
{
[m_webFrame->_private->inspectors makeObjectsPerformSelector:@selector(_webFrameDetached:) withObject:m_webFrame.get()];
// Once that task is complete, this will go away
void WebFrameLoaderClient::setTitle(const String& title, const KURL& URL)
{
+ NSURL* nsURL = canonicalURL(URL.getNSURL());
+ if(!nsURL)
+ return;
NSString *titleNSString = title;
- [[[WebHistory optionalSharedHistory] itemForURL:URL.getNSURL()] setTitle:titleNSString];
+ [[[WebHistory optionalSharedHistory] itemForURL:nsURL] setTitle:titleNSString];
if (HistoryItem* item = core(m_webFrame.get())->loader()->currentHistoryItem())
item->setTitle(title);
}
return [[[m_webFrame.get() dataSource] representation] isKindOfClass:[WebHTMLRepresentation class]];
}
+Frame* WebFrameLoaderClient::createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement,
+ const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight)
+{
+ WebFrameBridge* bridge = m_webFrame->_private->bridge;
+ BEGIN_BLOCK_OBJC_EXCEPTIONS;
+
+ return [bridge createChildFrameNamed:name
+ withURL:url.getNSURL()
+ referrer:referrer
+ ownerElement:ownerElement
+ allowsScrolling:allowsScrolling
+ marginWidth:marginWidth
+ marginHeight:marginHeight];
+
+ END_BLOCK_OBJC_EXCEPTIONS;
+ return 0;
+}
+
+ObjectContentType WebFrameLoaderClient::objectContentType(const KURL& url, const String& mimeType)
+{
+ WebFrameBridge* bridge = m_webFrame->_private->bridge;
+ BEGIN_BLOCK_OBJC_EXCEPTIONS;
+ return (ObjectContentType)[bridge determineObjectFromMIMEType:mimeType URL:url.getNSURL()];
+ END_BLOCK_OBJC_EXCEPTIONS;
+ return ObjectContentNone;
+}
+
+static NSArray* nsArray(const Vector<String>& vector)
+{
+ unsigned len = vector.size();
+ NSMutableArray* array = [NSMutableArray arrayWithCapacity:len];
+ for (unsigned x = 0; x < len; x++)
+ [array addObject:vector[x]];
+ return array;
+}
+
+Widget* WebFrameLoaderClient::createPlugin(Element* element, const KURL& url, const Vector<String>& paramNames,
+ const Vector<String>& paramValues, const String& mimeType, bool loadManually)
+{
+ WebFrameBridge* bridge = m_webFrame->_private->bridge;
+
+ BEGIN_BLOCK_OBJC_EXCEPTIONS;
+ return new Widget([bridge viewForPluginWithURL:url.getNSURL()
+ attributeNames:nsArray(paramNames)
+ attributeValues:nsArray(paramValues)
+ MIMEType:mimeType
+ DOMElement:[DOMElement _elementWith:element]
+ loadManually:loadManually]);
+ END_BLOCK_OBJC_EXCEPTIONS;
+
+ return 0;
+}
+
+void WebFrameLoaderClient::redirectDataToPlugin(Widget* pluginWidget)
+{
+ BEGIN_BLOCK_OBJC_EXCEPTIONS;
+ [m_webFrame->_private->bridge redirectDataToPlugin:pluginWidget->getView()];
+ END_BLOCK_OBJC_EXCEPTIONS;
+}
+
+WebCore::Widget* WebFrameLoaderClient::createJavaAppletWidget(const IntSize& size, Element* element, const KURL& baseURL,
+ const Vector<String>& paramNames, const Vector<String>& paramValues)
+{
+ Widget* result = new Widget;
+
+ BEGIN_BLOCK_OBJC_EXCEPTIONS;
+ WebFrameBridge* bridge = m_webFrame->_private->bridge;
+ result->setView([bridge viewForJavaAppletWithFrame:NSMakeRect(0, 0, size.width(), size.height())
+ attributeNames:nsArray(paramNames)
+ attributeValues:nsArray(paramValues)
+ baseURL:baseURL.getNSURL()
+ DOMElement:[DOMElement _elementWith:element]]);
+ END_BLOCK_OBJC_EXCEPTIONS;
+
+ return result;
+}
+
+String WebFrameLoaderClient::overrideMediaType() const
+{
+ NSString* overrideType = [m_webFrame->_private->bridge overrideMediaType];
+ if (overrideType)
+ return overrideType;
+ return String();
+}
+
+void WebFrameLoaderClient::windowObjectCleared() const
+{
+ [m_webFrame->_private->bridge windowObjectCleared];
+}
+
@implementation WebFramePolicyListener
- (id)initWithWebCoreFrame:(Frame*)frame
#include "FrameQtClient.h"
#include "FrameQt.h"
#include "FrameView.h"
+#include "ResourceRequest.h"
#include "markup.h"
#include "RenderTreeAsText.h"
#include "ExecState.h"
#include "object.h"
+#include "wtf/HashMap.h"
using namespace WebCore;
-QWebFrame::QWebFrame(QWebPage *parent)
+QWebFrame::QWebFrame(QWebPage *parent, QWebFrameData *frameData)
: QScrollArea(parent)
, d(new QWebFramePrivate)
{
d->page = parent;
d->frameLoaderClient = new FrameLoaderClientQt();
- d->frame = new FrameQt(parent->d->page, 0, new FrameQtClient(), d->frameLoaderClient);
- d->frameLoaderClient->setFrame(this, d->frame);
+ d->frame = new FrameQt(parent->d->page, frameData->ownerElement, new FrameQtClient(), d->frameLoaderClient);
+ d->frameLoaderClient->setFrame(this, d->frame.get());
- d->frameView = new FrameView(d->frame);
+ d->frameView = new FrameView(d->frame.get());
d->frameView->setScrollArea(this);
- d->frame->setView(d->frameView);
+ d->frame->setView(d->frameView.get());
+ if (!frameData->url.isEmpty()) {
+ ResourceRequest request(frameData->url, frameData->referrer);
+ d->frame->loader()->load(request, frameData->name);
+ }
}
-QWebFrame::QWebFrame(QWebFrame *parent)
+QWebFrame::QWebFrame(QWebFrame *parent, QWebFrameData *frameData)
: QScrollArea(parent)
, d(new QWebFramePrivate)
{
d->page = parent->d->page;
-// d->frameLoaderClient = new FrameLoaderClientQt();
-// d->frame = new FrameQt(page, 0, new FrameQtClient(), frameLoaderClient);
-// d->frameLoaderClient->setFrame(d->frame);
-// d->frameView = new FrameView(d->frame);
-// d->frameView->setScrollArea(this);
-// d->frame->setView(d->frameView);
+ d->frameLoaderClient = new FrameLoaderClientQt();
+ d->frame = new FrameQt(parent->d->page->d->page, frameData->ownerElement, new FrameQtClient(), d->frameLoaderClient);
+ d->frameLoaderClient->setFrame(this, d->frame.get());
+
+ d->frameView = new FrameView(d->frame.get());
+ d->frameView->setScrollArea(this);
+ d->frame->setView(d->frameView.get());
}
QWebFrame::~QWebFrame()
{
- delete d->frame;
+ delete d;
}
void QWebFrame::addToJSWindowObject(const QByteArray &name, QObject *object)
namespace WebCore {
class FrameLoaderClientQt;
}
+class QWebFrameData;
class QWebFrame : public QScrollArea
{
Q_OBJECT
-public:
- QWebFrame(QWebPage *parent);
- QWebFrame(QWebFrame *parent);
+protected:
+ QWebFrame(QWebPage *parent, QWebFrameData *frameData);
+ QWebFrame(QWebFrame *parent, QWebFrameData *frameData);
~QWebFrame();
+public:
+
QWebPage *page() const;
void addToJSWindowObject(const QByteArray &name, QObject *object);
#include "qwebframe.h"
#include "qwebpage_p.h"
+#include "KURL.h"
+#include "PlatformString.h"
+#include "FrameView.h"
+#include "wtf/RefPtr.h"
+
namespace WebCore
{
class FrameLoaderClientQt;
class FrameQt;
class FrameView;
+ class HTMLFrameOwnerElement;
}
class QWebPage;
, page(0)
{}
WebCore::FrameLoaderClientQt *frameLoaderClient;
- WebCore::FrameQt *frame;
- WebCore::FrameView *frameView;
+ WTF::RefPtr<WebCore::FrameQt> frame;
+ WTF::RefPtr<WebCore::FrameView> frameView;
QWebPage *page;
};
+class QWebFrameData
+{
+public:
+ WebCore::KURL url;
+ WebCore::String name;
+ WebCore::HTMLFrameOwnerElement* ownerElement;
+
+ WebCore::String referrer;
+ bool allowsScrolling;
+ int marginWidth;
+ int marginHeight;
+};
#endif
#include "ChromeClientQt.h"
#include "ContextMenuClientQt.h"
#include "EditorClientQt.h"
+#include "Settings.h"
#include "Page.h"
#include "FrameLoader.h"
#include "KURL.h"
editorClient = new EditorClientQt();
page = new Page(chromeClient, contextMenuClient, editorClient);
+ Settings *settings = page->settings();
+ settings->setLoadsImagesAutomatically(true);
+ settings->setMinimumFontSize(5);
+ settings->setMinimumLogicalFontSize(5);
+ settings->setShouldPrintBackgrounds(true);
+ settings->setJavaScriptEnabled(true);
+
+ settings->setDefaultFixedFontSize(14);
+ settings->setDefaultFontSize(14);
+ settings->setSerifFontFamily("Times New Roman");
+ settings->setSansSerifFontFamily("Arial");
+ settings->setFixedFontFamily("Courier");
+ settings->setStandardFontFamily("Arial");
+
mainFrame = 0;
}
void QWebPagePrivate::createMainFrame()
{
if (!mainFrame) {
- mainFrame = q->createFrame(0);
+ QWebFrameData frameData;
+ frameData.ownerElement = 0;
+ frameData.allowsScrolling = true;
+ frameData.marginWidth = 5;
+ frameData.marginHeight = 5;
+ mainFrame = q->createFrame(0, &frameData);
layout->addWidget(mainFrame);
}
}
delete d;
}
-QWebFrame *QWebPage::createFrame(QWebFrame *parentFrame)
+QWebFrame *QWebPage::createFrame(QWebFrame *parentFrame, QWebFrameData *frameData)
{
if (parentFrame)
- return new QWebFrame(parentFrame);
- return new QWebFrame(this);
+ return new QWebFrame(parentFrame, frameData);
+ return new QWebFrame(this, frameData);
}
void QWebPage::open(const QUrl &url)
class QUrl;
class QWebPagePrivate;
+class QWebFrameData;
+
+namespace WebCore {
+ class FrameLoaderClientQt;
+}
class QWebPage : public QWidget
{
QWebPage(QWidget *parent);
~QWebPage();
- virtual QWebFrame *createFrame(QWebFrame *parentFrame);
- //virtual QWebPage *createPage(...);
void open(const QUrl &url);
*/
void loadFinished(QWebFrame *frame);
+protected:
+ virtual QWebFrame *createFrame(QWebFrame *parentFrame, QWebFrameData *frameData);
+ //virtual QWebPage *createPage(...);
private:
friend class QWebFrame;
+ friend class QWebPagePrivate;
+ friend class WebCore::FrameLoaderClientQt;
QWebPagePrivate *d;
};
+2007-01-23 Lars Knoll <lars@trolltech.com>
+
+ Reviewed by Maciej
+
+ Add support for Frames to the Qt build and fix some issues
+ in the API classes.
+
+ * Api/qwebframe.cpp:
+ (QWebFrame::QWebFrame):
+ (QWebFrame::~QWebFrame):
+ * Api/qwebframe.h:
+ * Api/qwebframe_p.h:
+ * Api/qwebpage.cpp:
+ (QWebPagePrivate::QWebPagePrivate):
+ (QWebPagePrivate::createMainFrame):
+ (QWebPage::createFrame):
+ * Api/qwebpage.h:
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::detachedFromParent3):
+ (WebCore::FrameLoaderClientQt::detachedFromParent4):
+ (WebCore::FrameLoaderClientQt::cancelPolicyCheck):
+ (WebCore::FrameLoaderClientQt::windowObjectCleared):
+ (WebCore::FrameLoaderClientQt::createFrame):
+ (WebCore::FrameLoaderClientQt::objectContentType):
+ (WebCore::FrameLoaderClientQt::createPlugin):
+ (WebCore::FrameLoaderClientQt::redirectDataToPlugin):
+ (WebCore::FrameLoaderClientQt::createJavaAppletWidget):
+ (WebCore::FrameLoaderClientQt::overrideMediaType):
+ * WebCoreSupport/FrameLoaderClientQt.h:
+
2007-01-23 Oliver Hunt <oliver@apple.com>
Reviewed by Adam.
/*
* Copyright (C) 2006 Zack Rusin <zack@kde.org>
* Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2007 Trolltech ASA
*
* All rights reserved.
*
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
+
#include "config.h"
#include "FrameLoaderClientQt.h"
+#include "FrameTree.h"
+#include "FrameView.h"
#include "DocumentLoader.h"
#include "ResourceResponse.h"
#include "Page.h"
#include "ProgressTracker.h"
+#include "ResourceRequest.h"
#include "qwebpage.h"
#include "qwebframe.h"
+#include "qwebframe_p.h"
#include "qdebug.h"
notImplemented();
}
-
-void FrameLoaderClientQt::detachedFromParent1()
-{
- notImplemented();
-}
-
-
void FrameLoaderClientQt::detachedFromParent2()
{
notImplemented();
void FrameLoaderClientQt::detachedFromParent3()
{
- notImplemented();
+ m_webFrame->d->frameView = 0;
}
void FrameLoaderClientQt::detachedFromParent4()
{
- notImplemented();
+ delete m_webFrame;
}
void FrameLoaderClientQt::cancelPolicyCheck()
{
+ qDebug() << "FrameLoaderClientQt::cancelPolicyCheck";
m_policyFunction = 0;
}
return true;
}
-void FrameLoaderClientQt::partClearedInBegin()
+void FrameLoaderClientQt::windowObjectCleared() const
{
emit m_webFrame->cleared();
}
return false;
}
+Frame* FrameLoaderClientQt::createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement,
+ const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight)
+{
+ qDebug() << ">>>>>>>>>>> createFrame";
+ QWebFrameData frameData;
+ frameData.url = url;
+ frameData.name = name;
+ frameData.ownerElement = ownerElement;
+ frameData.referrer = referrer;
+ frameData.allowsScrolling = allowsScrolling;
+ frameData.marginWidth = marginWidth;
+ frameData.marginHeight = marginHeight;
+
+
+ QWebFrame* webFrame = m_webFrame->page()->createFrame(m_webFrame, &frameData);
+
+ RefPtr<Frame> childFrame = webFrame->d->frame;
+
+ // FIXME: All of the below should probably be moved over into WebCore
+ childFrame->tree()->setName(name);
+ m_frame->tree()->appendChild(childFrame);
+ // ### set override encoding if we have one
+
+ FrameLoadType loadType = m_frame->loader()->loadType();
+ FrameLoadType childLoadType = FrameLoadTypeInternal;
+
+ childFrame->loader()->load(frameData.url, frameData.referrer, childLoadType,
+ String(), 0, 0, WTF::HashMap<String, String>());
+
+ // The frame's onload handler may have removed it from the document.
+ if (!childFrame->tree()->parent())
+ return 0;
+
+ return childFrame.get();
+}
+
+ObjectContentType FrameLoaderClientQt::objectContentType(const KURL& url, const String& mimeType)
+{
+ notImplemented();
+ return ObjectContentType();
+}
+
+Widget* FrameLoaderClientQt::createPlugin(Element*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool)
+{
+ notImplemented();
+ return 0;
+}
+
+void FrameLoaderClientQt::redirectDataToPlugin(Widget* pluginWidget)
+{
+ notImplemented();
+ return;
+}
+
+Widget* FrameLoaderClientQt::createJavaAppletWidget(const IntSize&, Element*, const KURL& baseURL,
+ const Vector<String>& paramNames, const Vector<String>& paramValues)
+{
+ notImplemented();
+ return 0;
+}
+
+String FrameLoaderClientQt::overrideMediaType() const
+{
+ notImplemented();
+ return String();
+}
+
}
#include "FrameLoaderClientQt.moc"
class NavigationAction;
class String;
class ResourceLoader;
-
+
struct LoadErrorResetToken;
class FrameLoaderClientQt : public QObject, public FrameLoaderClient {
virtual void willCloseDocument();
- virtual void detachedFromParent1();
virtual void detachedFromParent2();
virtual void detachedFromParent3();
virtual void detachedFromParent4();
virtual void postProgressStartedNotification();
virtual void postProgressEstimateChangedNotification();
virtual void postProgressFinishedNotification();
-
- // FIXME: This should probably not be here, but it's needed for the tests currently
- virtual void partClearedInBegin();
+ virtual Frame* createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement,
+ const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight) ;
+ virtual Widget* createPlugin(Element*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool);
+ virtual void redirectDataToPlugin(Widget* pluginWidget);
+ virtual Widget* createJavaAppletWidget(const IntSize&, Element*, const KURL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues);
+
+ virtual ObjectContentType objectContentType(const KURL& url, const String& mimeType);
+ virtual String overrideMediaType() const;
+
+ virtual void windowObjectCleared() const;
private:
Frame *m_frame;