Bug 82558 - Toggling <input type="range"> readonly or disabled state while active breaks all click events
Summary: Toggling <input type="range"> readonly or disabled state while active breaks ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Joseph Pecoraro
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-28 18:06 PDT by Joseph Pecoraro
Modified: 2017-04-05 08:36 PDT (History)
4 users (show)

See Also:


Attachments
[REDUCTION] Test Case (1.18 KB, text/html)
2012-03-28 18:06 PDT, Joseph Pecoraro
no flags Details
[PATCH] Proposed Fix 1: Stop Dragging when readonly / disabled state toggles (3.39 KB, patch)
2012-03-28 19:00 PDT, Joseph Pecoraro
no flags Details | Formatted Diff | Diff
[PATCH] Proposed Fix 2: Stop Dragging in the early bail (1.44 KB, patch)
2012-03-28 19:01 PDT, Joseph Pecoraro
no flags Details | Formatted Diff | Diff
[PATCH] Fix with test (6.30 KB, patch)
2012-03-28 20:11 PDT, Joseph Pecoraro
no flags Details | Formatted Diff | Diff
[TEXT] Expected Results Before Patch (930 bytes, text/plain)
2012-03-28 20:13 PDT, Joseph Pecoraro
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2012-03-28 18:06:03 PDT
Created attachment 134458 [details]
[REDUCTION] Test Case

See attached reduction.

If a user is actively dragging a slider and it toggles its readonly / disabled state
buttons, other sliders, etc. stop working.
Comment 1 Joseph Pecoraro 2012-03-28 18:07:25 PDT
My guess is that we miss a call to SliderThumbElement::stopDragging at some point
to clear the global capturing mouse events node:

    frame->eventHandler()->setCapturingMouseEventsNode(0);
Comment 2 Joseph Pecoraro 2012-03-28 18:37:53 PDT
Yep, calling stopDragging() when fixes the issue. There are a couple different
ways to fix this. I'm going to put up a few patches and let you know which
one I recommend. I'm in the process of doing a build.
Comment 3 Joseph Pecoraro 2012-03-28 19:00:37 PDT
Created attachment 134472 [details]
[PATCH] Proposed Fix 1: Stop Dragging when readonly / disabled state toggles
Comment 4 Joseph Pecoraro 2012-03-28 19:01:18 PDT
Created attachment 134474 [details]
[PATCH] Proposed Fix 2: Stop Dragging in the early bail
Comment 5 WebKit Review Bot 2012-03-28 19:02:41 PDT
Attachment 134472 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1
Source/WebCore/ChangeLog:10:  You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible.  [changelog/nonewtests] [5]
Total errors found: 1 in 5 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 6 Kent Tamura 2012-03-28 19:04:04 PDT
I like Proposed Fix 2 because of simplicity.
Comment 7 Joseph Pecoraro 2012-03-28 19:11:24 PDT
(In reply to comment #6)
> I like Proposed Fix 2 because of simplicity.

I wonder if we should take both.

  • Proposed Fix 1
    - this would stop an active drag if the input is changed to disabled and back quickly.
  • Proposed Fix 2
    - any early return should logically stop the drag.

Should I spend time trying to make a test for this?
Comment 8 Joseph Pecoraro 2012-03-28 19:13:42 PDT
I see there is: LayoutTests/fast/forms/range/range-drag.html
I'll see if I can make a test for this.
Comment 9 Joseph Pecoraro 2012-03-28 20:11:43 PDT
Created attachment 134483 [details]
[PATCH] Fix with test

Now with test!

The question now is if we want the following scenario to work.

    1. User starts dragging
    2. <input> becomes disabled
    3. <input> becomes enabled
    4. User continues dragging.

The test does not really test this scenario, it only really tests that mouse events
don't stop working when a toggle during an active drag happens.
Comment 10 Joseph Pecoraro 2012-03-28 20:13:10 PDT
Created attachment 134484 [details]
[TEXT] Expected Results Before Patch

This is to show that the test does change from before and after. This is the before, note that the attempt to drag the second slider fails.
Comment 11 Kent Tamura 2012-03-29 00:29:12 PDT
Comment on attachment 134483 [details]
[PATCH] Fix with test

ok
Comment 12 WebKit Review Bot 2012-03-29 11:11:57 PDT
Comment on attachment 134483 [details]
[PATCH] Fix with test

Clearing flags on attachment: 134483

Committed r112547: <http://trac.webkit.org/changeset/112547>
Comment 13 WebKit Review Bot 2012-03-29 11:12:03 PDT
All reviewed patches have been landed.  Closing bug.