[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:53:10 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit cd4186d59a6f183e9e5945157dcfdf45190cc339
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Oct 23 16:57:39 2002 +0000

    WebCore:
    
    	- fixed 3080478 -- reproducible incomplete load on apple.com
    
            * kwq/KWQLoaderImpl.mm:
            (-[WebCoreResourceLoader receivedResponse:]): Add an assert.
            (-[WebCoreResourceLoader cancel]): Don't finish here, just disconnect the handle
    	from the job, and disconnect the job from the WebCoreResourceLoader, and let the
    	KHTML code finish the cleanup later. This is the bug fix.
            (KWQCheckCacheObjectStatus): Add an assertion.
    
            * kwq/KWQKjobclasses.mm:
    	(TransferJob::~TransferJob): Don't call kill(); do the work here instead.
    	(TransferJob::kill): Self-destruct. Need this to avoid a storage leak.
    
            * khtml/misc/loader.cpp:
            (CachedObject::~CachedObject): Put some Apple-specific code inside APPLE_CHANGES.
            (CachedObject::setResponse): Streamlined this function.
            (Loader::receivedResponse): Added assertions.
    
            * kwq/qt/qxml.h: Add more stubs.
            * kwq/KWQxml.mm: Ditto.
    
            * kwq/WebCoreViewFactory.h: Add [WebCoreViewFactory fileButton], the
    	WebCoreFileButton protocol, and WebCoreFileButtonFilenameChanged.
            * kwq/WebCoreViewFactory.m: Add WebCoreFileButtonFilenameChanged.
            * WebCore.exp: Export _WebCoreFileButtonFilenameChanged.
    
    WebKit:
    
    	Add WebFileButton, to be used by WebCore soon. It's about 1/2
    	done right now. Compiles but not used yet.
    
            * WebCoreSupport.subproj/WebViewFactory.m: (-[WebViewFactory fileButton]): Added.
    
            * WebCoreSupport.subproj/WebFileButton.h: Added.
            * WebCoreSupport.subproj/WebFileButton.m: Added.
            * WebKit.pbproj/project.pbxproj: Added WebFileButton files.
    
            * WebCoreSupport.subproj/WebSubresourceClient.m:
            (-[WebSubresourceClient handle:didReceiveResponse:]): Add an assertion.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2434 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index 9634250..eb57ac0 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,31 @@
+2002-10-23  Darin Adler  <darin at apple.com>
+
+	- fixed 3080478 -- reproducible incomplete load on apple.com
+
+        * kwq/KWQLoaderImpl.mm:
+        (-[WebCoreResourceLoader receivedResponse:]): Add an assert.
+        (-[WebCoreResourceLoader cancel]): Don't finish here, just disconnect the handle
+	from the job, and disconnect the job from the WebCoreResourceLoader, and let the
+	KHTML code finish the cleanup later. This is the bug fix.
+        (KWQCheckCacheObjectStatus): Add an assertion.
+
+        * kwq/KWQKjobclasses.mm:
+	(TransferJob::~TransferJob): Don't call kill(); do the work here instead.
+	(TransferJob::kill): Self-destruct. Need this to avoid a storage leak.
+
+        * khtml/misc/loader.cpp:
+        (CachedObject::~CachedObject): Put some Apple-specific code inside APPLE_CHANGES.
+        (CachedObject::setResponse): Streamlined this function.
+        (Loader::receivedResponse): Added assertions.
+
+        * kwq/qt/qxml.h: Add more stubs.
+        * kwq/KWQxml.mm: Ditto.
+
+        * kwq/WebCoreViewFactory.h: Add [WebCoreViewFactory fileButton], the
+	WebCoreFileButton protocol, and WebCoreFileButtonFilenameChanged.
+        * kwq/WebCoreViewFactory.m: Add WebCoreFileButtonFilenameChanged.
+        * WebCore.exp: Export _WebCoreFileButtonFilenameChanged.
+
 2002-10-22  Maciej Stachowiak  <mjs at apple.com>
 
 	Forgot to check this in earlier:
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 9634250..eb57ac0 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,31 @@
+2002-10-23  Darin Adler  <darin at apple.com>
+
+	- fixed 3080478 -- reproducible incomplete load on apple.com
+
+        * kwq/KWQLoaderImpl.mm:
+        (-[WebCoreResourceLoader receivedResponse:]): Add an assert.
+        (-[WebCoreResourceLoader cancel]): Don't finish here, just disconnect the handle
+	from the job, and disconnect the job from the WebCoreResourceLoader, and let the
+	KHTML code finish the cleanup later. This is the bug fix.
+        (KWQCheckCacheObjectStatus): Add an assertion.
+
+        * kwq/KWQKjobclasses.mm:
+	(TransferJob::~TransferJob): Don't call kill(); do the work here instead.
+	(TransferJob::kill): Self-destruct. Need this to avoid a storage leak.
+
+        * khtml/misc/loader.cpp:
+        (CachedObject::~CachedObject): Put some Apple-specific code inside APPLE_CHANGES.
+        (CachedObject::setResponse): Streamlined this function.
+        (Loader::receivedResponse): Added assertions.
+
+        * kwq/qt/qxml.h: Add more stubs.
+        * kwq/KWQxml.mm: Ditto.
+
+        * kwq/WebCoreViewFactory.h: Add [WebCoreViewFactory fileButton], the
+	WebCoreFileButton protocol, and WebCoreFileButtonFilenameChanged.
+        * kwq/WebCoreViewFactory.m: Add WebCoreFileButtonFilenameChanged.
+        * WebCore.exp: Export _WebCoreFileButtonFilenameChanged.
+
 2002-10-22  Maciej Stachowiak  <mjs at apple.com>
 
 	Forgot to check this in earlier:
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 9634250..eb57ac0 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,31 @@
+2002-10-23  Darin Adler  <darin at apple.com>
+
+	- fixed 3080478 -- reproducible incomplete load on apple.com
+
+        * kwq/KWQLoaderImpl.mm:
+        (-[WebCoreResourceLoader receivedResponse:]): Add an assert.
+        (-[WebCoreResourceLoader cancel]): Don't finish here, just disconnect the handle
+	from the job, and disconnect the job from the WebCoreResourceLoader, and let the
+	KHTML code finish the cleanup later. This is the bug fix.
+        (KWQCheckCacheObjectStatus): Add an assertion.
+
+        * kwq/KWQKjobclasses.mm:
+	(TransferJob::~TransferJob): Don't call kill(); do the work here instead.
+	(TransferJob::kill): Self-destruct. Need this to avoid a storage leak.
+
+        * khtml/misc/loader.cpp:
+        (CachedObject::~CachedObject): Put some Apple-specific code inside APPLE_CHANGES.
+        (CachedObject::setResponse): Streamlined this function.
+        (Loader::receivedResponse): Added assertions.
+
+        * kwq/qt/qxml.h: Add more stubs.
+        * kwq/KWQxml.mm: Ditto.
+
+        * kwq/WebCoreViewFactory.h: Add [WebCoreViewFactory fileButton], the
+	WebCoreFileButton protocol, and WebCoreFileButtonFilenameChanged.
+        * kwq/WebCoreViewFactory.m: Add WebCoreFileButtonFilenameChanged.
+        * WebCore.exp: Export _WebCoreFileButtonFilenameChanged.
+
 2002-10-22  Maciej Stachowiak  <mjs at apple.com>
 
 	Forgot to check this in earlier:
diff --git a/WebCore/WebCore.exp b/WebCore/WebCore.exp
index ac6118d..e58b9ab 100644
--- a/WebCore/WebCore.exp
+++ b/WebCore/WebCore.exp
@@ -9,3 +9,4 @@
 .objc_class_name_WebCoreTestController
 .objc_class_name_WebCoreTextRendererFactory
 .objc_class_name_WebCoreViewFactory
+_WebCoreFileButtonFilenameChanged
diff --git a/WebCore/khtml/misc/loader.cpp b/WebCore/khtml/misc/loader.cpp
index 59336d5..38183c2 100644
--- a/WebCore/khtml/misc/loader.cpp
+++ b/WebCore/khtml/misc/loader.cpp
@@ -57,6 +57,7 @@
 #include "xml/dom_docimpl.h"
 
 #ifdef APPLE_CHANGES
+#include <KWQAssertions.h>
 #include <KWQLoaderImpl.h>
 #endif
 
@@ -72,7 +73,9 @@ CachedObject::~CachedObject()
     if(m_deleted) abort();
     Cache::removeFromLRUList(this);
     m_deleted = true;
-    KWQReleaseResponse (m_response);
+#if APPLE_CHANGES
+    KWQReleaseResponse(m_response);
+#endif
 }
 
 void CachedObject::finish()
