[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 07:11:23 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 6f5b507346cd922d509d69ee470720c5a63e59b9
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Dec 4 21:47:16 2002 +0000

    WebCore:
    
            Reviewed by Trey and Maciej.
    
    	- fixed 3117558 -- Assertion failure in KWQKHTMLPart::slotData after typing "amazon.com" twice
    	- got rid of the per-part NSEvent in preparation for NSView mouse event handling going through WebCore
    
            * khtml/khtml_part.h: Added declaration for didOpenURL.
            * khtml/khtml_part.cpp: (KHTMLPart::openURL): Changed name to didOpenURL in the APPLE_CHANGES
    	version because calls to openURL from within KHTML need to make the round trip to WebKit.
    	Also disabled the "scroll to anchor" part.
    
            * kwq/KWQKHTMLPart.cpp: (KWQKHTMLPart::isFrameSet): Fix to return false when document is 0.
    
            * kwq/KWQKHTMLPart.h: Add scrollToAnchor, remove setCurrentEvent and _currentEvent
            * kwq/KWQKHTMLPart.mm:
            (KHTMLPart::openURL): Pass the openURL call to the KWQKHTMLPart.
            (KWQKHTMLPart::KWQKHTMLPart): Don't initialize _currentEvent.
            (KWQKHTMLPart::~KWQKHTMLPart): Don't release _currentEvent.
            (KWQKHTMLPart::submitForm): Pass [NSApp currentEvent] instead of _currentEvent.
            (KWQKHTMLPart::urlSelected): Pass [NSApp currentEvent] instead of _currentEvent.
            (KWQKHTMLPart::scrollToAnchor): Added. Contains the code from the anchor case inside
    	KHTMLPart::openURL.
    
            * kwq/WebCoreBridge.h: Added scrollToAnchorWithURL:.
            * kwq/WebCoreBridge.mm:
            (-[WebCoreBridge openURL:reload:headers:lastModified:pageCache:]): Change around so that we
    	don't do a bunch of irrelevant stuff in the page cache case. I think we might just want to
    	make a separate method for the page cache case.
            (-[WebCoreBridge scrollToAnchorWithURL:]): Added.
            (-[WebCoreBridge mouseUp:]): Simplify check for nil view. Remove calls to setCurrentEvent.
            (-[WebCoreBridge mouseDown:]): Simplify check for nil view. Fix event type constants for
    	right mouse button and other mouse button.
            (-[WebCoreBridge mouseMoved:]): Simplify check for nil view.
            (-[WebCoreBridge mouseDragged:]): Simplify check for nil view.
    
    WebKit:
    
            Reviewed by Trey and Maciej.
    
    	- fixed 3117558 -- Assertion failure in KWQKHTMLPart::slotData after typing "amazon.com" twice
    	- update NSEvent handling in preparation for NSView mouse event handling going through WebCore
    
            * WebView.subproj/WebFramePrivate.m:
            (-[WebFrame _loadItem:fromItem:withLoadType:]): Added FIXME comments about matching the _loadURL
    	case more closely.
            (-[WebFrame _actionInformationForNavigationType:event:originalURL:]): Only use the event if it's
    	a mouse down event. This prevents trouble when we have other kinds of events coming through.
            (-[WebFrame _continueFragmentScrollAfterNavigationPolicy:request:]): Call the new scrollToAnchorWithURL:
    	instead of openURL:. This fixes the assertion failure in the bug above.
            (-[WebFrame _loadURL:loadType:triggeringEvent:isFormSubmission:]): Update checks here to more closely
    	match the ones in KHTMLPart::openURL that we are replacing. Add more comments.
    
            * WebView.subproj/WebHTMLView.m: (-[WebHTMLView hitTest:]): Function to intercept all clicks at the
    	WebHTMLView level, disabled for now because we are not yet ready.
    
    	- started a gzip download decoder, not yet hooked up
    
            * Downloads.subproj/WebGZipDecoder.h: Added.
            * Downloads.subproj/WebGZipDecoder.m: Added.
            * WebKit.pbproj/project.pbxproj: Add WebGZipDecoder and zlib.
    
    	- other changes
    
            * Panels.subproj/WebAuthenticationPanel.m: Fixed screwed-up indentation.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2932 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 2b06cfd..7c176e4 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,39 @@
+2002-12-04  Darin Adler  <darin at apple.com>
+
+        Reviewed by Trey and Maciej.
+
+	- fixed 3117558 -- Assertion failure in KWQKHTMLPart::slotData after typing "amazon.com" twice
+	- got rid of the per-part NSEvent in preparation for NSView mouse event handling going through WebCore
+
+        * khtml/khtml_part.h: Added declaration for didOpenURL.
+        * khtml/khtml_part.cpp: (KHTMLPart::openURL): Changed name to didOpenURL in the APPLE_CHANGES
+	version because calls to openURL from within KHTML need to make the round trip to WebKit.
+	Also disabled the "scroll to anchor" part.
+
+        * kwq/KWQKHTMLPart.cpp: (KWQKHTMLPart::isFrameSet): Fix to return false when document is 0.
+
+        * kwq/KWQKHTMLPart.h: Add scrollToAnchor, remove setCurrentEvent and _currentEvent
+        * kwq/KWQKHTMLPart.mm:
+        (KHTMLPart::openURL): Pass the openURL call to the KWQKHTMLPart.
+        (KWQKHTMLPart::KWQKHTMLPart): Don't initialize _currentEvent.
+        (KWQKHTMLPart::~KWQKHTMLPart): Don't release _currentEvent.
+        (KWQKHTMLPart::submitForm): Pass [NSApp currentEvent] instead of _currentEvent.
+        (KWQKHTMLPart::urlSelected): Pass [NSApp currentEvent] instead of _currentEvent.
+        (KWQKHTMLPart::scrollToAnchor): Added. Contains the code from the anchor case inside
+	KHTMLPart::openURL.
+
+        * kwq/WebCoreBridge.h: Added scrollToAnchorWithURL:.
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge openURL:reload:headers:lastModified:pageCache:]): Change around so that we
+	don't do a bunch of irrelevant stuff in the page cache case. I think we might just want to
+	make a separate method for the page cache case.
+        (-[WebCoreBridge scrollToAnchorWithURL:]): Added.
+        (-[WebCoreBridge mouseUp:]): Simplify check for nil view. Remove calls to setCurrentEvent.
+        (-[WebCoreBridge mouseDown:]): Simplify check for nil view. Fix event type constants for
+	right mouse button and other mouse button.
+        (-[WebCoreBridge mouseMoved:]): Simplify check for nil view.
+        (-[WebCoreBridge mouseDragged:]): Simplify check for nil view.
+
 2002-12-04  Richard Williamson   <rjw at apple.com>
 
         Cache the NSFont in QFont after doing family based lookup.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 2b06cfd..7c176e4 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,39 @@
