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

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

Issue 244193002: Enable universal accelerated overflow scroll (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update test expectations for crashing test. Created 6 years, 8 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/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 1625 matching lines...) Expand 10 before | Expand all | Expand 10 after
1636 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages:: argumentNullOrIncorrectType(1, "Element")); 1636 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages:: argumentNullOrIncorrectType(1, "Element"));
1637 return String(); 1637 return String();
1638 } 1638 }
1639 1639
1640 FrameView* frameView = element->document().view(); 1640 FrameView* frameView = element->document().view();
1641 frameView->updateLayoutAndStyleForPainting(); 1641 frameView->updateLayoutAndStyleForPainting();
1642 1642
1643 return elementLayerTreeAsText(element, 0, exceptionState); 1643 return elementLayerTreeAsText(element, 0, exceptionState);
1644 } 1644 }
1645 1645
1646 static PassRefPtr<NodeList> paintOrderList(Element* element, ExceptionState& exc eptionState, RenderLayerStackingNode::PaintOrderListType type)
1647 {
1648 if (!element) {
1649 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages:: argumentNullOrIncorrectType(1, "Element"));
1650 return nullptr;
1651 }
1652
1653 element->document().updateLayout();
1654
1655 RenderObject* renderer = element->renderer();
1656 if (!renderer || !renderer->isBox()) {
1657 exceptionState.throwDOMException(InvalidAccessError, renderer ? "The pro vided element's renderer is not a box." : "The provided element has no renderer. ");
1658 return nullptr;
1659 }
1660
1661 RenderLayer* layer = toRenderBox(renderer)->layer();
1662 if (!layer) {
1663 exceptionState.throwDOMException(InvalidAccessError, "No render layer ca n be obtained from the provided element.");
1664 return nullptr;
1665 }
1666
1667 Vector<RefPtr<Node> > nodes;
1668 layer->stackingNode()->computePaintOrderList(type, nodes);
1669 return StaticNodeList::adopt(nodes);
1670 }
1671
1672 PassRefPtr<NodeList> Internals::paintOrderListBeforePromote(Element* element, Ex ceptionState& exceptionState)
1673 {
1674 return paintOrderList(element, exceptionState, RenderLayerStackingNode::Befo rePromote);
1675 }
1676
1677 PassRefPtr<NodeList> Internals::paintOrderListAfterPromote(Element* element, Exc eptionState& exceptionState)
1678 {
1679 return paintOrderList(element, exceptionState, RenderLayerStackingNode::Afte rPromote);
1680 }
1681
1682 bool Internals::scrollsWithRespectTo(Element* element1, Element* element2, Excep tionState& exceptionState) 1646 bool Internals::scrollsWithRespectTo(Element* element1, Element* element2, Excep tionState& exceptionState)
1683 { 1647 {
1684 if (!element1 || !element2) { 1648 if (!element1 || !element2) {
1685 exceptionState.throwDOMException(InvalidAccessError, String::format("The %s element provided is invalid.", element1 ? "second" : "first")); 1649 exceptionState.throwDOMException(InvalidAccessError, String::format("The %s element provided is invalid.", element1 ? "second" : "first"));
1686 return 0; 1650 return 0;
1687 } 1651 }
1688 1652
1689 element1->document().updateLayout(); 1653 element1->document().updateLayout();
1690 1654
1691 RenderObject* renderer1 = element1->renderer(); 1655 RenderObject* renderer1 = element1->renderer();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1726 1690
1727 RenderLayer* layer = toRenderBox(renderer)->layer(); 1691 RenderLayer* layer = toRenderBox(renderer)->layer();
1728 if (!layer) { 1692 if (!layer) {
1729 exceptionState.throwDOMException(InvalidAccessError, "No render layer ca n be obtained from the provided element."); 1693 exceptionState.throwDOMException(InvalidAccessError, "No render layer ca n be obtained from the provided element.");
1730 return 0; 1694 return 0;
1731 } 1695 }
1732 1696
1733 return layer->isUnclippedDescendant(); 1697 return layer->isUnclippedDescendant();
1734 } 1698 }
1735 1699
1736 bool Internals::needsCompositedScrolling(Element* element, ExceptionState& excep tionState)
1737 {
1738 if (!element) {
1739 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages:: argumentNullOrIncorrectType(1, "Element"));
1740 return 0;
1741 }
1742
1743 element->document().view()->updateLayoutAndStyleForPainting();
1744
1745 RenderObject* renderer = element->renderer();
1746 if (!renderer || !renderer->isBox()) {
1747 exceptionState.throwDOMException(InvalidAccessError, renderer ? "The pro vided element's renderer is not a box." : "The provided element has no renderer. ");
1748 return 0;
1749 }
1750
1751 RenderLayer* layer = toRenderBox(renderer)->layer();
1752 if (!layer) {
1753 exceptionState.throwDOMException(InvalidAccessError, "No render layer ca n be obtained from the provided element.");
1754 return 0;
1755 }
1756
1757 return layer->needsCompositedScrolling();
1758 }
1759
1760 String Internals::layerTreeAsText(Document* document, unsigned flags, ExceptionS tate& exceptionState) const 1700 String Internals::layerTreeAsText(Document* document, unsigned flags, ExceptionS tate& exceptionState) const
1761 { 1701 {
1762 if (!document || !document->frame()) { 1702 if (!document || !document->frame()) {
1763 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc ument's frame cannot be retrieved." : "The document provided is invalid."); 1703 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc ument's frame cannot be retrieved." : "The document provided is invalid.");
1764 return String(); 1704 return String();
1765 } 1705 }
1766 1706
1767 document->view()->updateLayoutAndStyleForPainting(); 1707 document->view()->updateLayoutAndStyleForPainting();
1768 1708
1769 return document->frame()->layerTreeAsText(flags); 1709 return document->frame()->layerTreeAsText(flags);
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
2431 String Internals::textSurroundingNode(Node* node, int x, int y, unsigned long ma xLength) 2371 String Internals::textSurroundingNode(Node* node, int x, int y, unsigned long ma xLength)
2432 { 2372 {
2433 if (!node) 2373 if (!node)
2434 return String(); 2374 return String();
2435 blink::WebPoint point(x, y); 2375 blink::WebPoint point(x, y);
2436 SurroundingText surroundingText(VisiblePosition(node->renderer()->positionFo rPoint(static_cast<IntPoint>(point))), maxLength); 2376 SurroundingText surroundingText(VisiblePosition(node->renderer()->positionFo rPoint(static_cast<IntPoint>(point))), maxLength);
2437 return surroundingText.content(); 2377 return surroundingText.content();
2438 } 2378 }
2439 2379
2440 } 2380 }
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