@@ -116,15 +119,17 @@ bool CachedObject::isExpired() const
     return (difftime(now, m_expireDate) >= 0);
 }
 
-void CachedObject::setResponse (void *response)
+#if APPLE_CHANGES
+
+void CachedObject::setResponse(void *response)
 {
-    if (m_response != response){
-        KWQReleaseResponse (m_response);
-        m_response = response;
-        KWQRetainResponse (m_response);
-    }
+    KWQRetainResponse(response);
+    KWQReleaseResponse(m_response);
+    m_response = response;
 }
 
+#endif
+
 void CachedObject::setRequest(Request *_request)
 {
     if ( _request && !m_request )
@@ -1221,15 +1226,13 @@ kdDebug(6060) << "Loader::slotFinished, url = " << j->url().url() << " expires "
   servePendingRequests();
 }
 
-#ifdef APPLE_CHANGES
-void Loader::receivedResponse (KIO::Job*job,void *response)
+#if APPLE_CHANGES
+void Loader::receivedResponse(KIO::Job* job, void *response)
 {
     Request *r = m_requestsLoading[job];
-    if(!r) {
-        kdDebug( 6060 ) << "got response for unknown request!" << endl;
-        return;
-    }
-    r->object->setResponse( response );
+    ASSERT(r);
+    ASSERT(response);
+    r->object->setResponse(response);
 }
 #endif
 
diff --git a/WebCore/kwq/KWQKJobClasses.mm b/WebCore/kwq/KWQKJobClasses.mm
index 2ea8803..bff67e5 100644
--- a/WebCore/kwq/KWQKJobClasses.mm
+++ b/WebCore/kwq/KWQKJobClasses.mm
@@ -69,7 +69,7 @@ TransferJob::TransferJob(const KURL &url, const QByteArray &postData, bool showP
 
 TransferJob::~TransferJob()
 {
-    kill();
+    [d->handle cancel];
     delete d;
 }
 
@@ -117,7 +117,7 @@ void TransferJob::addMetaData(const QMap<QString, QString> &keysAndValues)
 
 void TransferJob::kill()
 {
-    [d->handle cancel];
+    delete this;
 }
 
 void TransferJob::setHandle(id <WebCoreResourceHandle> handle)
diff --git a/WebCore/kwq/KWQLoader.mm b/WebCore/kwq/KWQLoader.mm
index bd9f4d4..6b65266 100644
--- a/WebCore/kwq/KWQLoader.mm
+++ b/WebCore/kwq/KWQLoader.mm
@@ -70,9 +70,10 @@ using KIO::TransferJob;
     [super dealloc];
 }
 
-- (void)receivedResponse: response
+- (void)receivedResponse:(id)response
 {
-    loader->receivedResponse (job, response);
+    ASSERT(response);
+    loader->receivedResponse(job, response);
 }
 
 - (void)addData:(NSData *)data
