Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: Source/core/html/forms/TextFieldInputType.cpp

Issue 620333002: Use invalidation sets for :invalid/:valid/:required/:optional. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * Copyright (C) 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2011 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 484
485 bool wasChanged = element().wasChangedSinceLastFormControlChangeEvent(); 485 bool wasChanged = element().wasChangedSinceLastFormControlChangeEvent();
486 element().setChangedSinceLastFormControlChangeEvent(true); 486 element().setChangedSinceLastFormControlChangeEvent(true);
487 487
488 // We don't need to call sanitizeUserInputValue() function here because 488 // We don't need to call sanitizeUserInputValue() function here because
489 // HTMLInputElement::handleBeforeTextInsertedEvent() has already called 489 // HTMLInputElement::handleBeforeTextInsertedEvent() has already called
490 // sanitizeUserInputValue(). 490 // sanitizeUserInputValue().
491 // sanitizeValue() is needed because IME input doesn't dispatch BeforeTextIn sertedEvent. 491 // sanitizeValue() is needed because IME input doesn't dispatch BeforeTextIn sertedEvent.
492 element().setValueFromRenderer(sanitizeValue(convertFromVisibleValue(element ().innerEditorValue()))); 492 element().setValueFromRenderer(sanitizeValue(convertFromVisibleValue(element ().innerEditorValue())));
493 element().updatePlaceholderVisibility(false); 493 element().updatePlaceholderVisibility(false);
494 // Recalc for :invalid change. 494 element().pseudoStateChanged(CSSSelector::PseudoValid);
495 element().setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracin g::createWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Inv alid)); 495 element().pseudoStateChanged(CSSSelector::PseudoInvalid);
496 496
497 didSetValueByUserEdit(wasChanged ? ValueChangeStateChanged : ValueChangeStat eNone); 497 didSetValueByUserEdit(wasChanged ? ValueChangeStateChanged : ValueChangeStat eNone);
498 } 498 }
499 499
500 void TextFieldInputType::didSetValueByUserEdit(ValueChangeState state) 500 void TextFieldInputType::didSetValueByUserEdit(ValueChangeState state)
501 { 501 {
502 if (!element().focused()) 502 if (!element().focused())
503 return; 503 return;
504 if (Chrome* chrome = this->chrome()) 504 if (Chrome* chrome = this->chrome())
505 chrome->client().didChangeValueInTextField(element()); 505 chrome->client().didChangeValueInTextField(element());
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 return shouldSpinButtonRespondToMouseEvents() && element().focused(); 549 return shouldSpinButtonRespondToMouseEvents() && element().focused();
550 } 550 }
551 551
552 void TextFieldInputType::spinButtonDidReleaseMouseCapture(SpinButtonElement::Eve ntDispatch eventDispatch) 552 void TextFieldInputType::spinButtonDidReleaseMouseCapture(SpinButtonElement::Eve ntDispatch eventDispatch)
553 { 553 {
554 if (eventDispatch == SpinButtonElement::EventDispatchAllowed) 554 if (eventDispatch == SpinButtonElement::EventDispatchAllowed)
555 element().dispatchFormControlChangeEvent(); 555 element().dispatchFormControlChangeEvent();
556 } 556 }
557 557
558 } // namespace blink 558 } // namespace blink
OLDNEW
« Source/core/html/HTMLFormControlElement.cpp ('K') | « Source/core/html/HTMLFormElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698