Chromium Code Reviews| 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/FilterEffectRenderer.h" | 10 #include "core/layout/FilterEffectRenderer.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 Document& document = renderLayer.layoutObject()->document(); | 135 Document& document = renderLayer.layoutObject()->document(); |
| 136 // FIXME: It doesn't work with forward or external SVG references (h ttps://bugs.webkit.org/show_bug.cgi?id=90405) | 136 // FIXME: It doesn't work with forward or external SVG references (h ttps://bugs.webkit.org/show_bug.cgi?id=90405) |
| 137 Element* element = document.getElementById(referenceClipPathOperatio n->fragment()); | 137 Element* element = document.getElementById(referenceClipPathOperatio n->fragment()); |
| 138 if (isSVGClipPathElement(element) && element->layoutObject()) { | 138 if (isSVGClipPathElement(element) && element->layoutObject()) { |
| 139 if (!rootRelativeBoundsComputed) { | 139 if (!rootRelativeBoundsComputed) { |
| 140 rootRelativeBounds = renderLayer.physicalBoundingBoxIncludin gReflectionAndStackingChildren(paintingInfo.rootLayer, offsetFromRoot); | 140 rootRelativeBounds = renderLayer.physicalBoundingBoxIncludin gReflectionAndStackingChildren(paintingInfo.rootLayer, offsetFromRoot); |
| 141 rootRelativeBoundsComputed = true; | 141 rootRelativeBoundsComputed = true; |
| 142 } | 142 } |
| 143 | 143 |
| 144 m_resourceClipper = toLayoutSVGResourceClipper(toLayoutSVGResour ceContainer(element->layoutObject())); | 144 m_resourceClipper = toLayoutSVGResourceClipper(toLayoutSVGResour ceContainer(element->layoutObject())); |
| 145 if (!SVGClipPainter(*m_resourceClipper).applyClippingToContext(r enderLayer.layoutObject(), rootRelativeBounds, | 145 ASSERT(renderLayer.layoutObject()); |
|
fs
2015/03/24 14:15:31
This has already been dereferenced above, so this
Erik Dahlström (inactive)
2015/03/24 16:26:00
Done.
| |
| 146 if (!SVGClipPainter(*m_resourceClipper).applyClippingToContext(* renderLayer.layoutObject(), rootRelativeBounds, | |
| 146 paintingInfo.paintDirtyRect, context, m_clipperState)) { | 147 paintingInfo.paintDirtyRect, context, m_clipperState)) { |
| 147 // No need to post-apply the clipper if this failed. | 148 // No need to post-apply the clipper if this failed. |
| 148 m_resourceClipper = 0; | 149 m_resourceClipper = 0; |
| 149 } | 150 } |
| 150 } | 151 } |
| 151 } | 152 } |
| 152 } | 153 } |
| 153 | 154 |
| 154 ~ClipPathHelper() | 155 ~ClipPathHelper() |
| 155 { | 156 { |
| 156 if (m_resourceClipper) | 157 if (m_resourceClipper) { |
| 157 SVGClipPainter(*m_resourceClipper).postApplyStatefulResource(m_rende rLayer.layoutObject(), m_context, m_clipperState); | 158 ASSERT(m_renderLayer.layoutObject()); |
|
fs
2015/03/24 14:15:31
As above.
Erik Dahlström (inactive)
2015/03/24 16:26:00
Done.
| |
| 159 SVGClipPainter(*m_resourceClipper).postApplyStatefulResource(*m_rend erLayer.layoutObject(), m_context, m_clipperState); | |
| 160 } | |
| 158 } | 161 } |
| 159 private: | 162 private: |
| 160 LayoutSVGResourceClipper* m_resourceClipper; | 163 LayoutSVGResourceClipper* m_resourceClipper; |
| 161 OwnPtr<ClipPathRecorder> m_clipPathRecorder; | 164 OwnPtr<ClipPathRecorder> m_clipPathRecorder; |
| 162 SVGClipPainter::ClipperState m_clipperState; | 165 SVGClipPainter::ClipperState m_clipperState; |
| 163 const DeprecatedPaintLayer& m_renderLayer; | 166 const DeprecatedPaintLayer& m_renderLayer; |
| 164 GraphicsContext* m_context; | 167 GraphicsContext* m_context; |
| 165 }; | 168 }; |
| 166 | 169 |
| 167 void DeprecatedPaintLayerPainter::paintLayerContents(GraphicsContext* context, c onst DeprecatedPaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags, FragmentPolicy fragmentPolicy) | 170 void DeprecatedPaintLayerPainter::paintLayerContents(GraphicsContext* context, c onst DeprecatedPaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags, FragmentPolicy fragmentPolicy) |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 709 if (!m_renderLayer.containsDirtyOverlayScrollbars()) | 712 if (!m_renderLayer.containsDirtyOverlayScrollbars()) |
| 710 return; | 713 return; |
| 711 | 714 |
| 712 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_renderLayer, LayoutRect(enc losingIntRect(damageRect)), paintBehavior, LayoutSize(), paintingRoot); | 715 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_renderLayer, LayoutRect(enc losingIntRect(damageRect)), paintBehavior, LayoutSize(), paintingRoot); |
| 713 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); | 716 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); |
| 714 | 717 |
| 715 m_renderLayer.setContainsDirtyOverlayScrollbars(false); | 718 m_renderLayer.setContainsDirtyOverlayScrollbars(false); |
| 716 } | 719 } |
| 717 | 720 |
| 718 } // namespace blink | 721 } // namespace blink |
| OLD | NEW |