+2002-12-04  Darin Adler  <darin at apple.com>
+
+        Reviewed by Trey and Maciej.
+
+	- fixed 3117558 -- Assertion failure in KWQKHTMLPart::slotData after typing "amazon.com" twice
+	- got rid of the per-part NSEvent in preparation for NSView mouse event handling going through WebCore
+
+        * khtml/khtml_part.h: Added declaration for didOpenURL.
+        * khtml/khtml_part.cpp: (KHTMLPart::openURL): Changed name to didOpenURL in the APPLE_CHANGES
+	version because calls to openURL from within KHTML need to make the round trip to WebKit.
+	Also disabled the "scroll to anchor" part.
+
+        * kwq/KWQKHTMLPart.cpp: (KWQKHTMLPart::isFrameSet): Fix to return false when document is 0.
+
+        * kwq/KWQKHTMLPart.h: Add scrollToAnchor, remove setCurrentEvent and _currentEvent
+        * kwq/KWQKHTMLPart.mm:
+        (KHTMLPart::openURL): Pass the openURL call to the KWQKHTMLPart.
+        (KWQKHTMLPart::KWQKHTMLPart): Don't initialize _currentEvent.
+        (KWQKHTMLPart::~KWQKHTMLPart): Don't release _currentEvent.
+        (KWQKHTMLPart::submitForm): Pass [NSApp currentEvent] instead of _currentEvent.
+        (KWQKHTMLPart::urlSelected): Pass [NSApp currentEvent] instead of _currentEvent.
+        (KWQKHTMLPart::scrollToAnchor): Added. Contains the code from the anchor case inside
+	KHTMLPart::openURL.
+
+        * kwq/WebCoreBridge.h: Added scrollToAnchorWithURL:.
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge openURL:reload:headers:lastModified:pageCache:]): Change around so that we
+	don't do a bunch of irrelevant stuff in the page cache case. I think we might just want to
+	make a separate method for the page cache case.
+        (-[WebCoreBridge scrollToAnchorWithURL:]): Added.
+        (-[WebCoreBridge mouseUp:]): Simplify check for nil view. Remove calls to setCurrentEvent.
+        (-[WebCoreBridge mouseDown:]): Simplify check for nil view. Fix event type constants for
+	right mouse button and other mouse button.
+        (-[WebCoreBridge mouseMoved:]): Simplify check for nil view.
+        (-[WebCoreBridge mouseDragged:]): Simplify check for nil view.
+
 2002-12-04  Richard Williamson   <rjw at apple.com>
 
         Cache the NSFont in QFont after doing family based lookup.
diff --git a/WebCore/khtml/khtml_part.cpp b/WebCore/khtml/khtml_part.cpp
index 8cb2d79..217332e 100644
--- a/WebCore/khtml/khtml_part.cpp
+++ b/WebCore/khtml/khtml_part.cpp
@@ -340,7 +340,11 @@ bool KHTMLPart::restoreURL( const KURL &url )
 }
 
 
+#if APPLE_CHANGES
+bool KHTMLPart::didOpenURL(const KURL &url)
+#else
 bool KHTMLPart::openURL( const KURL &url )
+#endif
 {
   kdDebug( 6050 ) << "KHTMLPart(" << this << ")::openURL " << url.url() << endl;
 
@@ -377,6 +381,8 @@ bool KHTMLPart::openURL( const KURL &url )
 #endif // APPLE_CHANGES
 
   KParts::URLArgs args( d->m_extension->urlArgs() );
+
+#if !APPLE_CHANGES
   // in case we have a) no frameset (don't test m_frames.count(), iframes get in there)
   // b) the url is identical with the currently
   // displayed one (except for the htmlref!) , c) the url request is not a POST
@@ -408,6 +414,7 @@ bool KHTMLPart::openURL( const KURL &url )
         return true;
       }
   }
