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

Side by Side Diff: third_party/WebKit/Source/core/layout/svg/SVGResources.cpp

Issue 2107153002: SVG object with same idrefs get conflicted even they are under different shadow root Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename the method in TreeScope class Created 4 years, 5 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
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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 hasPendingResource = true; 176 hasPendingResource = true;
177 return nullptr; 177 return nullptr;
178 } 178 }
179 179
180 if (!container->isSVGPaintServer()) 180 if (!container->isSVGPaintServer())
181 return nullptr; 181 return nullptr;
182 182
183 return toLayoutSVGResourcePaintServer(container); 183 return toLayoutSVGResourcePaintServer(container);
184 } 184 }
185 185
186 static inline void registerPendingResource(SVGDocumentExtensions& extensions, co nst AtomicString& id, SVGElement* element) 186 static inline void registerPendingResource(SVGTreeScopeResources& treeScopeResou rces, const AtomicString& id, SVGElement* element)
187 { 187 {
188 ASSERT(element); 188 ASSERT(element);
189 extensions.addPendingResource(id, element); 189 treeScopeResources.addPendingResource(id, element);
190 } 190 }
191 191
192 bool SVGResources::hasResourceData() const 192 bool SVGResources::hasResourceData() const
193 { 193 {
194 return m_clipperFilterMaskerData 194 return m_clipperFilterMaskerData
195 || m_markerData 195 || m_markerData
196 || m_fillStrokeData 196 || m_fillStrokeData
197 || m_linkedResource; 197 || m_linkedResource;
198 } 198 }
199 199
(...skipping 13 matching lines...) Expand all
213 ASSERT(node); 213 ASSERT(node);
214 ASSERT_WITH_SECURITY_IMPLICATION(node->isSVGElement()); 214 ASSERT_WITH_SECURITY_IMPLICATION(node->isSVGElement());
215 215
216 SVGElement* element = toSVGElement(node); 216 SVGElement* element = toSVGElement(node);
217 ASSERT(element); 217 ASSERT(element);
218 218
219 const AtomicString& tagName = element->localName(); 219 const AtomicString& tagName = element->localName();
220 ASSERT(!tagName.isNull()); 220 ASSERT(!tagName.isNull());
221 221
222 TreeScope& treeScope = element->treeScope(); 222 TreeScope& treeScope = element->treeScope();
223 SVGDocumentExtensions& extensions = element->document().accessSVGExtensions( ); 223 SVGTreeScopeResources& treeScopeResources = element->treeScope().accessSVGTr eeScopedResources();
224
225 const SVGComputedStyle& style = computedStyle.svgStyle(); 224 const SVGComputedStyle& style = computedStyle.svgStyle();
226 225
227 std::unique_ptr<SVGResources> resources; 226 std::unique_ptr<SVGResources> resources;
228 if (clipperFilterMaskerTags().contains(tagName)) { 227 if (clipperFilterMaskerTags().contains(tagName)) {
229 if (style.hasClipper()) { 228 if (style.hasClipper()) {
230 AtomicString id = style.clipperResource(); 229 AtomicString id = style.clipperResource();
231 if (!ensureResources(resources).setClipper(getLayoutSVGResourceById< LayoutSVGResourceClipper>(treeScope, id))) 230 if (!ensureResources(resources).setClipper(getLayoutSVGResourceById< LayoutSVGResourceClipper>(treeScope, id)))
232 registerPendingResource(extensions, id, element); 231 registerPendingResource(treeScopeResources, id, element);
233 } 232 }
234 233
235 if (computedStyle.hasFilter() && !object->isSVGRoot()) { 234 if (computedStyle.hasFilter() && !object->isSVGRoot()) {
236 const FilterOperations& filterOperations = computedStyle.filter(); 235 const FilterOperations& filterOperations = computedStyle.filter();
237 if (filterOperations.size() == 1) { 236 if (filterOperations.size() == 1) {
238 const FilterOperation& filterOperation = *filterOperations.at(0) ; 237 const FilterOperation& filterOperation = *filterOperations.at(0) ;
239 if (filterOperation.type() == FilterOperation::REFERENCE) { 238 if (filterOperation.type() == FilterOperation::REFERENCE) {
240 const auto& referenceFilterOperation = toReferenceFilterOper ation(filterOperation); 239 const auto& referenceFilterOperation = toReferenceFilterOper ation(filterOperation);
241 AtomicString id = SVGURIReference::fragmentIdentifierFromIRI String(referenceFilterOperation.url(), treeScope); 240 AtomicString id = SVGURIReference::fragmentIdentifierFromIRI String(referenceFilterOperation.url(), treeScope);
242 if (!ensureResources(resources).setFilter(getLayoutSVGResour ceById<LayoutSVGResourceFilter>(treeScope, id))) 241 if (!ensureResources(resources).setFilter(getLayoutSVGResour ceById<LayoutSVGResourceFilter>(treeScope, id)))
243 registerPendingResource(extensions, id, element); 242 registerPendingResource(treeScopeResources, id, element) ;
244 } 243 }
245 } 244 }
246 } 245 }
247 246
248 if (style.hasMasker()) { 247 if (style.hasMasker()) {
249 AtomicString id = style.maskerResource(); 248 AtomicString id = style.maskerResource();
250 if (!ensureResources(resources).setMasker(getLayoutSVGResourceById<L ayoutSVGResourceMasker>(treeScope, id))) 249 if (!ensureResources(resources).setMasker(getLayoutSVGResourceById<L ayoutSVGResourceMasker>(treeScope, id)))
251 registerPendingResource(extensions, id, element); 250 registerPendingResource(treeScopeResources, id, element);
252 } 251 }
253 } 252 }
254 253
255 if (style.hasMarkers() && supportsMarkers(*element)) { 254 if (style.hasMarkers() && supportsMarkers(*element)) {
256 const AtomicString& markerStartId = style.markerStartResource(); 255 const AtomicString& markerStartId = style.markerStartResource();
257 if (!ensureResources(resources).setMarkerStart(getLayoutSVGResourceById< LayoutSVGResourceMarker>(treeScope, markerStartId))) 256 if (!ensureResources(resources).setMarkerStart(getLayoutSVGResourceById< LayoutSVGResourceMarker>(treeScope, markerStartId)))
258 registerPendingResource(extensions, markerStartId, element); 257 registerPendingResource(treeScopeResources, markerStartId, element);
259 258
260 const AtomicString& markerMidId = style.markerMidResource(); 259 const AtomicString& markerMidId = style.markerMidResource();
261 if (!ensureResources(resources).setMarkerMid(getLayoutSVGResourceById<La youtSVGResourceMarker>(treeScope, markerMidId))) 260 if (!ensureResources(resources).setMarkerMid(getLayoutSVGResourceById<La youtSVGResourceMarker>(treeScope, markerMidId)))
262 registerPendingResource(extensions, markerMidId, element); 261 registerPendingResource(treeScopeResources, markerMidId, element);
263 262
264 const AtomicString& markerEndId = style.markerEndResource(); 263 const AtomicString& markerEndId = style.markerEndResource();
265 if (!ensureResources(resources).setMarkerEnd(getLayoutSVGResourceById<La youtSVGResourceMarker>(treeScope, style.markerEndResource()))) 264 if (!ensureResources(resources).setMarkerEnd(getLayoutSVGResourceById<La youtSVGResourceMarker>(treeScope, style.markerEndResource())))
266 registerPendingResource(extensions, markerEndId, element); 265 registerPendingResource(treeScopeResources, markerEndId, element);
267 } 266 }
268 267
269 if (fillAndStrokeTags().contains(tagName)) { 268 if (fillAndStrokeTags().contains(tagName)) {
270 if (style.hasFill()) { 269 if (style.hasFill()) {
271 bool hasPendingResource = false; 270 bool hasPendingResource = false;
272 AtomicString id; 271 AtomicString id;
273 LayoutSVGResourcePaintServer* resource = paintingResourceFromSVGPain t(treeScope, style.fillPaintType(), style.fillPaintUri(), id, hasPendingResource ); 272 LayoutSVGResourcePaintServer* resource = paintingResourceFromSVGPain t(treeScope, style.fillPaintType(), style.fillPaintUri(), id, hasPendingResource );
274 if (!ensureResources(resources).setFill(resource) && hasPendingResou rce) 273 if (!ensureResources(resources).setFill(resource) && hasPendingResou rce)
275 registerPendingResource(extensions, id, element); 274 registerPendingResource(treeScopeResources, id, element);
276 } 275 }
277 276
278 if (style.hasStroke()) { 277 if (style.hasStroke()) {
279 bool hasPendingResource = false; 278 bool hasPendingResource = false;
280 AtomicString id; 279 AtomicString id;
281 LayoutSVGResourcePaintServer* resource = paintingResourceFromSVGPain t(treeScope, style.strokePaintType(), style.strokePaintUri(), id, hasPendingReso urce); 280 LayoutSVGResourcePaintServer* resource = paintingResourceFromSVGPain t(treeScope, style.strokePaintType(), style.strokePaintUri(), id, hasPendingReso urce);
282 if (!ensureResources(resources).setStroke(resource) && hasPendingRes ource) 281 if (!ensureResources(resources).setStroke(resource) && hasPendingRes ource)
283 registerPendingResource(extensions, id, element); 282 registerPendingResource(treeScopeResources, id, element);
284 } 283 }
285 } 284 }
286 285
287 if (chainableResourceTags().contains(tagName)) { 286 if (chainableResourceTags().contains(tagName)) {
288 AtomicString id = targetReferenceFromResource(*element); 287 AtomicString id = targetReferenceFromResource(*element);
289 if (!ensureResources(resources).setLinkedResource(getLayoutSVGResourceCo ntainerById(treeScope, id))) 288 if (!ensureResources(resources).setLinkedResource(getLayoutSVGResourceCo ntainerById(treeScope, id)))
290 registerPendingResource(extensions, id, element); 289 registerPendingResource(treeScopeResources, id, element);
291 } 290 }
292 291
293 return (!resources || !resources->hasResourceData()) ? nullptr : std::move(r esources); 292 return (!resources || !resources->hasResourceData()) ? nullptr : std::move(r esources);
294 } 293 }
295 294
296 void SVGResources::layoutIfNeeded() 295 void SVGResources::layoutIfNeeded()
297 { 296 {
298 if (m_clipperFilterMaskerData) { 297 if (m_clipperFilterMaskerData) {
299 if (LayoutSVGResourceClipper* clipper = m_clipperFilterMaskerData->clipp er) 298 if (LayoutSVGResourceClipper* clipper = m_clipperFilterMaskerData->clipp er)
300 clipper->layoutIfNeeded(); 299 clipper->layoutIfNeeded();
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 if (LayoutSVGResourcePaintServer* stroke = m_fillStrokeData->stroke) 674 if (LayoutSVGResourcePaintServer* stroke = m_fillStrokeData->stroke)
676 fprintf(stderr, " |-> Stroke : %p (node=%p)\n", stroke, stroke-> element()); 675 fprintf(stderr, " |-> Stroke : %p (node=%p)\n", stroke, stroke-> element());
677 } 676 }
678 677
679 if (m_linkedResource) 678 if (m_linkedResource)
680 fprintf(stderr, " |-> xlink:href : %p (node=%p)\n", m_linkedResource, m_ linkedResource->element()); 679 fprintf(stderr, " |-> xlink:href : %p (node=%p)\n", m_linkedResource, m_ linkedResource->element());
681 } 680 }
682 #endif 681 #endif
683 682
684 } // namespace blink 683 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698