Changeset 109104 in webkit
- Timestamp:
- Feb 28, 2012 8:01:19 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r109100 r109104 1 2012-02-28 Florin Malita <fmalita@google.com> 2 3 Percent width/height SVG not always scaled on window resize 4 https://bugs.webkit.org/show_bug.cgi?id=79490 5 6 Reviewed by Nikolas Zimmermann. 7 8 * fast/repaint/percent-minheight-resize-expected.html: Added. 9 * fast/repaint/percent-minheight-resize.html: Added. 10 * svg/custom/svg-percent-scale-expected.html: Added. 11 * svg/custom/svg-percent-scale-vonly-expected.html: Added. 12 * svg/custom/svg-percent-scale-vonly.html: Added. 13 * svg/custom/svg-percent-scale.html: Added. 14 1 15 2012-02-28 Nikolas Zimmermann <nzimmermann@rim.com> 2 16 -
trunk/Source/WebCore/ChangeLog
r109102 r109104 1 2012-02-28 Florin Malita <fmalita@google.com> 2 3 Percent width/height SVG not always scaled on window resize 4 https://bugs.webkit.org/show_bug.cgi?id=79490 5 6 Reviewed by Nikolas Zimmermann. 7 8 Tests: fast/repaint/percent-minheight-resize-expected.html 9 fast/repaint/percent-minheight-resize.html 10 svg/custom/svg-percent-scale-expected.html 11 svg/custom/svg-percent-scale-vonly-expected.html 12 svg/custom/svg-percent-scale-vonly.html 13 svg/custom/svg-percent-scale.html 14 15 Fix a couple of problems preventing correct SVG scaling on window resize: 16 17 - RenderReplaced::computePreferredLogicalWidths is not SVG attribute aware and computes 18 a non-zero m_minPreferredLogicalWidth even when the SVG widh/height are percentages. 19 20 - RenderBlock::layoutInlineChildren is also not SVG attribute aware and does not trigger 21 percent height child layouts on vertical-only resizes. 22 23 * rendering/RenderBlockLineLayout.cpp: 24 (WebCore::RenderBlock::layoutInlineChildren): 25 Use hasRelativeDimensions() instead of direct width/height->isPercent tests. This also fixes 26 an HTML issue where percent {min,max}Height inline elements are not updated on vertical-only resizes. 27 28 * rendering/RenderBox.cpp: 29 (WebCore::RenderBox::hasRelativeDimensions): 30 (WebCore): 31 * rendering/RenderBox.h: 32 (RenderBox): 33 Add virtual hasRelativeDimensions() method. 34 35 * rendering/RenderReplaced.cpp: 36 (WebCore::RenderReplaced::computePreferredLogicalWidths): 37 Use hasRelativeDimensions() instead of direct width/height->isPercent tests. 38 39 * rendering/svg/RenderSVGRoot.cpp: 40 (WebCore::RenderSVGRoot::computeReplacedLogicalHeight): 41 (WebCore::RenderSVGRoot::willBeDestroyed): 42 Register percent-height SVG elements with the gPercentHeightDescendantsMap, and clean-up on destruction 43 or height unit change. 44 45 (WebCore::RenderSVGRoot::hasRelativeDimensions): 46 (WebCore): 47 * rendering/svg/RenderSVGRoot.h: 48 (RenderSVGRoot): 49 SVG-aware hasRelativeDimensions() override. 50 1 51 2012-02-28 Yury Semikhatsky <yurys@chromium.org> 2 52 -
trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp
r108933 r109104 1487 1487 RenderBox* box = toRenderBox(o); 1488 1488 1489 if (relayoutChildren || o->style()->width().isPercent() || o->style()->height().isPercent())1489 if (relayoutChildren || box->hasRelativeDimensions()) 1490 1490 o->setChildNeedsLayout(true, false); 1491 1491 -
trunk/Source/WebCore/rendering/RenderBox.cpp
r109028 r109104 3961 3961 } 3962 3962 3963 bool RenderBox::hasRelativeDimensions() const 3964 { 3965 return style()->height().isPercent() || style()->width().isPercent() 3966 || style()->maxHeight().isPercent() || style()->maxWidth().isPercent() 3967 || style()->minHeight().isPercent() || style()->minWidth().isPercent(); 3968 } 3969 3963 3970 } // namespace WebCore -
trunk/Source/WebCore/rendering/RenderBox.h
r108382 r109104 450 450 IntSize scrolledContentOffset() const; 451 451 452 virtual bool hasRelativeDimensions() const; 453 452 454 protected: 453 455 virtual void willBeDestroyed(); -
trunk/Source/WebCore/rendering/RenderReplaced.cpp
r107880 r109104 441 441 m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, style()->maxWidth().value() + (style()->boxSizing() == CONTENT_BOX ? borderAndPadding : zeroLayoutUnit)); 442 442 443 if (style()->width().isPercent() || style()->height().isPercent() 444 || style()->maxWidth().isPercent() || style()->maxHeight().isPercent() 445 || style()->minWidth().isPercent() || style()->minHeight().isPercent()) 443 if (hasRelativeDimensions()) 446 444 m_minPreferredLogicalWidth = 0; 447 445 else -
trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp
r108857 r109104 189 189 return RenderReplaced::computeReplacedLogicalHeight(); 190 190 191 if (svg->heightAttributeEstablishesViewport()) 192 return resolveLengthAttributeForSVG(svg->intrinsicHeight(SVGSVGElement::IgnoreCSSProperties), style()->effectiveZoom(), containingBlock()->availableLogicalHeight()); 191 if (svg->heightAttributeEstablishesViewport()) { 192 Length height = svg->intrinsicHeight(SVGSVGElement::IgnoreCSSProperties); 193 if (height.isPercent()) { 194 RenderBlock* cb = containingBlock(); 195 ASSERT(cb); 196 while (cb->isAnonymous()) { 197 cb = cb->containingBlock(); 198 cb->addPercentHeightDescendant(const_cast<RenderSVGRoot*>(this)); 199 } 200 } else 201 RenderBlock::removePercentHeightDescendant(const_cast<RenderSVGRoot*>(this)); 202 203 return resolveLengthAttributeForSVG(height, style()->effectiveZoom(), containingBlock()->availableLogicalHeight()); 204 } 193 205 194 206 // Only SVGs embedded in <object> reach this point. … … 276 288 void RenderSVGRoot::willBeDestroyed() 277 289 { 290 RenderBlock::removePercentHeightDescendant(const_cast<RenderSVGRoot*>(this)); 291 278 292 SVGResourcesCache::clientDestroyed(this); 279 293 RenderReplaced::willBeDestroyed(); … … 402 416 } 403 417 418 bool RenderSVGRoot::hasRelativeDimensions() const 419 { 420 SVGSVGElement* svg = static_cast<SVGSVGElement*>(node()); 421 ASSERT(svg); 422 423 return svg->intrinsicHeight(SVGSVGElement::IgnoreCSSProperties).isPercent() || svg->intrinsicWidth(SVGSVGElement::IgnoreCSSProperties).isPercent(); 424 } 425 404 426 } 405 427 -
trunk/Source/WebCore/rendering/svg/RenderSVGRoot.h
r108758 r109104 53 53 IntSize containerSize() const { return m_containerSize; } 54 54 void setContainerSize(const IntSize& containerSize) { m_containerSize = containerSize; } 55 56 virtual bool hasRelativeDimensions() const; 55 57 56 58 private:
Note: See TracChangeset
for help on using the changeset viewer.