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

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: Added expectation Created 5 years, 1 month 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 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 LayoutRect contentBoxRect = toLayoutSVGRoot(layoutObject())->contentBoxR ect(); 628 LayoutRect contentBoxRect = toLayoutSVGRoot(layoutObject())->contentBoxR ect();
629 return FloatSize(contentBoxRect.width() / layoutObject()->style()->effec tiveZoom(), contentBoxRect.height() / layoutObject()->style()->effectiveZoom()); 629 return FloatSize(contentBoxRect.width() / layoutObject()->style()->effec tiveZoom(), contentBoxRect.height() / layoutObject()->style()->effectiveZoom());
630 } 630 }
631 631
632 FloatRect viewportRect = toLayoutSVGViewportContainer(layoutObject())->viewp ort(); 632 FloatRect viewportRect = toLayoutSVGViewportContainer(layoutObject())->viewp ort();
633 return FloatSize(viewportRect.width(), viewportRect.height()); 633 return FloatSize(viewportRect.width(), viewportRect.height());
634 } 634 }
635 635
636 bool SVGSVGElement::hasIntrinsicWidth() const 636 bool SVGSVGElement::hasIntrinsicWidth() const
637 { 637 {
638 return width()->currentValue()->unitType() != LengthTypePercentage; 638 return width()->currentValue()->typeWithCalcResolved() != CSSPrimitiveValue: :UnitType::Percentage;
639 } 639 }
640 640
641 bool SVGSVGElement::hasIntrinsicHeight() const 641 bool SVGSVGElement::hasIntrinsicHeight() const
642 { 642 {
643 return height()->currentValue()->unitType() != LengthTypePercentage; 643 return height()->currentValue()->typeWithCalcResolved() != CSSPrimitiveValue ::UnitType::Percentage;
644 } 644 }
645 645
646 Length SVGSVGElement::intrinsicWidth() const 646 Length SVGSVGElement::intrinsicWidth() const
647 { 647 {
648 if (width()->currentValue()->unitType() == LengthTypePercentage) 648 if (width()->currentValue()->typeWithCalcResolved() == CSSPrimitiveValue::Un itType::Percentage)
649 return Length(0, Fixed); 649 return Length(0, Fixed);
650 650
651 SVGLengthContext lengthContext(this); 651 SVGLengthContext lengthContext(this);
652 return Length(width()->currentValue()->value(lengthContext), Fixed); 652 return Length(width()->currentValue()->value(lengthContext), Fixed);
653 } 653 }
654 654
655 Length SVGSVGElement::intrinsicHeight() const 655 Length SVGSVGElement::intrinsicHeight() const
656 { 656 {
657 if (height()->currentValue()->unitType() == LengthTypePercentage) 657 if (height()->currentValue()->typeWithCalcResolved() == CSSPrimitiveValue::U nitType::Percentage)
658 return Length(0, Fixed); 658 return Length(0, Fixed);
659 659
660 SVGLengthContext lengthContext(this); 660 SVGLengthContext lengthContext(this);
661 return Length(height()->currentValue()->value(lengthContext), Fixed); 661 return Length(height()->currentValue()->value(lengthContext), Fixed);
662 } 662 }
663 663
664 AffineTransform SVGSVGElement::viewBoxToViewTransform(float viewWidth, float vie wHeight) const 664 AffineTransform SVGSVGElement::viewBoxToViewTransform(float viewWidth, float vie wHeight) const
665 { 665 {
666 if (!m_useCurrentView || !m_viewSpec) 666 if (!m_useCurrentView || !m_viewSpec)
667 return SVGFitToViewBox::viewBoxToViewTransform(currentViewBoxRect(), pre serveAspectRatio()->currentValue(), viewWidth, viewHeight); 667 return SVGFitToViewBox::viewBoxToViewTransform(currentViewBoxRect(), pre serveAspectRatio()->currentValue(), viewWidth, viewHeight);
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 visitor->trace(m_width); 769 visitor->trace(m_width);
770 visitor->trace(m_height); 770 visitor->trace(m_height);
771 visitor->trace(m_translation); 771 visitor->trace(m_translation);
772 visitor->trace(m_timeContainer); 772 visitor->trace(m_timeContainer);
773 visitor->trace(m_viewSpec); 773 visitor->trace(m_viewSpec);
774 SVGGraphicsElement::trace(visitor); 774 SVGGraphicsElement::trace(visitor);
775 SVGFitToViewBox::trace(visitor); 775 SVGFitToViewBox::trace(visitor);
776 } 776 }
777 777
778 } // namespace blink 778 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGLengthTearOff.cpp ('k') | third_party/WebKit/Source/core/svg/SVGTextContentElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698