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

Side by Side Diff: Source/core/testing/Internals.cpp

Issue 1215953003: Construct Internals with a ScriptState (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 5 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 | « Source/core/testing/Internals.h ('k') | Source/core/testing/Internals.idl » ('j') | 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2013 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 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 186
187 static SpellCheckRequester* spellCheckRequester(Document* document) 187 static SpellCheckRequester* spellCheckRequester(Document* document)
188 { 188 {
189 if (!document || !document->frame()) 189 if (!document || !document->frame())
190 return 0; 190 return 0;
191 return &document->frame()->spellChecker().spellCheckRequester(); 191 return &document->frame()->spellChecker().spellCheckRequester();
192 } 192 }
193 193
194 const char* Internals::internalsId = "internals"; 194 const char* Internals::internalsId = "internals";
195 195
196 Internals* Internals::create(Document* document) 196 Internals* Internals::create(ScriptState* scriptState)
197 { 197 {
198 return new Internals(document); 198 return new Internals(scriptState);
199 } 199 }
200 200
201 Internals::~Internals() 201 Internals::~Internals()
202 { 202 {
203 } 203 }
204 204
205 void Internals::resetToConsistentState(Page* page) 205 void Internals::resetToConsistentState(Page* page)
206 { 206 {
207 ASSERT(page); 207 ASSERT(page);
208 208
209 page->setDeviceScaleFactor(1); 209 page->setDeviceScaleFactor(1);
210 page->setIsCursorVisible(true); 210 page->setIsCursorVisible(true);
211 page->setPageScaleFactor(1, IntPoint(0, 0)); 211 page->setPageScaleFactor(1, IntPoint(0, 0));
212 overrideUserPreferredLanguages(Vector<AtomicString>()); 212 overrideUserPreferredLanguages(Vector<AtomicString>());
213 if (!page->deprecatedLocalMainFrame()->spellChecker().isContinuousSpellCheck ingEnabled()) 213 if (!page->deprecatedLocalMainFrame()->spellChecker().isContinuousSpellCheck ingEnabled())
214 page->deprecatedLocalMainFrame()->spellChecker().toggleContinuousSpellCh ecking(); 214 page->deprecatedLocalMainFrame()->spellChecker().toggleContinuousSpellCh ecking();
215 if (page->deprecatedLocalMainFrame()->editor().isOverwriteModeEnabled()) 215 if (page->deprecatedLocalMainFrame()->editor().isOverwriteModeEnabled())
216 page->deprecatedLocalMainFrame()->editor().toggleOverwriteModeEnabled(); 216 page->deprecatedLocalMainFrame()->editor().toggleOverwriteModeEnabled();
217 217
218 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator( )) 218 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator( ))
219 scrollingCoordinator->reset(); 219 scrollingCoordinator->reset();
220 220
221 page->deprecatedLocalMainFrame()->view()->clear(); 221 page->deprecatedLocalMainFrame()->view()->clear();
222 PlatformKeyboardEvent::setCurrentCapsLockState(PlatformKeyboardEvent::Overri deCapsLockState::Default); 222 PlatformKeyboardEvent::setCurrentCapsLockState(PlatformKeyboardEvent::Overri deCapsLockState::Default);
223 } 223 }
224 224
225 Internals::Internals(Document* document) 225 Internals::Internals(ScriptState* scriptState)
226 : ContextLifecycleObserver(document) 226 : ContextLifecycleObserver(scriptState->executionContext())
227 , m_runtimeFlags(InternalRuntimeFlags::create()) 227 , m_runtimeFlags(InternalRuntimeFlags::create())
228 { 228 {
229 } 229 }
230 230
231 Document* Internals::contextDocument() const 231 Document* Internals::contextDocument() const
232 { 232 {
233 return toDocument(executionContext()); 233 return toDocument(executionContext());
234 } 234 }
235 235
236 LocalFrame* Internals::frame() const 236 LocalFrame* Internals::frame() const
(...skipping 2203 matching lines...) Expand 10 before | Expand all | Expand 10 after
2440 return ClientRectList::create(rects); 2440 return ClientRectList::create(rects);
2441 } 2441 }
2442 2442
2443 void Internals::setCapsLockState(bool enabled) 2443 void Internals::setCapsLockState(bool enabled)
2444 { 2444 {
2445 PlatformKeyboardEvent::setCurrentCapsLockState(enabled ? 2445 PlatformKeyboardEvent::setCurrentCapsLockState(enabled ?
2446 PlatformKeyboardEvent::OverrideCapsLockState::On : PlatformKeyboardEvent ::OverrideCapsLockState::Off); 2446 PlatformKeyboardEvent::OverrideCapsLockState::On : PlatformKeyboardEvent ::OverrideCapsLockState::Off);
2447 } 2447 }
2448 2448
2449 } // namespace blink 2449 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/testing/Internals.h ('k') | Source/core/testing/Internals.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698