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

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

Issue 1421533006: Make SVGLength wrap a CSSPrimitiveValue. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
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 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 LayoutRect contentBoxRect = toLayoutSVGRoot(layoutObject())->contentBoxR ect(); 627 LayoutRect contentBoxRect = toLayoutSVGRoot(layoutObject())->contentBoxR ect();
628 return FloatSize(contentBoxRect.width() / layoutObject()->style()->effec tiveZoom(), contentBoxRect.height() / layoutObject()->style()->effectiveZoom()); 628 return FloatSize(contentBoxRect.width() / layoutObject()->style()->effec tiveZoom(), contentBoxRect.height() / layoutObject()->style()->effectiveZoom());
629 } 629 }
630 630
631 FloatRect viewportRect = toLayoutSVGViewportContainer(layoutObject())->viewp ort(); 631 FloatRect viewportRect = toLayoutSVGViewportContainer(layoutObject())->viewp ort();
632 return FloatSize(viewportRect.width(), viewportRect.height()); 632 return FloatSize(viewportRect.width(), viewportRect.height());
633 } 633 }
634 634
635 bool SVGSVGElement::hasIntrinsicWidth() const 635 bool SVGSVGElement::hasIntrinsicWidth() const
636 { 636 {
637 return width()->currentValue()->unitType() != LengthTypePercentage; 637 return width()->currentValue()->typeWithCalcResolved() != CSSPrimitiveValue: :UnitType::Percentage;
638 } 638 }
639 639
640 bool SVGSVGElement::hasIntrinsicHeight() const 640 bool SVGSVGElement::hasIntrinsicHeight() const
641 { 641 {
642 return height()->currentValue()->unitType() != LengthTypePercentage; 642 return height()->currentValue()->typeWithCalcResolved() != CSSPrimitiveValue ::UnitType::Percentage;
643 } 643 }
644 644
645 Length SVGSVGElement::intrinsicWidth() const 645 Length SVGSVGElement::intrinsicWidth() const
646 { 646 {
647 if (width()->currentValue()->unitType() == LengthTypePercentage) 647 if (width()->currentValue()->typeWithCalcResolved() == CSSPrimitiveValue::Un itType::Percentage)
648 return Length(0, Fixed); 648 return Length(0, Fixed);
649 649
650 SVGLengthContext lengthContext(this); 650 SVGLengthContext lengthContext(this);
651 return Length(width()->currentValue()->value(lengthContext), Fixed); 651 return Length(width()->currentValue()->value(lengthContext), Fixed);
652 } 652 }
653 653
654 Length SVGSVGElement::intrinsicHeight() const 654 Length SVGSVGElement::intrinsicHeight() const
655 { 655 {
656 if (height()->currentValue()->unitType() == LengthTypePercentage) 656 if (height()->currentValue()->typeWithCalcResolved() == CSSPrimitiveValue::U nitType::Percentage)
657 return Length(0, Fixed); 657 return Length(0, Fixed);
658 658
659 SVGLengthContext lengthContext(this); 659 SVGLengthContext lengthContext(this);
660 return Length(height()->currentValue()->value(lengthContext), Fixed); 660 return Length(height()->currentValue()->value(lengthContext), Fixed);
661 } 661 }
662 662
663 AffineTransform SVGSVGElement::viewBoxToViewTransform(float viewWidth, float vie wHeight) const 663 AffineTransform SVGSVGElement::viewBoxToViewTransform(float viewWidth, float vie wHeight) const
664 { 664 {
665 if (!m_useCurrentView || !m_viewSpec) 665 if (!m_useCurrentView || !m_viewSpec)
666 return SVGFitToViewBox::viewBoxToViewTransform(currentViewBoxRect(), pre serveAspectRatio()->currentValue(), viewWidth, viewHeight); 666 return SVGFitToViewBox::viewBoxToViewTransform(currentViewBoxRect(), pre serveAspectRatio()->currentValue(), viewWidth, viewHeight);
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 visitor->trace(m_width); 768 visitor->trace(m_width);
769 visitor->trace(m_height); 769 visitor->trace(m_height);
770 visitor->trace(m_translation); 770 visitor->trace(m_translation);
771 visitor->trace(m_timeContainer); 771 visitor->trace(m_timeContainer);
772 visitor->trace(m_viewSpec); 772 visitor->trace(m_viewSpec);
773 SVGGraphicsElement::trace(visitor); 773 SVGGraphicsElement::trace(visitor);
774 SVGFitToViewBox::trace(visitor); 774 SVGFitToViewBox::trace(visitor);
775 } 775 }
776 776
777 } // namespace blink 777 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698