Skip to content

Commit

Permalink
Fix focus traversal for HTMLPluginElement
Browse files Browse the repository at this point in the history
Fix focus traversal for HTMLPluginElement
https://bugs.webkit.org/show_bug.cgi?id=248138

Reviewed by Ryosuke Niwa.

This patch is to align Webkit behavior with Blink / Chrome and Gecko / Firefox.

Merge - https://chromium.googlesource.com/chromium/src/+/2d8d2b205c31e236b1ff896cc5530402ce858212

It is to remove early return when the widget / plugin is not present.

* Source/WebCore/html/HTMLPlugInElement.cpp:
(HTMLPlugInElement::defaultEventHandler): Fix early return
* LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/chrome-object-tab-focus-bug-expected.txt: Rebaselined
* LayoutTests/platform/mac/imported/w3c/web-platform-tests/html/interaction/focus/chrome-object-tab-focus-bug-expected.txt: Add platform specific expectation

Canonical link: https://commits.webkit.org/256900@main
  • Loading branch information
Ahmad-S792 authored and Ahmad Saleem committed Nov 21, 2022
1 parent 1b082ac commit 0989933
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Expand Up @@ -2,5 +2,5 @@ Pressing TAB twice should focus/highlight end checkbox

start end

FAIL focus advances with tab key thorough object element assert_equals: object got focus expected Element node <object type="text/html" data="data:text/html," width="16... but got Element node <body><p>Pressing TAB twice should focus/highlight end ch...
PASS focus advances with tab key thorough object element

@@ -0,0 +1,6 @@
Pressing TAB twice should focus/highlight end checkbox

start end

FAIL focus advances with tab key thorough object element assert_equals: object got focus expected Element node <object type="text/html" data="data:text/html," width="16... but got Element node <body><p>Pressing TAB twice should focus/highlight end ch...

5 changes: 2 additions & 3 deletions Source/WebCore/html/HTMLPlugInElement.cpp
Expand Up @@ -176,9 +176,8 @@ void HTMLPlugInElement::defaultEventHandler(Event& event)
// Don't keep the widget alive over the defaultEventHandler call, since that can do things like navigate.
{
RefPtr<Widget> widget = downcast<RenderWidget>(*renderer).widget();
if (!widget)
return;
widget->handleEvent(event);
if (widget)
widget->handleEvent(event);
if (event.defaultHandled())
return;
}
Expand Down

0 comments on commit 0989933

Please sign in to comment.