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

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: 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
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 850 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 } 901 }
901 902
902 void TextControlElement::copyNonAttributePropertiesFromElement( 903 void TextControlElement::copyNonAttributePropertiesFromElement(
903 const Element& source) { 904 const Element& source) {
904 const TextControlElement& sourceElement = 905 const TextControlElement& sourceElement =
905 static_cast<const TextControlElement&>(source); 906 static_cast<const TextControlElement&>(source);
906 m_lastChangeWasUserEdit = sourceElement.m_lastChangeWasUserEdit; 907 m_lastChangeWasUserEdit = sourceElement.m_lastChangeWasUserEdit;
907 HTMLFormControlElement::copyNonAttributePropertiesFromElement(source); 908 HTMLFormControlElement::copyNonAttributePropertiesFromElement(source);
908 } 909 }
909 910
911 void TextControlElement::disabledAttributeChanged() {
912 HTMLFormControlElement::disabledAttributeChanged();
913 removeSpellingAndGrammarMarkersOnInnerEditor();
914 }
915
916 void TextControlElement::readonlyAttributeChanged() {
917 HTMLFormControlElement::readonlyAttributeChanged();
918 removeSpellingAndGrammarMarkersOnInnerEditor();
919 }
920
921 void TextControlElement::removeSpellingAndGrammarMarkersOnInnerEditor() {
Xiaocheng 2017/02/03 04:54:07 This function seems unnecessary. I think checking
922 if (isDisabledOrReadOnly()) {
923 HTMLElement* innerEditor = innerEditorElement();
924 if (innerEditor) {
925 document().frame()->spellChecker().removeSpellingAndGrammarMarkers(
926 *innerEditor);
927 }
928 }
929 }
930
910 } // namespace blink 931 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698