Reviewed by Oliver.
Width of SVG elements not applied to container elements
http://bugs.webkit.org/show_bug.cgi?id=16305
Added calcPrefWidths for RenderSVGRoot (copied from RenderReplaced)
This is caused by poor factoring in the render tree. RenderContainer probably should be a template.
svg/css/css-box-min-width.html
* rendering/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::calcPrefWidths): Added.
* rendering/RenderSVGRoot.h:
* css/SVGCSSStyleSelector::applySVGProperty: fixed ASSERT in debug builds
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@28755
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-12-15 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Oliver.
+
+ Width of SVG elements not applied to container elements
+ http://bugs.webkit.org/show_bug.cgi?id=16305
+
+ * platform/mac/svg/css/css-box-min-width-expected.checksum: Added.
+ * platform/mac/svg/css/css-box-min-width-expected.png: Added.
+ * platform/mac/svg/css/css-box-min-width-expected.txt: Added.
+ * svg/css/css-box-min-width.html: Added.
+
2007-12-15 Alp Toker <alp@atoker.com>
http://bugs.webkit.org/show_bug.cgi?id=16449
--- /dev/null
+658bb899a309b09540fe1d7868835e58
\ 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
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x576
+ RenderBlock (floating) {DIV} at (0,0) size 110x110 [border: (5px solid #000000)]
+ RenderSVGRoot {svg} at (13,13) size 100x100
+ RenderPath {rect} at (13,13) size 100x100 [fill={[type=SOLID] [color=#0000FF]}] [data="M0.00,0.00L100.00,0.00L100.00,100.00L0.00,100.00"]
+ RenderBlock {P} at (0,110) size 784x18
+ RenderText {#text} at (0,0) size 435x18
+ text run at (0,0) width 435: "You should see a solid 5px black border around a 100x100 blue rect."
--- /dev/null
+<html>
+<head>
+ <script type="text/javascript">
+ function draw() {
+ var NS = "http://www.w3.org/2000/svg";
+ var s = document.createElementNS(NS, "svg");
+ s.setAttribute("width", 100);
+ s.setAttribute("height", 100);
+
+ var rect = document.createElementNS(NS, "rect");
+ rect.setAttribute("width", "100%");
+ rect.setAttribute("height", "100%");
+ rect.setAttribute("fill", "blue");
+
+ s.appendChild(rect);
+
+ document.getElementById("d").appendChild(s);
+ }
+ </script>
+</head>
+
+<body onload="draw()">
+ <div style="border: 5px solid black; float: left;" id="d"></div>
+ <p style="clear: left;">You should see a solid 5px black border around a 100x100 blue rect.</p>
+</body>
+</html>
+2007-12-15 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Oliver.
+
+ Width of SVG elements not applied to container elements
+ http://bugs.webkit.org/show_bug.cgi?id=16305
+ Added calcPrefWidths for RenderSVGRoot (copied from RenderReplaced)
+ This is caused by poor factoring in the render tree. RenderContainer probably should be a template.
+
+ svg/css/css-box-min-width.html
+
+ * rendering/RenderSVGRoot.cpp:
+ (WebCore::RenderSVGRoot::calcPrefWidths): Added.
+ * rendering/RenderSVGRoot.h:
+ * css/SVGCSSStyleSelector::applySVGProperty: fixed ASSERT in debug builds
+
2007-12-15 David Kilzer <ddkilzer@apple.com>
Fix comment after isSafeScript() was renamed to allowsAccessFrom().
break;
}
+ case CSS_PROP_ENABLE_BACKGROUND:
+ // Silently ignoring this property for now
+ // http://bugs.webkit.org/show_bug.cgi?id=6022
+ break;
default:
// If you crash here, it's because you added a css property and are not handling it
// in either this switch statement or the one in CSSStyleSelector::applyProperty
calcWidth();
calcHeight();
-
+
if (checkForRepaint)
repaintAfterLayoutIfNeeded(oldBounds, oldOutlineBox);
-
+
setNeedsLayout(false);
}
return height() + marginTop() + marginBottom();
}
+void RenderSVGRoot::calcPrefWidths()
+{
+ ASSERT(prefWidthsDirty());
+
+ int width = calcReplacedWidth() + paddingLeft() + paddingRight() + borderLeft() + borderRight();
+ if (style()->width().isPercent() || (style()->width().isAuto() && style()->height().isPercent())) {
+ m_minPrefWidth = 0;
+ m_maxPrefWidth = width;
+ } else
+ m_minPrefWidth = m_maxPrefWidth = width;
+
+ setPrefWidthsDirty(false);
+}
+
void RenderSVGRoot::layout()
{
ASSERT(needsLayout());
virtual short lineHeight(bool b, bool isRootLineBox = false) const;
virtual short baselinePosition(bool b, bool isRootLineBox = false) const;
+ virtual void calcPrefWidths();
virtual void layout();
virtual void paint(PaintInfo&, int parentX, int parentY);