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

hyatt hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:30:53 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit f0a3efc1ea3e0faac8823372b396bf864e2b6f00
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Mar 26 01:34:14 2004 +0000

    WebCore:
    
    	Implement the rest of the search field.  Make it work with form submission.  Implement onscroll at
    	the document level.
    
            Reviewed by darin
    
            * khtml/html/html_formimpl.cpp:
            (HTMLFormElementImpl::submit):
            * khtml/rendering/render_form.cpp:
            (RenderLineEdit::addSearchResult):
            * khtml/rendering/render_form.h:
            * kwq/KWQKHTMLPart.h:
            * kwq/KWQKHTMLPart.mm:
            (KWQKHTMLPart::sendScrollEvent):
            * kwq/KWQLineEdit.h:
            * kwq/KWQLineEdit.mm:
            (QLineEdit::setMaxResults):
            (QLineEdit::setPlaceholderString):
            (QLineEdit::addSearchResult):
            * kwq/WebCoreBridge.h:
            * kwq/WebCoreBridge.mm:
            (-[WebCoreBridge sendScrollEvent]):
            * kwq/WebCoreViewFactory.h:
    
    WebKit:
    
    	Implement the rest of the search field.
    
    	Implement onscroll at the document level.
    
            Reviewed by darin
    
            * English.lproj/Localizable.strings:
            * WebCoreSupport.subproj/WebBridge.m:
            * WebCoreSupport.subproj/WebViewFactory.m:
            (-[NSMenu addItemWithTitle:action:tag:]):
            (-[WebViewFactory submitButtonDefaultLabel]):
            (-[WebViewFactory cellMenuForSearchField]):
            * WebView.subproj/WebHTMLView.m:
            (-[WebHTMLView _frameOrBoundsChanged]):
            (-[WebHTMLView viewDidMoveToWindow]):
            * WebView.subproj/WebHTMLViewPrivate.h:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6260 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 76243e6..57fea04 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,5 +1,30 @@
 2004-03-25  David Hyatt  <hyatt at apple.com>
 
+	Implement the rest of the search field.  Make it work with form submission.  Implement onscroll at
+	the document level.
+	
+        Reviewed by darin
+
+        * khtml/html/html_formimpl.cpp:
+        (HTMLFormElementImpl::submit):
+        * khtml/rendering/render_form.cpp:
+        (RenderLineEdit::addSearchResult):
+        * khtml/rendering/render_form.h:
+        * kwq/KWQKHTMLPart.h:
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::sendScrollEvent):
+        * kwq/KWQLineEdit.h:
+        * kwq/KWQLineEdit.mm:
+        (QLineEdit::setMaxResults):
+        (QLineEdit::setPlaceholderString):
+        (QLineEdit::addSearchResult):
+        * kwq/WebCoreBridge.h:
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge sendScrollEvent]):
+        * kwq/WebCoreViewFactory.h:
+
+2004-03-25  David Hyatt  <hyatt at apple.com>
+
 	Fix for 3570700, crash in inlineBox::isDirty.  Make sure line boxes null out parent pointers when those
 	parents get deleted.  r=john
 
diff --git a/WebCore/khtml/html/html_formimpl.cpp b/WebCore/khtml/html/html_formimpl.cpp
index 0441aca..7c8758e 100644
--- a/WebCore/khtml/html/html_formimpl.cpp
+++ b/WebCore/khtml/html/html_formimpl.cpp
@@ -521,9 +521,12 @@ void HTMLFormElementImpl::submit( bool activateSubmitButton )
         if (current->id() == ID_INPUT) {
             HTMLInputElementImpl *input = static_cast<HTMLInputElementImpl*>(current);
             if (input->inputType() == HTMLInputElementImpl::TEXT
-                || input->inputType() ==  HTMLInputElementImpl::PASSWORD)
+                || input->inputType() ==  HTMLInputElementImpl::PASSWORD
+                || input->inputType() == HTMLInputElementImpl::SEARCH)
             {
                 KWQ(part)->recordFormValue(input->name().string(), input->value().string(), this);
+                if (input->renderer() && input->inputType() == HTMLInputElementImpl::SEARCH)
+                    static_cast<RenderLineEdit*>(input->renderer())->addSearchResult();
             }
         }
 #else
