Changeset 67166 in webkit
- Timestamp:
- Sep 9, 2010 10:06:45 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r67164 r67166 1 2010-09-09 Kent Tamura <tkent@chromium.org> 2 3 Reviewed by Dimitri Glazkov. 4 5 Apply :invalid CSS class to <input type=number> with an unacceptable value 6 https://bugs.webkit.org/show_bug.cgi?id=45376 7 8 * fast/forms/input-number-unacceptable-style-expected.txt: Added. 9 * fast/forms/input-number-unacceptable-style.html: Added. 10 1 11 2010-09-09 Kent Tamura <tkent@chromium.org> 2 12 -
trunk/WebCore/ChangeLog
r67165 r67166 1 2010-09-09 Kent Tamura <tkent@chromium.org> 2 3 Reviewed by Dimitri Glazkov. 4 5 Apply :invalid CSS class to <input type=number> with an unacceptable value 6 https://bugs.webkit.org/show_bug.cgi?id=45376 7 8 Apply :invalid CSS class to <input type=number> elements with an 9 unacceptable value in order to tell users that a value is not 10 valid. 11 12 Introducing Element::hasUnaccceptableValue(), and CSSStyleSelector 13 applies :invalid to not only elements with !isValidFormControlElement() 14 but also elements with hasUnaccceptableValue(). 15 16 HTMLInputElement and RenderTextControlSingleLine need some changes 17 to update style and to avoid updating renderer value during style 18 update. 19 20 Test: fast/forms/input-number-unacceptable-style.html 21 22 * css/CSSStyleSelector.cpp: 23 (WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector): 24 * dom/Element.h: 25 (WebCore::Element::hasUnacceptableValue): 26 * html/HTMLInputElement.cpp: 27 (WebCore::HTMLInputElement::handleBlurEvent): 28 (WebCore::HTMLInputElement::hasUnacceptableValue): 29 * html/HTMLInputElement.h: 30 * rendering/RenderTextControlSingleLine.cpp: 31 (WebCore::RenderTextControlSingleLine::subtreeHasChanged): 32 (WebCore::RenderTextControlSingleLine::updateFromElement): 33 1 34 2010-09-09 Kent Tamura <tkent@chromium.org> 2 35 -
trunk/WebCore/css/CSSStyleSelector.cpp
r67102 r67166 2577 2577 return false; 2578 2578 e->document()->setContainsValidityStyleRules(); 2579 return e->willValidate() && !e->isValidFormControlElement() ;2579 return e->willValidate() && !e->isValidFormControlElement() || e->hasUnacceptableValue(); 2580 2580 } case CSSSelector::PseudoChecked: { 2581 2581 if (!e || !e->isFormControlElement()) -
trunk/WebCore/dom/Element.h
r66954 r67166 283 283 virtual bool willValidate() const { return false; } 284 284 virtual bool isValidFormControlElement() { return false; } 285 virtual bool hasUnacceptableValue() const { return false; } 285 286 286 287 virtual bool formControlValueMatchesRenderer() const { return false; } -
trunk/WebCore/html/HTMLInputElement.cpp
r67164 r67166 829 829 void HTMLInputElement::handleBlurEvent() 830 830 { 831 // Reset the renderer value, which might be unmatched with the element value. 832 setFormControlValueMatchesRenderer(false); 831 if (inputType() == NUMBER) { 832 // Reset the renderer value, which might be unmatched with the element value. 833 setFormControlValueMatchesRenderer(false); 834 // We need to reset the renderer value explicitly because an unacceptable 835 // renderer value should be purged before style calculation. 836 if (renderer()) 837 renderer()->updateFromElement(); 838 } 833 839 InputElement::dispatchBlurEvent(this, this); 834 840 } … … 2692 2698 } 2693 2699 2700 bool HTMLInputElement::hasUnacceptableValue() const 2701 { 2702 return inputType() == NUMBER && renderer() && !isAcceptableValue(toRenderTextControl(renderer())->text()); 2703 } 2704 2694 2705 bool HTMLInputElement::needsActivationCallback() 2695 2706 { -
trunk/WebCore/html/HTMLInputElement.h
r67164 r67166 284 284 virtual bool isAcceptableValue(const String&) const; 285 285 virtual String sanitizeValue(const String&) const; 286 virtual bool hasUnacceptableValue() const; 286 287 287 288 virtual void documentDidBecomeActive(); -
trunk/WebCore/rendering/RenderTextControlSingleLine.cpp
r67164 r67166 174 174 if (input->isAcceptableValue(value)) 175 175 input->setValueFromRenderer(input->sanitizeValue(value)); 176 if (node()->isHTMLElement()) { 177 // Recalc for :invalid and hasUnacceptableValue() change. 178 static_cast<HTMLInputElement*>(input)->setNeedsStyleRecalc(); 179 } 176 180 177 181 if (m_cancelButton) … … 680 684 if (!inputElement()->suggestedValue().isNull()) 681 685 setInnerTextValue(inputElement()->suggestedValue()); 682 else 686 else if (!node()->isHTMLElement() || !static_cast<HTMLInputElement*>(node())->formControlValueMatchesRenderer()) 687 // For HTMLInputElement, update the renderer value only if the 688 // formControlValueMatchesRenderer() flag is false. It protects an 689 // unacceptable renderer value from being overwritten with the DOM value. 683 690 setInnerTextValue(inputElement()->value()); 684 691 }
Note: See TracChangeset
for help on using the changeset viewer.