Bug 155159 - Stop clamping HTMLElement.tabIndex to the range of a short
Summary: Stop clamping HTMLElement.tabIndex to the range of a short
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: WebExposed
Depends on:
Blocks:
 
Reported: 2016-03-07 21:32 PST by Chris Dumez
Modified: 2016-03-08 20:42 PST (History)
4 users (show)

See Also:


Attachments
Patch (246.30 KB, patch)
2016-03-07 21:37 PST, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2016-03-07 21:32:47 PST
Stop clamping HTMLElement.tabIndex to the range of a short. We apparently did this to match Firefox. However, this no longer matches Firefox's behavior nor the HTML specification:
- https://html.spec.whatwg.org/multipage/interaction.html#dom-tabindex
Comment 1 Chris Dumez 2016-03-07 21:37:27 PST
Created attachment 273267 [details]
Patch
Comment 2 WebKit Commit Bot 2016-03-07 22:38:00 PST
Comment on attachment 273267 [details]
Patch

Clearing flags on attachment: 273267

Committed r197726: <http://trac.webkit.org/changeset/197726>
Comment 3 WebKit Commit Bot 2016-03-07 22:38:04 PST
All reviewed patches have been landed.  Closing bug.
Comment 4 Darin Adler 2016-03-08 08:47:57 PST
Comment on attachment 273267 [details]
Patch

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

> Source/WebCore/page/FocusController.cpp:493
> -    int winningTabIndex = std::numeric_limits<short>::max() + 1;
> +    int winningTabIndex = std::numeric_limits<int>::max();

The behavior for an item with a tab index of 2^32-1 is not the same as the old behavior for an item with a tab index of 2^16-1. We will skip such an item instead of returning it as the next element. I suggest constructing a test case that shows this and fixing the bug if it’s a bug.
Comment 5 Chris Dumez 2016-03-08 20:42:23 PST
(In reply to comment #4)
> Comment on attachment 273267 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=273267&action=review
> 
> > Source/WebCore/page/FocusController.cpp:493
> > -    int winningTabIndex = std::numeric_limits<short>::max() + 1;
> > +    int winningTabIndex = std::numeric_limits<int>::max();
> 
> The behavior for an item with a tab index of 2^32-1 is not the same as the
> old behavior for an item with a tab index of 2^16-1. We will skip such an
> item instead of returning it as the next element. I suggest constructing a
> test case that shows this and fixing the bug if it’s a bug.

Thanks for catching this, I will fix in https://bugs.webkit.org/show_bug.cgi?id=155215.