diff --git a/WebCore/khtml/rendering/render_form.cpp b/WebCore/khtml/rendering/render_form.cpp
index 4c38619..5117da3 100644
--- a/WebCore/khtml/rendering/render_form.cpp
+++ b/WebCore/khtml/rendering/render_form.cpp
@@ -598,6 +598,12 @@ void RenderLineEdit::slotPerformSearch()
     // Fire the "search" DOM event.
     element()->dispatchHTMLEvent(EventImpl::SEARCH_EVENT, true, false);
 }
+
+void RenderLineEdit::addSearchResult()
+{
+    if (widget())
+        widget()->addSearchResult();
+}
 #endif
 
 void RenderLineEdit::handleFocusOut()
diff --git a/WebCore/khtml/rendering/render_form.h b/WebCore/khtml/rendering/render_form.h
index cc600b9..fee2595 100644
--- a/WebCore/khtml/rendering/render_form.h
+++ b/WebCore/khtml/rendering/render_form.h
@@ -265,6 +265,8 @@ public slots:
     void slotTextChanged(const QString &string);
 #if APPLE_CHANGES
     void slotPerformSearch();
+public:
+    void addSearchResult();
 #endif
 
 protected:
diff --git a/WebCore/kwq/KWQKHTMLPart.h b/WebCore/kwq/KWQKHTMLPart.h
index e65833b..ef7feeb 100644
--- a/WebCore/kwq/KWQKHTMLPart.h
+++ b/WebCore/kwq/KWQKHTMLPart.h
@@ -181,6 +181,7 @@ public:
     void forceLayout();
     void forceLayoutWithPageWidthRange(float minPageWidth, float maxPageWidth);
     void sendResizeEvent();
+    void sendScrollEvent();
     void paint(QPainter *, const QRect &);
     void paintSelectionOnly(QPainter *p, const QRect &rect);
 
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 38b83f1..9861a8c 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -1468,6 +1468,17 @@ void KWQKHTMLPart::sendResizeEvent()
     }
 }
 
+void KWQKHTMLPart::sendScrollEvent()
+{
+    KHTMLView *v = d->m_view;
+    if (v) {
+        DocumentImpl *doc = xmlDocImpl();
+        if (!doc)
+            return;
+        doc->dispatchHTMLEvent(EventImpl::SCROLL_EVENT, true, false);
+    }
+}
+
 void KWQKHTMLPart::runJavaScriptAlert(const QString &message)
 {
     QString text = message;
diff --git a/WebCore/kwq/KWQLineEdit.h b/WebCore/kwq/KWQLineEdit.h
index fbbea62..ceef6b6 100644
--- a/WebCore/kwq/KWQLineEdit.h
+++ b/WebCore/kwq/KWQLineEdit.h
@@ -81,6 +81,7 @@ public:
     void setAutoSaveName(const QString& name);
     void setMaxResults(int maxResults);
     void setPlaceholderString(const QString& placeholder);
+    void addSearchResult();
 
 private:
     KWQSignal m_returnPressed;
diff --git a/WebCore/kwq/KWQLineEdit.mm b/WebCore/kwq/KWQLineEdit.mm
index 92204fc..6d32b3a 100644
--- a/WebCore/kwq/KWQLineEdit.mm
+++ b/WebCore/kwq/KWQLineEdit.mm
@@ -31,6 +31,11 @@
 #import "KWQTextField.h"
 #import "WebCoreTextRenderer.h"
 #import "WebCoreTextRendererFactory.h"
+#import "WebCoreViewFactory.h"
+
+ at interface NSSearchField (SearchFieldSecrets)
+- (void) _addStringToRecentSearches:(NSString*)string;
+ at end
 
 QLineEdit::QLineEdit(Type type)
     : m_returnPressed(this, SIGNAL(returnPressed()))
@@ -285,12 +290,21 @@ void QLineEdit::setMaxResults(int maxResults)
         return;
     
     NSSearchField *searchField = (NSSearchField *)getView();
-    if (!maxResults)
-        [[searchField cell] setSearchButtonCell:nil];
-    else
-        [[searchField cell] resetSearchButtonCell];
-
-    [[searchField cell] setMaximumRecents:maxResults];
+    id searchCell = [searchField cell];
+    if (!maxResults) {
+        [searchCell setSearchButtonCell:nil];
+        [searchCell setSearchMenuTemplate:nil];
+    }
+    else {
+        NSMenu* cellMenu = [searchCell searchMenuTemplate];
+        NSButtonCell* buttonCell = [searchCell searchButtonCell];
+        if (!buttonCell)
+            [searchCell resetSearchButtonCell];
+        if (!cellMenu)
+            [searchCell setSearchMenuTemplate:[[WebCoreViewFactory sharedFactory] cellMenuForSearchField]];
+    }
+    
+    [searchCell setMaximumRecents:maxResults];
 }
 
 void QLineEdit::setPlaceholderString(const QString& placeholder)
