Bug 87380 - Form controls in <fieldset disabled> should not be focusable.
Summary: Form controls in <fieldset disabled> should not be focusable.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kent Tamura
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-24 05:47 PDT by Kent Tamura
Modified: 2012-05-30 19:24 PDT (History)
3 users (show)

See Also:


Attachments
Patch (10.26 KB, patch)
2012-05-29 23:27 PDT, Kent Tamura
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kent Tamura 2012-05-24 05:47:50 PDT
1. Load the following document.
<fieldset disabled>
  <input>
</fieldset>

2. Click the text field.

EXPECTED: Nothing happens.
ACTUAL: The text field gets focus and the focus ring is drawn.
Comment 1 Kent Tamura 2012-05-29 23:27:07 PDT
Created attachment 144718 [details]
Patch
Comment 2 Darin Adler 2012-05-30 12:30:57 PDT
Comment on attachment 144718 [details]
Patch

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

> Source/WebCore/html/HTMLFormControlElement.cpp:322
>  bool HTMLFormControlElement::supportsFocus() const
>  {
> -    return !m_disabled;
> +    return !disabled();
>  }

This code change shows that our naming in this class is not good! It's terrible to be in a situation where m_disabled is one thing and disabled() another, and switching from one to the other fixes a bug. The names should reflect differences between the two.

Our longer term direction should be to give good, clear names to this class's members. If the names from the DOM standard are causing us problems then we should think about solutions to that; maybe we could start putting prefixes on some names used in DOM bindings to make sure no one is tempted to use them inside WebKit itself.

Does this code change have any other effects? Is being wrapped inside a disabled fieldset the only difference between disabled() and m_disabled. Are there tests showing these other effects are OK?
Comment 3 Kent Tamura 2012-05-30 18:45:54 PDT
(In reply to comment #2)
> This code change shows that our naming in this class is not good! It's terrible to be in a situation where m_disabled is one thing and disabled() another, and switching from one to the other fixes a bug. The names should reflect differences between the two.
> 
> Our longer term direction should be to give good, clear names to this class's members. If the names from the DOM standard are causing us problems then we should think about solutions to that; maybe we could start putting prefixes on some names used in DOM bindings to make sure no one is tempted to use them inside WebKit itself.

I agree with renaming.
 * rename m_disabled to m_reflectedDisabled, m_bareDisabled, m_rawDisabled, m_disabledAttributeValue, or
 * rename disabled() to effectiveDisabled() or something?

The specification says 'disabled' for our disabled().

> Does this code change have any other effects? Is being wrapped inside a disabled fieldset the only difference between disabled() and m_disabled. Are there tests showing these other effects are OK?

I think we have no more bugs about <fieldset disabled>.  But the test coverage might be not good.
Comment 4 WebKit Review Bot 2012-05-30 19:24:38 PDT
Comment on attachment 144718 [details]
Patch

Clearing flags on attachment: 144718

Committed r119023: <http://trac.webkit.org/changeset/119023>
Comment 5 WebKit Review Bot 2012-05-30 19:24:43 PDT
All reviewed patches have been landed.  Closing bug.