| OLD | NEW |
| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 #include "core/loader/HistoryItem.h" | 110 #include "core/loader/HistoryItem.h" |
| 111 #include "core/page/ChromeClient.h" | 111 #include "core/page/ChromeClient.h" |
| 112 #include "core/page/EventHandler.h" | 112 #include "core/page/EventHandler.h" |
| 113 #include "core/page/FocusController.h" | 113 #include "core/page/FocusController.h" |
| 114 #include "core/page/NetworkStateNotifier.h" | 114 #include "core/page/NetworkStateNotifier.h" |
| 115 #include "core/page/Page.h" | 115 #include "core/page/Page.h" |
| 116 #include "core/page/PrintContext.h" | 116 #include "core/page/PrintContext.h" |
| 117 #include "core/paint/DeprecatedPaintLayer.h" | 117 #include "core/paint/DeprecatedPaintLayer.h" |
| 118 #include "core/plugins/testing/DictionaryPluginPlaceholder.h" | 118 #include "core/plugins/testing/DictionaryPluginPlaceholder.h" |
| 119 #include "core/plugins/testing/DocumentFragmentPluginPlaceholder.h" | 119 #include "core/plugins/testing/DocumentFragmentPluginPlaceholder.h" |
| 120 #include "core/streams/ReadableStream2.h" |
| 120 #include "core/testing/DictionaryTest.h" | 121 #include "core/testing/DictionaryTest.h" |
| 121 #include "core/testing/GCObservation.h" | 122 #include "core/testing/GCObservation.h" |
| 122 #include "core/testing/InternalRuntimeFlags.h" | 123 #include "core/testing/InternalRuntimeFlags.h" |
| 123 #include "core/testing/InternalSettings.h" | 124 #include "core/testing/InternalSettings.h" |
| 124 #include "core/testing/LayerRect.h" | 125 #include "core/testing/LayerRect.h" |
| 125 #include "core/testing/LayerRectList.h" | 126 #include "core/testing/LayerRectList.h" |
| 126 #include "core/testing/PluginPlaceholderOptions.h" | 127 #include "core/testing/PluginPlaceholderOptions.h" |
| 127 #include "core/testing/PrivateScriptTest.h" | 128 #include "core/testing/PrivateScriptTest.h" |
| 128 #include "core/testing/TypeConversions.h" | 129 #include "core/testing/TypeConversions.h" |
| 129 #include "core/testing/UnionTypesTest.h" | 130 #include "core/testing/UnionTypesTest.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 | 186 |
| 186 static SpellCheckRequester* spellCheckRequester(Document* document) | 187 static SpellCheckRequester* spellCheckRequester(Document* document) |
| 187 { | 188 { |
| 188 if (!document || !document->frame()) | 189 if (!document || !document->frame()) |
| 189 return 0; | 190 return 0; |
| 190 return &document->frame()->spellChecker().spellCheckRequester(); | 191 return &document->frame()->spellChecker().spellCheckRequester(); |
| 191 } | 192 } |
| 192 | 193 |
| 193 const char* Internals::internalsId = "internals"; | 194 const char* Internals::internalsId = "internals"; |
| 194 | 195 |
| 195 Internals* Internals::create(Document* document) | 196 Internals* Internals::create(ScriptState* scriptState) |
| 196 { | 197 { |
| 197 return new Internals(document); | 198 return new Internals(scriptState); |
| 198 } | 199 } |
| 199 | 200 |
| 200 Internals::~Internals() | 201 Internals::~Internals() |
| 201 { | 202 { |
| 202 } | 203 } |
| 203 | 204 |
| 204 void Internals::resetToConsistentState(Page* page) | 205 void Internals::resetToConsistentState(Page* page) |
| 205 { | 206 { |
| 206 ASSERT(page); | 207 ASSERT(page); |
| 207 | 208 |
| 208 page->setDeviceScaleFactor(1); | 209 page->setDeviceScaleFactor(1); |
| 209 page->setIsCursorVisible(true); | 210 page->setIsCursorVisible(true); |
| 210 page->setPageScaleFactor(1, IntPoint(0, 0)); | 211 page->setPageScaleFactor(1, IntPoint(0, 0)); |
| 211 overrideUserPreferredLanguages(Vector<AtomicString>()); | 212 overrideUserPreferredLanguages(Vector<AtomicString>()); |
| 212 if (!page->deprecatedLocalMainFrame()->spellChecker().isContinuousSpellCheck
ingEnabled()) | 213 if (!page->deprecatedLocalMainFrame()->spellChecker().isContinuousSpellCheck
ingEnabled()) |
| 213 page->deprecatedLocalMainFrame()->spellChecker().toggleContinuousSpellCh
ecking(); | 214 page->deprecatedLocalMainFrame()->spellChecker().toggleContinuousSpellCh
ecking(); |
| 214 if (page->deprecatedLocalMainFrame()->editor().isOverwriteModeEnabled()) | 215 if (page->deprecatedLocalMainFrame()->editor().isOverwriteModeEnabled()) |
| 215 page->deprecatedLocalMainFrame()->editor().toggleOverwriteModeEnabled(); | 216 page->deprecatedLocalMainFrame()->editor().toggleOverwriteModeEnabled(); |
| 216 | 217 |
| 217 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator(
)) | 218 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator(
)) |
| 218 scrollingCoordinator->reset(); | 219 scrollingCoordinator->reset(); |
| 219 | 220 |
| 220 page->deprecatedLocalMainFrame()->view()->clear(); | 221 page->deprecatedLocalMainFrame()->view()->clear(); |
| 221 } | 222 } |
| 222 | 223 |
| 223 Internals::Internals(Document* document) | 224 namespace { |
| 224 : ContextLifecycleObserver(document) | 225 |
| 226 class TestUnderlyingSource : public UnderlyingSourceBase { |
| 227 public: |
| 228 ScriptPromise start(ScriptState* scriptState) override |
| 229 { |
| 230 controller().enqueue("a"); |
| 231 controller().enqueue("b"); |
| 232 controller().close(); |
| 233 return UnderlyingSourceBase::start(scriptState); |
| 234 }; |
| 235 }; |
| 236 |
| 237 class TestQueuingStrategy : public QueuingStrategyBase { |
| 238 public: |
| 239 TestQueuingStrategy() : QueuingStrategyBase(1024.0) { }; |
| 240 |
| 241 double size(ScriptValue chunk) override |
| 242 { |
| 243 return 0; |
| 244 } |
| 245 }; |
| 246 |
| 247 } // namespace |
| 248 |
| 249 Internals::Internals(ScriptState* scriptState) |
| 250 : ContextLifecycleObserver(scriptState->executionContext()) |
| 225 , m_runtimeFlags(InternalRuntimeFlags::create()) | 251 , m_runtimeFlags(InternalRuntimeFlags::create()) |
| 252 , m_readableStream(new ReadableStream2(scriptState, new TestUnderlyingSource
(), new TestQueuingStrategy())) |
| 226 { | 253 { |
| 227 } | 254 } |
| 228 | 255 |
| 229 Document* Internals::contextDocument() const | 256 Document* Internals::contextDocument() const |
| 230 { | 257 { |
| 231 return toDocument(executionContext()); | 258 return toDocument(executionContext()); |
| 232 } | 259 } |
| 233 | 260 |
| 234 LocalFrame* Internals::frame() const | 261 LocalFrame* Internals::frame() const |
| 235 { | 262 { |
| (...skipping 2127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2363 } | 2390 } |
| 2364 | 2391 |
| 2365 ClientRectList* Internals::focusRingRects(Element* element) | 2392 ClientRectList* Internals::focusRingRects(Element* element) |
| 2366 { | 2393 { |
| 2367 Vector<LayoutRect> rects; | 2394 Vector<LayoutRect> rects; |
| 2368 if (element && element->layoutObject()) | 2395 if (element && element->layoutObject()) |
| 2369 element->layoutObject()->addFocusRingRects(rects, LayoutPoint()); | 2396 element->layoutObject()->addFocusRingRects(rects, LayoutPoint()); |
| 2370 return ClientRectList::create(rects); | 2397 return ClientRectList::create(rects); |
| 2371 } | 2398 } |
| 2372 | 2399 |
| 2400 ScriptValue Internals::readableStream() |
| 2401 { |
| 2402 return m_readableStream->scriptValue(); |
| 2403 } |
| 2404 |
| 2373 } // namespace blink | 2405 } // namespace blink |
| OLD | NEW |