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

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

Issue 654953002: Navigation transitions (web to native app): Get names and rects of transition elements (Step 2) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: re-add TypeChecking Created 6 years, 2 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 2226 matching lines...) Expand 10 before | Expand all | Expand 10 after
2237 return; 2237 return;
2238 } 2238 }
2239 networkStateNotifier().setWebConnectionTypeForTest(webtype); 2239 networkStateNotifier().setWebConnectionTypeForTest(webtype);
2240 } 2240 }
2241 2241
2242 unsigned Internals::countHitRegions(CanvasRenderingContext2D* context) 2242 unsigned Internals::countHitRegions(CanvasRenderingContext2D* context)
2243 { 2243 {
2244 return context->hitRegionsCount(); 2244 return context->hitRegionsCount();
2245 } 2245 }
2246 2246
2247 PassRefPtrWillBeRawPtr<ClientRect> Internals::boundsInRootViewSpace(Element* ele ment)
2248 {
2249 ASSERT(element);
2250 return ClientRect::create(element->boundsInRootViewSpace());
2251 }
2252
2247 String Internals::serializeNavigationMarkup() 2253 String Internals::serializeNavigationMarkup()
2248 { 2254 {
2249 Vector<Document::TransitionElementData> elementData; 2255 Vector<Document::TransitionElementData> elementData;
2250 frame()->document()->getTransitionElementData(elementData); 2256 frame()->document()->getTransitionElementData(elementData);
2251 2257
2252 StringBuilder markup; 2258 StringBuilder markup;
2253 Vector<Document::TransitionElementData>::iterator iter = elementData.begin() ; 2259 Vector<Document::TransitionElementData>::iterator iter = elementData.begin() ;
2254 for (; iter != elementData.end(); ++iter) 2260 for (; iter != elementData.end(); ++iter)
2255 markup.append(iter->markup); 2261 markup.append(iter->markup);
2256 2262
2257 return markup.toString(); 2263 return markup.toString();
2258 } 2264 }
2259 2265
2266 Vector<String> Internals::getTransitionElementNames()
2267 {
2268 Vector<Document::TransitionElementData> elementData;
2269 frame()->document()->getTransitionElementData(elementData);
2270
2271 Vector<String> names;
2272 Vector<Document::TransitionElementData>::iterator iter = elementData.begin() ;
sof 2014/10/24 15:17:14 Shorter as (the untested) for (const auto& elem
Zhen Wang 2014/10/27 14:14:45 I see other for loops using the traditional versio
2273 for (; iter != elementData.end(); ++iter) {
2274 Vector<String>::iterator jter = iter->names.begin();
2275 for (; jter != iter->names.end(); ++jter)
2276 names.append(*jter);
2277 }
2278
2279 return names;
2280 }
2281
2282 PassRefPtrWillBeRawPtr<ClientRectList> Internals::getTransitionElementRects()
2283 {
2284 Vector<Document::TransitionElementData> elementData;
2285 frame()->document()->getTransitionElementData(elementData);
2286
2287 Vector<IntRect> rects;
2288 Vector<Document::TransitionElementData>::iterator iter = elementData.begin() ;
sof 2014/10/24 15:17:14 Can also be shortened.
Zhen Wang 2014/10/27 14:14:45 ditto
2289 for (; iter != elementData.end(); ++iter) {
2290 Vector<IntRect>::iterator jter = iter->rects.begin();
2291 for (; jter != iter->rects.end(); ++jter)
2292 rects.append(*jter);
2293 }
2294
2295 Vector<FloatQuad> quads(rects.size());
2296 for (size_t i = 0; i < rects.size(); ++i)
2297 quads[i] = FloatRect(rects[i]);
2298 return ClientRectList::create(quads);
2299 }
2300
2260 void Internals::hideAllTransitionElements() 2301 void Internals::hideAllTransitionElements()
2261 { 2302 {
2262 Vector<Document::TransitionElementData> elementData; 2303 Vector<Document::TransitionElementData> elementData;
2263 frame()->document()->getTransitionElementData(elementData); 2304 frame()->document()->getTransitionElementData(elementData);
2264 2305
2265 Vector<Document::TransitionElementData>::iterator iter = elementData.begin() ; 2306 Vector<Document::TransitionElementData>::iterator iter = elementData.begin() ;
2266 for (; iter != elementData.end(); ++iter) 2307 for (; iter != elementData.end(); ++iter)
2267 frame()->document()->hideTransitionElements(AtomicString(iter->selector) ); 2308 frame()->document()->hideTransitionElements(AtomicString(iter->selector) );
2268 } 2309 }
2269 2310
(...skipping 14 matching lines...) Expand all
2284 } 2325 }
2285 toHTMLPlugInElement(element)->setPlaceholder(DictionaryPluginPlaceholder::cr eate(element->document(), options)); 2326 toHTMLPlugInElement(element)->setPlaceholder(DictionaryPluginPlaceholder::cr eate(element->document(), options));
2286 } 2327 }
2287 2328
2288 Iterator* Internals::iterator(ScriptState* scriptState, ExceptionState& exceptio nState) 2329 Iterator* Internals::iterator(ScriptState* scriptState, ExceptionState& exceptio nState)
2289 { 2330 {
2290 return new InternalsIterator; 2331 return new InternalsIterator;
2291 } 2332 }
2292 2333
2293 } // namespace blink 2334 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698