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

trey trey at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:48:19 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 2f1e3f8d01290815be2279d948d81b7aa6eec898
Author: trey <trey at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jun 24 18:58:43 2004 +0000

    WebCore:
    
    	3693420 - onbeforecut and onbeforepaste need real implementaion
    
            Reviewed by Chris.
    
            * kwq/KWQKHTMLPart.h:
            * kwq/KWQKHTMLPart.mm:
            (KWQKHTMLPart::mayCut):  Dispatch event to DHTML.
            (KWQKHTMLPart::mayCopy):  Ditto
            (KWQKHTMLPart::mayPaste):  Ditto
            (KWQKHTMLPart::tryCut):  No more need to send fake onbefore event
            (KWQKHTMLPart::tryCopy):  Ditto
            (KWQKHTMLPart::tryPaste): Ditto
            * kwq/WebCoreBridge.h:
            * kwq/WebCoreBridge.mm:
            (-[WebCoreBridge mayDHTMLCut]):  Standard glue
            (-[WebCoreBridge mayDHTMLCopy]):  Ditto
            (-[WebCoreBridge mayDHTMLPaste]):  Ditto
    
    WebKit:
    
    	3693420 - onbeforecut and onbeforepaste need real implementaion
    
            Reviewed by Chris.
    
            * WebView.subproj/WebHTMLView.m:
            (-[WebHTMLView validateUserInterfaceItem:]):  Check with WebCore
    	to see if cut, copy, paste should be enabled.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6921 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 75c8f09..5fc2ed9 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,23 @@
+2004-06-24  Trey Matteson  <trey at apple.com>
+
+	3693420 - onbeforecut and onbeforepaste need real implementaion
+
+        Reviewed by Chris.
+
+        * kwq/KWQKHTMLPart.h:
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::mayCut):  Dispatch event to DHTML.
+        (KWQKHTMLPart::mayCopy):  Ditto
+        (KWQKHTMLPart::mayPaste):  Ditto
+        (KWQKHTMLPart::tryCut):  No more need to send fake onbefore event
+        (KWQKHTMLPart::tryCopy):  Ditto
+        (KWQKHTMLPart::tryPaste): Ditto
+        * kwq/WebCoreBridge.h:
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge mayDHTMLCut]):  Standard glue
+        (-[WebCoreBridge mayDHTMLCopy]):  Ditto
+        (-[WebCoreBridge mayDHTMLPaste]):  Ditto
+
 2004-06-24  Darin Adler  <darin at apple.com>
 
         Reviewed by John.
diff --git a/WebCore/kwq/KWQKHTMLPart.h b/WebCore/kwq/KWQKHTMLPart.h
index 3a5da0d..19fd117 100644
--- a/WebCore/kwq/KWQKHTMLPart.h
+++ b/WebCore/kwq/KWQKHTMLPart.h
@@ -235,10 +235,13 @@ public:
     void dragSourceMovedTo(const QPoint &loc);
     void dragSourceEndedAt(const QPoint &loc);
 
+    bool mayCut();
+    bool mayCopy();
+    bool mayPaste();
     bool tryCut();
     bool tryCopy();
     bool tryPaste();
-
+    
     bool sendContextMenuEvent(NSEvent *);
 
     void clearTimers();
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index fad2165..8bec1b1 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -2095,6 +2095,8 @@ void KWQKHTMLPart::dragSourceEndedAt(const QPoint &loc)
     _dragSrc = 0;
 }
 
