| OLD | NEW |
| 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 #ifndef SVGRootPainter_h | 5 #ifndef SVGRootPainter_h |
| 6 #define SVGRootPainter_h | 6 #define SVGRootPainter_h |
| 7 | 7 |
| 8 #include "wtf/Allocator.h" | 8 #include "wtf/Allocator.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| 11 | 11 |
| 12 struct PaintInfo; | 12 struct PaintInfo; |
| 13 class AffineTransform; |
| 14 class IntRect; |
| 13 class LayoutPoint; | 15 class LayoutPoint; |
| 14 class LayoutSVGRoot; | 16 class LayoutSVGRoot; |
| 15 | 17 |
| 16 class SVGRootPainter { | 18 class SVGRootPainter { |
| 17 STACK_ALLOCATED(); | 19 STACK_ALLOCATED(); |
| 18 public: | 20 public: |
| 19 SVGRootPainter(const LayoutSVGRoot& layoutSVGRoot) : m_layoutSVGRoot(layoutS
VGRoot) { } | 21 SVGRootPainter(const LayoutSVGRoot& layoutSVGRoot) : m_layoutSVGRoot(layoutS
VGRoot) { } |
| 20 | 22 |
| 21 void paint(const PaintInfo&, const LayoutPoint&); | 23 void paint(const PaintInfo&, const LayoutPoint&); |
| 22 | 24 |
| 25 // The embedded SVG document uses an unsnapped viewport box for layout, whil
e SVG root's border |
| 26 // box ultimately gets snapped during paint. This translate/scale transform
is applied to |
| 27 // compensate the difference, in addition to applying the local to border bo
x transform. |
| 28 AffineTransform transformToPixelSnappedBorderBox(const LayoutPoint& paintOff
set) const; |
| 29 |
| 23 private: | 30 private: |
| 31 IntRect pixelSnappedSize(const LayoutPoint& paintOffset) const; |
| 32 |
| 24 const LayoutSVGRoot& m_layoutSVGRoot; | 33 const LayoutSVGRoot& m_layoutSVGRoot; |
| 25 }; | 34 }; |
| 26 | 35 |
| 27 } // namespace blink | 36 } // namespace blink |
| 28 | 37 |
| 29 #endif // SVGRootPainter_h | 38 #endif // SVGRootPainter_h |
| OLD | NEW |