Bug 103350 - :read-only selector should match to date/time input types
Summary: :read-only selector should match to date/time input types
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: WebExposed
Depends on:
Blocks:
 
Reported: 2012-11-26 20:04 PST by Kent Tamura
Modified: 2012-11-26 23:54 PST (History)
10 users (show)

See Also:


Attachments
Patch (125.11 KB, patch)
2012-11-26 22:49 PST, Kent Tamura
no flags Details | Formatted Diff | Diff
Patch for landing (125.10 KB, patch)
2012-11-26 23:14 PST, 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-11-26 20:04:53 PST
How to reproduce:
1. Open data:text/html,<style>:read-only { background-color:red; }</style><input type=time readonly><input readonly>

Expected:
Both of the time input and the text input are red.
Actual:
The time input is white.

According to the standard [1], date/time types should support readonly attribute, and of couse :read-only selector too.

[1] http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
Comment 1 Kent Tamura 2012-11-26 22:49:05 PST
Created attachment 176180 [details]
Patch
Comment 2 Kentaro Hara 2012-11-26 23:02:06 PST
Comment on attachment 176180 [details]
Patch

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

Looks ok

> Source/WebCore/ChangeLog:11
> +        isTextFormControl check in SeelctorChecker, and just relies on

Typo: SelectorChecker

> Source/WebCore/html/HTMLTextAreaElement.cpp:539
> +bool HTMLTextAreaElement::shouldMatchReadOnlySelector() const
> +{
> +    return readOnly();
> +}
> +
> +bool HTMLTextAreaElement::shouldMatchReadWriteSelector() const
> +{
> +    return !readOnly();

Don't you want to change this to:

  bool HTMLTextAreaElement::shouldMatchReadOnlySelector() const
  {
    return supportsReadOnly() && readOnly();
  }

  bool HTMLTextAreaElement::shouldMatchReadWriteSelector() const
  {
    return supportsReadOnly() && !readOnly();
  }

and implement:

  HTMLTextAreaElement::supportsReadOnly() { return true; }

?
Comment 3 Kent Tamura 2012-11-26 23:12:15 PST
Comment on attachment 176180 [details]
Patch

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

>> Source/WebCore/html/HTMLTextAreaElement.cpp:539
>> +    return !readOnly();
> 
> Don't you want to change this to:
> 
>   bool HTMLTextAreaElement::shouldMatchReadOnlySelector() const
>   {
>     return supportsReadOnly() && readOnly();
>   }
> 
>   bool HTMLTextAreaElement::shouldMatchReadWriteSelector() const
>   {
>     return supportsReadOnly() && !readOnly();
>   }
> 
> and implement:
> 
>   HTMLTextAreaElement::supportsReadOnly() { return true; }
> 
> ?

It looks to help nothing and makes code readers confused.
Comment 4 Kent Tamura 2012-11-26 23:14:11 PST
Created attachment 176186 [details]
Patch for landing

Fix a typo in ChangeLog
Comment 5 WebKit Review Bot 2012-11-26 23:54:07 PST
Comment on attachment 176186 [details]
Patch for landing

Clearing flags on attachment: 176186

Committed r135829: <http://trac.webkit.org/changeset/135829>
Comment 6 WebKit Review Bot 2012-11-26 23:54:11 PST
All reviewed patches have been landed.  Closing bug.