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

Side by Side Diff: Source/core/rendering/svg/RenderSVGImage.cpp

Issue 109753004: Avoid drawing SVG image content when the image is of zero size. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 months 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/svg/as-image/zero-size-buffered-image-nopaint-expected.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org> 2 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org>
3 * Copyright (C) 2006 Apple Computer, Inc. 3 * Copyright (C) 2006 Apple Computer, Inc.
4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> 4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
5 * Copyright (C) 2007, 2008, 2009 Rob Buis <buis@kde.org> 5 * Copyright (C) 2007, 2008, 2009 Rob Buis <buis@kde.org>
6 * Copyright (C) 2009 Google, Inc. 6 * Copyright (C) 2009 Google, Inc.
7 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 7 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
8 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> 8 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com>
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 } 123 }
124 124
125 void RenderSVGImage::paint(PaintInfo& paintInfo, const LayoutPoint&) 125 void RenderSVGImage::paint(PaintInfo& paintInfo, const LayoutPoint&)
126 { 126 {
127 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, this); 127 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, this);
128 128
129 if (paintInfo.context->paintingDisabled() || style()->visibility() == HIDDEN || !m_imageResource->hasImage()) 129 if (paintInfo.context->paintingDisabled() || style()->visibility() == HIDDEN || !m_imageResource->hasImage())
130 return; 130 return;
131 131
132 FloatRect boundingBox = repaintRectInLocalCoordinates(); 132 FloatRect boundingBox = repaintRectInLocalCoordinates();
133 if (!SVGRenderSupport::paintInfoIntersectsRepaintRect(boundingBox, m_localTr ansform, paintInfo)) 133 if (!SVGRenderSupport::paintInfoIntersectsRepaintRect(boundingBox, m_localTr ansform, paintInfo))
pdr. 2014/01/06 18:24:03 Can you move the bounding box empty check into thi
134 return; 134 return;
135 135
136 PaintInfo childPaintInfo(paintInfo); 136 PaintInfo childPaintInfo(paintInfo);
137 bool drawsOutline = style()->outlineWidth() && (childPaintInfo.phase == Pain tPhaseOutline || childPaintInfo.phase == PaintPhaseSelfOutline); 137 bool drawsOutline = style()->outlineWidth() && (childPaintInfo.phase == Pain tPhaseOutline || childPaintInfo.phase == PaintPhaseSelfOutline);
138 if (drawsOutline || childPaintInfo.phase == PaintPhaseForeground) { 138 if (drawsOutline || childPaintInfo.phase == PaintPhaseForeground) {
139 GraphicsContextStateSaver stateSaver(*childPaintInfo.context); 139 GraphicsContextStateSaver stateSaver(*childPaintInfo.context);
140 childPaintInfo.applyTransform(m_localTransform); 140 childPaintInfo.applyTransform(m_localTransform);
141 141
142 if (childPaintInfo.phase == PaintPhaseForeground) { 142 if (childPaintInfo.phase == PaintPhaseForeground && !m_objectBoundingBox .isEmpty()) {
143 SVGRenderingContext renderingContext(this, childPaintInfo); 143 SVGRenderingContext renderingContext(this, childPaintInfo);
144 144
145 if (renderingContext.isRenderingPrepared()) { 145 if (renderingContext.isRenderingPrepared()) {
146 if (style()->svgStyle()->bufferedRendering() == BR_STATIC && re nderingContext.bufferForeground(m_bufferedForeground)) 146 if (style()->svgStyle()->bufferedRendering() == BR_STATIC && ren deringContext.bufferForeground(m_bufferedForeground))
147 return; 147 return;
148 148
149 paintForeground(childPaintInfo); 149 paintForeground(childPaintInfo);
150 } 150 }
151 } 151 }
152 152
153 if (drawsOutline) 153 if (drawsOutline)
154 paintOutline(childPaintInfo, IntRect(boundingBox)); 154 paintOutline(childPaintInfo, IntRect(boundingBox));
155 } 155 }
156 } 156 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 223
224 void RenderSVGImage::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint &, const RenderLayerModelObject*) 224 void RenderSVGImage::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint &, const RenderLayerModelObject*)
225 { 225 {
226 // this is called from paint() after the localTransform has already been app lied 226 // this is called from paint() after the localTransform has already been app lied
227 IntRect contentRect = enclosingIntRect(repaintRectInLocalCoordinates()); 227 IntRect contentRect = enclosingIntRect(repaintRectInLocalCoordinates());
228 if (!contentRect.isEmpty()) 228 if (!contentRect.isEmpty())
229 rects.append(contentRect); 229 rects.append(contentRect);
230 } 230 }
231 231
232 } // namespace WebCore 232 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/svg/as-image/zero-size-buffered-image-nopaint-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698