@@ -83,7 +84,8 @@ using KIO::TransferJob;
 - (void)cancel
 {
     job->setError(1);
-    [self finish];
+    job->setHandle(0);
+    job = 0;
 }
 
 - (void)finish
@@ -143,12 +145,14 @@ void KWQCheckCacheObjectStatus(DocLoader *loader, CachedObject *cachedObject)
         return;
     }
     
+    ASSERT(cachedObject->response());
+    
     // Notify the caller that we "loaded".
     WebCoreBridge *bridge = ((KHTMLPart *)loader->part())->impl->bridge();
     NSURL *URL = [[NSURL alloc] initWithString:cachedObject->url().string().getNSString()];
     ASSERT(URL);
     CachedImage *cachedImage = dynamic_cast<CachedImage *>(cachedObject);
-    [bridge objectLoadedFromCache:URL response: (id)cachedObject->response() size:cachedImage ? cachedImage->dataSize() : cachedObject->size()];
+    [bridge objectLoadedFromCache:URL response:(id)cachedObject->response() size:cachedImage ? cachedImage->dataSize() : cachedObject->size()];
     [URL release];
 }
 
diff --git a/WebCore/kwq/KWQLoaderImpl.mm b/WebCore/kwq/KWQLoaderImpl.mm
index bd9f4d4..6b65266 100644
--- a/WebCore/kwq/KWQLoaderImpl.mm
+++ b/WebCore/kwq/KWQLoaderImpl.mm
@@ -70,9 +70,10 @@ using KIO::TransferJob;
     [super dealloc];
 }
 
-- (void)receivedResponse: response
+- (void)receivedResponse:(id)response
 {
-    loader->receivedResponse (job, response);
+    ASSERT(response);
+    loader->receivedResponse(job, response);
 }
 
 - (void)addData:(NSData *)data
@@ -83,7 +84,8 @@ using KIO::TransferJob;
 - (void)cancel
 {
     job->setError(1);
-    [self finish];
+    job->setHandle(0);
+    job = 0;
 }
 
 - (void)finish
@@ -143,12 +145,14 @@ void KWQCheckCacheObjectStatus(DocLoader *loader, CachedObject *cachedObject)
         return;
     }
     
+    ASSERT(cachedObject->response());
+    
     // Notify the caller that we "loaded".
     WebCoreBridge *bridge = ((KHTMLPart *)loader->part())->impl->bridge();
     NSURL *URL = [[NSURL alloc] initWithString:cachedObject->url().string().getNSString()];
     ASSERT(URL);
     CachedImage *cachedImage = dynamic_cast<CachedImage *>(cachedObject);
-    [bridge objectLoadedFromCache:URL response: (id)cachedObject->response() size:cachedImage ? cachedImage->dataSize() : cachedObject->size()];
+    [bridge objectLoadedFromCache:URL response:(id)cachedObject->response() size:cachedImage ? cachedImage->dataSize() : cachedObject->size()];
     [URL release];
 }
 
diff --git a/WebCore/kwq/KWQXml.h b/WebCore/kwq/KWQXml.h
index 51f2d92..ee8b969 100644
--- a/WebCore/kwq/KWQXml.h
+++ b/WebCore/kwq/KWQXml.h
@@ -28,6 +28,18 @@
 
 class QString;
 
+class QXmlInputSource {
+public:
+    void setData(const QString &);
+};
+
+class QXmlParseException {
+public:
+    QString message() const;
+    int columnNumber() const;
+    int lineNumber() const;
+};
+
 class QXmlAttributes {
 public:
     QString value(const QString &) const;
@@ -37,16 +49,54 @@ public:
     QString uri(int index) const;
 };
 
-class QXmlInputSource {
+class QXmlContentHandler {
 public:
-    void setData(const QString &);
+    virtual bool startDocument() = 0;
+    virtual bool endDocument() = 0;
+    virtual bool startPrefixMapping(const QString &prefix, const QString &URI) = 0;
+    virtual bool endPrefixMapping(const QString &prefix) = 0;
+    virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &attributes) = 0;
+    virtual bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName) = 0;
+    virtual bool characters(const QString &characters) = 0;
+    virtual bool ignorableWhitespace(const QString &characters) = 0;
+    virtual bool processingInstruction(const QString &target, const QString &data) = 0;
+    virtual bool skippedEntity(const QString &name) = 0;
+    virtual QString errorString() = 0;
+};
+
+class QXmlLexicalHandler {
+public:
+    virtual bool startDTD(const QString &name, const QString &publicId, const QString &systemId) = 0;
+    virtual bool endDTD() = 0;
+    virtual bool startEntity(const QString &name) = 0;
+    virtual bool endEntity(const QString &name) = 0;
+    virtual bool startCDATA() = 0;
+    virtual bool endCDATA() = 0;
+    virtual bool comment(const QString &characters) = 0;
+    virtual QString errorString() = 0;
+};
+
+class QXmlErrorHandler {
+public:
+    virtual bool warning(const QXmlParseException &exception) = 0;
+    virtual bool error(const QXmlParseException &exception) = 0;
+    virtual bool fatalError(const QXmlParseException &exception) = 0;
+    virtual QString errorString() = 0;
 };
 
-class QXmlDTDHandler { };
-class QXmlDeclHandler { };
-class QXmlErrorHandler { };
-class QXmlLexicalHandler { };
-class QXmlContentHandler { };
+class QXmlDeclHandler {
+public:
+    virtual bool attributeDecl(const QString &entityName, const QString &attributeName, const QString &type, const QString &valueDefault, const QString &value) = 0;
+    virtual bool externalEntityDecl(const QString &name, const QString &publicId, const QString &systemId) = 0;
+    virtual bool internalEntityDecl(const QString &name, const QString &value) = 0;
+};
+
+class QXmlDTDHandler {
+public:
+    virtual bool notationDecl(const QString& name, const QString& publicId, const QString& systemId) = 0;
+    virtual bool unparsedEntityDecl(const QString& name, const QString& publicId, const QString& systemId, const QString& notationName) = 0;
+    virtual QString errorString() = 0;
+};
 
 class QXmlDefaultHandler :
     public QXmlContentHandler, 
