[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.18-1-697-g2f78b87
zimmermann at webkit.org
zimmermann at webkit.org
Wed Jan 20 22:23:26 UTC 2010
The following commit has been merged in the debian/unstable branch:
commit c7a715146eeec4c762762cebb7a44a89fb4bd637
Author: zimmermann at webkit.org <zimmermann at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Jan 14 03:05:30 2010 +0000
2010-01-13 Nikolas Zimmermann <nzimmermann at rim.com>
Reviewed by Oliver Hunt.
Window size changes are not propagated down the render tree
https://bugs.webkit.org/show_bug.cgi?id=33643
Test: svg/custom/relative-sized-content.xhtml
* rendering/RenderSVGContainer.cpp: Fix incorrect markParents=true usage, leading to unnecessary relayouts.
(WebCore::RenderSVGContainer::layout): Use new layoutChildren() method.
(WebCore::RenderSVGContainer::paint): Fix indention.
* rendering/RenderSVGHiddenContainer.cpp: Fix incorrect markParents=true usage.
(WebCore::RenderSVGHiddenContainer::layout): Use new layoutChildren() helper.
* rendering/RenderSVGRoot.cpp: Refactor existing code to layout children in SVGRenderSupport::layoutChildren.
(WebCore::RenderSVGRoot::layout): Make children relayouting depend on width/height changes, if the outermost svg uses relative viewport sizes.
* rendering/SVGRenderSupport.cpp: Add central place handling child layout, skips relayouting non-relative sized children as benefit.
(WebCore::SVGRenderBase::layoutChildren): This methods contains the actual changes.
* rendering/SVGRenderSupport.h:
* svg/SVGGElement.h: Remove dead code.
* svg/SVGSVGElement.h: Make hasRelativeValues() public to remove the need for friendship declarations.
* svg/SVGStyledElement.h: Change default return value for hasRelativeValues() to false, as it was intended.
(WebCore::SVGStyledElement::hasRelativeValues): Make it public, to be usable from SVGRenderSupport.
* svg/SVGSymbolElement.h: Remove dead code.
* svg/SVGUseElement.cpp: Implement hasRelativeValues() - it was simply missing here.
(WebCore::SVGUseElement::hasRelativeValues):
* svg/SVGUseElement.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53229 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index dc8de89..e02cf74 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,20 @@
+2010-01-13 Nikolas Zimmermann <nzimmermann at rim.com>
+
+ Reviewed by Oliver Hunt.
+
+ Window size changes are not propagated down the render tree
+ https://bugs.webkit.org/show_bug.cgi?id=33643
+
+ Add svg/custom/relative-sized-content.xhtml, verifying that we're reacting on window size changes.
+ Testcase realized by putting svg content in an absolute sized <div> and resizing that dynamically.
+ The same code path is used when propagating window size changes - we can not test that directly.
+
+ * platform/mac/svg/custom/relative-sized-content-expected.checksum: Added.
+ * platform/mac/svg/custom/relative-sized-content-expected.png: Added.
+ * platform/mac/svg/custom/relative-sized-content-expected.txt: Added.
+ * svg/custom/relative-sized-content.xhtml: Added.
+ * svg/custom/use-clipped-hit.svg: Small change to avoid a timing dependency.
+
2010-01-13 Fumitoshi Ukai <ukai at chromium.org>
Unreviewed.
diff --git a/LayoutTests/platform/mac/svg/custom/relative-sized-content-expected.checksum b/LayoutTests/platform/mac/svg/custom/relative-sized-content-expected.checksum
new file mode 100644
index 0000000..e5ad06e
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/custom/relative-sized-content-expected.checksum
@@ -0,0 +1 @@
+86a0ec2bcfd54ec364e603aaadc7c1e1
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/custom/relative-sized-content-expected.png b/LayoutTests/platform/mac/svg/custom/relative-sized-content-expected.png
new file mode 100644
index 0000000..df9d740
Binary files /dev/null and b/LayoutTests/platform/mac/svg/custom/relative-sized-content-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/custom/relative-sized-content-expected.txt b/LayoutTests/platform/mac/svg/custom/relative-sized-content-expected.txt
new file mode 100644
index 0000000..f56484e
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/custom/relative-sized-content-expected.txt
@@ -0,0 +1,13 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x478
+ RenderBlock {html} at (0,0) size 800x478
+ RenderBody {body} at (8,16) size 784x454
+ RenderBlock {p} at (0,0) size 784x36
+ RenderText {#text} at (0,0) size 772x36
+ text run at (0,0) width 772: "The svg area contained in the div element (red box), should fill out the whole area (blue rectangle), especially after resizing"
+ text run at (0,18) width 209: "the content box to a different size"
+ RenderBlock {div} at (0,52) size 402x402 [border: (1px solid #FF0000)]
+ RenderSVGRoot {svg} at (9,69) size 400x400
+ RenderPath {rect} at (9,69) size 400x400 [fill={[type=SOLID] [color=#0000FF]}] [data="M0.00,0.00 L400.00,0.00 L400.00,400.00 L0.00,400.00 Z"]
+ RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/svg/custom/relative-sized-content.xhtml b/LayoutTests/svg/custom/relative-sized-content.xhtml
new file mode 100644
index 0000000..f4830d8
--- /dev/null
+++ b/LayoutTests/svg/custom/relative-sized-content.xhtml
@@ -0,0 +1,20 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<body onload="window.setTimeout(resizeBox, 0)">
+ <p>The svg area contained in the div element (red box), should fill out the whole area (blue rectangle), especially after resizing the content box to a different size</p>
+ <div id="contentBox" style="width: 100px; height: 400px; border: 1px solid red;">
+ <svg xmlns="http://www.w3.org/2000/svg">
+ <rect id="targetRect" width="100%" height="100%" fill="blue"/>
+ </svg>
+ </div>
+ <script type="JavaScript">
+ if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+ function resizeBox() {
+ document.getElementById("contentBox").style.setProperty("width", "400px");
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+ }
+ </script>
+</body>
+</html>
diff --git a/LayoutTests/svg/custom/use-clipped-hit.svg b/LayoutTests/svg/custom/use-clipped-hit.svg
index 7f4ea9a..d64e9ec 100644
--- a/LayoutTests/svg/custom/use-clipped-hit.svg
+++ b/LayoutTests/svg/custom/use-clipped-hit.svg
@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
-<svg version="1.1" baseProfile="basic" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="svg-root" width="100%" height="100%" onload="runTest()">
+<svg version="1.1" baseProfile="basic" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="svg-root" width="100%" height="100%" onload="setTimeout(runTest, 0)">
<script type="text/ecmascript"><![CDATA[
+ if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
var states = [];
var clicked;
function testClickAt(x, y) {
@@ -30,6 +32,8 @@
document.getElementById("status").textContent = "Failed";
if (checkResults())
document.getElementById("status").textContent = "Passed";
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
} else {
// in manual mode
alert("Please use run-webkit-tests.");
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e2feca7..0f42c68 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,31 @@
+2010-01-13 Nikolas Zimmermann <nzimmermann at rim.com>
+
+ Reviewed by Oliver Hunt.
+
+ Window size changes are not propagated down the render tree
+ https://bugs.webkit.org/show_bug.cgi?id=33643
+
+ Test: svg/custom/relative-sized-content.xhtml
+
+ * rendering/RenderSVGContainer.cpp: Fix incorrect markParents=true usage, leading to unnecessary relayouts.
+ (WebCore::RenderSVGContainer::layout): Use new layoutChildren() method.
+ (WebCore::RenderSVGContainer::paint): Fix indention.
+ * rendering/RenderSVGHiddenContainer.cpp: Fix incorrect markParents=true usage.
+ (WebCore::RenderSVGHiddenContainer::layout): Use new layoutChildren() helper.
+ * rendering/RenderSVGRoot.cpp: Refactor existing code to layout children in SVGRenderSupport::layoutChildren.
+ (WebCore::RenderSVGRoot::layout): Make children relayouting depend on width/height changes, if the outermost svg uses relative viewport sizes.
+ * rendering/SVGRenderSupport.cpp: Add central place handling child layout, skips relayouting non-relative sized children as benefit.
+ (WebCore::SVGRenderBase::layoutChildren): This methods contains the actual changes.
+ * rendering/SVGRenderSupport.h:
+ * svg/SVGGElement.h: Remove dead code.
+ * svg/SVGSVGElement.h: Make hasRelativeValues() public to remove the need for friendship declarations.
+ * svg/SVGStyledElement.h: Change default return value for hasRelativeValues() to false, as it was intended.
+ (WebCore::SVGStyledElement::hasRelativeValues): Make it public, to be usable from SVGRenderSupport.
+ * svg/SVGSymbolElement.h: Remove dead code.
+ * svg/SVGUseElement.cpp: Implement hasRelativeValues() - it was simply missing here.
+ (WebCore::SVGUseElement::hasRelativeValues):
+ * svg/SVGUseElement.h:
+
2010-01-13 Fumitoshi Ukai <ukai at chromium.org>
Reviewed by David Levin.
diff --git a/WebCore/rendering/RenderSVGContainer.cpp b/WebCore/rendering/RenderSVGContainer.cpp
index 8e82f53..5adeb8d 100644
--- a/WebCore/rendering/RenderSVGContainer.cpp
+++ b/WebCore/rendering/RenderSVGContainer.cpp
@@ -26,14 +26,11 @@
#if ENABLE(SVG)
#include "RenderSVGContainer.h"
-#include "AXObjectCache.h"
-#include "FloatQuad.h"
#include "GraphicsContext.h"
#include "RenderView.h"
#include "SVGRenderSupport.h"
#include "SVGResourceFilter.h"
#include "SVGStyledElement.h"
-#include "SVGURIReference.h"
namespace WebCore {
@@ -63,17 +60,7 @@ void RenderSVGContainer::layout()
LayoutRepainter repainter(*this, checkForRepaintDuringLayout() || selfWillPaint());
calculateLocalTransform(); // Allow RenderSVGTransformableContainer to update its transform
- for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
- // Only force our kids to layout if we're being asked to relayout as a result of a parent changing
- // FIXME: We should be able to skip relayout of non-relative kids when only bounds size has changed
- // that's a possible future optimization using LayoutState
- // http://bugs.webkit.org/show_bug.cgi?id=15391
- if (selfNeedsLayout())
- child->setNeedsLayout(true);
-
- child->layoutIfNeeded();
- ASSERT(!child->needsLayout());
- }
+ layoutChildren(this, selfNeedsLayout());
repainter.repaintAfterLayout();
setNeedsLayout(false);
@@ -95,7 +82,7 @@ void RenderSVGContainer::paint(PaintInfo& paintInfo, int, int)
if (paintInfo.context->paintingDisabled() || !drawsContents())
return;
- // Spec: groups w/o children still may render filter content.
+ // Spec: groups w/o children still may render filter content.
if (!firstChild() && !selfWillPaint())
return;
@@ -198,5 +185,3 @@ bool RenderSVGContainer::nodeAtFloatPoint(const HitTestRequest& request, HitTest
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/rendering/RenderSVGHiddenContainer.cpp b/WebCore/rendering/RenderSVGHiddenContainer.cpp
index d4b39d3..bb0a15d 100644
--- a/WebCore/rendering/RenderSVGHiddenContainer.cpp
+++ b/WebCore/rendering/RenderSVGHiddenContainer.cpp
@@ -38,17 +38,7 @@ RenderSVGHiddenContainer::RenderSVGHiddenContainer(SVGStyledElement* element)
void RenderSVGHiddenContainer::layout()
{
ASSERT(needsLayout());
-
- // Layout our kids to prevent a kid from being marked as needing layout
- // then never being asked to layout.
- for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
- if (selfNeedsLayout())
- child->setNeedsLayout(true);
-
- child->layoutIfNeeded();
- ASSERT(!child->needsLayout());
- }
-
+ layoutChildren(this, selfNeedsLayout());
setNeedsLayout(false);
}
diff --git a/WebCore/rendering/RenderSVGRoot.cpp b/WebCore/rendering/RenderSVGRoot.cpp
index be8cef9..1224699 100644
--- a/WebCore/rendering/RenderSVGRoot.cpp
+++ b/WebCore/rendering/RenderSVGRoot.cpp
@@ -86,23 +86,20 @@ void RenderSVGRoot::layout()
LayoutRepainter repainter(*this, checkForRepaintDuringLayout() && selfNeedsLayout());
+ int oldWidth = width();
calcWidth();
+
+ int oldHeight = height();
calcHeight();
SVGSVGElement* svg = static_cast<SVGSVGElement*>(node());
setWidth(static_cast<int>(width() * svg->currentScale()));
setHeight(static_cast<int>(height() * svg->currentScale()));
-
calcViewport();
-
- for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
- if (selfNeedsLayout()) // either bounds or transform changed, force kids to relayout
- child->setNeedsLayout(true, false);
-
- child->layoutIfNeeded();
- ASSERT(!child->needsLayout());
- }
+ // RenderSVGRoot needs to take special care to propagate window size changes to the children,
+ // if the outermost <svg> is using relative x/y/width/height values. Hence the additonal parameters.
+ layoutChildren(this, selfNeedsLayout() || (svg->hasRelativeValues() && (width() != oldWidth || height() != oldHeight)));
repainter.repaintAfterLayout();
view()->enableLayoutState();
@@ -315,5 +312,3 @@ bool RenderSVGRoot::nodeAtPoint(const HitTestRequest& request, HitTestResult& re
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/rendering/SVGRenderSupport.cpp b/WebCore/rendering/SVGRenderSupport.cpp
index 49908d3..1dfd1cf 100644
--- a/WebCore/rendering/SVGRenderSupport.cpp
+++ b/WebCore/rendering/SVGRenderSupport.cpp
@@ -240,6 +240,29 @@ FloatRect SVGRenderBase::computeContainerBoundingBox(const RenderObject* contain
return boundingBox;
}
+void SVGRenderBase::layoutChildren(RenderObject* start, bool selfNeedsLayout)
+{
+ for (RenderObject* child = start->firstChild(); child; child = child->nextSibling()) {
+ // Only force our kids to layout if we're being asked to relayout as a result of a parent changing
+ // FIXME: We should be able to skip relayout of non-relative kids when only bounds size has changed
+ // that's a possible future optimization using LayoutState
+ // http://bugs.webkit.org/show_bug.cgi?id=15391
+ bool needsLayout = selfNeedsLayout;
+ if (!needsLayout) {
+ if (SVGElement* element = child->node()->isSVGElement() ? static_cast<SVGElement*>(child->node()) : 0) {
+ if (element->isStyled())
+ needsLayout = static_cast<SVGStyledElement*>(element)->hasRelativeValues();
+ }
+ }
+
+ if (needsLayout)
+ child->setNeedsLayout(true, false);
+
+ child->layoutIfNeeded();
+ ASSERT(!child->needsLayout());
+ }
+}
+
FloatRect SVGRenderBase::filterBoundingBoxForRenderer(const RenderObject* object) const
{
#if ENABLE(FILTERS)
diff --git a/WebCore/rendering/SVGRenderSupport.h b/WebCore/rendering/SVGRenderSupport.h
index 9ea66e3..0804ede 100644
--- a/WebCore/rendering/SVGRenderSupport.h
+++ b/WebCore/rendering/SVGRenderSupport.h
@@ -48,6 +48,9 @@ namespace WebCore {
static bool prepareToRenderSVGContent(RenderObject*, RenderObject::PaintInfo&, const FloatRect& boundingBox, SVGResourceFilter*&, SVGResourceFilter* rootFilter = 0);
static void finishRenderSVGContent(RenderObject*, RenderObject::PaintInfo&, SVGResourceFilter*&, GraphicsContext* savedContext);
+ // Layout all children of the passed render object
+ static void layoutChildren(RenderObject*, bool selfNeedsLayout);
+
virtual FloatRect strokeBoundingBox() const { return FloatRect(); }
virtual FloatRect markerBoundingBox() const { return FloatRect(); }
diff --git a/WebCore/svg/SVGGElement.h b/WebCore/svg/SVGGElement.h
index 9cfb5a3..677f0df 100644
--- a/WebCore/svg/SVGGElement.h
+++ b/WebCore/svg/SVGGElement.h
@@ -50,9 +50,6 @@ namespace WebCore {
ANIMATED_PROPERTY_DECLARATIONS(SVGGElement, SVGExternalResourcesRequiredIdentifier,
SVGNames::externalResourcesRequiredAttrString, bool,
ExternalResourcesRequired, externalResourcesRequired)
-
- friend class SVGUseElement;
- TransformationMatrix localMatrix() const;
};
} // namespace WebCore
diff --git a/WebCore/svg/SVGSVGElement.h b/WebCore/svg/SVGSVGElement.h
index 51eb4f6..c956712 100644
--- a/WebCore/svg/SVGSVGElement.h
+++ b/WebCore/svg/SVGSVGElement.h
@@ -130,13 +130,8 @@ namespace WebCore {
void inheritViewAttributes(SVGViewElement*);
- protected:
- friend class RenderSVGRoot;
- friend class RenderSVGViewportContainer;
-
- virtual bool hasRelativeValues() const;
-
bool isOutermostSVG() const;
+ virtual bool hasRelativeValues() const;
private:
ANIMATED_PROPERTY_DECLARATIONS(SVGSVGElement, SVGNames::svgTagString, SVGNames::xAttrString, SVGLength, X, x)
diff --git a/WebCore/svg/SVGStyledElement.h b/WebCore/svg/SVGStyledElement.h
index 7542d61..f8055f6 100644
--- a/WebCore/svg/SVGStyledElement.h
+++ b/WebCore/svg/SVGStyledElement.h
@@ -38,7 +38,8 @@ namespace WebCore {
public:
SVGStyledElement(const QualifiedName&, Document*);
virtual ~SVGStyledElement();
-
+
+ virtual bool hasRelativeValues() const { return false; }
virtual bool isStyled() const { return true; }
virtual bool supportsMarkers() const { return false; }
@@ -66,10 +67,8 @@ namespace WebCore {
virtual void detach();
void setInstanceUpdatesBlocked(bool);
-
- protected:
- virtual bool hasRelativeValues() const { return true; }
-
+
+ protected:
static int cssPropertyIdForSVGAttributeName(const QualifiedName&);
private:
diff --git a/WebCore/svg/SVGSymbolElement.h b/WebCore/svg/SVGSymbolElement.h
index 5c68202..582f37f 100644
--- a/WebCore/svg/SVGSymbolElement.h
+++ b/WebCore/svg/SVGSymbolElement.h
@@ -38,8 +38,6 @@ namespace WebCore {
virtual ~SVGSymbolElement();
virtual void parseMappedAttribute(MappedAttribute*);
- virtual bool shouldAttachChild(Element*) const { return false; }
-
virtual bool rendererIsNeeded(RenderStyle*) { return false; }
private:
diff --git a/WebCore/svg/SVGUseElement.cpp b/WebCore/svg/SVGUseElement.cpp
index 14ec7fd..9abddc1 100644
--- a/WebCore/svg/SVGUseElement.cpp
+++ b/WebCore/svg/SVGUseElement.cpp
@@ -886,6 +886,11 @@ void SVGUseElement::transferUseAttributesToReplacedElement(SVGElement* from, SVG
ASSERT(ec == 0);
}
+bool SVGUseElement::hasRelativeValues() const
+{
+ return x().isRelative() || y().isRelative() || width().isRelative() || height().isRelative();
+}
+
}
#endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGUseElement.h b/WebCore/svg/SVGUseElement.h
index 45ca783..5a17105 100644
--- a/WebCore/svg/SVGUseElement.h
+++ b/WebCore/svg/SVGUseElement.h
@@ -67,6 +67,8 @@ namespace WebCore {
SVGElementInstance* instanceForShadowTreeElement(Node* element) const;
private:
+ virtual bool hasRelativeValues() const;
+
ANIMATED_PROPERTY_DECLARATIONS(SVGUseElement, SVGNames::useTagString, SVGNames::xAttrString, SVGLength, X, x)
ANIMATED_PROPERTY_DECLARATIONS(SVGUseElement, SVGNames::useTagString, SVGNames::yAttrString, SVGLength, Y, y)
ANIMATED_PROPERTY_DECLARATIONS(SVGUseElement, SVGNames::useTagString, SVGNames::widthAttrString, SVGLength, Width, width)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list