+#endif // APPLE_CHANGES
 
   if (!d->m_restored)
   {
diff --git a/WebCore/khtml/khtml_part.h b/WebCore/khtml/khtml_part.h
index 75aeddb..3f57360 100644
--- a/WebCore/khtml/khtml_part.h
+++ b/WebCore/khtml/khtml_part.h
@@ -1089,6 +1089,7 @@ public:
 
   void completed();
   void completed(bool);
+  bool didOpenURL(const KURL &);
   void setStatusBarText(const QString &);
   void started(KIO::Job *);
 #endif
diff --git a/WebCore/kwq/KWQKHTMLPart.cpp b/WebCore/kwq/KWQKHTMLPart.cpp
index 966247a..f0498d9 100644
--- a/WebCore/kwq/KWQKHTMLPart.cpp
+++ b/WebCore/kwq/KWQKHTMLPart.cpp
@@ -37,7 +37,7 @@ using DOM::NodeImpl;
 bool KWQKHTMLPart::isFrameSet()
 {
     DocumentImpl *document = d->m_doc;
-    if (!document->isHTMLDocument())
+    if (!document || !document->isHTMLDocument())
         return false;
     NodeImpl *body = static_cast<HTMLDocumentImpl *>(document)->body();
     return body && body->renderer() && body->id() == ID_FRAMESET;
diff --git a/WebCore/kwq/KWQKHTMLPart.h b/WebCore/kwq/KWQKHTMLPart.h
index 1c2810a..276421e 100644
--- a/WebCore/kwq/KWQKHTMLPart.h
+++ b/WebCore/kwq/KWQKHTMLPart.h
@@ -86,6 +86,8 @@ public:
     void openURLRequest(const KURL &, const KParts::URLArgs &);
     void submitForm(const KURL &, const KParts::URLArgs &);
     
+    void scrollToAnchor(const KURL &);
+    
     void slotData(NSString *, bool forceEncoding, const char *bytes, int length, bool complete = false);
 
     void setTitle(const DOM::DOMString &);
@@ -154,11 +156,9 @@ public:
     DOM::NodeImpl *selectionStart() const;
     DOM::NodeImpl *selectionEnd() const;
 
-    void setCurrentEvent(NSEvent *event);
-    
     void addMetaData(const QString &key, const QString &value);
 
-    bool KWQKHTMLPart::keyEvent(NSEvent *event);
+    bool keyEvent(NSEvent *event);
     
 private:
     void setPolicyBaseURL(const DOM::DOMString &);
@@ -182,8 +182,6 @@ private:
     
     bool _ownsView;
 
-    NSEvent *_currentEvent;
-
     static QPtrList<KWQKHTMLPart> &mutableInstances();
 
     friend class KHTMLPart;
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 451d471..891413e 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -74,6 +74,12 @@ void KHTMLPart::nodeActivated(const DOM::Node &aNode)
 {
 }
 
+bool KHTMLPart::openURL(const KURL &URL)
+{
+    kwq->openURL(URL);
+    return true;
+}
+
 void KHTMLPart::onURL(const QString &)
 {
 }
@@ -100,7 +106,6 @@ KWQKHTMLPart::KWQKHTMLPart(KHTMLPart *p)
     , _completed(p, SIGNAL(completed()))
     , _completedWithBool(p, SIGNAL(completed(bool)))
     , _ownsView(false)
-    , _currentEvent(nil)
 {
     Cache::init();
     mutableInstances().prepend(this);
@@ -113,7 +118,6 @@ KWQKHTMLPart::~KWQKHTMLPart()
     if (_ownsView) {
         delete d->m_view;
     }
-    [_currentEvent release];
 }
 
 WebCoreBridge *KWQKHTMLPart::bridgeForFrameName(const QString &frameName)
@@ -154,13 +158,14 @@ void KWQKHTMLPart::openURLRequest(const KURL &url, const URLArgs &args)
 void KWQKHTMLPart::submitForm(const KURL &url, const URLArgs &args)
 {
     if (!args.doPost()) {
-        [bridgeForFrameName(args.frameName) loadURL:url.url().getNSString() reload:args.reload triggeringEvent:_currentEvent isFormSubmission:YES];
+        [bridgeForFrameName(args.frameName) loadURL:url.url().getNSString() reload:args.reload
+            triggeringEvent:[NSApp currentEvent] isFormSubmission:YES];
     } else {
         QString contentType = args.contentType();
         ASSERT(contentType.startsWith("Content-Type: "));
         [bridgeForFrameName(args.frameName) postWithURL:url.url().getNSString()
             data:[NSData dataWithBytes:args.postData.data() length:args.postData.size()]
-            contentType:contentType.mid(14).getNSString() triggeringEvent:_currentEvent];
+            contentType:contentType.mid(14).getNSString() triggeringEvent:[NSApp currentEvent]];
     }
 }
 
@@ -184,7 +189,8 @@ void KWQKHTMLPart::slotData(NSString *encoding, bool forceEncoding, const char *
 
 void KWQKHTMLPart::urlSelected(const KURL &url, int button, int state, const URLArgs &args)
 {
-    [bridgeForFrameName(args.frameName) loadURL:url.url().getNSString() reload:args.reload triggeringEvent:_currentEvent isFormSubmission:NO];
+    [bridgeForFrameName(args.frameName) loadURL:url.url().getNSString() reload:args.reload
+        triggeringEvent:[NSApp currentEvent] isFormSubmission:NO];
 }
 
 class KWQPluginPart : public ReadOnlyPart
@@ -631,19 +637,11 @@ void KWQKHTMLPart::createDummyDocument()
     }
 }
 
-void KWQKHTMLPart::setCurrentEvent(NSEvent *event)
-{
-    [event retain];
-    [_currentEvent release];
-    _currentEvent = event;
-}
-
 void KWQKHTMLPart::addMetaData(const QString &key, const QString &value)
 {
     d->m_job->addMetaData(key, value);
 }
 
