Changeset 163295 in webkit
- Timestamp:
- Feb 3, 2014 1:02:55 AM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r163294 r163295 1 2014-02-03 Andreas Kling <akling@apple.com> 2 3 RenderSVGResource::removeClientFromCache() should take RenderElement&. 4 <https://webkit.org/b/128097> 5 6 Text renderers never have resources associated with them. 7 This is yet another step towards enforcing that at compile-time 8 by making all the resource cache interfaces deal in RenderElement. 9 10 Also marked the RenderSVGResourceSolidColor class final. 11 12 Reviewed by Darin Adler. 13 14 * rendering/svg/RenderSVGResource.cpp: 15 (WebCore::removeFromCacheAndInvalidateDependencies): 16 (WebCore::RenderSVGResource::markForLayoutAndParentResourceInvalidation): 17 * rendering/svg/RenderSVGResource.h: 18 * rendering/svg/RenderSVGResourceClipper.cpp: 19 (WebCore::RenderSVGResourceClipper::removeClientFromCache): 20 * rendering/svg/RenderSVGResourceClipper.h: 21 * rendering/svg/RenderSVGResourceFilter.cpp: 22 (WebCore::RenderSVGResourceFilter::removeClientFromCache): 23 * rendering/svg/RenderSVGResourceFilter.h: 24 * rendering/svg/RenderSVGResourceGradient.cpp: 25 (WebCore::RenderSVGResourceGradient::removeClientFromCache): 26 * rendering/svg/RenderSVGResourceGradient.h: 27 * rendering/svg/RenderSVGResourceMarker.cpp: 28 (WebCore::RenderSVGResourceMarker::removeClientFromCache): 29 * rendering/svg/RenderSVGResourceMarker.h: 30 * rendering/svg/RenderSVGResourceMasker.cpp: 31 (WebCore::RenderSVGResourceMasker::removeClientFromCache): 32 * rendering/svg/RenderSVGResourceMasker.h: 33 * rendering/svg/RenderSVGResourcePattern.cpp: 34 (WebCore::RenderSVGResourcePattern::removeClientFromCache): 35 * rendering/svg/RenderSVGResourcePattern.h: 36 * rendering/svg/RenderSVGResourceSolidColor.h: 37 * rendering/svg/SVGRenderSupport.cpp: 38 (WebCore::invalidateResourcesOfChildren): 39 (WebCore::SVGRenderSupport::layoutChildren): 40 * rendering/svg/SVGResources.cpp: 41 (WebCore::SVGResources::removeClientFromCache): 42 * rendering/svg/SVGResources.h: 43 1 44 2014-02-03 Dan Bernstein <mitz@apple.com> 2 45 -
trunk/Source/WebCore/rendering/svg/RenderSVGResource.cpp
r163283 r163295 157 157 } 158 158 159 static inline void removeFromCacheAndInvalidateDependencies(Render Object& object, bool needsLayout)160 { 161 if (SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject( object)) {159 static inline void removeFromCacheAndInvalidateDependencies(RenderElement& renderer, bool needsLayout) 160 { 161 if (SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(renderer)) { 162 162 #if ENABLE(FILTERS) 163 163 if (RenderSVGResourceFilter* filter = resources->filter()) 164 filter->removeClientFromCache( object);164 filter->removeClientFromCache(renderer); 165 165 #endif 166 166 if (RenderSVGResourceMasker* masker = resources->masker()) 167 masker->removeClientFromCache( object);167 masker->removeClientFromCache(renderer); 168 168 169 169 if (RenderSVGResourceClipper* clipper = resources->clipper()) 170 clipper->removeClientFromCache( object);171 } 172 173 if (! object.node() || !object.node()->isSVGElement())170 clipper->removeClientFromCache(renderer); 171 } 172 173 if (!renderer.element() || !renderer.element()->isSVGElement()) 174 174 return; 175 HashSet<SVGElement*>* dependencies = object.document().accessSVGExtensions()->setOfElementsReferencingTarget(toSVGElement(object.node()));175 HashSet<SVGElement*>* dependencies = renderer.document().accessSVGExtensions()->setOfElementsReferencingTarget(toSVGElement(renderer.element())); 176 176 if (!dependencies) 177 177 return; … … 189 189 object.setNeedsLayout(); 190 190 191 removeFromCacheAndInvalidateDependencies(object, needsLayout); 191 if (object.isRenderElement()) 192 removeFromCacheAndInvalidateDependencies(toRenderElement(object), needsLayout); 192 193 193 194 // Invalidate resources in ancestor chain, if needed. 194 RenderObject*current = object.parent();195 auto current = object.parent(); 195 196 while (current) { 196 197 removeFromCacheAndInvalidateDependencies(*current, needsLayout); -
trunk/Source/WebCore/rendering/svg/RenderSVGResource.h
r160651 r163295 61 61 62 62 virtual void removeAllClientsFromCache(bool markForInvalidation = true) = 0; 63 virtual void removeClientFromCache(Render Object&, bool markForInvalidation = true) = 0;63 virtual void removeClientFromCache(RenderElement&, bool markForInvalidation = true) = 0; 64 64 65 65 virtual bool applyResource(RenderElement&, const RenderStyle&, GraphicsContext*&, unsigned short resourceMode) = 0; -
trunk/Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp
r163276 r163295 62 62 } 63 63 64 void RenderSVGResourceClipper::removeClientFromCache(Render Object& client, bool markForInvalidation)64 void RenderSVGResourceClipper::removeClientFromCache(RenderElement& client, bool markForInvalidation) 65 65 { 66 66 m_clipper.remove(&client); -
trunk/Source/WebCore/rendering/svg/RenderSVGResourceClipper.h
r162198 r163295 46 46 SVGClipPathElement& clipPathElement() const { return toSVGClipPathElement(nodeForNonAnonymous()); } 47 47 48 virtual void removeAllClientsFromCache(bool markForInvalidation = true) ;49 virtual void removeClientFromCache(Render Object&, bool markForInvalidation = true);48 virtual void removeAllClientsFromCache(bool markForInvalidation = true) override; 49 virtual void removeClientFromCache(RenderElement&, bool markForInvalidation = true) override; 50 50 51 51 virtual bool applyResource(RenderElement&, const RenderStyle&, GraphicsContext*&, unsigned short resourceMode) override; -
trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp
r163283 r163295 65 65 } 66 66 67 void RenderSVGResourceFilter::removeClientFromCache(Render Object& client, bool markForInvalidation)67 void RenderSVGResourceFilter::removeClientFromCache(RenderElement& client, bool markForInvalidation) 68 68 { 69 69 if (FilterData* filterData = m_filter.get(&client)) { -
trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.h
r163283 r163295 69 69 SVGFilterElement& filterElement() const { return toSVGFilterElement(RenderSVGResourceContainer::element()); } 70 70 71 virtual void removeAllClientsFromCache(bool markForInvalidation = true) ;72 virtual void removeClientFromCache(Render Object&, bool markForInvalidation = true);71 virtual void removeAllClientsFromCache(bool markForInvalidation = true) override; 72 virtual void removeClientFromCache(RenderElement&, bool markForInvalidation = true) override; 73 73 74 74 virtual bool applyResource(RenderElement&, const RenderStyle&, GraphicsContext*&, unsigned short resourceMode) override; -
trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp
r163285 r163295 49 49 } 50 50 51 void RenderSVGResourceGradient::removeClientFromCache(Render Object& client, bool markForInvalidation)51 void RenderSVGResourceGradient::removeClientFromCache(RenderElement& client, bool markForInvalidation) 52 52 { 53 53 m_gradientMap.remove(&client); -
trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.h
r162198 r163295 47 47 48 48 virtual void removeAllClientsFromCache(bool markForInvalidation = true) override final; 49 virtual void removeClientFromCache(Render Object&, bool markForInvalidation = true) override final;49 virtual void removeClientFromCache(RenderElement&, bool markForInvalidation = true) override final; 50 50 51 51 virtual bool applyResource(RenderElement&, const RenderStyle&, GraphicsContext*&, unsigned short resourceMode) override final; -
trunk/Source/WebCore/rendering/svg/RenderSVGResourceMarker.cpp
r161418 r163295 60 60 } 61 61 62 void RenderSVGResourceMarker::removeClientFromCache(Render Object& client, bool markForInvalidation)62 void RenderSVGResourceMarker::removeClientFromCache(RenderElement& client, bool markForInvalidation) 63 63 { 64 64 markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidation : ParentOnlyInvalidation); -
trunk/Source/WebCore/rendering/svg/RenderSVGResourceMarker.h
r162198 r163295 39 39 SVGMarkerElement& markerElement() const { return toSVGMarkerElement(RenderSVGResourceContainer::element()); } 40 40 41 virtual void removeAllClientsFromCache(bool markForInvalidation = true) ;42 virtual void removeClientFromCache(Render Object&, bool markForInvalidation = true);41 virtual void removeAllClientsFromCache(bool markForInvalidation = true) override; 42 virtual void removeClientFromCache(RenderElement&, bool markForInvalidation = true) override; 43 43 44 44 void draw(PaintInfo&, const AffineTransform&); -
trunk/Source/WebCore/rendering/svg/RenderSVGResourceMasker.cpp
r163276 r163295 51 51 } 52 52 53 void RenderSVGResourceMasker::removeClientFromCache(Render Object& client, bool markForInvalidation)53 void RenderSVGResourceMasker::removeClientFromCache(RenderElement& client, bool markForInvalidation) 54 54 { 55 55 m_masker.remove(&client); -
trunk/Source/WebCore/rendering/svg/RenderSVGResourceMasker.h
r162198 r163295 44 44 SVGMaskElement& maskElement() const { return toSVGMaskElement(RenderSVGResourceContainer::element()); } 45 45 46 virtual void removeAllClientsFromCache(bool markForInvalidation = true) ;47 virtual void removeClientFromCache(Render Object&, bool markForInvalidation = true);46 virtual void removeAllClientsFromCache(bool markForInvalidation = true) override; 47 virtual void removeClientFromCache(RenderElement&, bool markForInvalidation = true) override; 48 48 virtual bool applyResource(RenderElement&, const RenderStyle&, GraphicsContext*&, unsigned short resourceMode) override; 49 49 virtual FloatRect resourceBoundingBox(const RenderObject&) override; -
trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp
r163276 r163295 53 53 } 54 54 55 void RenderSVGResourcePattern::removeClientFromCache(Render Object& client, bool markForInvalidation)55 void RenderSVGResourcePattern::removeClientFromCache(RenderElement& client, bool markForInvalidation) 56 56 { 57 57 m_patternMap.remove(&client); -
trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.h
r162198 r163295 46 46 SVGPatternElement& patternElement() const; 47 47 48 virtual void removeAllClientsFromCache(bool markForInvalidation = true) ;49 virtual void removeClientFromCache(Render Object&, bool markForInvalidation = true);48 virtual void removeAllClientsFromCache(bool markForInvalidation = true) override; 49 virtual void removeClientFromCache(RenderElement&, bool markForInvalidation = true) override; 50 50 51 51 virtual bool applyResource(RenderElement&, const RenderStyle&, GraphicsContext*&, unsigned short resourceMode) override; -
trunk/Source/WebCore/rendering/svg/RenderSVGResourceSolidColor.h
r162139 r163295 27 27 namespace WebCore { 28 28 29 class RenderSVGResourceSolidColor : public RenderSVGResource {29 class RenderSVGResourceSolidColor final : public RenderSVGResource { 30 30 public: 31 31 RenderSVGResourceSolidColor(); 32 32 virtual ~RenderSVGResourceSolidColor(); 33 33 34 virtual void removeAllClientsFromCache(bool = true) { }35 virtual void removeClientFromCache(Render Object&, bool = true){ }34 virtual void removeAllClientsFromCache(bool = true) override { } 35 virtual void removeClientFromCache(RenderElement&, bool = true) override { } 36 36 37 37 virtual bool applyResource(RenderElement&, const RenderStyle&, GraphicsContext*&, unsigned short resourceMode) override; … … 39 39 virtual FloatRect resourceBoundingBox(const RenderObject&) override { return FloatRect(); } 40 40 41 virtual RenderSVGResourceType resourceType() const { return s_resourceType; }41 virtual RenderSVGResourceType resourceType() const override { return s_resourceType; } 42 42 static RenderSVGResourceType s_resourceType; 43 43 -
trunk/Source/WebCore/rendering/svg/SVGRenderSupport.cpp
r161418 r163295 186 186 } 187 187 188 static inline void invalidateResourcesOfChildren(Render Object& start)189 { 190 ASSERT(! start.needsLayout());191 if (SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject( start))192 resources->removeClientFromCache( start, false);193 194 for ( RenderObject* child = start.firstChildSlow(); child; child = child->nextSibling())195 invalidateResourcesOfChildren( *child);188 static inline void invalidateResourcesOfChildren(RenderElement& renderer) 189 { 190 ASSERT(!renderer.needsLayout()); 191 if (SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(renderer)) 192 resources->removeClientFromCache(renderer, false); 193 194 for (auto& child : childrenOfType<RenderElement>(renderer)) 195 invalidateResourcesOfChildren(child); 196 196 } 197 197 … … 289 289 290 290 // If the layout size changed, invalidate all resources of all children that didn't go through the layout() code path. 291 for (auto child : notlayoutedObjects) 292 invalidateResourcesOfChildren(*child); 291 for (auto child : notlayoutedObjects) { 292 if (child->isRenderElement()) 293 invalidateResourcesOfChildren(toRenderElement(*child)); 294 } 293 295 } 294 296 -
trunk/Source/WebCore/rendering/svg/SVGResources.cpp
r161418 r163295 280 280 } 281 281 282 void SVGResources::removeClientFromCache(Render Object& object, bool markForInvalidation) const282 void SVGResources::removeClientFromCache(RenderElement& renderer, bool markForInvalidation) const 283 283 { 284 284 if (!m_clipperFilterMaskerData && !m_markerData && !m_fillStrokeData && !m_linkedResource) … … 289 289 ASSERT(!m_markerData); 290 290 ASSERT(!m_fillStrokeData); 291 m_linkedResource->removeClientFromCache( object, markForInvalidation);291 m_linkedResource->removeClientFromCache(renderer, markForInvalidation); 292 292 return; 293 293 } … … 295 295 if (m_clipperFilterMaskerData) { 296 296 if (m_clipperFilterMaskerData->clipper) 297 m_clipperFilterMaskerData->clipper->removeClientFromCache( object, markForInvalidation);297 m_clipperFilterMaskerData->clipper->removeClientFromCache(renderer, markForInvalidation); 298 298 #if ENABLE(FILTERS) 299 299 if (m_clipperFilterMaskerData->filter) 300 m_clipperFilterMaskerData->filter->removeClientFromCache( object, markForInvalidation);300 m_clipperFilterMaskerData->filter->removeClientFromCache(renderer, markForInvalidation); 301 301 #endif 302 302 if (m_clipperFilterMaskerData->masker) 303 m_clipperFilterMaskerData->masker->removeClientFromCache( object, markForInvalidation);303 m_clipperFilterMaskerData->masker->removeClientFromCache(renderer, markForInvalidation); 304 304 } 305 305 306 306 if (m_markerData) { 307 307 if (m_markerData->markerStart) 308 m_markerData->markerStart->removeClientFromCache( object, markForInvalidation);308 m_markerData->markerStart->removeClientFromCache(renderer, markForInvalidation); 309 309 if (m_markerData->markerMid) 310 m_markerData->markerMid->removeClientFromCache( object, markForInvalidation);310 m_markerData->markerMid->removeClientFromCache(renderer, markForInvalidation); 311 311 if (m_markerData->markerEnd) 312 m_markerData->markerEnd->removeClientFromCache( object, markForInvalidation);312 m_markerData->markerEnd->removeClientFromCache(renderer, markForInvalidation); 313 313 } 314 314 315 315 if (m_fillStrokeData) { 316 316 if (m_fillStrokeData->fill) 317 m_fillStrokeData->fill->removeClientFromCache( object, markForInvalidation);317 m_fillStrokeData->fill->removeClientFromCache(renderer, markForInvalidation); 318 318 if (m_fillStrokeData->stroke) 319 m_fillStrokeData->stroke->removeClientFromCache( object, markForInvalidation);319 m_fillStrokeData->stroke->removeClientFromCache(renderer, markForInvalidation); 320 320 } 321 321 } -
trunk/Source/WebCore/rendering/svg/SVGResources.h
r160651 r163295 73 73 74 74 // Methods operating on all cached resources 75 void removeClientFromCache(Render Object&, bool markForInvalidation = true) const;75 void removeClientFromCache(RenderElement&, bool markForInvalidation = true) const; 76 76 void resourceDestroyed(RenderSVGResourceContainer&); 77 77
Note: See TracChangeset
for help on using the changeset viewer.