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

Side by Side Diff: Source/core/svg/SVGSVGElement.cpp

Issue 1162453002: [svg2] Make SVGLength wrap a CSSPrimitiveValue (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: nit Created 5 years, 6 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
« no previous file with comments | « Source/core/svg/SVGLengthTearOff.cpp ('k') | Source/core/svg/SVGTextContentElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Rob Buis <buis@kde.org>
4 * Copyright (C) 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2007 Apple Inc. All rights reserved.
5 * Copyright (C) 2014 Google, Inc. 5 * Copyright (C) 2014 Google, Inc.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 LayoutRect contentBoxRect = toLayoutSVGRoot(layoutObject())->contentBoxR ect(); 640 LayoutRect contentBoxRect = toLayoutSVGRoot(layoutObject())->contentBoxR ect();
641 return FloatSize(contentBoxRect.width() / layoutObject()->style()->effec tiveZoom(), contentBoxRect.height() / layoutObject()->style()->effectiveZoom()); 641 return FloatSize(contentBoxRect.width() / layoutObject()->style()->effec tiveZoom(), contentBoxRect.height() / layoutObject()->style()->effectiveZoom());
642 } 642 }
643 643
644 FloatRect viewportRect = toLayoutSVGViewportContainer(layoutObject())->viewp ort(); 644 FloatRect viewportRect = toLayoutSVGViewportContainer(layoutObject())->viewp ort();
645 return FloatSize(viewportRect.width(), viewportRect.height()); 645 return FloatSize(viewportRect.width(), viewportRect.height());
646 } 646 }
647 647
648 bool SVGSVGElement::hasIntrinsicWidth() const 648 bool SVGSVGElement::hasIntrinsicWidth() const
649 { 649 {
650 return width()->currentValue()->unitType() != LengthTypePercentage; 650 return width()->currentValue()->primitiveType() != CSSPrimitiveValue::CSS_PE RCENTAGE;
651 } 651 }
652 652
653 bool SVGSVGElement::hasIntrinsicHeight() const 653 bool SVGSVGElement::hasIntrinsicHeight() const
654 { 654 {
655 return height()->currentValue()->unitType() != LengthTypePercentage; 655 return height()->currentValue()->primitiveType() != CSSPrimitiveValue::CSS_P ERCENTAGE;
656 } 656 }
657 657
658 Length SVGSVGElement::intrinsicWidth() const 658 Length SVGSVGElement::intrinsicWidth() const
659 { 659 {
660 if (width()->currentValue()->unitType() == LengthTypePercentage) 660 if (width()->currentValue()->primitiveType() == CSSPrimitiveValue::CSS_PERCE NTAGE)
661 return Length(0, Fixed); 661 return Length(0, Fixed);
662 662
663 SVGLengthContext lengthContext(this); 663 SVGLengthContext lengthContext(this);
664 return Length(width()->currentValue()->value(lengthContext), Fixed); 664 return Length(width()->currentValue()->value(lengthContext), Fixed);
665 } 665 }
666 666
667 Length SVGSVGElement::intrinsicHeight() const 667 Length SVGSVGElement::intrinsicHeight() const
668 { 668 {
669 if (height()->currentValue()->unitType() == LengthTypePercentage) 669 if (height()->currentValue()->primitiveType() == CSSPrimitiveValue::CSS_PERC ENTAGE)
670 return Length(0, Fixed); 670 return Length(0, Fixed);
671 671
672 SVGLengthContext lengthContext(this); 672 SVGLengthContext lengthContext(this);
673 return Length(height()->currentValue()->value(lengthContext), Fixed); 673 return Length(height()->currentValue()->value(lengthContext), Fixed);
674 } 674 }
675 675
676 AffineTransform SVGSVGElement::viewBoxToViewTransform(float viewWidth, float vie wHeight) const 676 AffineTransform SVGSVGElement::viewBoxToViewTransform(float viewWidth, float vie wHeight) const
677 { 677 {
678 if (!m_useCurrentView || !m_viewSpec) 678 if (!m_useCurrentView || !m_viewSpec)
679 return SVGFitToViewBox::viewBoxToViewTransform(currentViewBoxRect(), pre serveAspectRatio()->currentValue(), viewWidth, viewHeight); 679 return SVGFitToViewBox::viewBoxToViewTransform(currentViewBoxRect(), pre serveAspectRatio()->currentValue(), viewWidth, viewHeight);
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 visitor->trace(m_width); 781 visitor->trace(m_width);
782 visitor->trace(m_height); 782 visitor->trace(m_height);
783 visitor->trace(m_translation); 783 visitor->trace(m_translation);
784 visitor->trace(m_timeContainer); 784 visitor->trace(m_timeContainer);
785 visitor->trace(m_viewSpec); 785 visitor->trace(m_viewSpec);
786 SVGGraphicsElement::trace(visitor); 786 SVGGraphicsElement::trace(visitor);
787 SVGFitToViewBox::trace(visitor); 787 SVGFitToViewBox::trace(visitor);
788 } 788 }
789 789
790 } // namespace blink 790 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/svg/SVGLengthTearOff.cpp ('k') | Source/core/svg/SVGTextContentElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698