[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:56:48 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit b4a3f2a58a40434baeae82be7e37afbce6d1d7d0
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Sep 22 00:33:22 2003 +0000

    WebCore:
    
            Reviewed by Dave.
    
            - fixed 3106411 -- show title attribute for page elements in tooltip on mouseover (important for PeopleSoft)
    
            * kwq/WebCoreBridge.mm: (-[WebCoreBridge elementAtPoint:]): Set the value of a new element dictionary
            key, WebCoreElementTitleKey. This gives the title for an element, walking up the DOM tree as necessary
            to find it. It's used for tool tips at the WebKit level.
            * kwq/WebCoreBridge.h: Added WebCoreElementTitleKey and WebCorePageCacheStateKey.
    
            * WebCore.exp: Added all the constants from WebCoreBridge.h; these should be exported even though they
            are not being used at the moment because the "WebCore and WebKit use the same constant keys" hack we
            are doing at the WebKit level means we can just use the WebKit keys on the WebKit side.
            * WebCore-combined.exp: Regenerated.
    
    WebKit:
    
            Reviewed by Dave.
    
            - fixed 3106411 -- show title attribute for page elements in tooltip on mouseover (important for PeopleSoft)
    
            * WebView.subproj/WebHTMLViewPrivate.h: Added fields needed for tool tip implementation.
            * WebView.subproj/WebHTMLViewPrivate.m:
            (-[WebHTMLViewPrivate dealloc]): Release the tool tip string.
            (-[WebHTMLView addTrackingRect:owner:userData:assumeInside:]): Override the default NSView
            tracking rectangle implementation so we can trick the tool tip manager into trusting us about
            when you leave and enter the rectangle for each element.
            (-[WebHTMLView removeTrackingRect:]): The other half of the above stuff.
            (-[WebHTMLView _sendToolTipMouseExited]): Added. Makes an event just good enough to fool the tool tip
            manager, and send it on.
            (-[WebHTMLView _sendToolTipMouseEntered]): Ditto.
            (-[WebHTMLView _setToolTip:]): Added. Manages the new and old tool tips in a way that fools the tool
            tip manager into working even though we don't know the rectangles of the tool tips beforehand. The
            advantage of using AppKit tool tips is that they have all sorts of nice little features, like wrapping
            to a nice rectangular shape and fading out when you move away.
            (-[WebHTMLView view:stringForToolTip:point:userData:]): This is how the tool tip manager gets the actual
            tool tip text.
            (-[WebHTMLView _updateMouseoverWithEvent:]): Call _setToolTip method, using the value passed along with the
            WebCoreElementTitleKey in the dictionary.
    
            - unrelated code cleanup
    
            * WebView.subproj/WebFramePrivate.h: Don't define WebCorePageCacheStateKey here; instead use
            a definition exported from WebCore.
            * WebView.subproj/WebFramePrivate.m: Ditto.
            * English.lproj/StringsNotToBeLocalized.txt: Update for above changes.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5026 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index bcf40d3..98bb61f 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,19 @@
+2003-09-21  Darin Adler  <darin at apple.com>
+
+        Reviewed by Dave.
+
+        - fixed 3106411 -- show title attribute for page elements in tooltip on mouseover (important for PeopleSoft)
+
+        * kwq/WebCoreBridge.mm: (-[WebCoreBridge elementAtPoint:]): Set the value of a new element dictionary
+        key, WebCoreElementTitleKey. This gives the title for an element, walking up the DOM tree as necessary
+        to find it. It's used for tool tips at the WebKit level.
+        * kwq/WebCoreBridge.h: Added WebCoreElementTitleKey and WebCorePageCacheStateKey.
+
+        * WebCore.exp: Added all the constants from WebCoreBridge.h; these should be exported even though they
+        are not being used at the moment because the "WebCore and WebKit use the same constant keys" hack we
+        are doing at the WebKit level means we can just use the WebKit keys on the WebKit side.
+        * WebCore-combined.exp: Regenerated.
+
 2003-09-20  Darin Adler  <darin at apple.com>
 
         Reviewed by Dave.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index bcf40d3..98bb61f 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,19 @@
+2003-09-21  Darin Adler  <darin at apple.com>
+
+        Reviewed by Dave.
+
+        - fixed 3106411 -- show title attribute for page elements in tooltip on mouseover (important for PeopleSoft)
+
+        * kwq/WebCoreBridge.mm: (-[WebCoreBridge elementAtPoint:]): Set the value of a new element dictionary
+        key, WebCoreElementTitleKey. This gives the title for an element, walking up the DOM tree as necessary
+        to find it. It's used for tool tips at the WebKit level.
+        * kwq/WebCoreBridge.h: Added WebCoreElementTitleKey and WebCorePageCacheStateKey.
+
+        * WebCore.exp: Added all the constants from WebCoreBridge.h; these should be exported even though they
+        are not being used at the moment because the "WebCore and WebKit use the same constant keys" hack we
+        are doing at the WebKit level means we can just use the WebKit keys on the WebKit side.
+        * WebCore-combined.exp: Regenerated.
+
 2003-09-20  Darin Adler  <darin at apple.com>
 
         Reviewed by Dave.
diff --git a/WebCore/WebCore-combined.exp b/WebCore/WebCore-combined.exp
index 2fe99c4..cf5eb63 100644
--- a/WebCore/WebCore-combined.exp
+++ b/WebCore/WebCore-combined.exp
@@ -9,8 +9,23 @@
 .objc_class_name_WebCoreSettings
 .objc_class_name_WebCoreTextRendererFactory
 .objc_class_name_WebCoreViewFactory
-_WebCoreFileButtonFilenameChanged
+_WebCoreDirectionInfo
+_WebCoreElementFrameKey
+_WebCoreElementImageAltStringKey
+_WebCoreElementImageKey
+_WebCoreElementImageRectKey
+_WebCoreElementImageURLKey
+_WebCoreElementIsSelectedKey
+_WebCoreElementLinkLabelKey
+_WebCoreElementLinkTargetFrameKey
+_WebCoreElementLinkTitleKey
+_WebCoreElementLinkURLKey
+_WebCoreElementTitleKey
 _WebCoreFileButtonClicked
+_WebCoreFileButtonFilenameChanged
+_WebCoreInitializeEmptyTextStyle
+_WebCoreInitializeTextRun
+_WebCorePageCacheStateKey
 _WebCoreUnicodeCategoryFunction
 _WebCoreUnicodeCombiningClassFunction
 _WebCoreUnicodeDecompositionTagFunction
@@ -21,9 +36,6 @@ _WebCoreUnicodeLowerFunction
 _WebCoreUnicodeMirroredCharFunction
 _WebCoreUnicodeMirroredFunction
 _WebCoreUnicodeUpperFunction
-_WebCoreInitializeTextRun
-_WebCoreInitializeEmptyTextStyle
-_WebCoreDirectionInfo
 __ZN10KWQMapImpl11endInternalEv
 __ZN10KWQMapImpl13beginInternalEv
 __ZN10KWQMapImpl13clearInternalEv
diff --git a/WebCore/WebCore.exp b/WebCore/WebCore.exp
index a806f7a..4777f6a 100644
--- a/WebCore/WebCore.exp
+++ b/WebCore/WebCore.exp
@@ -9,8 +9,23 @@
 .objc_class_name_WebCoreSettings
 .objc_class_name_WebCoreTextRendererFactory
 .objc_class_name_WebCoreViewFactory
-_WebCoreFileButtonFilenameChanged
+_WebCoreDirectionInfo
+_WebCoreElementFrameKey
+_WebCoreElementImageAltStringKey
+_WebCoreElementImageKey
+_WebCoreElementImageRectKey
+_WebCoreElementImageURLKey
+_WebCoreElementIsSelectedKey
+_WebCoreElementLinkLabelKey
+_WebCoreElementLinkTargetFrameKey
+_WebCoreElementLinkTitleKey
+_WebCoreElementLinkURLKey
+_WebCoreElementTitleKey
 _WebCoreFileButtonClicked
+_WebCoreFileButtonFilenameChanged
+_WebCoreInitializeEmptyTextStyle
+_WebCoreInitializeTextRun
+_WebCorePageCacheStateKey
 _WebCoreUnicodeCategoryFunction
 _WebCoreUnicodeCombiningClassFunction
 _WebCoreUnicodeDecompositionTagFunction
@@ -21,6 +36,3 @@ _WebCoreUnicodeLowerFunction
 _WebCoreUnicodeMirroredCharFunction
 _WebCoreUnicodeMirroredFunction
 _WebCoreUnicodeUpperFunction
-_WebCoreInitializeTextRun
-_WebCoreInitializeEmptyTextStyle
-_WebCoreDirectionInfo
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index 9ec8176..7f8f9a1 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -68,6 +68,9 @@ extern NSString *WebCoreElementLinkURLKey;
 extern NSString *WebCoreElementLinkTargetFrameKey;
 extern NSString *WebCoreElementLinkLabelKey;
 extern NSString *WebCoreElementLinkTitleKey;
+extern NSString *WebCoreElementTitleKey;
+
+extern NSString *WebCorePageCacheStateKey;
 
 typedef enum {
     WebCoreDeviceScreen,
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index 7e55513..a9cf980 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -93,8 +93,9 @@ NSString *WebCoreElementLinkTargetFrameKey =	@"WebElementTargetFrame";
 NSString *WebCoreElementLinkLabelKey = 		@"WebElementLinkLabel";
 NSString *WebCoreElementLinkTitleKey = 		@"WebElementLinkTitle";
 NSString *WebCoreElementNameKey = 		@"WebElementName";
+NSString *WebCoreElementTitleKey = 		@"WebCoreElementTitle"; // not in WebKit API for now, could be in API some day
 
-NSString *WebCorePageCacheStateKey =               @"WebCorePageCacheState";
+NSString *WebCorePageCacheStateKey =            @"WebCorePageCacheState";
 
 @implementation WebCoreBridge
 
@@ -692,7 +693,21 @@ static HTMLFormElementImpl *formElementFromDOMElement(id <WebDOMElement>element)
     NSMutableDictionary *element = [NSMutableDictionary dictionary];
     [element setObject:[NSNumber numberWithBool:_part->isPointInsideSelection((int)point.x, (int)point.y)]
                 forKey:WebCoreElementIsSelectedKey];
-    
+
+    // Find the title in the nearest enclosing DOM node.
+    for (NodeImpl *titleNode = nodeInfo.innerNonSharedNode(); titleNode; titleNode = titleNode->parentNode()) {
+        if (titleNode->isElementNode()) {
+            const DOMString title = static_cast<ElementImpl *>(titleNode)->getAttribute(ATTR_TITLE);
+            if (!title.isNull()) {
+                // We found a node with a title.
+                QString titleText = title.string();
+                titleText.replace('\\', _part->backslashAsCurrencySymbol());
+                [element setObject:titleText.getNSString() forKey:WebCoreElementTitleKey];
+                break;
+            }
+        }
+    }
+
     NodeImpl *URLNode = nodeInfo.URLElement();
     if (URLNode) {
         ElementImpl *e = static_cast<ElementImpl *>(URLNode);
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index d531fd9..b609245 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,35 @@
+2003-09-21  Darin Adler  <darin at apple.com>
+
+        Reviewed by Dave.
+
+        - fixed 3106411 -- show title attribute for page elements in tooltip on mouseover (important for PeopleSoft)
+
+        * WebView.subproj/WebHTMLViewPrivate.h: Added fields needed for tool tip implementation.
+        * WebView.subproj/WebHTMLViewPrivate.m:
+        (-[WebHTMLViewPrivate dealloc]): Release the tool tip string.
+        (-[WebHTMLView addTrackingRect:owner:userData:assumeInside:]): Override the default NSView
+        tracking rectangle implementation so we can trick the tool tip manager into trusting us about
+        when you leave and enter the rectangle for each element.
+        (-[WebHTMLView removeTrackingRect:]): The other half of the above stuff.
+        (-[WebHTMLView _sendToolTipMouseExited]): Added. Makes an event just good enough to fool the tool tip
+        manager, and send it on.
+        (-[WebHTMLView _sendToolTipMouseEntered]): Ditto.
+        (-[WebHTMLView _setToolTip:]): Added. Manages the new and old tool tips in a way that fools the tool
+        tip manager into working even though we don't know the rectangles of the tool tips beforehand. The
+        advantage of using AppKit tool tips is that they have all sorts of nice little features, like wrapping
+        to a nice rectangular shape and fading out when you move away.
+        (-[WebHTMLView view:stringForToolTip:point:userData:]): This is how the tool tip manager gets the actual
+        tool tip text.
+        (-[WebHTMLView _updateMouseoverWithEvent:]): Call _setToolTip method, using the value passed along with the
+        WebCoreElementTitleKey in the dictionary.
+
+        - unrelated code cleanup
+
+        * WebView.subproj/WebFramePrivate.h: Don't define WebCorePageCacheStateKey here; instead use
+        a definition exported from WebCore.
+        * WebView.subproj/WebFramePrivate.m: Ditto.
+        * English.lproj/StringsNotToBeLocalized.txt: Update for above changes.
+
 2003-09-19  Maciej Stachowiak  <mjs at apple.com>
 
         Reviewed by Darin.
diff --git a/WebKit/English.lproj/StringsNotToBeLocalized.txt b/WebKit/English.lproj/StringsNotToBeLocalized.txt
index e957759..acde62b 100644
--- a/WebKit/English.lproj/StringsNotToBeLocalized.txt
+++ b/WebKit/English.lproj/StringsNotToBeLocalized.txt
@@ -115,7 +115,6 @@
 "WebActionOriginalURLKey"
 "WebAuthenticationPanel"
 "WebBackForwardList:\n"
-"WebCorePageCacheState"
 "WebCurrentFrameState"
 "WebDataRequest"
 "WebElementFrame"
diff --git a/WebKit/WebView.subproj/WebFramePrivate.h b/WebKit/WebView.subproj/WebFramePrivate.h
index 514741c..86c54d1 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.h
+++ b/WebKit/WebView.subproj/WebFramePrivate.h
@@ -54,7 +54,6 @@ typedef enum {
 extern NSString *WebPageCacheEntryDateKey;
 extern NSString *WebPageCacheDataSourceKey;
 extern NSString *WebPageCacheDocumentViewKey;
-extern NSString *WebCorePageCacheStateKey;
 
 @interface WebFramePrivate : NSObject
 {
diff --git a/WebKit/WebView.subproj/WebFramePrivate.m b/WebKit/WebView.subproj/WebFramePrivate.m
index f2cf25e..3e2b44c 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.m
+++ b/WebKit/WebView.subproj/WebFramePrivate.m
@@ -84,7 +84,6 @@ Repeat load of the same URL (by any other means of navigation other than the rel
 NSString *WebPageCacheEntryDateKey = @"WebPageCacheEntryDateKey";
 NSString *WebPageCacheDataSourceKey = @"WebPageCacheDataSourceKey";
 NSString *WebPageCacheDocumentViewKey = @"WebPageCacheDocumentViewKey";
-NSString *WebCorePageCacheStateKey = @"WebCorePageCacheState";
 
 @interface NSObject (WebExtraPerformMethod)
 
diff --git a/WebKit/WebView.subproj/WebHTMLViewPrivate.h b/WebKit/WebView.subproj/WebHTMLViewPrivate.h
index ae56ba4..1806a54 100644
--- a/WebKit/WebView.subproj/WebHTMLViewPrivate.h
+++ b/WebKit/WebView.subproj/WebHTMLViewPrivate.h
@@ -35,6 +35,11 @@
     BOOL laidOutAtLeastOnce;
     
     WebPluginController *pluginController;
+    
+    NSString *toolTip;
+    NSToolTipTag toolTipTag;
+    id trackingRectOwner;
+    void *trackingRectUserData;
 }
 @end
 
diff --git a/WebKit/WebView.subproj/WebHTMLViewPrivate.m b/WebKit/WebView.subproj/WebHTMLViewPrivate.m
index 4b4b8be..de97d7a 100644
--- a/WebKit/WebView.subproj/WebHTMLViewPrivate.m
+++ b/WebKit/WebView.subproj/WebHTMLViewPrivate.m
@@ -39,6 +39,9 @@
 #define DRAG_LINK_LABEL_FONT_SIZE   11.0
 #define DRAG_LINK_URL_FONT_SIZE   10.0
 
+// Any non-zero value will do, but using somethign recognizable might help us debug some day.
+#define TRACKING_RECT_TAG 0xBADFACE
+
 static BOOL forceRealHitTest = NO;
 
 @interface NSView (AppKitSecretsIKnowAbout)
@@ -64,6 +67,7 @@ static BOOL forceRealHitTest = NO;
     [mouseDownEvent release];
     [draggingImageURL release];
     [pluginController release];
+    [toolTip release];
     
     [super dealloc];
 }
@@ -292,6 +296,79 @@ static WebHTMLView *lastHitView = nil;
     }
 }
 
+- (NSTrackingRectTag)addTrackingRect:(NSRect)rect owner:(id)owner userData:(void *)data assumeInside:(BOOL)flag
+{
+    ASSERT(_private->trackingRectOwner == nil);
+    _private->trackingRectOwner = owner;
+    _private->trackingRectUserData = data;
+    return TRACKING_RECT_TAG;
+}
+
+- (void)removeTrackingRect:(NSTrackingRectTag)tag
+{
+    if (_private != nil) {
+        ASSERT(_private->trackingRectOwner != nil);
+        _private->trackingRectOwner = nil;
+    }
+}
+
+- (void)_sendToolTipMouseExited
+{
+    // Nothing matters except window, trackingNumber, and userData.
+    NSEvent *fakeEvent = [NSEvent enterExitEventWithType:NSMouseExited
+        location:NSMakePoint(0, 0)
+        modifierFlags:0
+        timestamp:0
+        windowNumber:[[self window] windowNumber]
+        context:NULL
+        eventNumber:0
+        trackingNumber:TRACKING_RECT_TAG
+        userData:_private->trackingRectUserData];
+    [_private->trackingRectOwner mouseExited:fakeEvent];
+}
+
+- (void)_sendToolTipMouseEntered
+{
+    // Nothing matters except window, trackingNumber, and userData.
+    NSEvent *fakeEvent = [NSEvent enterExitEventWithType:NSMouseEntered
+        location:NSMakePoint(0, 0)
+        modifierFlags:0
+        timestamp:0
+        windowNumber:[[self window] windowNumber]
+        context:NULL
+        eventNumber:0
+        trackingNumber:TRACKING_RECT_TAG
+        userData:_private->trackingRectUserData];
+    [_private->trackingRectOwner mouseEntered:fakeEvent];
+}
+
+- (void)_setToolTip:(NSString *)string
+{
+    NSString *toolTip = [string length] == 0 ? nil : string;
+    NSString *oldToolTip = _private->toolTip;
+    if ((toolTip == nil || oldToolTip == nil) ? toolTip == oldToolTip : [toolTip isEqualToString:oldToolTip]) {
+        return;
+    }
+    if (oldToolTip) {
+        [self _sendToolTipMouseExited];
+        [oldToolTip release];
+    }
+    _private->toolTip = [toolTip copy];
+    if (toolTip) {
+        if (_private->toolTipTag) {
+            [self removeToolTip:_private->toolTipTag];
+        }
+        NSRect wideOpenRect = NSMakeRect(-100000, -100000, 200000, 200000);
+        _private->toolTipTag = [self addToolTipRect:wideOpenRect owner:self userData:NULL];
+        [self _sendToolTipMouseEntered];
+    }
+}
+
+- (NSString *)view:(NSView *)view stringForToolTip:(NSToolTipTag)tag point:(NSPoint)point userData:(void *)data
+{
+    return [[_private->toolTip copy] autorelease];
+}
+
 - (void)_updateMouseoverWithEvent:(NSEvent *)event
 {
     WebHTMLView *view = nil;
@@ -328,13 +405,21 @@ static WebHTMLView *lastHitView = nil;
 
     lastHitView = view;
     
+    NSDictionary *element;
     if (view == nil) {
-        [[self _webView] _mouseDidMoveOverElement:nil modifierFlags:0];
+        element = nil;
     } else {
         [[view _bridge] mouseMoved:event];
+
         NSPoint point = [view convertPoint:[event locationInWindow] fromView:nil];
-        [[self _webView] _mouseDidMoveOverElement:[view _elementAtPoint:point] modifierFlags:[event modifierFlags]];
+        element = [view _elementAtPoint:point];
     }
+
+    // Have the web view send a message to the delegate so it can do status bar display.
+    [[self _webView] _mouseDidMoveOverElement:element modifierFlags:[event modifierFlags]];
+
+    // Set a tool tip; it won't show up right away but will if the user pauses.
+    [self _setToolTip:[element objectForKey:WebCoreElementTitleKey]];
 }
 
 - (BOOL)_interceptKeyEvent:(NSEvent *)event toView:(NSView *)view

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list