@@ -302,3 +316,12 @@ void QLineEdit::setPlaceholderString(const QString& placeholder)
     [[searchField cell] setPlaceholderString:placeholder.getNSString()];
 }
 
+void QLineEdit::addSearchResult()
+{
+    if (m_type != Search)
+        return;
+    
+    NSSearchField *searchField = (NSSearchField *)getView();
+    [[searchField cell] _addStringToRecentSearches:[searchField stringValue]];
+}
+
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index c53630a..b3dd52a 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -170,6 +170,7 @@ typedef enum {
 - (void)forceLayoutAdjustingViewSize:(BOOL)adjustSizeFlag;
 - (void)forceLayoutWithMinimumPageWidth:(float)minPageWidth maximumPageWidth:(float)maxPageWidth adjustingViewSize:(BOOL)adjustSizeFlag;
 - (void)sendResizeEvent;
+- (void)sendScrollEvent;
 - (BOOL)needsLayout;
 - (void)setNeedsLayout;
 - (void)drawRect:(NSRect)rect;
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index bbcf1ca..a8fb8df 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -585,6 +585,11 @@ static BOOL nowPrinting(WebCoreBridge *self)
     _part->sendResizeEvent();
 }
 
+- (void)sendScrollEvent
+{
+    _part->sendScrollEvent();
+}
+
 - (void)drawRect:(NSRect)rect withPainter:(QPainter *)p
 {
     [self _setupRootForPrinting:YES];
diff --git a/WebCore/kwq/WebCoreViewFactory.h b/WebCore/kwq/WebCoreViewFactory.h
index 1ce6faa..b869a69 100644
--- a/WebCore/kwq/WebCoreViewFactory.h
+++ b/WebCore/kwq/WebCoreViewFactory.h
@@ -39,6 +39,8 @@
 - (NSString *)searchableIndexIntroduction;
 - (NSString *)submitButtonDefaultLabel;
 
+- (NSMenu *)cellMenuForSearchField;
+
 - (NSString *)defaultLanguageCode;
 
 - (WebCoreBridge *)bridgeForView:(NSView *)aView;
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 5b3ac25..29afed0 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,22 @@
+2004-03-25  David Hyatt  <hyatt at apple.com>
+
+	Implement the rest of the search field.
+
+	Implement onscroll at the document level.
+	
+        Reviewed by darin
+
+        * English.lproj/Localizable.strings:
+        * WebCoreSupport.subproj/WebBridge.m:
+        * WebCoreSupport.subproj/WebViewFactory.m:
+        (-[NSMenu addItemWithTitle:action:tag:]):
+        (-[WebViewFactory submitButtonDefaultLabel]):
+        (-[WebViewFactory cellMenuForSearchField]):
+        * WebView.subproj/WebHTMLView.m:
+        (-[WebHTMLView _frameOrBoundsChanged]):
+        (-[WebHTMLView viewDidMoveToWindow]):
+        * WebView.subproj/WebHTMLViewPrivate.h:
+
 2004-03-25  Richard Williamson   <rjw at apple.com>
 
 	Netscape plugin API header cleanup.
diff --git a/WebKit/English.lproj/Localizable.strings b/WebKit/English.lproj/Localizable.strings
index 2081b35..628c542 100644
Binary files a/WebKit/English.lproj/Localizable.strings and b/WebKit/English.lproj/Localizable.strings differ
diff --git a/WebKit/WebCoreSupport.subproj/WebBridge.m b/WebKit/WebCoreSupport.subproj/WebBridge.m
index 4df9d22..080a030 100644
--- a/WebKit/WebCoreSupport.subproj/WebBridge.m
+++ b/WebKit/WebCoreSupport.subproj/WebBridge.m
@@ -74,7 +74,6 @@
 - (jobject)pollForAppletInWindow: (NSWindow *)window;
 @end
 
-
 @implementation WebBridge
 
 - (id)initWithWebFrame:(WebFrame *)webFrame
diff --git a/WebKit/WebCoreSupport.subproj/WebViewFactory.m b/WebKit/WebCoreSupport.subproj/WebViewFactory.m
index fe2c215..91408f7 100644
--- a/WebKit/WebCoreSupport.subproj/WebViewFactory.m
+++ b/WebKit/WebCoreSupport.subproj/WebViewFactory.m
@@ -17,6 +17,20 @@
 
 #import <WebKit/WebPluginDatabase.h>
 
+ at interface NSMenu (BrowserMenuAdditions)
+- (NSMenuItem *)addItemWithTitle:(NSString *)title action:(SEL)action tag:(int)tag;
+ at end
+
+ at implementation NSMenu (BrowserMenuAdditions)
+- (NSMenuItem *)addItemWithTitle:(NSString *)title action:(SEL)action tag:(int)tag
+{
+    NSMenuItem *item = [[[NSMenuItem alloc] initWithTitle:title action:action keyEquivalent:@""] autorelease];
+    [item setTag:tag];
+    [self addItem:item];
+    return item;
+}
+ at end
+
 @implementation WebViewFactory
 
 + (void)createSharedFactory;
@@ -74,6 +88,22 @@
     return UI_STRING("Submit", "default label for Submit buttons in forms on web pages");
 }
 
