Commit b0eb2ac5 authored by rjw's avatar rjw

Changes for back/forward. Currently disabled.

        * History.subproj/WebHistoryItem.h:
        * History.subproj/WebHistoryItem.m:
        (-[WebHistoryItem dealloc]):
        (-[WebHistoryItem setPageCacheEnabled:]):
        (-[WebHistoryItem pageCache]):
        * Misc.subproj/WebKitLogging.h:
        * Misc.subproj/WebKitLogging.m:
        * WebCoreSupport.subproj/WebBridge.m:
        (-[WebBridge saveDocumentToPageCache:]):
        * WebView.subproj/WebDataSource.m:
        (-[WebDataSource startLoading]):
        * WebView.subproj/WebDataSourcePrivate.h:
        * WebView.subproj/WebDataSourcePrivate.m:
        (-[WebDataSource _startLoading:]):
        (-[WebDataSource _startLoading]):
        (-[WebDataSource _commitIfReady:]):
        (-[WebDataSource _commitIfReady]):
        (-[WebDataSource _setStoredInPageCache:]):
        (-[WebDataSource _storedInPageCache]):
        * WebView.subproj/WebFramePrivate.h:
        * WebView.subproj/WebFramePrivate.m:
        (-[WebFrame _transitionToCommitted:]):
        (-[WebFrame _canCachePage]):
        (-[WebFrame _purgePageCache]):
        (-[WebFrame _setState:]):
        (-[WebFrame _continueFragmentScrollAfterNavigationPolicy:request:]):
        (-[WebFrame _continueLoadRequestAfterNavigationPolicy:request:]):

        Changes for back/forward.  Currently disabled.

        * ForwardingHeaders/kjs/property_map.h: Added.
        * khtml/ecma/kjs_window.cpp:
        (Window::hasTimeouts):
        (WindowQObject::hasTimeouts):
        * khtml/ecma/kjs_window.h:
        * khtml/khtmlpart_p.h:
        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::DocumentImpl):
        (DocumentImpl::detach):
        (DocumentImpl::inPageCache):
        (DocumentImpl::setInPageCache):
        * khtml/xml/dom_docimpl.h:
        * kwq/KWQKHTMLPart.h:
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::setView):
        (KWQKHTMLPart::userAgent):
        (KWQKHTMLPart::nextKeyViewForWidget):
        (KWQKHTMLPart::canCachePage):
        (KWQKHTMLPart::saveWindowProperties):
        (KWQKHTMLPart::saveLocationProperties):
        (KWQKHTMLPart::restoreWindowProperties):
        (KWQKHTMLPart::restoreLocationProperties):
        (KWQKHTMLPart::openURLFromPageCache):
        * kwq/WebCoreBridge.h:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge openURL:reload:headers:lastModified:pageCache:]):
        (-[WebCoreBridge saveDocumentToPageCache]):
        (-[WebCoreBridge canCachePage]):
        (attributedString):
        (-[KWQPageState initWithDocument:DOM::URL:windowProperties:KJS::locationProperties:KJS::]):
        (-[KWQPageState dealloc]):
        (-[KWQPageState DOM::]):
        (-[KWQPageState URL]):
        (-[KWQPageState KJS::]):

        Changes for back/forward.  Currently disabled.

        * kjs/property_map.cpp:
        * kjs/property_map.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2863 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent e3ec257b
