OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008 Rob Buis <buis@kde.org> | 2 * Copyright (C) 2007, 2008 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) 2009 Dirk Schulze <krit@webkit.org> | 6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
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 |
11 * License as published by the Free Software Foundation; either | 11 * License as published by the Free Software Foundation; either |
12 * version 2 of the License, or (at your option) any later version. | 12 * version 2 of the License, or (at your option) any later version. |
13 * | 13 * |
14 * This library is distributed in the hope that it will be useful, | 14 * This library is distributed in the hope that it will be useful, |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
17 * Library General Public License for more details. | 17 * Library General Public License for more details. |
18 * | 18 * |
19 * You should have received a copy of the GNU Library General Public License | 19 * You should have received a copy of the GNU Library General Public License |
20 * along with this library; see the file COPYING.LIB. If not, write to | 20 * along with this library; see the file COPYING.LIB. If not, write to |
21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
22 * Boston, MA 02110-1301, USA. | 22 * Boston, MA 02110-1301, USA. |
23 */ | 23 */ |
24 | 24 |
25 #include "config.h" | 25 #include "config.h" |
26 | 26 |
27 #include "core/rendering/svg/SVGRenderingContext.h" | 27 #include "core/rendering/svg/SVGRenderingContext.h" |
28 | 28 |
29 #include "core/frame/FrameHost.h" | 29 #include "core/frame/FrameHost.h" |
30 #include "core/frame/FrameView.h" | |
31 #include "core/frame/LocalFrame.h" | |
32 #include "core/frame/Settings.h" | |
33 #include "core/paint/SVGImagePainter.h" | 30 #include "core/paint/SVGImagePainter.h" |
34 #include "core/rendering/RenderLayer.h" | 31 #include "core/rendering/RenderLayer.h" |
35 #include "core/rendering/svg/RenderSVGImage.h" | 32 #include "core/rendering/svg/RenderSVGImage.h" |
36 #include "core/rendering/svg/RenderSVGResource.h" | 33 #include "core/rendering/svg/RenderSVGResource.h" |
37 #include "core/rendering/svg/RenderSVGResourceFilter.h" | 34 #include "core/rendering/svg/RenderSVGResourceFilter.h" |
38 #include "core/rendering/svg/RenderSVGResourceMasker.h" | 35 #include "core/rendering/svg/RenderSVGResourceMasker.h" |
| 36 #include "core/rendering/svg/SVGRenderSupport.h" |
39 #include "core/rendering/svg/SVGResources.h" | 37 #include "core/rendering/svg/SVGResources.h" |
40 #include "core/rendering/svg/SVGResourcesCache.h" | 38 #include "core/rendering/svg/SVGResourcesCache.h" |
41 #include "platform/FloatConversion.h" | 39 #include "platform/FloatConversion.h" |
42 | 40 |
43 static int kMaxImageBufferSize = 4096; | 41 static int kMaxImageBufferSize = 4096; |
44 | 42 |
45 namespace blink { | 43 namespace blink { |
46 | 44 |
47 static inline bool isRenderingMaskImage(RenderObject* object) | |
48 { | |
49 if (object->frame() && object->frame()->view()) | |
50 return object->frame()->view()->paintBehavior() & PaintBehaviorRendering
SVGMask; | |
51 return false; | |
52 } | |
53 | |
54 SVGRenderingContext::~SVGRenderingContext() | 45 SVGRenderingContext::~SVGRenderingContext() |
55 { | 46 { |
56 // Fast path if we don't need to restore anything. | 47 // Fast path if we don't need to restore anything. |
57 if (!(m_renderingFlags & ActionsNeeded)) | 48 if (!(m_renderingFlags & ActionsNeeded)) |
58 return; | 49 return; |
59 | 50 |
60 ASSERT(m_object && m_paintInfo); | 51 ASSERT(m_object && m_paintInfo); |
61 | 52 |
62 if (m_renderingFlags & PostApplyResources) { | 53 if (m_renderingFlags & PostApplyResources) { |
63 ASSERT(m_masker || m_clipper || m_filter); | 54 ASSERT(m_masker || m_clipper || m_filter); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 m_object = object; | 92 m_object = object; |
102 m_paintInfo = &paintInfo; | 93 m_paintInfo = &paintInfo; |
103 m_filter = 0; | 94 m_filter = 0; |
104 | 95 |
105 RenderStyle* style = m_object->style(); | 96 RenderStyle* style = m_object->style(); |
106 ASSERT(style); | 97 ASSERT(style); |
107 | 98 |
108 const SVGRenderStyle& svgStyle = style->svgStyle(); | 99 const SVGRenderStyle& svgStyle = style->svgStyle(); |
109 | 100 |
110 // Setup transparency layers before setting up SVG resources! | 101 // Setup transparency layers before setting up SVG resources! |
111 bool isRenderingMask = isRenderingMaskImage(m_object); | 102 bool isRenderingMask = SVGRenderSupport::isRenderingMaskImage(*m_object); |
112 // RenderLayer takes care of root opacity. | 103 // RenderLayer takes care of root opacity. |
113 float opacity = (object->isSVGRoot() || isRenderingMask) ? 1 : style->opacit
y(); | 104 float opacity = (object->isSVGRoot() || isRenderingMask) ? 1 : style->opacit
y(); |
114 bool hasBlendMode = style->hasBlendMode() && !isRenderingMask; | 105 bool hasBlendMode = style->hasBlendMode() && !isRenderingMask; |
115 | 106 |
116 if (opacity < 1 || hasBlendMode || style->hasIsolation()) { | 107 if (opacity < 1 || hasBlendMode || style->hasIsolation()) { |
117 FloatRect paintInvalidationRect = m_object->paintInvalidationRectInLocal
Coordinates(); | 108 FloatRect paintInvalidationRect = m_object->paintInvalidationRectInLocal
Coordinates(); |
118 m_paintInfo->context->clip(paintInvalidationRect); | 109 m_paintInfo->context->clip(paintInvalidationRect); |
119 | 110 |
120 if (hasBlendMode) { | 111 if (hasBlendMode) { |
121 if (!(m_renderingFlags & RestoreGraphicsContext)) { | 112 if (!(m_renderingFlags & RestoreGraphicsContext)) { |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 SVGImagePainter::paintForeground(toRenderSVGImage(*m_object), buffer
edInfo); | 289 SVGImagePainter::paintForeground(toRenderSVGImage(*m_object), buffer
edInfo); |
299 } else | 290 } else |
300 return false; | 291 return false; |
301 } | 292 } |
302 | 293 |
303 m_paintInfo->context->drawImageBuffer(imageBuffer.get(), boundingBox); | 294 m_paintInfo->context->drawImageBuffer(imageBuffer.get(), boundingBox); |
304 return true; | 295 return true; |
305 } | 296 } |
306 | 297 |
307 } // namespace blink | 298 } // namespace blink |
OLD | NEW |