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

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

Issue 1144203004: Allow certain SP recorder classes to defer their "begin" operation. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 7 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 | « Source/core/paint/SVGContainerPainter.cpp ('k') | Source/core/paint/SVGRootPainter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/layout/svg/LayoutSVGForeignObject.h" 8 #include "core/layout/svg/LayoutSVGForeignObject.h"
9 #include "core/layout/svg/SVGLayoutSupport.h" 9 #include "core/layout/svg/SVGLayoutSupport.h"
10 #include "core/paint/BlockPainter.h" 10 #include "core/paint/BlockPainter.h"
11 #include "core/paint/FloatClipRecorder.h" 11 #include "core/paint/FloatClipRecorder.h"
12 #include "core/paint/PaintInfo.h" 12 #include "core/paint/PaintInfo.h"
13 #include "core/paint/SVGPaintContext.h" 13 #include "core/paint/SVGPaintContext.h"
14 #include "core/paint/TransformRecorder.h" 14 #include "core/paint/TransformRecorder.h"
15 15
16 namespace blink { 16 namespace blink {
17 17
18 void SVGForeignObjectPainter::paint(const PaintInfo& paintInfo) 18 void SVGForeignObjectPainter::paint(const PaintInfo& paintInfo)
19 { 19 {
20 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase Selection) 20 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase Selection)
21 return; 21 return;
22 22
23 PaintInfo paintInfoBeforeFiltering(paintInfo); 23 PaintInfo paintInfoBeforeFiltering(paintInfo);
24 TransformRecorder transformRecorder(*paintInfoBeforeFiltering.context, m_lay outSVGForeignObject, m_layoutSVGForeignObject.localTransform()); 24 TransformRecorder transformRecorder(*paintInfoBeforeFiltering.context, m_lay outSVGForeignObject, m_layoutSVGForeignObject.localTransform());
25 25
26 // When transitioning from SVG to block painters we need to keep the PaintIn fo rect up-to-date 26 // When transitioning from SVG to block painters we need to keep the PaintIn fo rect up-to-date
27 // because it can be used for clipping. 27 // because it can be used for clipping.
28 m_layoutSVGForeignObject.updatePaintInfoRect(paintInfoBeforeFiltering.rect); 28 m_layoutSVGForeignObject.updatePaintInfoRect(paintInfoBeforeFiltering.rect);
29 29
30 OwnPtr<FloatClipRecorder> clipRecorder; 30 FloatClipRecorder clipRecorder(*paintInfoBeforeFiltering.context, m_layoutSV GForeignObject, paintInfoBeforeFiltering.phase);
31 if (SVGLayoutSupport::isOverflowHidden(&m_layoutSVGForeignObject)) 31 if (SVGLayoutSupport::isOverflowHidden(&m_layoutSVGForeignObject))
32 clipRecorder = adoptPtr(new FloatClipRecorder(*paintInfoBeforeFiltering. context, m_layoutSVGForeignObject, paintInfoBeforeFiltering.phase, m_layoutSVGFo reignObject.viewportRect())); 32 clipRecorder.begin(m_layoutSVGForeignObject.viewportRect());
33 33
34 SVGPaintContext paintContext(m_layoutSVGForeignObject, paintInfoBeforeFilter ing); 34 SVGPaintContext paintContext(m_layoutSVGForeignObject, paintInfoBeforeFilter ing);
35 bool continueRendering = true; 35 bool continueRendering = true;
36 if (paintContext.paintInfo().phase == PaintPhaseForeground) 36 if (paintContext.paintInfo().phase == PaintPhaseForeground)
37 continueRendering = paintContext.applyClipMaskAndFilterIfNecessary(); 37 continueRendering = paintContext.applyClipMaskAndFilterIfNecessary();
38 38
39 if (continueRendering) { 39 if (continueRendering) {
40 // Paint all phases of FO elements atomically as though the FO element e stablished its own stacking context. 40 // Paint all phases of FO elements atomically as though the FO element e stablished its own stacking context.
41 bool preservePhase = paintContext.paintInfo().phase == PaintPhaseSelecti on || paintContext.paintInfo().phase == PaintPhaseTextClip; 41 bool preservePhase = paintContext.paintInfo().phase == PaintPhaseSelecti on || paintContext.paintInfo().phase == PaintPhaseTextClip;
42 const LayoutPoint childPoint = IntPoint(); 42 const LayoutPoint childPoint = IntPoint();
43 paintContext.paintInfo().phase = preservePhase ? paintContext.paintInfo( ).phase : PaintPhaseBlockBackground; 43 paintContext.paintInfo().phase = preservePhase ? paintContext.paintInfo( ).phase : PaintPhaseBlockBackground;
44 BlockPainter(m_layoutSVGForeignObject).paint(paintContext.paintInfo(), c hildPoint); 44 BlockPainter(m_layoutSVGForeignObject).paint(paintContext.paintInfo(), c hildPoint);
45 if (!preservePhase) { 45 if (!preservePhase) {
46 paintContext.paintInfo().phase = PaintPhaseChildBlockBackgrounds; 46 paintContext.paintInfo().phase = PaintPhaseChildBlockBackgrounds;
47 BlockPainter(m_layoutSVGForeignObject).paint(paintContext.paintInfo( ), childPoint); 47 BlockPainter(m_layoutSVGForeignObject).paint(paintContext.paintInfo( ), childPoint);
48 paintContext.paintInfo().phase = PaintPhaseFloat; 48 paintContext.paintInfo().phase = PaintPhaseFloat;
49 BlockPainter(m_layoutSVGForeignObject).paint(paintContext.paintInfo( ), childPoint); 49 BlockPainter(m_layoutSVGForeignObject).paint(paintContext.paintInfo( ), childPoint);
50 paintContext.paintInfo().phase = PaintPhaseForeground; 50 paintContext.paintInfo().phase = PaintPhaseForeground;
51 BlockPainter(m_layoutSVGForeignObject).paint(paintContext.paintInfo( ), childPoint); 51 BlockPainter(m_layoutSVGForeignObject).paint(paintContext.paintInfo( ), childPoint);
52 paintContext.paintInfo().phase = PaintPhaseOutline; 52 paintContext.paintInfo().phase = PaintPhaseOutline;
53 BlockPainter(m_layoutSVGForeignObject).paint(paintContext.paintInfo( ), childPoint); 53 BlockPainter(m_layoutSVGForeignObject).paint(paintContext.paintInfo( ), childPoint);
54 } 54 }
55 } 55 }
56 } 56 }
57 57
58 } // namespace blink 58 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/SVGContainerPainter.cpp ('k') | Source/core/paint/SVGRootPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698