Changeset 56096 in webkit


Ignore:
Timestamp:
Mar 16, 2010 5:31:41 PM (14 years ago)
Author:
jam@chromium.org
Message:

2010-03-16 John Abd-El-Malek <jam@chromium.org>

Reviewed by Darin Fisher.

Give keyboard focus to PluginDocuments by default
https://bugs.webkit.org/show_bug.cgi?id=36147

Test: http/tests/plugins/plugin-document-has-focus.html

  • loader/PluginDocument.cpp: (WebCore::PluginDocument::pluginNode):
  • loader/PluginDocument.h:
  • page/EventHandler.cpp: (WebCore::eventTargetNodeForDocument):

2010-03-16 John Abd-El-Malek <jam@chromium.org>

Reviewed by Darin Fisher.

Give keyboard focus to PluginDocuments by default
https://bugs.webkit.org/show_bug.cgi?id=36147

  • http/tests/plugins/plugin-document-has-focus-expected.txt: Added.
  • http/tests/plugins/plugin-document-has-focus.html: Added.
  • http/tests/plugins/resources/plugin-document-has-focus.pl: Added.
  • platform/gtk/Skipped:
  • platform/mac/Skipped:
  • platform/qt/Skipped:
  • platform/win/Skipped:

2010-03-16 John Abd-El-Malek <jam@chromium.org>

Reviewed by Darin Fisher.

Give keyboard focus to PluginDocuments by default
https://bugs.webkit.org/show_bug.cgi?id=36147

  • DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp: (pluginAllocate):
  • DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h:
  • DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp: (NPP_New): (NPP_SetWindow): (handleEventCarbon): (handleEventCocoa):
