OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
594 LayoutSize offsetFromSquashLayerOrigin = LayoutPoint(m_squashedLayers[i] .offsetFromSquashingCLM) - squashLayerOriginInOwningLayerSpace; | 594 LayoutSize offsetFromSquashLayerOrigin = LayoutPoint(m_squashedLayers[i] .offsetFromSquashingCLM) - squashLayerOriginInOwningLayerSpace; |
595 m_squashedLayers[i].offsetFromRenderer = -flooredIntSize(offsetFromSquas hLayerOrigin); | 595 m_squashedLayers[i].offsetFromRenderer = -flooredIntSize(offsetFromSquas hLayerOrigin); |
596 | 596 |
597 m_squashedLayers[i].renderLayer->setSubpixelAccumulation(offsetFromSquas hLayerOrigin.fraction()); | 597 m_squashedLayers[i].renderLayer->setSubpixelAccumulation(offsetFromSquas hLayerOrigin.fraction()); |
598 ASSERT(m_squashedLayers[i].renderLayer->subpixelAccumulation() == | 598 ASSERT(m_squashedLayers[i].renderLayer->subpixelAccumulation() == |
599 toLayoutSize(computeOffsetFromCompositedAncestor(m_squashedLayers[i] .renderLayer, m_squashedLayers[i].renderLayer->ancestorCompositingLayer())).frac tion()); | 599 toLayoutSize(computeOffsetFromCompositedAncestor(m_squashedLayers[i] .renderLayer, m_squashedLayers[i].renderLayer->ancestorCompositingLayer())).frac tion()); |
600 | 600 |
601 // FIXME: find a better design to avoid this redundant value - most like ly it will make | 601 // FIXME: find a better design to avoid this redundant value - most like ly it will make |
602 // sense to move the paint task info into RenderLayer's m_compositingPro perties. | 602 // sense to move the paint task info into RenderLayer's m_compositingPro perties. |
603 m_squashedLayers[i].renderLayer->setOffsetFromSquashingLayerOrigin(m_squ ashedLayers[i].offsetFromRenderer); | 603 m_squashedLayers[i].renderLayer->setOffsetFromSquashingLayerOrigin(m_squ ashedLayers[i].offsetFromRenderer); |
604 | |
604 } | 605 } |
606 | |
607 for (size_t i = 0; i < m_squashedLayers.size(); ++i) | |
608 m_squashedLayers[i].localClipRectForSquashedLayer = localClipRectForSqua shedLayer(m_squashedLayers[i]); | |
605 } | 609 } |
606 | 610 |
607 void CompositedLayerMapping::updateGraphicsLayerGeometry(GraphicsLayerUpdater::U pdateType updateType, const RenderLayer* compositingContainer) | 611 void CompositedLayerMapping::updateGraphicsLayerGeometry(GraphicsLayerUpdater::U pdateType updateType, const RenderLayer* compositingContainer) |
608 { | 612 { |
609 // If we haven't built z-order lists yet, wait until later. | 613 // If we haven't built z-order lists yet, wait until later. |
610 if (m_owningLayer.stackingNode()->isStackingContainer() && m_owningLayer.sta ckingNode()->zOrderListsDirty()) | 614 if (m_owningLayer.stackingNode()->isStackingContainer() && m_owningLayer.sta ckingNode()->zOrderListsDirty()) |
611 return; | 615 return; |
612 | 616 |
613 if (!shouldUpdateGraphicsLayer(updateType)) | 617 if (!shouldUpdateGraphicsLayer(updateType)) |
614 return; | 618 return; |
(...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1827 | 1831 |
1828 // r is in the coordinate space of the layer's render object | 1832 // r is in the coordinate space of the layer's render object |
1829 void CompositedLayerMapping::setContentsNeedDisplayInRect(const IntRect& r) | 1833 void CompositedLayerMapping::setContentsNeedDisplayInRect(const IntRect& r) |
1830 { | 1834 { |
1831 // FIXME: need to split out repaints for the background. | 1835 // FIXME: need to split out repaints for the background. |
1832 ASSERT(!paintsIntoCompositedAncestor()); | 1836 ASSERT(!paintsIntoCompositedAncestor()); |
1833 SetContentsNeedsDisplayInRectFunctor functor = { r }; | 1837 SetContentsNeedsDisplayInRectFunctor functor = { r }; |
1834 ApplyToGraphicsLayers(this, functor, ApplyToContentLayers); | 1838 ApplyToGraphicsLayers(this, functor, ApplyToContentLayers); |
1835 } | 1839 } |
1836 | 1840 |
1841 const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer(co nst RenderObject* renderObject) const | |
1842 { | |
1843 for (size_t i = 0; i < m_squashedLayers.size(); ++i) { | |
1844 if (renderObject->isDescendantOf(m_squashedLayers[i].renderLayer->render er())) { | |
1845 return &m_squashedLayers[i]; | |
1846 break; | |
1847 } | |
1848 } | |
1849 return 0; | |
1850 } | |
1851 | |
1852 IntRect CompositedLayerMapping::localClipRectForSquashedLayer(const GraphicsLaye rPaintInfo& paintInfo) const | |
1853 { | |
1854 const RenderObject* clippingContainer = paintInfo.renderLayer->renderer()->c lippingContainer(); | |
1855 if (clippingContainer == m_owningLayer.renderer()->clippingContainer()) | |
1856 return PaintInfo::infiniteRect(); | |
1857 | |
1858 ASSERT(clippingContainer); | |
1859 | |
1860 const GraphicsLayerPaintInfo* ancestorPaintInfo = containingSquashedLayer(cl ippingContainer); | |
1861 // Must be there, otherwise CompositingLayerAssigner::canSquashIntoCurrentSq uashingOwner would have disallowed squashing. | |
1862 ASSERT(ancestorPaintInfo); | |
1863 | |
1864 ClipRectsContext clipRectsContext(ancestorPaintInfo->renderLayer, TemporaryC lipRects); | |
Ian Vollick
2014/05/08 20:56:19
This could hurt perf. Even if we don't figure out
chrishtr
2014/05/08 20:58:15
Added a FIXME.
| |
1865 IntRect parentClipRect = pixelSnappedIntRect(paintInfo.renderLayer->clipper( ).backgroundClipRect(clipRectsContext).rect()); | |
1866 ASSERT(parentClipRect != PaintInfo::infiniteRect()); | |
1867 | |
1868 // Convert from ancestor to local coordinates. | |
1869 IntSize ancestorToLocalOffset = paintInfo.offsetFromRenderer - ancestorPaint Info->offsetFromRenderer; | |
1870 parentClipRect.move(ancestorToLocalOffset); | |
1871 return parentClipRect; | |
1872 } | |
1873 | |
1837 void CompositedLayerMapping::doPaintTask(GraphicsLayerPaintInfo& paintInfo, Grap hicsContext* context, | 1874 void CompositedLayerMapping::doPaintTask(GraphicsLayerPaintInfo& paintInfo, Grap hicsContext* context, |
1838 const IntRect& clip) // In the coords of rootLayer. | 1875 const IntRect& clip) // In the coords of rootLayer. |
1839 { | 1876 { |
1840 if (paintsIntoCompositedAncestor()) { | 1877 if (paintsIntoCompositedAncestor()) { |
1841 ASSERT_NOT_REACHED(); | 1878 ASSERT_NOT_REACHED(); |
1842 return; | 1879 return; |
1843 } | 1880 } |
1844 | 1881 |
1845 FontCachePurgePreventer fontCachePurgePreventer; | 1882 FontCachePurgePreventer fontCachePurgePreventer; |
1846 | 1883 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1895 | 1932 |
1896 ASSERT(!paintInfo.isBackgroundLayer || paintFlags & PaintLayerPaintingRo otBackgroundOnly); | 1933 ASSERT(!paintInfo.isBackgroundLayer || paintFlags & PaintLayerPaintingRo otBackgroundOnly); |
1897 | 1934 |
1898 if (paintInfo.renderLayer->containsDirtyOverlayScrollbars()) | 1935 if (paintInfo.renderLayer->containsDirtyOverlayScrollbars()) |
1899 paintInfo.renderLayer->paintLayerContents(context, paintingInfo, pai ntFlags | PaintLayerPaintingOverlayScrollbars); | 1936 paintInfo.renderLayer->paintLayerContents(context, paintingInfo, pai ntFlags | PaintLayerPaintingOverlayScrollbars); |
1900 } else { | 1937 } else { |
1901 ASSERT(compositor()->layerSquashingEnabled()); | 1938 ASSERT(compositor()->layerSquashingEnabled()); |
1902 LayerPaintingInfo paintingInfo(paintInfo.renderLayer, dirtyRect, PaintBe haviorNormal, paintInfo.renderLayer->subpixelAccumulation()); | 1939 LayerPaintingInfo paintingInfo(paintInfo.renderLayer, dirtyRect, PaintBe haviorNormal, paintInfo.renderLayer->subpixelAccumulation()); |
1903 | 1940 |
1904 // RenderLayer::paintLayer assumes that the caller clips to the passed r ect. Squashed layers need to do this clipping in software, | 1941 // RenderLayer::paintLayer assumes that the caller clips to the passed r ect. Squashed layers need to do this clipping in software, |
1905 // since there is no graphics layer to clip them precisely. | 1942 // since there is no graphics layer to clip them precisely. Furthermore, in some cases we squash layers that need clipping in software |
1906 // FIXME: in some cases this clip is not necessary. For example if the d irty rect is not the same as the bounds of the layer, | 1943 // from clipping ancestors (see CompositedLayerMapping::localClipRectFor SquashedLayer()). |
1907 // RenderLayer will clip it (see RenderLayer::clipToRect). Put in more w ork if this becomes a performance issue. | |
1908 context->save(); | 1944 context->save(); |
1945 dirtyRect.intersect(paintInfo.localClipRectForSquashedLayer); | |
1909 context->clip(dirtyRect); | 1946 context->clip(dirtyRect); |
1910 paintInfo.renderLayer->paintLayer(context, paintingInfo, paintFlags); | 1947 paintInfo.renderLayer->paintLayer(context, paintingInfo, paintFlags); |
1911 context->restore(); | 1948 context->restore(); |
1912 } | 1949 } |
1913 | 1950 |
1914 ASSERT(!paintInfo.renderLayer->usedTransparency()); | 1951 ASSERT(!paintInfo.renderLayer->usedTransparency()); |
1915 | 1952 |
1916 // Manually restore the context to its original state by applying the opposi te translation. | 1953 // Manually restore the context to its original state by applying the opposi te translation. |
1917 context->translate(offset); | 1954 context->translate(offset); |
1918 } | 1955 } |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2113 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { | 2150 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { |
2114 name = "Scrolling Contents Layer"; | 2151 name = "Scrolling Contents Layer"; |
2115 } else { | 2152 } else { |
2116 ASSERT_NOT_REACHED(); | 2153 ASSERT_NOT_REACHED(); |
2117 } | 2154 } |
2118 | 2155 |
2119 return name; | 2156 return name; |
2120 } | 2157 } |
2121 | 2158 |
2122 } // namespace WebCore | 2159 } // namespace WebCore |
OLD | NEW |