Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: third_party/WebKit/Source/core/paint/SVGContainerPainter.cpp

Issue 1512803004: Use refs for GraphicsContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ScrollbarTheme
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/SVGContainerPainter.h" 6 #include "core/paint/SVGContainerPainter.h"
7 7
8 #include "core/layout/svg/LayoutSVGContainer.h" 8 #include "core/layout/svg/LayoutSVGContainer.h"
9 #include "core/layout/svg/LayoutSVGViewportContainer.h" 9 #include "core/layout/svg/LayoutSVGViewportContainer.h"
10 #include "core/layout/svg/SVGLayoutSupport.h" 10 #include "core/layout/svg/SVGLayoutSupport.h"
(...skipping 17 matching lines...) Expand all
28 if (!paintInfo.cullRect().intersectsCullRect(m_layoutSVGContainer.localToPar entTransform(), boundingBox)) 28 if (!paintInfo.cullRect().intersectsCullRect(m_layoutSVGContainer.localToPar entTransform(), boundingBox))
29 return; 29 return;
30 30
31 // Spec: An empty viewBox on the <svg> element disables rendering. 31 // Spec: An empty viewBox on the <svg> element disables rendering.
32 ASSERT(m_layoutSVGContainer.element()); 32 ASSERT(m_layoutSVGContainer.element());
33 if (isSVGSVGElement(*m_layoutSVGContainer.element()) && toSVGSVGElement(*m_l ayoutSVGContainer.element()).hasEmptyViewBox()) 33 if (isSVGSVGElement(*m_layoutSVGContainer.element()) && toSVGSVGElement(*m_l ayoutSVGContainer.element()).hasEmptyViewBox())
34 return; 34 return;
35 35
36 PaintInfo paintInfoBeforeFiltering(paintInfo); 36 PaintInfo paintInfoBeforeFiltering(paintInfo);
37 paintInfoBeforeFiltering.updateCullRect(m_layoutSVGContainer.localToParentTr ansform()); 37 paintInfoBeforeFiltering.updateCullRect(m_layoutSVGContainer.localToParentTr ansform());
38 TransformRecorder transformRecorder(*paintInfoBeforeFiltering.context, m_lay outSVGContainer, m_layoutSVGContainer.localToParentTransform()); 38 TransformRecorder transformRecorder(paintInfoBeforeFiltering.context, m_layo utSVGContainer, m_layoutSVGContainer.localToParentTransform());
39 { 39 {
40 Optional<FloatClipRecorder> clipRecorder; 40 Optional<FloatClipRecorder> clipRecorder;
41 if (m_layoutSVGContainer.isSVGViewportContainer() && SVGLayoutSupport::i sOverflowHidden(&m_layoutSVGContainer)) { 41 if (m_layoutSVGContainer.isSVGViewportContainer() && SVGLayoutSupport::i sOverflowHidden(&m_layoutSVGContainer)) {
42 FloatRect viewport = m_layoutSVGContainer.localToParentTransform().i nverse().mapRect(toLayoutSVGViewportContainer(m_layoutSVGContainer).viewport()); 42 FloatRect viewport = m_layoutSVGContainer.localToParentTransform().i nverse().mapRect(toLayoutSVGViewportContainer(m_layoutSVGContainer).viewport());
43 clipRecorder.emplace(*paintInfoBeforeFiltering.context, m_layoutSVGC ontainer, paintInfoBeforeFiltering.phase, viewport); 43 clipRecorder.emplace(paintInfoBeforeFiltering.context, m_layoutSVGCo ntainer, paintInfoBeforeFiltering.phase, viewport);
44 } 44 }
45 45
46 SVGPaintContext paintContext(m_layoutSVGContainer, paintInfoBeforeFilter ing); 46 SVGPaintContext paintContext(m_layoutSVGContainer, paintInfoBeforeFilter ing);
47 bool continueRendering = true; 47 bool continueRendering = true;
48 if (paintContext.paintInfo().phase == PaintPhaseForeground) 48 if (paintContext.paintInfo().phase == PaintPhaseForeground)
49 continueRendering = paintContext.applyClipMaskAndFilterIfNecessary() ; 49 continueRendering = paintContext.applyClipMaskAndFilterIfNecessary() ;
50 50
51 if (continueRendering) { 51 if (continueRendering) {
52 paintContext.paintInfo().updatePaintingRootForChildren(&m_layoutSVGC ontainer); 52 paintContext.paintInfo().updatePaintingRootForChildren(&m_layoutSVGC ontainer);
53 for (LayoutObject* child = m_layoutSVGContainer.firstChild(); child; child = child->nextSibling()) 53 for (LayoutObject* child = m_layoutSVGContainer.firstChild(); child; child = child->nextSibling())
54 child->paint(paintContext.paintInfo(), IntPoint()); 54 child->paint(paintContext.paintInfo(), IntPoint());
55 } 55 }
56 } 56 }
57 57
58 if (paintInfoBeforeFiltering.phase != PaintPhaseForeground) 58 if (paintInfoBeforeFiltering.phase != PaintPhaseForeground)
59 return; 59 return;
60 60
61 if (m_layoutSVGContainer.style()->outlineWidth() && m_layoutSVGContainer.sty le()->visibility() == VISIBLE) { 61 if (m_layoutSVGContainer.style()->outlineWidth() && m_layoutSVGContainer.sty le()->visibility() == VISIBLE) {
62 PaintInfo outlinePaintInfo(paintInfoBeforeFiltering); 62 PaintInfo outlinePaintInfo(paintInfoBeforeFiltering);
63 outlinePaintInfo.phase = PaintPhaseSelfOutline; 63 outlinePaintInfo.phase = PaintPhaseSelfOutline;
64 ObjectPainter(m_layoutSVGContainer).paintOutline(outlinePaintInfo, Layou tPoint(boundingBox.location())); 64 ObjectPainter(m_layoutSVGContainer).paintOutline(outlinePaintInfo, Layou tPoint(boundingBox.location()));
65 } 65 }
66 66
67 if (paintInfoBeforeFiltering.isPrinting()) 67 if (paintInfoBeforeFiltering.isPrinting())
68 ObjectPainter(m_layoutSVGContainer).addPDFURLRectIfNeeded(paintInfoBefor eFiltering, LayoutPoint()); 68 ObjectPainter(m_layoutSVGContainer).addPDFURLRectIfNeeded(paintInfoBefor eFiltering, LayoutPoint());
69 } 69 }
70 70
71 } // namespace blink 71 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/SVGClipPainter.cpp ('k') | third_party/WebKit/Source/core/paint/SVGFilterPainter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698