• andersr@opera.com's avatar
    Improve support for :read-only and :read-write pseudoclasses. · 7a31aa7c
    andersr@opera.com authored
    This change fixes these two issues:
    
     1) The :read-write pseudoclass should apply to all elements which are
        editable, not just form elements.
     2) The :read-only pseudoclass should match all elements which is not
        matched by the :read-write class, not just form elements which are
        non-editable.
    
    Case (1) is problematic because of the -webkit-user-modify property.
    When we try to match :read-write to an element, we may not yet have applied
    other rules which contain -webkit-user-modify and hence modify the
    editability of the element. So, we can not check the computed style for
    an element for a match against :read-write. Instead, I suggest checking
    the conteteditable attribute on the element. If this attribute is set, and
    contains an absolute value, then we have our answer. If the value is
    "inherit", then we check the computed style of parent elements (via
    rendererIsEditable()).
    
    Note that this fix only works for elements which specify "contenteditable",
    not for elements with -webkit-user-modify properties in their style.
    However, the CSS property was removed from the spec, and it doesn't
    appear to work in Firefox anymore either. It should probably be removed
    from Blink.
    
    The test-case fast/forms/select-live-pseudo-selectors.html failed with this
    change, because it incorrectly and probably accidentally depended on
    :read-only not being applied to <select> elements. Fixed by not applying
    :read-only to <select> elements.
    
    TEST=automated
    BUG=338309
    
    Review URL: https://codereview.chromium.org/148223004
    
    git-svn-id: svn://svn.chromium.org/blink/trunk@167629 bbb929c8-8fbe-4397-9dbb-9b2b20218538
    7a31aa7c
readwrite-contenteditable-expected.html 862 Bytes