[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

morrita at google.com morrita at google.com
Wed Dec 22 15:46:48 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit c479731147636334a32d56419178570dffd9cf0e
Author: morrita at google.com <morrita at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Nov 12 06:02:02 2010 +0000

    2010-11-11  MORITA Hajime  <morrita at google.com>
    
            Reviewed by Kent Tamura.
    
            editing/selection/context-menu-on-text.html fails on chromium
            https://bugs.webkit.org/show_bug.cgi?id=45898
    
            * platform/chromium/test_expectations.txt: Unskipped context-menu-on-text.html
    2010-11-11  MORITA Hajime  <morrita at google.com>
    
            Reviewed by Kent Tamura.
    
            editing/selection/context-menu-on-text.html fails on chromium
            https://bugs.webkit.org/show_bug.cgi?id=45898
    
            Added makeStringArray(), that is used by DumpRenderTree.
    
            * public/WebBindings.h:
            * src/WebBindings.cpp:
            (WebKit::makeStringArrayImpl): Added.
            (WebKit::WebBindings::makeStringArray): Added.
    2010-11-11  MORITA Hajime  <morrita at google.com>
    
            Reviewed by Kent Tamura.
    
            editing/selection/context-menu-on-text.html fails on chromium
            https://bugs.webkit.org/show_bug.cgi?id=45898
    
            Enhance Chromium's EventSender::contextClick() to return
            array of menu strings. The implementation incomplete because
            Although actual context menu is implemented by the browser,
            it reflects editability of underlying context thus makes
            context-menu-on-text.html passed.
    
            * DumpRenderTree/chromium/EventSender.cpp:
            (makeMenuItemStringsFor): Added.
            (EventSender::contextClick): Now returns array of menu strings.
            * DumpRenderTree/chromium/WebViewHost.cpp:
            (WebViewHost::showContextMenu): Now storing given WebContextMenuData object.
            (WebViewHost::clearContextMenuData): Added.
            (WebViewHost::lastContextMenuData): Added.
            * DumpRenderTree/chromium/WebViewHost.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71886 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 4ff2aae..dbaa356 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,12 @@
+2010-11-11  MORITA Hajime  <morrita at google.com>
+
+        Reviewed by Kent Tamura.
+
+        editing/selection/context-menu-on-text.html fails on chromium
+        https://bugs.webkit.org/show_bug.cgi?id=45898
+
+        * platform/chromium/test_expectations.txt: Unskipped context-menu-on-text.html
+
 2010-11-11  Nate Chapin  <japhet at chromium.org>
 
         Reviewed by Antti Koivisto.
diff --git a/LayoutTests/platform/chromium/test_expectations.txt b/LayoutTests/platform/chromium/test_expectations.txt
index c5bd6d0..cf51c2a 100644
--- a/LayoutTests/platform/chromium/test_expectations.txt
+++ b/LayoutTests/platform/chromium/test_expectations.txt
@@ -696,7 +696,6 @@ BUG38653 MAC : editing/selection/find-yensign-and-backslash.html = TEXT
 BUGWK39105 : editing/spelling/context-menu-suggestions.html = TEXT
 
 BUGWK45438 : editing/spelling/spelling-backspace-between-lines.html = TEXT
-BUGWK45898 : editing/selection/context-menu-on-text.html = TEXT
 
 // Selection is wrong.
 BUG10292 MAC : editing/selection/5354455-1.html = FAIL
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index ad8d79a..456baa8 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,17 @@
+2010-11-11  MORITA Hajime  <morrita at google.com>
+
+        Reviewed by Kent Tamura.
+
+        editing/selection/context-menu-on-text.html fails on chromium
+        https://bugs.webkit.org/show_bug.cgi?id=45898
+
+        Added makeStringArray(), that is used by DumpRenderTree.
+        
+        * public/WebBindings.h:
+        * src/WebBindings.cpp:
+        (WebKit::makeStringArrayImpl): Added.
+        (WebKit::WebBindings::makeStringArray): Added.
+
 2010-11-11  Tony Gentilcore  <tonyg at chromium.org>
 
         Reviewed by Nate Chapin.
diff --git a/WebKit/chromium/public/WebBindings.h b/WebKit/chromium/public/WebBindings.h
index 147ce45..cb33781 100644
--- a/WebKit/chromium/public/WebBindings.h
+++ b/WebKit/chromium/public/WebBindings.h
@@ -32,6 +32,7 @@
 #define WebBindings_h
 
 #include "WebCommon.h"
+#include "WebString.h"
 #include "WebVector.h"
 #include <bindings/npruntime.h>
 
@@ -146,6 +147,7 @@ public:
     WEBKIT_API static bool getElement(NPObject* element, WebElement*);
 
     WEBKIT_API static NPObject* makeIntArray(const WebVector<int>&);
+    WEBKIT_API static NPObject* makeStringArray(const WebVector<WebString>&);
 
     // Exceptions -------------------------------------------------------------
 
diff --git a/WebKit/chromium/src/WebBindings.cpp b/WebKit/chromium/src/WebBindings.cpp
index c25c31b..436bfea 100644
--- a/WebKit/chromium/src/WebBindings.cpp
+++ b/WebKit/chromium/src/WebBindings.cpp
@@ -323,6 +323,17 @@ static NPObject* makeIntArrayImpl(const WebVector<int>& data)
     return npCreateV8ScriptObject(0, result, window);
 }
 
