Title: [88555] trunk
Revision
88555
Author
[email protected]
Date
2011-06-10 12:43:23 -0700 (Fri, 10 Jun 2011)

Log Message

2011-06-10  Rob Buis  <[email protected]>

        Reviewed by Nikolas Zimmermann.

        animation event handling broken: focusin
        https://bugs.webkit.org/show_bug.cgi?id=12894

        focusin, focusout, activate not implemented in SVG
        https://bugs.webkit.org/show_bug.cgi?id=40545

        Test whether focusin and focusout events are dispatched and seen in the focusin/focusout event handlers.

        * platform/mac/svg/custom/focus-ring-expected.txt:
        * svg/custom/focus-event-handling-expected.txt: Added.
        * svg/custom/focus-event-handling-keyboard-expected.txt: Added.
        * svg/custom/focus-event-handling-keyboard.xhtml: Added.
        * svg/custom/focus-event-handling.xhtml: Added.
        * svg/custom/resources/focus-event-handling-keyboard.js: Added.
        (focusinHandler):
        (focusoutHandler):
        * svg/custom/resources/focus-event-handling.js: Added.
        (clearFocusSeen):
        ():
        (focusoutHandler):
        (clickAt):
2011-06-10  Rob Buis  <[email protected]>

        Reviewed by Nikolas Zimmermann.

        amation event handling broken: focusin
        https://bugs.webkit.org/show_bug.cgi?id=12894

        focusin, focusout, activate not implemented in SVG
        https://bugs.webkit.org/show_bug.cgi?id=40545

        Make elements that should support GraphicalEventAttribute handle focussing, since focusin, focusout is part of that:

        http://www.w3.org/TR/SVG11/intro.html#TermGraphicalEventAttribute

        Match Opera behaviour ; elements that support GraphicalEventAttribute can receive visual mouse focus when having either a focusin or focusout event handler. Elements that support GraphicalEventAttribute can receive visual keyboard focus when having either a focusin or focusout event handler. Keyboard focus does not advance to SVG elements that are not focusable at the time.

        Tests: svg/custom/focus-event-handling-keyboard.xhtml
               svg/custom/focus-event-handling.xhtml

        * rendering/svg/SVGRenderSupport.cpp:
        (WebCore::SVGRenderSupport::computeRectForRepaint):
        * svg/SVGCircleElement.h:
        (WebCore::SVGCircleElement::supportsFocus):
        * svg/SVGEllipseElement.h:
        (WebCore::SVGEllipseElement::supportsFocus):
        * svg/SVGGElement.h:
        (WebCore::SVGGElement::supportsFocus):
        * svg/SVGImageElement.h:
        (WebCore::SVGImageElement::supportsFocus):
        * svg/SVGLineElement.h:
        (WebCore::SVGLineElement::supportsFocus):
        * svg/SVGPathElement.h:
        (WebCore::SVGPathElement::supportsFocus):
        * svg/SVGPolyElement.h:
        (WebCore::SVGPolyElement::supportsFocus):
        * svg/SVGRectElement.h:
        (WebCore::SVGRectElement::supportsFocus):
        * svg/SVGSVGElement.h:
        (WebCore::SVGSVGElement::supportsFocus):
        * svg/SVGStyledElement.cpp:
        (WebCore::SVGStyledElement::isMouseFocusable):
        (WebCore::SVGStyledElement::isKeyboardFocusable):
        * svg/SVGStyledElement.h:
        * svg/SVGSwitchElement.h:
        (WebCore::SVGSwitchElement::supportsFocus):
        * svg/SVGSymbolElement.h:
        (WebCore::SVGSymbolElement::supportsFocus):
        * svg/SVGTextElement.h:
        (WebCore::SVGTextElement::supportsFocus):
        * svg/SVGUseElement.h:
        (WebCore::SVGUseElement::supportsFocus):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (88554 => 88555)


--- trunk/LayoutTests/ChangeLog	2011-06-10 18:35:46 UTC (rev 88554)
+++ trunk/LayoutTests/ChangeLog	2011-06-10 19:43:23 UTC (rev 88555)
@@ -1,3 +1,29 @@
+2011-06-10  Rob Buis  <[email protected]>
+
+        Reviewed by Nikolas Zimmermann.
+
+        animation event handling broken: focusin
+        https://bugs.webkit.org/show_bug.cgi?id=12894
+
+        focusin, focusout, activate not implemented in SVG
+        https://bugs.webkit.org/show_bug.cgi?id=40545
+
+        Test whether focusin and focusout events are dispatched and seen in the focusin/focusout event handlers.
+
+        * platform/mac/svg/custom/focus-ring-expected.txt:
+        * svg/custom/focus-event-handling-expected.txt: Added.
+        * svg/custom/focus-event-handling-keyboard-expected.txt: Added.
+        * svg/custom/focus-event-handling-keyboard.xhtml: Added.
+        * svg/custom/focus-event-handling.xhtml: Added.
+        * svg/custom/resources/focus-event-handling-keyboard.js: Added.
+        (focusinHandler):
+        (focusoutHandler):
+        * svg/custom/resources/focus-event-handling.js: Added.
+        (clearFocusSeen):
+        ():
+        (focusoutHandler):
+        (clickAt):
+
 2011-06-10  Abhishek Arya  <[email protected]>
 
         Reviewed by Tony Gentilcore.

