Index: Source/core/svg/SVGUseElement.cpp |
diff --git a/Source/core/svg/SVGUseElement.cpp b/Source/core/svg/SVGUseElement.cpp |
index 0230f7d5b4dd6737f436014837f07d081e65b494..bcdc4ba03b4403d2e60b5fb346318521d40168b2 100644 |
--- a/Source/core/svg/SVGUseElement.cpp |
+++ b/Source/core/svg/SVGUseElement.cpp |
@@ -743,6 +743,29 @@ bool SVGUseElement::selfHasRelativeLengths() const |
return m_targetElementInstance->hasRelativeLengths(); |
} |
+FloatRect SVGUseElement::getBBox() |
+{ |
+ document().updateLayoutIgnorePendingStylesheets(); |
+ |
+ if (!layoutObject()) |
+ return FloatRect(); |
+ |
+ LayoutSVGTransformableContainer& transformableContainer = toLayoutSVGTransformableContainer(*layoutObject()); |
+ // Don't apply the additional translation if the oBB is invalid. |
+ if (!transformableContainer.isObjectBoundingBoxValid()) |
+ return FloatRect(); |
+ |
+ // TODO(fs): Preferably this would just use objectBoundingBox() (and hence |
+ // don't need to override SVGGraphicsElement::getBBox at all) and be |
+ // correct without additional work. That will not work out ATM without |
+ // additional quirks. The problem stems from including the additional |
+ // translation directly on the LayoutObject corresponding to the |
+ // SVGUseElement. |
+ FloatRect bbox = transformableContainer.objectBoundingBox(); |
+ bbox.move(transformableContainer.additionalTranslation()); |
+ return bbox; |
+} |
+ |
void SVGUseElement::dispatchPendingEvent(SVGUseEventSender* eventSender) |
{ |
ASSERT_UNUSED(eventSender, eventSender == &svgUseLoadEventSender()); |