@@ -55,23 +105,48 @@ class QXmlDefaultHandler :
     public QXmlDeclHandler, 
     public QXmlDTDHandler
 {
+    virtual bool startDocument();
+    virtual bool endDocument();
+    virtual bool startPrefixMapping(const QString &prefix, const QString &URI);
+    virtual bool endPrefixMapping(const QString &prefix);
+    virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &attributes);
+    virtual bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName);
+    virtual bool characters(const QString &characters);
+    virtual bool ignorableWhitespace(const QString &characters);
+    virtual bool processingInstruction(const QString &target, const QString &data);
+    virtual bool skippedEntity(const QString &name);
+
+    virtual bool startDTD(const QString &name, const QString &publicId, const QString &systemId);
+    virtual bool endDTD();
+    virtual bool startEntity(const QString &name);
+    virtual bool endEntity(const QString &name);
+    virtual bool startCDATA();
+    virtual bool endCDATA();
+    virtual bool comment(const QString &characters);
+
+    virtual bool warning(const QXmlParseException &exception);
+    virtual bool error(const QXmlParseException &exception);
+    virtual bool fatalError(const QXmlParseException &exception);
+
+    virtual bool attributeDecl(const QString &entityName, const QString &attributeName, const QString &type, const QString &valueDefault, const QString &value);
+    virtual bool externalEntityDecl(const QString &name, const QString &publicId, const QString &systemId);
+    virtual bool internalEntityDecl(const QString &name, const QString &value);
+
+    virtual bool notationDecl(const QString& name, const QString& publicId, const QString& systemId);
+    virtual bool unparsedEntityDecl(const QString& name, const QString& publicId, const QString& systemId, const QString& notationName);
+
+    virtual QString errorString();
 };
 
 class QXmlSimpleReader {
 public:
     void setContentHandler(QXmlContentHandler *handler);
-    bool parse(const QXmlInputSource &input);
     void setLexicalHandler(QXmlLexicalHandler *handler);
     void setDTDHandler(QXmlDTDHandler *handler);
     void setDeclHandler(QXmlDeclHandler *handler);
     void setErrorHandler(QXmlErrorHandler *handler);
-};
 
-class QXmlParseException {
-public:
-    QString message() const;
-    int columnNumber() const;
-    int lineNumber() const;
+    bool parse(const QXmlInputSource &input);
 };
 
 #endif
diff --git a/WebCore/kwq/KWQXml.mm b/WebCore/kwq/KWQXml.mm
index bd42f95..bc33fbe 100644
--- a/WebCore/kwq/KWQXml.mm
+++ b/WebCore/kwq/KWQXml.mm
@@ -25,7 +25,7 @@
 
 #import <qxml.h>
 
-#import <KWQLogging.h>
+#import <KWQAssertions.h>
 
 #import <qstring.h>
 
@@ -59,8 +59,6 @@ QString QXmlAttributes::uri(int) const
     return QString();
 }
 
-
-
 void QXmlInputSource::setData(const QString& data)
 {
     ERROR("not yet implemented");
@@ -115,3 +113,133 @@ int QXmlParseException::lineNumber() const
     ERROR("not yet implemented");
     return 0;
 }
+
+bool QXmlDefaultHandler::startDocument()
+{
+    return true;
+}
+
+bool QXmlDefaultHandler::endDocument()
+{
+    return true;
+}
+
+bool QXmlDefaultHandler::startPrefixMapping(const QString &prefix, const QString &URI)
+{
+    return true;
+}
+
+bool QXmlDefaultHandler::endPrefixMapping(const QString &prefix)
+{
+    return true;
+}
+
+bool QXmlDefaultHandler::startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &attributes)
+{
+    return true;
+}
+
+bool QXmlDefaultHandler::endElement(const QString &namespaceURI, const QString &localName, const QString &qName)
+{
+    return true;
+}
+
+bool QXmlDefaultHandler::characters(const QString &characters)
+{
+    return true;
+}
+
+bool QXmlDefaultHandler::ignorableWhitespace(const QString &characters)
+{
+    return true;
+}
+
+bool QXmlDefaultHandler::processingInstruction(const QString &target, const QString &data)
+{
+    return true;
+}
+
+bool QXmlDefaultHandler::skippedEntity(const QString &name)
+{
+    return true;
+}
+
+bool QXmlDefaultHandler::startDTD(const QString &name, const QString &publicId, const QString &systemId)
+{
+    return true;
+}
+
+bool QXmlDefaultHandler::endDTD()
+{
+    return true;
+}
+
+bool QXmlDefaultHandler::startEntity(const QString &name)
+{
+    return true;
+}
+
+bool QXmlDefaultHandler::endEntity(const QString &name)
+{
+    return true;
+}
+
+bool QXmlDefaultHandler::startCDATA()
+{
+    return true;
+}
+
+bool QXmlDefaultHandler::endCDATA()
+{
+    return true;
+}
+
+bool QXmlDefaultHandler::comment(const QString &characters)
+{
+    return true;
+}
+
+bool QXmlDefaultHandler::warning(const QXmlParseException &exception)
+{
+    return true;
+}
+
+bool QXmlDefaultHandler::error(const QXmlParseException &exception)
+{
+    return true;
+}
+
+bool QXmlDefaultHandler::fatalError(const QXmlParseException &exception)
+{
+    return true;
+}
+
+bool QXmlDefaultHandler::attributeDecl(const QString &entityName, const QString &attributeName, const QString &type, const QString &valueDefault, const QString &value)
+{
+    return true;
+}
+
+bool QXmlDefaultHandler::externalEntityDecl(const QString &name, const QString &publicId, const QString &systemId)
+{
+    return true;
+}
+
+bool QXmlDefaultHandler::internalEntityDecl(const QString &name, const QString &value)
+{
+    return true;
+}
+
+bool QXmlDefaultHandler::notationDecl(const QString& name, const QString& publicId, const QString& systemId)
+{
+    return true;
+}
+
+bool QXmlDefaultHandler::unparsedEntityDecl(const QString& name, const QString& publicId, const QString& systemId, const QString& notationName)
+{
+    return true;
+}
+
+QString QXmlDefaultHandler::errorString()
+{
+    return QString();
+}
diff --git a/WebCore/kwq/WebCoreViewFactory.h b/WebCore/kwq/WebCoreViewFactory.h
index ac555ea..991cc79 100644
--- a/WebCore/kwq/WebCoreViewFactory.h
+++ b/WebCore/kwq/WebCoreViewFactory.h
@@ -28,15 +28,7 @@
 @class NSString;
 @class NSView;
 
