Changeset 136091 in webkit


Ignore:
Timestamp:
Nov 28, 2012, 9:20:54 PM (13 years ago)
Author:
tkent@chromium.org
Message:

Merge 135829 - :read-only selector should match to date/time input types
https://bugs.webkit.org/show_bug.cgi?id=103350

Reviewed by Kentaro Hara.

Source/WebCore:

We supported :read-only and :read-write only for text form controls;
i.e. <textarea> and text-field <input>. According to [1], we should
support them for date/time types. So, this patch removes
isTextFormControl check in SelectorChecker, and just relies on
shouldMatchRead{Only,Write}Selector virtual functions.

Tests: Update fast/forms/*/*-appearance-pseudo-classes.html.

[1] http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary

  • css/SelectorChecker.cpp:

(WebCore::SelectorChecker::checkOneSelector):
Remove isFormControlElement check and isTextFormControl check.

  • html/HTMLFormControlElement.cpp:

Remove shouldMatchRead{Only,Write}Selector functions. We don't need
common implementations any more.

  • html/HTMLFormControlElement.h: Ditto.
  • html/HTMLTextAreaElement.h:

(HTMLTextAreaElement): Add shouldMatchRead{Only,Write}Selector overrides.

  • html/HTMLTextAreaElement.cpp:

(WebCore::HTMLTextAreaElement::shouldMatchReadOnlySelector): Added.
(WebCore::HTMLTextAreaElement::shouldMatchReadWriteSelector): Added.

  • html/HTMLInputElement.h:

(HTMLInputElement): Add shouldMatchRead{Only,Write}Selector overrides.

  • html/HTMLInputElement.cpp:

(WebCore::HTMLInputElement::shouldMatchReadOnlySelector):
Added. This checks InputType::supportsReadOnly and readOnly.
(WebCore::HTMLInputElement::shouldMatchReadWriteSelector): Ditto.

  • html/InputType.h:

(InputType): Add supportsReadOnly.

  • html/InputType.cpp:

(WebCore::InputType::supportsReadOnly): Added. Returns false by default.

  • html/BaseDateAndTimeInputType.h:

(BaseDateAndTimeInputType): Add supportsReadOnly.

  • html/BaseDateAndTimeInputType.cpp:

(WebCore::BaseDateAndTimeInputType::supportsReadOnly): Added. Returns true.

  • html/TextFieldInputType.h:

(TextFieldInputType): Add supportsReadOnly.

  • html/TextFieldInputType.cpp:

(WebCore::TextFieldInputType::supportsReadOnly): Added. Returns true.

LayoutTests:

The text color becomes yellow as specified for :read-only in
*-appearance-pseudo-classes.html

  • platform/chromium-mac/fast/forms/date/date-appearance-pseudo-classes-expected.png:
  • platform/chromium-mac/fast/forms/month/month-appearance-pseudo-classes-expected.png:
  • platform/chromium-mac/fast/forms/time/time-appearance-pseudo-classes-expected.png:
  • platform/chromium-mac/fast/forms/week/week-appearance-pseudo-classes-expected.png:
  • platform/chromium/TestExpectations:

TBR=tkent@chromium.org
Review URL: https://codereview.chromium.org/11415195

Location:
branches/chromium/1312
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • branches/chromium/1312/LayoutTests/platform/chromium/TestExpectations

    r134985 r136091  
    27922792webkit.org/b/98906 platform/chromium/fast/forms/suggestion-picker/date-suggestion-picker-mouse-operations.html [ Pass Failure ]
    27932793
     2794webkit.org/b/103350 fast/forms/date/date-appearance-pseudo-classes.html [ Pass ImageOnlyFailure ]
     2795webkit.org/b/103350 fast/forms/month/month-appearance-pseudo-classes.html [ Pass ImageOnlyFailure ]
     2796webkit.org/b/103350 fast/forms/time/time-appearance-pseudo-classes.html [ Pass ImageOnlyFailure ]
     2797webkit.org/b/103350 fast/forms/week/week-appearance-pseudo-classes.html [ Pass ImageOnlyFailure ]
     2798
    27942799# New test added in r87324
    27952800crbug.com/83994 [ Win ] platform/win/plugins/call-javascript-that-destroys-plugin.html [ Failure ]
  • branches/chromium/1312/Source/WebCore/css/SelectorChecker.cpp

    r132754 r136091  
    10461046            break;
    10471047        case CSSSelector::PseudoReadOnly:
    1048             if (!element || !element->isFormControlElement())
    1049                 return false;
    1050             return element->isTextFormControl() && element->shouldMatchReadOnlySelector();
     1048            return element && element->shouldMatchReadOnlySelector();
    10511049        case CSSSelector::PseudoReadWrite:
    1052             if (!element || !element->isFormControlElement())
    1053                 return false;
    1054             return element->isTextFormControl() && element->shouldMatchReadWriteSelector();
     1050            return element && element->shouldMatchReadWriteSelector();
    10551051        case CSSSelector::PseudoOptional:
    10561052            return element && element->isOptionalFormControl();
  • branches/chromium/1312/Source/WebCore/html/BaseDateAndTimeInputType.cpp

    r132774 r136091  
    183183}
    184184
     185bool BaseDateAndTimeInputType::supportsReadOnly() const
     186{
     187    return true;
     188}
     189
    185190} // namespace WebCore
  • branches/chromium/1312/Source/WebCore/html/BaseDateAndTimeInputType.h

    r130835 r136091  
    6565    virtual String visibleValue() const OVERRIDE;
    6666    virtual String convertFromVisibleValue(const String&) const OVERRIDE;
     67    virtual bool supportsReadOnly() const OVERRIDE;
    6768};
    6869
  • branches/chromium/1312/Source/WebCore/html/HTMLFormControlElement.cpp

    r131572 r136091  
    459459}
    460460
    461 bool HTMLFormControlElement::shouldMatchReadOnlySelector() const
    462 {
    463     return readOnly();
    464 }
    465 
    466 bool HTMLFormControlElement::shouldMatchReadWriteSelector() const
    467 {
    468     return !readOnly();
    469 }
    470 
    471461bool HTMLFormControlElement::validationMessageShadowTreeContains(Node* node) const
    472462{
  • branches/chromium/1312/Source/WebCore/html/HTMLFormControlElement.h

    r128254 r136091  
    8282    virtual const AtomicString& formControlType() const OVERRIDE = 0;
    8383    virtual bool isEnabledFormControl() const { return !disabled(); }
    84     virtual bool shouldMatchReadOnlySelector() const OVERRIDE;
    85     virtual bool shouldMatchReadWriteSelector() const OVERRIDE;
    8684
    8785    virtual bool canTriggerImplicitSubmission() const { return false; }
  • branches/chromium/1312/Source/WebCore/html/HTMLInputElement.cpp

    r134269 r136091  
    14691469}
    14701470
     1471bool HTMLInputElement::shouldMatchReadOnlySelector() const
     1472{
     1473    return m_inputType->supportsReadOnly() && readOnly();
     1474}
     1475
     1476bool HTMLInputElement::shouldMatchReadWriteSelector() const
     1477{
     1478    return m_inputType->supportsReadOnly() && !readOnly();
     1479}
     1480
    14711481void HTMLInputElement::addSearchResult()
    14721482{
  • branches/chromium/1312/Source/WebCore/html/HTMLInputElement.h

    r132599 r136091  
    289289    static Vector<FileChooserFileInfo> filesFromFileInputFormControlState(const FormControlState&);
    290290
     291    virtual bool shouldMatchReadOnlySelector() const OVERRIDE;
     292    virtual bool shouldMatchReadWriteSelector() const OVERRIDE;
    291293    virtual void setRangeText(const String& replacement, ExceptionCode&) OVERRIDE;
    292294    virtual void setRangeText(const String& replacement, unsigned start, unsigned end, const String& selectionMode, ExceptionCode&) OVERRIDE;
  • branches/chromium/1312/Source/WebCore/html/HTMLTextAreaElement.cpp

    r130818 r136091  
    530530}
    531531
     532bool HTMLTextAreaElement::shouldMatchReadOnlySelector() const
     533{
     534    return readOnly();
     535}
     536
     537bool HTMLTextAreaElement::shouldMatchReadWriteSelector() const
     538{
     539    return !readOnly();
     540}
     541
    532542void HTMLTextAreaElement::updatePlaceholderText()
    533543{
  • branches/chromium/1312/Source/WebCore/html/HTMLTextAreaElement.h

    r128856 r136091  
    113113    virtual bool shouldUseInputMethod();
    114114    virtual void attach() OVERRIDE;
     115    virtual bool shouldMatchReadOnlySelector() const OVERRIDE;
     116    virtual bool shouldMatchReadWriteSelector() const OVERRIDE;
    115117
    116118    bool valueMissing(const String& value) const { return isRequiredFormControl() && !disabled() && !readOnly() && value.isEmpty(); }
  • branches/chromium/1312/Source/WebCore/html/InputType.cpp

    r131969 r136091  
    882882}
    883883
     884bool InputType::supportsReadOnly() const
     885{
     886    return false;
     887}
     888
    884889void InputType::updateInnerTextValue()
    885890{
  • branches/chromium/1312/Source/WebCore/html/InputType.h

    r131969 r136091  
    277277    virtual bool usesFixedPlaceholder() const;
    278278    virtual String fixedPlaceholder();
     279    virtual bool supportsReadOnly() const;
    279280    virtual void updateInnerTextValue();
    280281    virtual void updatePlaceholderText();
  • branches/chromium/1312/Source/WebCore/html/TextFieldInputType.cpp

    r134459 r136091  
    330330}
    331331
     332bool TextFieldInputType::supportsReadOnly() const
     333{
     334    return true;
     335}
     336
    332337bool TextFieldInputType::shouldUseInputMethod() const
    333338{
  • branches/chromium/1312/Source/WebCore/html/TextFieldInputType.h

    r132291 r136091  
    6565    virtual void disabledAttributeChanged() OVERRIDE;
    6666    virtual void readonlyAttributeChanged() OVERRIDE;
     67    virtual bool supportsReadOnly() const OVERRIDE;
    6768    virtual void handleBlurEvent() OVERRIDE;
    6869    virtual void updateInnerTextValue() OVERRIDE;
Note: See TracChangeset for help on using the changeset viewer.