-
 bool KWQKHTMLPart::keyEvent(NSEvent *event)
 {
     ASSERT([event type] == NSKeyDown || [event type] == NSKeyUp);
@@ -686,3 +684,19 @@ bool KWQKHTMLPart::keyEvent(NSEvent *event)
 
     return result;
 }
+
+// This does the same kind of work that KHTMLPart::openURL does, except it relies on the fact
+// that a higher level already checked that the URLs match and the scrolling is the right thing to do.
+void KWQKHTMLPart::scrollToAnchor(const KURL &URL)
+{
+    part->m_url = URL;
+    part->started(0);
+
+    if (!part->gotoAnchor(URL.encodedHtmlRef()))
+        part->gotoAnchor(URL.htmlRef());
+
+    d->m_bComplete = true;
+    d->m_doc->setParsing(false);
+
+    part->completed();
+}
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index dc48225..0198310 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -97,7 +97,7 @@ enum FrameBorderStyle {
 
 - (void)setParent:(WebCoreBridge *)parent;
 
-- (void)openURL:(NSString *)URL reload:(BOOL)reload headers:(NSDictionary *)headers lastModified:(NSDate *)lastModified pageCache: (NSDictionary *)pageCache;
+- (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;
@@ -116,6 +116,7 @@ enum FrameBorderStyle {
 - (void)removeFromFrame;
 
 - (void)scrollToAnchor:(NSString *)anchor;
+- (void)scrollToAnchorWithURL:(NSString *)URL;
 
 - (void)createKHTMLViewWithNSView:(NSView *)view marginWidth:(int)mw marginHeight:(int)mh;
 
@@ -238,7 +239,7 @@ 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;
+- (BOOL)saveDocumentToPageCache:(id)documentInfo;
 
 @end
 
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index b817ccc..b99ac3b 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -140,39 +140,34 @@ NSString *WebCoreElementStringKey = 		@"WebElementString";
     _part->setParent([parent part]);
 }
 
-- (void)openURL:(NSString *)URL reload:(BOOL)reload headers:(NSDictionary *)headers lastModified:(NSDate *)lastModified pageCache: (NSDictionary *)pageCache
+- (void)openURL:(NSString *)URL reload:(BOOL)reload headers:(NSDictionary *)headers lastModified:(NSDate *)lastModified pageCache:(NSDictionary *)pageCache
 {
-    URLArgs args(_part->browserExtension()->urlArgs());
+    if (pageCache) {
+        KWQPageState *state = [pageCache objectForKey:@"WebCorePageState"];
+        _part->kwq->openURLFromPageCache([state document], [state URL], [state windowProperties], [state locationProperties]);
+        return;
+    }
 
-    // reload
+    // arguments
+    URLArgs args(_part->browserExtension()->urlArgs());
     args.reload = reload;
-
-    // Content-Type
     NSString *contentType = [headers objectForKey:@"Content-Type"];
     if (contentType) {
         args.serviceType = QString::fromNSString(contentType);
     }
-    
     _part->browserExtension()->setURLArgs(args);
 
-    // URL
-    if (pageCache){
-        KWQPageState *state = [pageCache objectForKey: @"WebCorePageState"];
-        _part->kwq->openURLFromPageCache([state document], [state URL], [state windowProperties], [state locationProperties]);
-    }
-    else
-        _part->openURL([URL cString]);
-    
-    // Refresh
+    // opening the URL
+    _part->didOpenURL([URL cString]);
+
+    // things we have to set up after calling didOpenURL
     NSString *refreshHeader = [headers objectForKey:@"Refresh"];
     if (refreshHeader) {
         _part->kwq->addMetaData("http-refresh", QString::fromNSString(refreshHeader));
     }
-
     if (lastModified) {
 	_part->kwq->addMetaData("modified", QString::fromNSString([lastModified description]));
     }
-
 }
 
 - (void)addData:(NSData *)data withEncoding:(NSString *)encoding
@@ -222,6 +217,11 @@ NSString *WebCoreElementStringKey = 		@"WebElementString";
     }
 }
 
