| 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/DeprecatedPaintLayerPainter.h" | 6 #include "core/paint/DeprecatedPaintLayerPainter.h" |
| 7 | 7 |
| 8 #include "core/frame/Settings.h" | 8 #include "core/frame/Settings.h" |
| 9 #include "core/layout/ClipPathOperation.h" | 9 #include "core/layout/ClipPathOperation.h" |
| 10 #include "core/layout/LayoutBlock.h" | 10 #include "core/layout/LayoutBlock.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 if (!paintLayer.layoutObject()->hasClipPath() || (paintLayer.needsCompos
itedScrolling() && !(paintFlags & PaintLayerPaintingChildClippingMaskPhase))) | 132 if (!paintLayer.layoutObject()->hasClipPath() || (paintLayer.needsCompos
itedScrolling() && !(paintFlags & PaintLayerPaintingChildClippingMaskPhase))) |
| 133 return; | 133 return; |
| 134 | 134 |
| 135 m_clipperState = SVGClipPainter::ClipperNotApplied; | 135 m_clipperState = SVGClipPainter::ClipperNotApplied; |
| 136 | 136 |
| 137 ASSERT(style.clipPath()); | 137 ASSERT(style.clipPath()); |
| 138 if (style.clipPath()->type() == ClipPathOperation::SHAPE) { | 138 if (style.clipPath()->type() == ClipPathOperation::SHAPE) { |
| 139 ShapeClipPathOperation* clipPath = toShapeClipPathOperation(style.cl
ipPath()); | 139 ShapeClipPathOperation* clipPath = toShapeClipPathOperation(style.cl
ipPath()); |
| 140 if (clipPath->isValid()) { | 140 if (clipPath->isValid()) { |
| 141 if (!rootRelativeBoundsComputed) { | 141 if (!rootRelativeBoundsComputed) { |
| 142 rootRelativeBounds = paintLayer.physicalBoundingBoxIncluding
ReflectionAndStackingChildren(paintingInfo.rootLayer, offsetFromRoot); | 142 rootRelativeBounds = paintLayer.physicalBoundingBoxIncluding
ReflectionAndStackingChildren(offsetFromRoot); |
| 143 rootRelativeBoundsComputed = true; | 143 rootRelativeBoundsComputed = true; |
| 144 } | 144 } |
| 145 m_clipPathRecorder.emplace(*context, *paintLayer.layoutObject(),
clipPath->path(FloatRect(rootRelativeBounds))); | 145 m_clipPathRecorder.emplace(*context, *paintLayer.layoutObject(),
clipPath->path(FloatRect(rootRelativeBounds))); |
| 146 } | 146 } |
| 147 } else if (style.clipPath()->type() == ClipPathOperation::REFERENCE) { | 147 } else if (style.clipPath()->type() == ClipPathOperation::REFERENCE) { |
| 148 ReferenceClipPathOperation* referenceClipPathOperation = toReference
ClipPathOperation(style.clipPath()); | 148 ReferenceClipPathOperation* referenceClipPathOperation = toReference
ClipPathOperation(style.clipPath()); |
| 149 Document& document = paintLayer.layoutObject()->document(); | 149 Document& document = paintLayer.layoutObject()->document(); |
| 150 // FIXME: It doesn't work with forward or external SVG references (h
ttps://bugs.webkit.org/show_bug.cgi?id=90405) | 150 // FIXME: It doesn't work with forward or external SVG references (h
ttps://bugs.webkit.org/show_bug.cgi?id=90405) |
| 151 Element* element = document.getElementById(referenceClipPathOperatio
n->fragment()); | 151 Element* element = document.getElementById(referenceClipPathOperatio
n->fragment()); |
| 152 if (isSVGClipPathElement(element) && element->layoutObject()) { | 152 if (isSVGClipPathElement(element) && element->layoutObject()) { |
| 153 if (!rootRelativeBoundsComputed) { | 153 if (!rootRelativeBoundsComputed) { |
| 154 rootRelativeBounds = paintLayer.physicalBoundingBoxIncluding
ReflectionAndStackingChildren(paintingInfo.rootLayer, offsetFromRoot); | 154 rootRelativeBounds = paintLayer.physicalBoundingBoxIncluding
ReflectionAndStackingChildren(offsetFromRoot); |
| 155 rootRelativeBoundsComputed = true; | 155 rootRelativeBoundsComputed = true; |
| 156 } | 156 } |
| 157 | 157 |
| 158 m_resourceClipper = toLayoutSVGResourceClipper(toLayoutSVGResour
ceContainer(element->layoutObject())); | 158 m_resourceClipper = toLayoutSVGResourceClipper(toLayoutSVGResour
ceContainer(element->layoutObject())); |
| 159 if (!SVGClipPainter(*m_resourceClipper).prepareEffect(*paintLaye
r.layoutObject(), FloatRect(rootRelativeBounds), | 159 if (!SVGClipPainter(*m_resourceClipper).prepareEffect(*paintLaye
r.layoutObject(), FloatRect(rootRelativeBounds), |
| 160 FloatRect(paintingInfo.paintDirtyRect), context, m_clipperSt
ate)) { | 160 FloatRect(paintingInfo.paintDirtyRect), context, m_clipperSt
ate)) { |
| 161 // No need to post-apply the clipper if this failed. | 161 // No need to post-apply the clipper if this failed. |
| 162 m_resourceClipper = 0; | 162 m_resourceClipper = 0; |
| 163 } | 163 } |
| 164 } | 164 } |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 if (&m_paintLayer == localPaintingInfo.rootLayer && (localPaintFlags & Paint
LayerPaintingOverflowContents)) | 316 if (&m_paintLayer == localPaintingInfo.rootLayer && (localPaintFlags & Paint
LayerPaintingOverflowContents)) |
| 317 return true; | 317 return true; |
| 318 | 318 |
| 319 for (DeprecatedPaintLayerFragment& fragment: fragments) { | 319 for (DeprecatedPaintLayerFragment& fragment: fragments) { |
| 320 LayoutPoint newOffsetFromRoot = offsetFromRoot + fragment.paginationOffs
et; | 320 LayoutPoint newOffsetFromRoot = offsetFromRoot + fragment.paginationOffs
et; |
| 321 // Note that this really only works reliably on the first fragment. If t
he layer has visible | 321 // Note that this really only works reliably on the first fragment. If t
he layer has visible |
| 322 // overflow and a subsequent fragment doesn't intersect with the border
box of the layer | 322 // overflow and a subsequent fragment doesn't intersect with the border
box of the layer |
| 323 // (i.e. only contains an overflow portion of the layer), intersection w
ill fail. The reason | 323 // (i.e. only contains an overflow portion of the layer), intersection w
ill fail. The reason |
| 324 // for this is that fragment.layerBounds is set to the border box, not t
he bounding box, of | 324 // for this is that fragment.layerBounds is set to the border box, not t
he bounding box, of |
| 325 // the layer. | 325 // the layer. |
| 326 if (m_paintLayer.intersectsDamageRect(fragment.layerBounds, fragment.bac
kgroundRect.rect(), localPaintingInfo.rootLayer, &newOffsetFromRoot)) | 326 if (m_paintLayer.intersectsDamageRect(fragment.layerBounds, fragment.bac
kgroundRect.rect(), newOffsetFromRoot)) |
| 327 return true; | 327 return true; |
| 328 } | 328 } |
| 329 return false; | 329 return false; |
| 330 } | 330 } |
| 331 | 331 |
| 332 void DeprecatedPaintLayerPainter::paintLayerWithTransform(GraphicsContext* conte
xt, const DeprecatedPaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintF
lags) | 332 void DeprecatedPaintLayerPainter::paintLayerWithTransform(GraphicsContext* conte
xt, const DeprecatedPaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintF
lags) |
| 333 { | 333 { |
| 334 TransformationMatrix layerTransform = m_paintLayer.renderableTransform(paint
ingInfo.globalPaintFlags()); | 334 TransformationMatrix layerTransform = m_paintLayer.renderableTransform(paint
ingInfo.globalPaintFlags()); |
| 335 // If the transform can't be inverted, then don't paint anything. | 335 // If the transform can't be inverted, then don't paint anything. |
| 336 if (!layerTransform.isInvertible()) | 336 if (!layerTransform.isInvertible()) |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 if (!m_paintLayer.containsDirtyOverlayScrollbars()) | 610 if (!m_paintLayer.containsDirtyOverlayScrollbars()) |
| 611 return; | 611 return; |
| 612 | 612 |
| 613 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl
osingIntRect(damageRect)), paintFlags, LayoutSize(), paintingRoot); | 613 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl
osingIntRect(damageRect)), paintFlags, LayoutSize(), paintingRoot); |
| 614 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); | 614 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); |
| 615 | 615 |
| 616 m_paintLayer.setContainsDirtyOverlayScrollbars(false); | 616 m_paintLayer.setContainsDirtyOverlayScrollbars(false); |
| 617 } | 617 } |
| 618 | 618 |
| 619 } // namespace blink | 619 } // namespace blink |
| OLD | NEW |