| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 m_clipperState = SVGClipPainter::ClipperNotApplied; | 125 m_clipperState = SVGClipPainter::ClipperNotApplied; |
| 126 | 126 |
| 127 ASSERT(style.clipPath()); | 127 ASSERT(style.clipPath()); |
| 128 if (style.clipPath()->type() == ClipPathOperation::SHAPE) { | 128 if (style.clipPath()->type() == ClipPathOperation::SHAPE) { |
| 129 ShapeClipPathOperation* clipPath = toShapeClipPathOperation(style.cl
ipPath()); | 129 ShapeClipPathOperation* clipPath = toShapeClipPathOperation(style.cl
ipPath()); |
| 130 if (clipPath->isValid()) { | 130 if (clipPath->isValid()) { |
| 131 if (!rootRelativeBoundsComputed) { | 131 if (!rootRelativeBoundsComputed) { |
| 132 rootRelativeBounds = paintLayer.physicalBoundingBoxIncluding
ReflectionAndStackingChildren(paintingInfo.rootLayer, offsetFromRoot); | 132 rootRelativeBounds = paintLayer.physicalBoundingBoxIncluding
ReflectionAndStackingChildren(paintingInfo.rootLayer, offsetFromRoot); |
| 133 rootRelativeBoundsComputed = true; | 133 rootRelativeBoundsComputed = true; |
| 134 } | 134 } |
| 135 m_clipPathRecorder.emplace(*context, *paintLayer.layoutObject(),
clipPath->path(rootRelativeBounds)); | 135 m_clipPathRecorder.emplace(*context, *paintLayer.layoutObject(),
clipPath->path(FloatRect(rootRelativeBounds))); |
| 136 } | 136 } |
| 137 } else if (style.clipPath()->type() == ClipPathOperation::REFERENCE) { | 137 } else if (style.clipPath()->type() == ClipPathOperation::REFERENCE) { |
| 138 ReferenceClipPathOperation* referenceClipPathOperation = toReference
ClipPathOperation(style.clipPath()); | 138 ReferenceClipPathOperation* referenceClipPathOperation = toReference
ClipPathOperation(style.clipPath()); |
| 139 Document& document = paintLayer.layoutObject()->document(); | 139 Document& document = paintLayer.layoutObject()->document(); |
| 140 // FIXME: It doesn't work with forward or external SVG references (h
ttps://bugs.webkit.org/show_bug.cgi?id=90405) | 140 // FIXME: It doesn't work with forward or external SVG references (h
ttps://bugs.webkit.org/show_bug.cgi?id=90405) |
| 141 Element* element = document.getElementById(referenceClipPathOperatio
n->fragment()); | 141 Element* element = document.getElementById(referenceClipPathOperatio
n->fragment()); |
| 142 if (isSVGClipPathElement(element) && element->layoutObject()) { | 142 if (isSVGClipPathElement(element) && element->layoutObject()) { |
| 143 if (!rootRelativeBoundsComputed) { | 143 if (!rootRelativeBoundsComputed) { |
| 144 rootRelativeBounds = paintLayer.physicalBoundingBoxIncluding
ReflectionAndStackingChildren(paintingInfo.rootLayer, offsetFromRoot); | 144 rootRelativeBounds = paintLayer.physicalBoundingBoxIncluding
ReflectionAndStackingChildren(paintingInfo.rootLayer, offsetFromRoot); |
| 145 rootRelativeBoundsComputed = true; | 145 rootRelativeBoundsComputed = true; |
| 146 } | 146 } |
| 147 | 147 |
| 148 m_resourceClipper = toLayoutSVGResourceClipper(toLayoutSVGResour
ceContainer(element->layoutObject())); | 148 m_resourceClipper = toLayoutSVGResourceClipper(toLayoutSVGResour
ceContainer(element->layoutObject())); |
| 149 if (!SVGClipPainter(*m_resourceClipper).applyClippingToContext(*
paintLayer.layoutObject(), rootRelativeBounds, | 149 if (!SVGClipPainter(*m_resourceClipper).applyClippingToContext(*
paintLayer.layoutObject(), FloatRect(rootRelativeBounds), |
| 150 paintingInfo.paintDirtyRect, context, m_clipperState)) { | 150 FloatRect(paintingInfo.paintDirtyRect), context, m_clipperSt
ate)) { |
| 151 // No need to post-apply the clipper if this failed. | 151 // No need to post-apply the clipper if this failed. |
| 152 m_resourceClipper = 0; | 152 m_resourceClipper = 0; |
| 153 } | 153 } |
| 154 } | 154 } |
| 155 } | 155 } |
| 156 } | 156 } |
| 157 | 157 |
| 158 ~ClipPathHelper() | 158 ~ClipPathHelper() |
| 159 { | 159 { |
| 160 if (m_resourceClipper) | 160 if (m_resourceClipper) |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 if (!m_paintLayer.containsDirtyOverlayScrollbars()) | 604 if (!m_paintLayer.containsDirtyOverlayScrollbars()) |
| 605 return; | 605 return; |
| 606 | 606 |
| 607 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl
osingIntRect(damageRect)), paintFlags, LayoutSize(), paintingRoot); | 607 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl
osingIntRect(damageRect)), paintFlags, LayoutSize(), paintingRoot); |
| 608 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); | 608 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); |
| 609 | 609 |
| 610 m_paintLayer.setContainsDirtyOverlayScrollbars(false); | 610 m_paintLayer.setContainsDirtyOverlayScrollbars(false); |
| 611 } | 611 } |
| 612 | 612 |
| 613 } // namespace blink | 613 } // namespace blink |
| OLD | NEW |