OLD | NEW |
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 1756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1767 if (!layer | 1767 if (!layer |
1768 || !layer->backing() | 1768 || !layer->backing() |
1769 || !layer->backing()->graphicsLayer()) { | 1769 || !layer->backing()->graphicsLayer()) { |
1770 // Don't raise exception in these cases which may be normally used in te
sts. | 1770 // Don't raise exception in these cases which may be normally used in te
sts. |
1771 return String(); | 1771 return String(); |
1772 } | 1772 } |
1773 | 1773 |
1774 return layer->backing()->graphicsLayer()->layerTreeAsText(flags); | 1774 return layer->backing()->graphicsLayer()->layerTreeAsText(flags); |
1775 } | 1775 } |
1776 | 1776 |
| 1777 static RenderLayer* getRenderLayerForElement(Element* element, ExceptionState& e
s) |
| 1778 { |
| 1779 if (!element) { |
| 1780 es.throwDOMException(InvalidAccessError); |
| 1781 return 0; |
| 1782 } |
| 1783 |
| 1784 RenderObject* renderer = element->renderer(); |
| 1785 if (!renderer || !renderer->isBox()) { |
| 1786 es.throwDOMException(InvalidAccessError); |
| 1787 return 0; |
| 1788 } |
| 1789 |
| 1790 RenderLayer* layer = toRenderBox(renderer)->layer(); |
| 1791 if (!layer) { |
| 1792 es.throwDOMException(InvalidAccessError); |
| 1793 return 0; |
| 1794 } |
| 1795 |
| 1796 return layer; |
| 1797 } |
| 1798 |
1777 void Internals::setNeedsCompositedScrolling(Element* element, unsigned needsComp
ositedScrolling, ExceptionState& es) | 1799 void Internals::setNeedsCompositedScrolling(Element* element, unsigned needsComp
ositedScrolling, ExceptionState& es) |
1778 { | 1800 { |
1779 if (!element) { | 1801 if (!element) { |
1780 es.throwDOMException(InvalidAccessError); | 1802 es.throwDOMException(InvalidAccessError); |
1781 return; | 1803 return; |
1782 } | 1804 } |
1783 | 1805 |
1784 element->document().updateLayout(); | 1806 element->document().updateLayout(); |
1785 | 1807 |
1786 RenderObject* renderer = element->renderer(); | 1808 if (RenderLayer* layer = getRenderLayerForElement(element, es)) |
1787 if (!renderer || !renderer->isBox()) { | 1809 layer->setForceNeedsCompositedScrolling(static_cast<RenderLayer::ForceNe
edsCompositedScrollingMode>(needsCompositedScrolling)); |
1788 es.throwDOMException(InvalidAccessError); | 1810 } |
1789 return; | |
1790 } | |
1791 | 1811 |
1792 RenderLayer* layer = toRenderBox(renderer)->layer(); | 1812 bool Internals::isScrollParent(Element* child, Element* parent, ExceptionState&
es) |
1793 if (!layer) { | 1813 { |
1794 es.throwDOMException(InvalidAccessError); | 1814 RenderLayer* childLayer = getRenderLayerForElement(child, es); |
1795 return; | 1815 RenderLayer* parentLayer = getRenderLayerForElement(parent, es); |
1796 } | 1816 return childLayer && parentLayer && childLayer->scrollParent() == parentLaye
r; |
| 1817 } |
1797 | 1818 |
1798 layer->setForceNeedsCompositedScrolling(static_cast<RenderLayer::ForceNeedsC
ompositedScrollingMode>(needsCompositedScrolling)); | 1819 bool Internals::isClipParent(Element* child, Element* parent, ExceptionState& es
) |
| 1820 { |
| 1821 RenderLayer* childLayer = getRenderLayerForElement(child, es); |
| 1822 RenderLayer* parentLayer = getRenderLayerForElement(parent, es); |
| 1823 return childLayer && parentLayer && childLayer->clipParent() == parentLayer; |
| 1824 } |
| 1825 |
| 1826 PassRefPtr<ClientRect> Internals::scrollClip(Element* element, ExceptionState& e
s) |
| 1827 { |
| 1828 RenderLayer* layer = getRenderLayerForElement(element, es); |
| 1829 if (!layer || !layer->backing() || !layer->backing()->scrollingLayer()) |
| 1830 return ClientRect::create(); |
| 1831 |
| 1832 return ClientRect::create( |
| 1833 FloatRect( |
| 1834 layer->backing()->scrollingLayer()->boundsOrigin(), |
| 1835 layer->backing()->scrollingLayer()->size())); |
| 1836 } |
| 1837 |
| 1838 PassRefPtr<ClientRect> Internals::ancestorScrollClip(Element* element, Exception
State& es) |
| 1839 { |
| 1840 RenderLayer* layer = getRenderLayerForElement(element, es); |
| 1841 if (!layer || !layer->backing() || !layer->backing()->ancestorScrollClipping
Layer()) |
| 1842 return ClientRect::create(); |
| 1843 |
| 1844 return ClientRect::create( |
| 1845 FloatRect( |
| 1846 layer->backing()->ancestorScrollClippingLayer()->boundsOrigin(), |
| 1847 layer->backing()->ancestorScrollClippingLayer()->size())); |
1799 } | 1848 } |
1800 | 1849 |
1801 String Internals::repaintRectsAsText(Document* document, ExceptionState& es) con
st | 1850 String Internals::repaintRectsAsText(Document* document, ExceptionState& es) con
st |
1802 { | 1851 { |
1803 if (!document || !document->frame()) { | 1852 if (!document || !document->frame()) { |
1804 es.throwDOMException(InvalidAccessError); | 1853 es.throwDOMException(InvalidAccessError); |
1805 return String(); | 1854 return String(); |
1806 } | 1855 } |
1807 | 1856 |
1808 return document->frame()->trackedRepaintRectsAsText(); | 1857 return document->frame()->trackedRepaintRectsAsText(); |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2223 return false; | 2272 return false; |
2224 sharedContext->getExtensions()->loseContextCHROMIUM(Extensions3D::GUILTY_CON
TEXT_RESET_ARB, Extensions3D::INNOCENT_CONTEXT_RESET_ARB); | 2273 sharedContext->getExtensions()->loseContextCHROMIUM(Extensions3D::GUILTY_CON
TEXT_RESET_ARB, Extensions3D::INNOCENT_CONTEXT_RESET_ARB); |
2225 // To prevent tests that call loseSharedGraphicsContext3D from being | 2274 // To prevent tests that call loseSharedGraphicsContext3D from being |
2226 // flaky, we call finish so that the context is guaranteed to be lost | 2275 // flaky, we call finish so that the context is guaranteed to be lost |
2227 // synchronously (i.e. before returning). | 2276 // synchronously (i.e. before returning). |
2228 sharedContext->finish(); | 2277 sharedContext->finish(); |
2229 return true; | 2278 return true; |
2230 } | 2279 } |
2231 | 2280 |
2232 } | 2281 } |
OLD | NEW |