+- (void)scrollToAnchorWithURL:(NSString *)URL
+{
+    _part->kwq->scrollToAnchor([URL cString]);
+}
+
 - (BOOL)saveDocumentToPageCache
 {
     DocumentImpl *doc = _part->kwq->document();
@@ -414,6 +414,10 @@ NSString *WebCoreElementStringKey = 		@"WebElementString";
 
 - (void)mouseUp:(NSEvent *)event
 {
+    if (!_part->kwq->view()) {
+        return;
+    }
+    
     NSPoint p = [event locationInWindow];
 
     int button, state;
@@ -433,40 +437,38 @@ NSString *WebCoreElementStringKey = 		@"WebElementString";
     }
     state |= [self stateForEvent:event];
     
-    if (_part->kwq->view()) {
-        int clickCount = [event clickCount];
-
-        // Our behavior here is a little different that Qt.  Qt always sends
-        // a mouse release event, even for a double click.  To correct problems
-        // in khtml's DOM click event handling we do not send a release here
-        // for a double click.  Instead we send that event from khtmlview's
-        // viewportMouseDoubleClickEvent.
-        if (clickCount > 0 && clickCount % 2 == 0) {
-            QMouseEvent doubleClickEvent(QEvent::MouseButtonDblClick, QPoint(p), button, state, clickCount);
-	    _part->kwq->setCurrentEvent(event);
-            _part->kwq->view()->viewportMouseDoubleClickEvent(&doubleClickEvent);
-	    _part->kwq->setCurrentEvent(nil);
-        }
-        else {
-            QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(p), button, state, clickCount);
-	    _part->kwq->setCurrentEvent(event);
-            _part->kwq->view()->viewportMouseReleaseEvent(&releaseEvent);
-	    _part->kwq->setCurrentEvent(nil);
-        }
+    int clickCount = [event clickCount];
+
+    // Our behavior here is a little different that Qt.  Qt always sends
+    // a mouse release event, even for a double click.  To correct problems
+    // in khtml's DOM click event handling we do not send a release here
+    // for a double click.  Instead we send that event from khtmlview's
+    // viewportMouseDoubleClickEvent.
+    if (clickCount > 0 && clickCount % 2 == 0) {
+        QMouseEvent doubleClickEvent(QEvent::MouseButtonDblClick, QPoint(p), button, state, clickCount);
+        _part->kwq->view()->viewportMouseDoubleClickEvent(&doubleClickEvent);
+    }
+    else {
+        QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(p), button, state, clickCount);
+        _part->kwq->view()->viewportMouseReleaseEvent(&releaseEvent);
     }
 }
 
 - (void)mouseDown:(NSEvent *)event
 {
+    if (!_part->kwq->view()) {
+        return;
+    }
+    
     NSPoint p = [event locationInWindow];
     
     int button, state;     
     switch ([event type]) {
-    case NSRightMouseUp:
+    case NSRightMouseDown:
         button = Qt::RightButton;
         state = Qt::RightButton;
         break;
-    case NSOtherMouseUp:
+    case NSOtherMouseDown:
         button = Qt::MidButton;
         state = Qt::MidButton;
         break;
@@ -477,30 +479,32 @@ NSString *WebCoreElementStringKey = 		@"WebElementString";
     }
     state |= [self stateForEvent:event];
     
-    if (_part->kwq->view()) {
-        QMouseEvent kEvent(QEvent::MouseButtonPress, QPoint(p), button, state, [event clickCount]);
-        _part->kwq->view()->viewportMousePressEvent(&kEvent);
-    }
+    QMouseEvent kEvent(QEvent::MouseButtonPress, QPoint(p), button, state, [event clickCount]);
+    _part->kwq->view()->viewportMousePressEvent(&kEvent);
 }
 
 - (void)mouseMoved:(NSEvent *)event
 {
+    if (!_part->kwq->view()) {
+        return;
+    }
+    
     NSPoint p = [event locationInWindow];
     
     QMouseEvent kEvent(QEvent::MouseMove, QPoint(p), 0, [self stateForEvent:event]);
-    if (_part->kwq->view()) {
-        _part->kwq->view()->viewportMouseMoveEvent(&kEvent);
-    }
+    _part->kwq->view()->viewportMouseMoveEvent(&kEvent);
 }
 
 - (void)mouseDragged:(NSEvent *)event
 {
+    if (!_part->kwq->view()) {
+        return;
+    }
+    
     NSPoint p = [event locationInWindow];
     
     QMouseEvent kEvent(QEvent::MouseMove, QPoint(p), Qt::LeftButton, Qt::LeftButton);
-    if (_part->kwq->view()) {
-        _part->kwq->view()->viewportMouseMoveEvent(&kEvent);
-    }
+    _part->kwq->view()->viewportMouseMoveEvent(&kEvent);
 }
 
 - (NSDictionary *)elementAtPoint:(NSPoint)point
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 1ca3bac..deedbed 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,33 @@
+2002-12-04  Darin Adler  <darin at apple.com>
+
+        Reviewed by Trey and Maciej.
+
+	- fixed 3117558 -- Assertion failure in KWQKHTMLPart::slotData after typing "amazon.com" twice
+	- update NSEvent handling in preparation for NSView mouse event handling going through WebCore
+
+        * WebView.subproj/WebFramePrivate.m:
+        (-[WebFrame _loadItem:fromItem:withLoadType:]): Added FIXME comments about matching the _loadURL
+	case more closely.
+        (-[WebFrame _actionInformationForNavigationType:event:originalURL:]): Only use the event if it's
+	a mouse down event. This prevents trouble when we have other kinds of events coming through.
+        (-[WebFrame _continueFragmentScrollAfterNavigationPolicy:request:]): Call the new scrollToAnchorWithURL:
+	instead of openURL:. This fixes the assertion failure in the bug above.
+        (-[WebFrame _loadURL:loadType:triggeringEvent:isFormSubmission:]): Update checks here to more closely
+	match the ones in KHTMLPart::openURL that we are replacing. Add more comments.
+
+        * WebView.subproj/WebHTMLView.m: (-[WebHTMLView hitTest:]): Function to intercept all clicks at the
+	WebHTMLView level, disabled for now because we are not yet ready.
+
+	- started a gzip download decoder, not yet hooked up
+
+        * Downloads.subproj/WebGZipDecoder.h: Added.
+        * Downloads.subproj/WebGZipDecoder.m: Added.
+        * WebKit.pbproj/project.pbxproj: Add WebGZipDecoder and zlib.
+
+	- other changes
+
+        * Panels.subproj/WebAuthenticationPanel.m: Fixed screwed-up indentation.
+
 2002-12-04  Richard Williamson   <rjw at apple.com>
 
         Cache the fallback font in the same way we cache other
