Index: Source/WebCore/rendering/svg/RenderSVGRoot.cpp |
=================================================================== |
--- Source/WebCore/rendering/svg/RenderSVGRoot.cpp (revision 109989) |
+++ Source/WebCore/rendering/svg/RenderSVGRoot.cpp (working copy) |
@@ -188,9 +188,21 @@ |
if (hasReplacedLogicalHeight()) |
return RenderReplaced::computeReplacedLogicalHeight(); |
- if (svg->heightAttributeEstablishesViewport()) |
- return resolveLengthAttributeForSVG(svg->intrinsicHeight(SVGSVGElement::IgnoreCSSProperties), style()->effectiveZoom(), containingBlock()->availableLogicalHeight()); |
+ if (svg->heightAttributeEstablishesViewport()) { |
+ Length height = svg->intrinsicHeight(SVGSVGElement::IgnoreCSSProperties); |
+ if (height.isPercent()) { |
+ RenderBlock* cb = containingBlock(); |
+ ASSERT(cb); |
+ while (cb->isAnonymous()) { |
+ cb = cb->containingBlock(); |
+ cb->addPercentHeightDescendant(const_cast<RenderSVGRoot*>(this)); |
+ } |
+ } else |
+ RenderBlock::removePercentHeightDescendant(const_cast<RenderSVGRoot*>(this)); |
+ return resolveLengthAttributeForSVG(height, style()->effectiveZoom(), containingBlock()->availableLogicalHeight()); |
+ } |
+ |
// Only SVGs embedded in <object> reach this point. |
ASSERT(isEmbeddedThroughFrameContainingSVGDocument()); |
return document()->frame()->ownerRenderer()->availableLogicalHeight(); |
@@ -271,6 +283,8 @@ |
void RenderSVGRoot::willBeDestroyed() |
{ |
+ RenderBlock::removePercentHeightDescendant(const_cast<RenderSVGRoot*>(this)); |
+ |
SVGResourcesCache::clientDestroyed(this); |
RenderReplaced::willBeDestroyed(); |
} |
@@ -397,6 +411,14 @@ |
return false; |
} |
+bool RenderSVGRoot::hasRelativeDimensions() const |
+{ |
+ SVGSVGElement* svg = static_cast<SVGSVGElement*>(node()); |
+ ASSERT(svg); |
+ |
+ return svg->intrinsicHeight(SVGSVGElement::IgnoreCSSProperties).isPercent() || svg->intrinsicWidth(SVGSVGElement::IgnoreCSSProperties).isPercent(); |
} |
+} |
+ |
#endif // ENABLE(SVG) |