https://bugs.webkit.org/show_bug.cgi?id=81513
Patch by Florin Malita <fmalita@google.com> on 2012-03-19
Reviewed by Dirk Schulze.
Source/WebCore:
Tests: svg/custom/svg-percent-scale-block-expected.html
svg/custom/svg-percent-scale-block.html
A couple of places still have style()->logical{Min,Max,}Height percent checks,
which do not work for SVG elements. This patch adds a virtual hasRelativeLogicalHeight()
RenderBox method to replace the explicit style checks.
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::layoutBlockChildren):
Use virtual hasRelativeLogicalHeight() instead of logical height style checks.
* rendering/RenderBox.cpp:
(WebCore::RenderBox::hasRelativeLogicalHeight):
(WebCore):
* rendering/RenderBox.h:
(RenderBox):
Add virtual hasRelativeLogicalHeight().
* rendering/RenderView.cpp:
(WebCore::RenderView::layout):
Use virtual hasRelativeLogicalHeight() instead of logical height style checks, if possible.
* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::hasRelativeLogicalHeight):
(WebCore):
* rendering/svg/RenderSVGRoot.h:
(RenderSVGRoot):
Add hasRelativeLogicalHeight() override.
LayoutTests:
* svg/custom/svg-percent-scale-block-expected.html: Added.
* svg/custom/svg-percent-scale-block.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111279
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-03-19 Florin Malita <fmalita@google.com>
+
+ Relative-height block SVG root not layed out on container height change
+ https://bugs.webkit.org/show_bug.cgi?id=81513
+
+ Reviewed by Dirk Schulze.
+
+ * svg/custom/svg-percent-scale-block-expected.html: Added.
+ * svg/custom/svg-percent-scale-block.html: Added.
+
2012-03-19 Tim Horton <timothy_horton@apple.com>
Four fast/canvas tests are flaky (fail on bots, not locally, or vice versa)
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+ <script src="../../fast/repaint/resources/repaint.js"></script>
+ <script>
+ function repaintTest()
+ {
+ document.getElementById('resize-target').style.height = '200px';
+ }
+ </script>
+</head>
+
+<body style="margin: 0; padding: 0; overflow: hidden;" onload="runRepaintTest()">
+ <div id="resize-target" style="width: 400px; height: 400px; position: absolute;"></div>
+ <div style="width: 100px; height: 100px; position: absolute; background-color: green;"></div>
+</body>
+</html>
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Test for https://bugs.webkit.org/show_bug.cgi?id=79490</title>
+ <script src="../../fast/repaint/resources/repaint.js"></script>
+ <script>
+ function repaintTest()
+ {
+ document.getElementById('resize-target').style.height = '200px';
+ }
+ </script>
+</head>
+
+<body style="margin: 0; padding: 0; overflow: hidden;" onload="runRepaintTest()">
+ <div id="resize-target" style="width: 400px; height: 400px; position: absolute;">
+ <!-- After vertical window resizing, this SVG element should not be visible -->
+ <svg width="25%" height="50%" xmlns="http://www.w3.org/2000/svg" style="display: block;">
+ <rect fill="red" width="100%" height="100%"></rect>
+ </svg>
+ </div>
+
+ <div style="width: 100px; height: 100px; position: absolute; background-color: green;"></div>
+</body>
+</html>
+2012-03-19 Florin Malita <fmalita@google.com>
+
+ Relative-height block SVG root not layed out on container height change
+ https://bugs.webkit.org/show_bug.cgi?id=81513
+
+ Reviewed by Dirk Schulze.
+
+ Tests: svg/custom/svg-percent-scale-block-expected.html
+ svg/custom/svg-percent-scale-block.html
+
+ A couple of places still have style()->logical{Min,Max,}Height percent checks,
+ which do not work for SVG elements. This patch adds a virtual hasRelativeLogicalHeight()
+ RenderBox method to replace the explicit style checks.
+
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::layoutBlockChildren):
+ Use virtual hasRelativeLogicalHeight() instead of logical height style checks.
+
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::hasRelativeLogicalHeight):
+ (WebCore):
+ * rendering/RenderBox.h:
+ (RenderBox):
+ Add virtual hasRelativeLogicalHeight().
+
+ * rendering/RenderView.cpp:
+ (WebCore::RenderView::layout):
+ Use virtual hasRelativeLogicalHeight() instead of logical height style checks, if possible.
+
+ * rendering/svg/RenderSVGRoot.cpp:
+ (WebCore::RenderSVGRoot::hasRelativeLogicalHeight):
+ (WebCore):
+ * rendering/svg/RenderSVGRoot.h:
+ (RenderSVGRoot):
+ Add hasRelativeLogicalHeight() override.
+
2012-03-19 Jer Noble <jer.noble@apple.com>
Assertion failure in RenderBlock::addChildIgnoringAnonymousColumnBlocks when running fullscreen/full-screen-twice-crash.html
// Make sure we layout children if they need it.
// FIXME: Technically percentage height objects only need a relayout if their percentage isn't going to be turned into
// an auto value. Add a method to determine this, so that we can avoid the relayout.
- RenderStyle* childStyle = child->style();
- if (relayoutChildren || ((childStyle->logicalHeight().isPercent() || childStyle->logicalMinHeight().isPercent() || childStyle->logicalMaxHeight().isPercent()) && !isRenderView()))
+ if (relayoutChildren || (child->hasRelativeLogicalHeight() && !isRenderView()))
child->setChildNeedsLayout(true, false);
// If relayoutChildren is set and the child has percentage padding or an embedded content box, we also need to invalidate the childs pref widths.
|| style()->minHeight().isPercent() || style()->minWidth().isPercent();
}
+bool RenderBox::hasRelativeLogicalHeight() const
+{
+ return style()->logicalHeight().isPercent()
+ || style()->logicalMinHeight().isPercent()
+ || style()->logicalMaxHeight().isPercent();
+}
+
} // namespace WebCore
void clearCachedSizeForOverflowClip();
virtual bool hasRelativeDimensions() const;
+ virtual bool hasRelativeLogicalHeight() const;
bool hasHorizontalLayoutOverflow() const
{
if (relayoutChildren) {
setChildNeedsLayout(true, false);
for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
- if (child->style()->logicalHeight().isPercent() || child->style()->logicalMinHeight().isPercent() || child->style()->logicalMaxHeight().isPercent())
+ if ((child->isBox() && toRenderBox(child)->hasRelativeLogicalHeight())
+ || child->style()->logicalHeight().isPercent()
+ || child->style()->logicalMinHeight().isPercent()
+ || child->style()->logicalMaxHeight().isPercent())
child->setChildNeedsLayout(true, false);
}
}
return svg->intrinsicHeight(SVGSVGElement::IgnoreCSSProperties).isPercent() || svg->intrinsicWidth(SVGSVGElement::IgnoreCSSProperties).isPercent();
}
+bool RenderSVGRoot::hasRelativeLogicalHeight() const
+{
+ SVGSVGElement* svg = static_cast<SVGSVGElement*>(node());
+ ASSERT(svg);
+
+ return svg->intrinsicHeight(SVGSVGElement::IgnoreCSSProperties).isPercent();
+}
+
}
#endif // ENABLE(SVG)
void setContainerSize(const IntSize& containerSize) { m_containerSize = containerSize; }
virtual bool hasRelativeDimensions() const;
+ virtual bool hasRelativeLogicalHeight() const;
// localToBorderBoxTransform maps local SVG viewport coordinates to local CSS box coordinates.
const AffineTransform& localToBorderBoxTransform() const { return m_localToBorderBoxTransform; }