Changeset 248983 in webkit
- Timestamp:
- Aug 21, 2019, 5:34:48 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/svg/custom/add-event-listener-shadow-tree-element.html (modified) (1 diff)
-
LayoutTests/svg/custom/resources/focus-event-handling-keyboard.js (modified) (1 diff)
-
LayoutTests/svg/custom/resources/focus-event-handling.js (modified) (1 diff)
-
LayoutTests/svg/custom/tabindex-order-expected.txt (modified) (2 diffs)
-
LayoutTests/svg/custom/tabindex-order.html (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/svg/SVGAElement.cpp (modified) (1 diff)
-
Source/WebCore/svg/SVGElement.cpp (modified) (1 diff)
-
Source/WebCore/svg/SVGElement.h (modified) (2 diffs)
-
Source/WebCore/svg/SVGGraphicsElement.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r248977 r248983 1 2019-08-21 Ryosuke Niwa <rniwa@webkit.org> 2 3 SVG element should become focusable when focus and key event listeners are added 4 https://bugs.webkit.org/show_bug.cgi?id=200997 5 6 Reviewed by Said Abou-Hallawa. 7 8 Updated existing tests to set tabIndex where appropriate, and added SVG elements 9 without tabindex content attribute to tabindex-order.html so that the test would 10 skip those elements when sequentially focus navigating across them. 11 12 * svg/custom/add-event-listener-shadow-tree-element.html: 13 * svg/custom/resources/focus-event-handling-keyboard.js: 14 * svg/custom/resources/focus-event-handling.js: 15 * svg/custom/tabindex-order-expected.txt: 16 * svg/custom/tabindex-order.html: Added test cases without tabindex. 17 1 18 2019-08-21 Megan Gardner <megan_gardner@apple.com> 2 19 -
trunk/LayoutTests/svg/custom/add-event-listener-shadow-tree-element.html
r247826 r248983 20 20 testRunner.waitUntilDone(); 21 21 } 22 use1.tabIndex = 0; 22 23 use1.setAttribute("onfocusin", "eventhandler()"); 23 24 use1.focus(); -
trunk/LayoutTests/svg/custom/resources/focus-event-handling-keyboard.js
r124380 r248983 23 23 } 24 24 25 rectElement.tabIndex = 0; 25 26 rectElement.setAttribute("onfocusin", "focusinHandler(evt)"); 26 27 rectElement.setAttribute("onfocusout", "focusoutHandler(evt)"); 28 gElement.tabIndex = 0; 27 29 gElement.setAttribute("onfocusin", "focusinHandler(evt)"); 28 30 gElement.setAttribute("onfocusout", "focusoutHandler(evt)"); 31 useElement.tabIndex = 0; 29 32 useElement.setAttribute("onfocusin", "focusinHandler(evt)"); 30 33 useElement.setAttribute("onfocusout", "focusoutHandler(evt)"); 34 useElement2.tabIndex = 0; 31 35 useElement2.setAttribute("onfocusin", "focusinHandler(evt)"); 32 36 useElement2.setAttribute("onfocusout", "focusoutHandler(evt)"); 37 switchElement.tabIndex = 0; 33 38 switchElement.setAttribute("onfocusin", "focusinHandler(evt)"); 34 39 switchElement.setAttribute("onfocusout", "focusoutHandler(evt)"); 40 imgElement.tabIndex = 0; 35 41 imgElement.setAttribute("onfocusin", "focusinHandler(evt)"); 36 42 imgElement.setAttribute("onfocusout", "focusoutHandler(evt)"); -
trunk/LayoutTests/svg/custom/resources/focus-event-handling.js
r124380 r248983 29 29 } 30 30 31 rectElement.tabIndex = 0; 31 32 rectElement.setAttribute("onfocusin", "focusinHandler(evt)"); 32 33 rectElement.setAttribute("onfocusout", "focusoutHandler(evt)"); 34 gElement.tabIndex = 0; 33 35 gElement.setAttribute("onfocusin", "focusinHandler(evt)"); 34 36 gElement.setAttribute("onfocusout", "focusoutHandler(evt)"); 37 useElement.tabIndex = 0; 35 38 useElement.setAttribute("onfocusin", "focusinHandler(evt)"); 36 39 useElement.setAttribute("onfocusout", "focusoutHandler(evt)"); 40 useElement2.tabIndex = 0; 37 41 useElement2.setAttribute("onfocusin", "focusinHandler(evt)"); 38 42 useElement2.setAttribute("onfocusout", "focusoutHandler(evt)"); 43 switchElement.tabIndex = 0; 39 44 switchElement.setAttribute("onfocusin", "focusinHandler(evt)"); 40 45 switchElement.setAttribute("onfocusout", "focusoutHandler(evt)"); 46 imgElement.tabIndex = 0; 41 47 imgElement.setAttribute("onfocusin", "focusinHandler(evt)"); 42 48 imgElement.setAttribute("onfocusout", "focusoutHandler(evt)"); -
trunk/LayoutTests/svg/custom/tabindex-order-expected.txt
r168313 r248983 8 8 id: b tabindex: 1 [object SVGGElement] is focused. 9 9 id: c tabindex: 1 [object SVGEllipseElement] is focused. 10 id: symbol tabindex: 1 [object SVGSymbolElement] is focused. 10 11 id: d tabindex: 1 [object SVGPathElement] is focused. 11 12 id: e tabindex: 3 [object SVGAElement] is focused. … … 27 28 id: e tabindex: 3 [object SVGAElement] is focused. 28 29 id: d tabindex: 1 [object SVGPathElement] is focused. 30 id: symbol tabindex: 1 [object SVGSymbolElement] is focused. 29 31 id: c tabindex: 1 [object SVGEllipseElement] is focused. 30 32 id: b tabindex: 1 [object SVGGElement] is focused. -
trunk/LayoutTests/svg/custom/tabindex-order.html
r168313 r248983 66 66 <svg> 67 67 <rect class="tab" tabindex="6" id="g" width="1" height="1"/> 68 <rect class="tab" id="rect without tabindex is not focusable" width="1" height="1"/> 68 69 <circle class="tab" tabindex="1" id="a" r="1" cx="0" cy="0"/> 70 <circle class="tab" id="circle without tabindex is not focusable" r="1" cx="0" cy="0"/> 69 71 <rect class="tab" tabindex="-5" id="not in tab order (negative tabindex)" width="1" height="1"/> 70 72 <g class="tab" tabindex="1" id="b"/> 73 <g class="tab" id="g without tabindex is not focusable"/> 71 74 <svg class="tab" tabindex="0" id="i" width="1" height="1"/> 72 75 <text class="tab" tabindex="6" id="h" width="1" height="1"/> 76 <text class="tab" id="text without tabindex is not focusable" width="1" height="1"/> 73 77 <ellipse class="tab" tabindex="1" id="c" rx="1" ry="1" cx="0" cy="0"/> 74 <symbol class="tab" tabindex="1" id="symbol is not focusable" width="1" height="1"/> 78 <ellipse class="tab" id="ellipse without tabindex is not focusable" rx="1" ry="1" cx="0" cy="0"/> 79 <symbol class="tab" tabindex="1" id="symbol" width="1" height="1"/> 80 <symbol class="tab" id="symbol without tabindex is not focusable" width="1" height="1"/> 75 81 <defs class="tab" tabindex="1" id="defs is not focusable"/> 76 82 <path class="tab" tabindex="1" id="d" d="M0,0"/> 83 <path class="tab" id="path without tabindex is not focusable" d="M0,0"/> 77 84 <line class="tab" tabindex="0" id="j" x1="1" x2="1" y1="0" y2="0"/> 85 <line class="tab" id="line without tabindex is not focusable" x1="1" x2="1" y1="0" y2="0"/> 78 86 <rect class="tab" tabindex="-1" id="not in tab order (negative tabindex)" width="1" height="1"/> 79 87 <polygon class="tab" tabindex="0" id="k" points="1,1 2,2"/> 88 <polygon class="tab" id="polygon without tabindex is not focusable" points="1,1 2,2"/> 80 89 <polyline class="tab" tabindex="4" id="f" points="1,1 2,2"/> 90 <polyline class="tab" id="polyline without tabindex is not focusable" points="1,1 2,2"/> 81 91 <a class="tab" tabindex="3" id="e"><rect width="1" height="1"/></a> 82 92 </svg> -
trunk/Source/WebCore/ChangeLog
r248978 r248983 1 2019-08-21 Ryosuke Niwa <rniwa@webkit.org> 2 3 SVG element should become focusable when focus and key event listeners are added 4 https://bugs.webkit.org/show_bug.cgi?id=200997 5 6 Reviewed by Said Abou-Hallawa. 7 8 This patch removes the odd behavior WebKit (and Blink) browsers had to make SVG elements 9 with key or focus event listeners focusable. New behavior matches the behavior of Firefox 10 as well as the SVG 2.0 specification: https://www.w3.org/TR/SVG2/interact.html#Focus 11 12 Test: svg/custom/tabindex-order.html 13 14 * svg/SVGAElement.cpp: 15 (WebCore::SVGAElement::supportsFocus const): 16 * svg/SVGElement.cpp: 17 (WebCore::SVGElement::hasFocusEventListeners const): Deleted. 18 (WebCore::SVGElement::isMouseFocusable const): Deleted. 19 * svg/SVGElement.h: 20 * svg/SVGGraphicsElement.h: 21 1 22 2019-08-21 Jer Noble <jer.noble@apple.com> 2 23 -
trunk/Source/WebCore/svg/SVGAElement.cpp
r248784 r248983 162 162 return SVGGraphicsElement::supportsFocus(); 163 163 // If not a link we should still be able to focus the element if it has a tabIndex. 164 return isLink() || Element::supportsFocus();164 return isLink() || SVGGraphicsElement::supportsFocus(); 165 165 } 166 166 -
trunk/Source/WebCore/svg/SVGElement.cpp
r248846 r248983 984 984 } 985 985 986 bool SVGElement::hasFocusEventListeners() const987 {988 Element* eventTarget = const_cast<SVGElement*>(this);989 return eventTarget->hasEventListeners(eventNames().focusinEvent)990 || eventTarget->hasEventListeners(eventNames().focusoutEvent)991 || eventTarget->hasEventListeners(eventNames().focusEvent)992 || eventTarget->hasEventListeners(eventNames().blurEvent);993 }994 995 bool SVGElement::isMouseFocusable() const996 {997 if (!isFocusable())998 return false;999 Element* eventTarget = const_cast<SVGElement*>(this);1000 return hasFocusEventListeners()1001 || eventTarget->hasEventListeners(eventNames().keydownEvent)1002 || eventTarget->hasEventListeners(eventNames().keyupEvent)1003 || eventTarget->hasEventListeners(eventNames().keypressEvent);1004 }1005 1006 986 void SVGElement::accessKeyAction(bool sendMouseEvents) 1007 987 { -
trunk/Source/WebCore/svg/SVGElement.h
r248784 r248983 117 117 bool addEventListener(const AtomString& eventType, Ref<EventListener>&&, const AddEventListenerOptions&) override; 118 118 bool removeEventListener(const AtomString& eventType, EventListener&, const ListenerOptions&) override; 119 bool hasFocusEventListeners() const;120 119 121 120 bool hasTagName(const SVGQualifiedName& name) const { return hasLocalName(name.localName()); } … … 153 152 SVGElement(const QualifiedName&, Document&); 154 153 virtual ~SVGElement(); 155 156 bool isMouseFocusable() const override;157 bool supportsFocus() const override { return false; }158 154 159 155 bool rendererIsNeeded(const RenderStyle&) override; -
trunk/Source/WebCore/svg/SVGGraphicsElement.h
r246490 r248983 71 71 SVGGraphicsElement(const QualifiedName&, Document&); 72 72 73 bool supportsFocus() const override { return Element::supportsFocus() || hasFocusEventListeners(); }74 75 73 void parseAttribute(const QualifiedName&, const AtomString&) override; 76 74 void svgAttributeChanged(const QualifiedName&) override;
Note:
See TracChangeset
for help on using the changeset viewer.