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

Unified Diff: Source/core/rendering/svg/RenderSVGViewportContainer.cpp

Issue 252903004: Avoid using SVGElementInstance in calcViewport (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase one more time Created 6 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/rendering/svg/RenderSVGViewportContainer.cpp
diff --git a/Source/core/rendering/svg/RenderSVGViewportContainer.cpp b/Source/core/rendering/svg/RenderSVGViewportContainer.cpp
index 0dae02cd718424da5147d953eda4df5349dfecab..752859fa8dda88f15a3afacb7256f146e99d476f 100644
--- a/Source/core/rendering/svg/RenderSVGViewportContainer.cpp
+++ b/Source/core/rendering/svg/RenderSVGViewportContainer.cpp
@@ -67,54 +67,6 @@ void RenderSVGViewportContainer::calcViewport()
SVGLengthContext lengthContext(element);
m_viewport = FloatRect(svg->x()->currentValue()->value(lengthContext), svg->y()->currentValue()->value(lengthContext), svg->width()->currentValue()->value(lengthContext), svg->height()->currentValue()->value(lengthContext));
- SVGElement* correspondingElement = svg->correspondingElement();
- if (correspondingElement && svg->isInShadowTree()) {
- const HashSet<SVGElementInstance*>& instances = correspondingElement->instancesForElement();
- ASSERT(!instances.isEmpty());
-
- SVGUseElement* useElement = 0;
- const HashSet<SVGElementInstance*>::const_iterator end = instances.end();
- for (HashSet<SVGElementInstance*>::const_iterator it = instances.begin(); it != end; ++it) {
- const SVGElementInstance* instance = (*it);
- ASSERT(isSVGSVGElement(instance->correspondingElement()) || isSVGSymbolElement(instance->correspondingElement()));
- if (instance->shadowTreeElement() == svg) {
- ASSERT(correspondingElement == instance->correspondingElement());
- useElement = instance->directUseElement();
- if (!useElement)
- useElement = instance->correspondingUseElement();
- break;
- }
- }
-
- ASSERT(useElement);
- bool isSymbolElement = isSVGSymbolElement(*correspondingElement);
-
- // Spec (<use> on <symbol>): This generated 'svg' will always have explicit values for attributes width and height.
- // If attributes width and/or height are provided on the 'use' element, then these attributes
- // will be transferred to the generated 'svg'. If attributes width and/or height are not specified,
- // the generated 'svg' element will use values of 100% for these attributes.
-
- // Spec (<use> on <svg>): If attributes width and/or height are provided on the 'use' element, then these
- // values will override the corresponding attributes on the 'svg' in the generated tree.
-
- SVGLengthContext lengthContext(element);
- if (useElement->hasAttribute(SVGNames::widthAttr))
- m_viewport.setWidth(useElement->width()->currentValue()->value(lengthContext));
- else if (isSymbolElement && svg->hasAttribute(SVGNames::widthAttr)) {
- RefPtr<SVGLength> containerWidth = SVGLength::create(LengthModeWidth);
- containerWidth->setValueAsString("100%", ASSERT_NO_EXCEPTION);
- m_viewport.setWidth(containerWidth->value(lengthContext));
- }
-
- if (useElement->hasAttribute(SVGNames::heightAttr))
- m_viewport.setHeight(useElement->height()->currentValue()->value(lengthContext));
- else if (isSymbolElement && svg->hasAttribute(SVGNames::heightAttr)) {
- RefPtr<SVGLength> containerHeight = SVGLength::create(LengthModeHeight);
- containerHeight->setValueAsString("100%", ASSERT_NO_EXCEPTION);
- m_viewport.setHeight(containerHeight->value(lengthContext));
- }
- }
-
if (oldViewport != m_viewport) {
setNeedsBoundariesUpdate();
setNeedsTransformUpdate();
« no previous file with comments | « LayoutTests/svg/custom/use-dynamic-attribute-setting-expected.html ('k') | Source/core/svg/SVGUseElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698