• commit-queue@webkit.org's avatar
    Unable to focus on embedded plugins such as Flash via javascript focus() · fefc6dd6
    commit-queue@webkit.org authored
    https://bugs.webkit.org/show_bug.cgi?id=32292
    
    Patch by Dave Michael <dmichael@chromium.org> on 2013-04-03
    Reviewed by Ryosuke Niwa.
    
    Source/WebCore:
    
    Make embed, object, and applet elements support focus() when
    appropriate. Prior to this patch, javascript focus() had no effect on
    embed, object, or applet elements unless tabindex or contenteditable is
    set. With this patch, focus() will focus the element unless the plugin
    content has failed to load (i.e., we are showing either fallback content
    or an unavailable plugin indicator).
    
    Test: plugins/focus.html
          java/focus.html
    
    * html/HTMLPlugInElement.cpp:
    (WebCore::HTMLPlugInElement::supportsFocus):
    Overridden to return true except when the plugin content has failed to load.
    * html/HTMLPlugInElement.h:
    (WebCore::HTMLPlugInElement::useFallbackContent):
    Moved up from HTMLPlugInImageElement.
    (WebCore::HTMLPlugInElement::supportsFocus):
    * html/HTMLPlugInElement.h:
    (WebCore::HTMLPlugInImageElement::useFallbackContent):
    Removed. Now the implementation is inherited from HTMLPlugInElement.
    
    LayoutTests:
    
    Add/update testing to ensure embed, object, and applet tags now support
    focus except when plugin content did not load.
    
    * fast/events/resources/tabindex-focus-blur-all-frame1.html: Change embed and object
        elements to reference an invalid plugin, to be consistent with applet. These
        element types are not focusable when there is valid plugin content.
    * fast/events/resources/tabindex-focus-blur-all-frame2.html: Same as above.
    * fast/events/resources/tabindex-focus-blur-all-iframe1.html: Same as above.
    * fast/events/resources/tabindex-focus-blur-all-iframe2.html: Same as above.
    * java/focus-expected.txt: Added.
    * java/focus.html: Added.
    * plugins/focus-expected.txt: Added.
    * plugins/focus.html: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@147591 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    fefc6dd6