+// Returns whether caller should continue with "the default processing", which is the same as 
+// the event handler NOT setting the return value to false
 bool KWQKHTMLPart::dispatchCPPEvent(int eventId, KWQClipboard::AccessPolicy policy)
 {
     NodeImpl *target = d->m_selection.start().element();
@@ -2119,10 +2121,25 @@ bool KWQKHTMLPart::dispatchCPPEvent(int eventId, KWQClipboard::AccessPolicy poli
     return !noDefaultProcessing;
 }
 
-// In the next three functions, for now, we send the "before" event to gain some compatibility with WinIE.
-// WinIE uses onbeforecut and onbeforepaste to enables the cut and paste menu items, but we don't yet.  They
-// also send onbeforecopy, apparently for symmetry, but it doesn't affect the menu items.  The return of these
-// routines should not block the sending of non-"before" event.
+// WinIE uses onbeforecut and onbeforepaste to enables the cut and paste menu items.  They
+// also send onbeforecopy, apparently for symmetry, but it doesn't affect the menu items.
+// We need to use onbeforecopy as a real menu enabler because we allow elements that are not
+// normally selectable to implement copy/paste (like divs, or a document body).
+
+bool KWQKHTMLPart::mayCut()
+{
+    return !dispatchCPPEvent(EventImpl::BEFORECUT_EVENT, KWQClipboard::Numb);
+}
+
+bool KWQKHTMLPart::mayCopy()
+{
+    return !dispatchCPPEvent(EventImpl::BEFORECOPY_EVENT, KWQClipboard::Numb);
+}
+
+bool KWQKHTMLPart::mayPaste()
+{
+    return !dispatchCPPEvent(EventImpl::BEFOREPASTE_EVENT, KWQClipboard::Numb);
+}
 
 bool KWQKHTMLPart::tryCut()
 {
@@ -2130,7 +2147,6 @@ bool KWQKHTMLPart::tryCut()
     // also done for security, as it erases data from the last copy/paste.
     [[NSPasteboard generalPasteboard] declareTypes:[NSArray array] owner:nil];
 
-    dispatchCPPEvent(EventImpl::BEFORECUT_EVENT, KWQClipboard::Writable);
     return !dispatchCPPEvent(EventImpl::CUT_EVENT, KWQClipboard::Writable);
 }
 
@@ -2140,13 +2156,11 @@ bool KWQKHTMLPart::tryCopy()
     // also done for security, as it erases data from the last copy/paste.
     [[NSPasteboard generalPasteboard] declareTypes:[NSArray array] owner:nil];
 
-    dispatchCPPEvent(EventImpl::BEFORECOPY_EVENT, KWQClipboard::Writable);
     return !dispatchCPPEvent(EventImpl::COPY_EVENT, KWQClipboard::Writable);
 }
 
 bool KWQKHTMLPart::tryPaste()
 {
-    dispatchCPPEvent(EventImpl::BEFOREPASTE_EVENT, KWQClipboard::Readable);
     return !dispatchCPPEvent(EventImpl::PASTE_EVENT, KWQClipboard::Readable);
 }
 
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index 78b7c3f..ba3b5c3 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -325,6 +325,9 @@ typedef enum {
 - (void)dragSourceMovedTo:(NSPoint)windowLoc;
 - (void)dragSourceEndedAt:(NSPoint)windowLoc operation:(NSDragOperation)operation;
 
+- (BOOL)mayDHTMLCut;
+- (BOOL)mayDHTMLCopy;
+- (BOOL)mayDHTMLPaste;
 - (BOOL)tryDHTMLCut;
 - (BOOL)tryDHTMLCopy;
 - (BOOL)tryDHTMLPaste;
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index d2248a9..75d5540 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -1674,6 +1674,21 @@ static HTMLFormElementImpl *formElementFromDOMElement(DOMElement *element)
     }
 }
 
+- (BOOL)mayDHTMLCut
+{
+    return _part->mayCut();
+}
+
+- (BOOL)mayDHTMLCopy
+{
+    return _part->mayCopy();
+}
+
+- (BOOL)mayDHTMLPaste
+{
+    return _part->mayPaste();
+}
+
 - (BOOL)tryDHTMLCut
 {
     return _part->tryCut();
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 7475bcc..0d17e7c 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,13 @@
+2004-06-24  Trey Matteson  <trey at apple.com>
+
+	3693420 - onbeforecut and onbeforepaste need real implementaion
+
+        Reviewed by Chris.
+
+        * WebView.subproj/WebHTMLView.m:
+        (-[WebHTMLView validateUserInterfaceItem:]):  Check with WebCore
+	to see if cut, copy, paste should be enabled.
+
 2004-06-24  John Sullivan  <sullivan at apple.com>
 
         Reviewed by Darin.
@@ -11,8 +21,8 @@
 
 2004-06-23  Richard Williamson   <rjw at apple.com>
 
-		Implemented changes for latest npruntime.h.
-		Made npruntime.h public.
+	Implemented changes for latest npruntime.h.
+	Made npruntime.h public.
 		
         Reviewed by Chris.
 
diff --git a/WebKit/WebView.subproj/WebHTMLView.m b/WebKit/WebView.subproj/WebHTMLView.m
index 19980f8..205f0da 100644
--- a/WebKit/WebView.subproj/WebHTMLView.m
+++ b/WebKit/WebView.subproj/WebHTMLView.m
@@ -1211,15 +1211,16 @@ static WebHTMLView *lastHitView = nil;
 - (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item 
 {
     SEL action = [item action];
-    
+    WebBridge *bridge = [self _bridge];
+
     if (action == @selector(cut:)) {
-        return [self _canDelete];
+        return [bridge mayDHTMLCut] || [self _canDelete];
     } else if (action == @selector(copy:)) {
-        return [self _haveSelection];
+        return [bridge mayDHTMLCopy] || [self _haveSelection];
     } else if (action == @selector(delete:)) {
         return [self _canDelete];
     } else if (action == @selector(paste:)) {
-        return [self _canPaste];
+        return [bridge mayDHTMLPaste] || [self _canPaste];
     } else if (action == @selector(takeFindStringFromSelection:)) {
         return [self _haveSelection];
     } else if (action == @selector(jumpToSelection:)) {

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list