Location:
trunk
Files:
3 added
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r56094 r56096  
     12010-03-16  John Abd-El-Malek  <jam@chromium.org>
     2
     3        Reviewed by Darin Fisher.
     4
     5        Give keyboard focus to PluginDocuments by default
     6        https://bugs.webkit.org/show_bug.cgi?id=36147
     7
     8        * http/tests/plugins/plugin-document-has-focus-expected.txt: Added.
     9        * http/tests/plugins/plugin-document-has-focus.html: Added.
     10        * http/tests/plugins/resources/plugin-document-has-focus.pl: Added.
     11        * platform/gtk/Skipped:
     12        * platform/mac/Skipped:
     13        * platform/qt/Skipped:
     14        * platform/win/Skipped:
     15
    1162010-03-16  Chris Fleizach  <cfleizach@apple.com>
    217
  • trunk/LayoutTests/platform/gtk/Skipped

    r56057 r56096  
    35863586plugins/mouse-events-fixedpos.html
    35873587plugins/keyboard-events.html
     3588plugins/plugin-document-has-focus.html
    35883589
    35893590# https://bugs.webkit.org/show_bug.cgi?id=30561
  • trunk/LayoutTests/platform/mac/Skipped

    r56093 r56096  
    145145fast/canvas/webgl/triangle.html
    146146fast/canvas/webgl/viewport-unchanged-upon-resize.html
     147
     148# eventSender needs to propagate the event to the calling window, not the main frame always.
     149plugins/plugin-document-has-focus.html
  • trunk/LayoutTests/platform/qt/Skipped

    r56012 r56096  
    537537plugins/open-and-close-window-with-plugin.html
    538538plugins/keyboard-events.html
     539plugins/plugin-document-has-focus.html
    539540
    540541security/block-test.html
  • trunk/LayoutTests/platform/win/Skipped

    r56025 r56096  
    784784# Needs to implement NPP_HandleEvent() in TestNetscapePlugin
    785785plugins/keyboard-events.html
     786plugins/plugin-document-has-focus.html
    786787
    787788# DumpRenderTree code to enable Java is currently a no-op. Windows doesn't come with Java by default.
  • trunk/WebCore/ChangeLog

    r56094 r56096  
     12010-03-16  John Abd-El-Malek  <jam@chromium.org>
     2
     3        Reviewed by Darin Fisher.
     4
     5        Give keyboard focus to PluginDocuments by default
     6        https://bugs.webkit.org/show_bug.cgi?id=36147
     7
     8        Test: http/tests/plugins/plugin-document-has-focus.html
     9
     10        * loader/PluginDocument.cpp:
     11        (WebCore::PluginDocument::pluginNode):
     12        * loader/PluginDocument.h:
     13        * page/EventHandler.cpp:
     14        (WebCore::eventTargetNodeForDocument):
     15
    1162010-03-16  Chris Fleizach  <cfleizach@apple.com>
    217
  • trunk/WebCore/loader/PluginDocument.cpp

    r55814 r56096  
    169169}
    170170
     171Node* PluginDocument::pluginNode()
     172{
     173    RefPtr<Element> body_element = body();
     174    if (body_element)
     175        return body_element->firstChild();
     176
     177    return 0;
    171178}
     179
     180}
  • trunk/WebCore/loader/PluginDocument.h

    r55814 r56096  
    3030namespace WebCore {
    3131
     32class Node;
    3233class Widget;
    3334class PluginDocument : public HTMLDocument {
     
    3940
    4041    Widget* pluginWidget();
     42    Node* pluginNode();
    4143
    4244private:
  • trunk/WebCore/page/EventHandler.cpp

    r55909 r56096  
    5858#include "PlatformKeyboardEvent.h"
    5959#include "PlatformWheelEvent.h"
     60#include "PluginDocument.h"
    6061#include "RenderFrameSet.h"
    6162#include "RenderTextControlSingleLine.h"
     
    20582059        return 0;
    20592060    Node* node = doc->focusedNode();
     2061    if (!node && doc->isPluginDocument()) {
     2062        PluginDocument* pluginDocument = static_cast<PluginDocument*>(doc);
     2063        node =  pluginDocument->pluginNode();
     2064    }
    20602065    if (!node && doc->isHTMLDocument())
    20612066        node = doc->body();
  • trunk/WebKitTools/ChangeLog

    r56091 r56096  
     12010-03-16  John Abd-El-Malek  <jam@chromium.org>
     2
     3        Reviewed by Darin Fisher.
     4
     5        Give keyboard focus to PluginDocuments by default
     6        https://bugs.webkit.org/show_bug.cgi?id=36147
     7
     8        * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp:
     9        (pluginAllocate):
     10        * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h:
     11        * DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp:
     12        (NPP_New):
     13        (NPP_SetWindow):
     14        (handleEventCarbon):
     15        (handleEventCocoa):
     16
    1172010-03-16  Sam Weinig  <sam@webkit.org>
    218
  • trunk/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp

    r56090 r56096  
    953953    newInstance->testDocumentOpenInDestroyStream = FALSE;
    954954    newInstance->testWindowOpen = FALSE;
     955    newInstance->testKeyboardFocusForPlugins = FALSE;
    955956
    956957    return (NPObject*)newInstance;
  • trunk/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h

    r56086 r56096  
    4242    NPBool testDocumentOpenInDestroyStream;
    4343    NPBool testWindowOpen;
     44    NPBool testKeyboardFocusForPlugins;
    4445    char* onStreamLoad;
    4546    char* onStreamDestroy;
  • trunk/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp

    r56086 r56096  
    112112        else if (strcasecmp(argn[i], "testwindowopen") == 0)
    113113            obj->testWindowOpen = TRUE;
     114        else if (strcasecmp(argn[i], "src") == 0 && strstr(argv[i], "plugin-document-has-focus.pl"))
     115            obj->testKeyboardFocusForPlugins = TRUE;
    114116    }
    115117       
     
    179181        if (obj->logSetWindow) {
    180182            pluginLog(instance, "NPP_SetWindow: %d %d", (int)window->width, (int)window->height);
    181             obj->logSetWindow = false;
     183            obj->logSetWindow = FALSE;
    182184        }
    183185
     
    186188            obj->testWindowOpen = FALSE;
    187189        }
     190
     191        if (obj->testKeyboardFocusForPlugins) {
     192            obj->eventLogging = true;
     193            executeScript(obj, "eventSender.keyDown('A');");
     194        }
    188195    }
    189196   
     
    278285        case keyUp:
    279286            pluginLog(instance, "keyUp '%c'", (char)(event->message & 0xFF));
     287            if (obj->testKeyboardFocusForPlugins) {
     288                obj->eventLogging = false;
     289                obj->testKeyboardFocusForPlugins = FALSE;
     290                executeScript(obj, "layoutTestController.notifyDone();");
     291            }
    280292            break;
    281293        case autoKey:
     
    346358
    347359        case NPCocoaEventKeyUp:
    348             if (event->data.key.characters)
     360            if (event->data.key.characters) {
    349361                pluginLog(instance, "keyUp '%c'", CFStringGetCharacterAtIndex(reinterpret_cast<CFStringRef>(event->data.key.characters), 0));
     362                if (obj->testKeyboardFocusForPlugins) {
     363                    obj->eventLogging = false;
     364                    obj->testKeyboardFocusForPlugins = FALSE;
     365                    executeScript(obj, "layoutTestController.notifyDone();");
     366                }
     367            }
    350368            return 1;
    351369
Note: See TracChangeset for help on using the changeset viewer.