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

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

Issue 2683853005: bindings: Make some value iterator properties aliases to Array.prototype functions (Closed)
Patch Set: Remove constexpr from Internals.h to fix the Android build 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) 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 #include "wtf/Optional.h" 150 #include "wtf/Optional.h"
151 #include "wtf/PtrUtil.h" 151 #include "wtf/PtrUtil.h"
152 #include "wtf/dtoa.h" 152 #include "wtf/dtoa.h"
153 #include "wtf/text/StringBuffer.h" 153 #include "wtf/text/StringBuffer.h"
154 #include <deque> 154 #include <deque>
155 #include <memory> 155 #include <memory>
156 #include <v8.h> 156 #include <v8.h>
157 157
158 namespace blink { 158 namespace blink {
159 159
160 namespace {
161
162 class InternalsIterationSource final
163 : public ValueIterable<int>::IterationSource {
164 public:
165 bool next(ScriptState* scriptState,
166 int& value,
167 ExceptionState& exceptionState) override {
168 if (m_index >= 5)
169 return false;
170 value = m_index * m_index;
171 return true;
172 }
173 };
174
175 } // namespace
176
177 static WTF::Optional<DocumentMarker::MarkerType> markerTypeFrom( 160 static WTF::Optional<DocumentMarker::MarkerType> markerTypeFrom(
178 const String& markerType) { 161 const String& markerType) {
179 if (equalIgnoringCase(markerType, "Spelling")) 162 if (equalIgnoringCase(markerType, "Spelling"))
180 return DocumentMarker::Spelling; 163 return DocumentMarker::Spelling;
181 if (equalIgnoringCase(markerType, "Grammar")) 164 if (equalIgnoringCase(markerType, "Grammar"))
182 return DocumentMarker::Grammar; 165 return DocumentMarker::Grammar;
183 if (equalIgnoringCase(markerType, "TextMatch")) 166 if (equalIgnoringCase(markerType, "TextMatch"))
184 return DocumentMarker::TextMatch; 167 return DocumentMarker::TextMatch;
185 return WTF::nullopt; 168 return WTF::nullopt;
186 } 169 }
(...skipping 2797 matching lines...) Expand 10 before | Expand all | Expand 10 after
2984 return frame()->view()->getScrollableArea()->getScrollOffset().width(); 2967 return frame()->view()->getScrollableArea()->getScrollOffset().width();
2985 } 2968 }
2986 2969
2987 float Internals::visualViewportScrollY() { 2970 float Internals::visualViewportScrollY() {
2988 if (!frame()) 2971 if (!frame())
2989 return 0; 2972 return 0;
2990 2973
2991 return frame()->view()->getScrollableArea()->getScrollOffset().height(); 2974 return frame()->view()->getScrollableArea()->getScrollOffset().height();
2992 } 2975 }
2993 2976
2994 ValueIterable<int>::IterationSource* Internals::startIteration(
2995 ScriptState*,
2996 ExceptionState&) {
2997 return new InternalsIterationSource();
2998 }
2999
3000 bool Internals::isUseCounted(Document* document, uint32_t feature) { 2977 bool Internals::isUseCounted(Document* document, uint32_t feature) {
3001 if (feature >= UseCounter::NumberOfFeatures) 2978 if (feature >= UseCounter::NumberOfFeatures)
3002 return false; 2979 return false;
3003 return UseCounter::isCounted(*document, 2980 return UseCounter::isCounted(*document,
3004 static_cast<UseCounter::Feature>(feature)); 2981 static_cast<UseCounter::Feature>(feature));
3005 } 2982 }
3006 2983
3007 bool Internals::isCSSPropertyUseCounted(Document* document, 2984 bool Internals::isCSSPropertyUseCounted(Document* document,
3008 const String& propertyName) { 2985 const String& propertyName) {
3009 return UseCounter::isCounted(*document, propertyName); 2986 return UseCounter::isCounted(*document, propertyName);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
3085 3062
3086 void Internals::crash() { 3063 void Internals::crash() {
3087 CHECK(false) << "Intentional crash"; 3064 CHECK(false) << "Intentional crash";
3088 } 3065 }
3089 3066
3090 void Internals::setIsLowEndDevice(bool isLowEndDevice) { 3067 void Internals::setIsLowEndDevice(bool isLowEndDevice) {
3091 MemoryCoordinator::setIsLowEndDeviceForTesting(isLowEndDevice); 3068 MemoryCoordinator::setIsLowEndDeviceForTesting(isLowEndDevice);
3092 } 3069 }
3093 3070
3094 } // namespace blink 3071 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/testing/Internals.h ('k') | third_party/WebKit/Source/core/testing/Internals.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698