OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "core/paint/LayerPainter.h" | 6 #include "core/paint/LayerPainter.h" |
7 | 7 |
8 #include "core/frame/Settings.h" | 8 #include "core/frame/Settings.h" |
9 #include "core/page/Page.h" | 9 #include "core/page/Page.h" |
10 #include "core/rendering/ClipPathOperation.h" | 10 #include "core/rendering/ClipPathOperation.h" |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 // It must, however, still be applied to the mask layer, so that the composi
tor can properly mask the | 210 // It must, however, still be applied to the mask layer, so that the composi
tor can properly mask the |
211 // scrolling contents and scrollbars. | 211 // scrolling contents and scrollbars. |
212 if (m_renderLayer.renderer()->hasClipPath() && style && (!m_renderLayer.need
sCompositedScrolling() || paintFlags & PaintLayerPaintingChildClippingMaskPhase)
) { | 212 if (m_renderLayer.renderer()->hasClipPath() && style && (!m_renderLayer.need
sCompositedScrolling() || paintFlags & PaintLayerPaintingChildClippingMaskPhase)
) { |
213 ASSERT(style->clipPath()); | 213 ASSERT(style->clipPath()); |
214 if (style->clipPath()->type() == ClipPathOperation::SHAPE) { | 214 if (style->clipPath()->type() == ClipPathOperation::SHAPE) { |
215 ShapeClipPathOperation* clipPath = toShapeClipPathOperation(style->c
lipPath()); | 215 ShapeClipPathOperation* clipPath = toShapeClipPathOperation(style->c
lipPath()); |
216 if (clipPath->isValid()) { | 216 if (clipPath->isValid()) { |
217 clipStateSaver.save(); | 217 clipStateSaver.save(); |
218 | 218 |
219 if (!rootRelativeBoundsComputed) { | 219 if (!rootRelativeBoundsComputed) { |
220 rootRelativeBounds = m_renderLayer.physicalBoundingBoxInclud
ingReflectionAndStackingChildren(paintingInfo.rootLayer, offsetFromRoot); | 220 rootRelativeBounds = m_renderLayer.boundingBoxIncludingRefle
ctionAndStackingChildren(paintingInfo.rootLayer, offsetFromRoot); |
221 rootRelativeBoundsComputed = true; | 221 rootRelativeBoundsComputed = true; |
222 } | 222 } |
223 | 223 |
224 context->clipPath(clipPath->path(rootRelativeBounds), clipPath->
windRule()); | 224 context->clipPath(clipPath->path(rootRelativeBounds), clipPath->
windRule()); |
225 } | 225 } |
226 } else if (style->clipPath()->type() == ClipPathOperation::REFERENCE) { | 226 } else if (style->clipPath()->type() == ClipPathOperation::REFERENCE) { |
227 ReferenceClipPathOperation* referenceClipPathOperation = toReference
ClipPathOperation(style->clipPath()); | 227 ReferenceClipPathOperation* referenceClipPathOperation = toReference
ClipPathOperation(style->clipPath()); |
228 Document& document = m_renderLayer.renderer()->document(); | 228 Document& document = m_renderLayer.renderer()->document(); |
229 // FIXME: It doesn't work with forward or external SVG references (h
ttps://bugs.webkit.org/show_bug.cgi?id=90405) | 229 // FIXME: It doesn't work with forward or external SVG references (h
ttps://bugs.webkit.org/show_bug.cgi?id=90405) |
230 Element* element = document.getElementById(referenceClipPathOperatio
n->fragment()); | 230 Element* element = document.getElementById(referenceClipPathOperatio
n->fragment()); |
231 if (isSVGClipPathElement(element) && element->renderer()) { | 231 if (isSVGClipPathElement(element) && element->renderer()) { |
232 // FIXME: Saving at this point is not required in the 'mask'- | 232 // FIXME: Saving at this point is not required in the 'mask'- |
233 // case, or if the clip ends up empty. | 233 // case, or if the clip ends up empty. |
234 clipStateSaver.save(); | 234 clipStateSaver.save(); |
235 if (!rootRelativeBoundsComputed) { | 235 if (!rootRelativeBoundsComputed) { |
236 rootRelativeBounds = m_renderLayer.physicalBoundingBoxInclud
ingReflectionAndStackingChildren(paintingInfo.rootLayer, offsetFromRoot); | 236 rootRelativeBounds = m_renderLayer.boundingBoxIncludingRefle
ctionAndStackingChildren(paintingInfo.rootLayer, offsetFromRoot); |
237 rootRelativeBoundsComputed = true; | 237 rootRelativeBoundsComputed = true; |
238 } | 238 } |
239 | 239 |
240 resourceClipper = toRenderSVGResourceClipper(toRenderSVGResource
Container(element->renderer())); | 240 resourceClipper = toRenderSVGResourceClipper(toRenderSVGResource
Container(element->renderer())); |
241 if (!resourceClipper->applyClippingToContext(m_renderLayer.rende
rer(), rootRelativeBounds, | 241 if (!resourceClipper->applyClippingToContext(m_renderLayer.rende
rer(), rootRelativeBounds, |
242 paintingInfo.paintDirtyRect, context, clipperState)) { | 242 paintingInfo.paintDirtyRect, context, clipperState)) { |
243 // No need to post-apply the clipper if this failed. | 243 // No need to post-apply the clipper if this failed. |
244 resourceClipper = 0; | 244 resourceClipper = 0; |
245 } | 245 } |
246 } | 246 } |
(...skipping 18 matching lines...) Expand all Loading... |
265 m_renderLayer.collectFragments(layerFragments, localPaintingInfo.rootLay
er, localPaintingInfo.paintDirtyRect, | 265 m_renderLayer.collectFragments(layerFragments, localPaintingInfo.rootLay
er, localPaintingInfo.paintDirtyRect, |
266 (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : Pai
ntingClipRects, IgnoreOverlayScrollbarSize, | 266 (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : Pai
ntingClipRects, IgnoreOverlayScrollbarSize, |
267 shouldRespectOverflowClip(paintFlags, m_renderLayer.renderer()), &of
fsetFromRoot, localPaintingInfo.subPixelAccumulation); | 267 shouldRespectOverflowClip(paintFlags, m_renderLayer.renderer()), &of
fsetFromRoot, localPaintingInfo.subPixelAccumulation); |
268 updatePaintingInfoForFragments(layerFragments, localPaintingInfo, paintF
lags, shouldPaintContent, &offsetFromRoot); | 268 updatePaintingInfoForFragments(layerFragments, localPaintingInfo, paintF
lags, shouldPaintContent, &offsetFromRoot); |
269 } | 269 } |
270 | 270 |
271 if (filterPainter.haveFilterEffect()) { | 271 if (filterPainter.haveFilterEffect()) { |
272 ASSERT(m_renderLayer.filterInfo()); | 272 ASSERT(m_renderLayer.filterInfo()); |
273 | 273 |
274 if (!rootRelativeBoundsComputed) | 274 if (!rootRelativeBoundsComputed) |
275 rootRelativeBounds = m_renderLayer.physicalBoundingBoxIncludingRefle
ctionAndStackingChildren(paintingInfo.rootLayer, offsetFromRoot); | 275 rootRelativeBounds = m_renderLayer.boundingBoxIncludingReflectionAnd
StackingChildren(paintingInfo.rootLayer, offsetFromRoot); |
276 | 276 |
277 if (filterPainter.prepareFilterEffect(&m_renderLayer, rootRelativeBounds
, paintingInfo.paintDirtyRect)) { | 277 if (filterPainter.prepareFilterEffect(&m_renderLayer, rootRelativeBounds
, paintingInfo.paintDirtyRect)) { |
278 | 278 |
279 // Rewire the old context to a memory buffer, so that we can capture
the contents of the layer. | 279 // Rewire the old context to a memory buffer, so that we can capture
the contents of the layer. |
280 // NOTE: We saved the old context in the "transparencyLayerContext"
local variable, to be able to start a transparency layer | 280 // NOTE: We saved the old context in the "transparencyLayerContext"
local variable, to be able to start a transparency layer |
281 // on the original context and avoid duplicating "beginFilterEffect"
after each transparency layer call. Also, note that | 281 // on the original context and avoid duplicating "beginFilterEffect"
after each transparency layer call. Also, note that |
282 // beginTransparencyLayers will only create a single lazy transparen
cy layer, even though it is called twice in this method. | 282 // beginTransparencyLayers will only create a single lazy transparen
cy layer, even though it is called twice in this method. |
283 // With deferred filters, we don't need a separate context, but we d
o need to do transparency and clipping before starting | 283 // With deferred filters, we don't need a separate context, but we d
o need to do transparency and clipping before starting |
284 // filter processing. | 284 // filter processing. |
285 // FIXME: when the legacy path is removed, remove the transparencyLa
yerContext as well. | 285 // FIXME: when the legacy path is removed, remove the transparencyLa
yerContext as well. |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
871 clipRect.intersect(parentClipRect); | 871 clipRect.intersect(parentClipRect); |
872 } | 872 } |
873 | 873 |
874 LayerPainter(*m_renderLayer.parent()).clipToRect(paintingInfo, context,
clipRect, paintFlags); | 874 LayerPainter(*m_renderLayer.parent()).clipToRect(paintingInfo, context,
clipRect, paintFlags); |
875 paintLayerByApplyingTransform(context, paintingInfo, paintFlags, fragmen
t.paginationOffset); | 875 paintLayerByApplyingTransform(context, paintingInfo, paintFlags, fragmen
t.paginationOffset); |
876 LayerPainter(*m_renderLayer.parent()).restoreClip(context, paintingInfo.
paintDirtyRect, clipRect); | 876 LayerPainter(*m_renderLayer.parent()).restoreClip(context, paintingInfo.
paintDirtyRect, clipRect); |
877 } | 877 } |
878 } | 878 } |
879 | 879 |
880 } // namespace blink | 880 } // namespace blink |
OLD | NEW |