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

Unified Diff: Source/core/svg/SVGUseElement.cpp

Issue 1310873004: Include additional translation in getBBox for SVGUseElement (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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/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());
« Source/core/layout/svg/LayoutSVGTransformableContainer.h ('K') | « Source/core/svg/SVGUseElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698