Bug 19911 - :read-only and :read-write pseudoclasses support
Summary: :read-only and :read-write pseudoclasses support
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P3 Enhancement
Assignee: Nobody
URL: http://www.w3.org/TR/web-forms-2/#rel...
Keywords:
Depends on:
Blocks: HTML5Forms
  Show dependency treegraph
 
Reported: 2008-07-06 04:28 PDT by Michelangelo De Simone
Modified: 2008-07-07 16:35 PDT (History)
1 user (show)

See Also:


Attachments
Support for :read-only and :read-write pseudoclasses (16.49 KB, patch)
2008-07-06 06:02 PDT, Michelangelo De Simone
adele: review-
Details | Formatted Diff | Diff
Support for :read-only and :read-write pseudoclasses (updated) (16.08 KB, patch)
2008-07-07 14:09 PDT, Michelangelo De Simone
adele: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michelangelo De Simone 2008-07-06 04:28:05 PDT
WebKit should be able to deal with :read-only and :read-write CSS pseudoclasses which apply to editable form controls (text/password inputs and textareas) when "readonly" attribute is specified.

These pseudoclasses do not apply input types such radio, checkbox and so on.
Comment 1 Michelangelo De Simone 2008-07-06 04:30:06 PDT
A patch is going to be submitted.
Comment 2 Michelangelo De Simone 2008-07-06 06:02:40 PDT
Created attachment 22107 [details]
Support for :read-only and :read-write pseudoclasses

The attached patch includes Opera's test suite for :read-only and :read-write.
Comment 3 Adele Peterson 2008-07-07 10:02:34 PDT
Comment on attachment 22107 [details]
Support for :read-only and :read-write pseudoclasses

Looks pretty good- I have just a few comments:

atomic strings in CSSSelector.cpp should be readOnly and readWrite

you shouldn't need the check  && !e->isInputTypeHidden()

you've left out checks for search fields and isindex - instead of using the specific checks for the type, you can use isTextField().
Comment 4 Adele Peterson 2008-07-07 11:43:08 PDT
Also, we may want to add the -webkit prefix for these pseudoclasses.
Comment 5 Michelangelo De Simone 2008-07-07 14:09:27 PDT
Created attachment 22140 [details]
Support for :read-only and :read-write pseudoclasses (updated)

Patch updated according to Adele's comments.
Comment 6 Adele Peterson 2008-07-07 14:34:54 PDT
Committed revision 35042.
Comment 7 Dave Hyatt 2008-07-07 14:40:27 PDT
This patch does not deal with style sharing:

dhyatt: canShareStyleWithElement
[4:38pm] dhyatt: if (isControl && (s->isEnabled() != m_element->isEnabled()) ||
[4:38pm] dhyatt:                             (s->isIndeterminate() != m_element->isIndeterminate()) ||
[4:38pm] dhyatt:                             (s->isChecked() != m_element->isChecked()))
[4:38pm] dhyatt:                 return false;
[4:38pm] dhyatt: has this check
[4:38pm] dhyatt: for enabled/indeterminate/checked
[4:38pm] dhyatt: you need to add readonlycontrol or whatever to this
[4:38pm] dhyatt: make a test with two adjacent textareas
[4:38pm] dhyatt: sibling textareas
[4:38pm] dhyatt: and make the first one read-only and the second one not be read-only
[4:38pm] dhyatt: and then write a pseudo rule
[4:39pm] dhyatt: the second one will incorrectly match
[4:39pm] dhyatt: because it will share style with the first
Comment 8 Adele Peterson 2008-07-07 14:41:06 PDT
re-opening.  We need to address style-sharing with a new patch.
Comment 9 Michelangelo De Simone 2008-07-07 15:41:16 PDT
Style sharing already checks for readonlyAttr. No issue.