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

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

Issue 2510313004: Use LayoutBox::frameRect() as the viewport of LayoutSVGForeignObject (Closed)
Patch Set: crbug.com/667071 Created 4 years, 1 month 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
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp ('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 // 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 "core/paint/SVGForeignObjectPainter.h" 5 #include "core/paint/SVGForeignObjectPainter.h"
6 6
7 #include "core/layout/svg/LayoutSVGForeignObject.h" 7 #include "core/layout/svg/LayoutSVGForeignObject.h"
8 #include "core/layout/svg/SVGLayoutSupport.h" 8 #include "core/layout/svg/SVGLayoutSupport.h"
9 #include "core/paint/BlockPainter.h" 9 #include "core/paint/BlockPainter.h"
10 #include "core/paint/FloatClipRecorder.h" 10 #include "core/paint/FloatClipRecorder.h"
(...skipping 27 matching lines...) Expand all
38 paintInfo.phase != PaintPhaseSelection) 38 paintInfo.phase != PaintPhaseSelection)
39 return; 39 return;
40 40
41 PaintInfo paintInfoBeforeFiltering(paintInfo); 41 PaintInfo paintInfoBeforeFiltering(paintInfo);
42 paintInfoBeforeFiltering.updateCullRect( 42 paintInfoBeforeFiltering.updateCullRect(
43 m_layoutSVGForeignObject.localToSVGParentTransform()); 43 m_layoutSVGForeignObject.localToSVGParentTransform());
44 SVGTransformContext transformContext( 44 SVGTransformContext transformContext(
45 paintInfoBeforeFiltering.context, m_layoutSVGForeignObject, 45 paintInfoBeforeFiltering.context, m_layoutSVGForeignObject,
46 m_layoutSVGForeignObject.localToSVGParentTransform()); 46 m_layoutSVGForeignObject.localToSVGParentTransform());
47 47
48 // In theory we should just let BlockPainter::paint() handle the clip, but for
49 // now we don't allow normal overflow clip for LayoutSVGBlock, so we have to
50 // apply clip manually. See LayoutSVGBlock::allowsOverflowClip() for details.
48 Optional<FloatClipRecorder> clipRecorder; 51 Optional<FloatClipRecorder> clipRecorder;
49 if (SVGLayoutSupport::isOverflowHidden(&m_layoutSVGForeignObject)) { 52 if (SVGLayoutSupport::isOverflowHidden(&m_layoutSVGForeignObject)) {
50 clipRecorder.emplace( 53 clipRecorder.emplace(
51 paintInfoBeforeFiltering.context, m_layoutSVGForeignObject, 54 paintInfoBeforeFiltering.context, m_layoutSVGForeignObject,
52 paintInfoBeforeFiltering.phase, 55 paintInfoBeforeFiltering.phase,
53 FloatRect(FloatPoint(), 56 m_layoutSVGForeignObject.visualRectInLocalSVGCoordinates());
54 m_layoutSVGForeignObject.viewportRect().size()));
55 } 57 }
56 58
57 SVGPaintContext paintContext(m_layoutSVGForeignObject, 59 SVGPaintContext paintContext(m_layoutSVGForeignObject,
58 paintInfoBeforeFiltering); 60 paintInfoBeforeFiltering);
59 bool continueRendering = true; 61 bool continueRendering = true;
60 if (paintContext.paintInfo().phase == PaintPhaseForeground) 62 if (paintContext.paintInfo().phase == PaintPhaseForeground)
61 continueRendering = paintContext.applyClipMaskAndFilterIfNecessary(); 63 continueRendering = paintContext.applyClipMaskAndFilterIfNecessary();
62 64
63 if (continueRendering) { 65 if (continueRendering) {
64 // Paint all phases of FO elements atomically as though the FO element 66 // Paint all phases of FO elements atomically as though the FO element
65 // established its own stacking context. The delegate forwards calls to 67 // established its own stacking context. The delegate forwards calls to
66 // paint() in LayoutObject::paintAllPhasesAtomically() to 68 // paint() in LayoutObject::paintAllPhasesAtomically() to
67 // BlockPainter::paint(), instead of m_layoutSVGForeignObject.paint() (which 69 // BlockPainter::paint(), instead of m_layoutSVGForeignObject.paint() (which
68 // would call this method again). 70 // would call this method again).
69 BlockPainterDelegate delegate(m_layoutSVGForeignObject); 71 BlockPainterDelegate delegate(m_layoutSVGForeignObject);
70 // We have included location() in transform, so pass -location() to adjust 72 // We have included location() in transform, so pass -location() to adjust
71 // paint offset that will be added by location() in BlockPainter::paint(). 73 // paint offset that will be added by location() in BlockPainter::paint().
72 ObjectPainter(delegate).paintAllPhasesAtomically( 74 ObjectPainter(delegate).paintAllPhasesAtomically(
73 paintContext.paintInfo(), -m_layoutSVGForeignObject.location()); 75 paintContext.paintInfo(), -m_layoutSVGForeignObject.location());
74 } 76 }
75 } 77 }
76 78
77 } // namespace blink 79 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698