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

Side by Side Diff: Source/core/paint/SVGForeignObjectPainter.cpp

Issue 802833003: Remove the SVG paint culling optimization (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update PaintInfo rect when leaving SVG Created 6 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 | Annotate | Revision Log
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/SVGForeignObjectPainter.h" 6 #include "core/paint/SVGForeignObjectPainter.h"
7 7
8 #include "core/paint/BlockPainter.h" 8 #include "core/paint/BlockPainter.h"
9 #include "core/rendering/PaintInfo.h" 9 #include "core/rendering/PaintInfo.h"
10 #include "core/rendering/svg/RenderSVGForeignObject.h" 10 #include "core/rendering/svg/RenderSVGForeignObject.h"
11 #include "core/rendering/svg/SVGRenderSupport.h" 11 #include "core/rendering/svg/SVGRenderSupport.h"
12 #include "core/rendering/svg/SVGRenderingContext.h" 12 #include "core/rendering/svg/SVGRenderingContext.h"
13 #include "platform/graphics/GraphicsContextStateSaver.h" 13 #include "platform/graphics/GraphicsContextStateSaver.h"
14 14
15 namespace blink { 15 namespace blink {
16 16
17 void SVGForeignObjectPainter::paint(const PaintInfo& paintInfo) 17 void SVGForeignObjectPainter::paint(const PaintInfo& paintInfo)
18 { 18 {
19 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase Selection) 19 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase Selection)
20 return; 20 return;
21 21
22 PaintInfo childPaintInfo(paintInfo); 22 PaintInfo childPaintInfo(paintInfo);
23 GraphicsContextStateSaver stateSaver(*childPaintInfo.context); 23 GraphicsContextStateSaver stateSaver(*childPaintInfo.context);
24 childPaintInfo.applyTransform(m_renderSVGForeignObject.localTransform()); 24 childPaintInfo.applyTransform(m_renderSVGForeignObject.localTransform());
25 25
26 // When transitioning from SVG to HTML painters we need to keep the PaintInf o rect up-to-date
27 // because it can be used for clipping.
28 // FIXME: We need to find an approach that's not O(n^2).
29 const AffineTransform& transform = SVGRenderSupport::transformToRootBorderBo x(m_renderSVGForeignObject, m_renderSVGForeignObject.localTransform());
pdr. 2014/12/15 05:02:21 How can we cache this from paint invalidation? (si
fs 2014/12/15 10:28:16 Add: m_cachedRootTransform = paintInvalidationSta
pdr. 2014/12/16 06:29:56 Thank you! This worked a charm. I'm not /too/ wor
fs 2014/12/16 09:43:55 I'm not too worried either - let's just hope that
30 childPaintInfo.rect = enclosingIntRect(transform.inverse().mapRect(FloatRect (childPaintInfo.rect)));
fs 2014/12/15 10:28:16 One inverse() too many (since transformToRootBorde
31
chrishtr 2014/12/15 16:36:24 Maybe just use an infinite rect here to turn off c
26 if (SVGRenderSupport::isOverflowHidden(&m_renderSVGForeignObject)) 32 if (SVGRenderSupport::isOverflowHidden(&m_renderSVGForeignObject))
27 childPaintInfo.context->clip(m_renderSVGForeignObject.viewportRect()); 33 childPaintInfo.context->clip(m_renderSVGForeignObject.viewportRect());
28 34
29 SVGRenderingContext renderingContext; 35 SVGRenderingContext renderingContext;
30 bool continueRendering = true; 36 bool continueRendering = true;
31 if (paintInfo.phase == PaintPhaseForeground) { 37 if (paintInfo.phase == PaintPhaseForeground) {
32 renderingContext.prepareToRenderSVGContent(&m_renderSVGForeignObject, ch ildPaintInfo); 38 renderingContext.prepareToRenderSVGContent(&m_renderSVGForeignObject, ch ildPaintInfo);
33 continueRendering = renderingContext.isRenderingPrepared(); 39 continueRendering = renderingContext.isRenderingPrepared();
34 } 40 }
35 41
(...skipping 10 matching lines...) Expand all
46 BlockPainter(m_renderSVGForeignObject).paint(childPaintInfo, childPo int); 52 BlockPainter(m_renderSVGForeignObject).paint(childPaintInfo, childPo int);
47 childPaintInfo.phase = PaintPhaseForeground; 53 childPaintInfo.phase = PaintPhaseForeground;
48 BlockPainter(m_renderSVGForeignObject).paint(childPaintInfo, childPo int); 54 BlockPainter(m_renderSVGForeignObject).paint(childPaintInfo, childPo int);
49 childPaintInfo.phase = PaintPhaseOutline; 55 childPaintInfo.phase = PaintPhaseOutline;
50 BlockPainter(m_renderSVGForeignObject).paint(childPaintInfo, childPo int); 56 BlockPainter(m_renderSVGForeignObject).paint(childPaintInfo, childPo int);
51 } 57 }
52 } 58 }
53 } 59 }
54 60
55 } // namespace blink 61 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698