+static NPObject* makeStringArrayImpl(const WebVector<WebString>& data)
+{
+    v8::HandleScope handleScope;
+    v8::Handle<v8::Array> result = v8::Array::New(data.size());
+    for (size_t i = 0; i < data.size(); ++i)
+        result->Set(i, data[i].data() ? v8::String::New(data[i].data()) : v8::String::New(""));
+
+    WebCore::DOMWindow* window = WebCore::V8Proxy::retrieveWindow(WebCore::V8Proxy::currentContext());
+    return npCreateV8ScriptObject(0, result, window);
+}
+
 #endif
 
 bool WebBindings::getDragData(NPObject* event, int* eventId, WebDragData* data)
@@ -371,6 +382,16 @@ NPObject* WebBindings::makeIntArray(const WebVector<int> & data)
 #endif
 }
 
+NPObject* WebBindings::makeStringArray(const WebVector<WebString>& data)
+{
+#if USE(V8)
+    return makeStringArrayImpl(data);
+#else
+    // Not supported on other ports (JSC, etc.).
+    return 0;
+#endif
+}
+
 void WebBindings::pushExceptionHandler(ExceptionHandler handler, void* data)
 {
     WebCore::pushExceptionHandler(handler, data);
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 3593c00..7b173bf 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,25 @@
+2010-11-11  MORITA Hajime  <morrita at google.com>
+
+        Reviewed by Kent Tamura.
+
+        editing/selection/context-menu-on-text.html fails on chromium
+        https://bugs.webkit.org/show_bug.cgi?id=45898
+
+        Enhance Chromium's EventSender::contextClick() to return
+        array of menu strings. The implementation incomplete because
+        Although actual context menu is implemented by the browser,
+        it reflects editability of underlying context thus makes
+        context-menu-on-text.html passed.
+        
+        * DumpRenderTree/chromium/EventSender.cpp:
+        (makeMenuItemStringsFor): Added.
+        (EventSender::contextClick): Now returns array of menu strings.
+        * DumpRenderTree/chromium/WebViewHost.cpp:
+        (WebViewHost::showContextMenu): Now storing given WebContextMenuData object.
+        (WebViewHost::clearContextMenuData): Added.
+        (WebViewHost::lastContextMenuData): Added.
+        * DumpRenderTree/chromium/WebViewHost.h:
+
 2010-11-11  Dirk Pranke  <dpranke at chromium.org>
 
         Unreviewed, build fix.
diff --git a/WebKitTools/DumpRenderTree/chromium/EventSender.cpp b/WebKitTools/DumpRenderTree/chromium/EventSender.cpp
index ec16cf7..5707eea 100644
--- a/WebKitTools/DumpRenderTree/chromium/EventSender.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/EventSender.cpp
@@ -44,6 +44,7 @@
 #include "EventSender.h"
 
 #include "TestShell.h"
+#include "WebContextMenuData.h"
 #include "WebDragData.h"
 #include "WebDragOperation.h"
 #include "WebPoint.h"
@@ -728,16 +729,48 @@ void EventSender::replaySavedEvents()
     replayingSavedEvents = false;
 }
 
