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

Side by Side Diff: third_party/WebKit/Source/core/html/TextControlElement.cpp

Issue 2669213002: Remove spelling markers in disabled and readonly form elements
Patch Set: Use setNeedsWillValidateCheck() to avoid crashes Created 3 years, 10 months 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css/invalidation/read-only-write-pseudo-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 19 matching lines...) Expand all
30 #include "core/dom/Document.h" 30 #include "core/dom/Document.h"
31 #include "core/dom/ElementTraversal.h" 31 #include "core/dom/ElementTraversal.h"
32 #include "core/dom/Text.h" 32 #include "core/dom/Text.h"
33 #include "core/dom/shadow/ShadowRoot.h" 33 #include "core/dom/shadow/ShadowRoot.h"
34 #include "core/editing/EditingUtilities.h" 34 #include "core/editing/EditingUtilities.h"
35 #include "core/editing/Editor.h" 35 #include "core/editing/Editor.h"
36 #include "core/editing/FrameSelection.h" 36 #include "core/editing/FrameSelection.h"
37 #include "core/editing/iterators/CharacterIterator.h" 37 #include "core/editing/iterators/CharacterIterator.h"
38 #include "core/editing/iterators/TextIterator.h" 38 #include "core/editing/iterators/TextIterator.h"
39 #include "core/editing/serializers/Serialization.h" 39 #include "core/editing/serializers/Serialization.h"
40 #include "core/editing/spellcheck/SpellChecker.h"
40 #include "core/events/Event.h" 41 #include "core/events/Event.h"
41 #include "core/frame/LocalFrame.h" 42 #include "core/frame/LocalFrame.h"
42 #include "core/frame/UseCounter.h" 43 #include "core/frame/UseCounter.h"
43 #include "core/html/HTMLBRElement.h" 44 #include "core/html/HTMLBRElement.h"
44 #include "core/html/parser/HTMLParserIdioms.h" 45 #include "core/html/parser/HTMLParserIdioms.h"
45 #include "core/html/shadow/ShadowElementNames.h" 46 #include "core/html/shadow/ShadowElementNames.h"
46 #include "core/layout/LayoutBlock.h" 47 #include "core/layout/LayoutBlock.h"
47 #include "core/layout/LayoutBlockFlow.h" 48 #include "core/layout/LayoutBlockFlow.h"
48 #include "core/layout/LayoutTheme.h" 49 #include "core/layout/LayoutTheme.h"
49 #include "core/page/FocusController.h" 50 #include "core/page/FocusController.h"
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 if (params.name == autocapitalizeAttr) 707 if (params.name == autocapitalizeAttr)
707 UseCounter::count(document(), UseCounter::AutocapitalizeAttribute); 708 UseCounter::count(document(), UseCounter::AutocapitalizeAttribute);
708 709
709 if (params.name == placeholderAttr) { 710 if (params.name == placeholderAttr) {
710 updatePlaceholderText(); 711 updatePlaceholderText();
711 updatePlaceholderVisibility(); 712 updatePlaceholderVisibility();
712 UseCounter::count(document(), UseCounter::PlaceholderAttribute); 713 UseCounter::count(document(), UseCounter::PlaceholderAttribute);
713 } else { 714 } else {
714 HTMLFormControlElementWithState::parseAttribute(params); 715 HTMLFormControlElementWithState::parseAttribute(params);
715 } 716 }
717
718 if ((params.name == disabledAttr || params.name == readonlyAttr) &&
719 (params.oldValue.isNull() != params.newValue.isNull()) &&
720 isTextControl() && isDisabledOrReadOnly() && document().frame()) {
721 setNeedsWillValidateCheck();
tkent 2017/02/07 14:17:06 Why do we need setNeedsWillValidateCheck()?
Manuel Rego 2017/02/07 15:06:03 Now that we use parseAttribute() I need to call se
yosin_UTC9 2017/02/08 02:07:44 It seems we should refactor removeSpellingAndGramm
tkent 2017/02/08 02:12:14 Thanks. I understand. We handle |disabled| attri
Manuel Rego 2017/02/08 09:00:34 We still need to use hasEditableStyle() in removeS
722 document().frame()->spellChecker().didEndEditingOnTextField(this);
723 }
716 } 724 }
717 725
718 bool TextControlElement::lastChangeWasUserEdit() const { 726 bool TextControlElement::lastChangeWasUserEdit() const {
719 if (!isTextControl()) 727 if (!isTextControl())
720 return false; 728 return false;
721 return m_lastChangeWasUserEdit; 729 return m_lastChangeWasUserEdit;
722 } 730 }
723 731
724 Node* TextControlElement::createPlaceholderBreakElement() const { 732 Node* TextControlElement::createPlaceholderBreakElement() const {
725 return HTMLBRElement::create(document()); 733 return HTMLBRElement::create(document());
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 909
902 void TextControlElement::copyNonAttributePropertiesFromElement( 910 void TextControlElement::copyNonAttributePropertiesFromElement(
903 const Element& source) { 911 const Element& source) {
904 const TextControlElement& sourceElement = 912 const TextControlElement& sourceElement =
905 static_cast<const TextControlElement&>(source); 913 static_cast<const TextControlElement&>(source);
906 m_lastChangeWasUserEdit = sourceElement.m_lastChangeWasUserEdit; 914 m_lastChangeWasUserEdit = sourceElement.m_lastChangeWasUserEdit;
907 HTMLFormControlElement::copyNonAttributePropertiesFromElement(source); 915 HTMLFormControlElement::copyNonAttributePropertiesFromElement(source);
908 } 916 }
909 917
910 } // namespace blink 918 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css/invalidation/read-only-write-pseudo-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698