X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fthird_party%2FWebKit%2FSource%2Fcore%2Frendering%2Fsvg%2FRenderSVGImage.cpp;h=e1f2d20fc3199e3d324a50f7c7d6e6adb21df2d3;hb=3545e9f2671f595d2a2f3ee75ca0393b01e35ef6;hp=c56cf2ed14cdc5326e228289865c6aca58b91b1f;hpb=7d210d4c7e9ba36e635eabc5b5780495f8a63292;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/third_party/WebKit/Source/core/rendering/svg/RenderSVGImage.cpp b/src/third_party/WebKit/Source/core/rendering/svg/RenderSVGImage.cpp index c56cf2e..e1f2d20 100644 --- a/src/third_party/WebKit/Source/core/rendering/svg/RenderSVGImage.cpp +++ b/src/third_party/WebKit/Source/core/rendering/svg/RenderSVGImage.cpp @@ -27,18 +27,16 @@ #include "core/rendering/svg/RenderSVGImage.h" -#include "core/rendering/GraphicsContextAnnotator.h" +#include "core/paint/SVGImagePainter.h" #include "core/rendering/ImageQualityController.h" #include "core/rendering/PointerEventsHitRules.h" #include "core/rendering/RenderImageResource.h" #include "core/rendering/svg/RenderSVGResource.h" #include "core/rendering/svg/SVGRenderSupport.h" -#include "core/rendering/svg/SVGRenderingContext.h" #include "core/rendering/svg/SVGResources.h" #include "core/rendering/svg/SVGResourcesCache.h" #include "core/svg/SVGImageElement.h" #include "platform/LengthFunctions.h" -#include "platform/graphics/GraphicsContextStateSaver.h" namespace blink { @@ -53,8 +51,13 @@ RenderSVGImage::RenderSVGImage(SVGImageElement* impl) RenderSVGImage::~RenderSVGImage() { +} + +void RenderSVGImage::destroy() +{ ImageQualityController::remove(this); m_imageResource->shutdown(); + RenderSVGModelObject::destroy(); } bool RenderSVGImage::forceNonUniformScaling(SVGImageElement* image) const @@ -143,58 +146,7 @@ void RenderSVGImage::layout() void RenderSVGImage::paint(PaintInfo& paintInfo, const LayoutPoint&) { - ANNOTATE_GRAPHICS_CONTEXT(paintInfo, this); - - if (paintInfo.phase != PaintPhaseForeground - || style()->visibility() == HIDDEN - || !m_imageResource->hasImage()) - return; - - FloatRect boundingBox = paintInvalidationRectInLocalCoordinates(); - if (!SVGRenderSupport::paintInfoIntersectsPaintInvalidationRect(boundingBox, m_localTransform, paintInfo)) - return; - - PaintInfo childPaintInfo(paintInfo); - GraphicsContextStateSaver stateSaver(*childPaintInfo.context, false); - - if (!m_localTransform.isIdentity()) { - stateSaver.save(); - childPaintInfo.applyTransform(m_localTransform, false); - } - if (!m_objectBoundingBox.isEmpty()) { - // SVGRenderingContext may taint the state - make sure we're always saving. - SVGRenderingContext renderingContext(this, childPaintInfo, stateSaver.saved() ? - SVGRenderingContext::DontSaveGraphicsContext : SVGRenderingContext::SaveGraphicsContext); - - if (renderingContext.isRenderingPrepared()) { - if (style()->svgStyle().bufferedRendering() == BR_STATIC && renderingContext.bufferForeground(m_bufferedForeground)) - return; - - paintForeground(childPaintInfo); - } - } - - if (style()->outlineWidth()) - paintOutline(childPaintInfo, IntRect(boundingBox)); -} - -void RenderSVGImage::paintForeground(PaintInfo& paintInfo) -{ - RefPtr image = m_imageResource->image(); - FloatRect destRect = m_objectBoundingBox; - FloatRect srcRect(0, 0, image->width(), image->height()); - - SVGImageElement* imageElement = toSVGImageElement(element()); - imageElement->preserveAspectRatio()->currentValue()->transformRect(destRect, srcRect); - - InterpolationQuality interpolationQuality = InterpolationDefault; - if (style()->svgStyle().bufferedRendering() != BR_STATIC) - interpolationQuality = ImageQualityController::imageQualityController()->chooseInterpolationQuality(paintInfo.context, this, image.get(), image.get(), LayoutSize(destRect.size())); - - InterpolationQuality previousInterpolationQuality = paintInfo.context->imageInterpolationQuality(); - paintInfo.context->setImageInterpolationQuality(interpolationQuality); - paintInfo.context->drawImage(image.get(), destRect, srcRect, CompositeSourceOver); - paintInfo.context->setImageInterpolationQuality(previousInterpolationQuality); + SVGImagePainter(*this).paint(paintInfo); } void RenderSVGImage::invalidateBufferedForeground() @@ -243,13 +195,13 @@ void RenderSVGImage::imageChanged(WrappedImagePtr, const IntRect*) invalidateBufferedForeground(); - paintInvalidationForWholeRenderer(); + setShouldDoFullPaintInvalidation(true); } -void RenderSVGImage::addFocusRingRects(Vector& rects, const LayoutPoint&, const RenderLayerModelObject*) const +void RenderSVGImage::addFocusRingRects(Vector& rects, const LayoutPoint&, const RenderLayerModelObject*) const { // this is called from paint() after the localTransform has already been applied - IntRect contentRect = enclosingIntRect(paintInvalidationRectInLocalCoordinates()); + LayoutRect contentRect = LayoutRect(paintInvalidationRectInLocalCoordinates()); if (!contentRect.isEmpty()) rects.append(contentRect); }