[webkit-reviews] review granted: [Bug 203292] Accessory bar next/previous buttons do not work on inputs in shadow roots : [Attachment 412272] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Oct 25 17:24:07 PDT 2020


Ryosuke Niwa <rniwa at webkit.org> has granted Tetsuharu Ohzeki
<tetsuharu.ohzeki at gmail.com>'s request for review:
Bug 203292: Accessory bar next/previous buttons do not work on inputs in shadow
roots
https://bugs.webkit.org/show_bug.cgi?id=203292

Attachment 412272: Patch

https://bugs.webkit.org/attachment.cgi?id=412272&action=review




--- Comment #28 from Ryosuke Niwa <rniwa at webkit.org> ---
Comment on attachment 412272
  --> https://bugs.webkit.org/attachment.cgi?id=412272
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=412272&action=review

>
LayoutTests/fast/shadow-dom/ios/accessory-bar-work-on-input-with-tabindex-in-sh
adow-tree.html:130
> +class Testcase {
> +    constructor(documentOrShadowRoot, inputGetter) {

It seems that we can just have a helper function that creates a simple
dictionary instead of a class with a getter.
For tests, we should strive to make things as simple as possible because we
don't want to be debugging test code.

>
LayoutTests/fast/shadow-dom/ios/accessory-bar-work-on-input-with-tabindex-in-sh
adow-tree.html:145
> +	   new Testcase(document, (_) => document.getElementById('first')),

It seems this class is totally unnecessary.
Given we're not dynamically mutating the tree, we can simply compute the input
element right here:
e.g. testCase(document, document.getElementById('first'))

>
LayoutTests/fast/shadow-dom/ios/accessory-bar-work-on-input-with-tabindex-in-sh
adow-tree.html:181
> +    for (const [i, { documentOrShadowRoot, inputElement, }] of
stack.entries()) {

Why not just start at i=1 instead?

>
LayoutTests/fast/shadow-dom/ios/accessory-bar-work-on-input-with-tabindex-in-sh
adow-tree.html:196
> +    for (let i = stack.length - 1; -1 < i; --i) {
> +	   if (stack.length - 1 === i) {

Why not just start i = stack.length - 2?

> LayoutTests/resources/ui-helper.js:1383
> +    static moveToNextByKeyboardAccessoryBar() {

Nit: { should be on the next line.

> LayoutTests/resources/ui-helper.js:1392
> +    static moveToPrevByKeyboardAccessoryBar() {

Ditto.


More information about the webkit-reviews mailing list