Bug 103350

Summary: :read-only selector should match to date/time input types
Product: WebKit Reporter: Kent Tamura <tkent>
Component: FormsAssignee: Kent Tamura <tkent>
Status: RESOLVED FIXED    
Severity: Normal CC: allan.jensen, cmarcelo, haraken, macpherson, menard, mifenton, morrita, ojan, webkit.review.bot, yosin
Priority: P2 Keywords: WebExposed
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch for landing none

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.