diff --git a/WebKit/Downloads.subproj/WebGZipDecoder.h b/WebKit/Downloads.subproj/WebGZipDecoder.h
new file mode 100644
index 0000000..eec613c
--- /dev/null
+++ b/WebKit/Downloads.subproj/WebGZipDecoder.h
@@ -0,0 +1,22 @@
+//
+//  WebGZipDecoder.h
+//  WebKit
+//
+//  Created by Darin Adler on Wed Dec 04 2002.
+//  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+#import <zlib.h>
+
+ at protocol WebDownloadDecoder;
+
+ at interface WebGZipDecoder : NSObject <WebDownloadDecoder>
+{
+    z_stream _stream;
+    BOOL _streamInitialized;
+    
+    BOOL _failed;
+}
+ at end
diff --git a/WebKit/Downloads.subproj/WebGZipDecoder.m b/WebKit/Downloads.subproj/WebGZipDecoder.m
new file mode 100644
index 0000000..9f9a672
--- /dev/null
+++ b/WebKit/Downloads.subproj/WebGZipDecoder.m
@@ -0,0 +1,84 @@
+//
+//  WebGZipDecoder.m
+//  WebKit
+//
+//  Created by Darin Adler on Wed Dec 04 2002.
+//  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+//
+
+#import "WebGZipDecoder.h"
+
+#import <WebFoundation/WebAssertions.h>
+#import <WebKit/WebDownloadDecoder.h>
+
+ at implementation WebGZipDecoder
+
++ (BOOL)canDecodeHeaderData:(NSData *)headerData
+{
+    if ([headerData length] < 2) {
+        return NO;
+    }
+    const unsigned char *bytes = (const unsigned char *)[headerData bytes];
+    return (bytes[0] == 0x1F) && (bytes[1] == 0x8B) && 0;
+}
+
+- (id)init
+{
+    self = [super init];
+    int error = inflateInit(&_stream);
+    if (error != Z_OK) {
+        ERROR("failed to initialize zlib, error %d", error);
+        [self release];
+        return nil;
+    }
+    _streamInitialized = YES;
+    return self;
+}
+
+- (void)dealloc
+{
+    if (_streamInitialized)
+        inflateEnd(&_stream);
+    [super dealloc];
+}
+
+- (BOOL)decodeData:(NSData *)data dataForkData:(NSData **)dataForkData resourceForkData:(NSData **)resourceForkData
+{
+    ASSERT(data);
+    ASSERT([data length]);
+    ASSERT(dataForkData);
+    ASSERT(resourceForkData);
+    
+    *dataForkData = nil;
+    *resourceForkData = nil;
+    
+    int error = inflate(&_stream, Z_NO_FLUSH);
+    if (error != Z_OK) {
+        _failed = YES;
+        return NO;
+    }
+
+    return YES;
+}
+
+- (BOOL)finishDecoding
+{
+    int error = inflate(&_stream, Z_FINISH);
+    if (error != Z_OK) {
+        _failed = YES;
+        return NO;
+    }
+    return YES;
+}
+
+- (NSDictionary *)fileAttributes
+{
+    return nil;
+}
+
+- (NSString *)filename
+{
+    return nil;
+}
+
+ at end
diff --git a/WebKit/Panels.subproj/WebAuthenticationPanel.m b/WebKit/Panels.subproj/WebAuthenticationPanel.m
index 2323bf5..240d149 100644
--- a/WebKit/Panels.subproj/WebAuthenticationPanel.m
+++ b/WebKit/Panels.subproj/WebAuthenticationPanel.m
@@ -132,9 +132,8 @@
         }
     }
 
-[mainLabel setStringValue:message];
-
-[mainLabel sizeToFitAndAdjustWindowHeight];
+    [mainLabel setStringValue:message];
+    [mainLabel sizeToFitAndAdjustWindowHeight];
 
     if ([resource receivesCredentialSecurely]) {
         [smallLabel setStringValue:
diff --git a/WebKit/WebKit.pbproj/project.pbxproj b/WebKit/WebKit.pbproj/project.pbxproj
index 0ee7bb7..12e3696 100644
--- a/WebKit/WebKit.pbproj/project.pbxproj
+++ b/WebKit/WebKit.pbproj/project.pbxproj
@@ -117,9 +117,10 @@
 				F8216299029F4FB501000131,
 				F821629A029F4FB501000131,
 				F821629B029F4FB501000131,
+				936F62C1039DF33B008635CE,
 			);
 			isa = PBXGroup;
-			name = Frameworks;
+			name = "Frameworks and Libraries";
 			refType = 4;
 		};
 		0867D69CFE84028FC02AAC07 = {
@@ -303,6 +304,7 @@
 				9316400E0379832D008635CE,
 				658CF8C103851FB5008C2A4B,
 				7082F571038EADAA00A80180,
+				936F62BF039DF0BF008635CE,
 			);
 			isa = PBXHeadersBuildPhase;
 			runOnlyForDeploymentPostprocessing = 0;
@@ -415,6 +417,7 @@
 				9316400F0379832D008635CE,
 				BED907790389380000CA289C,
 				7082F572038EADAA00A80180,
+				936F62C0039DF0BF008635CE,
 			);
 			isa = PBXSourcesBuildPhase;
 			runOnlyForDeploymentPostprocessing = 0;
@@ -428,6 +431,7 @@
 				F82162D8029F4FB501000131,
 				F82162D9029F4FB501000131,
 				F52BD8BA02DF4FBD018635CA,
+				936F62C2039DF33B008635CE,
 			);
 			isa = PBXFrameworksBuildPhase;
 			runOnlyForDeploymentPostprocessing = 0;
@@ -1578,6 +1582,8 @@
 				832E26A4036F9614005E2B4F,
 				83413E8C0375BCD3004719BE,
 				83413E8D0375BCD3004719BE,
+				936F62BD039DF0BF008635CE,
+				936F62BE039DF0BF008635CE,
 			);
 			isa = PBXGroup;
 			name = Downloads;
@@ -2102,6 +2108,42 @@
 			settings = {
 			};
 		};
