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

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

Issue 483163003: Introduce ES6 iterator for DOM objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "core/css/resolver/ViewportStyleResolver.h" 42 #include "core/css/resolver/ViewportStyleResolver.h"
43 #include "core/dom/ClientRect.h" 43 #include "core/dom/ClientRect.h"
44 #include "core/dom/ClientRectList.h" 44 #include "core/dom/ClientRectList.h"
45 #include "core/dom/DOMPoint.h" 45 #include "core/dom/DOMPoint.h"
46 #include "core/dom/DOMStringList.h" 46 #include "core/dom/DOMStringList.h"
47 #include "core/dom/Document.h" 47 #include "core/dom/Document.h"
48 #include "core/dom/DocumentMarker.h" 48 #include "core/dom/DocumentMarker.h"
49 #include "core/dom/DocumentMarkerController.h" 49 #include "core/dom/DocumentMarkerController.h"
50 #include "core/dom/Element.h" 50 #include "core/dom/Element.h"
51 #include "core/dom/ExceptionCode.h" 51 #include "core/dom/ExceptionCode.h"
52 #include "core/dom/Iterator.h"
52 #include "core/dom/NodeRenderStyle.h" 53 #include "core/dom/NodeRenderStyle.h"
53 #include "core/dom/PseudoElement.h" 54 #include "core/dom/PseudoElement.h"
54 #include "core/dom/Range.h" 55 #include "core/dom/Range.h"
55 #include "core/dom/StaticNodeList.h" 56 #include "core/dom/StaticNodeList.h"
56 #include "core/dom/StyleEngine.h" 57 #include "core/dom/StyleEngine.h"
57 #include "core/dom/TreeScope.h" 58 #include "core/dom/TreeScope.h"
58 #include "core/dom/ViewportDescription.h" 59 #include "core/dom/ViewportDescription.h"
59 #include "core/dom/shadow/ComposedTreeWalker.h" 60 #include "core/dom/shadow/ComposedTreeWalker.h"
60 #include "core/dom/shadow/ElementShadow.h" 61 #include "core/dom/shadow/ElementShadow.h"
61 #include "core/dom/shadow/SelectRuleFeatureSet.h" 62 #include "core/dom/shadow/SelectRuleFeatureSet.h"
62 #include "core/dom/shadow/ShadowRoot.h" 63 #include "core/dom/shadow/ShadowRoot.h"
63 #include "core/editing/Editor.h" 64 #include "core/editing/Editor.h"
64 #include "core/editing/PlainTextRange.h" 65 #include "core/editing/PlainTextRange.h"
65 #include "core/editing/SpellCheckRequester.h" 66 #include "core/editing/SpellCheckRequester.h"
66 #include "core/editing/SpellChecker.h" 67 #include "core/editing/SpellChecker.h"
67 #include "core/editing/SurroundingText.h" 68 #include "core/editing/SurroundingText.h"
68 #include "core/editing/TextIterator.h" 69 #include "core/editing/TextIterator.h"
69 #include "core/fetch/MemoryCache.h" 70 #include "core/fetch/MemoryCache.h"
70 #include "core/fetch/ResourceFetcher.h" 71 #include "core/fetch/ResourceFetcher.h"
71 #include "core/frame/LocalDOMWindow.h"
72 #include "core/frame/EventHandlerRegistry.h" 72 #include "core/frame/EventHandlerRegistry.h"
73 #include "core/frame/FrameConsole.h" 73 #include "core/frame/FrameConsole.h"
74 #include "core/frame/FrameView.h" 74 #include "core/frame/FrameView.h"
75 #include "core/frame/LocalDOMWindow.h"
75 #include "core/frame/LocalFrame.h" 76 #include "core/frame/LocalFrame.h"
76 #include "core/frame/Settings.h" 77 #include "core/frame/Settings.h"
77 #include "core/html/HTMLContentElement.h" 78 #include "core/html/HTMLContentElement.h"
78 #include "core/html/HTMLIFrameElement.h" 79 #include "core/html/HTMLIFrameElement.h"
79 #include "core/html/HTMLInputElement.h" 80 #include "core/html/HTMLInputElement.h"
80 #include "core/html/HTMLMediaElement.h" 81 #include "core/html/HTMLMediaElement.h"
81 #include "core/html/HTMLPlugInElement.h" 82 #include "core/html/HTMLPlugInElement.h"
82 #include "core/html/HTMLSelectElement.h" 83 #include "core/html/HTMLSelectElement.h"
83 #include "core/html/HTMLTextAreaElement.h" 84 #include "core/html/HTMLTextAreaElement.h"
84 #include "core/html/canvas/CanvasRenderingContext2D.h" 85 #include "core/html/canvas/CanvasRenderingContext2D.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 #include "public/platform/WebGraphicsContext3DProvider.h" 138 #include "public/platform/WebGraphicsContext3DProvider.h"
138 #include "public/platform/WebLayer.h" 139 #include "public/platform/WebLayer.h"
139 #include "wtf/InstanceCounter.h" 140 #include "wtf/InstanceCounter.h"
140 #include "wtf/PassOwnPtr.h" 141 #include "wtf/PassOwnPtr.h"
141 #include "wtf/dtoa.h" 142 #include "wtf/dtoa.h"
142 #include "wtf/text/StringBuffer.h" 143 #include "wtf/text/StringBuffer.h"
143 #include <v8.h> 144 #include <v8.h>
144 145
145 namespace blink { 146 namespace blink {
146 147
148 namespace {
149
150 class InternalsIterator FINAL : public Iterator {
151 public:
152 InternalsIterator() : m_current(0) { }
153
154 virtual ScriptValue next(ScriptState* scriptState, ExceptionState& exception State) OVERRIDE
155 {
156 v8::Isolate* isolate = scriptState->isolate();
157 v8::Local<v8::Value> value = v8::Integer::New(isolate, m_current * m_cur rent);
158 bool done = (m_current >= 5);
159 ++m_current;
160
161 v8::Local<v8::Object> result = v8::Object::New(isolate);
162 result->Set(v8String(isolate, "value"), value);
163 result->Set(v8String(isolate, "done"), v8Boolean(done, isolate));
164 return ScriptValue(scriptState, result);
165 }
166
167 virtual ScriptValue next(ScriptState* scriptState, ScriptValue value, Except ionState& exceptionState) OVERRIDE
168 {
169 exceptionState.throwTypeError("Not implemented");
170 return ScriptValue();
171 }
172
173 private:
174 int m_current;
175 };
176
177 } // namespace
178
147 // FIXME: oilpan: These will be removed soon. 179 // FIXME: oilpan: These will be removed soon.
148 static MockPagePopupDriver* s_pagePopupDriver = 0; 180 static MockPagePopupDriver* s_pagePopupDriver = 0;
149 181
150 using namespace HTMLNames; 182 using namespace HTMLNames;
151 183
152 static bool markerTypesFrom(const String& markerType, DocumentMarker::MarkerType s& result) 184 static bool markerTypesFrom(const String& markerType, DocumentMarker::MarkerType s& result)
153 { 185 {
154 if (markerType.isEmpty() || equalIgnoringCase(markerType, "all")) 186 if (markerType.isEmpty() || equalIgnoringCase(markerType, "all"))
155 result = DocumentMarker::AllMarkers(); 187 result = DocumentMarker::AllMarkers();
156 else if (equalIgnoringCase(markerType, "Spelling")) 188 else if (equalIgnoringCase(markerType, "Spelling"))
(...skipping 2067 matching lines...) Expand 10 before | Expand all | Expand 10 after
2224 return; 2256 return;
2225 } 2257 }
2226 if (!element->isPluginElement()) { 2258 if (!element->isPluginElement()) {
2227 exceptionState.throwDOMException(InvalidNodeTypeError, "The element prov ided is not a plugin."); 2259 exceptionState.throwDOMException(InvalidNodeTypeError, "The element prov ided is not a plugin.");
2228 return; 2260 return;
2229 } 2261 }
2230 element->ensureUserAgentShadowRoot().setInnerHTML(htmlSource, exceptionState ); 2262 element->ensureUserAgentShadowRoot().setInnerHTML(htmlSource, exceptionState );
2231 toHTMLPlugInElement(element)->setUsePlaceholderContent(true); 2263 toHTMLPlugInElement(element)->setUsePlaceholderContent(true);
2232 } 2264 }
2233 2265
2266 Iterator* Internals::iterator(ScriptState* scriptState, ExceptionState& exceptio nState)
2267 {
2268 return new InternalsIterator;
2269 }
2270
2234 } // namespace blink 2271 } // 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