- at protocol WebCorePluginInfo <NSObject>
-
-- (NSString *)name;
-- (NSString *)filename;
-- (NSString *)pluginDescription;
-- (NSDictionary *)MIMEToExtensionsDictionary;
-- (NSDictionary *)MIMEToDescriptionDictionary;
-
- at end
+ at protocol WebCoreFileButton;
 
 @protocol WebCoreViewFactory
 
@@ -45,6 +37,8 @@
 
 - (NSView *)viewForJavaAppletWithFrame:(NSRect)frame baseURL:(NSURL *)URL parameters:(NSDictionary *)parameters;
 
+- (NSView <WebCoreFileButton> *)fileButton;
+
 - (BOOL)runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(NSString *)defaultText returningText:(NSString **)result;
 
 @end
@@ -59,3 +53,20 @@
 
 @interface WebCoreViewFactory (SubclassResponsibility) <WebCoreViewFactory>
 @end
+
+ at protocol WebCorePluginInfo <NSObject>
+- (NSString *)name;
+- (NSString *)filename;
+- (NSString *)pluginDescription;
+- (NSDictionary *)MIMEToExtensionsDictionary;
+- (NSDictionary *)MIMEToDescriptionDictionary;
+ at end
+
+ at protocol WebCoreFileButton <NSObject>
+- (void)setFilename:(NSString *)filename;
+- (NSString *)filename;
+- (NSSize)bestSize;
+- (float)baseline;
+ at end
+
+extern NSString *WebCoreFileButtonFilenameChanged;
diff --git a/WebCore/kwq/WebCoreViewFactory.m b/WebCore/kwq/WebCoreViewFactory.m
index 7c63b95..cafd930 100644
--- a/WebCore/kwq/WebCoreViewFactory.m
+++ b/WebCore/kwq/WebCoreViewFactory.m
@@ -26,6 +26,8 @@
 #import "WebCoreViewFactory.h"
 #import <KWQAssertions.h>
 
+NSString *WebCoreFileButtonFilenameChanged = @"WebCoreFileButtonFilenameChanged";
+
 @implementation WebCoreViewFactory
 
 static WebCoreViewFactory *sharedFactory;
diff --git a/WebCore/kwq/qt/qxml.h b/WebCore/kwq/qt/qxml.h
index 51f2d92..ee8b969 100644
--- a/WebCore/kwq/qt/qxml.h
+++ b/WebCore/kwq/qt/qxml.h
@@ -28,6 +28,18 @@
 
 class QString;
 
+class QXmlInputSource {
+public:
+    void setData(const QString &);
+};
+
+class QXmlParseException {
+public:
+    QString message() const;
+    int columnNumber() const;
+    int lineNumber() const;
+};
+
 class QXmlAttributes {
 public:
     QString value(const QString &) const;
@@ -37,16 +49,54 @@ public:
     QString uri(int index) const;
 };
 
-class QXmlInputSource {
+class QXmlContentHandler {
 public:
-    void setData(const QString &);
+    virtual bool startDocument() = 0;
+    virtual bool endDocument() = 0;
+    virtual bool startPrefixMapping(const QString &prefix, const QString &URI) = 0;
+    virtual bool endPrefixMapping(const QString &prefix) = 0;
+    virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &attributes) = 0;
+    virtual bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName) = 0;
+    virtual bool characters(const QString &characters) = 0;
+    virtual bool ignorableWhitespace(const QString &characters) = 0;
+    virtual bool processingInstruction(const QString &target, const QString &data) = 0;
+    virtual bool skippedEntity(const QString &name) = 0;
+    virtual QString errorString() = 0;
+};
+
+class QXmlLexicalHandler {
+public:
+    virtual bool startDTD(const QString &name, const QString &publicId, const QString &systemId) = 0;
+    virtual bool endDTD() = 0;
+    virtual bool startEntity(const QString &name) = 0;
+    virtual bool endEntity(const QString &name) = 0;
+    virtual bool startCDATA() = 0;
+    virtual bool endCDATA() = 0;
+    virtual bool comment(const QString &characters) = 0;
+    virtual QString errorString() = 0;
+};
+
+class QXmlErrorHandler {
+public:
+    virtual bool warning(const QXmlParseException &exception) = 0;
+    virtual bool error(const QXmlParseException &exception) = 0;
+    virtual bool fatalError(const QXmlParseException &exception) = 0;
+    virtual QString errorString() = 0;
 };
 
