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

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

Issue 2774753004: Add SVGFitToViewBox::hasValidViewBox helper (Closed)
Patch Set: Created 3 years, 9 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 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 synthesizedViewBoxSize.setHeight( 575 synthesizedViewBoxSize.setHeight(
576 height()->currentValue()->scaleByPercentage( 576 height()->currentValue()->scaleByPercentage(
577 currentViewportSize().height())); 577 currentViewportSize().height()));
578 return FloatRect(FloatPoint(), synthesizedViewBoxSize); 578 return FloatRect(FloatPoint(), synthesizedViewBoxSize);
579 } 579 }
580 580
581 SVGPreserveAspectRatio* SVGSVGElement::currentPreserveAspectRatio() const { 581 SVGPreserveAspectRatio* SVGSVGElement::currentPreserveAspectRatio() const {
582 if (m_viewSpec) 582 if (m_viewSpec)
583 return m_viewSpec->preserveAspectRatio(); 583 return m_viewSpec->preserveAspectRatio();
584 584
585 if (!viewBox()->currentValue()->isValid() && shouldSynthesizeViewBox()) { 585 if (!hasValidViewBox() && shouldSynthesizeViewBox()) {
586 // If no viewBox is specified and we're embedded through SVGImage, then 586 // If no (valid) viewBox is specified and we're embedded through SVGImage,
587 // synthesize a pAR with the value 'none'. 587 // then synthesize a pAR with the value 'none'.
588 SVGPreserveAspectRatio* synthesizedPAR = SVGPreserveAspectRatio::create(); 588 SVGPreserveAspectRatio* synthesizedPAR = SVGPreserveAspectRatio::create();
589 synthesizedPAR->setAlign( 589 synthesizedPAR->setAlign(
590 SVGPreserveAspectRatio::kSvgPreserveaspectratioNone); 590 SVGPreserveAspectRatio::kSvgPreserveaspectratioNone);
591 return synthesizedPAR; 591 return synthesizedPAR;
592 } 592 }
593 return preserveAspectRatio()->currentValue(); 593 return preserveAspectRatio()->currentValue();
594 } 594 }
595 595
596 FloatSize SVGSVGElement::currentViewportSize() const { 596 FloatSize SVGSVGElement::currentViewportSize() const {
597 if (!layoutObject()) 597 if (!layoutObject())
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 visitor->trace(m_width); 727 visitor->trace(m_width);
728 visitor->trace(m_height); 728 visitor->trace(m_height);
729 visitor->trace(m_translation); 729 visitor->trace(m_translation);
730 visitor->trace(m_timeContainer); 730 visitor->trace(m_timeContainer);
731 visitor->trace(m_viewSpec); 731 visitor->trace(m_viewSpec);
732 SVGGraphicsElement::trace(visitor); 732 SVGGraphicsElement::trace(visitor);
733 SVGFitToViewBox::trace(visitor); 733 SVGFitToViewBox::trace(visitor);
734 } 734 }
735 735
736 } // namespace blink 736 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGPatternElement.cpp ('k') | third_party/WebKit/Source/core/svg/SVGViewSpec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698