+		936F62BD039DF0BF008635CE = {
+			fileEncoding = 4;
+			isa = PBXFileReference;
+			path = WebGZipDecoder.h;
+			refType = 4;
+		};
+		936F62BE039DF0BF008635CE = {
+			fileEncoding = 4;
+			isa = PBXFileReference;
+			path = WebGZipDecoder.m;
+			refType = 4;
+		};
+		936F62BF039DF0BF008635CE = {
+			fileRef = 936F62BD039DF0BF008635CE;
+			isa = PBXBuildFile;
+			settings = {
+			};
+		};
+		936F62C0039DF0BF008635CE = {
+			fileRef = 936F62BE039DF0BF008635CE;
+			isa = PBXBuildFile;
+			settings = {
+			};
+		};
+		936F62C1039DF33B008635CE = {
+			isa = PBXExecutableFileReference;
+			name = libz.dylib;
+			path = /usr/lib/libz.dylib;
+			refType = 0;
+		};
+		936F62C2039DF33B008635CE = {
+			fileRef = 936F62C1039DF33B008635CE;
+			isa = PBXBuildFile;
+			settings = {
+			};
+		};
 		93AEB17D032C1735008635CE = {
 			fileEncoding = 4;
 			isa = PBXFileReference;
diff --git a/WebKit/WebView.subproj/WebFramePrivate.m b/WebKit/WebView.subproj/WebFramePrivate.m
index e6b4b25..92bbc34 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.m
+++ b/WebKit/WebView.subproj/WebFramePrivate.m
@@ -841,16 +841,19 @@ static const char * const loadTypeNames[] = {
 }
 
 // loads content into this frame, as specified by item
-- (void)_loadItem:(WebHistoryItem *)item fromItem:(WebHistoryItem *)fromItem withLoadType: (WebFrameLoadType)type
+- (void)_loadItem:(WebHistoryItem *)item fromItem:(WebHistoryItem *)fromItem withLoadType:(WebFrameLoadType)type
 {
     NSURL *itemURL = [item URL];
-    WebResourceRequest *request;
     NSURL *currentURL = [[[self dataSource] request] URL];
 
     // Are we navigating to an anchor within the page?
     // Note if we have child frames we do a real reload, since the child frames might not
     // match our current frame structure, or they might not have the right content.  We could
     // check for all that as an additional optimization.
+    
+    // FIXME: These checks don't match the ones in _loadURL:loadType:triggeringEvent:isFormSubmission:
+    // Perhaps they should.
+    
     if ([item anchor] &&
         [[itemURL _web_URLByRemovingFragment] isEqual: [currentURL _web_URLByRemovingFragment]] &&
         (!_private->children || ![_private->children count]))
@@ -859,6 +862,7 @@ static const char * const loadTypeNames[] = {
         [self _saveScrollPositionToItem:[_private currentItem]];
         // FIXME: form state might want to be saved here too
 
+        // FIXME: Perhaps we can use scrollToAnchorWithURL here instead and remove the older scrollToAnchor:?
         [[_private->dataSource _bridge] scrollToAnchor: [item anchor]];
     
         // must do this maintenance here, since we don't go through a real page reload
@@ -876,7 +880,7 @@ static const char * const loadTypeNames[] = {
             [self _loadDataSource:newDataSource withLoadType:type];            
         }
         else {
-            request = [[WebResourceRequest alloc] initWithURL:itemURL];
+            WebResourceRequest *request = [[WebResourceRequest alloc] initWithURL:itemURL];
         
             // set the request cache policy based on the type of request we have
             // however, allow any previously set value to take precendence
@@ -991,29 +995,35 @@ static const char * const loadTypeNames[] = {
 
 -(NSDictionary *)_actionInformationForNavigationType:(WebNavigationType)navigationType event:(NSEvent *)event originalURL:(NSURL *)URL
 {
-    if (event != nil) {
-        NSView *topViewInEventWindow = [[event window] contentView];
-        NSView *viewContainingPoint = [topViewInEventWindow hitTest:[topViewInEventWindow convertPoint:[event locationInWindow] fromView:nil]];
-
-        ASSERT(viewContainingPoint != nil);
-        ASSERT([viewContainingPoint isKindOfClass:[WebHTMLView class]]);
-
-        NSPoint point = [viewContainingPoint convertPoint:[event locationInWindow] fromView:nil];
-        NSDictionary *elementInfo = [(WebHTMLView *)viewContainingPoint _elementAtPoint:point];
-
-        return [NSDictionary dictionaryWithObjectsAndKeys:
-            [NSNumber numberWithInt:navigationType], WebActionNavigationTypeKey,
-            elementInfo, WebActionElementKey,
-            [NSNumber numberWithInt:[event type]], WebActionButtonKey,
-            [NSNumber numberWithInt:[event modifierFlags]], WebActionModifierFlagsKey,
-	    URL, WebActionOriginalURLKey,
-            nil];
+    switch ([event type]) {
+        case NSLeftMouseDown:
+        case NSRightMouseDown:
+        case NSOtherMouseDown:
+        {
+            NSView *topViewInEventWindow = [[event window] contentView];
+            NSView *viewContainingPoint = [topViewInEventWindow hitTest:[topViewInEventWindow convertPoint:[event locationInWindow] fromView:nil]];
+    
+            ASSERT(viewContainingPoint != nil);
+            ASSERT([viewContainingPoint isKindOfClass:[WebHTMLView class]]);
+    
+            NSPoint point = [viewContainingPoint convertPoint:[event locationInWindow] fromView:nil];
+            NSDictionary *elementInfo = [(WebHTMLView *)viewContainingPoint _elementAtPoint:point];
+    
+            return [NSDictionary dictionaryWithObjectsAndKeys:
+                [NSNumber numberWithInt:navigationType], WebActionNavigationTypeKey,
+                elementInfo, WebActionElementKey,
+                [NSNumber numberWithInt:[event buttonNumber]], WebActionButtonKey,
+                [NSNumber numberWithInt:[event modifierFlags]], WebActionModifierFlagsKey,
+                URL, WebActionOriginalURLKey,
+                nil];
+        }
+        
+        default:
+            return [NSDictionary dictionaryWithObjectsAndKeys:
+                [NSNumber numberWithInt:navigationType], WebActionNavigationTypeKey,
+                URL, WebActionOriginalURLKey,
+                nil];
     }
-
-    return [NSDictionary dictionaryWithObjectsAndKeys:
-	[NSNumber numberWithInt:navigationType], WebActionNavigationTypeKey,
-        URL, WebActionOriginalURLKey,
-        nil];
 }
 
 - (void) _invalidatePendingPolicyDecisionCallingDefaultAction:(BOOL)call
@@ -1152,7 +1162,7 @@ static const char * const loadTypeNames[] = {
         [self _addBackForwardItemClippedAtTarget:NO];
     }
     
-    [_private->bridge openURL:[URL absoluteString] reload:NO headers:nil lastModified:nil pageCache: nil];
+    [_private->bridge scrollToAnchorWithURL:[URL absoluteString]];
     
     if (!isRedirect) {
         // This will clear previousItem from the rest of the frame tree tree that didn't
@@ -1194,23 +1204,33 @@ static const char * const loadTypeNames[] = {
         action = [self _actionInformationForNavigationType:WebNavigationTypeLinkClicked event:event originalURL:URL];
     }
 
-    // FIXME: This logic doesn't exactly match what KHTML does in openURL, so it's possible
-    // this will screw up in some cases involving framesets.
-    if (loadType != WebFrameLoadTypeReload && [URL fragment] && [[URL _web_URLByRemovingFragment] isEqual:[[NSURL _web_URLWithString:[_private->bridge URL]] _web_URLByRemovingFragment]]) {
-        // Just do anchor navigation within the existing content.  Note we only do this if there is
-        // an anchor in the URL - otherwise this check might prevent us from reloading a document
-        // that has subframes that are different than what we're displaying (in other words, a link
-        // from within a frame is trying to reload the frameset into _top).
+    WebDataSource *oldDataSource = [[self dataSource] retain];
+    
+    if (!isFormSubmission
+            && loadType != WebFrameLoadTypeReload
+            && ![_private->bridge isFrameSet]
+            && [URL fragment]
+            && [[URL _web_URLByRemovingFragment] isEqual:[[NSURL _web_URLWithString:[_private->bridge URL]] _web_URLByRemovingFragment]]) {
 
-        WebDataSource *dataSrc = [self dataSource];
-        [dataSrc _setTriggeringAction:action];
+        // Just do anchor navigation within the existing content.
+        
+        // We don't do this if we are submitting a form, explicitly reloading,
+        // currently displaying a frameset, or if the new URL does not have a fragment.
+        // These rules are based on what KHTML was doing in KHTMLPart::openURL.
+        
+        // One reason we only do this if there is an anchor in the URL is that
+        // this might prevent us from reloading a document that has subframes that are
+        // different than what we're displaying (in other words, a link from within a
+        // frame is trying to reload the frameset into _top).
+        
+        // FIXME: What about load types other than Standard and Reload?
 
+        [oldDataSource _setTriggeringAction:action];
         [self _invalidatePendingPolicyDecisionCallingDefaultAction:YES];
-
-        [self _checkNavigationPolicyForRequest:request dataSource:dataSrc andCall:self withSelector:@selector(_continueFragmentScrollAfterNavigationPolicy:request:)];
+        [self _checkNavigationPolicyForRequest:request dataSource:oldDataSource
+            andCall:self withSelector:@selector(_continueFragmentScrollAfterNavigationPolicy:request:)];
     } else {
         WebFrameLoadType previousLoadType = [self _loadType];
-        WebDataSource *oldDataSource = [[self dataSource] retain];
 
         [self _loadRequest:request triggeringAction:action loadType:loadType];
         if (_private->quickRedirectComing) {
@@ -1228,13 +1248,13 @@ static const char * const loadTypeNames[] = {
             [newDataSource _addBackForwardItems:[oldDataSource _backForwardItems]];
         }
         [request release];
-        [oldDataSource release];
     }
+
+    [oldDataSource release];
 }
 
 - (void)_loadURL:(NSURL *)URL intoChild:(WebFrame *)childFrame
 {
-    //WebDataSource *dataSrc = [self dataSource];
     WebHistoryItem *parentItem = [_private currentItem];
     NSArray *childItems = [parentItem children];
     WebFrameLoadType loadType = [self _loadType];
diff --git a/WebKit/WebView.subproj/WebHTMLView.m b/WebKit/WebView.subproj/WebHTMLView.m
index 3271d99..864865c 100644
--- a/WebKit/WebView.subproj/WebHTMLView.m
+++ b/WebKit/WebView.subproj/WebHTMLView.m
@@ -928,4 +928,14 @@
 {
 }
 
+#if INTERCEPT_ALL_CLICKS // gonna do this soon
+
+- (NSView *)hitTest:(NSPoint)point
+{
+    // We handle all clicks. We don't allow subviews to handle them.
+    return [super hitTest:point] ? self : nil;
+}
+
+#endif
+
 @end

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list