+- (NSMenu *)cellMenuForSearchField
+{
+    NSMenu* cellMenu = [[[NSMenu alloc] initWithTitle:@""] autorelease];
+    [cellMenu addItemWithTitle:UI_STRING("Recent Searches", "label for first item in the menu that appears when clicking on the search field image, used as embedded menu title")
+                        action:NULL tag:NSSearchFieldRecentsTitleMenuItemTag];
+    [cellMenu addItemWithTitle:@"" action:NULL tag:NSSearchFieldRecentsMenuItemTag];
+    NSMenuItem *separator = [NSMenuItem separatorItem];
+    [separator setTag:NSSearchFieldRecentsTitleMenuItemTag];
+    [cellMenu addItem:separator];
+    [cellMenu addItemWithTitle:UI_STRING("Clear Recent Searches", "menu item in Recent Searches menu that empties menu's contents")
+                        action:NULL tag:NSSearchFieldClearRecentsMenuItemTag];
+    [cellMenu addItemWithTitle:UI_STRING("No recent searches", "Label for only item in menu that appears when clicking on the search field image, when no searches have been performed")
+                        action:NULL tag:NSSearchFieldNoRecentsMenuItemTag];
+    return cellMenu;
+}
+
 - (NSString *)defaultLanguageCode
 {
     // FIXME: Need implementation. Defaults gives us a list of languages, but by name, not code.
diff --git a/WebKit/WebView.subproj/WebHTMLView.m b/WebKit/WebView.subproj/WebHTMLView.m
index 9c30b8d..456e0bc 100644
--- a/WebKit/WebView.subproj/WebHTMLView.m
+++ b/WebKit/WebView.subproj/WebHTMLView.m
@@ -197,6 +197,11 @@ static BOOL forceRealHitTest = NO;
         [self setNeedsDisplay:YES];
     }
 
+    NSPoint origin = [[self superview] bounds].origin;
+    if (!NSEqualPoints(_private->lastScrollPosition, origin))
+        [[self _bridge] sendScrollEvent];
+    _private->lastScrollPosition = origin;
+
     SEL selector = @selector(_updateMouseoverWithFakeEvent);
     [NSObject cancelPreviousPerformRequestsWithTarget:self selector:selector object:nil];
     [self performSelector:selector withObject:nil afterDelay:0];
@@ -1183,6 +1188,7 @@ static WebHTMLView *lastHitView = nil;
     if (_private) {
         [self _stopAutoscrollTimer];
         if ([self window]) {
+            _private->lastScrollPosition = [[self superview] bounds].origin;
             [self addWindowObservers];
             [self addSuperviewObservers];
             [self addMouseMovedObserver];
@@ -1190,6 +1196,8 @@ static WebHTMLView *lastHitView = nil;
     
             [[self _pluginController] startAllPlugins];
     
+            _private->lastScrollPosition = NSZeroPoint;
+            
             _private->inWindow = YES;
         } else {
             // Reset when we are moved out of a window after being moved into one.
diff --git a/WebKit/WebView.subproj/WebHTMLViewPrivate.h b/WebKit/WebView.subproj/WebHTMLViewPrivate.h
index ccab175..e41e5b2 100644
--- a/WebKit/WebView.subproj/WebHTMLViewPrivate.h
+++ b/WebKit/WebView.subproj/WebHTMLViewPrivate.h
@@ -35,6 +35,8 @@
     NSSize lastLayoutFrameSize;
     BOOL laidOutAtLeastOnce;
     
+    NSPoint lastScrollPosition;
+
     WebPluginController *pluginController;
     
     NSString *toolTip;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list