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

Side by Side Diff: third_party/WebKit/Source/core/paint/SVGForeignObjectPainter.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/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 #include "wtf/Optional.h" 15 #include "wtf/Optional.h"
16 16
17 namespace blink { 17 namespace blink {
18 18
19 void SVGForeignObjectPainter::paint(const PaintInfo& paintInfo) 19 void SVGForeignObjectPainter::paint(const PaintInfo& paintInfo)
20 { 20 {
21 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase Selection) 21 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase Selection)
22 return; 22 return;
23 23
24 PaintInfo paintInfoBeforeFiltering(paintInfo); 24 PaintInfo paintInfoBeforeFiltering(paintInfo);
25 paintInfoBeforeFiltering.updateCullRect(m_layoutSVGForeignObject.localTransf orm()); 25 paintInfoBeforeFiltering.updateCullRect(m_layoutSVGForeignObject.localTransf orm());
26 TransformRecorder transformRecorder(*paintInfoBeforeFiltering.context, m_lay outSVGForeignObject, m_layoutSVGForeignObject.localTransform()); 26 TransformRecorder transformRecorder(paintInfoBeforeFiltering.context, m_layo utSVGForeignObject, m_layoutSVGForeignObject.localTransform());
27 27
28 Optional<FloatClipRecorder> clipRecorder; 28 Optional<FloatClipRecorder> clipRecorder;
29 if (SVGLayoutSupport::isOverflowHidden(&m_layoutSVGForeignObject)) 29 if (SVGLayoutSupport::isOverflowHidden(&m_layoutSVGForeignObject))
30 clipRecorder.emplace(*paintInfoBeforeFiltering.context, m_layoutSVGForei gnObject, paintInfoBeforeFiltering.phase, m_layoutSVGForeignObject.viewportRect( )); 30 clipRecorder.emplace(paintInfoBeforeFiltering.context, m_layoutSVGForeig nObject, paintInfoBeforeFiltering.phase, m_layoutSVGForeignObject.viewportRect() );
31 31
32 SVGPaintContext paintContext(m_layoutSVGForeignObject, paintInfoBeforeFilter ing); 32 SVGPaintContext paintContext(m_layoutSVGForeignObject, paintInfoBeforeFilter ing);
33 bool continueRendering = true; 33 bool continueRendering = true;
34 if (paintContext.paintInfo().phase == PaintPhaseForeground) 34 if (paintContext.paintInfo().phase == PaintPhaseForeground)
35 continueRendering = paintContext.applyClipMaskAndFilterIfNecessary(); 35 continueRendering = paintContext.applyClipMaskAndFilterIfNecessary();
36 36
37 if (continueRendering) { 37 if (continueRendering) {
38 // Paint all phases of FO elements atomically as though the FO element e stablished its own stacking context. 38 // Paint all phases of FO elements atomically as though the FO element e stablished its own stacking context.
39 bool preservePhase = paintContext.paintInfo().phase == PaintPhaseSelecti on || paintContext.paintInfo().phase == PaintPhaseTextClip; 39 bool preservePhase = paintContext.paintInfo().phase == PaintPhaseSelecti on || paintContext.paintInfo().phase == PaintPhaseTextClip;
40 const LayoutPoint childPoint = IntPoint(); 40 const LayoutPoint childPoint = IntPoint();
41 paintContext.paintInfo().phase = preservePhase ? paintContext.paintInfo( ).phase : PaintPhaseBlockBackground; 41 paintContext.paintInfo().phase = preservePhase ? paintContext.paintInfo( ).phase : PaintPhaseBlockBackground;
42 BlockPainter(m_layoutSVGForeignObject).paint(paintContext.paintInfo(), c hildPoint); 42 BlockPainter(m_layoutSVGForeignObject).paint(paintContext.paintInfo(), c hildPoint);
43 if (!preservePhase) { 43 if (!preservePhase) {
44 paintContext.paintInfo().phase = PaintPhaseChildBlockBackgrounds; 44 paintContext.paintInfo().phase = PaintPhaseChildBlockBackgrounds;
45 BlockPainter(m_layoutSVGForeignObject).paint(paintContext.paintInfo( ), childPoint); 45 BlockPainter(m_layoutSVGForeignObject).paint(paintContext.paintInfo( ), childPoint);
46 paintContext.paintInfo().phase = PaintPhaseFloat; 46 paintContext.paintInfo().phase = PaintPhaseFloat;
47 BlockPainter(m_layoutSVGForeignObject).paint(paintContext.paintInfo( ), childPoint); 47 BlockPainter(m_layoutSVGForeignObject).paint(paintContext.paintInfo( ), childPoint);
48 paintContext.paintInfo().phase = PaintPhaseForeground; 48 paintContext.paintInfo().phase = PaintPhaseForeground;
49 BlockPainter(m_layoutSVGForeignObject).paint(paintContext.paintInfo( ), childPoint); 49 BlockPainter(m_layoutSVGForeignObject).paint(paintContext.paintInfo( ), childPoint);
50 paintContext.paintInfo().phase = PaintPhaseOutline; 50 paintContext.paintInfo().phase = PaintPhaseOutline;
51 BlockPainter(m_layoutSVGForeignObject).paint(paintContext.paintInfo( ), childPoint); 51 BlockPainter(m_layoutSVGForeignObject).paint(paintContext.paintInfo( ), childPoint);
52 } 52 }
53 } 53 }
54 } 54 }
55 55
56 } // namespace blink 56 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/SVGFilterPainter.cpp ('k') | third_party/WebKit/Source/core/paint/SVGImagePainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698