-class QXmlDTDHandler { };
-class QXmlDeclHandler { };
-class QXmlErrorHandler { };
-class QXmlLexicalHandler { };
-class QXmlContentHandler { };
+class QXmlDeclHandler {
+public:
+    virtual bool attributeDecl(const QString &entityName, const QString &attributeName, const QString &type, const QString &valueDefault, const QString &value) = 0;
+    virtual bool externalEntityDecl(const QString &name, const QString &publicId, const QString &systemId) = 0;
+    virtual bool internalEntityDecl(const QString &name, const QString &value) = 0;
+};
+
+class QXmlDTDHandler {
+public:
+    virtual bool notationDecl(const QString& name, const QString& publicId, const QString& systemId) = 0;
+    virtual bool unparsedEntityDecl(const QString& name, const QString& publicId, const QString& systemId, const QString& notationName) = 0;
+    virtual QString errorString() = 0;
+};
 
 class QXmlDefaultHandler :
     public QXmlContentHandler, 
@@ -55,23 +105,48 @@ class QXmlDefaultHandler :
     public QXmlDeclHandler, 
     public QXmlDTDHandler
 {
+    virtual bool startDocument();
+    virtual bool endDocument();
+    virtual bool startPrefixMapping(const QString &prefix, const QString &URI);
+    virtual bool endPrefixMapping(const QString &prefix);
+    virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &attributes);
+    virtual bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName);
+    virtual bool characters(const QString &characters);
+    virtual bool ignorableWhitespace(const QString &characters);
+    virtual bool processingInstruction(const QString &target, const QString &data);
+    virtual bool skippedEntity(const QString &name);
+
+    virtual bool startDTD(const QString &name, const QString &publicId, const QString &systemId);
+    virtual bool endDTD();
+    virtual bool startEntity(const QString &name);
+    virtual bool endEntity(const QString &name);
+    virtual bool startCDATA();
+    virtual bool endCDATA();
+    virtual bool comment(const QString &characters);
+
+    virtual bool warning(const QXmlParseException &exception);
+    virtual bool error(const QXmlParseException &exception);
+    virtual bool fatalError(const QXmlParseException &exception);
+
+    virtual bool attributeDecl(const QString &entityName, const QString &attributeName, const QString &type, const QString &valueDefault, const QString &value);
+    virtual bool externalEntityDecl(const QString &name, const QString &publicId, const QString &systemId);
+    virtual bool internalEntityDecl(const QString &name, const QString &value);
+
+    virtual bool notationDecl(const QString& name, const QString& publicId, const QString& systemId);
+    virtual bool unparsedEntityDecl(const QString& name, const QString& publicId, const QString& systemId, const QString& notationName);
+
+    virtual QString errorString();
 };
 
 class QXmlSimpleReader {
 public:
     void setContentHandler(QXmlContentHandler *handler);
-    bool parse(const QXmlInputSource &input);
     void setLexicalHandler(QXmlLexicalHandler *handler);
     void setDTDHandler(QXmlDTDHandler *handler);
     void setDeclHandler(QXmlDeclHandler *handler);
     void setErrorHandler(QXmlErrorHandler *handler);
-};
 
-class QXmlParseException {
-public:
-    QString message() const;
-    int columnNumber() const;
-    int lineNumber() const;
+    bool parse(const QXmlInputSource &input);
 };
 
 #endif
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index a3934ca..3ca3ad0 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,17 @@
+2002-10-23  Darin Adler  <darin at apple.com>
+
+	Add WebFileButton, to be used by WebCore soon. It's about 1/2
+	done right now. Compiles but not used yet.
+
+        * WebCoreSupport.subproj/WebViewFactory.m: (-[WebViewFactory fileButton]): Added.
+
+        * WebCoreSupport.subproj/WebFileButton.h: Added.
+        * WebCoreSupport.subproj/WebFileButton.m: Added.
+        * WebKit.pbproj/project.pbxproj: Added WebFileButton files.
+
+        * WebCoreSupport.subproj/WebSubresourceClient.m:
+        (-[WebSubresourceClient handle:didReceiveResponse:]): Add an assertion.
+
 2002-10-23  Maciej Stachowiak  <mjs at apple.com>
 
         - fixed 2876448 - The authentication panel should give a note when
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index a3934ca..3ca3ad0 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,17 @@
+2002-10-23  Darin Adler  <darin at apple.com>
+
+	Add WebFileButton, to be used by WebCore soon. It's about 1/2
+	done right now. Compiles but not used yet.
+
+        * WebCoreSupport.subproj/WebViewFactory.m: (-[WebViewFactory fileButton]): Added.
+
+        * WebCoreSupport.subproj/WebFileButton.h: Added.
+        * WebCoreSupport.subproj/WebFileButton.m: Added.
+        * WebKit.pbproj/project.pbxproj: Added WebFileButton files.
+
+        * WebCoreSupport.subproj/WebSubresourceClient.m:
+        (-[WebSubresourceClient handle:didReceiveResponse:]): Add an assertion.
+
 2002-10-23  Maciej Stachowiak  <mjs at apple.com>
 
         - fixed 2876448 - The authentication panel should give a note when