2002-11-25 Richard Williamson <rjw@apple.com>
Changes for back/forward. Currently disabled.
* kjs/property_map.cpp:
* kjs/property_map.h:
2002-11-25 Darin Adler <darin@apple.com>
* kjs/property_map.cpp: Rearrange code a little bit and tweak indentation.
......
2002-11-25 Richard Williamson <rjw@apple.com>
Changes for back/forward. Currently disabled.
* kjs/property_map.cpp:
* kjs/property_map.h:
2002-11-25 Darin Adler <darin@apple.com>
* kjs/property_map.cpp: Rearrange code a little bit and tweak indentation.
......
2002-11-25 Richard Williamson <rjw@apple.com>
Changes for back/forward. Currently disabled.
* kjs/property_map.cpp:
* kjs/property_map.h:
2002-11-25 Darin Adler <darin@apple.com>
* kjs/property_map.cpp: Rearrange code a little bit and tweak indentation.
......
......@@ -68,6 +68,14 @@ public:
Value value;
};
SavedProperties::SavedProperties() : _count(0), _properties(0) { }
SavedProperties::~SavedProperties()
{
if (_properties)
delete _properties;
}
// Algorithm concepts from Algorithms in C++, Sedgewick.
PropertyMap::PropertyMap() : _table(0)
......
......@@ -38,7 +38,7 @@ namespace KJS {
class SavedProperties {
friend class PropertyMap;
public:
SavedProperties() : _count(0), _properties(0) { }
SavedProperties();
~SavedProperties();
private:
......
2002-11-25 Richard Williamson <rjw@apple.com>
Changes for back/forward.
* ForwardingHeaders/kjs/property_map.h: Added.
* khtml/ecma/kjs_window.cpp:
(Window::hasTimeouts):
(WindowQObject::hasTimeouts):
* khtml/ecma/kjs_window.h:
* khtml/khtmlpart_p.h:
* khtml/xml/dom_docimpl.cpp:
(DocumentImpl::DocumentImpl):
(DocumentImpl::detach):
(DocumentImpl::inPageCache):
(DocumentImpl::setInPageCache):
* khtml/xml/dom_docimpl.h:
* kwq/KWQKHTMLPart.h:
* kwq/KWQKHTMLPart.mm:
(KWQKHTMLPart::setView):
(KWQKHTMLPart::userAgent):
(KWQKHTMLPart::nextKeyViewForWidget):
(KWQKHTMLPart::canCachePage):
(KWQKHTMLPart::saveWindowProperties):
(KWQKHTMLPart::saveLocationProperties):
(KWQKHTMLPart::restoreWindowProperties):
(KWQKHTMLPart::restoreLocationProperties):
(KWQKHTMLPart::openURLFromPageCache):
* kwq/WebCoreBridge.h:
* kwq/WebCoreBridge.mm:
(-[WebCoreBridge openURL:reload:headers:lastModified:pageCache:]):
(-[WebCoreBridge saveDocumentToPageCache]):
(-[WebCoreBridge canCachePage]):
(attributedString):
(-[KWQPageState initWithDocument:DOM::URL:windowProperties:KJS::locationProperties:KJS::]):
(-[KWQPageState dealloc]):
(-[KWQPageState DOM::]):
(-[KWQPageState URL]):
(-[KWQPageState KJS::]):
2002-11-25 David Hyatt <hyatt@apple.com>
Fix for 3025963. Ensure that KJS looks for the form on the
......
2002-11-25 Richard Williamson <rjw@apple.com>
Changes for back/forward.
* ForwardingHeaders/kjs/property_map.h: Added.
* khtml/ecma/kjs_window.cpp:
(Window::hasTimeouts):
(WindowQObject::hasTimeouts):
* khtml/ecma/kjs_window.h:
* khtml/khtmlpart_p.h:
* khtml/xml/dom_docimpl.cpp:
(DocumentImpl::DocumentImpl):
(DocumentImpl::detach):
(DocumentImpl::inPageCache):
(DocumentImpl::setInPageCache):
* khtml/xml/dom_docimpl.h:
* kwq/KWQKHTMLPart.h:
* kwq/KWQKHTMLPart.mm:
(KWQKHTMLPart::setView):
(KWQKHTMLPart::userAgent):
(KWQKHTMLPart::nextKeyViewForWidget):
(KWQKHTMLPart::canCachePage):
(KWQKHTMLPart::saveWindowProperties):
(KWQKHTMLPart::saveLocationProperties):
(KWQKHTMLPart::restoreWindowProperties):
(KWQKHTMLPart::restoreLocationProperties):
(KWQKHTMLPart::openURLFromPageCache):
* kwq/WebCoreBridge.h:
* kwq/WebCoreBridge.mm:
(-[WebCoreBridge openURL:reload:headers:lastModified:pageCache:]):
(-[WebCoreBridge saveDocumentToPageCache]):
(-[WebCoreBridge canCachePage]):
(attributedString):
(-[KWQPageState initWithDocument:DOM::URL:windowProperties:KJS::locationProperties:KJS::]):
(-[KWQPageState dealloc]):
(-[KWQPageState DOM::]):
(-[KWQPageState URL]):
(-[KWQPageState KJS::]):
2002-11-25 David Hyatt <hyatt@apple.com>
Fix for 3025963. Ensure that KJS looks for the form on the
......
2002-11-25 Richard Williamson <rjw@apple.com>
Changes for back/forward.
* ForwardingHeaders/kjs/property_map.h: Added.
* khtml/ecma/kjs_window.cpp:
(Window::hasTimeouts):
(WindowQObject::hasTimeouts):
* khtml/ecma/kjs_window.h:
* khtml/khtmlpart_p.h:
* khtml/xml/dom_docimpl.cpp:
(DocumentImpl::DocumentImpl):
(DocumentImpl::detach):
(DocumentImpl::inPageCache):
(DocumentImpl::setInPageCache):
* khtml/xml/dom_docimpl.h:
* kwq/KWQKHTMLPart.h:
* kwq/KWQKHTMLPart.mm:
(KWQKHTMLPart::setView):
(KWQKHTMLPart::userAgent):
(KWQKHTMLPart::nextKeyViewForWidget):
(KWQKHTMLPart::canCachePage):
(KWQKHTMLPart::saveWindowProperties):
(KWQKHTMLPart::saveLocationProperties):
(KWQKHTMLPart::restoreWindowProperties):
(KWQKHTMLPart::restoreLocationProperties):
(KWQKHTMLPart::openURLFromPageCache):
* kwq/WebCoreBridge.h:
* kwq/WebCoreBridge.mm:
(-[WebCoreBridge openURL:reload:headers:lastModified:pageCache:]):
(-[WebCoreBridge saveDocumentToPageCache]):
(-[WebCoreBridge canCachePage]):
(attributedString):
(-[KWQPageState initWithDocument:DOM::URL:windowProperties:KJS::locationProperties:KJS::]):
(-[KWQPageState dealloc]):
(-[KWQPageState DOM::]):
(-[KWQPageState URL]):
(-[KWQPageState KJS::]):
2002-11-25 David Hyatt <hyatt@apple.com>
Fix for 3025963. Ensure that KJS looks for the form on the
......
#include <JavaScriptCore/property_map.h>
\ No newline at end of file
......@@ -852,6 +852,13 @@ void Window::clearTimeout(int timerId)
winq->clearTimeout(timerId);
}
#if APPLE_CHANGES
bool Window::hasTimeouts()
{
return winq->hasTimeouts();
}
#endif
void Window::scheduleClose()
{
kdDebug(6070) << "Window::scheduleClose window.close() " << m_part << endl;
......@@ -1519,6 +1526,13 @@ void WindowQObject::timeoutClose()
}
}
#if APPLE_CHANGES
bool WindowQObject::hasTimeouts()
{
return scheduledActions.count();
}
#endif
Value FrameArray::get(ExecState *exec, const Identifier &p) const
{
#ifdef KJS_VERBOSE
......
......@@ -89,6 +89,9 @@ namespace KJS {
virtual bool toBoolean(ExecState *exec) const;
int installTimeout(const Identifier &handler, int t, bool singleShot);
void clearTimeout(int timerId);
#ifdef APPLE_CHANGES
bool hasTimeouts();
#endif
void scheduleClose();
bool isSafeScript(ExecState *exec) const;
Location *location() const;
......@@ -155,6 +158,10 @@ namespace KJS {
int installTimeout(const Identifier &handler, int t, bool singleShot);
int installTimeout(const Value &func, List args, int t, bool singleShot);
void clearTimeout(int timerId, bool delAction = true);
#ifdef APPLE_CHANGES
bool hasTimeouts();
#endif
public slots:
void timeoutClose();
protected slots:
......
......@@ -225,6 +225,8 @@ public:
// Made this static so frame names are globally unique and unsigned
// so overflow is handled more gracefully.
static unsigned m_frameNameId;
bool m_savingPageState:1;
bool m_restoringPageState:1;
#else
int m_frameNameId;
#endif
......
......@@ -226,7 +226,7 @@ QPtrList<DocumentImpl> * DocumentImpl::changedDocuments = 0;
DocumentImpl::DocumentImpl(DOMImplementationImpl *_implementation, KHTMLView *v)
: NodeBaseImpl( new DocumentPtr() )
#if APPLE_CHANGES
, m_finishedParsing(this, SIGNAL(finishedParsing()))
, m_finishedParsing(this, SIGNAL(finishedParsing())), m_inPageCache(0)
#endif
{
document->doc = this;
......@@ -1002,6 +1002,9 @@ void DocumentImpl::attach()
void DocumentImpl::detach()
{
#if APPLE_CHANGES
if (!m_inPageCache){
#endif
RenderObject* render = m_render;
// indicate destruction mode, i.e. attached() but m_render == 0
......@@ -1016,6 +1019,9 @@ void DocumentImpl::detach()
delete m_renderArena;
m_renderArena = 0;
#if APPLE_CHANGES
}
#endif
}
void DocumentImpl::setVisuallyOrdered()
......@@ -2202,4 +2208,16 @@ NodeImpl *DocumentTypeImpl::cloneNode ( bool /*deep*/ )
return 0;
}
#if APPLE_CHANGES
bool DocumentImpl::inPageCache()
{
return m_inPageCache;
}
void DocumentImpl::setInPageCache(bool flag)
{
m_inPageCache = flag;
}
#endif
#include "dom_docimpl.moc"
......@@ -412,6 +412,12 @@ public:
KWQSignal m_finishedParsing;
static Document createInstance (DocumentImpl *impl);
bool inPageCache();
void setInPageCache (bool flag);
private:
bool m_inPageCache;
#endif
protected:
......
......@@ -51,6 +51,10 @@ namespace khtml {
class RenderPart;
}
namespace KJS {
class SavedProperties;
}
#ifdef __OBJC__
@class NSView;
@class WebCoreBridge;
......@@ -95,6 +99,13 @@ public:
void unfocusWindow();
bool canCachePage();
void saveWindowProperties(KJS::SavedProperties *windowProperties);
void saveLocationProperties(KJS::SavedProperties *locationProperties);
void restoreWindowProperties(KJS::SavedProperties *windowProperties);
void restoreLocationProperties(KJS::SavedProperties *locationProperties);
void openURLFromPageCache(DOM::DocumentImpl *doc, KURL *url, KJS::SavedProperties *windowProperties, KJS::SavedProperties *locationProperties);
void saveDocumentState();
void restoreDocumentState();
......
......@@ -32,6 +32,8 @@
#import "render_text.h"
#import "khtmlpart_p.h"
#import "khtmlview.h"
#import "kjs_window.h"
#import <kjs/property_map.h>
#import "WebCoreBridge.h"
#import "WebCoreBridgePrivate.h"
......@@ -41,6 +43,8 @@
#import "KWQKJobClasses.h"
#import "KWQLogging.h"
#import "xml/dom2_eventsimpl.h"
#undef _KWQ_TIMING
using khtml::Cache;
......@@ -219,7 +223,7 @@ ReadOnlyPart *KWQKHTMLPart::createPart(const ChildFrame &child, const KURL &url,
void KWQKHTMLPart::setView(KHTMLView *view, bool weOwnIt)
{
if (_ownsView) {
if (_ownsView && !d->m_doc->inPageCache()) {
delete d->m_view;
}
d->m_view = view;
......@@ -330,7 +334,11 @@ RenderObject *KWQKHTMLPart::renderer()
QString KWQKHTMLPart::userAgent() const
{
return QString::fromNSString([_bridge userAgentForURL:part->m_url.url().getNSString()]);
NSString *us = [_bridge userAgentForURL:part->m_url.url().getNSString()];
if (us)
return QString::fromNSString(us);
return QString();
}
NSView *KWQKHTMLPart::nextKeyViewInFrame(NodeImpl *node, KWQSelectionDirection direction)
......@@ -414,6 +422,118 @@ NSView *KWQKHTMLPart::nextKeyViewForWidget(QWidget *startingWidget, KWQSelection
return partForNode(node)->nextKeyView(node, direction);
}
bool KWQKHTMLPart::canCachePage()
{
// Only save page state if:
// 1. We're not a frame or frameset.
// 2. The page has no javascript timers.
// 3. The page has no unload handler.
// 4. The page has no plugins.
if (d->m_doc &&
(d->m_frames.count() ||
part->parentPart() ||
d->m_objects.count() ||
d->m_doc->getWindowEventListener (DOM::EventImpl::UNLOAD_EVENT) ||
(d->m_jscript && KJS::Window::retrieveWindow(part)->hasTimeouts()))){
printf ("Not saving page state for %s\n", part->m_url.url().latin1());
return false;
}
return true;
}
void KWQKHTMLPart::saveWindowProperties(KJS::SavedProperties *windowProperties)
{
KJS::Window::retrieveWindow(part)->saveProperties(*windowProperties);
}
void KWQKHTMLPart::saveLocationProperties(KJS::SavedProperties *locationProperties)
{
KJS::Window::retrieveWindow(part)->location()->saveProperties(*locationProperties);
}
void KWQKHTMLPart::restoreWindowProperties(KJS::SavedProperties *windowProperties)
{
KJS::Window::retrieveWindow(part)->restoreProperties(*windowProperties);
}
void KWQKHTMLPart::restoreLocationProperties(KJS::SavedProperties *locationProperties)
{
KJS::Window::retrieveWindow(part)->location()->restoreProperties(*locationProperties);
}
void KWQKHTMLPart::openURLFromPageCache(DOM::DocumentImpl *doc, KURL *url, KJS::SavedProperties *windowProperties, KJS::SavedProperties *locationProperties)
{
printf ("KWQKHTMLPart::openURLFromPageCache\n");
d->m_redirectionTimer.stop();
// We still have to close the previous part page.
if (!d->m_restored){
part->closeURL();
}
d->m_bComplete = false;
// Don't re-emit the load event.
d->m_bLoadEventEmitted = true;
// delete old status bar msg's from kjs (if it _was_ activated on last URL)
if( d->m_bJScriptEnabled )
{
d->m_kjsStatusBarText = QString::null;
d->m_kjsDefaultStatusBarText = QString::null;
}
part->m_url = *url;
// set the javascript flags according to the current url
d->m_bJScriptEnabled = KHTMLFactory::defaultHTMLSettings()->isJavaScriptEnabled(part->m_url.host());
d->m_bJScriptDebugEnabled = KHTMLFactory::defaultHTMLSettings()->isJavaScriptDebugEnabled();
d->m_bJavaEnabled = KHTMLFactory::defaultHTMLSettings()->isJavaEnabled(part->m_url.host());
d->m_bPluginsEnabled = KHTMLFactory::defaultHTMLSettings()->isPluginsEnabled(part->m_url.host());
// initializing m_url to the new url breaks relative links when opening such a link after this call and _before_ begin() is called (when the first
// data arrives) (Simon)
if(part->m_url.protocol().startsWith( "http" ) && !part->m_url.host().isEmpty() && part->m_url.path().isEmpty()) {
part->m_url.setPath("/");
emit d->m_extension->setLocationBarURL( part->m_url.prettyURL() );
}
// copy to m_workingURL after fixing m_url above
d->m_workingURL = part->m_url;
emit part->started( 0L );
// -----------begin-----------
part->clear();
d->m_bCleared = false;
d->m_cacheId = 0;
d->m_bComplete = false;
d->m_bLoadEventEmitted = false;
d->m_referrer = part->m_url.url();
part->m_url = *url;
KURL baseurl;
// We don't need KDE chained URI handling or window caption setting
if ( !part->m_url.isEmpty() ){
baseurl = part->m_url;
}
d->m_doc = doc;
d->m_doc->ref();
setView (doc->view(), true);
updatePolicyBaseURL();
d->m_doc->setParsing(true);
restoreWindowProperties (windowProperties);
restoreLocationProperties (locationProperties);
}
WebCoreBridge *KWQKHTMLPart::bridgeForWidget(QWidget *widget)
{
return partForNode(nodeForWidget(widget))->bridge();
......
......@@ -97,12 +97,16 @@ enum FrameBorderStyle {
- (void)setParent:(WebCoreBridge *)parent;
- (void)openURL:(NSString *)URL reload:(BOOL)reload headers:(NSDictionary *)headers lastModified:(NSDate *)lastModified;
- (void)openURL:(NSString *)URL reload:(BOOL)reload headers:(NSDictionary *)headers lastModified:(NSDate *)lastModified pageCache: (NSDictionary *)pageCache;
- (void)addData:(NSData *)data withEncoding:(NSString *)encoding;
- (void)addData:(NSData *)data withOverrideEncoding:(NSString *)encoding;
- (void)closeURL;
- (void)saveDocumentState;
- (void)restoreDocumentState;
- (BOOL)canCachePage;
- (BOOL)saveDocumentToPageCache;
- (void)end;
- (NSString *)URL;
......@@ -234,6 +238,8 @@ enum FrameBorderStyle {
- (NSView *)viewForPluginWithURL:(NSString *)URL attributes:(NSArray *)attributesArray baseURL:(NSString *)baseURL MIMEType:(NSString *)MIMEType;
- (NSView *)viewForJavaAppletWithFrame:(NSRect)frame attributes:(NSDictionary *)attributes baseURL:(NSString *)baseURL;
- (BOOL)saveDocumentToPageCache: documentInfo;
@end
// This interface definition allows those who hold a WebCoreBridge * to call all the methods
......
......@@ -52,6 +52,8 @@
#import "WebCoreDOMPrivate.h"
#import <kjs/property_map.h>
using KParts::URLArgs;
using DOM::DocumentImpl;
......@@ -61,6 +63,8 @@ using khtml::RenderImage;
using khtml::RenderObject;
using khtml::RenderPart;
using KJS::SavedProperties;
NSString *WebCoreElementFrameKey = @"WebElementFrame";
NSString *WebCoreElementImageAltStringKey = @"WebElementImageAltString";
NSString *WebCoreElementImageKey = @"WebElementImage";
......@@ -73,6 +77,20 @@ NSString *WebCoreElementLinkTitleKey = @"WebElementLinkTitle";
NSString *WebCoreElementNameKey = @"WebElementName";
NSString *WebCoreElementStringKey = @"WebElementString";
@interface KWQPageState : NSObject
{
DOM::DocumentImpl *document;
KURL *URL;
KJS::SavedProperties *windowProperties;
KJS::SavedProperties *locationProperties;
}
- initWithDocument: (DOM::DocumentImpl *)doc URL: (KURL)u windowProperties: (KJS::SavedProperties *)wp locationProperties: (KJS::SavedProperties *)lp;
- (DOM::DocumentImpl *)document;
- (KURL *)URL;
- (KJS::SavedProperties *)windowProperties;
- (KJS::SavedProperties *)locationProperties;
@end
@implementation WebCoreBridge
- init
......@@ -122,7 +140,7 @@ NSString *WebCoreElementStringKey = @"WebElementString";
_part->setParent([parent part]);
}
- (void)openURL:(NSString *)URL reload:(BOOL)reload headers:(NSDictionary *)headers lastModified:(NSDate *)lastModified
- (void)openURL:(NSString *)URL reload:(BOOL)reload headers:(NSDictionary *)headers lastModified:(NSDate *)lastModified pageCache: (NSDictionary *)pageCache
{
URLArgs args(_part->browserExtension()->urlArgs());
......@@ -138,7 +156,12 @@ NSString *WebCoreElementStringKey = @"WebElementString";
_part->browserExtension()->setURLArgs(args);
// URL
_part->openURL([URL cString]);
if (pageCache){
KWQPageState *state = [pageCache objectForKey: @"WebCorePageState"];
_part->kwq->openURLFromPageCache([state document], [state URL], [state windowProperties], [state locationProperties]);
}
else
_part->openURL([URL cString]);
// Refresh
NSString *refreshHeader = [headers objectForKey:@"Refresh"];
......@@ -199,6 +222,26 @@ NSString *WebCoreElementStringKey = @"WebElementString";
}
}
- (BOOL)saveDocumentToPageCache
{
DocumentImpl *doc = _part->kwq->document();
if (doc != 0){
KJS::SavedProperties *windowProperties = new KJS::SavedProperties();
KJS::SavedProperties *locationProperties = new KJS::SavedProperties();
_part->kwq->saveWindowProperties(windowProperties);
_part->kwq->saveLocationProperties(locationProperties);
KWQPageState *pageState = [[[KWQPageState alloc] initWithDocument: doc URL:_part->m_url windowProperties:windowProperties locationProperties:locationProperties] autorelease];
return [self saveDocumentToPageCache: pageState];
}
return false;
}
- (BOOL)canCachePage
{
return _part->kwq->canCachePage();
}
- (void)end
{
_part->end();
......@@ -607,8 +650,8 @@ static NSAttributedString *attributedString(DOM::NodeImpl *_startNode, int start
{
bool hasNewLine = true;
bool hasParagraphBreak = true;
DOM::Node n = _startNode;
khtml::RenderObject *renderer;
DOM::Node n = _startNode;
khtml::RenderObject *renderer;
NSFont *font;
NSMutableAttributedString *result = [[[NSMutableAttributedString alloc] init] autorelease];
NSAttributedString *partialString;
......@@ -842,3 +885,53 @@ DOM::Node next = n.firstChild();
}
@end
@implementation KWQPageState
- initWithDocument: (DOM::DocumentImpl *)doc URL: (KURL)u windowProperties: (KJS::SavedProperties *)wp locationProperties: (KJS::SavedProperties *)lp
{
[super init];
doc->ref();
document = doc;
document->setInPageCache(YES);
URL = new KURL(u);
windowProperties = wp;
locationProperties =lp;
return self;
}
- (void)dealloc
{
document->setInPageCache(NO);
document->deref();