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

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

Issue 1217943010: Add a FrameView lifecycle method that just updates layout, style and compositing. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 5 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/graphics/SVGImageChromeClient.cpp ('k') | Source/web/InspectorOverlayImpl.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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 return treeScope1->comparePosition(*treeScope2); 461 return treeScope1->comparePosition(*treeScope2);
462 } 462 }
463 463
464 void Internals::pauseAnimations(double pauseTime, ExceptionState& exceptionState ) 464 void Internals::pauseAnimations(double pauseTime, ExceptionState& exceptionState )
465 { 465 {
466 if (pauseTime < 0) { 466 if (pauseTime < 0) {
467 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages:: indexExceedsMinimumBound("pauseTime", pauseTime, 0.0)); 467 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages:: indexExceedsMinimumBound("pauseTime", pauseTime, 0.0));
468 return; 468 return;
469 } 469 }
470 470
471 frame()->view()->updateLayoutAndStyleForPainting(); 471 frame()->view()->updateAllLifecyclePhases();
472 frame()->document()->timeline().pauseAnimationsForTesting(pauseTime); 472 frame()->document()->timeline().pauseAnimationsForTesting(pauseTime);
473 } 473 }
474 474
475 bool Internals::isCompositedAnimation(Animation* animation) 475 bool Internals::isCompositedAnimation(Animation* animation)
476 { 476 {
477 return animation->hasActiveAnimationsOnCompositor(); 477 return animation->hasActiveAnimationsOnCompositor();
478 } 478 }
479 479
480 void Internals::advanceTimeForImage(Element* image, double deltaTimeInSeconds, E xceptionState& exceptionState) 480 void Internals::advanceTimeForImage(Element* image, double deltaTimeInSeconds, E xceptionState& exceptionState)
481 { 481 {
(...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1601 1601
1602 String Internals::layerTreeAsText(Document* document, ExceptionState& exceptionS tate) const 1602 String Internals::layerTreeAsText(Document* document, ExceptionState& exceptionS tate) const
1603 { 1603 {
1604 return layerTreeAsText(document, 0, exceptionState); 1604 return layerTreeAsText(document, 0, exceptionState);
1605 } 1605 }
1606 1606
1607 String Internals::elementLayerTreeAsText(Element* element, ExceptionState& excep tionState) const 1607 String Internals::elementLayerTreeAsText(Element* element, ExceptionState& excep tionState) const
1608 { 1608 {
1609 ASSERT(element); 1609 ASSERT(element);
1610 FrameView* frameView = element->document().view(); 1610 FrameView* frameView = element->document().view();
1611 frameView->updateLayoutAndStyleForPainting(); 1611 frameView->updateAllLifecyclePhases();
1612 1612
1613 return elementLayerTreeAsText(element, 0, exceptionState); 1613 return elementLayerTreeAsText(element, 0, exceptionState);
1614 } 1614 }
1615 1615
1616 bool Internals::scrollsWithRespectTo(Element* element1, Element* element2, Excep tionState& exceptionState) 1616 bool Internals::scrollsWithRespectTo(Element* element1, Element* element2, Excep tionState& exceptionState)
1617 { 1617 {
1618 ASSERT(element1 && element2); 1618 ASSERT(element1 && element2);
1619 element1->document().view()->updateLayoutAndStyleForPainting(); 1619 element1->document().view()->updateAllLifecyclePhases();
1620 1620
1621 LayoutObject* layoutObject1 = element1->layoutObject(); 1621 LayoutObject* layoutObject1 = element1->layoutObject();
1622 LayoutObject* layoutObject2 = element2->layoutObject(); 1622 LayoutObject* layoutObject2 = element2->layoutObject();
1623 if (!layoutObject1 || !layoutObject1->isBox()) { 1623 if (!layoutObject1 || !layoutObject1->isBox()) {
1624 exceptionState.throwDOMException(InvalidAccessError, layoutObject1 ? "Th e first provided element's layoutObject is not a box." : "The first provided ele ment has no layoutObject."); 1624 exceptionState.throwDOMException(InvalidAccessError, layoutObject1 ? "Th e first provided element's layoutObject is not a box." : "The first provided ele ment has no layoutObject.");
1625 return false; 1625 return false;
1626 } 1626 }
1627 if (!layoutObject2 || !layoutObject2->isBox()) { 1627 if (!layoutObject2 || !layoutObject2->isBox()) {
1628 exceptionState.throwDOMException(InvalidAccessError, layoutObject2 ? "Th e second provided element's layoutObject is not a box." : "The second provided e lement has no layoutObject."); 1628 exceptionState.throwDOMException(InvalidAccessError, layoutObject2 ? "Th e second provided element's layoutObject is not a box." : "The second provided e lement has no layoutObject.");
1629 return false; 1629 return false;
(...skipping 10 matching lines...) Expand all
1640 } 1640 }
1641 1641
1642 String Internals::layerTreeAsText(Document* document, unsigned flags, ExceptionS tate& exceptionState) const 1642 String Internals::layerTreeAsText(Document* document, unsigned flags, ExceptionS tate& exceptionState) const
1643 { 1643 {
1644 ASSERT(document); 1644 ASSERT(document);
1645 if (!document->frame()) { 1645 if (!document->frame()) {
1646 exceptionState.throwDOMException(InvalidAccessError, "The document provi ded is invalid."); 1646 exceptionState.throwDOMException(InvalidAccessError, "The document provi ded is invalid.");
1647 return String(); 1647 return String();
1648 } 1648 }
1649 1649
1650 document->view()->updateLayoutAndStyleForPainting(); 1650 document->view()->updateAllLifecyclePhases();
1651 1651
1652 return document->frame()->layerTreeAsText(flags); 1652 return document->frame()->layerTreeAsText(flags);
1653 } 1653 }
1654 1654
1655 String Internals::elementLayerTreeAsText(Element* element, unsigned flags, Excep tionState& exceptionState) const 1655 String Internals::elementLayerTreeAsText(Element* element, unsigned flags, Excep tionState& exceptionState) const
1656 { 1656 {
1657 ASSERT(element); 1657 ASSERT(element);
1658 element->document().updateLayout(); 1658 element->document().updateLayout();
1659 1659
1660 LayoutObject* layoutObject = element->layoutObject(); 1660 LayoutObject* layoutObject = element->layoutObject();
(...skipping 19 matching lines...) Expand all
1680 } 1680 }
1681 1681
1682 String Internals::mainThreadScrollingReasons(Document* document, ExceptionState& exceptionState) const 1682 String Internals::mainThreadScrollingReasons(Document* document, ExceptionState& exceptionState) const
1683 { 1683 {
1684 ASSERT(document); 1684 ASSERT(document);
1685 if (!document->frame()) { 1685 if (!document->frame()) {
1686 exceptionState.throwDOMException(InvalidAccessError, "The document provi ded is invalid."); 1686 exceptionState.throwDOMException(InvalidAccessError, "The document provi ded is invalid.");
1687 return String(); 1687 return String();
1688 } 1688 }
1689 1689
1690 document->frame()->view()->updateLayoutAndStyleForPainting(); 1690 document->frame()->view()->updateAllLifecyclePhases();
1691 1691
1692 Page* page = document->page(); 1692 Page* page = document->page();
1693 if (!page) 1693 if (!page)
1694 return String(); 1694 return String();
1695 1695
1696 return page->mainThreadScrollingReasonsAsText(); 1696 return page->mainThreadScrollingReasonsAsText();
1697 } 1697 }
1698 1698
1699 ClientRectList* Internals::nonFastScrollableRects(Document* document, ExceptionS tate& exceptionState) const 1699 ClientRectList* Internals::nonFastScrollableRects(Document* document, ExceptionS tate& exceptionState) const
1700 { 1700 {
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1905 1905
1906 void Internals::startTrackingRepaints(Document* document, ExceptionState& except ionState) 1906 void Internals::startTrackingRepaints(Document* document, ExceptionState& except ionState)
1907 { 1907 {
1908 ASSERT(document); 1908 ASSERT(document);
1909 if (!document->view()) { 1909 if (!document->view()) {
1910 exceptionState.throwDOMException(InvalidAccessError, "The document provi ded is invalid."); 1910 exceptionState.throwDOMException(InvalidAccessError, "The document provi ded is invalid.");
1911 return; 1911 return;
1912 } 1912 }
1913 1913
1914 FrameView* frameView = document->view(); 1914 FrameView* frameView = document->view();
1915 frameView->updateLayoutAndStyleForPainting(); 1915 frameView->updateAllLifecyclePhases();
1916 frameView->setTracksPaintInvalidations(true); 1916 frameView->setTracksPaintInvalidations(true);
1917 } 1917 }
1918 1918
1919 void Internals::stopTrackingRepaints(Document* document, ExceptionState& excepti onState) 1919 void Internals::stopTrackingRepaints(Document* document, ExceptionState& excepti onState)
1920 { 1920 {
1921 ASSERT(document); 1921 ASSERT(document);
1922 if (!document->view()) { 1922 if (!document->view()) {
1923 exceptionState.throwDOMException(InvalidAccessError, "The document provi ded is invalid."); 1923 exceptionState.throwDOMException(InvalidAccessError, "The document provi ded is invalid.");
1924 return; 1924 return;
1925 } 1925 }
1926 1926
1927 FrameView* frameView = document->view(); 1927 FrameView* frameView = document->view();
1928 frameView->updateLayoutAndStyleForPainting(); 1928 frameView->updateAllLifecyclePhases();
1929 frameView->setTracksPaintInvalidations(false); 1929 frameView->setTracksPaintInvalidations(false);
1930 } 1930 }
1931 1931
1932 void Internals::updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(Node* node, ExceptionState& exceptionState) 1932 void Internals::updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(Node* node, ExceptionState& exceptionState)
1933 { 1933 {
1934 Document* document; 1934 Document* document;
1935 if (!node) { 1935 if (!node) {
1936 document = contextDocument(); 1936 document = contextDocument();
1937 } else if (node->isDocumentNode()) { 1937 } else if (node->isDocumentNode()) {
1938 document = toDocument(node); 1938 document = toDocument(node);
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
2188 } 2188 }
2189 2189
2190 void Internals::forceCompositingUpdate(Document* document, ExceptionState& excep tionState) 2190 void Internals::forceCompositingUpdate(Document* document, ExceptionState& excep tionState)
2191 { 2191 {
2192 ASSERT(document); 2192 ASSERT(document);
2193 if (!document->layoutView()) { 2193 if (!document->layoutView()) {
2194 exceptionState.throwDOMException(InvalidAccessError, "The document provi ded is invalid."); 2194 exceptionState.throwDOMException(InvalidAccessError, "The document provi ded is invalid.");
2195 return; 2195 return;
2196 } 2196 }
2197 2197
2198 document->frame()->view()->updateLayoutAndStyleForPainting(); 2198 document->frame()->view()->updateAllLifecyclePhases();
2199 } 2199 }
2200 2200
2201 void Internals::setZoomFactor(float factor) 2201 void Internals::setZoomFactor(float factor)
2202 { 2202 {
2203 frame()->setPageZoomFactor(factor); 2203 frame()->setPageZoomFactor(factor);
2204 } 2204 }
2205 2205
2206 void Internals::setShouldRevealPassword(Element* element, bool reveal, Exception State& exceptionState) 2206 void Internals::setShouldRevealPassword(Element* element, bool reveal, Exception State& exceptionState)
2207 { 2207 {
2208 ASSERT(element); 2208 ASSERT(element);
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
2440 return ClientRectList::create(rects); 2440 return ClientRectList::create(rects);
2441 } 2441 }
2442 2442
2443 void Internals::setCapsLockState(bool enabled) 2443 void Internals::setCapsLockState(bool enabled)
2444 { 2444 {
2445 PlatformKeyboardEvent::setCurrentCapsLockState(enabled ? 2445 PlatformKeyboardEvent::setCurrentCapsLockState(enabled ?
2446 PlatformKeyboardEvent::OverrideCapsLockState::On : PlatformKeyboardEvent ::OverrideCapsLockState::Off); 2446 PlatformKeyboardEvent::OverrideCapsLockState::On : PlatformKeyboardEvent ::OverrideCapsLockState::Off);
2447 } 2447 }
2448 2448
2449 } // namespace blink 2449 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/svg/graphics/SVGImageChromeClient.cpp ('k') | Source/web/InspectorOverlayImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698