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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde .org> 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde .org>
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
5 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 5 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
6 * Copyright (C) 2012 University of Szeged 6 * Copyright (C) 2012 University of Szeged
7 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org> 7 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org>
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 || m_width->currentValue()->isRelative() 736 || m_width->currentValue()->isRelative()
737 || m_height->currentValue()->isRelative()) 737 || m_height->currentValue()->isRelative())
738 return true; 738 return true;
739 739
740 if (!m_targetElementInstance) 740 if (!m_targetElementInstance)
741 return false; 741 return false;
742 742
743 return m_targetElementInstance->hasRelativeLengths(); 743 return m_targetElementInstance->hasRelativeLengths();
744 } 744 }
745 745
746 FloatRect SVGUseElement::getBBox()
747 {
748 document().updateLayoutIgnorePendingStylesheets();
749
750 if (!layoutObject())
751 return FloatRect();
752
753 LayoutSVGTransformableContainer& transformableContainer = toLayoutSVGTransfo rmableContainer(*layoutObject());
754 // Don't apply the additional translation if the oBB is invalid.
755 if (!transformableContainer.isObjectBoundingBoxValid())
756 return FloatRect();
757
758 // TODO(fs): Preferably this would just use objectBoundingBox() (and hence
759 // don't need to override SVGGraphicsElement::getBBox at all) and be
760 // correct without additional work. That will not work out ATM without
761 // additional quirks. The problem stems from including the additional
762 // translation directly on the LayoutObject corresponding to the
763 // SVGUseElement.
764 FloatRect bbox = transformableContainer.objectBoundingBox();
765 bbox.move(transformableContainer.additionalTranslation());
766 return bbox;
767 }
768
746 void SVGUseElement::dispatchPendingEvent(SVGUseEventSender* eventSender) 769 void SVGUseElement::dispatchPendingEvent(SVGUseEventSender* eventSender)
747 { 770 {
748 ASSERT_UNUSED(eventSender, eventSender == &svgUseLoadEventSender()); 771 ASSERT_UNUSED(eventSender, eventSender == &svgUseLoadEventSender());
749 ASSERT(isStructurallyExternal() && m_haveFiredLoadEvent); 772 ASSERT(isStructurallyExternal() && m_haveFiredLoadEvent);
750 dispatchEvent(Event::create(EventTypeNames::load)); 773 dispatchEvent(Event::create(EventTypeNames::load));
751 } 774 }
752 775
753 void SVGUseElement::notifyFinished(Resource* resource) 776 void SVGUseElement::notifyFinished(Resource* resource)
754 { 777 {
755 if (!inDocument()) 778 if (!inDocument())
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 819
797 if (m_resource) 820 if (m_resource)
798 m_resource->removeClient(this); 821 m_resource->removeClient(this);
799 822
800 m_resource = resource; 823 m_resource = resource;
801 if (m_resource) 824 if (m_resource)
802 m_resource->addClient(this); 825 m_resource->addClient(this);
803 } 826 }
804 827
805 } 828 }
OLDNEW
« 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