| 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  188     contentTransformation = subtreeContentTransformation * contentTransformation
     ; |  188     contentTransformation = subtreeContentTransformation * contentTransformation
     ; | 
|  189 } |  189 } | 
|  190  |  190  | 
|  191 SubtreeContentTransformScope::~SubtreeContentTransformScope() |  191 SubtreeContentTransformScope::~SubtreeContentTransformScope() | 
|  192 { |  192 { | 
|  193     currentContentTransformation() = m_savedContentTransformation; |  193     currentContentTransformation() = m_savedContentTransformation; | 
|  194 } |  194 } | 
|  195  |  195  | 
|  196 float SVGRenderingContext::calculateScreenFontSizeScalingFactor(const RenderObje
     ct* renderer) |  196 float SVGRenderingContext::calculateScreenFontSizeScalingFactor(const RenderObje
     ct* renderer) | 
|  197 { |  197 { | 
|  198     ASSERT(renderer); |  | 
|  199  |  | 
|  200     AffineTransform ctm; |  | 
|  201     // FIXME: calculateDeviceSpaceTransformation() queries layer compositing sta
     te - which is not |  | 
|  202     // supported during layout. Hence, the result may not include all CSS transf
     orms. |  | 
|  203     calculateDeviceSpaceTransformation(renderer, ctm); |  | 
|  204     return narrowPrecisionToFloat(sqrt((pow(ctm.xScale(), 2) + pow(ctm.yScale(),
      2)) / 2)); |  | 
|  205 } |  | 
|  206  |  | 
|  207 void SVGRenderingContext::calculateDeviceSpaceTransformation(const RenderObject*
      renderer, AffineTransform& absoluteTransform) |  | 
|  208 { |  | 
|  209     // FIXME: trying to compute a device space transform at record time is wrong
     . All clients |  198     // FIXME: trying to compute a device space transform at record time is wrong
     . All clients | 
|  210     // should be updated to avoid relying on this information, and the method sh
     ould be removed. |  199     // should be updated to avoid relying on this information, and the method sh
     ould be removed. | 
|  211  |  200  | 
|  212     ASSERT(renderer); |  201     ASSERT(renderer); | 
|  213     // We're about to possibly clear renderer, so save the deviceScaleFactor now
     . |  202     // We're about to possibly clear renderer, so save the deviceScaleFactor now
     . | 
|  214     float deviceScaleFactor = renderer->document().frameHost()->deviceScaleFacto
     r(); |  203     float deviceScaleFactor = renderer->document().frameHost()->deviceScaleFacto
     r(); | 
|  215  |  204  | 
|  216     // Walk up the render tree, accumulating SVG transforms. |  205     // Walk up the render tree, accumulating SVG transforms. | 
|  217     absoluteTransform = currentContentTransformation(); |  206     AffineTransform ctm = currentContentTransformation(); | 
|  218     while (renderer) { |  207     while (renderer) { | 
|  219         absoluteTransform = renderer->localToParentTransform() * absoluteTransfo
     rm; |  208         ctm = renderer->localToParentTransform() * ctm; | 
|  220         if (renderer->isSVGRoot()) |  209         if (renderer->isSVGRoot()) | 
|  221             break; |  210             break; | 
|  222         renderer = renderer->parent(); |  211         renderer = renderer->parent(); | 
|  223     } |  212     } | 
|  224  |  213  | 
|  225     // Continue walking up the layer tree, accumulating CSS transforms. |  214     // Continue walking up the layer tree, accumulating CSS transforms. | 
 |  215     // FIXME: this queries layer compositing state - which is not | 
 |  216     // supported during layout. Hence, the result may not include all CSS transf
     orms. | 
|  226     RenderLayer* layer = renderer ? renderer->enclosingLayer() : 0; |  217     RenderLayer* layer = renderer ? renderer->enclosingLayer() : 0; | 
|  227     while (layer && layer->isAllowedToQueryCompositingState()) { |  218     while (layer && layer->isAllowedToQueryCompositingState()) { | 
|  228         // We can stop at compositing layers, to match the backing resolution. |  219         // We can stop at compositing layers, to match the backing resolution. | 
|  229         // FIXME: should we be computing the transform to the nearest composited
      layer, |  220         // FIXME: should we be computing the transform to the nearest composited
      layer, | 
|  230         // or the nearest composited layer that does not paint into its ancestor
     ? |  221         // or the nearest composited layer that does not paint into its ancestor
     ? | 
|  231         // I think this is the nearest composited ancestor since we will inherit
      its |  222         // I think this is the nearest composited ancestor since we will inherit
      its | 
|  232         // transforms in the composited layer tree. |  223         // transforms in the composited layer tree. | 
|  233         if (layer->compositingState() != NotComposited) |  224         if (layer->compositingState() != NotComposited) | 
|  234             break; |  225             break; | 
|  235  |  226  | 
|  236         if (TransformationMatrix* layerTransform = layer->transform()) |  227         if (TransformationMatrix* layerTransform = layer->transform()) | 
|  237             absoluteTransform = layerTransform->toAffineTransform() * absoluteTr
     ansform; |  228             ctm = layerTransform->toAffineTransform() * ctm; | 
|  238  |  229  | 
|  239         layer = layer->parent(); |  230         layer = layer->parent(); | 
|  240     } |  231     } | 
|  241  |  232  | 
|  242     absoluteTransform.scale(deviceScaleFactor); |  233     ctm.scale(deviceScaleFactor); | 
 |  234  | 
 |  235     return narrowPrecisionToFloat(sqrt((pow(ctm.xScale(), 2) + pow(ctm.yScale(),
      2)) / 2)); | 
|  243 } |  236 } | 
|  244  |  237  | 
|  245 void SVGRenderingContext::renderSubtree(GraphicsContext* context, RenderObject* 
     item) |  238 void SVGRenderingContext::renderSubtree(GraphicsContext* context, RenderObject* 
     item) | 
|  246 { |  239 { | 
|  247     ASSERT(context); |  240     ASSERT(context); | 
|  248     ASSERT(item); |  241     ASSERT(item); | 
|  249     ASSERT(!item->needsLayout()); |  242     ASSERT(!item->needsLayout()); | 
|  250  |  243  | 
|  251     PaintInfo info(context, PaintInfo::infiniteRect(), PaintPhaseForeground, Pai
     ntBehaviorNormal); |  244     PaintInfo info(context, PaintInfo::infiniteRect(), PaintPhaseForeground, Pai
     ntBehaviorNormal); | 
|  252     item->paint(info, IntPoint()); |  245     item->paint(info, IntPoint()); | 
| (...skipping 24 matching lines...) Expand all  Loading... | 
|  277             SVGImagePainter::paintForeground(toRenderSVGImage(*m_object), buffer
     edInfo); |  270             SVGImagePainter::paintForeground(toRenderSVGImage(*m_object), buffer
     edInfo); | 
|  278         } else |  271         } else | 
|  279             return false; |  272             return false; | 
|  280     } |  273     } | 
|  281  |  274  | 
|  282     m_paintInfo->context->drawImageBuffer(imageBuffer.get(), boundingBox); |  275     m_paintInfo->context->drawImageBuffer(imageBuffer.get(), boundingBox); | 
|  283     return true; |  276     return true; | 
|  284 } |  277 } | 
|  285  |  278  | 
|  286 } // namespace blink |  279 } // namespace blink | 
| OLD | NEW |