diff --git a/WebKit/WebCoreSupport.subproj/WebFileButton.h b/WebKit/WebCoreSupport.subproj/WebFileButton.h
new file mode 100644
index 0000000..6ac1a30
--- /dev/null
+++ b/WebKit/WebCoreSupport.subproj/WebFileButton.h
@@ -0,0 +1,20 @@
+//
+//  WebFileButton.h
+//  WebKit
+//
+//  Created by Darin Adler on Tue Oct 22 2002.
+//  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+ at protocol WebCoreFileButton;
+
+ at interface WebFileButton : NSView <WebCoreFileButton>
+{
+    NSString *_filename;
+    NSButton *_button;
+    NSImage *_icon;
+    NSString *_label;
+}
+ at end
diff --git a/WebKit/WebCoreSupport.subproj/WebFileButton.m b/WebKit/WebCoreSupport.subproj/WebFileButton.m
new file mode 100644
index 0000000..6fb4cff
--- /dev/null
+++ b/WebKit/WebCoreSupport.subproj/WebFileButton.m
@@ -0,0 +1,161 @@
+//
+//  WebFileButton.m
+//  WebKit
+//
+//  Created by Darin Adler on Tue Oct 22 2002.
+//  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+//
+
+#import "WebFileButton.h"
+
+#import <WebFoundation/WebLocalizableStrings.h>
+
+#import <WebCore/WebCoreViewFactory.h>
+
+#import <WebKit/WebStringTruncator.h>
+
+#define NO_FILE_SELECTED 
+
+#define AFTER_BUTTON_SPACING 4
+#define ICON_HEIGHT 16
+#define ICON_WIDTH 16
+#define ICON_FILENAME_SPACING 2
+// FIXME: Is it OK to hard-code the width of the filename part of this control?
+#define FILENAME_WIDTH 200
+
+#define ADDITIONAL_WIDTH (AFTER_BUTTON_SPACING + ICON_WIDTH + ICON_FILENAME_SPACING + FILENAME_WIDTH)
+
+// We empirically determined that buttons have these extra pixels on all
+// sides. It would be better to get this info from AppKit somehow.
+#define BUTTON_TOP_MARGIN 4
+#define BUTTON_BOTTOM_MARGIN 6
+#define BUTTON_LEFT_MARGIN 5
+#define BUTTON_RIGHT_MARGIN 5
+
+// AppKit calls this kThemePushButtonSmallTextOffset.
+#define BUTTON_VERTICAL_FUDGE_FACTOR 2
+
+ at implementation WebFileButton
+
+- (void)positionButton
+{
+    [_button sizeToFit];
+    // FIXME: Need to take margins into account.
+    [_button setFrameOrigin:NSMakePoint(0, 0)];
+}
+
+- (id)initWithFrame:(NSRect)frame
+{
+    self = [super initWithFrame:frame];
+    if (self) {
+        _button = [[NSButton alloc] init];
+        [_button setTitle:UI_STRING("Choose File", "title for file button used in HTML forms")];
+        [self positionButton];
+        [self setFilename:nil];
+    }
+    return self;
+}
+
+- (void)dealloc
+{
+    [_filename release];
+    [_button release];
+    [_icon release];
+    [_label release];
+    [super dealloc];
+}
+
+- (NSFont *)font
+{
+    return [NSFont systemFontOfSize:[NSFont smallSystemFontSize]];
+}
+
+- (void)drawRect:(NSRect)rect
+{
+    NSRect bounds = [self bounds];
+    
+    [NSGraphicsContext saveGraphicsState];
+    NSRectClip(NSIntersectionRect(bounds, rect));
+
+    float left = bounds.size.width - ADDITIONAL_WIDTH + AFTER_BUTTON_SPACING;
+
+    if (_icon) {
+        [_icon drawInRect:NSMakeRect(left, (bounds.size.height - ICON_HEIGHT) / 2, ICON_WIDTH, ICON_HEIGHT)
+            fromRect:NSMakeRect(0, 0, [_icon size].width, [_icon size].height)
+            operation:NSCompositeSourceOver fraction:1.0];
+        left += ICON_WIDTH + ICON_FILENAME_SPACING;
+    }
+
+    NSFont *font = [self font];
+    NSDictionary *attributes = [NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName];
+    [_label drawAtPoint:NSMakePoint(left, [self baseline] - [font ascender]) withAttributes:attributes];
+
+    [NSGraphicsContext restoreGraphicsState];
+}
+
+- (void)setFilename:(NSString *)filename
+{
+    NSString *copy = [filename copy];
+    [_filename release];
+    _filename = copy;
+    
+    [_label release];
+    if (![_filename length]) {
+        _label = [UI_STRING("no file selected", "text to display in file button used in HTML forms when no file is selected") retain];
+    } else {
+        _label = [[WebStringTruncator centerTruncateString:
+            [[NSFileManager defaultManager] displayNameAtPath:_filename]
+            toWidth:FILENAME_WIDTH withFont:[self font]] copy];
+    }
+    
+    [_icon release];
+    _icon = [[[NSWorkspace sharedWorkspace] iconForFile:_filename] retain];
+    
+    [self setNeedsDisplay:YES];
+}
+
+- (NSString *)filename
+{
+    return [[_filename copy] autorelease];
+}
+
+- (void)setFrameSize:(NSSize)size
+{
+    // FIXME: Can we just use springs instead?
+    [self positionButton];
+    [super setFrameSize:size];
+}
+
+- (NSSize)bestSize
+{
+    // FIXME: Not yet implemented
+    return [self frame].size;
+}
+
+- (float)baseline
+{
+    // FIXME: Not yet implemented
+    return 0;
+}
+
+- (void)chooseButtonPressed:(id)sender
+{
+    [self retain];
+    
+    NSOpenPanel *sheet = [NSOpenPanel openPanel];    
+    [sheet setPrompt:UI_STRING("Choose", "title for button in open panel from file button used in HTML forms")];
+    [sheet beginSheetForDirectory:@"~" file:@"" types:nil
+        modalForWindow:[self window] modalDelegate:self
+        didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:)
+        contextInfo:nil];
+}
+
+- (void)openPanelDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
+{
+    if (returnCode == NSOKButton && [[sheet filenames] count] == 1) {
+        [self setFilename:[[sheet filenames] objectAtIndex:0]];
+    }
+    [self release];
+}
+
+ at end
diff --git a/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m b/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m
index af69eb0..13cc9be 100644
--- a/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m
+++ b/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m
@@ -150,11 +150,12 @@
 -(void)handle:(WebResourceHandle *)h didReceiveResponse:(WebResourceResponse *)r
 {
     ASSERT(handle == h);
+    ASSERT(r);
 
     [r retain];
     [response release];
     response = r;
-    [resourceProgressDelegate resource: identifier didReceiveResponse: r fromDataSource: dataSource];
+    [resourceProgressDelegate resource:identifier didReceiveResponse:r fromDataSource: dataSource];
 
     [loader receivedResponse:r];
 }
