Title: [106876] trunk
Revision
106876
Author
[email protected]
Date
2012-02-06 16:52:02 -0800 (Mon, 06 Feb 2012)

Log Message

REGRESSION (r104303): Clicking inline video controls gives the video a focus ring
https://bugs.webkit.org/show_bug.cgi?id=77288

Reviewed by Darin Adler.

Source/WebCore:

Test: media/video-mouse-focus.html

Do not allow media elements to be focused by mouse click by overriding isMouseFocusable
and returning false.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::isMouseFocusable):
* html/HTMLMediaElement.h:

LayoutTests:

* media/video-mouse-focus-expected.txt: Added.
* media/video-mouse-focus.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (106875 => 106876)


--- trunk/LayoutTests/ChangeLog	2012-02-07 00:43:26 UTC (rev 106875)
+++ trunk/LayoutTests/ChangeLog	2012-02-07 00:52:02 UTC (rev 106876)
@@ -1,3 +1,13 @@
+2012-02-03  Jer Noble  <[email protected]>
+
+        REGRESSION (r104303): Clicking inline video controls gives the video a focus ring
+        https://bugs.webkit.org/show_bug.cgi?id=77288
+
+        Reviewed by Darin Adler.
+
+        * media/video-mouse-focus-expected.txt: Added.
+        * media/video-mouse-focus.html: Added.
+
 2012-02-06  Ehsan Akhgari  <[email protected]>
 
         WebGL conformance test misc/functions-returning-strings.html fails

Added: trunk/LayoutTests/media/video-mouse-focus-expected.txt (0 => 106876)


--- trunk/LayoutTests/media/video-mouse-focus-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/video-mouse-focus-expected.txt	2012-02-07 00:52:02 UTC (rev 106876)
@@ -0,0 +1,5 @@
+This tests that a mouse click event will not cause a media element to gain focus.
+
+EXPECTED (document.activeElement.id != 'video') OK
+END OF TEST
+

Added: trunk/LayoutTests/media/video-mouse-focus.html (0 => 106876)


--- trunk/LayoutTests/media/video-mouse-focus.html	                        (rev 0)
+++ trunk/LayoutTests/media/video-mouse-focus.html	2012-02-07 00:52:02 UTC (rev 106876)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src=""
+        <script>
+            var startTest = function() {
+                if (!window.eventSender) {
+                    logResult(false, "This test requires window.eventSender.");
+                    return;
+                }
+
+                findMediaElement();
+                var rect = video.getBoundingClientRect();
+                var x = rect.left + rect.width / 2;
+                var y = rect.top + rect.height / 2;
+
+                eventSender.mouseMoveTo(x, y);
+                eventSender.mouseDown();
+                eventSender.mouseUp();
+
+                testExpected("document.activeElement.id", "video", "!=");
+                endTest();
+            };
+        </script>
+    </head>
+    <body _onload_="startTest();">
+        <p>This tests that a mouse click event will not cause a media element to gain focus.</p>
+        <video id="video" controls></video>
+    </body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (106875 => 106876)


--- trunk/Source/WebCore/ChangeLog	2012-02-07 00:43:26 UTC (rev 106875)
+++ trunk/Source/WebCore/ChangeLog	2012-02-07 00:52:02 UTC (rev 106876)
@@ -1,3 +1,19 @@
+2012-02-03  Jer Noble  <[email protected]>
+
+        REGRESSION (r104303): Clicking inline video controls gives the video a focus ring
+        https://bugs.webkit.org/show_bug.cgi?id=77288
+
+        Reviewed by Darin Adler.
+
+        Test: media/video-mouse-focus.html
+
+        Do not allow media elements to be focused by mouse click by overriding isMouseFocusable
+        and returning false.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::isMouseFocusable):
+        * html/HTMLMediaElement.h:
+
 2012-02-06  Anders Carlsson  <[email protected]>
 
         Overlay scrollbars flash when window is simply activated

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (106875 => 106876)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2012-02-07 00:43:26 UTC (rev 106875)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2012-02-07 00:52:02 UTC (rev 106876)
@@ -315,6 +315,11 @@
     return controls() ||  HTMLElement::supportsFocus();
 }
 
+bool HTMLMediaElement::isMouseFocusable() const
+{
+    return false;
+}
+
 void HTMLMediaElement::attributeChanged(Attribute* attr)
 {
     HTMLElement::attributeChanged(attr);

Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (106875 => 106876)


--- trunk/Source/WebCore/html/HTMLMediaElement.h	2012-02-07 00:43:26 UTC (rev 106875)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h	2012-02-07 00:52:02 UTC (rev 106876)
@@ -336,6 +336,7 @@
     void createMediaPlayer();
 
     virtual bool supportsFocus() const;
+    virtual bool isMouseFocusable() const;
     virtual void attributeChanged(Attribute*) OVERRIDE;
     virtual bool rendererIsNeeded(const NodeRenderingContext&);
     virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to