| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 class RenderObject; | 47 class RenderObject; |
| 48 class RenderStyle; | 48 class RenderStyle; |
| 49 class RenderSVGResourceSolidColor; | 49 class RenderSVGResourceSolidColor; |
| 50 | 50 |
| 51 class SVGPaintServer { | 51 class SVGPaintServer { |
| 52 public: | 52 public: |
| 53 explicit SVGPaintServer(Color); | 53 explicit SVGPaintServer(Color); |
| 54 explicit SVGPaintServer(PassRefPtr<Gradient>); | 54 explicit SVGPaintServer(PassRefPtr<Gradient>); |
| 55 explicit SVGPaintServer(PassRefPtr<Pattern>); | 55 explicit SVGPaintServer(PassRefPtr<Pattern>); |
| 56 | 56 |
| 57 static SVGPaintServer requestForRenderer(RenderObject&, RenderStyle*, Render
SVGResourceMode); | 57 static SVGPaintServer requestForRenderer(const RenderObject&, const RenderSt
yle*, RenderSVGResourceMode); |
| 58 | 58 |
| 59 void apply(GraphicsContext&, RenderSVGResourceMode, GraphicsContextStateSave
r* = 0); | 59 void apply(GraphicsContext&, RenderSVGResourceMode, GraphicsContextStateSave
r* = 0); |
| 60 | 60 |
| 61 static SVGPaintServer invalid() { return SVGPaintServer(Color(Color::transpa
rent)); } | 61 static SVGPaintServer invalid() { return SVGPaintServer(Color(Color::transpa
rent)); } |
| 62 bool isValid() const { return m_color != Color::transparent; } | 62 bool isValid() const { return m_color != Color::transparent; } |
| 63 | 63 |
| 64 bool isTransformDependent() const { return m_gradient || m_pattern; } | 64 bool isTransformDependent() const { return m_gradient || m_pattern; } |
| 65 void prependTransform(const AffineTransform&); | 65 void prependTransform(const AffineTransform&); |
| 66 | 66 |
| 67 private: | 67 private: |
| 68 RefPtr<Gradient> m_gradient; | 68 RefPtr<Gradient> m_gradient; |
| 69 RefPtr<Pattern> m_pattern; | 69 RefPtr<Pattern> m_pattern; |
| 70 Color m_color; | 70 Color m_color; |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 class RenderSVGResource { | 73 class RenderSVGResource { |
| 74 public: | 74 public: |
| 75 RenderSVGResource() { } | 75 RenderSVGResource() { } |
| 76 virtual ~RenderSVGResource() { } | 76 virtual ~RenderSVGResource() { } |
| 77 | 77 |
| 78 virtual SVGPaintServer preparePaintServer(RenderObject*); | 78 virtual SVGPaintServer preparePaintServer(const RenderObject&); |
| 79 | 79 |
| 80 virtual RenderSVGResourceType resourceType() const = 0; | 80 virtual RenderSVGResourceType resourceType() const = 0; |
| 81 | 81 |
| 82 // Helper utilities used in the render tree to access resources used for pai
nting shapes/text (gradients & patterns & solid colors only) | 82 // Helper utilities used in the render tree to access resources used for pai
nting shapes/text (gradients & patterns & solid colors only) |
| 83 // If hasFallback gets set to true, the sharedSolidPaintingResource is set t
o a fallback color. | 83 // If hasFallback gets set to true, the sharedSolidPaintingResource is set t
o a fallback color. |
| 84 static RenderSVGResource* requestPaintingResource(RenderSVGResourceMode, Ren
derObject*, const RenderStyle*, bool& hasFallback); | 84 static RenderSVGResource* requestPaintingResource(RenderSVGResourceMode, con
st RenderObject&, const RenderStyle*, bool& hasFallback); |
| 85 static RenderSVGResourceSolidColor* sharedSolidPaintingResource(); | 85 static RenderSVGResourceSolidColor* sharedSolidPaintingResource(); |
| 86 | 86 |
| 87 static void markForLayoutAndParentResourceInvalidation(RenderObject*, bool n
eedsLayout = true); | 87 static void markForLayoutAndParentResourceInvalidation(RenderObject*, bool n
eedsLayout = true); |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 #define DEFINE_RENDER_SVG_RESOURCE_TYPE_CASTS(thisType, typeName) \ | 90 #define DEFINE_RENDER_SVG_RESOURCE_TYPE_CASTS(thisType, typeName) \ |
| 91 DEFINE_TYPE_CASTS(thisType, RenderSVGResource, resource, resource->resourceT
ype() == typeName, resource.resourceType() == typeName) | 91 DEFINE_TYPE_CASTS(thisType, RenderSVGResource, resource, resource->resourceT
ype() == typeName, resource.resourceType() == typeName) |
| 92 | 92 |
| 93 } | 93 } |
| 94 | 94 |
| 95 #endif | 95 #endif |
| OLD | NEW |