Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: Source/core/rendering/svg/RenderSVGRoot.cpp

Issue 22604008: Allow SVG images to not taint the canvas with drawImage/drawPattern (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase after r156375 Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLImageElement.cpp ('k') | Source/core/svg/graphics/SVGImage.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2007, 2008, 2009 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2007, 2008, 2009 Rob Buis <buis@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. 5 * Copyright (C) 2009 Google, Inc.
6 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 22 matching lines...) Expand all
33 #include "core/rendering/HitTestResult.h" 33 #include "core/rendering/HitTestResult.h"
34 #include "core/rendering/LayoutRepainter.h" 34 #include "core/rendering/LayoutRepainter.h"
35 #include "core/rendering/RenderPart.h" 35 #include "core/rendering/RenderPart.h"
36 #include "core/rendering/RenderView.h" 36 #include "core/rendering/RenderView.h"
37 #include "core/rendering/svg/RenderSVGResourceContainer.h" 37 #include "core/rendering/svg/RenderSVGResourceContainer.h"
38 #include "core/rendering/svg/SVGRenderingContext.h" 38 #include "core/rendering/svg/SVGRenderingContext.h"
39 #include "core/rendering/svg/SVGResources.h" 39 #include "core/rendering/svg/SVGResources.h"
40 #include "core/rendering/svg/SVGResourcesCache.h" 40 #include "core/rendering/svg/SVGResourcesCache.h"
41 #include "core/svg/SVGElement.h" 41 #include "core/svg/SVGElement.h"
42 #include "core/svg/SVGSVGElement.h" 42 #include "core/svg/SVGSVGElement.h"
43 #include "core/svg/graphics/SVGImage.h"
43 44
44 using namespace std; 45 using namespace std;
45 46
46 namespace WebCore { 47 namespace WebCore {
47 48
48 RenderSVGRoot::RenderSVGRoot(SVGElement* node) 49 RenderSVGRoot::RenderSVGRoot(SVGElement* node)
49 : RenderReplaced(node) 50 : RenderReplaced(node)
50 , m_objectBoundingBoxValid(false) 51 , m_objectBoundingBoxValid(false)
51 , m_isLayoutSizeChanged(false) 52 , m_isLayoutSizeChanged(false)
52 , m_needsBoundariesOrTransformUpdate(true) 53 , m_needsBoundariesOrTransformUpdate(true)
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 // If our intrinsic size is in percentage units, return those to the caller through the intrinsicSize. Notify the caller 104 // If our intrinsic size is in percentage units, return those to the caller through the intrinsicSize. Notify the caller
104 // about the special situation, by setting isPercentageIntrinsicSize=true, s o it knows how to interpret the return values. 105 // about the special situation, by setting isPercentageIntrinsicSize=true, s o it knows how to interpret the return values.
105 if (intrinsicWidthAttribute.isPercent() && intrinsicHeightAttribute.isPercen t()) { 106 if (intrinsicWidthAttribute.isPercent() && intrinsicHeightAttribute.isPercen t()) {
106 isPercentageIntrinsicSize = true; 107 isPercentageIntrinsicSize = true;
107 intrinsicSize = FloatSize(intrinsicWidthAttribute.percent(), intrinsicHe ightAttribute.percent()); 108 intrinsicSize = FloatSize(intrinsicWidthAttribute.percent(), intrinsicHe ightAttribute.percent());
108 } 109 }
109 } 110 }
110 111
111 bool RenderSVGRoot::isEmbeddedThroughSVGImage() const 112 bool RenderSVGRoot::isEmbeddedThroughSVGImage() const
112 { 113 {
113 if (!node()) 114 return SVGImage::isInSVGImage(toSVGSVGElement(node()));
114 return false;
115
116 // Test whether we're embedded through an img.
117 if (Page* page = node()->document()->page())
118 return page->chrome().client().isSVGImageChromeClient();
119 return false;
120 } 115 }
121 116
122 bool RenderSVGRoot::isEmbeddedThroughFrameContainingSVGDocument() const 117 bool RenderSVGRoot::isEmbeddedThroughFrameContainingSVGDocument() const
123 { 118 {
124 if (!node()) 119 if (!node())
125 return false; 120 return false;
126 121
127 Frame* frame = node()->document()->frame(); 122 Frame* frame = node()->document()->frame();
128 if (!frame) 123 if (!frame)
129 return false; 124 return false;
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 { 468 {
474 RenderObject* svgRoot = resource->parent(); 469 RenderObject* svgRoot = resource->parent();
475 while (svgRoot && !svgRoot->isSVGRoot()) 470 while (svgRoot && !svgRoot->isSVGRoot())
476 svgRoot = svgRoot->parent(); 471 svgRoot = svgRoot->parent();
477 if (!svgRoot) 472 if (!svgRoot)
478 return; 473 return;
479 toRenderSVGRoot(svgRoot)->m_resourcesNeedingToInvalidateClients.add(resource ); 474 toRenderSVGRoot(svgRoot)->m_resourcesNeedingToInvalidateClients.add(resource );
480 } 475 }
481 476
482 } 477 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLImageElement.cpp ('k') | Source/core/svg/graphics/SVGImage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698