| OLD | NEW |
| 1 /** | 1 /** |
| 2 * Copyright (C) 2007 Rob Buis <buis@kde.org> | 2 * Copyright (C) 2007 Rob Buis <buis@kde.org> |
| 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> | 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> |
| 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> | 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> |
| 5 * Copyright (C) 2009 Google, Inc. All rights reserved. | 5 * Copyright (C) 2009 Google, Inc. All rights reserved. |
| 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 7 * Copyright (C) 2012 Zoltan Herczeg <zherczeg@webkit.org>. | 7 * Copyright (C) 2012 Zoltan Herczeg <zherczeg@webkit.org>. |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 public: | 39 public: |
| 40 SubtreeContentTransformScope(const AffineTransform&); | 40 SubtreeContentTransformScope(const AffineTransform&); |
| 41 ~SubtreeContentTransformScope(); | 41 ~SubtreeContentTransformScope(); |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 AffineTransform m_savedContentTransformation; | 44 AffineTransform m_savedContentTransformation; |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 // SVGRenderingContext | 47 // SVGRenderingContext |
| 48 class SVGRenderingContext { | 48 class SVGRenderingContext { |
| 49 STACK_ALLOCATED(); |
| 49 public: | 50 public: |
| 50 // Does not start rendering. | 51 // Does not start rendering. |
| 51 SVGRenderingContext() | 52 SVGRenderingContext() |
| 52 : m_renderingFlags(0) | 53 : m_renderingFlags(0) |
| 53 , m_object(0) | 54 , m_object(nullptr) |
| 54 , m_paintInfo(0) | 55 , m_paintInfo(nullptr) |
| 55 , m_savedContext(0) | 56 , m_savedContext(nullptr) |
| 56 , m_filter(0) | 57 , m_filter(nullptr) |
| 57 , m_clipper(0) | 58 , m_clipper(nullptr) |
| 58 , m_clipperState(RenderSVGResourceClipper::ClipperNotApplied) | 59 , m_clipperState(RenderSVGResourceClipper::ClipperNotApplied) |
| 59 , m_masker(0) | 60 , m_masker(nullptr) |
| 60 { | 61 { |
| 61 } | 62 } |
| 62 | 63 |
| 63 SVGRenderingContext(RenderObject* object, PaintInfo& paintinfo) | 64 SVGRenderingContext(RenderObject* object, PaintInfo& paintinfo) |
| 64 : m_renderingFlags(0) | 65 : m_renderingFlags(0) |
| 65 , m_object(0) | 66 , m_object(nullptr) |
| 66 , m_paintInfo(0) | 67 , m_paintInfo(nullptr) |
| 67 , m_savedContext(0) | 68 , m_savedContext(nullptr) |
| 68 , m_filter(0) | 69 , m_filter(nullptr) |
| 69 , m_clipper(0) | 70 , m_clipper(nullptr) |
| 70 , m_clipperState(RenderSVGResourceClipper::ClipperNotApplied) | 71 , m_clipperState(RenderSVGResourceClipper::ClipperNotApplied) |
| 71 , m_masker(0) | 72 , m_masker(nullptr) |
| 72 { | 73 { |
| 73 prepareToRenderSVGContent(object, paintinfo); | 74 prepareToRenderSVGContent(object, paintinfo); |
| 74 } | 75 } |
| 75 | 76 |
| 76 // Automatically finishes context rendering. | 77 // Automatically finishes context rendering. |
| 77 ~SVGRenderingContext(); | 78 ~SVGRenderingContext(); |
| 78 | 79 |
| 79 // Used by all SVG renderers who apply clip/filter/etc. resources to the ren
derer content. | 80 // Used by all SVG renderers who apply clip/filter/etc. resources to the ren
derer content. |
| 80 void prepareToRenderSVGContent(RenderObject*, PaintInfo&); | 81 void prepareToRenderSVGContent(RenderObject*, PaintInfo&); |
| 81 bool isRenderingPrepared() const { return m_renderingFlags & RenderingPrepar
ed; } | 82 bool isRenderingPrepared() const { return m_renderingFlags & RenderingPrepar
ed; } |
| 82 | 83 |
| 83 static void renderSubtree(GraphicsContext*, RenderObject*); | 84 static void renderSubtree(GraphicsContext*, RenderObject*); |
| 84 | 85 |
| 85 static float calculateScreenFontSizeScalingFactor(const RenderObject*); | 86 static float calculateScreenFontSizeScalingFactor(const RenderObject*); |
| 86 | 87 |
| 87 private: | 88 private: |
| 88 // To properly revert partially successful initializtions in the destructor,
we record all successful steps. | 89 // To properly revert partially successful initializtions in the destructor,
we record all successful steps. |
| 89 enum RenderingFlags { | 90 enum RenderingFlags { |
| 90 RenderingPrepared = 1, | 91 RenderingPrepared = 1, |
| 91 RestoreGraphicsContext = 1 << 1, | 92 RestoreGraphicsContext = 1 << 1, |
| 92 EndOpacityLayer = 1 << 2, | 93 EndOpacityLayer = 1 << 2, |
| 93 PostApplyResources = 1 << 3, | 94 PostApplyResources = 1 << 3, |
| 94 PrepareToRenderSVGContentWasCalled = 1 << 4 | 95 PrepareToRenderSVGContentWasCalled = 1 << 4 |
| 95 }; | 96 }; |
| 96 | 97 |
| 97 // List of those flags which require actions during the destructor. | 98 // List of those flags which require actions during the destructor. |
| 98 const static int ActionsNeeded = RestoreGraphicsContext | EndOpacityLayer |
PostApplyResources; | 99 const static int ActionsNeeded = RestoreGraphicsContext | EndOpacityLayer |
PostApplyResources; |
| 99 | 100 |
| 100 int m_renderingFlags; | 101 int m_renderingFlags; |
| 101 RenderObject* m_object; | 102 RawPtrWillBeMember<RenderObject> m_object; |
| 102 PaintInfo* m_paintInfo; | 103 PaintInfo* m_paintInfo; |
| 103 GraphicsContext* m_savedContext; | 104 GraphicsContext* m_savedContext; |
| 104 IntRect m_savedPaintRect; | 105 IntRect m_savedPaintRect; |
| 105 RenderSVGResourceFilter* m_filter; | 106 RawPtrWillBeMember<RenderSVGResourceFilter> m_filter; |
| 106 RenderSVGResourceClipper* m_clipper; | 107 RawPtrWillBeMember<RenderSVGResourceClipper> m_clipper; |
| 107 RenderSVGResourceClipper::ClipperState m_clipperState; | 108 RenderSVGResourceClipper::ClipperState m_clipperState; |
| 108 RenderSVGResourceMasker* m_masker; | 109 RawPtrWillBeMember<RenderSVGResourceMasker> m_masker; |
| 109 }; | 110 }; |
| 110 | 111 |
| 111 } // namespace blink | 112 } // namespace blink |
| 112 | 113 |
| 113 #endif // SVGRenderingContext_h | 114 #endif // SVGRenderingContext_h |
| OLD | NEW |