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

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: Using idle task to remove the markers Created 3 years, 9 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
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 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 if (params.name == autocapitalizeAttr) 741 if (params.name == autocapitalizeAttr)
741 UseCounter::count(document(), UseCounter::AutocapitalizeAttribute); 742 UseCounter::count(document(), UseCounter::AutocapitalizeAttribute);
742 743
743 if (params.name == placeholderAttr) { 744 if (params.name == placeholderAttr) {
744 updatePlaceholderText(); 745 updatePlaceholderText();
745 updatePlaceholderVisibility(); 746 updatePlaceholderVisibility();
746 UseCounter::count(document(), UseCounter::PlaceholderAttribute); 747 UseCounter::count(document(), UseCounter::PlaceholderAttribute);
747 } else { 748 } else {
748 HTMLFormControlElementWithState::parseAttribute(params); 749 HTMLFormControlElementWithState::parseAttribute(params);
749 } 750 }
751
752 if ((params.name == disabledAttr || params.name == readonlyAttr) &&
753 (params.oldValue.isNull() != params.newValue.isNull()) &&
754 isTextControl() && isDisabledOrReadOnly() && document().frame()) {
755 document().frame()->spellChecker().cancelCheck();
756 }
750 } 757 }
751 758
752 bool TextControlElement::lastChangeWasUserEdit() const { 759 bool TextControlElement::lastChangeWasUserEdit() const {
753 if (!isTextControl()) 760 if (!isTextControl())
754 return false; 761 return false;
755 return m_lastChangeWasUserEdit; 762 return m_lastChangeWasUserEdit;
756 } 763 }
757 764
758 Node* TextControlElement::createPlaceholderBreakElement() const { 765 Node* TextControlElement::createPlaceholderBreakElement() const {
759 return HTMLBRElement::create(document()); 766 return HTMLBRElement::create(document());
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 942
936 void TextControlElement::copyNonAttributePropertiesFromElement( 943 void TextControlElement::copyNonAttributePropertiesFromElement(
937 const Element& source) { 944 const Element& source) {
938 const TextControlElement& sourceElement = 945 const TextControlElement& sourceElement =
939 static_cast<const TextControlElement&>(source); 946 static_cast<const TextControlElement&>(source);
940 m_lastChangeWasUserEdit = sourceElement.m_lastChangeWasUserEdit; 947 m_lastChangeWasUserEdit = sourceElement.m_lastChangeWasUserEdit;
941 HTMLFormControlElement::copyNonAttributePropertiesFromElement(source); 948 HTMLFormControlElement::copyNonAttributePropertiesFromElement(source);
942 } 949 }
943 950
944 } // namespace blink 951 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698