OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. |
3 * | 3 * |
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
5 * | 5 * |
6 * Other contributors: | 6 * Other contributors: |
7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
(...skipping 1816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1827 LayoutPoint offsetFromRoot; | 1827 LayoutPoint offsetFromRoot; |
1828 convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot); | 1828 convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot); |
1829 | 1829 |
1830 if (compositingState() == PaintsIntoOwnBacking) | 1830 if (compositingState() == PaintsIntoOwnBacking) |
1831 offsetFromRoot.move(subpixelAccumulation()); | 1831 offsetFromRoot.move(subpixelAccumulation()); |
1832 | 1832 |
1833 LayoutRect rootRelativeBounds; | 1833 LayoutRect rootRelativeBounds; |
1834 bool rootRelativeBoundsComputed = false; | 1834 bool rootRelativeBoundsComputed = false; |
1835 | 1835 |
1836 // Apply clip-path to context. | 1836 // Apply clip-path to context. |
1837 bool hasClipPath = false; | 1837 GraphicsContextStateSaver clipStateSaver(*context, false); |
1838 RenderStyle* style = renderer()->style(); | 1838 RenderStyle* style = renderer()->style(); |
1839 RenderSVGResourceClipper* resourceClipper = 0; | 1839 RenderSVGResourceClipper* resourceClipper = 0; |
1840 ClipperContext clipperContext; | 1840 ClipperContext clipperContext; |
1841 | 1841 |
1842 // Clip-path, like border radius, must not be applied to the contents of a c
omposited-scrolling container. | 1842 // Clip-path, like border radius, must not be applied to the contents of a c
omposited-scrolling container. |
1843 // It must, however, still be applied to the mask layer, so that the composi
tor can properly mask the | 1843 // It must, however, still be applied to the mask layer, so that the composi
tor can properly mask the |
1844 // scrolling contents and scrollbars. | 1844 // scrolling contents and scrollbars. |
1845 if (renderer()->hasClipPath() && !context->paintingDisabled() && style && (!
needsCompositedScrolling() || paintFlags & PaintLayerPaintingChildClippingMaskPh
ase)) { | 1845 if (renderer()->hasClipPath() && !context->paintingDisabled() && style && (!
needsCompositedScrolling() || paintFlags & PaintLayerPaintingChildClippingMaskPh
ase)) { |
1846 ASSERT(style->clipPath()); | 1846 ASSERT(style->clipPath()); |
1847 if (style->clipPath()->type() == ClipPathOperation::SHAPE) { | 1847 if (style->clipPath()->type() == ClipPathOperation::SHAPE) { |
1848 hasClipPath = true; | 1848 clipStateSaver.save(); |
1849 context->save(); | |
1850 ShapeClipPathOperation* clipPath = toShapeClipPathOperation(style->c
lipPath()); | 1849 ShapeClipPathOperation* clipPath = toShapeClipPathOperation(style->c
lipPath()); |
1851 | 1850 |
1852 if (!rootRelativeBoundsComputed) { | 1851 if (!rootRelativeBoundsComputed) { |
1853 rootRelativeBounds = physicalBoundingBoxIncludingReflectionAndSt
ackingChildren(paintingInfo.rootLayer, offsetFromRoot); | 1852 rootRelativeBounds = physicalBoundingBoxIncludingReflectionAndSt
ackingChildren(paintingInfo.rootLayer, offsetFromRoot); |
1854 rootRelativeBoundsComputed = true; | 1853 rootRelativeBoundsComputed = true; |
1855 } | 1854 } |
1856 | 1855 |
1857 context->clipPath(clipPath->path(rootRelativeBounds), clipPath->wind
Rule()); | 1856 context->clipPath(clipPath->path(rootRelativeBounds), clipPath->wind
Rule()); |
1858 } else if (style->clipPath()->type() == ClipPathOperation::REFERENCE) { | 1857 } else if (style->clipPath()->type() == ClipPathOperation::REFERENCE) { |
1859 ReferenceClipPathOperation* referenceClipPathOperation = toReference
ClipPathOperation(style->clipPath()); | 1858 ReferenceClipPathOperation* referenceClipPathOperation = toReference
ClipPathOperation(style->clipPath()); |
1860 Document& document = renderer()->document(); | 1859 Document& document = renderer()->document(); |
1861 // FIXME: It doesn't work with forward or external SVG references (h
ttps://bugs.webkit.org/show_bug.cgi?id=90405) | 1860 // FIXME: It doesn't work with forward or external SVG references (h
ttps://bugs.webkit.org/show_bug.cgi?id=90405) |
1862 Element* element = document.getElementById(referenceClipPathOperatio
n->fragment()); | 1861 Element* element = document.getElementById(referenceClipPathOperatio
n->fragment()); |
1863 if (isSVGClipPathElement(element) && element->renderer()) { | 1862 if (isSVGClipPathElement(element) && element->renderer()) { |
| 1863 // FIXME: Saving at this point is not required in the 'mask'- |
| 1864 // case, or if the clip ends up empty. |
| 1865 clipStateSaver.save(); |
1864 if (!rootRelativeBoundsComputed) { | 1866 if (!rootRelativeBoundsComputed) { |
1865 rootRelativeBounds = physicalBoundingBoxIncludingReflectionA
ndStackingChildren(paintingInfo.rootLayer, offsetFromRoot); | 1867 rootRelativeBounds = physicalBoundingBoxIncludingReflectionA
ndStackingChildren(paintingInfo.rootLayer, offsetFromRoot); |
1866 rootRelativeBoundsComputed = true; | 1868 rootRelativeBoundsComputed = true; |
1867 } | 1869 } |
1868 | 1870 |
1869 resourceClipper = toRenderSVGResourceClipper(toRenderSVGResource
Container(element->renderer())); | 1871 resourceClipper = toRenderSVGResourceClipper(toRenderSVGResource
Container(element->renderer())); |
1870 if (!resourceClipper->applyClippingToContext(renderer(), rootRel
ativeBounds, | 1872 if (!resourceClipper->applyClippingToContext(renderer(), rootRel
ativeBounds, |
1871 paintingInfo.paintDirtyRect, context, clipperContext)) { | 1873 paintingInfo.paintDirtyRect, context, clipperContext)) { |
1872 // No need to post-apply the clipper if this failed. | 1874 // No need to post-apply the clipper if this failed. |
1873 resourceClipper = 0; | 1875 resourceClipper = 0; |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2002 | 2004 |
2003 // End our transparency layer | 2005 // End our transparency layer |
2004 if ((haveTransparency || paintsWithBlendMode() || createTransparencyLayerFor
BlendMode) && m_usedTransparency && !(m_reflectionInfo && m_reflectionInfo->isPa
intingInsideReflection())) { | 2006 if ((haveTransparency || paintsWithBlendMode() || createTransparencyLayerFor
BlendMode) && m_usedTransparency && !(m_reflectionInfo && m_reflectionInfo->isPa
intingInsideReflection())) { |
2005 context->endLayer(); | 2007 context->endLayer(); |
2006 context->restore(); | 2008 context->restore(); |
2007 m_usedTransparency = false; | 2009 m_usedTransparency = false; |
2008 } | 2010 } |
2009 | 2011 |
2010 if (resourceClipper) | 2012 if (resourceClipper) |
2011 resourceClipper->postApplyStatefulResource(renderer(), context, clipperC
ontext); | 2013 resourceClipper->postApplyStatefulResource(renderer(), context, clipperC
ontext); |
2012 | |
2013 if (hasClipPath) | |
2014 context->restore(); | |
2015 } | 2014 } |
2016 | 2015 |
2017 void RenderLayer::paintLayerByApplyingTransform(GraphicsContext* context, const
LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags, const LayoutPoint&
translationOffset) | 2016 void RenderLayer::paintLayerByApplyingTransform(GraphicsContext* context, const
LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags, const LayoutPoint&
translationOffset) |
2018 { | 2017 { |
2019 // This involves subtracting out the position of the layer in our current co
ordinate space, but preserving | 2018 // This involves subtracting out the position of the layer in our current co
ordinate space, but preserving |
2020 // the accumulated error for sub-pixel layout. | 2019 // the accumulated error for sub-pixel layout. |
2021 LayoutPoint delta; | 2020 LayoutPoint delta; |
2022 convertToLayerCoords(paintingInfo.rootLayer, delta); | 2021 convertToLayerCoords(paintingInfo.rootLayer, delta); |
2023 delta.moveBy(translationOffset); | 2022 delta.moveBy(translationOffset); |
2024 TransformationMatrix transform(renderableTransform(paintingInfo.paintBehavio
r)); | 2023 TransformationMatrix transform(renderableTransform(paintingInfo.paintBehavio
r)); |
(...skipping 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3786 } | 3785 } |
3787 } | 3786 } |
3788 | 3787 |
3789 void showLayerTree(const WebCore::RenderObject* renderer) | 3788 void showLayerTree(const WebCore::RenderObject* renderer) |
3790 { | 3789 { |
3791 if (!renderer) | 3790 if (!renderer) |
3792 return; | 3791 return; |
3793 showLayerTree(renderer->enclosingLayer()); | 3792 showLayerTree(renderer->enclosingLayer()); |
3794 } | 3793 } |
3795 #endif | 3794 #endif |
OLD | NEW |