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

Unified Diff: Source/WebCore/rendering/svg/RenderSVGRoot.cpp

Issue 9617034: Merge 109104 - Percent width/height SVG not always scaled on window resize (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1025/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/rendering/svg/RenderSVGRoot.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « Source/WebCore/rendering/svg/RenderSVGRoot.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698