-void EventSender::contextClick(const CppArgumentList& arguments, CppVariant* result)
+// Because actual context menu is implemented by the browser side, 
+// this function does only what LayoutTests are expecting:
+// - Many test checks the count of items. So returning non-zero value makes sense.
+// - Some test compares the count before and after some action. So changing the count based on flags
+//   also makes sense. This function is doing such for some flags.
+// - Some test even checks actual string content. So providing it would be also helpful.
+//
+static Vector<WebString> makeMenuItemStringsFor(WebContextMenuData* contextMenu)
 {
-    result->setNull();
+    // These constants are based on Safari's context menu because tests are made for it.
+    static const char* nonEditableMenuStrings[] = { "Back", "Reload Page", "Open in Dashbaord", "<separator>", "View Source", "Save Page As", "Print Page", "Inspect Element", 0 };
+    static const char* editableMenuStrings[] = { "Cut", "Copy", "<separator>", "Paste", "Spelling and Grammar", "Substitutions, Transformations", "Font", "Speech", "Paragraph Direction", "<separator>", 0 };
+
+    // This is possible because mouse events are cancelleable.
+    if (!contextMenu)
+        return Vector<WebString>();
+
+    Vector<WebString> strings;
+
+    if (contextMenu->isEditable) {
+        for (const char** item = editableMenuStrings; *item; ++item) 
+            strings.append(WebString::fromUTF8(*item));
+    } else {
+        for (const char** item = nonEditableMenuStrings; *item; ++item) 
+            strings.append(WebString::fromUTF8(*item));
+    }
 
+    return strings;
+}
+
+
+void EventSender::contextClick(const CppArgumentList& arguments, CppVariant* result)
+{
     webview()->layout();
 
     updateClickCountForButton(WebMouseEvent::ButtonRight);
 
-    // Generate right mouse down and up.
+    // Clears last context menu data because we need to know if the context menu be requested 
+    // after following mouse events.
+    m_shell->webViewHost()->clearContextMenuData();
 
+    // Generate right mouse down and up.
     WebMouseEvent event;
     pressedButton = WebMouseEvent::ButtonRight;
     initMouseEvent(WebInputEvent::MouseDown, WebMouseEvent::ButtonRight, lastMousePos, &event);
@@ -747,6 +780,9 @@ void EventSender::contextClick(const CppArgumentList& arguments, CppVariant* res
     webview()->handleInputEvent(event);
 
     pressedButton = WebMouseEvent::ButtonNone;
+
+    WebContextMenuData* lastContextMenu = m_shell->webViewHost()->lastContextMenuData();
+    result->set(WebBindings::makeStringArray(makeMenuItemStringsFor(lastContextMenu)));
 }
 
 class MouseDownTask: public MethodTask<EventSender> {
diff --git a/WebKitTools/DumpRenderTree/chromium/WebViewHost.cpp b/WebKitTools/DumpRenderTree/chromium/WebViewHost.cpp
index 6c0bd7d..4762469 100644
--- a/WebKitTools/DumpRenderTree/chromium/WebViewHost.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/WebViewHost.cpp
@@ -443,10 +443,20 @@ bool WebViewHost::runModalBeforeUnloadDialog(WebFrame*, const WebString&)
     return true; // Allow window closure.
 }
 
-void WebViewHost::showContextMenu(WebFrame*, const WebContextMenuData&)
+void WebViewHost::showContextMenu(WebFrame*, const WebContextMenuData& contextMenuData)
 {
+    m_lastContextMenuData = adoptPtr(new WebContextMenuData(contextMenuData));
 }
 
+void WebViewHost::clearContextMenuData()
+{
+    m_lastContextMenuData.clear();
+}
+
+WebContextMenuData* WebViewHost::lastContextMenuData() const
+{
+    return m_lastContextMenuData.get();
+}
 
 void WebViewHost::setStatusText(const WebString& text)
 {
diff --git a/WebKitTools/DumpRenderTree/chromium/WebViewHost.h b/WebKitTools/DumpRenderTree/chromium/WebViewHost.h
index f21e663..0e12978 100644
--- a/WebKitTools/DumpRenderTree/chromium/WebViewHost.h
+++ b/WebKitTools/DumpRenderTree/chromium/WebViewHost.h
@@ -90,6 +90,9 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient,
     void addClearHeader(const WTF::String& header) { m_clearHeaders.add(header); }
     const HashSet<WTF::String>& clearHeaders() const { return m_clearHeaders; }
 
+    WebKit::WebContextMenuData* lastContextMenuData() const;
+    void clearContextMenuData();
+
     // NavigationHost
     virtual bool navigate(const TestNavigationEntry&, bool reload);
 
@@ -294,6 +297,8 @@ private:
     WebKit::WebRect m_paintRect;
     bool m_isPainting;
 
+    OwnPtr<WebKit::WebContextMenuData> m_lastContextMenuData;
+
 #if !ENABLE(CLIENT_BASED_GEOLOCATION)
     // Geolocation
     OwnPtr<WebKit::WebGeolocationServiceMock> m_geolocationServiceMock;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list