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

Side by Side Diff: Source/core/layout/svg/SVGResourcesCache.cpp

Issue 1068073005: Handle layer clients in LayoutSVGResourceContainer::registerResource (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 static inline bool layoutObjectCanHaveResources(LayoutObject* layoutObject) 109 static inline bool layoutObjectCanHaveResources(LayoutObject* layoutObject)
110 { 110 {
111 ASSERT(layoutObject); 111 ASSERT(layoutObject);
112 return layoutObject->node() && layoutObject->node()->isSVGElement() && !layo utObject->isSVGInlineText(); 112 return layoutObject->node() && layoutObject->node()->isSVGElement() && !layo utObject->isSVGInlineText();
113 } 113 }
114 114
115 void SVGResourcesCache::clientStyleChanged(LayoutObject* layoutObject, StyleDiff erence diff, const ComputedStyle& newStyle) 115 void SVGResourcesCache::clientStyleChanged(LayoutObject* layoutObject, StyleDiff erence diff, const ComputedStyle& newStyle)
116 { 116 {
117 ASSERT(layoutObject); 117 ASSERT(layoutObject);
118 ASSERT(layoutObject->node()); 118 ASSERT(layoutObject->node());
119 ASSERT(layoutObject->node()->isSVGElement());
120 119
121 if (!diff.hasDifference() || !layoutObject->parent()) 120 if (!diff.hasDifference() || !layoutObject->parent())
122 return; 121 return;
123 122
124 // In this case the proper SVGFE*Element will decide whether the modified CS S properties require a relayout or paintInvalidation. 123 // In this case the proper SVGFE*Element will decide whether the modified CS S properties require a relayout or paintInvalidation.
125 if (layoutObject->isSVGResourceFilterPrimitive() && !diff.needsLayout()) 124 if (layoutObject->isSVGResourceFilterPrimitive() && !diff.needsLayout())
126 return; 125 return;
127 126
127 // If it's not an SVGElement, we can leave early because none of the below w ill have any effect.
128 if (!layoutObject->node()->isSVGElement())
129 return;
130
128 // Dynamic changes of CSS properties like 'clip-path' may require us to reco mpute the associated resources for a layoutObject. 131 // Dynamic changes of CSS properties like 'clip-path' may require us to reco mpute the associated resources for a layoutObject.
129 // FIXME: Avoid passing in a useless StyleDifference, but instead compare ol dStyle/newStyle to see which resources changed 132 // FIXME: Avoid passing in a useless StyleDifference, but instead compare ol dStyle/newStyle to see which resources changed
130 // to be able to selectively rebuild individual resources, instead of all of them. 133 // to be able to selectively rebuild individual resources, instead of all of them.
131 if (layoutObjectCanHaveResources(layoutObject)) { 134 if (layoutObjectCanHaveResources(layoutObject)) {
132 SVGResourcesCache* cache = resourcesCacheFromLayoutObject(layoutObject); 135 SVGResourcesCache* cache = resourcesCacheFromLayoutObject(layoutObject);
133 cache->removeResourcesFromLayoutObject(layoutObject); 136 cache->removeResourcesFromLayoutObject(layoutObject);
134 cache->addResourcesFromLayoutObject(layoutObject, newStyle); 137 cache->addResourcesFromLayoutObject(layoutObject, newStyle);
135 } 138 }
136 139
137 LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidation(layou tObject, false); 140 LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidation(layou tObject, false);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 // Mark users of destroyed resources as pending resolution based on the id of the old resource. 190 // Mark users of destroyed resources as pending resolution based on the id of the old resource.
188 Element* resourceElement = resource->element(); 191 Element* resourceElement = resource->element();
189 Element* clientElement = toElement(objectResources.key->node()); 192 Element* clientElement = toElement(objectResources.key->node());
190 SVGDocumentExtensions& extensions = clientElement->document().accessSVGE xtensions(); 193 SVGDocumentExtensions& extensions = clientElement->document().accessSVGE xtensions();
191 194
192 extensions.addPendingResource(resourceElement->fastGetAttribute(HTMLName s::idAttr), clientElement); 195 extensions.addPendingResource(resourceElement->fastGetAttribute(HTMLName s::idAttr), clientElement);
193 } 196 }
194 } 197 }
195 198
196 } 199 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698