Chromium Code Reviews| 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 14 matching lines...) Expand all Loading... | |
| 25 #include "platform/graphics/Pattern.h" | 25 #include "platform/graphics/Pattern.h" |
| 26 | 26 |
| 27 namespace blink { | 27 namespace blink { |
| 28 | 28 |
| 29 enum RenderSVGResourceType { | 29 enum RenderSVGResourceType { |
| 30 MaskerResourceType, | 30 MaskerResourceType, |
| 31 MarkerResourceType, | 31 MarkerResourceType, |
| 32 PatternResourceType, | 32 PatternResourceType, |
| 33 LinearGradientResourceType, | 33 LinearGradientResourceType, |
| 34 RadialGradientResourceType, | 34 RadialGradientResourceType, |
| 35 SolidColorResourceType, | |
| 36 FilterResourceType, | 35 FilterResourceType, |
| 37 ClipperResourceType | 36 ClipperResourceType |
| 38 }; | 37 }; |
| 39 | 38 |
| 40 enum RenderSVGResourceMode { | 39 enum RenderSVGResourceMode { |
| 41 ApplyToFillMode, | 40 ApplyToFillMode, |
| 42 ApplyToStrokeMode, | 41 ApplyToStrokeMode, |
| 43 }; | 42 }; |
| 44 | 43 |
| 45 class GraphicsContext; | 44 class GraphicsContext; |
| 46 class GraphicsContextStateSaver; | 45 class GraphicsContextStateSaver; |
| 47 class RenderObject; | 46 class RenderObject; |
| 48 class RenderStyle; | 47 class RenderStyle; |
| 49 class RenderSVGResourceSolidColor; | |
| 50 | 48 |
| 51 class SVGPaintServer { | 49 class SVGPaintServer { |
| 52 public: | 50 public: |
| 53 explicit SVGPaintServer(Color); | 51 explicit SVGPaintServer(Color); |
| 54 explicit SVGPaintServer(PassRefPtr<Gradient>); | 52 explicit SVGPaintServer(PassRefPtr<Gradient>); |
| 55 explicit SVGPaintServer(PassRefPtr<Pattern>); | 53 explicit SVGPaintServer(PassRefPtr<Pattern>); |
| 56 | 54 |
| 57 static SVGPaintServer requestForRenderer(const RenderObject&, const RenderSt yle*, RenderSVGResourceMode); | 55 static SVGPaintServer requestForRenderer(const RenderObject&, const RenderSt yle*, RenderSVGResourceMode); |
| 58 | 56 |
| 59 void apply(GraphicsContext&, RenderSVGResourceMode, GraphicsContextStateSave r* = 0); | 57 void apply(GraphicsContext&, RenderSVGResourceMode, GraphicsContextStateSave r* = 0); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 72 | 70 |
| 73 class RenderSVGResource { | 71 class RenderSVGResource { |
| 74 public: | 72 public: |
| 75 RenderSVGResource() { } | 73 RenderSVGResource() { } |
| 76 virtual ~RenderSVGResource() { } | 74 virtual ~RenderSVGResource() { } |
| 77 | 75 |
| 78 virtual SVGPaintServer preparePaintServer(const RenderObject&); | 76 virtual SVGPaintServer preparePaintServer(const RenderObject&); |
| 79 | 77 |
| 80 virtual RenderSVGResourceType resourceType() const = 0; | 78 virtual RenderSVGResourceType resourceType() const = 0; |
| 81 | 79 |
| 82 // Helper utilities used in the render tree to access resources used for pai nting shapes/text (gradients & patterns & solid colors only) | 80 // Helper utilities used in the render tree to access resources used for |
| 83 // If hasFallback gets set to true, the sharedSolidPaintingResource is set t o a fallback color. | 81 // painting shapes/text (gradients & patterns & solid colors only). |
| 84 static RenderSVGResource* requestPaintingResource(RenderSVGResourceMode, con st RenderObject&, const RenderStyle*, bool& hasFallback); | 82 // If |PaintDescription::hasFallback| is true, |PaintDescription::color| is set to a fallback color. |
| 85 static RenderSVGResourceSolidColor* sharedSolidPaintingResource(); | 83 struct PaintDescription { |
|
f(malita)
2014/10/20 14:51:06
This smells close enough to a paint server to make
fs
2014/10/20 15:20:20
It's the case you mention and the DRT code. For DR
fs
2014/10/20 15:52:24
Oh, and it'll not be possible to tell a fallback c
| |
| 84 PaintDescription() : resource(nullptr), isValid(false), hasFallback(fals e) { } | |
| 85 PaintDescription(Color color) : resource(nullptr), color(color), isValid (true), hasFallback(false) { } | |
| 86 PaintDescription(RenderSVGResource* resource) : resource(resource), isVa lid(true), hasFallback(false) { ASSERT(resource); } | |
| 87 PaintDescription(RenderSVGResource* resource, Color fallbackColor) : res ource(resource), color(fallbackColor), isValid(true), hasFallback(true) { ASSERT (resource); } | |
| 88 | |
| 89 RenderSVGResource* resource; | |
| 90 Color color; | |
| 91 bool isValid; | |
| 92 bool hasFallback; | |
| 93 }; | |
| 94 static PaintDescription requestPaint(RenderSVGResourceMode, const RenderObje ct&, const RenderStyle*); | |
| 86 | 95 |
| 87 static void markForLayoutAndParentResourceInvalidation(RenderObject*, bool n eedsLayout = true); | 96 static void markForLayoutAndParentResourceInvalidation(RenderObject*, bool n eedsLayout = true); |
| 88 }; | 97 }; |
| 89 | 98 |
| 90 #define DEFINE_RENDER_SVG_RESOURCE_TYPE_CASTS(thisType, typeName) \ | 99 #define DEFINE_RENDER_SVG_RESOURCE_TYPE_CASTS(thisType, typeName) \ |
| 91 DEFINE_TYPE_CASTS(thisType, RenderSVGResource, resource, resource->resourceT ype() == typeName, resource.resourceType() == typeName) | 100 DEFINE_TYPE_CASTS(thisType, RenderSVGResource, resource, resource->resourceT ype() == typeName, resource.resourceType() == typeName) |
| 92 | 101 |
| 93 } | 102 } |
| 94 | 103 |
| 95 #endif | 104 #endif |
| OLD | NEW |