Modified: trunk/LayoutTests/platform/mac/svg/custom/focus-ring-expected.txt (88554 => 88555)


--- trunk/LayoutTests/platform/mac/svg/custom/focus-ring-expected.txt	2011-06-10 18:35:46 UTC (rev 88554)
+++ trunk/LayoutTests/platform/mac/svg/custom/focus-ring-expected.txt	2011-06-10 19:43:23 UTC (rev 88555)
@@ -2,31 +2,31 @@
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600
   RenderSVGRoot {svg} at (10,10) size 437x527
-    RenderSVGPath {circle} at (15,10) size 100x100 [fill={[type=SOLID] [color=#FFA500]}] [cx=65.00] [cy=60.00] [r=50.00]
-    RenderSVGPath {path} at (140,10) size 100x100 [fill={[type=SOLID] [color=#FFA500]}] [data="" 140 10 L 190 110 L 240 60 L 220 60 L 200 30 Z"]
-    RenderSVGContainer {g} at (270,10) size 100x100
-      RenderSVGPath {rect} at (270,10) size 100x100 [fill={[type=SOLID] [color=#FFA500]}] [x=270.00] [y=10.00] [width=100.00] [height=100.00]
+    RenderSVGPath {circle} at (10,5) size 110x110 [fill={[type=SOLID] [color=#FFA500]}] [cx=65.00] [cy=60.00] [r=50.00]
+    RenderSVGPath {path} at (135,5) size 110x110 [fill={[type=SOLID] [color=#FFA500]}] [data="" 140 10 L 190 110 L 240 60 L 220 60 L 200 30 Z"]
+    RenderSVGContainer {g} at (265,5) size 110x110
+      RenderSVGPath {rect} at (265,5) size 110x110 [fill={[type=SOLID] [color=#FFA500]}] [x=270.00] [y=10.00] [width=100.00] [height=100.00]
     RenderSVGContainer {g} at (10,140) size 137x137 [transform={m=((0.87,0.50)(-0.50,0.87)) t=(60.00,140.00)}]
-      RenderSVGPath {rect} at (10,140) size 137x137 [fill={[type=SOLID] [color=#FFA500]}] [x=0.00] [y=0.00] [width=100.00] [height=100.00]
-    RenderSVGPath {rect} at (150,140) size 137x137 [transform={m=((0.87,0.50)(-0.50,0.87)) t=(200.00,140.00)}] [fill={[type=SOLID] [color=#FFA500]}] [x=0.00] [y=0.00] [width=100.00] [height=100.00]
-    RenderSVGContainer {g} at (310,140) size 137x137
-      RenderSVGPath {rect} at (310,140) size 137x137 [transform={m=((0.87,0.50)(-0.50,0.87)) t=(360.00,140.00)}] [fill={[type=SOLID] [color=#FFA500]}] [x=0.00] [y=0.00] [width=100.00] [height=100.00]
+      RenderSVGPath {rect} at (3,133) size 151x151 [fill={[type=SOLID] [color=#FFA500]}] [x=0.00] [y=0.00] [width=100.00] [height=100.00]
+    RenderSVGPath {rect} at (143,133) size 151x151 [transform={m=((0.87,0.50)(-0.50,0.87)) t=(200.00,140.00)}] [fill={[type=SOLID] [color=#FFA500]}] [x=0.00] [y=0.00] [width=100.00] [height=100.00]
+    RenderSVGContainer {g} at (305,135) size 147x147
+      RenderSVGPath {rect} at (305,135) size 147x147 [transform={m=((0.87,0.50)(-0.50,0.87)) t=(360.00,140.00)}] [fill={[type=SOLID] [color=#FFA500]}] [x=0.00] [y=0.00] [width=100.00] [height=100.00]
     RenderSVGText {text} at (10,306) size 76x18 contains 1 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 76x18
         chunk 1 text run 1 at (10.00,320.00) startOffset 0 endOffset 12 width 76.00: "focused text"
     RenderSVGText {text} at (0,-14) size 76x18 contains 1 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 76x18
         chunk 1 text run 1 at (0.00,0.00) startOffset 0 endOffset 12 width 76.00: "focused text"
-    RenderSVGContainer {g} at (198,307) size 75x55
+    RenderSVGContainer {g} at (193,302) size 85x65
       RenderSVGText {text} at (0,-14) size 76x18 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 76x18
           chunk 1 text run 1 at (0.00,0.00) startOffset 0 endOffset 12 width 76.00: "focused text"
     RenderSVGResourceClipper {clipPath} [id="clip"] [clipPathUnits=userSpaceOnUse]
       RenderSVGPath {rect} at (0,0) size 100x100 [fill={[type=SOLID] [color=#000000]}] [x=0.00] [y=0.00] [width=100.00] [height=100.00]
-    RenderSVGImage {image} at (0,0) size 0x0
+    RenderSVGImage {image} at (0,0) size 5x5
       [clipPath="clip"] RenderSVGResourceClipper {clipPath} at (0,0) size 100x100
-    RenderSVGImage {image} at (150,400) size 137x137 [transform={m=((0.87,0.50)(-0.50,0.87)) t=(200.00,400.00)}]
+    RenderSVGImage {image} at (143,393) size 151x151 [transform={m=((0.87,0.50)(-0.50,0.87)) t=(200.00,400.00)}]
       [clipPath="clip"] RenderSVGResourceClipper {clipPath} at (0,0) size 100x100
-    RenderSVGContainer {g} at (310,400) size 137x137 [transform={m=((0.87,0.50)(-0.50,0.87)) t=(360.00,400.00)}]
-      RenderSVGImage {image} at (310,400) size 137x137
+    RenderSVGContainer {g} at (303,393) size 151x151 [transform={m=((0.87,0.50)(-0.50,0.87)) t=(360.00,400.00)}]
+      RenderSVGImage {image} at (303,393) size 151x151
         [clipPath="clip"] RenderSVGResourceClipper {clipPath} at (0,0) size 100x100

Added: trunk/LayoutTests/svg/custom/focus-event-handling-expected.txt (0 => 88555)


--- trunk/LayoutTests/svg/custom/focus-event-handling-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/focus-event-handling-expected.txt	2011-06-10 19:43:23 UTC (rev 88555)
@@ -0,0 +1,19 @@
+TEST
+Test whether focusin and focusout events are dispatched and seen in the focusin/focusout event handlers:
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS focusinSeen is "rect1"
+PASS focusoutSeen is "rect1"
+PASS focusinSeen is "g"
+PASS focusoutSeen is "g"
+PASS focusinSeen is "use"
+PASS focusoutSeen is "use"
+PASS focusinSeen is "usesymbol"
+PASS focusoutSeen is "usesymbol"
+PASS focusinSeen is "switch"
+PASS focusoutSeen is "switch"
+PASS focusinSeen is "img"
+PASS focusoutSeen is "img"
+

Added: trunk/LayoutTests/svg/custom/focus-event-handling-keyboard-expected.txt (0 => 88555)


--- trunk/LayoutTests/svg/custom/focus-event-handling-keyboard-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/focus-event-handling-keyboard-expected.txt	2011-06-10 19:43:23 UTC (rev 88555)
@@ -0,0 +1,19 @@
+TEST
+Test whether focusin and focusout events are dispatched and seen in the focusin/focusout event handlers when using keyboard:
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS focusinSeen is "rect1"
+PASS focusinSeen is "g"
+PASS focusoutSeen is "rect1"
+PASS focusinSeen is "use"
+PASS focusoutSeen is "g"
+PASS focusinSeen is "usesymbol"
+PASS focusoutSeen is "use"
+PASS focusinSeen is "switch"
+PASS focusoutSeen is "usesymbol"
+PASS focusinSeen is "img"
+PASS focusoutSeen is "switch"
+PASS focusoutSeen is "img"
+

Added: trunk/LayoutTests/svg/custom/focus-event-handling-keyboard.xhtml (0 => 88555)


--- trunk/LayoutTests/svg/custom/focus-event-handling-keyboard.xhtml	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/focus-event-handling-keyboard.xhtml	2011-06-10 19:43:23 UTC (rev 88555)
@@ -0,0 +1,33 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+</head>
+<body>
+
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="400" height="300">
+  <rect id="rect1" width="100" height="100" fill="green"/>
+  <g id="g">
+    <rect id="rect2" x="100" y="0" width="100" height="100" fill="green"/>
+  </g>
+  <defs>
+    <rect id="rect3" width="100" height="100" fill="green"/>
+    <symbol id="symbol">
+      <rect id="rect4" width="100" height="100" fill="green"/>
+    </symbol>
+  </defs>
+  <use id="use" x="200" xlink:href=""
+  <use id="usesymbol" x="300" xlink:href=""
+  <switch id="switch">
+    <rect id="rect5" y="100" width="100" height="100" fill="green"/>
+  </switch>
+  <image xlink:href="" x="100" y="100" height="100" width="100" id="img"/>
+  <text id="txt" x="220" y="150">TEST</text>
+</svg>
+
+
+<p id="description"></p>
+<div id="console"></div>
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/svg/custom/focus-event-handling.xhtml (0 => 88555)


--- trunk/LayoutTests/svg/custom/focus-event-handling.xhtml	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/focus-event-handling.xhtml	2011-06-10 19:43:23 UTC (rev 88555)
@@ -0,0 +1,32 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+</head>
+<body>
+
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="400" height="300">
+  <rect id="rect1" width="100" height="100" fill="green"/>
+  <g id="g">
+    <rect id="rect2" x="100" y="0" width="100" height="100" fill="green"/>
+  </g>
+  <defs>
+    <rect id="rect3" width="100" height="100" fill="green"/>
+    <symbol id="symbol">
+      <rect id="rect4" width="100" height="100" fill="green"/>
+    </symbol>
+  </defs>
+  <use id="use" x="200" xlink:href=""
+  <use id="usesymbol" x="300" xlink:href=""
+  <switch id="switch">
+    <rect id="rect5" y="100" width="100" height="100" fill="green"/>
+  </switch>
+  <image xlink:href="" x="100" y="100" height="100" width="100" id="img"/>
+  <text id="txt" x="220" y="150">TEST</text>
+</svg>
+
+<p id="description"></p>
+<div id="console"></div>
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/svg/custom/resources/focus-event-handling-keyboard.js (0 => 88555)


--- trunk/LayoutTests/svg/custom/resources/focus-event-handling-keyboard.js	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/resources/focus-event-handling-keyboard.js	2011-06-10 19:43:23 UTC (rev 88555)
@@ -0,0 +1,66 @@
+var focusinSeen = "";
+var focusoutSeen = "";
+
+var rectElement = document.getElementById("rect1");
+var gElement = document.getElementById("g");
+var useElement = document.getElementById("use");
+var useElement2 = document.getElementById("usesymbol");
+var switchElement = document.getElementById("switch");
+var imgElement = document.getElementById("img");
+description("Test whether focusin and focusout events are dispatched and seen in the focusin/focusout event handlers when using keyboard: ");
+
+if (window.layoutTestController)
+    layoutTestController.waitUntilDone();
+
+function focusinHandler(evt)
+{
+    focusinSeen = evt.target.getAttribute('id');
+}
+
+function focusoutHandler(evt)
+{
+    focusoutSeen = evt.target.getAttribute('id');
+}
+
+rectElement.setAttribute("onfocusin", "focusinHandler(evt)");
+rectElement.setAttribute("onfocusout", "focusoutHandler(evt)");
+gElement.setAttribute("onfocusin", "focusinHandler(evt)");
+gElement.setAttribute("onfocusout", "focusoutHandler(evt)");
+useElement.setAttribute("onfocusin", "focusinHandler(evt)");
+useElement.setAttribute("onfocusout", "focusoutHandler(evt)");
+useElement2.setAttribute("onfocusin", "focusinHandler(evt)");
+useElement2.setAttribute("onfocusout", "focusoutHandler(evt)");
+switchElement.setAttribute("onfocusin", "focusinHandler(evt)");
+switchElement.setAttribute("onfocusout", "focusoutHandler(evt)");
+imgElement.setAttribute("onfocusin", "focusinHandler(evt)");
+imgElement.setAttribute("onfocusout", "focusoutHandler(evt)");
+
+if (window.eventSender) {
+
+    // cause focusin and focusout
+    eventSender.keyDown('\t');
+    shouldBeEqualToString('focusinSeen', 'rect1');
+    eventSender.keyDown('\t');
+    shouldBeEqualToString('focusinSeen', 'g');
+    shouldBeEqualToString('focusoutSeen', 'rect1');
+    eventSender.keyDown('\t');
+    shouldBeEqualToString('focusinSeen', 'use');
+    shouldBeEqualToString('focusoutSeen', 'g');
+    eventSender.keyDown('\t');
+    shouldBeEqualToString('focusinSeen', 'usesymbol');
+    shouldBeEqualToString('focusoutSeen', 'use');
+    eventSender.keyDown('\t');
+    shouldBeEqualToString('focusinSeen', 'switch');
+    shouldBeEqualToString('focusoutSeen', 'usesymbol');
+    eventSender.keyDown('\t');
+    shouldBeEqualToString('focusinSeen', 'img');
+    shouldBeEqualToString('focusoutSeen', 'switch');
+    eventSender.keyDown('\t');
+    shouldBeEqualToString('focusoutSeen', 'img');
+
+    successfullyParsed = true;
+
+    if (window.layoutTestController)
+        layoutTestController.notifyDone();
+} else
+    alert("This test must be run via DRT!");

Added: trunk/LayoutTests/svg/custom/resources/focus-event-handling.js (0 => 88555)


--- trunk/LayoutTests/svg/custom/resources/focus-event-handling.js	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/resources/focus-event-handling.js	2011-06-10 19:43:23 UTC (rev 88555)
@@ -0,0 +1,105 @@
+var focusinSeen = "";
+var focusoutSeen = "";
+
+var rectElement = document.getElementById("rect1");
+var gElement = document.getElementById("g");
+var useElement = document.getElementById("use");
+var useElement2 = document.getElementById("usesymbol");
+var switchElement = document.getElementById("switch");
+var imgElement = document.getElementById("img");
+description("Test whether focusin and focusout events are dispatched and seen in the focusin/focusout event handlers: ");
+
+if (window.layoutTestController)
+    layoutTestController.waitUntilDone();
+
+function clearFocusSeen(evt)
+{
+    focusinSeen = "";
+    focusoutSeen = "";
+}
+
+function focusinHandler(evt)
+{
+    focusinSeen = evt.target.getAttribute('id');
+}
+
+function focusoutHandler(evt)
+{
+    focusoutSeen = evt.target.getAttribute('id');
+}
+
+rectElement.setAttribute("onfocusin", "focusinHandler(evt)");
+rectElement.setAttribute("onfocusout", "focusoutHandler(evt)");
+gElement.setAttribute("onfocusin", "focusinHandler(evt)");
+gElement.setAttribute("onfocusout", "focusoutHandler(evt)");
+useElement.setAttribute("onfocusin", "focusinHandler(evt)");
+useElement.setAttribute("onfocusout", "focusoutHandler(evt)");
+useElement2.setAttribute("onfocusin", "focusinHandler(evt)");
+useElement2.setAttribute("onfocusout", "focusoutHandler(evt)");
+switchElement.setAttribute("onfocusin", "focusinHandler(evt)");
+switchElement.setAttribute("onfocusout", "focusoutHandler(evt)");
+imgElement.setAttribute("onfocusin", "focusinHandler(evt)");
+imgElement.setAttribute("onfocusout", "focusoutHandler(evt)");
+
+function clickAt(x, y)
+{
+    eventSender.mouseMoveTo(x, y);
+    eventSender.mouseDown();
+    eventSender.mouseUp();
+}
+
+if (window.eventSender) {
+
+    // cause focusin and focusout
+    clickAt(50, 50);
+    clickAt(150, 250);
+    shouldBeEqualToString('focusinSeen', 'rect1');
+    shouldBeEqualToString('focusoutSeen', 'rect1');
+
+    clearFocusSeen();
+
+    // cause focusin and focusout
+    clickAt(150, 50);
+    clickAt(150, 250);
+    shouldBeEqualToString('focusinSeen', 'g');
+    shouldBeEqualToString('focusoutSeen', 'g');
+
+    clearFocusSeen();
+
+    // cause focusin and focusout
+    clickAt(250, 50);
+    clickAt(250, 250);
+    shouldBeEqualToString('focusinSeen', 'use');
+    shouldBeEqualToString('focusoutSeen', 'use');
+
+    clearFocusSeen();
+
+    // cause focusin and focusout
+    clickAt(350, 50);
+    clickAt(350, 250);
+    shouldBeEqualToString('focusinSeen', 'usesymbol');
+    shouldBeEqualToString('focusoutSeen', 'usesymbol');
+
+    clearFocusSeen();
+
+    // cause focusin and focusout
+    clickAt(50, 150);
+    clickAt(50, 250);
+    shouldBeEqualToString('focusinSeen', 'switch');
+    shouldBeEqualToString('focusoutSeen', 'switch');
+
+    clearFocusSeen();
+
+    // cause focusin and focusout
+    clickAt(150, 150);
+    clickAt(150, 250);
+    shouldBeEqualToString('focusinSeen', 'img');
+    shouldBeEqualToString('focusoutSeen', 'img');
+
+    successfullyParsed = true;
+    successfullyParsed = true;
+
+    if (window.layoutTestController)
+        layoutTestController.notifyDone();
+} else
+    alert("This test must be run via DRT!");

Modified: trunk/Source/WebCore/ChangeLog (88554 => 88555)


--- trunk/Source/WebCore/ChangeLog	2011-06-10 18:35:46 UTC (rev 88554)
+++ trunk/Source/WebCore/ChangeLog	2011-06-10 19:43:23 UTC (rev 88555)
@@ -1,3 +1,55 @@
+2011-06-10  Rob Buis  <[email protected]>
+
+        Reviewed by Nikolas Zimmermann.
+
+        amation event handling broken: focusin
+        https://bugs.webkit.org/show_bug.cgi?id=12894
+
+        focusin, focusout, activate not implemented in SVG
+        https://bugs.webkit.org/show_bug.cgi?id=40545
+
+        Make elements that should support GraphicalEventAttribute handle focussing, since focusin, focusout is part of that:
+
+        http://www.w3.org/TR/SVG11/intro.html#TermGraphicalEventAttribute
+
+        Match Opera behaviour ; elements that support GraphicalEventAttribute can receive visual mouse focus when having either a focusin or focusout event handler. Elements that support GraphicalEventAttribute can receive visual keyboard focus when having either a focusin or focusout event handler. Keyboard focus does not advance to SVG elements that are not focusable at the time.
+
+        Tests: svg/custom/focus-event-handling-keyboard.xhtml
+               svg/custom/focus-event-handling.xhtml
+
+        * rendering/svg/SVGRenderSupport.cpp:
+        (WebCore::SVGRenderSupport::computeRectForRepaint):
+        * svg/SVGCircleElement.h:
+        (WebCore::SVGCircleElement::supportsFocus):
+        * svg/SVGEllipseElement.h:
+        (WebCore::SVGEllipseElement::supportsFocus):
+        * svg/SVGGElement.h:
+        (WebCore::SVGGElement::supportsFocus):
+        * svg/SVGImageElement.h:
+        (WebCore::SVGImageElement::supportsFocus):
+        * svg/SVGLineElement.h:
+        (WebCore::SVGLineElement::supportsFocus):
+        * svg/SVGPathElement.h:
+        (WebCore::SVGPathElement::supportsFocus):
+        * svg/SVGPolyElement.h:
+        (WebCore::SVGPolyElement::supportsFocus):
+        * svg/SVGRectElement.h:
+        (WebCore::SVGRectElement::supportsFocus):
+        * svg/SVGSVGElement.h:
+        (WebCore::SVGSVGElement::supportsFocus):
+        * svg/SVGStyledElement.cpp:
+        (WebCore::SVGStyledElement::isMouseFocusable):
+        (WebCore::SVGStyledElement::isKeyboardFocusable):
+        * svg/SVGStyledElement.h:
+        * svg/SVGSwitchElement.h:
+        (WebCore::SVGSwitchElement::supportsFocus):
+        * svg/SVGSymbolElement.h:
+        (WebCore::SVGSymbolElement::supportsFocus):
+        * svg/SVGTextElement.h:
+        (WebCore::SVGTextElement::supportsFocus):
+        * svg/SVGUseElement.h:
+        (WebCore::SVGUseElement::supportsFocus):
+
 2011-06-10  Luke Macpherson   <[email protected]>
 
         Reviewed by Eric Seidel.

Modified: trunk/Source/WebCore/rendering/svg/SVGRenderSupport.cpp (88554 => 88555)


--- trunk/Source/WebCore/rendering/svg/SVGRenderSupport.cpp	2011-06-10 18:35:46 UTC (rev 88554)
+++ trunk/Source/WebCore/rendering/svg/SVGRenderSupport.cpp	2011-06-10 19:43:23 UTC (rev 88555)
@@ -63,6 +63,7 @@
     const SVGRenderStyle* svgStyle = object->style()->svgStyle();
     if (const ShadowData* shadow = svgStyle->shadow())
         shadow->adjustRectForShadow(repaintRect);
+    repaintRect.inflate(object->style()->outlineWidth());
 
     // Translate to coords in our parent renderer, and then call computeRectForRepaint on our parent
     repaintRect = object->localToParentTransform().mapRect(repaintRect);

Modified: trunk/Source/WebCore/svg/SVGCircleElement.h (88554 => 88555)


--- trunk/Source/WebCore/svg/SVGCircleElement.h	2011-06-10 18:35:46 UTC (rev 88554)
+++ trunk/Source/WebCore/svg/SVGCircleElement.h	2011-06-10 19:43:23 UTC (rev 88555)
@@ -42,6 +42,7 @@
     SVGCircleElement(const QualifiedName&, Document*);
 
     virtual bool isValid() const { return SVGTests::isValid(); }
+    virtual bool supportsFocus() const { return true; }
 
     bool isSupportedAttribute(const QualifiedName&);
     virtual void parseMappedAttribute(Attribute*);

Modified: trunk/Source/WebCore/svg/SVGEllipseElement.h (88554 => 88555)


--- trunk/Source/WebCore/svg/SVGEllipseElement.h	2011-06-10 18:35:46 UTC (rev 88554)
+++ trunk/Source/WebCore/svg/SVGEllipseElement.h	2011-06-10 19:43:23 UTC (rev 88555)
@@ -42,6 +42,7 @@
     SVGEllipseElement(const QualifiedName&, Document*);
     
     virtual bool isValid() const { return SVGTests::isValid(); }
+    virtual bool supportsFocus() const { return true; }
 
     bool isSupportedAttribute(const QualifiedName&);
     virtual void parseMappedAttribute(Attribute*);

Modified: trunk/Source/WebCore/svg/SVGGElement.h (88554 => 88555)


--- trunk/Source/WebCore/svg/SVGGElement.h	2011-06-10 18:35:46 UTC (rev 88554)
+++ trunk/Source/WebCore/svg/SVGGElement.h	2011-06-10 19:43:23 UTC (rev 88555)
@@ -46,6 +46,7 @@
 
 private:
     virtual bool isValid() const { return SVGTests::isValid(); }
+    virtual bool supportsFocus() const { return true; }
 
     bool isSupportedAttribute(const QualifiedName&);
     virtual void parseMappedAttribute(Attribute*);

Modified: trunk/Source/WebCore/svg/SVGImageElement.h (88554 => 88555)


--- trunk/Source/WebCore/svg/SVGImageElement.h	2011-06-10 18:35:46 UTC (rev 88554)
+++ trunk/Source/WebCore/svg/SVGImageElement.h	2011-06-10 19:43:23 UTC (rev 88555)
@@ -46,6 +46,7 @@
     SVGImageElement(const QualifiedName&, Document*);
     
     virtual bool isValid() const { return SVGTests::isValid(); }
+    virtual bool supportsFocus() const { return true; }
 
     bool isSupportedAttribute(const QualifiedName&);
     virtual void parseMappedAttribute(Attribute*);

Modified: trunk/Source/WebCore/svg/SVGLineElement.h (88554 => 88555)


--- trunk/Source/WebCore/svg/SVGLineElement.h	2011-06-10 18:35:46 UTC (rev 88554)
+++ trunk/Source/WebCore/svg/SVGLineElement.h	2011-06-10 19:43:23 UTC (rev 88555)
@@ -42,6 +42,7 @@
     SVGLineElement(const QualifiedName&, Document*);
     
     virtual bool isValid() const { return SVGTests::isValid(); }
+    virtual bool supportsFocus() const { return true; }
 
     bool isSupportedAttribute(const QualifiedName&);
     virtual void parseMappedAttribute(Attribute*);

Modified: trunk/Source/WebCore/svg/SVGPathElement.h (88554 => 88555)


--- trunk/Source/WebCore/svg/SVGPathElement.h	2011-06-10 18:35:46 UTC (rev 88554)
+++ trunk/Source/WebCore/svg/SVGPathElement.h	2011-06-10 19:43:23 UTC (rev 88555)
@@ -100,6 +100,7 @@
     SVGPathElement(const QualifiedName&, Document*);
 
     virtual bool isValid() const { return SVGTests::isValid(); }
+    virtual bool supportsFocus() const { return true; }
 
     bool isSupportedAttribute(const QualifiedName&);
     virtual void parseMappedAttribute(Attribute*);

Modified: trunk/Source/WebCore/svg/SVGPolyElement.h (88554 => 88555)


--- trunk/Source/WebCore/svg/SVGPolyElement.h	2011-06-10 18:35:46 UTC (rev 88554)
+++ trunk/Source/WebCore/svg/SVGPolyElement.h	2011-06-10 19:43:23 UTC (rev 88555)
@@ -46,6 +46,7 @@
 
 private:
     virtual bool isValid() const { return SVGTests::isValid(); }
+    virtual bool supportsFocus() const { return true; }
 
     bool isSupportedAttribute(const QualifiedName&);
     virtual void parseMappedAttribute(Attribute*); 

Modified: trunk/Source/WebCore/svg/SVGRectElement.h (88554 => 88555)


--- trunk/Source/WebCore/svg/SVGRectElement.h	2011-06-10 18:35:46 UTC (rev 88554)
+++ trunk/Source/WebCore/svg/SVGRectElement.h	2011-06-10 19:43:23 UTC (rev 88555)
@@ -42,6 +42,7 @@
     SVGRectElement(const QualifiedName&, Document*);
     
     virtual bool isValid() const { return SVGTests::isValid(); }
+    virtual bool supportsFocus() const { return true; }
 
     bool isSupportedAttribute(const QualifiedName&);
     virtual void parseMappedAttribute(Attribute*);

Modified: trunk/Source/WebCore/svg/SVGSVGElement.h (88554 => 88555)


--- trunk/Source/WebCore/svg/SVGSVGElement.h	2011-06-10 18:35:46 UTC (rev 88554)
+++ trunk/Source/WebCore/svg/SVGSVGElement.h	2011-06-10 19:43:23 UTC (rev 88555)
@@ -52,6 +52,7 @@
     static PassRefPtr<SVGSVGElement> create(const QualifiedName&, Document*);
 
     virtual bool isValid() const { return SVGTests::isValid(); }
+    virtual bool supportsFocus() const { return true; }
 
     // 'SVGSVGElement' functions
     const AtomicString& contentScriptType() const;

Modified: trunk/Source/WebCore/svg/SVGStyledElement.cpp (88554 => 88555)


--- trunk/Source/WebCore/svg/SVGStyledElement.cpp	2011-06-10 18:35:46 UTC (rev 88554)
+++ trunk/Source/WebCore/svg/SVGStyledElement.cpp	2011-06-10 19:43:23 UTC (rev 88555)
@@ -26,6 +26,7 @@
 #include "Attr.h"
 #include "CSSParser.h"
 #include "Document.h"
+#include "EventNames.h"
 #include "HTMLNames.h"
 #include "PlatformString.h"
 #include "RenderObject.h"
@@ -506,6 +507,19 @@
     }
 }
 
+bool SVGStyledElement::isMouseFocusable() const
+{
+    if (!isFocusable())
+        return false;
+    Element* eventTarget = const_cast<SVGStyledElement *>(this);
+    return eventTarget->hasEventListeners(eventNames().focusinEvent) || eventTarget->hasEventListeners(eventNames().focusoutEvent);
 }
 
+bool SVGStyledElement::isKeyboardFocusable(KeyboardEvent*) const
+{
+    return isMouseFocusable();
+}
+
+}
+
 #endif // ENABLE(SVG)

Modified: trunk/Source/WebCore/svg/SVGStyledElement.h (88554 => 88555)


--- trunk/Source/WebCore/svg/SVGStyledElement.h	2011-06-10 18:35:46 UTC (rev 88554)
+++ trunk/Source/WebCore/svg/SVGStyledElement.h	2011-06-10 19:43:23 UTC (rev 88555)
@@ -87,6 +87,9 @@
 private:
     virtual bool isStyled() const { return true; }
 
+    virtual bool isKeyboardFocusable(KeyboardEvent*) const;
+    virtual bool isMouseFocusable() const;
+
     void buildPendingResourcesIfNeeded() const;
 
     HashSet<SVGStyledElement*> m_elementsWithRelativeLengths;

Modified: trunk/Source/WebCore/svg/SVGSwitchElement.h (88554 => 88555)


--- trunk/Source/WebCore/svg/SVGSwitchElement.h	2011-06-10 18:35:46 UTC (rev 88554)
+++ trunk/Source/WebCore/svg/SVGSwitchElement.h	2011-06-10 19:43:23 UTC (rev 88555)
@@ -41,6 +41,7 @@
     SVGSwitchElement(const QualifiedName&, Document*);
     
     virtual bool isValid() const { return SVGTests::isValid(); }
+    virtual bool supportsFocus() const { return true; }
 
     virtual bool childShouldCreateRenderer(Node*) const;
 

Modified: trunk/Source/WebCore/svg/SVGSymbolElement.h (88554 => 88555)


--- trunk/Source/WebCore/svg/SVGSymbolElement.h	2011-06-10 18:35:46 UTC (rev 88554)
+++ trunk/Source/WebCore/svg/SVGSymbolElement.h	2011-06-10 19:43:23 UTC (rev 88555)
@@ -42,6 +42,8 @@
 private:
     SVGSymbolElement(const QualifiedName&, Document*);
 
+    virtual bool supportsFocus() const { return true; }
+
     bool isSupportedAttribute(const QualifiedName&);
     virtual void parseMappedAttribute(Attribute*);
     virtual void svgAttributeChanged(const QualifiedName&);

Modified: trunk/Source/WebCore/svg/SVGTextElement.h (88554 => 88555)


--- trunk/Source/WebCore/svg/SVGTextElement.h	2011-06-10 18:35:46 UTC (rev 88554)
+++ trunk/Source/WebCore/svg/SVGTextElement.h	2011-06-10 19:43:23 UTC (rev 88555)
@@ -44,6 +44,8 @@
 private:
     SVGTextElement(const QualifiedName&, Document*);
 
+    virtual bool supportsFocus() const { return true; }
+
     bool isSupportedAttribute(const QualifiedName&);
     virtual void parseMappedAttribute(Attribute*);
 

Modified: trunk/Source/WebCore/svg/SVGUseElement.h (88554 => 88555)


--- trunk/Source/WebCore/svg/SVGUseElement.h	2011-06-10 18:35:46 UTC (rev 88554)
+++ trunk/Source/WebCore/svg/SVGUseElement.h	2011-06-10 19:43:23 UTC (rev 88555)
@@ -54,6 +54,7 @@
     SVGUseElement(const QualifiedName&, Document*);
 
     virtual bool isValid() const { return SVGTests::isValid(); }
+    virtual bool supportsFocus() const { return true; }
 
     virtual void insertedIntoDocument();
     virtual void removedFromDocument();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to