| 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 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "core/rendering/svg/SVGRenderSupport.h" | 34 #include "core/rendering/svg/SVGRenderSupport.h" |
| 35 #include "core/rendering/svg/SVGResources.h" | 35 #include "core/rendering/svg/SVGResources.h" |
| 36 #include "core/rendering/svg/SVGResourcesCache.h" | 36 #include "core/rendering/svg/SVGResourcesCache.h" |
| 37 #include "platform/FloatConversion.h" | 37 #include "platform/FloatConversion.h" |
| 38 | 38 |
| 39 namespace blink { | 39 namespace blink { |
| 40 | 40 |
| 41 SVGRenderingContext::~SVGRenderingContext() | 41 SVGRenderingContext::~SVGRenderingContext() |
| 42 { | 42 { |
| 43 if (m_filter) { | 43 if (m_filter) { |
| 44 ASSERT(SVGResourcesCache::cachedResourcesForRenderObject(m_object)); | 44 ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(m_object)); |
| 45 ASSERT(SVGResourcesCache::cachedResourcesForRenderObject(m_object)->filt
er() == m_filter); | 45 ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(m_object)->filt
er() == m_filter); |
| 46 | 46 |
| 47 RenderDrawingRecorder recorder(m_originalPaintInfo->context, *m_object,
DisplayItem::SVGFilter, LayoutRect::infiniteRect()); | 47 RenderDrawingRecorder recorder(m_originalPaintInfo->context, *m_object,
DisplayItem::SVGFilter, LayoutRect::infiniteRect()); |
| 48 if (!recorder.canUseCachedDrawing()) | 48 if (!recorder.canUseCachedDrawing()) |
| 49 m_filter->finishEffect(m_object, m_originalPaintInfo->context); | 49 m_filter->finishEffect(m_object, m_originalPaintInfo->context); |
| 50 | 50 |
| 51 // Reset the paint info after the filter effect has been completed. | 51 // Reset the paint info after the filter effect has been completed. |
| 52 // This isn't strictly required (e.g., m_paintInfo.rect is not used | 52 // This isn't strictly required (e.g., m_paintInfo.rect is not used |
| 53 // after this). | 53 // after this). |
| 54 m_paintInfo.context = m_originalPaintInfo->context; | 54 m_paintInfo.context = m_originalPaintInfo->context; |
| 55 m_paintInfo.rect = m_originalPaintInfo->rect; | 55 m_paintInfo.rect = m_originalPaintInfo->rect; |
| 56 } | 56 } |
| 57 | 57 |
| 58 if (m_masker) { | 58 if (m_masker) { |
| 59 ASSERT(SVGResourcesCache::cachedResourcesForRenderObject(m_object)); | 59 ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(m_object)); |
| 60 ASSERT(SVGResourcesCache::cachedResourcesForRenderObject(m_object)->mask
er() == m_masker); | 60 ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(m_object)->mask
er() == m_masker); |
| 61 m_masker->finishEffect(m_object, m_paintInfo.context); | 61 m_masker->finishEffect(m_object, m_paintInfo.context); |
| 62 } | 62 } |
| 63 | 63 |
| 64 if (m_clipper) { | 64 if (m_clipper) { |
| 65 ASSERT(SVGResourcesCache::cachedResourcesForRenderObject(m_object)); | 65 ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(m_object)); |
| 66 ASSERT(SVGResourcesCache::cachedResourcesForRenderObject(m_object)->clip
per() == m_clipper); | 66 ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(m_object)->clip
per() == m_clipper); |
| 67 m_clipper->postApplyStatefulResource(m_object, m_paintInfo.context, m_cl
ipperState); | 67 m_clipper->postApplyStatefulResource(m_object, m_paintInfo.context, m_cl
ipperState); |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | 70 |
| 71 bool SVGRenderingContext::applyClipMaskAndFilterIfNecessary() | 71 bool SVGRenderingContext::applyClipMaskAndFilterIfNecessary() |
| 72 { | 72 { |
| 73 #if ENABLE(ASSERT) | 73 #if ENABLE(ASSERT) |
| 74 ASSERT(!m_applyClipMaskAndFilterIfNecessaryCalled); | 74 ASSERT(!m_applyClipMaskAndFilterIfNecessaryCalled); |
| 75 m_applyClipMaskAndFilterIfNecessaryCalled = true; | 75 m_applyClipMaskAndFilterIfNecessaryCalled = true; |
| 76 #endif | 76 #endif |
| 77 | 77 |
| 78 SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(
m_object); | 78 SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObject(
m_object); |
| 79 | 79 |
| 80 // When rendering clip paths as masks, only geometric operations should be i
ncluded so skip | 80 // When rendering clip paths as masks, only geometric operations should be i
ncluded so skip |
| 81 // non-geometric operations such as compositing, masking, and filtering. | 81 // non-geometric operations such as compositing, masking, and filtering. |
| 82 if (m_paintInfo.isRenderingClipPathAsMaskImage()) { | 82 if (m_paintInfo.isRenderingClipPathAsMaskImage()) { |
| 83 if (!applyClipIfNecessary(resources)) | 83 if (!applyClipIfNecessary(resources)) |
| 84 return false; | 84 return false; |
| 85 return true; | 85 return true; |
| 86 } | 86 } |
| 87 | 87 |
| 88 applyCompositingIfNecessary(); | 88 applyCompositingIfNecessary(); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 AffineTransform& contentTransformation = currentContentTransformation(); | 198 AffineTransform& contentTransformation = currentContentTransformation(); |
| 199 m_savedContentTransformation = contentTransformation; | 199 m_savedContentTransformation = contentTransformation; |
| 200 contentTransformation = subtreeContentTransformation * contentTransformation
; | 200 contentTransformation = subtreeContentTransformation * contentTransformation
; |
| 201 } | 201 } |
| 202 | 202 |
| 203 SubtreeContentTransformScope::~SubtreeContentTransformScope() | 203 SubtreeContentTransformScope::~SubtreeContentTransformScope() |
| 204 { | 204 { |
| 205 currentContentTransformation() = m_savedContentTransformation; | 205 currentContentTransformation() = m_savedContentTransformation; |
| 206 } | 206 } |
| 207 | 207 |
| 208 float SVGRenderingContext::calculateScreenFontSizeScalingFactor(const RenderObje
ct* renderer) | 208 float SVGRenderingContext::calculateScreenFontSizeScalingFactor(const LayoutObje
ct* renderer) |
| 209 { | 209 { |
| 210 // FIXME: trying to compute a device space transform at record time is wrong
. All clients | 210 // FIXME: trying to compute a device space transform at record time is wrong
. All clients |
| 211 // should be updated to avoid relying on this information, and the method sh
ould be removed. | 211 // should be updated to avoid relying on this information, and the method sh
ould be removed. |
| 212 | 212 |
| 213 ASSERT(renderer); | 213 ASSERT(renderer); |
| 214 // We're about to possibly clear renderer, so save the deviceScaleFactor now
. | 214 // We're about to possibly clear renderer, so save the deviceScaleFactor now
. |
| 215 float deviceScaleFactor = renderer->document().frameHost()->deviceScaleFacto
r(); | 215 float deviceScaleFactor = renderer->document().frameHost()->deviceScaleFacto
r(); |
| 216 | 216 |
| 217 // Walk up the render tree, accumulating SVG transforms. | 217 // Walk up the render tree, accumulating SVG transforms. |
| 218 AffineTransform ctm = currentContentTransformation(); | 218 AffineTransform ctm = currentContentTransformation(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 240 ctm = layerTransform->toAffineTransform() * ctm; | 240 ctm = layerTransform->toAffineTransform() * ctm; |
| 241 | 241 |
| 242 layer = layer->parent(); | 242 layer = layer->parent(); |
| 243 } | 243 } |
| 244 | 244 |
| 245 ctm.scale(deviceScaleFactor); | 245 ctm.scale(deviceScaleFactor); |
| 246 | 246 |
| 247 return narrowPrecisionToFloat(sqrt((pow(ctm.xScale(), 2) + pow(ctm.yScale(),
2)) / 2)); | 247 return narrowPrecisionToFloat(sqrt((pow(ctm.xScale(), 2) + pow(ctm.yScale(),
2)) / 2)); |
| 248 } | 248 } |
| 249 | 249 |
| 250 void SVGRenderingContext::renderSubtree(GraphicsContext* context, RenderObject*
item) | 250 void SVGRenderingContext::renderSubtree(GraphicsContext* context, LayoutObject*
item) |
| 251 { | 251 { |
| 252 ASSERT(context); | 252 ASSERT(context); |
| 253 ASSERT(item); | 253 ASSERT(item); |
| 254 ASSERT(!item->needsLayout()); | 254 ASSERT(!item->needsLayout()); |
| 255 | 255 |
| 256 PaintInfo info(context, LayoutRect::infiniteIntRect(), PaintPhaseForeground,
PaintBehaviorNormal); | 256 PaintInfo info(context, LayoutRect::infiniteIntRect(), PaintPhaseForeground,
PaintBehaviorNormal); |
| 257 item->paint(info, IntPoint()); | 257 item->paint(info, IntPoint()); |
| 258 } | 258 } |
| 259 | 259 |
| 260 } // namespace blink | 260 } // namespace blink |
| OLD | NEW |