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

Unified Diff: Source/core/svg/SVGViewSpec.cpp

Issue 169033002: Drop [LegacyImplementedInBaseClass] from SVGFitToViewBox IDL interface (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Further refactoring Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« Source/core/svg/SVGMarkerElement.cpp ('K') | « Source/core/svg/SVGViewSpec.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGViewSpec.cpp
diff --git a/Source/core/svg/SVGViewSpec.cpp b/Source/core/svg/SVGViewSpec.cpp
index 9db13554a3768037ac91037303cccf5f6e647d12..78dd9e7a5a85e8cf4c85c3204481d90ca361e12f 100644
--- a/Source/core/svg/SVGViewSpec.cpp
+++ b/Source/core/svg/SVGViewSpec.cpp
@@ -45,21 +45,19 @@ const SVGPropertyInfo* SVGViewSpec::transformPropertyInfo()
}
SVGViewSpec::SVGViewSpec(SVGSVGElement* contextElement)
- : m_contextElement(contextElement)
- , m_zoomAndPan(SVGZoomAndPanMagnify)
// Note: We make |viewBox| and |preserveAspectRatio|'s contextElement the target element of SVGViewSpec.
// This contextElement will be only used for keeping this alive from the tearoff.
// SVGSVGElement holds a strong-ref to this SVGViewSpec, so this is kept alive as:
// AnimatedProperty tearoff -(contextElement)-> SVGSVGElement -(RefPtr)-> SVGViewSpec.
- , m_viewBox(SVGAnimatedRect::create(contextElement, SVGNames::viewBoxAttr))
- , m_preserveAspectRatio(SVGAnimatedPreserveAspectRatio::create(contextElement, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio::create()))
+ : SVGFitToViewBox(contextElement, PropertyMapPolicySkip) // Note: addToPropertyMap is not needed, as SVGViewSpec do not correspond to an element.
+ , m_contextElement(contextElement)
+ , m_zoomAndPan(SVGZoomAndPanMagnify)
{
ASSERT(m_contextElement);
ScriptWrappable::init(this);
- m_viewBox->setReadOnly();
- m_preserveAspectRatio->setReadOnly();
- // Note: addToPropertyMap is not needed, as SVGViewSpec do not correspond to an element.
+ viewBox()->setReadOnly();
+ preserveAspectRatio()->setReadOnly();
}
const AtomicString& SVGViewSpec::transformIdentifier()
@@ -76,7 +74,7 @@ void SVGViewSpec::setZoomAndPan(unsigned short, ExceptionState& exceptionState)
String SVGViewSpec::preserveAspectRatioString() const
{
- return m_preserveAspectRatio->baseValue()->valueAsString();
+ return preserveAspectRatio()->baseValue()->valueAsString();
}
void SVGViewSpec::setTransformString(const String& transform)
@@ -100,7 +98,7 @@ String SVGViewSpec::transformString() const
String SVGViewSpec::viewBoxString() const
{
- return m_viewBox->currentValue()->valueAsString();
+ return viewBox()->currentValue()->valueAsString();
}
SVGElement* SVGViewSpec::viewTarget() const
@@ -130,8 +128,8 @@ PassRefPtr<SVGAnimatedProperty> SVGViewSpec::lookupOrCreateTransformWrapper(SVGV
void SVGViewSpec::detachContextElement()
{
- m_viewBox = 0;
- m_preserveAspectRatio = 0;
+ clearViewBox();
+ clearPreserveAspectRatio();
m_contextElement = 0;
}
@@ -139,11 +137,10 @@ void SVGViewSpec::reset()
{
m_zoomAndPan = SVGZoomAndPanMagnify;
m_transform.clear();
- ASSERT(m_viewBox);
- m_viewBox->baseValue()->setValue(FloatRect());
- ASSERT(m_preserveAspectRatio);
- m_preserveAspectRatio->baseValue()->setAlign(SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMID);
- m_preserveAspectRatio->baseValue()->setMeetOrSlice(SVGPreserveAspectRatio::SVG_MEETORSLICE_MEET);
+ updateViewBox(FloatRect());
+ ASSERT(preserveAspectRatio());
+ preserveAspectRatio()->baseValue()->setAlign(SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMID);
+ preserveAspectRatio()->baseValue()->setMeetOrSlice(SVGPreserveAspectRatio::SVG_MEETORSLICE_MEET);
m_viewTargetString = emptyString();
}
@@ -176,7 +173,7 @@ bool SVGViewSpec::parseViewSpecInternal(const CharType* ptr, const CharType* end
float height = 0.0f;
if (!(parseNumber(ptr, end, x) && parseNumber(ptr, end, y) && parseNumber(ptr, end, width) && parseNumber(ptr, end, height, false)))
return false;
- m_viewBox->baseValue()->setValue(FloatRect(x, y, width, height));
+ updateViewBox(FloatRect(x, y, width, height));
if (ptr >= end || *ptr != ')')
return false;
ptr++;
@@ -209,7 +206,7 @@ bool SVGViewSpec::parseViewSpecInternal(const CharType* ptr, const CharType* end
if (ptr >= end || *ptr != '(')
return false;
ptr++;
- if (!m_preserveAspectRatio->baseValue()->parse(ptr, end, false))
+ if (!preserveAspectRatio()->baseValue()->parse(ptr, end, false))
return false;
if (ptr >= end || *ptr != ')')
return false;
« Source/core/svg/SVGMarkerElement.cpp ('K') | « Source/core/svg/SVGViewSpec.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698