diff --git a/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m b/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m
index af69eb0..13cc9be 100644
--- a/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m
+++ b/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m
@@ -150,11 +150,12 @@
 -(void)handle:(WebResourceHandle *)h didReceiveResponse:(WebResourceResponse *)r
 {
     ASSERT(handle == h);
+    ASSERT(r);
 
     [r retain];
     [response release];
     response = r;
-    [resourceProgressDelegate resource: identifier didReceiveResponse: r fromDataSource: dataSource];
+    [resourceProgressDelegate resource:identifier didReceiveResponse:r fromDataSource: dataSource];
 
     [loader receivedResponse:r];
 }
diff --git a/WebKit/WebCoreSupport.subproj/WebViewFactory.m b/WebKit/WebCoreSupport.subproj/WebViewFactory.m
index 80e7930..1afc3fd 100644
--- a/WebKit/WebCoreSupport.subproj/WebViewFactory.m
+++ b/WebKit/WebCoreSupport.subproj/WebViewFactory.m
@@ -6,15 +6,17 @@
 //  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
 //
 
+#import <WebKit/WebViewFactory.h>
+
 #import <WebKit/WebBaseNetscapePluginView.h>
 #import <WebKit/WebBasePluginPackage.h>
+#import <WebKit/WebFileButton.h>
 #import <WebKit/WebJavaScriptTextInputPanel.h>
 #import <WebKit/WebNetscapePluginEmbeddedView.h>
 #import <WebKit/WebNullPluginView.h>
 #import <WebKit/WebNetscapePluginPackage.h>
 #import <WebKit/WebPluginDatabase.h>
 #import <WebKit/WebPluginPackage.h>
-#import <WebKit/WebViewFactory.h>
 
 #import <WebFoundation/WebAssertions.h>
 #import <WebFoundation/WebNSURLExtras.h>
@@ -123,4 +125,9 @@
     return OK;
 }
 
+- (NSView <WebCoreFileButton> *)fileButton
+{
+    return [[WebFileButton alloc] init];
+}
+
 @end
diff --git a/WebKit/WebKit.pbproj/project.pbxproj b/WebKit/WebKit.pbproj/project.pbxproj
index 22ef2b7..217ebdb 100644
--- a/WebKit/WebKit.pbproj/project.pbxproj
+++ b/WebKit/WebKit.pbproj/project.pbxproj
@@ -294,6 +294,7 @@
 				39446093020F50ED0ECA1767,
 				511D5554033FD51000CA2ACD,
 				933D659B03413FF2008635CE,
+				9311022A03667CF1008635CE,
 			);
 			isa = PBXHeadersBuildPhase;
 			runOnlyForDeploymentPostprocessing = 0;
@@ -398,6 +399,7 @@
 				51F6866F0366057300CA2D3A,
 				83E4AF49036652150000E506,
 				83E4AF4E036659440000E506,
+				9311022B03667CF1008635CE,
 			);
 			isa = PBXSourcesBuildPhase;
 			runOnlyForDeploymentPostprocessing = 0;
@@ -1676,6 +1678,30 @@
 //932
 //933
 //934
+		9311022803667CF1008635CE = {
+			fileEncoding = 4;
+			isa = PBXFileReference;
+			path = WebFileButton.h;
+			refType = 4;
+		};
+		9311022903667CF1008635CE = {
+			fileEncoding = 4;
+			isa = PBXFileReference;
+			path = WebFileButton.m;
+			refType = 4;
+		};
+		9311022A03667CF1008635CE = {
+			fileRef = 9311022803667CF1008635CE;
+			isa = PBXBuildFile;
+			settings = {
+			};
+		};
+		9311022B03667CF1008635CE = {
+			fileRef = 9311022903667CF1008635CE;
+			isa = PBXBuildFile;
+			settings = {
+			};
+		};
 		931A72D203265920008635CE = {
 			fileEncoding = 4;
 			isa = PBXFileReference;
@@ -2863,26 +2889,28 @@
 		};
 		F5B36B400281DE87018635CB = {
 			children = (
-				F5B36B450281DF9C018635CB,
-				F5B36B460281DF9C018635CB,
-				F5B36B410281DF55018635CB,
-				F5B36B420281DF55018635CB,
-				F5F7174C02885C5B018635CA,
-				F5F7174D02885C5B018635CA,
-				9CE1F8A002A5C6F30ECA2ACD,
-				9CE1F8A102A5C6F30ECA2ACD,
-				9CE1F8A202A5C6F30ECA2ACD,
-				9CE1F8A302A5C6F30ECA2ACD,
 				F5AFB45E02B94DC8018635CA,
 				F5AFB45F02B94DC8018635CA,
-				F5E0E10802BC45F8018635CA,
-				F5E0E10902BC45F8018635CA,
 				F5488CF402CB04EE01FF6274,
 				F5488CF502CB04EE01FF6274,
+				9311022803667CF1008635CE,
+				9311022903667CF1008635CE,
 				F5E7B24503025CE801A80180,
 				F5E7B24603025CE801A80180,
+				9CE1F8A002A5C6F30ECA2ACD,
+				9CE1F8A102A5C6F30ECA2ACD,
+				9CE1F8A202A5C6F30ECA2ACD,
+				9CE1F8A302A5C6F30ECA2ACD,
 				9345D4EA0365C5B2008635CE,
 				9345D4EB0365C5B2008635CE,
+				F5E0E10802BC45F8018635CA,
+				F5E0E10902BC45F8018635CA,
+				F5B36B410281DF55018635CB,
+				F5B36B420281DF55018635CB,
+				F5B36B450281DF9C018635CB,
+				F5B36B460281DF9C018635CB,
+				F5F7174C02885C5B018635CA,
+				F5F7174D02885C5B018635CA,
 			);
 			isa = PBXGroup;
 			name = "WebCore Support";

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list