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

Side by Side Diff: third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp

Issue 2795113002: Move ownership of TextCheckerClientImpl to WebLocalFrameImpl (Closed)
Patch Set: Mon Apr 3 18:57:07 PDT 2017 Created 3 years, 8 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) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
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 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 DEFINE_STATIC_LOCAL(EmptySpellCheckerClient, client, ()); 101 DEFINE_STATIC_LOCAL(EmptySpellCheckerClient, client, ());
102 return client; 102 return client;
103 } 103 }
104 104
105 SpellCheckerClient& SpellChecker::spellCheckerClient() const { 105 SpellCheckerClient& SpellChecker::spellCheckerClient() const {
106 if (Page* page = frame().page()) 106 if (Page* page = frame().page())
107 return page->spellCheckerClient(); 107 return page->spellCheckerClient();
108 return emptySpellCheckerClient(); 108 return emptySpellCheckerClient();
109 } 109 }
110 110
111 static TextCheckerClient& emptyTextCheckerClient() {
112 DEFINE_STATIC_LOCAL(EmptyTextCheckerClient, client, ());
113 return client;
114 }
115
111 TextCheckerClient& SpellChecker::textChecker() const { 116 TextCheckerClient& SpellChecker::textChecker() const {
112 return spellCheckerClient().textChecker(); 117 if (TextCheckerClient* textChecker = frame().client()->textCheckerClient())
118 return *textChecker;
119 return emptyTextCheckerClient();
113 } 120 }
114 121
115 SpellChecker::SpellChecker(LocalFrame& frame) 122 SpellChecker::SpellChecker(LocalFrame& frame)
116 : m_frame(&frame), 123 : m_frame(&frame),
117 m_spellCheckRequester(SpellCheckRequester::create(frame)), 124 m_spellCheckRequester(SpellCheckRequester::create(frame)),
118 m_idleSpellCheckCallback(IdleSpellCheckCallback::create(frame)) {} 125 m_idleSpellCheckCallback(IdleSpellCheckCallback::create(frame)) {}
119 126
120 bool SpellChecker::isSpellCheckingEnabled() const { 127 bool SpellChecker::isSpellCheckingEnabled() const {
121 return spellCheckerClient().isSpellCheckingEnabled(); 128 return spellCheckerClient().isSpellCheckingEnabled();
122 } 129 }
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 if (!input.isFocusedElementInDocument()) 1183 if (!input.isFocusedElementInDocument())
1177 return false; 1184 return false;
1178 } 1185 }
1179 } 1186 }
1180 HTMLElement* element = 1187 HTMLElement* element =
1181 Traversal<HTMLElement>::firstAncestorOrSelf(*position.anchorNode()); 1188 Traversal<HTMLElement>::firstAncestorOrSelf(*position.anchorNode());
1182 return element && element->isSpellCheckingEnabled(); 1189 return element && element->isSpellCheckingEnabled();
1183 } 1190 }
1184 1191
1185 } // namespace blink 1192 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698