+2008-01-03 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Testcase for <rdar://problem/5668517> REGRESSION: Major under painting issues in SVG
+
+ * svg/custom/repaint-on-image-bounds-change-expected.checksum: Copied from LayoutTests/svg/custom/resource-client-removal-expected.checksum.
+ * svg/custom/repaint-on-image-bounds-change-expected.png: Copied from LayoutTests/svg/custom/resource-client-removal-expected.png.
+ * svg/custom/repaint-on-image-bounds-change-expected.txt: Added.
+ * svg/custom/repaint-on-image-bounds-change.svg: Added.
+
2008-01-03 Dan Bernstein <mitz@apple.com>
Reviewed by Sam Weinig.
--- /dev/null
+16310588467cfc20d551635abc59b784
\ No newline at end of file
--- /dev/null
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderSVGRoot {svg} at (0,0) size 100x100
+ RenderPath {rect} at (0,0) size 100x100 [fill={[type=SOLID] [color=#008000]}] [data="M0.00,0.00L100.00,0.00L100.00,100.00L0.00,100.00"]
+ RenderImage {image} at (0,0) size 0x0
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runRepaintTest()" >
+<script type="text/ecmascript">
+<![CDATA[
+// This is used to test that we correctly invalidate the original image bounds when the
+// image attributes are changed. A correct result will be a 100x100px green square
+function repaintTest() {
+ var target = document.getElementById("target");
+ target.setAttributeNS(null,"width", 0);
+ target.setAttributeNS(null,"height", 0);
+ target.setAttributeNS(null,"x", 50);
+ target.setAttributeNS(null,"y", 50);
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+
+}
+
+function runRepaintTest()
+{
+ if (window.layoutTestController) {
+ layoutTestController.display();
+ layoutTestController.waitUntilDone();
+ }
+ setTimeout(repaintTest, 50);
+}
+
+]]>
+</script>
+<rect x="0" y="0" width="100" height="100" fill="green" stroke="none"/>
+<image xlink:href="../../css2.1/support/swatch-red.png" id="target" x="0" y="0" width="100" height="100" />
+</svg>
\ No newline at end of file
+2008-01-03 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Fix <rdar://problem/5668517> REGRESSION: Major under painting issues in SVG (carto.net dock example)
+
+ We need to cache the absolute bounds of the <image>,
+ as there's no reliable way to recompute the old bounding
+ box one we have started layout.
+
+ * rendering/RenderSVGImage.cpp:
+ (WebCore::RenderSVGImage::layout):
+ (WebCore::RenderSVGImage::calculateAbsoluteBounds):
+ * rendering/RenderSVGImage.h:
+
2008-01-03 Alp Toker <alp@atoker.com>
Reviewed by Mark Rowe.
calcWidth();
calcHeight();
+ calculateAbsoluteBounds();
if (checkForRepaint)
repaintAfterLayoutIfNeeded(oldBounds, oldOutlineBox);
repaintRectangle(absoluteClippedOverflowRect());
}
-IntRect RenderSVGImage::absoluteClippedOverflowRect()
+void RenderSVGImage::calculateAbsoluteBounds()
{
- FloatRect repaintRect = absoluteTransform().mapRect(relativeBBox(true));
+ FloatRect absoluteRect = absoluteTransform().mapRect(relativeBBox(true));
#if ENABLE(SVG_FILTERS)
// Filters can expand the bounding box
SVGResourceFilter* filter = getFilterById(document(), SVGURIReference::getTarget(style()->svgStyle()->filter()));
if (filter)
- repaintRect.unite(filter->filterBBoxForItemBBox(repaintRect));
+ absoluteRect.unite(filter->filterBBoxForItemBBox(absoluteRect));
#endif
- if (!repaintRect.isEmpty())
- repaintRect.inflate(1); // inflate 1 pixel for antialiasing
+ if (!absoluteRect.isEmpty())
+ absoluteRect.inflate(1.5f); // inflate 1 pixel for antialiasing, 0.5 due to subpixel position or dimensions.
+
+ m_absoluteBounds = enclosingIntRect(absoluteRect);
+}
- return enclosingIntRect(repaintRect);
+IntRect RenderSVGImage::absoluteClippedOverflowRect()
+{
+ return m_absoluteBounds;
}
void RenderSVGImage::addFocusRingRects(GraphicsContext* graphicsContext, int tx, int ty)
bool calculateLocalTransform();
private:
+ void calculateAbsoluteBounds();
AffineTransform translationForAttributes();
AffineTransform m_localTransform;
float m_imageWidth;
float m_imageHeight;
+ IntRect m_absoluteBounds;
};
} // namespace WebCore