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

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

Issue 23890025: WIP (Introduce WTF::NonNullPtr<T>.) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/svg/animation/SVGSMILElement.cpp ('k') | Source/core/xml/XPathFunctions.cpp » ('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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 return isHTMLContentElement(insertionPoint) && toHTMLContentElement(insertio nPoint)->isSelectValid(); 312 return isHTMLContentElement(insertionPoint) && toHTMLContentElement(insertio nPoint)->isSelectValid();
313 } 313 }
314 314
315 Node* Internals::treeScopeRootNode(Node* node, ExceptionState& es) 315 Node* Internals::treeScopeRootNode(Node* node, ExceptionState& es)
316 { 316 {
317 if (!node) { 317 if (!node) {
318 es.throwDOMException(InvalidAccessError); 318 es.throwDOMException(InvalidAccessError);
319 return 0; 319 return 0;
320 } 320 }
321 321
322 return node->treeScope().rootNode(); 322 return node->treeScope()->rootNode();
323 } 323 }
324 324
325 Node* Internals::parentTreeScope(Node* node, ExceptionState& es) 325 Node* Internals::parentTreeScope(Node* node, ExceptionState& es)
326 { 326 {
327 if (!node) { 327 if (!node) {
328 es.throwDOMException(InvalidAccessError); 328 es.throwDOMException(InvalidAccessError);
329 return 0; 329 return 0;
330 } 330 }
331 const TreeScope* parentTreeScope = node->treeScope().parentTreeScope(); 331 const TreeScope* parentTreeScope = node->treeScope()->parentTreeScope();
332 return parentTreeScope ? parentTreeScope->rootNode() : 0; 332 return parentTreeScope ? parentTreeScope->rootNode() : 0;
333 } 333 }
334 334
335 bool Internals::hasSelectorForIdInShadow(Element* host, const String& idValue, E xceptionState& es) 335 bool Internals::hasSelectorForIdInShadow(Element* host, const String& idValue, E xceptionState& es)
336 { 336 {
337 if (!host || !host->shadow()) { 337 if (!host || !host->shadow()) {
338 es.throwDOMException(InvalidAccessError); 338 es.throwDOMException(InvalidAccessError);
339 return 0; 339 return 0;
340 } 340 }
341 341
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 return 0; 396 return 0;
397 } 397 }
398 const TreeScope* treeScope1 = node1->isDocumentNode() ? static_cast<const Tr eeScope*>(toDocument(node1)) : 398 const TreeScope* treeScope1 = node1->isDocumentNode() ? static_cast<const Tr eeScope*>(toDocument(node1)) :
399 node1->isShadowRoot() ? static_cast<const TreeScope*>(toShadowRoot(node1 )) : 0; 399 node1->isShadowRoot() ? static_cast<const TreeScope*>(toShadowRoot(node1 )) : 0;
400 const TreeScope* treeScope2 = node2->isDocumentNode() ? static_cast<const Tr eeScope*>(toDocument(node2)) : 400 const TreeScope* treeScope2 = node2->isDocumentNode() ? static_cast<const Tr eeScope*>(toDocument(node2)) :
401 node2->isShadowRoot() ? static_cast<const TreeScope*>(toShadowRoot(node2 )) : 0; 401 node2->isShadowRoot() ? static_cast<const TreeScope*>(toShadowRoot(node2 )) : 0;
402 if (!treeScope1 || !treeScope2) { 402 if (!treeScope1 || !treeScope2) {
403 es.throwDOMException(InvalidAccessError); 403 es.throwDOMException(InvalidAccessError);
404 return 0; 404 return 0;
405 } 405 }
406 return treeScope1->comparePosition(*treeScope2); 406 return treeScope1->comparePosition(treeScope2);
407 } 407 }
408 408
409 unsigned Internals::numberOfActiveAnimations() const 409 unsigned Internals::numberOfActiveAnimations() const
410 { 410 {
411 Frame* contextFrame = frame(); 411 Frame* contextFrame = frame();
412 if (RuntimeEnabledFeatures::webAnimationsCSSEnabled()) 412 if (RuntimeEnabledFeatures::webAnimationsCSSEnabled())
413 return frame()->document()->timeline()->numberOfActiveAnimationsForTesti ng(); 413 return frame()->document()->timeline()->numberOfActiveAnimationsForTesti ng();
414 if (AnimationController* controller = contextFrame->animation()) 414 return contextFrame->animation()->numberOfActiveAnimations(contextFrame->doc ument());
415 return controller->numberOfActiveAnimations(contextFrame->document());
416 return 0;
417 } 415 }
418 416
419 void Internals::suspendAnimations(Document* document, ExceptionState& es) const 417 void Internals::suspendAnimations(Document* document, ExceptionState& es) const
420 { 418 {
421 if (!document || !document->frame()) { 419 if (!document || !document->frame()) {
422 es.throwDOMException(InvalidAccessError); 420 es.throwDOMException(InvalidAccessError);
423 return; 421 return;
424 } 422 }
425 423
426 if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled()) { 424 if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled())
427 AnimationController* controller = document->frame()->animation(); 425 document->frame()->animation()->suspendAnimations();
428 if (!controller)
429 return;
430
431 controller->suspendAnimations();
432 }
433 } 426 }
434 427
435 void Internals::resumeAnimations(Document* document, ExceptionState& es) const 428 void Internals::resumeAnimations(Document* document, ExceptionState& es) const
436 { 429 {
437 if (!document || !document->frame()) { 430 if (!document || !document->frame()) {
438 es.throwDOMException(InvalidAccessError); 431 es.throwDOMException(InvalidAccessError);
439 return; 432 return;
440 } 433 }
441 434
442 if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled()) { 435 if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled())
443 AnimationController* controller = document->frame()->animation(); 436 document->frame()->animation()->resumeAnimations();
444 if (!controller)
445 return;
446
447 controller->resumeAnimations();
448 }
449 } 437 }
450 438
451 void Internals::pauseAnimations(double pauseTime, ExceptionState& es) 439 void Internals::pauseAnimations(double pauseTime, ExceptionState& es)
452 { 440 {
453 if (pauseTime < 0) { 441 if (pauseTime < 0) {
454 es.throwDOMException(InvalidAccessError); 442 es.throwDOMException(InvalidAccessError);
455 return; 443 return;
456 } 444 }
457 445
458 if (RuntimeEnabledFeatures::webAnimationsCSSEnabled()) 446 if (RuntimeEnabledFeatures::webAnimationsCSSEnabled())
(...skipping 1812 matching lines...) Expand 10 before | Expand all | Expand 10 after
2271 return false; 2259 return false;
2272 sharedContext->getExtensions()->loseContextCHROMIUM(Extensions3D::GUILTY_CON TEXT_RESET_ARB, Extensions3D::INNOCENT_CONTEXT_RESET_ARB); 2260 sharedContext->getExtensions()->loseContextCHROMIUM(Extensions3D::GUILTY_CON TEXT_RESET_ARB, Extensions3D::INNOCENT_CONTEXT_RESET_ARB);
2273 // To prevent tests that call loseSharedGraphicsContext3D from being 2261 // To prevent tests that call loseSharedGraphicsContext3D from being
2274 // flaky, we call finish so that the context is guaranteed to be lost 2262 // flaky, we call finish so that the context is guaranteed to be lost
2275 // synchronously (i.e. before returning). 2263 // synchronously (i.e. before returning).
2276 sharedContext->finish(); 2264 sharedContext->finish();
2277 return true; 2265 return true;
2278 } 2266 }
2279 2267
2280 } 2268 }
OLDNEW
« no previous file with comments | « Source/core/svg/animation/SVGSMILElement.cpp ('k') | Source/core/xml/XPathFunctions.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698