Fix for <rdar://problem/
5643770> REGRESSION: Free-standing SVGs
with width and height 100% clip to 300 x 150
Though it was correct in an earlier iteration of my patch, it is
not sufficient in the final, committed version to ask if the
relativeWidthValue() or relativeHeightValue() is greater than 0
just to determine if one has been set, for, they are now
initialized to 300 and 150 respectively! This patch instead adds a
bool to keep track of whether a container size has been set, and
only used the relative value if it has.
* rendering/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::calcViewport):
* svg/SVGSVGElement.cpp:
(WebCore::SVGSVGElement::SVGSVGElement):
* svg/SVGSVGElement.h:
(WebCore::SVGSVGElement::setContainerSize):
(WebCore::SVGSVGElement::hasSetContainerSize):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@28658
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-12-12 Beth Dakin <bdakin@apple.com>
+
+ Reviewed by Oliver.
+
+ Fix for <rdar://problem/5643770> REGRESSION: Free-standing SVGs
+ with width and height 100% clip to 300 x 150
+
+ Though it was correct in an earlier iteration of my patch, it is
+ not sufficient in the final, committed version to ask if the
+ relativeWidthValue() or relativeHeightValue() is greater than 0
+ just to determine if one has been set, for, they are now
+ initialized to 300 and 150 respectively! This patch instead adds a
+ bool to keep track of whether a container size has been set, and
+ only used the relative value if it has.
+
+ * rendering/RenderSVGRoot.cpp:
+ (WebCore::RenderSVGRoot::calcViewport):
+ * svg/SVGSVGElement.cpp:
+ (WebCore::SVGSVGElement::SVGSVGElement):
+ * svg/SVGSVGElement.h:
+ (WebCore::SVGSVGElement::setContainerSize):
+ (WebCore::SVGSVGElement::hasSetContainerSize):
+
2007-12-12 Brady Eidson <beidson@apple.com>
Reviewed by Steve Falkenburg
float w, h;
SVGLength width = svg->width();
- if (width.unitType() == LengthTypePercentage && svg->relativeWidthValue() > 0)
+ if (width.unitType() == LengthTypePercentage && svg->hasSetContainerSize())
w = svg->relativeWidthValue();
else
w = width.value();
SVGLength height = svg->height();
- if (height.unitType() == LengthTypePercentage && svg->relativeHeightValue() > 0)
+ if (height.unitType() == LengthTypePercentage && svg->hasSetContainerSize())
h = svg->relativeHeightValue();
else
h = height.value();
, m_timeScheduler(new TimeScheduler(doc))
, m_viewSpec(0)
, m_containerSize(300, 150)
+ , m_hasSetContainerSize(false)
{
setWidthBaseValue(SVGLength(this, LengthModeWidth, "100%"));
setHeightBaseValue(SVGLength(this, LengthModeHeight, "100%"));
FloatRect viewport() const;
- void setContainerSize(const IntSize& containerSize) { m_containerSize = containerSize; }
+ void setContainerSize(const IntSize& containerSize) { m_containerSize = containerSize; m_hasSetContainerSize = true; }
IntSize containerSize() const { return m_containerSize; }
+ bool hasSetContainerSize() const { return m_hasSetContainerSize; }
int relativeWidthValue() const;
int relativeHeightValue() const;
FloatPoint m_translation;
mutable OwnPtr<SVGViewSpec> m_viewSpec;
IntSize m_containerSize;
+ bool m_hasSetContainerSize;
};
} // namespace WebCore